From 712c455633e801232716e0c9c7de07242fa7dd29 Mon Sep 17 00:00:00 2001 From: Iristyle Date: Wed, 8 Nov 2017 22:39:12 -0800 Subject: [PATCH 1/3] (MODULES-5968) Remove LCM code / tests - Additionally remove references to both stdlib and powershell modules as dependencies. The LCM config manifest wsa the only thing using these modules, and without it, they can be removed! --- .fixtures.yml | 2 - README.md | 14 ------ manifests/lcm_config.pp | 14 ------ metadata.json | 8 --- spec/defines/lcm_config_spec.rb | 47 ----------------- templates/set-lcm-mode.ps1.erb | 50 ------------------- .../pre-suite/02_dsc_module_install.rb | 2 - .../basic_functionality/allow_lcm_modes.rb | 46 ----------------- .../pre-suite/01_dsc_module_install.rb | 2 - tests/lib/dsc_utils.rb | 32 ------------ 10 files changed, 217 deletions(-) delete mode 100644 manifests/lcm_config.pp delete mode 100644 spec/defines/lcm_config_spec.rb delete mode 100644 templates/set-lcm-mode.ps1.erb delete mode 100755 tests/acceptance/tests/basic_functionality/allow_lcm_modes.rb diff --git a/.fixtures.yml b/.fixtures.yml index e8dabe93..e462b975 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -1,7 +1,5 @@ fixtures: forge_modules: - stdlib: "puppetlabs/stdlib" - powershell: "puppetlabs/powershell" reboot: "puppetlabs/reboot" symlinks: "dsc": "#{source_dir}" diff --git a/README.md b/README.md index 877f4d35..7c244a3b 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,6 @@ * [Setting Registry Values](#setting-registry-values) * [Adding or Removing Windows Features](#adding-or-removing-windows-features) * [Website Installation Example](#website-installation-example) - * [Optionally Configure the DSC LCM RefreshMode](#optionally-configure-the-dsc-lcm-refreshmode) 5. [Reference](#reference) 6. [Limitations](#limitations) * [Known Issues](#known-issues) @@ -336,18 +335,6 @@ class fourthcoffee( As you can see, you can mix and match DSC resources with common Puppet resources. All [Puppet metaparameters](https://docs.puppet.com/references/latest/metaparameter.html) are also supported. -### Optionally Configure the DSC LCM RefreshMode - -*WARNING* The dsc::lcm_config class will be removed in the v1.5 release of this module - -Prior to the WMF5 Production Preview, the DSC Local Configuration Manager (LCM) `RefreshMode` had to be set to `'Disabled'` for the module to work. That limitation has been removed in the [WMF 5 Production Preview][wmf5-blog-post], but the module still supports configuring this setting if you wish to change it. - -~~~puppet -dsc::lcm_config {'disable_lcm': - refresh_mode => 'Disabled', -} -~~~ - ## Reference ### Types @@ -454,7 +441,6 @@ Where available, a link to the external GitHub repo of each resource is also inc While there are avenues for using Puppet with a non-administrative account, DSC is limited to only accounts with administrative privileges. The underlying CIM implementation DSC uses for DSC Resource invocation requires administrative credentials to function. -- Setting the LCM RefreshMode to Disabled requires administrative credentials - Using the Invoke-DscResource cmdlet requires administrative credentials The Puppet agent on a Windows node can run DSC with a normal default install. If the Puppet agent was configured to use an alternate user account, that account must have administrative privileges on the system in order to run DSC. diff --git a/manifests/lcm_config.pp b/manifests/lcm_config.pp deleted file mode 100644 index 25bebad5..00000000 --- a/manifests/lcm_config.pp +++ /dev/null @@ -1,14 +0,0 @@ -define dsc::lcm_config ( - $refresh_mode = 'Disabled' -) { - - warning('The dsc::lcm_config class will be removed in the v1.5 release of this module') - - validate_re($refresh_mode, '^(Disabled|Push)$', 'refresh_mode must be one of \'Disabled\', \'Push\'') - - exec { "dsc_provider_set_lcm_refreshmode_${refresh_mode}": - provider => 'powershell', - onlyif => "if ((Get-DscLocalConfigurationManager).RefreshMode -eq '${refresh_mode}') {exit 1} else {exit 0}", - command => template('dsc/set-lcm-mode.ps1.erb'), - } -} diff --git a/metadata.json b/metadata.json index bc66bcd8..444effed 100644 --- a/metadata.json +++ b/metadata.json @@ -33,14 +33,6 @@ } ], "dependencies": [ - { - "name": "puppetlabs/stdlib", - "version_requirement": ">= 2.3.0 < 5.0.0" - }, - { - "name": "puppetlabs/powershell", - "version_requirement": ">= 1.0.1 < 3.0.0" - }, { "name": "puppetlabs/reboot", "version_requirement": ">= 1.2.1 < 2.0.0" diff --git a/spec/defines/lcm_config_spec.rb b/spec/defines/lcm_config_spec.rb deleted file mode 100644 index fb1baa20..00000000 --- a/spec/defines/lcm_config_spec.rb +++ /dev/null @@ -1,47 +0,0 @@ -require 'spec_helper' - -RSpec.describe 'dsc::lcm_config', :type => :define do - - context 'refresh_mode should default to Disabled' do - let (:title) { 'lcm_default' } - - it { - should contain_dsc__lcm_config(title).with( - { - 'refresh_mode' => 'Disabled' - } - ) - } - end - - ['Disabled', 'Push'].each do |mode| - context "when refresh_mode => #{mode}" do - let (:title) { "lcm_#{mode}" } - let (:params) { {:refresh_mode => mode} } - - it {should compile} - - it { - should contain_dsc__lcm_config(title).with( - { - 'refresh_mode' => mode - } - ) - } - end - end - - ['disabled', 'push', 'pull', 'Pull', 'foo', 'bar'].each do |mode| - context "when refresh_mode => #{mode}" do - let (:title) { "lcm_#{mode}" } - let (:params) { {:refresh_mode => mode} } - - it {should_not compile} - - let (:error_message) { /refresh_mode must be one of/} - it { - expect { catalogue }.to raise_error(Puppet::Error, error_message) - } - end - end -end diff --git a/templates/set-lcm-mode.ps1.erb b/templates/set-lcm-mode.ps1.erb deleted file mode 100644 index 3f433bcd..00000000 --- a/templates/set-lcm-mode.ps1.erb +++ /dev/null @@ -1,50 +0,0 @@ -$lcmRefreshMode = '<%= @refresh_mode %>' -$generationDate = (Get-Date -Format 'M/d/yyyy HH:mm:ss') -$encoding = [Text.Encoding]::UTF8 -$namespace = 'root/Microsoft/Windows/DesiredStateConfiguration' -$className = 'MSFT_DSCLocalConfigurationManager' -$generationHost = [Environment]::MachineName - -$mofData = @" -/* -@TargetNode=''localhost'' -@GeneratedBy=PUPPET -@GenerationDate=$generationDate -@GenerationHost=$generationHost -*/ - -instance of MSFT_DSCMetaConfiguration as `$MSFT_DSCMetaConfiguration1ref -{ -RefreshMode = "$lcmRefreshMode"; -}; - -instance of OMI_ConfigurationDocument -{ -Version="2.0.0"; -MinimumCompatibleVersion = "1.0.0"; -CompatibleVersionAdditionalProperties= { "MSFT_DSCMetaConfiguration:StatusRetentionTimeInDays" }; -Author="PUPPET"; -GenerationDate="$generationDate"; -GenerationHost="$generationHost"; -Name="LCMSettings"; -}; -"@ - -$totalSize = [BitConverter]::GetBytes($mofData.Length + 4) -$bytes = $totalSize + $encoding.GetBytes($mofData) - -$cimClass = Get-CimClass -Namespace $namespace -ClassName $className -$sessionOptions = New-CimSessionOption -Protocol Wsman -$wsmanSession = New-CimSession -ComputerName localhost -SessionOption $sessionOptions - -$invokeParams = @{ - Verbose = $true - CimClass = $cimClass - CimSession = $wsmanSession - MethodName = 'SendMetaConfigurationApply' - Arguments = @{ - ConfigurationData = $bytes; - } -} - -Invoke-CimMethod @invokeParams diff --git a/tests/acceptance/pre-suite/02_dsc_module_install.rb b/tests/acceptance/pre-suite/02_dsc_module_install.rb index 78d5c140..c31f8da8 100755 --- a/tests/acceptance/pre-suite/02_dsc_module_install.rb +++ b/tests/acceptance/pre-suite/02_dsc_module_install.rb @@ -20,8 +20,6 @@ end else step 'Install DSC Module Dependencies' - on(agent, puppet('module install puppetlabs-stdlib')) - on(agent, puppet('module install puppetlabs-powershell')) on(agent, puppet('module install puppetlabs-reboot')) step 'Install DSC Module from Local Source' diff --git a/tests/acceptance/tests/basic_functionality/allow_lcm_modes.rb b/tests/acceptance/tests/basic_functionality/allow_lcm_modes.rb deleted file mode 100755 index c88eab83..00000000 --- a/tests/acceptance/tests/basic_functionality/allow_lcm_modes.rb +++ /dev/null @@ -1,46 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2480 - C89505 - Apply DSC Manifest with LCM refresh mode set to Push' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'file' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_destinationpath => 'C:\test.file', - :dsc_contents => 'Cats go meow!', -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -teardown do - step 'Disable LCM on Windows Agents' - configure_lcm(agents, refresh_mode = 'Disabled') -end - -# Setup -step 'Enable LCM on Windows Agents' -configure_lcm(agents, refresh_mode = 'Push') - -# Tests -agents.each do |agent| - step 'Attempt to Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => 0) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - assert_dsc_resource( - agent, - 'File', - 'PSDesiredStateConfiguration', - :DestinationPath => 'C:\test.file', - :Contents => 'Cats go meow!' - ) -end diff --git a/tests/integration/pre-suite/01_dsc_module_install.rb b/tests/integration/pre-suite/01_dsc_module_install.rb index 787185ac..f0e719e1 100755 --- a/tests/integration/pre-suite/01_dsc_module_install.rb +++ b/tests/integration/pre-suite/01_dsc_module_install.rb @@ -14,8 +14,6 @@ install_dev_puppet_module_on(master, staging) else step 'Install DSC Module Dependencies' - on(master, puppet('module install puppetlabs-stdlib')) - on(master, puppet('module install puppetlabs-powershell')) on(master, puppet('module install puppetlabs-reboot')) step 'Install DSC Module from Local Source' diff --git a/tests/lib/dsc_utils.rb b/tests/lib/dsc_utils.rb index 3e89acfa..e27c19ff 100755 --- a/tests/lib/dsc_utils.rb +++ b/tests/lib/dsc_utils.rb @@ -223,38 +223,6 @@ def uninstall_fake_reboot_resource(host) end end -# Configure the DSC LCM on a host. -# -# ==== Attributes -# -# * +hosts+ - A Windows Beaker host(s) running PowerShell DSC. -# * +refresh_mode+ - The desired LCM refresh mode. (Disabled, Push, Pull) -# -# ==== Returns -# -# +nil+ -# -# ==== Raises -# -# +nil+ -# -# ==== Examples -# -# configure_lcm(agents, 'Disabled') -def configure_lcm(hosts, refresh_mode = 'Disabled') - # Init - dsc_conf_manifest = <<-MANIFEST - dsc::lcm_config {'configure_lcm': - refresh_mode => '#{refresh_mode}' - } - MANIFEST - - # Configure - on(hosts, puppet('apply'), :stdin => dsc_conf_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Failed to configure the DSC LCM!') - end -end - # Build a PowerShell DSC command string. # # ==== Attributes From f7b15d7bd226526e69e9d5211c5a15ec43ee9a88 Mon Sep 17 00:00:00 2001 From: James Pogran Date: Wed, 1 Nov 2017 11:55:47 -0400 Subject: [PATCH 2/3] (MODULES-5968) Remove generated + vendored types - Remove all the generated types from lib/puppet/type/dsc_* and their corresponding specs from spec/unit/puppet/type/dsc_*. - Remove all vendored content inside of lib/puppet_x/dsc_resources/, except for xService in xPSDesiredStateConfiguration. xService is used in an acceptance test that may need to have a more generic equivalent built. - Remove most acceptance tests on basic dsc resources that won't be part of this module any longer from tests/acceptance/tests/, tests/integration/tests/ and corresponding test fixture data from tests/files/test_installer/ and tests/manifests/. More generic tests that use dsc_file were left (for now). - Exceptions: * Leave dsc_file.rb type for now to allow specs to pass. * Leave dsc_service.rb and dsc_xservice.rb to allow acceptance tests to pass. --- lib/puppet/type/dsc_archive.rb | 187 -- lib/puppet/type/dsc_auditpolicycsv.rb | 103 - lib/puppet/type/dsc_auditpolicyoption.rb | 108 - lib/puppet/type/dsc_auditpolicysubcategory.rb | 125 - lib/puppet/type/dsc_environment.rb | 135 - lib/puppet/type/dsc_group.rb | 189 -- lib/puppet/type/dsc_log.rb | 82 - lib/puppet/type/dsc_officeonlineserverfarm.rb | 891 ------ .../type/dsc_officeonlineserverinstall.rb | 105 - .../type/dsc_officeonlineservermachine.rb | 123 - lib/puppet/type/dsc_package.rb | 295 -- lib/puppet/type/dsc_registry.rb | 189 -- lib/puppet/type/dsc_runbookdirectory.rb | 157 - lib/puppet/type/dsc_script.rb | 149 - lib/puppet/type/dsc_securitysetting.rb | 462 --- lib/puppet/type/dsc_securitytemplate.rb | 103 - lib/puppet/type/dsc_smavariable.rb | 186 -- lib/puppet/type/dsc_spaccessserviceapp.rb | 151 - lib/puppet/type/dsc_spaccessservices2010.rb | 136 - lib/puppet/type/dsc_spalternateurl.rb | 156 - lib/puppet/type/dsc_spantivirussettings.rb | 186 -- lib/puppet/type/dsc_spappcatalog.rb | 101 - lib/puppet/type/dsc_spappdomain.rb | 116 - .../type/dsc_spappmanagementserviceapp.rb | 181 -- lib/puppet/type/dsc_spappstoresettings.rb | 133 - lib/puppet/type/dsc_spbcsserviceapp.rb | 166 -- lib/puppet/type/dsc_spblobcachesettings.rb | 203 -- lib/puppet/type/dsc_spcacheaccounts.rb | 147 - lib/puppet/type/dsc_spconfigwizard.rb | 149 - lib/puppet/type/dsc_spcontentdatabase.rb | 203 -- lib/puppet/type/dsc_spcreatefarm.rb | 219 -- lib/puppet/type/dsc_spdatabaseaag.rb | 151 - lib/puppet/type/dsc_spdesignersettings.rb | 231 -- .../type/dsc_spdiagnosticloggingsettings.rb | 389 --- .../type/dsc_spdistributedcacheservice.rb | 188 -- lib/puppet/type/dsc_spexcelserviceapp.rb | 463 --- lib/puppet/type/dsc_spfarm.rb | 253 -- lib/puppet/type/dsc_spfarmadministrators.rb | 155 - lib/puppet/type/dsc_spfarmpropertybag.rb | 136 - lib/puppet/type/dsc_spfarmsolution.rb | 203 -- lib/puppet/type/dsc_spfeature.rb | 171 -- .../type/dsc_sphealthanalyzerrulestate.rb | 169 -- lib/puppet/type/dsc_spinstall.rb | 150 - lib/puppet/type/dsc_spinstalllanguagepack.rb | 164 - lib/puppet/type/dsc_spinstallprereqs.rb | 376 --- lib/puppet/type/dsc_spirmsettings.rb | 137 - lib/puppet/type/dsc_spjoinfarm.rb | 152 - .../dsc_spmachinetranslationserviceapp.rb | 166 -- lib/puppet/type/dsc_spmanagedaccount.rb | 188 -- .../type/dsc_spmanagedmetadataserviceapp.rb | 214 -- lib/puppet/type/dsc_spmanagedpath.rb | 170 -- .../type/dsc_spofficeonlineserverbinding.rb | 139 - .../type/dsc_spoutgoingemailsettings.rb | 195 -- .../type/dsc_sppasswordchangesettings.rb | 155 - .../type/dsc_spperformancepointserviceapp.rb | 181 -- .../dsc_sppowerpointautomationserviceapp.rb | 241 -- lib/puppet/type/dsc_spproductupdate.rb | 180 -- .../type/dsc_sppublishserviceapplication.rb | 121 - lib/puppet/type/dsc_spquotatemplate.rb | 193 -- lib/puppet/type/dsc_spremotefarmtrust.rb | 151 - .../type/dsc_spsearchauthoritativepage.rb | 171 -- lib/puppet/type/dsc_spsearchcontentsource.rb | 345 --- .../type/dsc_spsearchcrawlerimpactrule.rb | 189 -- lib/puppet/type/dsc_spsearchcrawlmapping.rb | 153 - lib/puppet/type/dsc_spsearchcrawlrule.rb | 231 -- lib/puppet/type/dsc_spsearchfiletype.rb | 184 -- lib/puppet/type/dsc_spsearchindexpartition.rb | 154 - lib/puppet/type/dsc_spsearchresultsource.rb | 184 -- lib/puppet/type/dsc_spsearchserviceapp.rb | 244 -- lib/puppet/type/dsc_spsearchtopology.rb | 224 -- .../type/dsc_spsecurestoreserviceapp.rb | 296 -- lib/puppet/type/dsc_spserviceapppool.rb | 136 - lib/puppet/type/dsc_spserviceappproxygroup.rb | 175 -- lib/puppet/type/dsc_spserviceappsecurity.rb | 218 -- lib/puppet/type/dsc_spserviceinstance.rb | 121 - lib/puppet/type/dsc_spsessionstateservice.rb | 156 - lib/puppet/type/dsc_spshelladmins.rb | 222 -- lib/puppet/type/dsc_spsite.rb | 287 -- lib/puppet/type/dsc_spstateserviceapp.rb | 167 -- .../dsc_spsubscriptionsettingsserviceapp.rb | 166 -- lib/puppet/type/dsc_sptimerjobstate.rb | 147 - .../type/dsc_sptrustedidentitytokenissuer.rb | 292 -- lib/puppet/type/dsc_sptrustedrootauthority.rb | 136 - lib/puppet/type/dsc_spusageapplication.rb | 251 -- lib/puppet/type/dsc_spuserprofileproperty.rb | 458 --- lib/puppet/type/dsc_spuserprofilesection.rb | 169 -- .../type/dsc_spuserprofileserviceapp.rb | 304 -- .../dsc_spuserprofileserviceapppermissions.rb | 155 - .../type/dsc_spuserprofilesyncconnection.rb | 248 -- .../type/dsc_spuserprofilesyncservice.rb | 153 - lib/puppet/type/dsc_spvisioserviceapp.rb | 151 - lib/puppet/type/dsc_spweb.rb | 248 -- .../type/dsc_spwebappblockedfiletypes.rb | 155 - .../type/dsc_spwebappgeneralsettings.rb | 419 --- lib/puppet/type/dsc_spwebapplication.rb | 306 -- .../type/dsc_spwebapplicationappdomain.rb | 167 -- .../type/dsc_spwebapplicationextension.rb | 281 -- lib/puppet/type/dsc_spwebapppermissions.rb | 201 -- lib/puppet/type/dsc_spwebapppolicy.rb | 224 -- lib/puppet/type/dsc_spwebappproxygroup.rb | 116 - .../type/dsc_spwebappsiteuseanddeletion.rb | 169 -- .../type/dsc_spwebappthrottlingsettings.rb | 316 -- .../type/dsc_spwebappworkflowsettings.rb | 149 - .../type/dsc_spwordautomationserviceapp.rb | 406 --- .../type/dsc_spworkmanagementserviceapp.rb | 259 -- lib/puppet/type/dsc_systemlocale.rb | 103 - lib/puppet/type/dsc_user.rb | 214 -- lib/puppet/type/dsc_userrightsassignment.rb | 142 - lib/puppet/type/dsc_windowsfeature.rb | 181 -- lib/puppet/type/dsc_windowsoptionalfeature.rb | 235 -- lib/puppet/type/dsc_windowsprocess.rb | 287 -- lib/puppet/type/dsc_xadcomputer.rb | 320 -- .../type/dsc_xadcscertificationauthority.rb | 423 --- lib/puppet/type/dsc_xadcsonlineresponder.rb | 124 - lib/puppet/type/dsc_xadcswebenrollment.rb | 139 - lib/puppet/type/dsc_xaddomain.rb | 208 -- lib/puppet/type/dsc_xaddomaincontroller.rb | 177 -- .../dsc_xaddomaindefaultpasswordpolicy.rb | 274 -- lib/puppet/type/dsc_xaddomaintrust.rb | 174 -- lib/puppet/type/dsc_xadgroup.rb | 319 -- lib/puppet/type/dsc_xadorganizationalunit.rb | 169 -- lib/puppet/type/dsc_xadrecyclebin.rb | 131 - lib/puppet/type/dsc_xaduser.rb | 775 ----- lib/puppet/type/dsc_xarchive.rb | 188 -- lib/puppet/type/dsc_xazureaffinitygroup.rb | 150 - lib/puppet/type/dsc_xazurepackadmin.rb | 169 -- .../type/dsc_xazurepackdatabasesetting.rb | 184 -- lib/puppet/type/dsc_xazurepackfqdn.rb | 183 -- .../type/dsc_xazurepackidentityprovider.rb | 183 -- lib/puppet/type/dsc_xazurepackrelyingparty.rb | 185 -- .../type/dsc_xazurepackresourceprovider.rb | 638 ---- lib/puppet/type/dsc_xazurepacksetup.rb | 231 -- lib/puppet/type/dsc_xazurepackupdate.rb | 134 - lib/puppet/type/dsc_xazurequickvm.rb | 227 -- lib/puppet/type/dsc_xazureservice.rb | 150 - lib/puppet/type/dsc_xazuresqldatabase.rb | 214 -- ...dsc_xazuresqldatabaseserverfirewallrule.rb | 182 -- lib/puppet/type/dsc_xazurestorageaccount.rb | 165 - lib/puppet/type/dsc_xazuresubscription.rb | 120 - lib/puppet/type/dsc_xazurevm.rb | 258 -- .../type/dsc_xazurevmdscconfiguration.rb | 180 -- lib/puppet/type/dsc_xazurevmdscextension.rb | 312 -- lib/puppet/type/dsc_xblautobitlocker.rb | 395 --- lib/puppet/type/dsc_xblbitlocker.rb | 390 --- lib/puppet/type/dsc_xbltpm.rb | 133 - lib/puppet/type/dsc_xcertificateexport.rb | 332 --- lib/puppet/type/dsc_xcertificateimport.rb | 157 - lib/puppet/type/dsc_xcertreq.rb | 332 --- lib/puppet/type/dsc_xcluster.rb | 116 - lib/puppet/type/dsc_xclusterdisk.rb | 120 - lib/puppet/type/dsc_xclusternetwork.rb | 150 - lib/puppet/type/dsc_xclusterpreferredowner.rb | 158 - lib/puppet/type/dsc_xclusterquorum.rb | 121 - lib/puppet/type/dsc_xcomputer.rb | 177 -- lib/puppet/type/dsc_xcredssp.rb | 142 - lib/puppet/type/dsc_xdatabase.rb | 214 -- lib/puppet/type/dsc_xdatabaselogin.rb | 169 -- lib/puppet/type/dsc_xdatabaseserver.rb | 88 - lib/puppet/type/dsc_xdbpackage.rb | 167 -- lib/puppet/type/dsc_xdefaultgatewayaddress.rb | 120 - lib/puppet/type/dsc_xdfsnamespacefolder.rb | 238 -- lib/puppet/type/dsc_xdfsnamespaceroot.rb | 304 -- .../dsc_xdfsnamespaceserverconfiguration.rb | 140 - lib/puppet/type/dsc_xdfsreplicationgroup.rb | 207 -- .../dsc_xdfsreplicationgroupconnection.rb | 205 -- .../type/dsc_xdfsreplicationgroupfolder.rb | 183 -- .../dsc_xdfsreplicationgroupmembership.rb | 211 -- lib/puppet/type/dsc_xdhcpclient.rb | 123 - .../type/dsc_xdhcpserverauthorization.rb | 120 - lib/puppet/type/dsc_xdhcpserverclass.rb | 179 -- lib/puppet/type/dsc_xdhcpserveroption.rb | 174 -- lib/puppet/type/dsc_xdhcpserverreservation.rb | 170 -- lib/puppet/type/dsc_xdhcpserverscope.rb | 218 -- lib/puppet/type/dsc_xdisk.rb | 219 -- lib/puppet/type/dsc_xdiskaccesspath.rb | 187 -- lib/puppet/type/dsc_xdismfeature.rb | 120 - lib/puppet/type/dsc_xdnsarecord.rb | 137 - .../type/dsc_xdnsclientglobalsetting.rb | 140 - lib/puppet/type/dsc_xdnsconnectionsuffix.rb | 152 - lib/puppet/type/dsc_xdnsrecord.rb | 157 - lib/puppet/type/dsc_xdnsserveraddress.rb | 139 - lib/puppet/type/dsc_xdnsserveradzone.rb | 187 -- lib/puppet/type/dsc_xdnsserverforwarder.rb | 106 - lib/puppet/type/dsc_xdnsserverprimaryzone.rb | 138 - .../type/dsc_xdnsserversecondaryzone.rb | 138 - lib/puppet/type/dsc_xdnsserverzonetransfer.rb | 121 - lib/puppet/type/dsc_xdscwebservice.rb | 306 -- lib/puppet/type/dsc_xenvironment.rb | 164 - .../dsc_xexchactivesyncvirtualdirectory.rb | 313 -- .../type/dsc_xexchantimalwarescanning.rb | 118 - .../dsc_xexchautodiscovervirtualdirectory.rb | 196 -- lib/puppet/type/dsc_xexchautomountpoint.rb | 264 -- .../type/dsc_xexchclientaccessserver.rb | 197 -- .../dsc_xexchdatabaseavailabilitygroup.rb | 497 ---- ...sc_xexchdatabaseavailabilitygroupmember.rb | 147 - ...c_xexchdatabaseavailabilitygroupnetwork.rb | 201 -- .../type/dsc_xexchecpvirtualdirectory.rb | 260 -- lib/puppet/type/dsc_xexcheventloglevel.rb | 119 - .../type/dsc_xexchexchangecertificate.rb | 201 -- lib/puppet/type/dsc_xexchexchangeserver.rb | 208 -- lib/puppet/type/dsc_xexchimapsettings.rb | 183 -- lib/puppet/type/dsc_xexchinstall.rb | 118 - lib/puppet/type/dsc_xexchjetstress.rb | 154 - lib/puppet/type/dsc_xexchjetstresscleanup.rb | 183 -- lib/puppet/type/dsc_xexchmailboxdatabase.rb | 552 ---- .../type/dsc_xexchmailboxdatabasecopy.rb | 226 -- lib/puppet/type/dsc_xexchmailboxserver.rb | 853 ------ .../type/dsc_xexchmailboxtransportservice.rb | 456 --- lib/puppet/type/dsc_xexchmaintenancemode.rb | 182 -- .../type/dsc_xexchmapivirtualdirectory.rb | 180 -- .../type/dsc_xexchoabvirtualdirectory.rb | 300 -- lib/puppet/type/dsc_xexchoutlookanywhere.rb | 318 -- .../type/dsc_xexchowavirtualdirectory.rb | 405 --- lib/puppet/type/dsc_xexchpopsettings.rb | 183 -- .../dsc_xexchpowershellvirtualdirectory.rb | 226 -- lib/puppet/type/dsc_xexchreceiveconnector.rb | 950 ------ lib/puppet/type/dsc_xexchtransportservice.rb | 1459 --------- .../type/dsc_xexchumcallroutersettings.rb | 134 - lib/puppet/type/dsc_xexchumservice.rb | 152 - lib/puppet/type/dsc_xexchwaitforadprep.rb | 209 -- lib/puppet/type/dsc_xexchwaitfordag.rb | 152 - .../type/dsc_xexchwaitformailboxdatabase.rb | 167 -- .../dsc_xexchwebservicesvirtualdirectory.rb | 273 -- lib/puppet/type/dsc_xfirewall.rb | 621 ---- lib/puppet/type/dsc_xfirewallprofile.rb | 391 --- lib/puppet/type/dsc_xgroup.rb | 190 -- lib/puppet/type/dsc_xhostsfile.rb | 120 - lib/puppet/type/dsc_xhotfix.rb | 151 - lib/puppet/type/dsc_xiisfeaturedelegation.rb | 105 - lib/puppet/type/dsc_xiishandler.rb | 105 - lib/puppet/type/dsc_xiislogging.rb | 180 -- lib/puppet/type/dsc_xiismimetypemapping.rb | 122 - lib/puppet/type/dsc_xiismodule.rb | 202 -- .../type/dsc_xinternetexplorerhomepage.rb | 120 - lib/puppet/type/dsc_xipaddress.rb | 123 - lib/puppet/type/dsc_xjeaendpoint.rb | 172 -- lib/puppet/type/dsc_xjeatoolkit.rb | 156 - lib/puppet/type/dsc_xmicrosoftupdate.rb | 90 - lib/puppet/type/dsc_xmountimage.rb | 156 - lib/puppet/type/dsc_xmppreference.rb | 981 ------ lib/puppet/type/dsc_xmsipackage.rb | 368 --- lib/puppet/type/dsc_xmysqldatabase.rb | 136 - lib/puppet/type/dsc_xmysqlgrant.rb | 173 -- lib/puppet/type/dsc_xmysqlserver.rb | 136 - lib/puppet/type/dsc_xmysqluser.rb | 152 - lib/puppet/type/dsc_xnetadapterbinding.rb | 138 - lib/puppet/type/dsc_xnetadapterlso.rb | 119 - lib/puppet/type/dsc_xnetadaptername.rb | 245 -- lib/puppet/type/dsc_xnetadapterrdma.rb | 101 - lib/puppet/type/dsc_xnetbios.rb | 103 - lib/puppet/type/dsc_xnetconnectionprofile.rb | 139 - lib/puppet/type/dsc_xnetworkteam.rb | 159 - lib/puppet/type/dsc_xnetworkteaminterface.rb | 138 - lib/puppet/type/dsc_xofflinedomainjoin.rb | 103 - lib/puppet/type/dsc_xpackage.rb | 469 --- lib/puppet/type/dsc_xpendingreboot.rb | 245 -- lib/puppet/type/dsc_xpfximport.rb | 189 -- lib/puppet/type/dsc_xpowerplan.rb | 103 - .../type/dsc_xpowershellexecutionpolicy.rb | 88 - lib/puppet/type/dsc_xpsendpoint.rb | 169 -- lib/puppet/type/dsc_xrdremoteapp.rb | 260 -- lib/puppet/type/dsc_xrdsessioncollection.rb | 132 - .../dsc_xrdsessioncollectionconfiguration.rb | 373 --- lib/puppet/type/dsc_xrdsessiondeployment.rb | 119 - lib/puppet/type/dsc_xregistry.rb | 190 -- lib/puppet/type/dsc_xremotedesktopadmin.rb | 108 - lib/puppet/type/dsc_xremotefile.rb | 231 -- lib/puppet/type/dsc_xrobocopy.rb | 285 -- lib/puppet/type/dsc_xroute.rb | 210 -- lib/puppet/type/dsc_xscdpmconsolesetup.rb | 136 - .../type/dsc_xscdpmdatabaseserversetup.rb | 136 - lib/puppet/type/dsc_xscdpmserversetup.rb | 288 -- lib/puppet/type/dsc_xscheduledtask.rb | 698 ----- lib/puppet/type/dsc_xscomadmin.rb | 138 - lib/puppet/type/dsc_xscomconsolesetup.rb | 223 -- lib/puppet/type/dsc_xscomconsoleupdate.rb | 151 - lib/puppet/type/dsc_xscommanagementpack.rb | 176 -- .../type/dsc_xscommanagementserversetup.rb | 507 ---- .../type/dsc_xscommanagementserverupdate.rb | 151 - .../type/dsc_xscomreportingserversetup.rb | 284 -- .../type/dsc_xscomwebconsoleserversetup.rb | 287 -- .../type/dsc_xscomwebconsoleserverupdate.rb | 151 - lib/puppet/type/dsc_xscript.rb | 150 - lib/puppet/type/dsc_xscsmapowershellsetup.rb | 136 - .../dsc_xscsmarunbookworkerserversetup.rb | 287 -- .../type/dsc_xscsmawebserviceserversetup.rb | 414 --- lib/puppet/type/dsc_xscspfserver.rb | 139 - lib/puppet/type/dsc_xscspfserversetup.rb | 447 --- lib/puppet/type/dsc_xscspfserverupdate.rb | 151 - lib/puppet/type/dsc_xscspfsetting.rb | 171 -- lib/puppet/type/dsc_xscspfstamp.rb | 139 - lib/puppet/type/dsc_xscsrserversetup.rb | 307 -- lib/puppet/type/dsc_xscsrserverupdate.rb | 151 - lib/puppet/type/dsc_xscvmmadmin.rb | 138 - lib/puppet/type/dsc_xscvmmconsolesetup.rb | 187 -- lib/puppet/type/dsc_xscvmmconsoleupdate.rb | 151 - .../type/dsc_xscvmmmanagementserversetup.rb | 604 ---- .../type/dsc_xscvmmmanagementserverupdate.rb | 151 - lib/puppet/type/dsc_xsmacredential.rb | 164 - lib/puppet/type/dsc_xsmbshare.rb | 319 -- lib/puppet/type/dsc_xsqlalias.rb | 171 -- lib/puppet/type/dsc_xsqlaogroupensure.rb | 294 -- lib/puppet/type/dsc_xsqlaogroupjoin.rb | 153 - lib/puppet/type/dsc_xsqlhaendpoint.rb | 135 - lib/puppet/type/dsc_xsqlhagroup.rb | 195 -- lib/puppet/type/dsc_xsqlhaservice.rb | 117 - lib/puppet/type/dsc_xsqlserveralias.rb | 189 -- ...dsc_xsqlserveralwaysonavailabilitygroup.rb | 312 -- ...lserveralwaysonavailabilitygroupreplica.rb | 337 --- .../type/dsc_xsqlserveralwaysonservice.rb | 140 - ...dsc_xsqlserveravailabilitygrouplistener.rb | 204 -- .../type/dsc_xsqlserverconfiguration.rb | 171 -- lib/puppet/type/dsc_xsqlserverdatabase.rb | 139 - .../type/dsc_xsqlserverdatabaseowner.rb | 130 - .../type/dsc_xsqlserverdatabasepermission.rb | 194 -- .../dsc_xsqlserverdatabaserecoverymodel.rb | 137 - lib/puppet/type/dsc_xsqlserverdatabaserole.rb | 174 -- lib/puppet/type/dsc_xsqlserverendpoint.rb | 170 -- .../type/dsc_xsqlserverendpointpermission.rb | 170 -- .../type/dsc_xsqlserverendpointstate.rb | 135 - .../dsc_xsqlserverfailoverclustersetup.rb | 795 ----- lib/puppet/type/dsc_xsqlserverfirewall.rb | 233 -- lib/puppet/type/dsc_xsqlserverinstall.rb | 313 -- lib/puppet/type/dsc_xsqlserverlogin.rb | 221 -- lib/puppet/type/dsc_xsqlservermaxdop.rb | 154 - lib/puppet/type/dsc_xsqlservermemory.rb | 172 -- lib/puppet/type/dsc_xsqlservernetwork.rb | 168 -- lib/puppet/type/dsc_xsqlserverpermission.rb | 163 - lib/puppet/type/dsc_xsqlserverreplication.rb | 216 -- lib/puppet/type/dsc_xsqlserverrole.rb | 193 -- lib/puppet/type/dsc_xsqlserverrsconfig.rb | 147 - .../dsc_xsqlserverrssecureconnectionlevel.rb | 121 - lib/puppet/type/dsc_xsqlserverscript.rb | 188 -- lib/puppet/type/dsc_xsqlserversetup.rb | 846 ------ lib/puppet/type/dsc_xsslsettings.rb | 133 - lib/puppet/type/dsc_xsystemrestore.rb | 108 - lib/puppet/type/dsc_xsystemrestorepoint.rb | 123 - lib/puppet/type/dsc_xtimezone.rb | 103 - lib/puppet/type/dsc_xuser.rb | 215 -- lib/puppet/type/dsc_xvhd.rb | 240 -- lib/puppet/type/dsc_xvhdfile.rb | 154 - lib/puppet/type/dsc_xvirtualmemory.rb | 141 - lib/puppet/type/dsc_xvmdvddrive.rb | 160 - lib/puppet/type/dsc_xvmhost.rb | 331 --- lib/puppet/type/dsc_xvmhyperv.rb | 488 --- lib/puppet/type/dsc_xvmnetworkadapter.rb | 181 -- lib/puppet/type/dsc_xvmprocessor.rb | 288 -- lib/puppet/type/dsc_xvmswitch.rb | 223 -- lib/puppet/type/dsc_xwaitforaddomain.rb | 155 - .../type/dsc_xwaitforavailabilitygroup.rb | 121 - .../type/dsc_xwaitforcertificateservices.rb | 138 - lib/puppet/type/dsc_xwaitforcluster.rb | 121 - lib/puppet/type/dsc_xwaitfordisk.rb | 139 - lib/puppet/type/dsc_xwaitforsqlhagroup.rb | 183 -- lib/puppet/type/dsc_xwaitforvolume.rb | 121 - lib/puppet/type/dsc_xwebapplication.rb | 315 -- lib/puppet/type/dsc_xwebapppool.rb | 911 ------ lib/puppet/type/dsc_xwebapppooldefaults.rb | 124 - lib/puppet/type/dsc_xwebconfigkeyvalue.rb | 173 -- lib/puppet/type/dsc_xwebpackagedeploy.rb | 120 - lib/puppet/type/dsc_xwebsite.rb | 454 --- lib/puppet/type/dsc_xwebsitedefaults.rb | 169 -- lib/puppet/type/dsc_xwebvirtualdirectory.rb | 154 - lib/puppet/type/dsc_xwefcollector.rb | 105 - lib/puppet/type/dsc_xwefsubscription.rb | 411 --- lib/puppet/type/dsc_xwindowsfeature.rb | 167 -- .../type/dsc_xwindowsoptionalfeature.rb | 218 -- lib/puppet/type/dsc_xwindowspackagecab.rb | 135 - lib/puppet/type/dsc_xwindowsprocess.rb | 306 -- lib/puppet/type/dsc_xwindowsupdateagent.rb | 217 -- lib/puppet/type/dsc_xwineventlog.rb | 167 -- lib/puppet/type/dsc_xwordpresssite.rb | 151 - .../AuditPolicyDsc/AuditPolicyDsc.psd1 | 122 - .../AuditPolicyResourceHelper.psm1 | 224 -- .../AuditPolicyResourceHelper.strings.psd1 | 8 - .../MSFT_AuditPolicyCsv.psm1 | 256 -- .../MSFT_AuditPolicyCsv.schema.mof | 6 - .../en-US/MSFT_AuditPolicyCsv.strings.psd1 | 12 - .../MSFT_AuditPolicyOption.psm1 | 205 -- .../MSFT_AuditPolicyOption.schema.mof | 7 - .../en-US/MSFT_AuditPolicyOption.strings.psd1 | 9 - .../MSFT_AuditPolicySubcategory.psm1 | 286 -- .../MSFT_AuditPolicySubcategory.schema.mof | 9 - .../MSFT_AuditPolicySubcategory.strings.psd1 | 10 - .../dsc_resources/AuditPolicyDsc/LICENSE | 21 - .../MSFT_OfficeOnlineServerFarm.psm1 | 702 ----- .../MSFT_OfficeOnlineServerFarm.schema.mof | 56 - .../MSFT_OfficeOnlineServerInstall.psm1 | 113 - .../MSFT_OfficeOnlineServerInstall.schema.mof | 7 - .../MSFT_OfficeOnlineServerMachine.psm1 | 193 -- .../MSFT_OfficeOnlineServerMachine.schema.mof | 9 - .../OfficeOnlineServerDsc.Util.psm1 | 245 -- .../OfficeOnlineServerDsc.psd1 | 125 - .../MSFT_SecuritySetting.psm1 | 465 --- .../MSFT_SecuritySetting.schema.mof | 26 - .../en-US/MSFT_SecuritySetting.strings.psd1 | 8 - .../MSFT_SecurityTemplate.psm1 | 221 -- .../MSFT_SecurityTemplate.schema.mof | 8 - .../en-US/MSFT_SecurityTemplate.strings.psd1 | 6 - .../MSFT_UserRightsAssignment.psm1 | 600 ---- .../MSFT_UserRightsAssignment.schema.mof | 9 - .../UserRightsFriendlyNameConversions.psd1 | 45 - .../MSFT_UserRightsAssignment.strings.psd1 | 13 - .../SecurityPolicyResourceHelper.psm1 | 322 -- .../SecurityPolicyResourceHelper.strings.psd1 | 6 - .../dsc_resources/SecurityPolicyDsc/LICENSE | 21 - .../SecurityPolicyDsc/SecurityPolicyDsc.psd1 | 63 - .../MSFT_SPAccessServiceApp.psm1 | 194 -- .../MSFT_SPAccessServiceApp.schema.mof | 9 - .../MSFT_SPAccessServices2010.psm1 | 185 -- .../MSFT_SPAccessServices2010.schema.mof | 9 - .../MSFT_SPAlternateUrl.psm1 | 192 -- .../MSFT_SPAlternateUrl.schema.mof | 10 - .../MSFT_SPAntivirusSettings.psm1 | 206 -- .../MSFT_SPAntivirusSettings.schema.mof | 12 - .../MSFT_SPAppCatalog/MSFT_SPAppCatalog.psm1 | 105 - .../MSFT_SPAppCatalog.schema.mof | 6 - .../MSFT_SPAppDomain/MSFT_SPAppDomain.psm1 | 94 - .../MSFT_SPAppDomain.schema.mof | 8 - .../MSFT_SPAppManagementServiceApp.psm1 | 262 -- .../MSFT_SPAppManagementServiceApp.schema.mof | 12 - .../MSFT_SPAppStoreSettings.psm1 | 167 -- .../MSFT_SPAppStoreSettings.schema.mof | 8 - .../MSFT_SPBCSServiceApp.psm1 | 220 -- .../MSFT_SPBCSServiceApp.schema.mof | 11 - .../MSFT_SPBlobCacheSettings.psm1 | 384 --- .../MSFT_SPBlobCacheSettings.schema.mof | 14 - .../MSFT_SPCacheAccounts.psm1 | 280 -- .../MSFT_SPCacheAccounts.schema.mof | 10 - .../MSFT_SPConfigWizard.psm1 | 248 -- .../MSFT_SPConfigWizard.schema.mof | 9 - .../MSFT_SPContentDatabase.psm1 | 401 --- .../MSFT_SPContentDatabase.schema.mof | 13 - .../MSFT_SPCreateFarm/MSFT_SPCreateFarm.psm1 | 395 --- .../MSFT_SPCreateFarm.schema.mof | 13 - .../MSFT_SPDatabaseAAG.psm1 | 294 -- .../MSFT_SPDatabaseAAG.schema.mof | 10 - .../MSFT_SPDesignerSettings.psm1 | 418 --- .../MSFT_SPDesignerSettings.schema.mof | 15 - .../MSFT_SPDiagnosticLoggingSettings.psm1 | 321 -- ...SFT_SPDiagnosticLoggingSettings.schema.mof | 24 - .../MSFT_SPDistributedCacheService.psm1 | 405 --- .../MSFT_SPDistributedCacheService.schema.mof | 11 - .../MSFT_SPExcelServiceApp.psm1 | 673 ----- .../MSFT_SPExcelServiceApp.schema.mof | 50 - .../DSCResources/MSFT_SPFarm/MSFT_SPFarm.psm1 | 609 ---- .../MSFT_SPFarm/MSFT_SPFarm.schema.mof | 15 - .../MSFT_SPFarmAdministrators.psm1 | 372 --- .../MSFT_SPFarmAdministrators.schema.mof | 10 - .../MSFT_SPFarmPropertyBag.psm1 | 173 -- .../MSFT_SPFarmPropertyBag.schema.mof | 8 - .../MSFT_SPFarmSolution.psm1 | 458 --- .../MSFT_SPFarmSolution.schema.mof | 12 - .../MSFT_SPFeature/MSFT_SPFeature.psm1 | 217 -- .../MSFT_SPFeature/MSFT_SPFeature.schema.mof | 10 - .../MSFT_SPHealthAnalyzerRuleState.psm1 | 274 -- .../MSFT_SPHealthAnalyzerRuleState.schema.mof | 26 - .../MSFT_SPInstall/MSFT_SPInstall.psm1 | 271 -- .../MSFT_SPInstall/MSFT_SPInstall.schema.mof | 10 - .../MSFT_SPInstallLanguagePack.psm1 | 386 --- .../MSFT_SPInstallLanguagePack.schema.mof | 10 - .../MSFT_SPInstallPrereqs.psm1 | 776 ----- .../MSFT_SPInstallPrereqs.schema.mof | 24 - .../MSFT_SPIrmSettings.psm1 | 178 -- .../MSFT_SPIrmSettings.schema.mof | 8 - .../MSFT_SPJoinFarm/MSFT_SPJoinFarm.psm1 | 332 --- .../MSFT_SPJoinFarm.schema.mof | 9 - .../MSFT_SPMachineTranslationServiceApp.psm1 | 209 -- ..._SPMachineTranslationServiceApp.schema.mof | 12 - .../MSFT_SPManagedAccount.psm1 | 219 -- .../MSFT_SPManagedAccount.schema.mof | 11 - .../MSFT_SPManagedMetaDataServiceApp.psm1 | 449 --- ...SFT_SPManagedMetaDataServiceApp.schema.mof | 13 - .../MSFT_SPManagedPath.psm1 | 207 -- .../MSFT_SPManagedPath.schema.mof | 10 - .../MSFT_SPOfficeOnlineServerBinding.psm1 | 174 -- ...SFT_SPOfficeOnlineServerBinding.schema.mof | 20 - .../MSFT_SPOutgoingEmailSettings.psm1 | 255 -- .../MSFT_SPOutgoingEmailSettings.schema.mof | 13 - .../MSFT_SPPasswordChangeSettings.psm1 | 159 - .../MSFT_SPPasswordChangeSettings.schema.mof | 9 - .../MSFT_SPPerformancePointServiceApp.psm1 | 256 -- ...FT_SPPerformancePointServiceApp.schema.mof | 11 - ...MSFT_SPPowerPointAutomationServiceApp.psm1 | 390 --- ...PPowerPointAutomationServiceApp.schema.mof | 14 - .../MSFT_SPProductUpdate.psm1 | 545 ---- .../MSFT_SPProductUpdate.schema.mof | 11 - .../MSFT_SPPublishServiceApplication.psm1 | 146 - ...SFT_SPPublishServiceApplication.schema.mof | 7 - .../MSFT_SPQuotaTemplate.psm1 | 351 --- .../MSFT_SPQuotaTemplate.schema.mof | 11 - .../MSFT_SPRemoteFarmTrust.psm1 | 215 -- .../MSFT_SPRemoteFarmTrust.schema.mof | 9 - .../MSFT_SPSearchAuthoritativePage.psm1 | 297 -- .../MSFT_SPSearchAuthoritativePage.schema.mof | 10 - .../MSFT_SPSearchContentSource.psm1 | 780 ----- .../MSFT_SPSearchContentSource.schema.mof | 31 - .../MSFT_SPSearchCrawlMapping.psm1 | 225 -- .../MSFT_SPSearchCrawlMapping.schema.mof | 10 - .../MSFT_SPSearchCrawlRule.psm1 | 555 ---- .../MSFT_SPSearchCrawlRule.schema.mof | 14 - .../MSFT_SPSearchCrawlerImpactRule.psm1 | 288 -- .../MSFT_SPSearchCrawlerImpactRule.schema.mof | 13 - .../MSFT_SPSearchFileType.psm1 | 343 --- .../MSFT_SPSearchFileType.schema.mof | 12 - .../MSFT_SPSearchIndexPartition.psm1 | 261 -- .../MSFT_SPSearchIndexPartition.schema.mof | 9 - .../MSFT_SPSearchResultSource.psm1 | 292 -- .../MSFT_SPSearchResultSource.schema.mof | 11 - .../MSFT_SPSearchServiceApp.psm1 | 453 --- .../MSFT_SPSearchServiceApp.schema.mof | 16 - .../MSFT_SPSearchTopology.psm1 | 484 --- .../MSFT_SPSearchTopology.schema.mof | 13 - .../MSFT_SPSecureStoreServiceApp.psm1 | 408 --- .../MSFT_SPSecureStoreServiceApp.schema.mof | 19 - .../MSFT_SPServiceAppPool.psm1 | 176 -- .../MSFT_SPServiceAppPool.schema.mof | 9 - .../MSFT_SPServiceAppProxyGroup.psm1 | 449 --- .../MSFT_SPServiceAppProxyGroup.schema.mof | 10 - .../MSFT_SPServiceAppSecurity.psm1 | 419 --- .../MSFT_SPServiceAppSecurity.schema.mof | 16 - .../MSFT_SPServiceInstance.psm1 | 295 -- .../MSFT_SPServiceInstance.schema.mof | 7 - .../MSFT_SPSessionStateService.psm1 | 179 -- .../MSFT_SPSessionStateService.schema.mof | 10 - .../MSFT_SPShellAdmins.psm1 | 956 ------ .../MSFT_SPShellAdmins.schema.mof | 20 - .../DSCResources/MSFT_SPSite/MSFT_SPSite.psm1 | 302 -- .../MSFT_SPSite/MSFT_SPSite.schema.mof | 19 - .../MSFT_SPStateServiceApp.psm1 | 179 -- .../MSFT_SPStateServiceApp.schema.mof | 10 - ...MSFT_SPSubscriptionSettingsServiceApp.psm1 | 234 -- ...PSubscriptionSettingsServiceApp.schema.mof | 11 - .../MSFT_SPTimerJobState.psm1 | 258 -- .../MSFT_SPTimerJobState.schema.mof | 10 - .../MSFT_SPTrustedIdentityTokenIssuer.psm1 | 429 --- ...FT_SPTrustedIdentityTokenIssuer.schema.mof | 26 - .../MSFT_SPTrustedRootAuthority.psm1 | 169 -- .../MSFT_SPTrustedRootAuthority.schema.mof | 9 - .../MSFT_SPUsageApplication.psm1 | 328 -- .../MSFT_SPUsageApplication.schema.mof | 15 - .../MSFT_SPUserProfileProperty.psm1 | 782 ----- .../MSFT_SPUserProfileProperty.schema.mof | 28 - .../MSFT_SPUserProfileSection.psm1 | 240 -- .../MSFT_SPUserProfileSection.schema.mof | 10 - .../MSFT_SPUserProfileServiceApp.psm1 | 453 --- .../MSFT_SPUserProfileServiceApp.schema.mof | 19 - ...FT_SPUserProfileServiceAppPermissions.psm1 | 365 --- ...serProfileServiceAppPermissions.schema.mof | 9 - .../MSFT_SPUserProfileSyncConnection.psm1 | 383 --- ...SFT_SPUserProfileSyncConnection.schema.mof | 15 - .../MSFT_SPUserProfileSyncService.psm1 | 375 --- .../MSFT_SPUserProfileSyncService.schema.mof | 9 - .../MSFT_SPVisioServiceApp.psm1 | 210 -- .../MSFT_SPVisioServiceApp.schema.mof | 9 - .../DSCResources/MSFT_SPWeb/MSFT_SPWeb.psm1 | 283 -- .../MSFT_SPWeb/MSFT_SPWeb.schema.mof | 15 - .../MSFT_SPWebAppBlockedFileTypes.psm1 | 142 - .../MSFT_SPWebAppBlockedFileTypes.schema.mof | 9 - .../MSFT_SPWebAppGeneralSettings.psm1 | 339 --- .../MSFT_SPWebAppGeneralSettings.schema.mof | 25 - .../MSFT_SPWebAppPermissions.psm1 | 732 ----- .../MSFT_SPWebAppPermissions.schema.mof | 11 - .../MSFT_SPWebAppPolicy.psm1 | 823 ----- .../MSFT_SPWebAppPolicy.schema.mof | 18 - .../MSFT_SPWebAppProxyGroup.psm1 | 129 - .../MSFT_SPWebAppProxyGroup.schema.mof | 7 - .../MSFT_SPWebAppSiteUseAndDeletion.psm1 | 236 -- ...MSFT_SPWebAppSiteUseAndDeletion.schema.mof | 10 - .../MSFT_SPWebAppThrottlingSettings.psm1 | 247 -- ...MSFT_SPWebAppThrottlingSettings.schema.mof | 25 - .../MSFT_SPWebAppWorkflowSettings.psm1 | 137 - .../MSFT_SPWebAppWorkflowSettings.schema.mof | 9 - .../MSFT_SPWebApplication.psm1 | 426 --- .../MSFT_SPWebApplication.schema.mof | 20 - .../MSFT_SPWebApplicationAppDomain.psm1 | 173 -- .../MSFT_SPWebApplicationAppDomain.schema.mof | 10 - .../MSFT_SPWebApplicationExtension.psm1 | 423 --- .../MSFT_SPWebApplicationExtension.schema.mof | 18 - .../MSFT_SPWordAutomationServiceApp.psm1 | 676 ----- ...MSFT_SPWordAutomationServiceApp.schema.mof | 23 - .../MSFT_SPWorkManagementServiceApp.psm1 | 396 --- ...MSFT_SPWorkManagementServiceApp.schema.mof | 15 - .../dsc_resources/SharePointDsc/LICENSE | 22 - .../SPContentDatabase.psm1 | 76 - .../Modules/SharePointDsc.Farm/SPFarm.psm1 | 206 -- .../SPSearchContentSource.Schedules.psm1 | 136 - .../SharePointDsc.Util.psm1 | 750 ----- .../SPWebAppPolicy.psm1 | 194 -- .../SPWebApplication.BlockedFileTypes.psm1 | 138 - .../SPWebApplication.GeneralSettings.psm1 | 142 - .../SPWebApplication.Throttling.psm1 | 172 -- .../SPWebApplication.Workflow.psm1 | 68 - .../SharePointDsc/SharePointDsc.psd1 | 163 - .../MSFT_SystemLocale/MSFT_SystemLocale.psm1 | 217 -- .../MSFT_SystemLocale.schema.mof | 6 - .../en-us/MSFT_SystemLocale.psd1 | 12 - .../dsc_resources/SystemLocaleDsc/LICENSE | 21 - .../SystemLocaleDsc/SystemLocaleDsc.psd1 | 64 - .../xActiveDirectory/Assert-HADC.ps1 | 91 - .../Assert-ParentChildDomains.ps1 | 92 - .../MSFT_xADCommon/MSFT_xADCommon.ps1 | 601 ---- .../MSFT_xADCommon/MSFT_xADCommon.psm1 | 4 - .../MSFT_xADComputer/MSFT_xADComputer.psm1 | 521 ---- .../MSFT_xADComputer.schema.mof | 20 - .../en-US/MSFT_xADComputer.psd1 | 25 - .../MSFT_xADDomain/MSFT_xADDomain.psm1 | 347 --- .../MSFT_xADDomain/MSFT_xADDomain.schema.mof | 13 - .../MSFT_xADDomainController.psm1 | 224 -- .../MSFT_xADDomainController.schema.mof | 11 - .../MSFT_xADDomainDefaultPasswordPolicy.psm1 | 226 -- ..._xADDomainDefaultPasswordPolicy.schema.mof | 17 - .../MSFT_xADDomainTrust.psm1 | 398 --- .../MSFT_xADDomainTrust.schema.mof | 13 - .../MSFT_xADGroup/MSFT_xADGroup.psm1 | 492 --- .../MSFT_xADGroup/MSFT_xADGroup.schema.mof | 19 - .../MSFT_xADOrganizationalUnit.psm1 | 221 -- .../MSFT_xADOrganizationalUnit.schema.mof | 12 - .../MSFT_xADRecycleBin.psm1 | 189 -- .../MSFT_xADRecycleBin.schema.mof | 8 - .../GeneratexADRecycleBinSchema.ps1 | 6 - .../MSFT_xADUser/MSFT_xADUser.psm1 | 1017 ------- .../MSFT_xADUser/MSFT_xADUser.schema.mof | 50 - .../MSFT_xWaitForADDomain.psm1 | 185 -- .../MSFT_xWaitForADDomain.schema.mof | 9 - .../xActiveDirectory/HADCConfiguration.psd1 | 23 - .../dsc_resources/xActiveDirectory/LICENSE | 21 - .../Misc/New-ADDomainTrust.ps1 | 17 - .../xActiveDirectory/ParentChildConfig.psd1 | 24 - .../xActiveDirectory/xActiveDirectory.psd1 | 66 - .../DSCResources/CommonResourceHelper.psm1 | 163 - .../MSFT_xAdcsCertificationAuthority.psm1 | 628 ---- ...SFT_xAdcsCertificationAuthority.schema.mof | 27 - ...T_xAdcsCertificationAuthority.strings.psd1 | 13 - .../MSFT_xAdcsOnlineResponder.psm1 | 262 -- .../MSFT_xAdcsOnlineResponder.schema.mof | 7 - .../MSFT_xAdcsOnlineResponder.strings.psd1 | 13 - .../MSFT_xAdcsWebEnrollment.psm1 | 281 -- .../MSFT_xAdcsWebEnrollment.schema.mof | 9 - .../MSFT_xAdcsWebEnrollment.strings.psd1 | 13 - .../dsc_resources/xAdcsDeployment/LICENSE | 21 - .../xAdcsDeployment/xAdcsDeployment.psd1 | 87 - .../MSFT_xAzureAffinityGroup.psm1 | 133 - .../MSFT_xAzureAffinityGroup.schema.mof | 12 - .../MSFT_xAzureQuickVM.psm1 | 123 - .../MSFT_xAzureQuickVM.schema.mof | 17 - .../MSFT_xAzureService.psm1 | 149 - .../MSFT_xAzureService.schema.mof | 12 - .../MSFT_xAzureSqlDatabase.psm1 | 380 --- .../MSFT_xAzureSqlDatabase.schema.mof | 17 - ...T_xAzureSqlDatabaseServerFirewallRule.psm1 | 210 -- ...reSqlDatabaseServerFirewallRule.schema.mof | 15 - .../MSFT_xAzureStorageAccount.psm1 | 240 -- .../MSFT_xAzureStorageAccount.schema.mof | 13 - .../MSFT_xAzureSubscription.psm1 | 98 - .../MSFT_xAzureSubscription.schema.mof | 10 - .../MSFT_xAzureVM/MSFT_xAzureVM.psm1 | 148 - .../MSFT_xAzureVM/MSFT_xAzureVM.schema.mof | 19 - .../MSFT_xAzureVMDscConfiguration.psm1 | 176 -- .../MSFT_xAzureVMDscConfiguration.schema.mof | 18 - .../MSFT_xAzureVMDscExtension.psm1 | 156 - .../MSFT_xAzureVMDscExtension.schema.mof | 22 - lib/puppet_x/dsc_resources/xAzure/LICENSE | 21 - .../GenerateXAzureSqlDatabase.ps1 | 10 - ...ateXAzureSqlDatabaseServerFirewallRule.ps1 | 9 - lib/puppet_x/dsc_resources/xAzure/xAzure.psd1 | 31 - .../MSFT_xAzurePackAdmin.psm1 | 170 -- .../MSFT_xAzurePackAdmin.schema.mof | 10 - .../MSFT_xAzurePackDatabaseSetting.psm1 | 149 - .../MSFT_xAzurePackDatabaseSetting.schema.mof | 11 - .../MSFT_xAzurePackFQDN.psm1 | 194 -- .../MSFT_xAzurePackFQDN.schema.mof | 11 - .../MSFT_xAzurePackIdentityProvider.psm1 | 196 -- ...MSFT_xAzurePackIdentityProvider.schema.mof | 11 - .../MSFT_xAzurePackRelyingParty.psm1 | 193 -- .../MSFT_xAzurePackRelyingParty.schema.mof | 11 - .../MSFT_xAzurePackResourceProvider.psm1 | 764 ----- ...MSFT_xAzurePackResourceProvider.schema.mof | 40 - .../MSFT_xAzurePackSetup.psm1 | 670 ----- .../MSFT_xAzurePackSetup.schema.mof | 14 - .../MSFT_xAzurePackUpdate.psm1 | 372 --- .../MSFT_xAzurePackUpdate.schema.mof | 8 - lib/puppet_x/dsc_resources/xAzurePack/LICENSE | 21 - .../xAzurePack/en-US/xPDT.strings.psd1 | 10 - .../dsc_resources/xAzurePack/xAzurePack.psd1 | 55 - .../dsc_resources/xAzurePack/xPDT.psm1 | 708 ----- .../MSFT_xBLAutoBitlocker.psm1 | 398 --- .../MSFT_xBLAutoBitlocker.schema.mof | 32 - .../MSFT_xBLBitlocker/MSFT_xBLBitlocker.psm1 | 243 -- .../MSFT_xBLBitlocker.schema.mof | 30 - .../DSCResources/MSFT_xBLTpm/MSFT_xBLTpm.psm1 | 118 - .../MSFT_xBLTpm/MSFT_xBLTpm.schema.mof | 11 - lib/puppet_x/dsc_resources/xBitlocker/LICENSE | 21 - .../xBitlocker/Misc/xBitlockerCommon.psm1 | 516 ---- .../dsc_resources/xBitlocker/xBitlocker.psd1 | 118 - .../MSFT_xCertReq/MSFT_xCertReq.psm1 | 941 ------ .../MSFT_xCertReq/MSFT_xCertReq.schema.mof | 21 - .../en-us/MSFT_xCertReq.strings.psd1 | 24 - .../MSFT_xCertificateExport.psm1 | 487 --- .../MSFT_xCertificateExport.schema.mof | 20 - .../MSFT_xCertificateExport.strings.psd1 | 12 - .../MSFT_xCertificateImport.psm1 | 272 -- .../MSFT_xCertificateImport.schema.mof | 9 - .../MSFT_xCertificateImport.strings.psd1 | 11 - .../MSFT_xPfxImport/MSFT_xPfxImport.psm1 | 319 -- .../MSFT_xPfxImport.schema.mof | 11 - .../en-us/MSFT_xPfxImport.strings.psd1 | 11 - .../MSFT_xWaitForCertificateServices.psm1 | 242 -- ...SFT_xWaitForCertificateServices.schema.mof | 9 - ...T_xWaitForCertificateServices.strings.psd1 | 8 - .../dsc_resources/xCertificate/LICENSE | 22 - .../CertificateDSc.Common.psm1 | 587 ---- .../en-us/CertificateDsc.Common.strings.psd1 | 17 - .../CertificateDsc.PDT.psm1 | 744 ----- .../en-us/CertificateDsc.PDT.strings.psd1 | 10 - .../CertificateDsc.ResourceHelper.psm1 | 174 -- .../xCertificate/xCertificate.psd1 | 84 - .../DSCResources/CommonResourceHelper.psm1 | 425 --- .../MSFT_xComputer/MSFT_xComputer.psm1 | 386 --- .../MSFT_xComputer/MSFT_xComputer.schema.mof | 11 - .../MSFT_xOfflineDomainJoin.psm1 | 224 -- .../MSFT_xOfflineDomainJoin.schema.mof | 6 - .../MSFT_xOfflineDomainJoin.strings.psd1 | 11 - .../MSFT_xPowerPlan/MSFT_xPowerPlan.psm1 | 176 -- .../MSFT_xPowerPlan.schema.mof | 6 - .../en-US/MSFT_xPowerPlan.schema.mfl | 6 - .../en-US/MSFT_xPowerPlan.strings.psd1 | 11 - .../MSFT_xScheduledTask.psm1 | 1361 --------- .../MSFT_xScheduledTask.schema.mof | 43 - .../MSFT_xVirtualMemory.psm1 | 428 --- .../MSFT_xVirtualMemory.schema.mof | 10 - .../dsc_resources/xComputerManagement/LICENSE | 21 - .../xComputerManagement.psd1 | 95 - .../MSFT_xCredSSP/MSFT_xCredSSP.psm1 | 324 -- .../MSFT_xCredSSP/MSFT_xCredSSP.schema.mof | 9 - lib/puppet_x/dsc_resources/xCredSSP/LICENSE | 21 - .../dsc_resources/xCredSSP/xCredSSP.psd1 | 60 - .../MSFT_xDFSNamespaceFolder.psm1 | 696 ----- .../MSFT_xDFSNamespaceFolder.schema.mof | 14 - .../MSFT_xDFSNamespaceFolder.strings.psd1 | 19 - .../MSFT_xDFSNamespaceRoot.psm1 | 840 ------ .../MSFT_xDFSNamespaceRoot.schema.mof | 18 - .../en-us/MSFT_xDFSNamespaceRoot.strings.psd1 | 20 - ...MSFT_xDFSNamespaceServerConfiguration.psm1 | 267 -- ...DFSNamespaceServerConfiguration.schema.mof | 8 - ...SNamespaceServerConfiguration.strings.psd1 | 9 - .../MSFT_xDFSReplicationGroup.psm1 | 866 ------ .../MSFT_xDFSReplicationGroup.schema.mof | 12 - .../MSFT_xDFSReplicationGroup.strings.psd1 | 29 - .../MSFT_xDFSReplicationGroupConnection.psm1 | 513 ---- ..._xDFSReplicationGroupConnection.schema.mof | 12 - ...DFSReplicationGroupConnection.strings.psd1 | 16 - .../MSFT_xDFSReplicationGroupFolder.psm1 | 339 --- ...MSFT_xDFSReplicationGroupFolder.schema.mof | 11 - ...FT_xDFSReplicationGroupFolder.strings.psd1 | 12 - .../MSFT_xDFSReplicationGroupMembership.psm1 | 372 --- ..._xDFSReplicationGroupMembership.schema.mof | 13 - ...DFSReplicationGroupMembership.strings.psd1 | 12 - lib/puppet_x/dsc_resources/xDFS/LICENSE | 21 - .../DFSDsc.ResourceHelper.psm1 | 181 -- lib/puppet_x/dsc_resources/xDFS/xDFS.psd1 | 75 - .../MSFT_xDBPackage/MSFT_xDBPackage.psm1 | 242 -- .../MSFT_xDBPackage.schema.mof | 13 - .../MSFT_xDatabase/MSFT_xDatabase.psm1 | 224 -- .../MSFT_xDatabase/MSFT_xDatabase.schema.mof | 16 - .../MSFT_xDatabaseLogin.psm1 | 239 -- .../MSFT_xDatabaseLogin.schema.mof | 15 - .../MSFT_xDatabaseLoginWithDefaultDB.psm1 | 210 -- .../MSFT_xDatabaseServer.psm1 | 155 - .../MSFT_xDatabaseServer.schema.mof | 10 - .../xDatabase_Common/xDatabase_Common.psm1 | 282 -- lib/puppet_x/dsc_resources/xDatabase/LICENSE | 21 - .../dsc_resources/xDatabase/xDatabase.psd1 | 68 - .../MSFT_xMpPreference.psm1 | 702 ----- .../MSFT_xMpPreference.schema.mof | 60 - lib/puppet_x/dsc_resources/xDefender/LICENSE | Bin 2210 -> 0 bytes .../dsc_resources/xDefender/xDefender.psd1 | 120 - .../xDhcpServer/DSCResources/Helper.psm1 | 141 - .../MSFT_xDhcpServerAuthorization.psm1 | 171 -- .../MSFT_xDhcpServerAuthorization.schema.mof | 7 - .../MSFT_xDhcpServerClass.psm1 | 187 -- .../MSFT_xDhcpServerClass.schema.mof | 10 - .../MSFT_xDhcpServerOption.psm1 | 428 --- .../MSFT_xDhcpServerOption.schema.mof | 11 - .../MSFT_xDhcpServerOptionDefinition.psm1 | 171 -- .../MSFT_xDhcpServerReservation.psm1 | 354 --- .../MSFT_xDhcpServerReservation.schema.mof | 11 - .../MSFT_xDhcpServerScope.psm1 | 461 --- .../MSFT_xDhcpServerScope.schema.mof | 14 - .../dsc_resources/xDhcpServer/LICENSE | 21 - .../Misc/New-DhcpServerOptionResource.ps1 | 17 - .../New-DhcpServerReservationResource.ps1 | 17 - .../Misc/New-DhcpServerScopeResource.ps1 | 24 - .../xDhcpServer/xDhcpServer.psd1 | 63 - .../MSFT_xDismFeature/MSFT_xDismFeature.psm1 | 135 - .../MSFT_xDismFeature.schema.mof | 7 - .../dsc_resources/xDismFeature/LICENSE | 21 - .../xDismFeature/xDismFeature.psd1 | 60 - .../xDnsServer/DSCResources/Helper.psm1 | 45 - .../MSFT_xDnsARecord/MSFT_xDnsARecord.psm1 | 108 - .../MSFT_xDnsARecord.schema.mof | 9 - .../MSFT_xDnsRecord/MSFT_xDnsRecord.psm1 | 190 -- .../MSFT_xDnsRecord.schema.mof | 10 - .../MSFT_xDnsServerADZone/Helper.psm1 | 45 - .../MSFT_xDnsServerADZone.psm1 | 221 -- .../MSFT_xDnsServerADZone.schema.mof | 11 - .../MSFT_xDnsServerForwarder.psm1 | 69 - .../MSFT_xDnsServerForwarder.schema.mof | 6 - .../MSFT_xDnsServerPrimaryZone.psm1 | 164 - .../MSFT_xDnsServerPrimaryZone.schema.mof | 10 - .../MSFT_xDnsServerSecondaryZone.psm1 | 271 -- .../MSFT_xDnsServerSecondaryZone.schema.mof | 9 - .../MSFT_xDnsServerZoneTransfer.psm1 | 232 -- .../MSFT_xDnsServerZoneTransfer.schema.mof | 8 - lib/puppet_x/dsc_resources/xDnsServer/LICENSE | 21 - .../Misc/New-DnsServerSecondaryZone.ps1 | 10 - .../Misc/New-DnsServerZoneTransfer.ps1 | 12 - .../dsc_resources/xDnsServer/xDnsServer.psd1 | 62 - .../MSFT_xExchActiveSyncVirtualDirectory.psm1 | 663 ----- ...xExchActiveSyncVirtualDirectory.schema.mof | 25 - .../MSFT_xExchAntiMalwareScanning.psm1 | 145 - .../MSFT_xExchAntiMalwareScanning.schema.mof | 11 - .../MSFT_xExchAutoMountPoint.psm1 | 918 ------ .../MSFT_xExchAutoMountPoint.schema.mof | 20 - ...SFT_xExchAutodiscoverVirtualDirectory.psm1 | 246 -- ...xchAutodiscoverVirtualDirectory.schema.mof | 19 - .../MSFT_xExchClientAccessServer.psm1 | 291 -- .../MSFT_xExchClientAccessServer.schema.mof | 19 - .../MSFT_xExchDatabaseAvailabilityGroup.psm1 | 675 ----- ..._xExchDatabaseAvailabilityGroup.schema.mof | 37 - ..._xExchDatabaseAvailabilityGroupMember.psm1 | 178 -- ...DatabaseAvailabilityGroupMember.schema.mof | 13 - ...xExchDatabaseAvailabilityGroupNetwork.psm1 | 312 -- ...atabaseAvailabilityGroupNetwork.schema.mof | 19 - .../MSFT_xExchEcpVirtualDirectory.psm1 | 321 -- .../MSFT_xExchEcpVirtualDirectory.schema.mof | 23 - .../MSFT_xExchEventLogLevel.psm1 | 133 - .../MSFT_xExchEventLogLevel.schema.mof | 9 - .../MSFT_xExchExchangeCertificate.psm1 | 349 --- .../MSFT_xExchExchangeCertificate.schema.mof | 16 - .../MSFT_xExchExchangeServer.psm1 | 309 -- .../MSFT_xExchExchangeServer.schema.mof | 20 - .../MSFT_xExchImapSettings.psm1 | 228 -- .../MSFT_xExchImapSettings.schema.mof | 15 - .../MSFT_xExchInstall/MSFT_xExchInstall.psm1 | 282 -- .../MSFT_xExchInstall.schema.mof | 8 - .../MSFT_xExchJetstress.psm1 | 399 --- .../MSFT_xExchJetstress.schema.mof | 13 - .../MSFT_xExchJetstressCleanup.psm1 | 440 --- .../MSFT_xExchJetstressCleanup.schema.mof | 15 - .../MSFT_xExchMailboxDatabase.psm1 | 992 ------ .../MSFT_xExchMailboxDatabase.schema.mof | 42 - .../MSFT_xExchMailboxDatabaseCopy.psm1 | 383 --- .../MSFT_xExchMailboxDatabaseCopy.schema.mof | 21 - .../MSFT_xExchMailboxServer.psm1 | 1072 ------- .../MSFT_xExchMailboxServer.schema.mof | 56 - .../MSFT_xExchMailboxTransportService.psm1 | 450 --- ...FT_xExchMailboxTransportService.schema.mof | 29 - .../MSFT_xExchMaintenanceMode.psm1 | 1286 -------- .../MSFT_xExchMaintenanceMode.schema.mof | 13 - .../TransportMaintenance.psm1 | 2648 ----------------- .../MSFT_xExchMapiVirtualDirectory.psm1 | 231 -- .../MSFT_xExchMapiVirtualDirectory.schema.mof | 18 - .../MSFT_xExchOabVirtualDirectory.psm1 | 405 --- .../MSFT_xExchOabVirtualDirectory.schema.mof | 25 - .../MSFT_xExchOutlookAnywhere.psm1 | 387 --- .../MSFT_xExchOutlookAnywhere.schema.mof | 26 - .../MSFT_xExchOwaVirtualDirectory.psm1 | 488 --- .../MSFT_xExchOwaVirtualDirectory.schema.mof | 32 - .../MSFT_xExchPopSettings.psm1 | 228 -- .../MSFT_xExchPopSettings.schema.mof | 15 - .../MSFT_xExchPowerShellVirtualDirectory.psm1 | 282 -- ...xExchPowerShellVirtualDirectory.schema.mof | 21 - .../MSFT_xExchReceiveConnector.psm1 | 1245 -------- .../MSFT_xExchReceiveConnector.schema.mof | 63 - .../MSFT_xExchTransportService.psm1 | 1562 ---------- .../MSFT_xExchTransportService.schema.mof | 93 - .../MSFT_xExchUMCallRouterSettings.psm1 | 143 - .../MSFT_xExchUMCallRouterSettings.schema.mof | 12 - .../MSFT_xExchUMService.psm1 | 154 - .../MSFT_xExchUMService.schema.mof | 13 - .../MSFT_xExchWaitForADPrep.psm1 | 416 --- .../MSFT_xExchWaitForADPrep.schema.mof | 20 - .../MSFT_xExchWaitForDAG.psm1 | 176 -- .../MSFT_xExchWaitForDAG.schema.mof | 13 - .../MSFT_xExchWaitForMailboxDatabase.psm1 | 208 -- ...SFT_xExchWaitForMailboxDatabase.schema.mof | 14 - ...MSFT_xExchWebServicesVirtualDirectory.psm1 | 343 --- ...ExchWebServicesVirtualDirectory.schema.mof | 24 - lib/puppet_x/dsc_resources/xExchange/LICENSE | 21 - .../xExchange/Misc/xExchangeCommon.psm1 | 991 ------ .../xExchange/Misc/xExchangeDiskPart.psm1 | 217 -- .../dsc_resources/xExchange/xExchange.psd1 | 129 - .../DSCResources/CommonResourceHelper.psm1 | 265 -- .../MSFT_xCluster/MSFT_xCluster.psm1 | 413 --- .../MSFT_xCluster/MSFT_xCluster.schema.mof | 11 - .../en-US/MSFT_xCluster.strings.psd1 | 22 - .../MSFT_xClusterDisk/MSFT_xClusterDisk.psm1 | 185 -- .../MSFT_xClusterDisk.schema.mof | 7 - .../en-US/MSFT_xClusterDisk.strings.psd1 | 9 - .../MSFT_xClusterNetwork.psm1 | 236 -- .../MSFT_xClusterNetwork.schema.mof | 9 - .../en-US/MSFT_xClusterNetwork.strings.psd1 | 9 - .../MSFT_xClusterPreferredOwner.psm1 | 314 -- .../MSFT_xClusterPreferredOwner.schema.mof | 9 - .../MSFT_xClusterPreferredOwner.strings.psd1 | 15 - .../MSFT_xClusterQuorum.psm1 | 210 -- .../MSFT_xClusterQuorum.schema.mof | 7 - .../en-US/MSFT_xClusterQuorum.strings.psd1 | 7 - .../MSFT_xWaitForCluster.psm1 | 183 -- .../MSFT_xWaitForCluster.schema.mof | 11 - .../en-US/MSFT_xWaitForCluster.strings.psd1 | 13 - .../dsc_resources/xFailOverCluster/LICENSE | 21 - .../xFailOverCluster/xFailOverCluster.psd1 | 114 - .../HyperVCommon/HyperVCommon.psm1 | 407 --- .../en-us/HyperVCommon.strings.psd1 | 15 - .../DSCResources/MSFT_xVHD/MSFT_xVHD.psm1 | 381 --- .../MSFT_xVHD/MSFT_xVHD.schema.mof | 15 - .../MSFT_xVMDvdDrive/MSFT_xVMDvdDrive.psm1 | 437 --- .../MSFT_xVMDvdDrive.schema.mof | 9 - .../en-us/MSFT_xVMDvdDrive.strings.psd1 | 20 - .../MSFT_xVMHost/MSFT_xVMHost.psm1 | 409 --- .../MSFT_xVMHost/MSFT_xVMHost.schema.mof | 20 - .../MSFT_xVMHost/en-US/MSFT_xVMHost.psd1 | 8 - .../MSFT_xVMHyperV/MSFT_xVMHyperV.psm1 | 785 ----- .../MSFT_xVMHyperV/MSFT_xVMHyperV.schema.mof | 29 - .../MSFT_xVMNetworkAdapter.psm1 | 373 --- .../MSFT_xVMNetworkAdapter.schema.mof | 12 - .../en-US/MSFT_xVMNetworkAdapter.psd1 | 23 - .../MSFT_xVMProcessor/MSFT_xVMProcessor.psm1 | 443 --- .../MSFT_xVMProcessor.schema.mof | 17 - .../en-US/MSFT_xVMProcessor.psd1 | 12 - .../MSFT_xVMSwitch/MSFT_xVMSwitch.psm1 | 566 ---- .../MSFT_xVMSwitch/MSFT_xVMSwitch.schema.mof | 13 - .../en-us/MSFT_xVMSwitch.strings.psd1 | 35 - .../MSFT_xVhdFileDirectory.psm1 | 482 --- .../MSFT_xVhdFileDirectory.schema.mof | 24 - lib/puppet_x/dsc_resources/xHyper-V/LICENSE | 21 - .../xHyper-V/Misc/VHDResourceGenerator.ps1 | 13 - .../xHyper-V/Misc/VMResourceGenerator.ps1 | 26 - .../xHyper-V/Misc/VMSwitchGenerator.ps1 | 8 - .../dsc_resources/xHyper-V/xHyper-V.psd1 | 101 - .../xInternetExplorerHomePage.psm1 | 241 -- .../xInternetExplorerHomePage.schema.mof | 11 - .../xInternetExplorerHomePage/LICENSE | 21 - .../xInternetExplorerHomePage.psd1 | 37 - .../xJea/DSCResources/Library/Helper.psm1 | 22 - .../xJea/DSCResources/Library/JeaAccount.psm1 | 330 -- .../xJea/DSCResources/Library/JeaDir.psm1 | 39 - .../DSCResources/Library/JeaInitFile.psm1 | 39 - .../xJea/DSCResources/Library/JeaProxy.psm1 | 429 --- .../MSFT_xJeaEndpoint/MSFT_xJeaEndpoint.psm1 | 272 -- .../MSFT_xJeaEndpoint.schema.mof | 13 - .../MSFT_xJeaToolkit/MSFT_xJeaToolkit.psm1 | 161 - .../MSFT_xJeaToolkit.schema.mof | 12 - lib/puppet_x/dsc_resources/xJea/LICENSE | 21 - .../xJea/Util/Initialize-ToolKit.ps1 | 174 -- .../dsc_resources/xJea/Util/SafeProxy.psm1 | 658 ---- lib/puppet_x/dsc_resources/xJea/xJea.psd1 | 59 - lib/puppet_x/dsc_resources/xJea/xjea.psm1 | 29 - .../MSFT_xMySqlDatabase.psm1 | 126 - .../MSFT_xMySqlDatabase.schema.mof | 10 - .../xMySqlDatabaseDesigner.ps1 | 26 - .../MSFT_xMySqlGrant/MSFT_xMySqlGrant.psm1 | 182 -- .../MSFT_xMySqlGrant.schema.mof | 13 - .../en-US/MSFT_xMySqlGrant.strings.psd1 | 15 - .../MSFT_xMySqlGrant/xMySqlGrantDesigner.ps1 | 27 - .../MSFT_xMySqlServer/MSFT_xMySqlServer.psm1 | 112 - .../MSFT_xMySqlServer.schema.mof | 11 - .../MSFT_xMySqlUser/MSFT_xMySqlUser.psm1 | 154 - .../MSFT_xMySqlUser.schema.mof | 12 - .../en-US/MSFT_xMySqlUser.strings.psd1 | 14 - .../MSFT_xMySqlUser/xMySqlUserDesigner.ps1 | 26 - .../xMySqlProvision.Schema.psm1 | 89 - .../xMySqlProvision/xMySqlProvision.psd1 | 97 - lib/puppet_x/dsc_resources/xMySql/LICENSE | 21 - .../xMySql/MSFT_xMySqlUtilities.psm1 | 315 -- lib/puppet_x/dsc_resources/xMySql/xMySql.psd1 | 63 - .../MSFT_xDNSServerAddress.psm1 | 354 --- .../MSFT_xDNSServerAddress.schema.mof | 8 - .../en-US/MSFT_xDNSServerAddress.strings.psd1 | 16 - .../MSFT_xDefaultGatewayAddress.psm1 | 346 --- .../MSFT_xDefaultGatewayAddress.schema.mof | 7 - .../MSFT_xDefaultGatewayAddress.strings.psd1 | 18 - .../MSFT_xDhcpClient/MSFT_xDhcpClient.psm1 | 233 -- .../MSFT_xDhcpClient.schema.mof | 7 - .../en-US/MSFT_xDhcpClient.strings.psd1 | 10 - .../MSFT_xDnsClientGlobalSetting.data.psd1 | 16 - .../MSFT_xDnsClientGlobalSetting.psm1 | 232 -- .../MSFT_xDnsClientGlobalSetting.schema.mof | 8 - .../MSFT_xDnsClientGlobalSetting.strings.psd1 | 10 - .../MSFT_xDnsConnectionSuffix.psm1 | 273 -- .../MSFT_xDnsConnectionSuffix.schema.mof | 9 - .../MSFT_xDnsConnectionSuffix.strings.psd1 | 10 - .../MSFT_xFirewall/MSFT_xFirewall.Schema.mof | 37 - .../MSFT_xFirewall/MSFT_xFirewall.data.psd1 | 36 - .../MSFT_xFirewall/MSFT_xFirewall.psm1 | 1352 --------- .../en-US/MSFT_xFirewall.strings.psd1 | 24 - .../MSFT_xFirewallProfile.data.psd1 | 72 - .../MSFT_xFirewallProfile.psm1 | 475 --- .../MSFT_xFirewallProfile.schema.mof | 22 - .../en-US/MSFT_xFirewallProfile.strings.psd1 | 10 - .../MSFT_xHostsFile/MSFT_xHostsFile.psm1 | 266 -- .../MSFT_xHostsFile.schema.mof | 7 - .../en-US/MSFT_xHostsFile.strings.psd1 | 11 - .../MSFT_xIPAddress/MSFT_xIPAddress.psm1 | 476 --- .../MSFT_xIPAddress.schema.mof | 7 - .../en-US/MSFT_xIPAddress.strings.psd1 | 20 - .../MSFT_xNetAdapterBinding.psm1 | 281 -- .../MSFT_xNetAdapterBinding.schema.mof | 8 - .../MSFT_xNetAdapterBinding.strings.psd1 | 13 - .../MSFT_xNetAdapterLso.psm1 | 237 -- .../MSFT_xNetAdapterLso.schema.mof | 7 - .../en-US/MSFT_xNetAdapterLso.strings.psd1 | 9 - .../MSFT_xNetAdapterName.psm1 | 399 --- .../MSFT_xNetAdapterName.schema.mof | 15 - .../en-us/MSFT_xNetAdapterName.strings.psd1 | 11 - .../MSFT_xNetAdapterRDMA.psm1 | 156 - .../MSFT_xNetAdapterRDMA.schema.mof | 6 - .../en-US/MSFT_xNetAdapterRDMA.strings.psd1 | 10 - .../MSFT_xNetBIOS/MSFT_xNetBIOS.psm1 | 196 -- .../MSFT_xNetBIOS/MSFT_xNetBIOS.schema.mof | 7 - .../en-US/MSFT_xNetBIOS.strings.psd1 | 13 - .../MSFT_xNetConnectionProfile.psm1 | 232 -- .../MSFT_xNetConnectionProfile.schema.mof | 8 - .../MSFT_xNetConnectionProfile.strings.psd1 | 11 - .../MSFT_xNetworkTeam/MSFT_xNetworkTeam.psm1 | 306 -- .../MSFT_xNetworkTeam.schema.mof | 9 - .../en-US/MSFT_xNetworkTeam.strings.psd1 | 24 - .../MSFT_xNetworkTeamInterface.psm1 | 245 -- .../MSFT_xNetworkTeamInterface.schema.mof | 9 - .../MSFT_xNetworkTeamInterface.strings.psd1 | 19 - .../DSCResources/MSFT_xRoute/MSFT_xRoute.psm1 | 675 ----- .../MSFT_xRoute/MSFT_xRoute.schema.mof | 12 - .../en-US/MSFT_xRoute.strings.psd1 | 22 - .../dsc_resources/xNetworking/LICENSE | 21 - .../NetworkingDsc.Common.psm1 | 428 --- .../en-us/NetworkingDsc.Common.strings.psd1 | 12 - .../NetworkingDsc.ResourceHelper.psm1 | 173 -- .../xNetworking/PSScriptAnalyzerSettings.psd1 | 10 - .../xNetworking/xNetworking.psd1 | 112 - .../PublishModulesAndMofsToPullServer.psm1 | 302 -- .../MSFT_xArchive/MSFT_xArchive.psm1 | 1604 ---------- .../MSFT_xArchive/MSFT_xArchive.schema.mof | 11 - .../en-US/MSFT_xArchive.schema.mfl | Bin 5900 -> 0 bytes .../en-US/MSFT_xArchive.strings.psd1 | 57 - .../MSFT_xDSCWebService.Schema.mof | 19 - .../MSFT_xDSCWebService.psm1 | 691 ----- .../MSFT_xDSCWebService/PSWSIISEndpoint.psm1 | 709 ----- .../SecureTLSProtocols.psm1 | 48 - .../UseSecurityBestPractices.psm1 | 38 - .../MSFT_xEnvironmentResource.psm1 | 1145 ------- .../MSFT_xEnvironmentResource.schema.mof | 9 - .../MSFT_xEnvironmentResource.schema.mfl | Bin 1522 -> 0 bytes .../MSFT_xEnvironmentResource.strings.psd1 | 21 - .../MSFT_xGroupResource.psm1 | 2572 ---------------- .../MSFT_xGroupResource.schema.mof | 12 - .../en-US/MSFT_xGroupResource.schema.mfl | Bin 1694 -> 0 bytes .../en-US/MSFT_xGroupResource.strings.psd1 | 36 - .../MSFT_xMsiPackage/MSFT_xMsiPackage.psm1 | 1636 ---------- .../MSFT_xMsiPackage.schema.mof | 23 - .../en-US/MSFT_xMsiPackage.schema.mfl | Bin 4568 -> 0 bytes .../en-US/MSFT_xMsiPackage.strings.psd1 | 44 - .../MSFT_xPSSessionConfiguration.psm1 | 796 ----- .../MSFT_xPSSessionConfiguration.schema.mof | 11 - .../MSFT_xPackageResource.psm1 | 1970 ------------ .../MSFT_xPackageResource.schema.mof | 29 - .../en-US/MSFT_xPackageResource.schema.mfl | 32 - .../en-US/MSFT_xPackageResource.strings.psd1 | 68 - .../MSFT_xRegistryResource.psm1 | 1451 --------- .../MSFT_xRegistryResource.schema.mof | 11 - .../en-US/MSFT_xRegistryResource.schema.mfl | 11 - .../en-US/MSFT_xRegistryResource.strings.psd1 | 38 - .../MSFT_xRemoteFile/MSFT_xRemoteFile.psm1 | 586 ---- .../MSFT_xRemoteFile.schema.mof | 18 - .../en-us/MSFT_xRemoteFile.psd1 | 22 - .../MSFT_xScriptResource.psm1 | 283 -- .../MSFT_xScriptResource.schema.mof | 10 - .../en-US/MSFT_xScriptResource.schema.mfl | Bin 1936 -> 0 bytes .../en-US/MSFT_xScriptResource.strings.psd1 | 16 - .../MSFT_xUserResource.psm1 | 1341 --------- .../MSFT_xUserResource.schema.mof | 13 - .../en-US/MSFT_xUserResource.schema.mfl | Bin 2418 -> 0 bytes .../en-US/MSFT_xUserResource.strings.psd1 | 23 - .../MSFT_xWindowsFeature.psm1 | 554 ---- .../MSFT_xWindowsFeature.schema.mof | 11 - .../en-US/MSFT_xWindowsFeature.schema.mfl | Bin 2160 -> 0 bytes .../en-US/MSFT_xWindowsFeature.strings.psd1 | 23 - .../MSFT_xWindowsOptionalFeature.psm1 | 385 --- .../MSFT_xWindowsOptionalFeature.schema.mof | 14 - .../MSFT_xWindowsOptionalFeature.schema.mfl | Bin 3260 -> 0 bytes .../MSFT_xWindowsOptionalFeature.strings.psd1 | 20 - .../MSFT_xWindowsPackageCab.psm1 | 225 -- .../MSFT_xWindowsPackageCab.schema.mof | 9 - .../en-US/MSFT_xWindowsPackageCab.schema.mfl | 8 - .../MSFT_xWindowsPackageCab.strings.psd1 | 13 - .../MSFT_xWindowsProcess.psm1 | 1491 ---------- .../MSFT_xWindowsProcess.schema.mof | 18 - .../en-US/MSFT_xWindowsProcess.schema.mfl | Bin 3574 -> 0 bytes .../en-US/MSFT_xWindowsProcess.strings.psd1 | 36 - .../DSCResources/xFileUpload/xFileUpload.psd1 | 89 - .../xFileUpload/xFileUpload.schema.psm1 | 544 ---- .../DSCResources/xGroupSet/xGroupSet.psd1 | 27 - .../xGroupSet/xGroupSet.schema.psm1 | 68 - .../DSCResources/xProcessSet/xProcessSet.psd1 | 27 - .../xProcessSet/xProcessSet.schema.psm1 | 96 - .../xWindowsFeatureSet.psd1 | 27 - .../xWindowsFeatureSet.schema.psm1 | 78 - .../xWindowsOptionalFeatureSet.psd1 | 27 - .../xWindowsOptionalFeatureSet.schema.psm1 | 77 - .../GenerateXRemoteFileSchema.ps1 | 10 - .../New-PSSessionConfigurationResource.ps1 | 18 - .../MSFT_xPendingReboot.psm1 | 135 - .../MSFT_xPendingReboot.schema.mof | 20 - .../dsc_resources/xPendingReboot/LICENSE | 21 - .../xPendingReboot/xPendingReboot.psd1 | 57 - .../xPhpProvision/xPhpProvision.Schema.psm1 | 140 - .../xPhpProvision/xPhpProvision.psd1 | 94 - lib/puppet_x/dsc_resources/xPhp/LICENSE | 21 - lib/puppet_x/dsc_resources/xPhp/xPhp.psd1 | 97 - .../MSFT_xPowerShellExecutionPolicy.psm1 | 78 - ...MSFT_xPowerShellExecutionPolicy.schema.mof | 9 - .../xPowerShellExecutionPolicy/LICENSE | 21 - .../xPowerShellExecutionPolicy.psd1 | 61 - .../xRemoteDesktopAdmin.psm1 | 157 - .../xRemoteDesktopAdmin.schema.mof | 10 - .../dsc_resources/xRemoteDesktopAdmin/LICENSE | 21 - .../xRemoteDesktopAdmin.psd1 | 32 - .../MSFT_xRDRemoteApp/MSFT_xRDRemoteApp.psm1 | 133 - .../MSFT_xRDRemoteApp.schema.mof | 19 - .../MSFT_xRDSessionCollection.psm1 | 85 - .../MSFT_xRDSessionCollection.schema.mof | 12 - ...SFT_xRDSessionCollectionConfiguration.psm1 | 152 - ...DSessionCollectionConfiguration.schema.mof | 33 - .../MSFT_xRDSessionDeployment.psm1 | 76 - .../MSFT_xRDSessionDeployment.schema.mof | 11 - .../xRemoteDesktopSessionHost/LICENSE | 21 - .../xRemoteDesktopSessionHost.psd1 | 61 - .../xRemoteDesktopSessionHostCommon.psm1 | 12 - .../MSFT_xRobocopy/MSFT_xRobocopy.psm1 | 301 -- .../MSFT_xRobocopy/MSFT_xRobocopy.schema.mof | 18 - lib/puppet_x/dsc_resources/xRobocopy/LICENSE | 22 - .../xDscResourceDesigner_CreateScript.ps1 | 162 - .../dsc_resources/xRobocopy/xRobocopy.psd1 | 126 - .../MSFT_xSCDPMConsoleSetup.psm1 | 184 -- .../MSFT_xSCDPMConsoleSetup.schema.mof | 8 - .../MSFT_xSCDPMDatabaseServerSetup.psm1 | 178 -- .../MSFT_xSCDPMDatabaseServerSetup.schema.mof | 8 - .../MSFT_xSCDPMServerSetup.psm1 | 373 --- .../MSFT_xSCDPMServerSetup.schema.mof | 18 - lib/puppet_x/dsc_resources/xSCDPM/LICENSE | 21 - .../xSCDPM/en-US/xPDT.strings.psd1 | 10 - lib/puppet_x/dsc_resources/xSCDPM/xPDT.psm1 | 708 ----- lib/puppet_x/dsc_resources/xSCDPM/xSCDPM.psd1 | 31 - .../MSFT_xSCOMAdmin/MSFT_xSCOMAdmin.psm1 | 147 - .../MSFT_xSCOMAdmin.schema.mof | 8 - .../MSFT_xSCOMConsoleSetup.psm1 | 256 -- .../MSFT_xSCOMConsoleSetup.schema.mof | 13 - .../MSFT_xSCOMConsoleUpdate.psm1 | 183 -- .../MSFT_xSCOMConsoleUpdate.schema.mof | 9 - .../MSFT_xSCOMManagementPack.psm1 | 237 -- .../MSFT_xSCOMManagementPack.schema.mof | 11 - .../MSFT_xSCOMManagementServerSetup.psm1 | 543 ---- ...MSFT_xSCOMManagementServerSetup.schema.mof | 31 - .../MSFT_xSCOMManagementServerUpdate.psm1 | 183 -- ...SFT_xSCOMManagementServerUpdate.schema.mof | 9 - .../MSFT_xSCOMReportingServerSetup.psm1 | 333 --- .../MSFT_xSCOMReportingServerSetup.schema.mof | 17 - .../MSFT_xSCOMWebConsoleServerSetup.psm1 | 315 -- ...MSFT_xSCOMWebConsoleServerSetup.schema.mof | 17 - .../MSFT_xSCOMWebConsoleServerUpdate.psm1 | 183 -- ...SFT_xSCOMWebConsoleServerUpdate.schema.mof | 9 - lib/puppet_x/dsc_resources/xSCOM/LICENSE | 21 - .../xSCOM/en-US/xPDT.strings.psd1 | 10 - lib/puppet_x/dsc_resources/xSCOM/xPDT.psm1 | 708 ----- lib/puppet_x/dsc_resources/xSCOM/xSCOM.psd1 | 31 - .../MSFT_xRunbookDirectory.psm1 | 250 -- .../MSFT_xRunbookDirectory.schema.mof | 10 - .../MSFT_xSCSMAPowerShellSetup.psm1 | 199 -- .../MSFT_xSCSMAPowerShellSetup.schema.mof | 8 - .../MSFT_xSCSMARunbookWorkerServerSetup.psm1 | 367 --- ..._xSCSMARunbookWorkerServerSetup.schema.mof | 18 - .../MSFT_xSCSMAWebServiceServerSetup.psm1 | 505 ---- ...SFT_xSCSMAWebServiceServerSetup.schema.mof | 26 - .../MSFT_xSmaCredential.psm1 | 128 - .../MSFT_xSmaCredential.schema.mof | 12 - .../MSFT_xSmaVariable/MSFT_xSmaVariable.psm1 | 173 -- .../MSFT_xSmaVariable.schema.mof | 14 - lib/puppet_x/dsc_resources/xSCSMA/LICENSE | 21 - .../xSCSMA/en-US/xPDT.strings.psd1 | 10 - lib/puppet_x/dsc_resources/xSCSMA/xPDT.psm1 | 708 ----- lib/puppet_x/dsc_resources/xSCSMA/xSCSMA.psd1 | 60 - .../MSFT_xSCSPFServer/MSFT_xSCSPFServer.psm1 | 143 - .../MSFT_xSCSPFServer.schema.mof | 8 - .../MSFT_xSCSPFServerSetup.psm1 | 490 --- .../MSFT_xSCSPFServerSetup.schema.mof | 28 - .../MSFT_xSCSPFServerUpdate.psm1 | 183 -- .../MSFT_xSCSPFServerUpdate.schema.mof | 9 - .../MSFT_xSCSPFSetting.psm1 | 171 -- .../MSFT_xSCSPFSetting.schema.mof | 10 - .../MSFT_xSCSPFStamp/MSFT_xSCSPFStamp.psm1 | 180 -- .../MSFT_xSCSPFStamp.schema.mof | 8 - lib/puppet_x/dsc_resources/xSCSPF/LICENSE | 21 - .../xSCSPF/en-US/xPDT.strings.psd1 | 10 - lib/puppet_x/dsc_resources/xSCSPF/xPDT.psm1 | 708 ----- lib/puppet_x/dsc_resources/xSCSPF/xSCSPF.psd1 | 31 - .../MSFT_xSCSRServerSetup.psm1 | 390 --- .../MSFT_xSCSRServerSetup.schema.mof | 19 - .../MSFT_xSCSRServerUpdate.psm1 | 183 -- .../MSFT_xSCSRServerUpdate.schema.mof | 9 - lib/puppet_x/dsc_resources/xSCSR/LICENSE | 21 - .../xSCSR/en-US/xPDT.strings.psd1 | 10 - lib/puppet_x/dsc_resources/xSCSR/xPDT.psm1 | 708 ----- lib/puppet_x/dsc_resources/xSCSR/xSCSR.psd1 | 31 - .../MSFT_xSCVMMAdmin/MSFT_xSCVMMAdmin.psm1 | 129 - .../MSFT_xSCVMMAdmin.schema.mof | 8 - .../MSFT_xSCVMMConsoleSetup.psm1 | 259 -- .../MSFT_xSCVMMConsoleSetup.schema.mof | 11 - .../MSFT_xSCVMMConsoleUpdate.psm1 | 183 -- .../MSFT_xSCVMMConsoleUpdate.schema.mof | 9 - .../MSFT_xSCVMMManagementServerSetup.psm1 | 628 ---- ...SFT_xSCVMMManagementServerSetup.schema.mof | 37 - .../MSFT_xSCVMMManagementServerUpdate.psm1 | 183 -- ...FT_xSCVMMManagementServerUpdate.schema.mof | 9 - lib/puppet_x/dsc_resources/xSCVMM/LICENSE | 21 - .../xSCVMM/en-US/xPDT.strings.psd1 | 10 - lib/puppet_x/dsc_resources/xSCVMM/xPDT.psm1 | 708 ----- lib/puppet_x/dsc_resources/xSCVMM/xSCVMM.psd1 | 31 - .../MSFT_xSQLAOGroupEnsure.psm1 | 367 --- .../MSFT_xSQLAOGroupEnsure.schema.mof | 17 - .../MSFT_xSQLAOGroupJoin.psm1 | 227 -- .../MSFT_xSQLAOGroupJoin.schema.mof | 10 - .../MSFT_xSQLServerAlias.psm1 | 289 -- .../MSFT_xSQLServerAlias.schema.mof | 11 - ...T_xSQLServerAlwaysOnAvailabilityGroup.psm1 | 758 ----- ...ServerAlwaysOnAvailabilityGroup.schema.mof | 18 - ...erverAlwaysOnAvailabilityGroupReplica.psm1 | 738 ----- ...lwaysOnAvailabilityGroupReplica.schema.mof | 20 - .../MSFT_xSQLServerAlwaysOnService.psm1 | 186 -- .../MSFT_xSQLServerAlwaysOnService.schema.mof | 8 - ...T_xSQLServerAvailabilityGroupListener.psm1 | 494 --- ...ServerAvailabilityGroupListener.schema.mof | 14 - .../MSFT_xSQLServerConfiguration.psm1 | 213 -- .../MSFT_xSQLServerConfiguration.schema.mof | 10 - .../MSFT_xSQLServerDatabase.psm1 | 245 -- .../MSFT_xSQLServerDatabase.schema.mof | 8 - .../MSFT_xSQLServerDatabaseOwner.psm1 | 208 -- .../MSFT_xSQLServerDatabaseOwner.schema.mof | 8 - .../MSFT_xSQLServerDatabasePermission.psm1 | 278 -- ...FT_xSQLServerDatabasePermission.schema.mof | 11 - .../MSFT_xSQLServerDatabaseRecoveryModel.psm1 | 199 -- ...xSQLServerDatabaseRecoveryModel.schema.mof | 8 - .../MSFT_xSQLServerDatabaseRole.psm1 | 377 --- .../MSFT_xSQLServerDatabaseRole.schema.mof | 10 - .../MSFT_xSQLServerEndpoint.psm1 | 281 -- .../MSFT_xSQLServerEndpoint.schema.mof | 10 - .../MSFT_xSQLServerEndpointPermission.psm1 | 249 -- ...FT_xSQLServerEndpointPermission.schema.mof | 12 - .../MSFT_xSQLServerEndpointState.psm1 | 205 -- .../MSFT_xSQLServerEndpointState.schema.mof | 8 - .../MSFT_xSQLServerFailoverClusterSetup.psm1 | 1038 ------- ..._xSQLServerFailoverClusterSetup.schema.mof | 51 - .../MSFT_xSQLServerFirewall.psm1 | 806 ----- .../MSFT_xSQLServerFirewall.schema.mof | 14 - .../MSFT_xSQLServerLogin.psm1 | 615 ---- .../MSFT_xSQLServerLogin.schema.mof | 15 - .../MSFT_xSQLServerMaxDop.psm1 | 282 -- .../MSFT_xSQLServerMaxDop.schema.mof | 9 - .../MSFT_xSQLServerMemory.psm1 | 366 --- .../MSFT_xSQLServerMemory.schema.mof | 10 - .../MSFT_xSQLServerNetwork.psm1 | 287 -- .../MSFT_xSQLServerNetwork.schema.mof | 10 - .../MSFT_xSQLServerPermission.psm1 | 252 -- .../MSFT_xSQLServerPermission.schema.mof | 11 - .../MSFT_xSQLServerRSConfig.psm1 | 229 -- .../MSFT_xSQLServerRSConfig.schema.mof | 9 - ...SFT_xSQLServerRSSecureConnectionLevel.psm1 | 114 - ...QLServerRSSecureConnectionLevel.schema.mof | 7 - .../MSFT_xSQLServerReplication.psm1 | 505 ---- .../MSFT_xSQLServerReplication.schema.mof | 13 - .../MSFT_xSQLServerRole.psm1 | 541 ---- .../MSFT_xSQLServerRole.schema.mof | 11 - .../MSFT_xSQLServerScript.Schema.mof | 11 - .../MSFT_xSQLServerScript.psm1 | 283 -- .../MSFT_xSQLServerSetup.psm1 | 1973 ------------ .../MSFT_xSQLServerSetup.schema.mof | 54 - .../MSFT_xWaitForAvailabilityGroup.psm1 | 126 - .../MSFT_xWaitForAvailabilityGroup.schema.mof | 9 - lib/puppet_x/dsc_resources/xSQLServer/LICENSE | 21 - .../xSQLServer/en-US/xPDT.strings.psd1 | 11 - .../xSQLServer/en-US/xSQLServer.strings.psd1 | 114 - .../dsc_resources/xSQLServer/xPDT.psm1 | 708 ----- .../dsc_resources/xSQLServer/xSQLServer.psd1 | 174 -- .../xSQLServer/xSQLServerHelper.psm1 | 1428 --------- .../MSFT_xSmbShare/MSFT_xSmbShare.psm1 | 354 --- .../MSFT_xSmbShare/MSFT_xSmbShare.schema.mof | 23 - lib/puppet_x/dsc_resources/xSmbShare/LICENSE | 21 - .../dsc_resources/xSmbShare/xSmbShare.psd1 | 62 - .../MSFT_xSqlAlias/MSFT_xSqlAlias.psm1 | 324 -- .../MSFT_xSqlAlias/MSFT_xSqlAlias.schema.mof | 12 - .../MSFT_xSqlHAEndPoint.psm1 | 156 - .../MSFT_xSqlHAEndPoint.schema.mof | 12 - .../MSFT_xSqlHAGroup/MSFT_xSqlHAGroup.psm1 | 422 --- .../MSFT_xSqlHAGroup.schema.mof | 19 - .../MSFT_xSqlHAService.psm1 | 223 -- .../MSFT_xSqlHAService.schema.mof | 15 - .../MSFT_xSqlServerInstall.psm1 | 337 --- .../MSFT_xSqlServerInstall.schema.mof | 30 - .../MSFT_xWaitForSqlHAGroup.psm1 | 284 -- .../MSFT_xWaitForSqlHAGroup.schema.mof | 18 - lib/puppet_x/dsc_resources/xSqlPs/LICENSE | 21 - lib/puppet_x/dsc_resources/xSqlPs/xSqlPs.psd1 | 45 - .../DSCResources/MSFT_xDisk/MSFT_xDisk.psm1 | 806 ----- .../MSFT_xDisk/MSFT_xDisk.schema.mof | 14 - .../MSFT_xDisk/en-us/MSFT_xDisk.strings.psd1 | 38 - .../MSFT_xDiskAccessPath.psm1 | 682 ----- .../MSFT_xDiskAccessPath.schema.mof | 12 - .../en-us/MSFT_xDiskAccessPath.strings.psd1 | 34 - .../MSFT_xMountImage/MSFT_xMountImage.psm1 | 591 ---- .../MSFT_xMountImage.schema.mof | 11 - .../en-us/MSFT_xMountImage.strings.psd1 | 22 - .../MSFT_xWaitForDisk/MSFT_xWaitForDisk.psm1 | 231 -- .../MSFT_xWaitForDisk.schema.mof | 9 - .../en-us/MSFT_xWaitForDisk.strings.psd1 | 12 - .../MSFT_xWaitForVolume.psm1 | 210 -- .../MSFT_xWaitForVolume.schema.mof | 8 - .../en-us/MSFT_xWaitForVolume.strings.psd1 | 12 - lib/puppet_x/dsc_resources/xStorage/LICENSE | 22 - .../StorageDsc.Common/StorageDsc.Common.psm1 | 107 - .../en-us/StorageDsc.Common.strings.psd1 | 4 - .../StorageDsc.ResourceHelper.psm1 | 170 -- .../dsc_resources/xStorage/xStorage.psd1 | 137 - .../xTimeZone/DSCResources/SetTimeZone.cs | 268 -- .../DSCResources/TimezoneHelper.psm1 | 189 -- .../DSCResources/en-us/TimezoneHelper.psd1 | 8 - .../xTimeZone/en-us/xTimeZone.psd1 | 6 - .../DSCResources/xTimeZone/xTimeZone.psm1 | 119 - .../xTimeZone/xTimeZone.schema.mof | 6 - lib/puppet_x/dsc_resources/xTimeZone/LICENSE | 21 - .../dsc_resources/xTimeZone/xTimeZone.psd1 | 66 - .../DSCResources/Helper.psm1 | 63 - .../MSFT_xIIsHandler/MSFT_xIisHandler.psm1 | 959 ------ .../MSFT_xIisHandler.schema.mof | 6 - .../MSFT_xIisFeatureDelegation.psm1 | 146 - .../MSFT_xIisFeatureDelegation.schema.mof | 6 - .../MSFT_xIisLogging/MSFT_xIisLogging.psm1 | 311 -- .../MSFT_xIisLogging.schema.mof | 10 - .../MSFT_xIisMimeTypeMapping.psm1 | 192 -- .../MSFT_xIisMimeTypeMapping.schema.mof | 7 - .../MSFT_xIisModule/MSFT_xIisModule.psm1 | 414 --- .../MSFT_xIisModule.schema.mof | 17 - .../MSFT_xIisModule/xIisModuleDesigner.ps1 | 50 - .../MSFT_xSSLSettings/MSFT_xSSLSettings.psm1 | 175 -- .../MSFT_xSSLSettings.schema.mof | 7 - .../MSFT_xWebAppPool/MSFT_xWebAppPool.psm1 | 927 ------ .../MSFT_xWebAppPool.schema.mof | 55 - .../MSFT_xWebAppPoolDefaults.psm1 | 215 -- .../MSFT_xWebAppPoolDefaults.schema.mof | 8 - .../MSFT_xWebApplication.psm1 | 834 ------ .../MSFT_xWebApplication.schema.mof | 25 - .../MSFT_xWebConfigKeyValue.psm1 | 404 --- .../MSFT_xWebConfigKeyValue.schema.mof | 10 - .../MSFT_xWebSiteDefaults.psm1 | 245 -- .../MSFT_xWebSiteDefaults.schema.mof | 10 - .../MSFT_xWebVirtualDirectory.psm1 | 211 -- .../MSFT_xWebVirtualDirectory.schema.mof | 10 - .../MSFT_xWebsite/MSFT_xWebsite.psm1 | 2106 ------------- .../MSFT_xWebsite/MSFT_xWebsite.schema.mof | 45 - .../dsc_resources/xWebAdministration/LICENSE | 21 - .../xWebAdministration.psd1 | 69 - .../xWebDeploy/xWebDeploy.Schema.psm1 | 73 - .../DSCResources/xWebDeploy/xWebDeploy.psd1 | 96 - .../xWebPackageDeploy/xWebPackageDeploy.psm1 | 203 -- .../xWebPackageDeploy.schema.mof | 12 - lib/puppet_x/dsc_resources/xWebDeploy/LICENSE | 21 - .../dsc_resources/xWebDeploy/xWebDeploy.psd1 | 119 - .../MSFT_xWinEventLog/MSFT_xWinEventLog.psm1 | 240 -- .../MSFT_xWinEventLog.schema.mof | 14 - .../dsc_resources/xWinEventLog/LICENSE | 21 - .../xWinEventLog/xWinEventLog.psd1 | 98 - .../xWinEventLog/xWinEventLog.psm1 | 18 - .../MSFT_xWEFCollector.psm1 | 77 - .../MSFT_xWEFCollector.schema.mof | 8 - .../MSFT_xWEFSubscription.psm1 | 331 --- .../MSFT_xWEFSubscription.schema.mof | 26 - .../xWindowsEventForwarding/LICENSE | 22 - .../xWindowsEventForwarding.psd1 | 120 - .../xSystemRestore/xSystemRestore.psm1 | 120 - .../xSystemRestore/xSystemRestore.schema.mof | 10 - .../xSystemRestorePoint.psm1 | 205 -- .../xSystemRestorePoint.schema.mof | 11 - .../dsc_resources/xWindowsRestore/LICENSE | 21 - .../xWindowsRestore/xWindowsRestore.psd1 | 31 - .../MSFT_xMicrosoftUpdate.psm1 | 122 - .../MSFT_xMicrosoftUpdate.schema.mof | 6 - .../MSFT_xWindowsUpdate.psm1 | 418 --- .../MSFT_xWindowsUpdate.schema.mof | 13 - .../MSFT_xWindowsUpdateAgent.psm1 | 614 ---- .../MSFT_xWindowsUpdateAgent.schema.mof | 17 - .../dsc_resources/xWindowsUpdate/LICENSE | 21 - .../xWindowsUpdate/xWindowsUpdate.psd1 | 60 - .../MSFT_xWordPressSite.psm1 | 156 - .../MSFT_xWordPressSite.schema.mof | 13 - .../MSFT_xWordPressSite/xWordPressSite.ps1 | 55 - .../xIisWordPressSite.Schema.psm1 | 84 - .../xIisWordPressSite/xIisWordPressSite.psd1 | 96 - lib/puppet_x/dsc_resources/xWordPress/LICENSE | 21 - .../dsc_resources/xWordPress/xWordPress.psd1 | 36 - spec/unit/puppet/type/dsc_archive_spec.rb | 403 --- spec/unit/puppet/type/dsc_environment_spec.rb | 244 -- spec/unit/puppet/type/dsc_file_spec.rb | 559 ---- spec/unit/puppet/type/dsc_group_spec.rb | 280 -- spec/unit/puppet/type/dsc_log_spec.rb | 72 - spec/unit/puppet/type/dsc_package_spec.rb | 484 --- spec/unit/puppet/type/dsc_registry_spec.rb | 401 --- spec/unit/puppet/type/dsc_script_spec.rb | 183 -- spec/unit/puppet/type/dsc_service_spec.rb | 438 --- spec/unit/puppet/type/dsc_user_spec.rb | 435 --- .../puppet/type/dsc_windowsfeature_spec.rb | 308 -- .../type/dsc_windowsoptionalfeature_spec.rb | 413 --- .../puppet/type/dsc_windowsprocess_spec.rb | 479 --- .../environment/env_delete_var.rb | 46 - .../environment/env_new_var.rb | 50 - .../environment/env_no_value.rb | 48 - .../environment/env_update_path_var.rb | 54 - .../environment/env_update_var.rb | 59 - .../basic_dsc_resources/file/dir_recurse.rb | 83 - .../file/dir_remove_dir.rb | 47 - .../file/dir_valid_path.rb | 52 - .../file/dir_valid_unicode_path.rb | 44 - .../file/file_remove_file.rb | 47 - .../file/file_valid_path_contents.rb | 50 - .../file/file_valid_path_source.rb | 71 - .../file/file_valid_unicode_contents.rb | 52 - .../file/file_valid_unicode_path.rb | 44 - .../file/file_valid_unicode_source.rb | 55 - .../file/negative/file_invalid_force.rb | 31 - .../file/negative/file_invalid_path.rb | 30 - .../file/negative/file_invalid_sourcepath.rb | 30 - .../basic_dsc_resources/group/group_remove.rb | 45 - .../group/group_unicode_groupname.rb | 55 - .../group/group_valid_members.rb | 50 - .../negative/group_add_non-existent_user.rb | 31 - .../group/negative/group_invalid_groupname.rb | 30 - .../group/negative/group_member_conflict.rb | 32 - .../negative/package_failed_install.rb | 71 - .../package/negative/package_invalid_msi.rb | 57 - .../package/negative/package_invalid_path.rb | 32 - .../negative/package_invalid_productid.rb | 57 - .../package/package_uninstall.rb | 85 - .../package/package_valid_args.rb | 69 - .../package/package_valid_msi.rb | 75 - .../package/package_valid_returncode.rb | 81 - .../negative/reg_invalid_binary_value.rb | 32 - .../negative/reg_invalid_dword_value.rb | 32 - .../registry/negative/reg_invalid_key.rb | 31 - .../registry/reg_force_value.rb | 66 - .../registry/reg_remove_value.rb | 51 - .../registry/reg_valid_binary_valuedata.rb | 55 - .../registry/reg_valid_dword_hex_valuedata.rb | 57 - .../registry/reg_valid_dword_valuedata.rb | 55 - .../registry/reg_valid_implicit_valuedata.rb | 53 - .../registry/reg_valid_key_valuename.rb | 51 - .../service_incompatible_startup_state.rb | 30 - .../service/negative/service_invalid_name.rb | 30 - .../service/service_remove.rb | 42 - .../service_valid_name_startuptype_state.rb | 51 - .../user/negative/user_invalid_password.rb | 31 - .../user_invalid_passwordneverexpires.rb | 31 - .../user/negative/user_invalid_username.rb | 30 - .../basic_dsc_resources/user/user_remove.rb | 45 - .../user/user_valid_password.rb | 54 - .../user/user_valid_unicode.rb | 61 - .../negative/waitforall_blacklist.rb | 29 - .../negative/waitforany_blacklist.rb | 29 - .../negative/waitforsome_blacklist.rb | 29 - .../negative/process_invalid_path.rb | 31 - .../windowsprocess/process_kill.rb | 47 - .../windowsprocess/process_valid_args.rb | 49 - .../tests/user_scenarios/vendored_resource.rb | 54 - tests/files/test_installer/README.md | 9 - tests/files/test_installer/test.nsi | 58 - tests/files/test_installer/test.txt | 1 - .../test_installer/test_program_installer.exe | Bin 48629 -> 0 bytes .../create_mysql_database_server.rb | 142 - .../tests/user_scenarios/kitchen_sink.rb | 181 -- .../negative/blacklist_xchrome.rb | 35 - .../negative/blacklist_xfirefox.rb | 35 - .../user_scenarios/kitchen_sink.pp.erb | 101 - 1489 files changed, 267135 deletions(-) delete mode 100644 lib/puppet/type/dsc_archive.rb delete mode 100644 lib/puppet/type/dsc_auditpolicycsv.rb delete mode 100644 lib/puppet/type/dsc_auditpolicyoption.rb delete mode 100644 lib/puppet/type/dsc_auditpolicysubcategory.rb delete mode 100644 lib/puppet/type/dsc_environment.rb delete mode 100644 lib/puppet/type/dsc_group.rb delete mode 100644 lib/puppet/type/dsc_log.rb delete mode 100644 lib/puppet/type/dsc_officeonlineserverfarm.rb delete mode 100644 lib/puppet/type/dsc_officeonlineserverinstall.rb delete mode 100644 lib/puppet/type/dsc_officeonlineservermachine.rb delete mode 100644 lib/puppet/type/dsc_package.rb delete mode 100644 lib/puppet/type/dsc_registry.rb delete mode 100644 lib/puppet/type/dsc_runbookdirectory.rb delete mode 100644 lib/puppet/type/dsc_script.rb delete mode 100644 lib/puppet/type/dsc_securitysetting.rb delete mode 100644 lib/puppet/type/dsc_securitytemplate.rb delete mode 100644 lib/puppet/type/dsc_smavariable.rb delete mode 100644 lib/puppet/type/dsc_spaccessserviceapp.rb delete mode 100644 lib/puppet/type/dsc_spaccessservices2010.rb delete mode 100644 lib/puppet/type/dsc_spalternateurl.rb delete mode 100644 lib/puppet/type/dsc_spantivirussettings.rb delete mode 100644 lib/puppet/type/dsc_spappcatalog.rb delete mode 100644 lib/puppet/type/dsc_spappdomain.rb delete mode 100644 lib/puppet/type/dsc_spappmanagementserviceapp.rb delete mode 100644 lib/puppet/type/dsc_spappstoresettings.rb delete mode 100644 lib/puppet/type/dsc_spbcsserviceapp.rb delete mode 100644 lib/puppet/type/dsc_spblobcachesettings.rb delete mode 100644 lib/puppet/type/dsc_spcacheaccounts.rb delete mode 100644 lib/puppet/type/dsc_spconfigwizard.rb delete mode 100644 lib/puppet/type/dsc_spcontentdatabase.rb delete mode 100644 lib/puppet/type/dsc_spcreatefarm.rb delete mode 100644 lib/puppet/type/dsc_spdatabaseaag.rb delete mode 100644 lib/puppet/type/dsc_spdesignersettings.rb delete mode 100644 lib/puppet/type/dsc_spdiagnosticloggingsettings.rb delete mode 100644 lib/puppet/type/dsc_spdistributedcacheservice.rb delete mode 100644 lib/puppet/type/dsc_spexcelserviceapp.rb delete mode 100644 lib/puppet/type/dsc_spfarm.rb delete mode 100644 lib/puppet/type/dsc_spfarmadministrators.rb delete mode 100644 lib/puppet/type/dsc_spfarmpropertybag.rb delete mode 100644 lib/puppet/type/dsc_spfarmsolution.rb delete mode 100644 lib/puppet/type/dsc_spfeature.rb delete mode 100644 lib/puppet/type/dsc_sphealthanalyzerrulestate.rb delete mode 100644 lib/puppet/type/dsc_spinstall.rb delete mode 100644 lib/puppet/type/dsc_spinstalllanguagepack.rb delete mode 100644 lib/puppet/type/dsc_spinstallprereqs.rb delete mode 100644 lib/puppet/type/dsc_spirmsettings.rb delete mode 100644 lib/puppet/type/dsc_spjoinfarm.rb delete mode 100644 lib/puppet/type/dsc_spmachinetranslationserviceapp.rb delete mode 100644 lib/puppet/type/dsc_spmanagedaccount.rb delete mode 100644 lib/puppet/type/dsc_spmanagedmetadataserviceapp.rb delete mode 100644 lib/puppet/type/dsc_spmanagedpath.rb delete mode 100644 lib/puppet/type/dsc_spofficeonlineserverbinding.rb delete mode 100644 lib/puppet/type/dsc_spoutgoingemailsettings.rb delete mode 100644 lib/puppet/type/dsc_sppasswordchangesettings.rb delete mode 100644 lib/puppet/type/dsc_spperformancepointserviceapp.rb delete mode 100644 lib/puppet/type/dsc_sppowerpointautomationserviceapp.rb delete mode 100644 lib/puppet/type/dsc_spproductupdate.rb delete mode 100644 lib/puppet/type/dsc_sppublishserviceapplication.rb delete mode 100644 lib/puppet/type/dsc_spquotatemplate.rb delete mode 100644 lib/puppet/type/dsc_spremotefarmtrust.rb delete mode 100644 lib/puppet/type/dsc_spsearchauthoritativepage.rb delete mode 100644 lib/puppet/type/dsc_spsearchcontentsource.rb delete mode 100644 lib/puppet/type/dsc_spsearchcrawlerimpactrule.rb delete mode 100644 lib/puppet/type/dsc_spsearchcrawlmapping.rb delete mode 100644 lib/puppet/type/dsc_spsearchcrawlrule.rb delete mode 100644 lib/puppet/type/dsc_spsearchfiletype.rb delete mode 100644 lib/puppet/type/dsc_spsearchindexpartition.rb delete mode 100644 lib/puppet/type/dsc_spsearchresultsource.rb delete mode 100644 lib/puppet/type/dsc_spsearchserviceapp.rb delete mode 100644 lib/puppet/type/dsc_spsearchtopology.rb delete mode 100644 lib/puppet/type/dsc_spsecurestoreserviceapp.rb delete mode 100644 lib/puppet/type/dsc_spserviceapppool.rb delete mode 100644 lib/puppet/type/dsc_spserviceappproxygroup.rb delete mode 100644 lib/puppet/type/dsc_spserviceappsecurity.rb delete mode 100644 lib/puppet/type/dsc_spserviceinstance.rb delete mode 100644 lib/puppet/type/dsc_spsessionstateservice.rb delete mode 100644 lib/puppet/type/dsc_spshelladmins.rb delete mode 100644 lib/puppet/type/dsc_spsite.rb delete mode 100644 lib/puppet/type/dsc_spstateserviceapp.rb delete mode 100644 lib/puppet/type/dsc_spsubscriptionsettingsserviceapp.rb delete mode 100644 lib/puppet/type/dsc_sptimerjobstate.rb delete mode 100644 lib/puppet/type/dsc_sptrustedidentitytokenissuer.rb delete mode 100644 lib/puppet/type/dsc_sptrustedrootauthority.rb delete mode 100644 lib/puppet/type/dsc_spusageapplication.rb delete mode 100644 lib/puppet/type/dsc_spuserprofileproperty.rb delete mode 100644 lib/puppet/type/dsc_spuserprofilesection.rb delete mode 100644 lib/puppet/type/dsc_spuserprofileserviceapp.rb delete mode 100644 lib/puppet/type/dsc_spuserprofileserviceapppermissions.rb delete mode 100644 lib/puppet/type/dsc_spuserprofilesyncconnection.rb delete mode 100644 lib/puppet/type/dsc_spuserprofilesyncservice.rb delete mode 100644 lib/puppet/type/dsc_spvisioserviceapp.rb delete mode 100644 lib/puppet/type/dsc_spweb.rb delete mode 100644 lib/puppet/type/dsc_spwebappblockedfiletypes.rb delete mode 100644 lib/puppet/type/dsc_spwebappgeneralsettings.rb delete mode 100644 lib/puppet/type/dsc_spwebapplication.rb delete mode 100644 lib/puppet/type/dsc_spwebapplicationappdomain.rb delete mode 100644 lib/puppet/type/dsc_spwebapplicationextension.rb delete mode 100644 lib/puppet/type/dsc_spwebapppermissions.rb delete mode 100644 lib/puppet/type/dsc_spwebapppolicy.rb delete mode 100644 lib/puppet/type/dsc_spwebappproxygroup.rb delete mode 100644 lib/puppet/type/dsc_spwebappsiteuseanddeletion.rb delete mode 100644 lib/puppet/type/dsc_spwebappthrottlingsettings.rb delete mode 100644 lib/puppet/type/dsc_spwebappworkflowsettings.rb delete mode 100644 lib/puppet/type/dsc_spwordautomationserviceapp.rb delete mode 100644 lib/puppet/type/dsc_spworkmanagementserviceapp.rb delete mode 100644 lib/puppet/type/dsc_systemlocale.rb delete mode 100644 lib/puppet/type/dsc_user.rb delete mode 100644 lib/puppet/type/dsc_userrightsassignment.rb delete mode 100644 lib/puppet/type/dsc_windowsfeature.rb delete mode 100644 lib/puppet/type/dsc_windowsoptionalfeature.rb delete mode 100644 lib/puppet/type/dsc_windowsprocess.rb delete mode 100644 lib/puppet/type/dsc_xadcomputer.rb delete mode 100644 lib/puppet/type/dsc_xadcscertificationauthority.rb delete mode 100644 lib/puppet/type/dsc_xadcsonlineresponder.rb delete mode 100644 lib/puppet/type/dsc_xadcswebenrollment.rb delete mode 100644 lib/puppet/type/dsc_xaddomain.rb delete mode 100644 lib/puppet/type/dsc_xaddomaincontroller.rb delete mode 100644 lib/puppet/type/dsc_xaddomaindefaultpasswordpolicy.rb delete mode 100644 lib/puppet/type/dsc_xaddomaintrust.rb delete mode 100644 lib/puppet/type/dsc_xadgroup.rb delete mode 100644 lib/puppet/type/dsc_xadorganizationalunit.rb delete mode 100644 lib/puppet/type/dsc_xadrecyclebin.rb delete mode 100644 lib/puppet/type/dsc_xaduser.rb delete mode 100644 lib/puppet/type/dsc_xarchive.rb delete mode 100644 lib/puppet/type/dsc_xazureaffinitygroup.rb delete mode 100644 lib/puppet/type/dsc_xazurepackadmin.rb delete mode 100644 lib/puppet/type/dsc_xazurepackdatabasesetting.rb delete mode 100644 lib/puppet/type/dsc_xazurepackfqdn.rb delete mode 100644 lib/puppet/type/dsc_xazurepackidentityprovider.rb delete mode 100644 lib/puppet/type/dsc_xazurepackrelyingparty.rb delete mode 100644 lib/puppet/type/dsc_xazurepackresourceprovider.rb delete mode 100644 lib/puppet/type/dsc_xazurepacksetup.rb delete mode 100644 lib/puppet/type/dsc_xazurepackupdate.rb delete mode 100644 lib/puppet/type/dsc_xazurequickvm.rb delete mode 100644 lib/puppet/type/dsc_xazureservice.rb delete mode 100644 lib/puppet/type/dsc_xazuresqldatabase.rb delete mode 100644 lib/puppet/type/dsc_xazuresqldatabaseserverfirewallrule.rb delete mode 100644 lib/puppet/type/dsc_xazurestorageaccount.rb delete mode 100644 lib/puppet/type/dsc_xazuresubscription.rb delete mode 100644 lib/puppet/type/dsc_xazurevm.rb delete mode 100644 lib/puppet/type/dsc_xazurevmdscconfiguration.rb delete mode 100644 lib/puppet/type/dsc_xazurevmdscextension.rb delete mode 100644 lib/puppet/type/dsc_xblautobitlocker.rb delete mode 100644 lib/puppet/type/dsc_xblbitlocker.rb delete mode 100644 lib/puppet/type/dsc_xbltpm.rb delete mode 100644 lib/puppet/type/dsc_xcertificateexport.rb delete mode 100644 lib/puppet/type/dsc_xcertificateimport.rb delete mode 100644 lib/puppet/type/dsc_xcertreq.rb delete mode 100644 lib/puppet/type/dsc_xcluster.rb delete mode 100644 lib/puppet/type/dsc_xclusterdisk.rb delete mode 100644 lib/puppet/type/dsc_xclusternetwork.rb delete mode 100644 lib/puppet/type/dsc_xclusterpreferredowner.rb delete mode 100644 lib/puppet/type/dsc_xclusterquorum.rb delete mode 100644 lib/puppet/type/dsc_xcomputer.rb delete mode 100644 lib/puppet/type/dsc_xcredssp.rb delete mode 100644 lib/puppet/type/dsc_xdatabase.rb delete mode 100644 lib/puppet/type/dsc_xdatabaselogin.rb delete mode 100644 lib/puppet/type/dsc_xdatabaseserver.rb delete mode 100644 lib/puppet/type/dsc_xdbpackage.rb delete mode 100644 lib/puppet/type/dsc_xdefaultgatewayaddress.rb delete mode 100644 lib/puppet/type/dsc_xdfsnamespacefolder.rb delete mode 100644 lib/puppet/type/dsc_xdfsnamespaceroot.rb delete mode 100644 lib/puppet/type/dsc_xdfsnamespaceserverconfiguration.rb delete mode 100644 lib/puppet/type/dsc_xdfsreplicationgroup.rb delete mode 100644 lib/puppet/type/dsc_xdfsreplicationgroupconnection.rb delete mode 100644 lib/puppet/type/dsc_xdfsreplicationgroupfolder.rb delete mode 100644 lib/puppet/type/dsc_xdfsreplicationgroupmembership.rb delete mode 100644 lib/puppet/type/dsc_xdhcpclient.rb delete mode 100644 lib/puppet/type/dsc_xdhcpserverauthorization.rb delete mode 100644 lib/puppet/type/dsc_xdhcpserverclass.rb delete mode 100644 lib/puppet/type/dsc_xdhcpserveroption.rb delete mode 100644 lib/puppet/type/dsc_xdhcpserverreservation.rb delete mode 100644 lib/puppet/type/dsc_xdhcpserverscope.rb delete mode 100644 lib/puppet/type/dsc_xdisk.rb delete mode 100644 lib/puppet/type/dsc_xdiskaccesspath.rb delete mode 100644 lib/puppet/type/dsc_xdismfeature.rb delete mode 100644 lib/puppet/type/dsc_xdnsarecord.rb delete mode 100644 lib/puppet/type/dsc_xdnsclientglobalsetting.rb delete mode 100644 lib/puppet/type/dsc_xdnsconnectionsuffix.rb delete mode 100644 lib/puppet/type/dsc_xdnsrecord.rb delete mode 100644 lib/puppet/type/dsc_xdnsserveraddress.rb delete mode 100644 lib/puppet/type/dsc_xdnsserveradzone.rb delete mode 100644 lib/puppet/type/dsc_xdnsserverforwarder.rb delete mode 100644 lib/puppet/type/dsc_xdnsserverprimaryzone.rb delete mode 100644 lib/puppet/type/dsc_xdnsserversecondaryzone.rb delete mode 100644 lib/puppet/type/dsc_xdnsserverzonetransfer.rb delete mode 100644 lib/puppet/type/dsc_xdscwebservice.rb delete mode 100644 lib/puppet/type/dsc_xenvironment.rb delete mode 100644 lib/puppet/type/dsc_xexchactivesyncvirtualdirectory.rb delete mode 100644 lib/puppet/type/dsc_xexchantimalwarescanning.rb delete mode 100644 lib/puppet/type/dsc_xexchautodiscovervirtualdirectory.rb delete mode 100644 lib/puppet/type/dsc_xexchautomountpoint.rb delete mode 100644 lib/puppet/type/dsc_xexchclientaccessserver.rb delete mode 100644 lib/puppet/type/dsc_xexchdatabaseavailabilitygroup.rb delete mode 100644 lib/puppet/type/dsc_xexchdatabaseavailabilitygroupmember.rb delete mode 100644 lib/puppet/type/dsc_xexchdatabaseavailabilitygroupnetwork.rb delete mode 100644 lib/puppet/type/dsc_xexchecpvirtualdirectory.rb delete mode 100644 lib/puppet/type/dsc_xexcheventloglevel.rb delete mode 100644 lib/puppet/type/dsc_xexchexchangecertificate.rb delete mode 100644 lib/puppet/type/dsc_xexchexchangeserver.rb delete mode 100644 lib/puppet/type/dsc_xexchimapsettings.rb delete mode 100644 lib/puppet/type/dsc_xexchinstall.rb delete mode 100644 lib/puppet/type/dsc_xexchjetstress.rb delete mode 100644 lib/puppet/type/dsc_xexchjetstresscleanup.rb delete mode 100644 lib/puppet/type/dsc_xexchmailboxdatabase.rb delete mode 100644 lib/puppet/type/dsc_xexchmailboxdatabasecopy.rb delete mode 100644 lib/puppet/type/dsc_xexchmailboxserver.rb delete mode 100644 lib/puppet/type/dsc_xexchmailboxtransportservice.rb delete mode 100644 lib/puppet/type/dsc_xexchmaintenancemode.rb delete mode 100644 lib/puppet/type/dsc_xexchmapivirtualdirectory.rb delete mode 100644 lib/puppet/type/dsc_xexchoabvirtualdirectory.rb delete mode 100644 lib/puppet/type/dsc_xexchoutlookanywhere.rb delete mode 100644 lib/puppet/type/dsc_xexchowavirtualdirectory.rb delete mode 100644 lib/puppet/type/dsc_xexchpopsettings.rb delete mode 100644 lib/puppet/type/dsc_xexchpowershellvirtualdirectory.rb delete mode 100644 lib/puppet/type/dsc_xexchreceiveconnector.rb delete mode 100644 lib/puppet/type/dsc_xexchtransportservice.rb delete mode 100644 lib/puppet/type/dsc_xexchumcallroutersettings.rb delete mode 100644 lib/puppet/type/dsc_xexchumservice.rb delete mode 100644 lib/puppet/type/dsc_xexchwaitforadprep.rb delete mode 100644 lib/puppet/type/dsc_xexchwaitfordag.rb delete mode 100644 lib/puppet/type/dsc_xexchwaitformailboxdatabase.rb delete mode 100644 lib/puppet/type/dsc_xexchwebservicesvirtualdirectory.rb delete mode 100644 lib/puppet/type/dsc_xfirewall.rb delete mode 100644 lib/puppet/type/dsc_xfirewallprofile.rb delete mode 100644 lib/puppet/type/dsc_xgroup.rb delete mode 100644 lib/puppet/type/dsc_xhostsfile.rb delete mode 100644 lib/puppet/type/dsc_xhotfix.rb delete mode 100644 lib/puppet/type/dsc_xiisfeaturedelegation.rb delete mode 100644 lib/puppet/type/dsc_xiishandler.rb delete mode 100644 lib/puppet/type/dsc_xiislogging.rb delete mode 100644 lib/puppet/type/dsc_xiismimetypemapping.rb delete mode 100644 lib/puppet/type/dsc_xiismodule.rb delete mode 100644 lib/puppet/type/dsc_xinternetexplorerhomepage.rb delete mode 100644 lib/puppet/type/dsc_xipaddress.rb delete mode 100644 lib/puppet/type/dsc_xjeaendpoint.rb delete mode 100644 lib/puppet/type/dsc_xjeatoolkit.rb delete mode 100644 lib/puppet/type/dsc_xmicrosoftupdate.rb delete mode 100644 lib/puppet/type/dsc_xmountimage.rb delete mode 100644 lib/puppet/type/dsc_xmppreference.rb delete mode 100644 lib/puppet/type/dsc_xmsipackage.rb delete mode 100644 lib/puppet/type/dsc_xmysqldatabase.rb delete mode 100644 lib/puppet/type/dsc_xmysqlgrant.rb delete mode 100644 lib/puppet/type/dsc_xmysqlserver.rb delete mode 100644 lib/puppet/type/dsc_xmysqluser.rb delete mode 100644 lib/puppet/type/dsc_xnetadapterbinding.rb delete mode 100644 lib/puppet/type/dsc_xnetadapterlso.rb delete mode 100644 lib/puppet/type/dsc_xnetadaptername.rb delete mode 100644 lib/puppet/type/dsc_xnetadapterrdma.rb delete mode 100644 lib/puppet/type/dsc_xnetbios.rb delete mode 100644 lib/puppet/type/dsc_xnetconnectionprofile.rb delete mode 100644 lib/puppet/type/dsc_xnetworkteam.rb delete mode 100644 lib/puppet/type/dsc_xnetworkteaminterface.rb delete mode 100644 lib/puppet/type/dsc_xofflinedomainjoin.rb delete mode 100644 lib/puppet/type/dsc_xpackage.rb delete mode 100644 lib/puppet/type/dsc_xpendingreboot.rb delete mode 100644 lib/puppet/type/dsc_xpfximport.rb delete mode 100644 lib/puppet/type/dsc_xpowerplan.rb delete mode 100644 lib/puppet/type/dsc_xpowershellexecutionpolicy.rb delete mode 100644 lib/puppet/type/dsc_xpsendpoint.rb delete mode 100644 lib/puppet/type/dsc_xrdremoteapp.rb delete mode 100644 lib/puppet/type/dsc_xrdsessioncollection.rb delete mode 100644 lib/puppet/type/dsc_xrdsessioncollectionconfiguration.rb delete mode 100644 lib/puppet/type/dsc_xrdsessiondeployment.rb delete mode 100644 lib/puppet/type/dsc_xregistry.rb delete mode 100644 lib/puppet/type/dsc_xremotedesktopadmin.rb delete mode 100644 lib/puppet/type/dsc_xremotefile.rb delete mode 100644 lib/puppet/type/dsc_xrobocopy.rb delete mode 100644 lib/puppet/type/dsc_xroute.rb delete mode 100644 lib/puppet/type/dsc_xscdpmconsolesetup.rb delete mode 100644 lib/puppet/type/dsc_xscdpmdatabaseserversetup.rb delete mode 100644 lib/puppet/type/dsc_xscdpmserversetup.rb delete mode 100644 lib/puppet/type/dsc_xscheduledtask.rb delete mode 100644 lib/puppet/type/dsc_xscomadmin.rb delete mode 100644 lib/puppet/type/dsc_xscomconsolesetup.rb delete mode 100644 lib/puppet/type/dsc_xscomconsoleupdate.rb delete mode 100644 lib/puppet/type/dsc_xscommanagementpack.rb delete mode 100644 lib/puppet/type/dsc_xscommanagementserversetup.rb delete mode 100644 lib/puppet/type/dsc_xscommanagementserverupdate.rb delete mode 100644 lib/puppet/type/dsc_xscomreportingserversetup.rb delete mode 100644 lib/puppet/type/dsc_xscomwebconsoleserversetup.rb delete mode 100644 lib/puppet/type/dsc_xscomwebconsoleserverupdate.rb delete mode 100644 lib/puppet/type/dsc_xscript.rb delete mode 100644 lib/puppet/type/dsc_xscsmapowershellsetup.rb delete mode 100644 lib/puppet/type/dsc_xscsmarunbookworkerserversetup.rb delete mode 100644 lib/puppet/type/dsc_xscsmawebserviceserversetup.rb delete mode 100644 lib/puppet/type/dsc_xscspfserver.rb delete mode 100644 lib/puppet/type/dsc_xscspfserversetup.rb delete mode 100644 lib/puppet/type/dsc_xscspfserverupdate.rb delete mode 100644 lib/puppet/type/dsc_xscspfsetting.rb delete mode 100644 lib/puppet/type/dsc_xscspfstamp.rb delete mode 100644 lib/puppet/type/dsc_xscsrserversetup.rb delete mode 100644 lib/puppet/type/dsc_xscsrserverupdate.rb delete mode 100644 lib/puppet/type/dsc_xscvmmadmin.rb delete mode 100644 lib/puppet/type/dsc_xscvmmconsolesetup.rb delete mode 100644 lib/puppet/type/dsc_xscvmmconsoleupdate.rb delete mode 100644 lib/puppet/type/dsc_xscvmmmanagementserversetup.rb delete mode 100644 lib/puppet/type/dsc_xscvmmmanagementserverupdate.rb delete mode 100644 lib/puppet/type/dsc_xsmacredential.rb delete mode 100644 lib/puppet/type/dsc_xsmbshare.rb delete mode 100644 lib/puppet/type/dsc_xsqlalias.rb delete mode 100644 lib/puppet/type/dsc_xsqlaogroupensure.rb delete mode 100644 lib/puppet/type/dsc_xsqlaogroupjoin.rb delete mode 100644 lib/puppet/type/dsc_xsqlhaendpoint.rb delete mode 100644 lib/puppet/type/dsc_xsqlhagroup.rb delete mode 100644 lib/puppet/type/dsc_xsqlhaservice.rb delete mode 100644 lib/puppet/type/dsc_xsqlserveralias.rb delete mode 100644 lib/puppet/type/dsc_xsqlserveralwaysonavailabilitygroup.rb delete mode 100644 lib/puppet/type/dsc_xsqlserveralwaysonavailabilitygroupreplica.rb delete mode 100644 lib/puppet/type/dsc_xsqlserveralwaysonservice.rb delete mode 100644 lib/puppet/type/dsc_xsqlserveravailabilitygrouplistener.rb delete mode 100644 lib/puppet/type/dsc_xsqlserverconfiguration.rb delete mode 100644 lib/puppet/type/dsc_xsqlserverdatabase.rb delete mode 100644 lib/puppet/type/dsc_xsqlserverdatabaseowner.rb delete mode 100644 lib/puppet/type/dsc_xsqlserverdatabasepermission.rb delete mode 100644 lib/puppet/type/dsc_xsqlserverdatabaserecoverymodel.rb delete mode 100644 lib/puppet/type/dsc_xsqlserverdatabaserole.rb delete mode 100644 lib/puppet/type/dsc_xsqlserverendpoint.rb delete mode 100644 lib/puppet/type/dsc_xsqlserverendpointpermission.rb delete mode 100644 lib/puppet/type/dsc_xsqlserverendpointstate.rb delete mode 100644 lib/puppet/type/dsc_xsqlserverfailoverclustersetup.rb delete mode 100644 lib/puppet/type/dsc_xsqlserverfirewall.rb delete mode 100644 lib/puppet/type/dsc_xsqlserverinstall.rb delete mode 100644 lib/puppet/type/dsc_xsqlserverlogin.rb delete mode 100644 lib/puppet/type/dsc_xsqlservermaxdop.rb delete mode 100644 lib/puppet/type/dsc_xsqlservermemory.rb delete mode 100644 lib/puppet/type/dsc_xsqlservernetwork.rb delete mode 100644 lib/puppet/type/dsc_xsqlserverpermission.rb delete mode 100644 lib/puppet/type/dsc_xsqlserverreplication.rb delete mode 100644 lib/puppet/type/dsc_xsqlserverrole.rb delete mode 100644 lib/puppet/type/dsc_xsqlserverrsconfig.rb delete mode 100644 lib/puppet/type/dsc_xsqlserverrssecureconnectionlevel.rb delete mode 100644 lib/puppet/type/dsc_xsqlserverscript.rb delete mode 100644 lib/puppet/type/dsc_xsqlserversetup.rb delete mode 100644 lib/puppet/type/dsc_xsslsettings.rb delete mode 100644 lib/puppet/type/dsc_xsystemrestore.rb delete mode 100644 lib/puppet/type/dsc_xsystemrestorepoint.rb delete mode 100644 lib/puppet/type/dsc_xtimezone.rb delete mode 100644 lib/puppet/type/dsc_xuser.rb delete mode 100644 lib/puppet/type/dsc_xvhd.rb delete mode 100644 lib/puppet/type/dsc_xvhdfile.rb delete mode 100644 lib/puppet/type/dsc_xvirtualmemory.rb delete mode 100644 lib/puppet/type/dsc_xvmdvddrive.rb delete mode 100644 lib/puppet/type/dsc_xvmhost.rb delete mode 100644 lib/puppet/type/dsc_xvmhyperv.rb delete mode 100644 lib/puppet/type/dsc_xvmnetworkadapter.rb delete mode 100644 lib/puppet/type/dsc_xvmprocessor.rb delete mode 100644 lib/puppet/type/dsc_xvmswitch.rb delete mode 100644 lib/puppet/type/dsc_xwaitforaddomain.rb delete mode 100644 lib/puppet/type/dsc_xwaitforavailabilitygroup.rb delete mode 100644 lib/puppet/type/dsc_xwaitforcertificateservices.rb delete mode 100644 lib/puppet/type/dsc_xwaitforcluster.rb delete mode 100644 lib/puppet/type/dsc_xwaitfordisk.rb delete mode 100644 lib/puppet/type/dsc_xwaitforsqlhagroup.rb delete mode 100644 lib/puppet/type/dsc_xwaitforvolume.rb delete mode 100644 lib/puppet/type/dsc_xwebapplication.rb delete mode 100644 lib/puppet/type/dsc_xwebapppool.rb delete mode 100644 lib/puppet/type/dsc_xwebapppooldefaults.rb delete mode 100644 lib/puppet/type/dsc_xwebconfigkeyvalue.rb delete mode 100644 lib/puppet/type/dsc_xwebpackagedeploy.rb delete mode 100644 lib/puppet/type/dsc_xwebsite.rb delete mode 100644 lib/puppet/type/dsc_xwebsitedefaults.rb delete mode 100644 lib/puppet/type/dsc_xwebvirtualdirectory.rb delete mode 100644 lib/puppet/type/dsc_xwefcollector.rb delete mode 100644 lib/puppet/type/dsc_xwefsubscription.rb delete mode 100644 lib/puppet/type/dsc_xwindowsfeature.rb delete mode 100644 lib/puppet/type/dsc_xwindowsoptionalfeature.rb delete mode 100644 lib/puppet/type/dsc_xwindowspackagecab.rb delete mode 100644 lib/puppet/type/dsc_xwindowsprocess.rb delete mode 100644 lib/puppet/type/dsc_xwindowsupdateagent.rb delete mode 100644 lib/puppet/type/dsc_xwineventlog.rb delete mode 100644 lib/puppet/type/dsc_xwordpresssite.rb delete mode 100644 lib/puppet_x/dsc_resources/AuditPolicyDsc/AuditPolicyDsc.psd1 delete mode 100644 lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/AuditPolicyResourceHelper/AuditPolicyResourceHelper.psm1 delete mode 100644 lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/AuditPolicyResourceHelper/en-US/AuditPolicyResourceHelper.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicyCsv/MSFT_AuditPolicyCsv.psm1 delete mode 100644 lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicyCsv/MSFT_AuditPolicyCsv.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicyCsv/en-US/MSFT_AuditPolicyCsv.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicyOption/MSFT_AuditPolicyOption.psm1 delete mode 100644 lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicyOption/MSFT_AuditPolicyOption.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicyOption/en-US/MSFT_AuditPolicyOption.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicySubcategory/MSFT_AuditPolicySubcategory.psm1 delete mode 100644 lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicySubcategory/MSFT_AuditPolicySubcategory.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicySubcategory/en-US/MSFT_AuditPolicySubcategory.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/AuditPolicyDsc/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/OfficeOnlineServerDsc/DSCResources/MSFT_OfficeOnlineServerFarm/MSFT_OfficeOnlineServerFarm.psm1 delete mode 100644 lib/puppet_x/dsc_resources/OfficeOnlineServerDsc/DSCResources/MSFT_OfficeOnlineServerFarm/MSFT_OfficeOnlineServerFarm.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/OfficeOnlineServerDsc/DSCResources/MSFT_OfficeOnlineServerInstall/MSFT_OfficeOnlineServerInstall.psm1 delete mode 100644 lib/puppet_x/dsc_resources/OfficeOnlineServerDsc/DSCResources/MSFT_OfficeOnlineServerInstall/MSFT_OfficeOnlineServerInstall.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/OfficeOnlineServerDsc/DSCResources/MSFT_OfficeOnlineServerMachine/MSFT_OfficeOnlineServerMachine.psm1 delete mode 100644 lib/puppet_x/dsc_resources/OfficeOnlineServerDsc/DSCResources/MSFT_OfficeOnlineServerMachine/MSFT_OfficeOnlineServerMachine.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/OfficeOnlineServerDsc/Modules/OfficeOnlineServerDsc.Util/OfficeOnlineServerDsc.Util.psm1 delete mode 100644 lib/puppet_x/dsc_resources/OfficeOnlineServerDsc/OfficeOnlineServerDsc.psd1 delete mode 100644 lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_SecuritySetting/MSFT_SecuritySetting.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_SecuritySetting/MSFT_SecuritySetting.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_SecuritySetting/en-US/MSFT_SecuritySetting.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_SecurityTemplate/MSFT_SecurityTemplate.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_SecurityTemplate/MSFT_SecurityTemplate.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_SecurityTemplate/en-US/MSFT_SecurityTemplate.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_UserRightsAssignment/MSFT_UserRightsAssignment.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_UserRightsAssignment/MSFT_UserRightsAssignment.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_UserRightsAssignment/UserRightsFriendlyNameConversions.psd1 delete mode 100644 lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_UserRightsAssignment/en-US/MSFT_UserRightsAssignment.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/SecurityPolicyResourceHelper/SecurityPolicyResourceHelper.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/SecurityPolicyResourceHelper/en-US/SecurityPolicyResourceHelper.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/SecurityPolicyDsc/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/SecurityPolicyDsc/SecurityPolicyDsc.psd1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAccessServiceApp/MSFT_SPAccessServiceApp.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAccessServiceApp/MSFT_SPAccessServiceApp.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAccessServices2010/MSFT_SPAccessServices2010.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAccessServices2010/MSFT_SPAccessServices2010.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAlternateUrl/MSFT_SPAlternateUrl.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAlternateUrl/MSFT_SPAlternateUrl.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAntivirusSettings/MSFT_SPAntivirusSettings.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAntivirusSettings/MSFT_SPAntivirusSettings.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAppCatalog/MSFT_SPAppCatalog.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAppCatalog/MSFT_SPAppCatalog.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAppDomain/MSFT_SPAppDomain.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAppDomain/MSFT_SPAppDomain.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAppManagementServiceApp/MSFT_SPAppManagementServiceApp.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAppManagementServiceApp/MSFT_SPAppManagementServiceApp.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAppStoreSettings/MSFT_SPAppStoreSettings.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAppStoreSettings/MSFT_SPAppStoreSettings.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPBCSServiceApp/MSFT_SPBCSServiceApp.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPBCSServiceApp/MSFT_SPBCSServiceApp.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPBlobCacheSettings/MSFT_SPBlobCacheSettings.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPBlobCacheSettings/MSFT_SPBlobCacheSettings.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPCacheAccounts/MSFT_SPCacheAccounts.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPCacheAccounts/MSFT_SPCacheAccounts.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPConfigWizard/MSFT_SPConfigWizard.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPConfigWizard/MSFT_SPConfigWizard.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPContentDatabase/MSFT_SPContentDatabase.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPContentDatabase/MSFT_SPContentDatabase.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPCreateFarm/MSFT_SPCreateFarm.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPCreateFarm/MSFT_SPCreateFarm.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPDatabaseAAG/MSFT_SPDatabaseAAG.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPDatabaseAAG/MSFT_SPDatabaseAAG.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPDesignerSettings/MSFT_SPDesignerSettings.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPDesignerSettings/MSFT_SPDesignerSettings.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPDiagnosticLoggingSettings/MSFT_SPDiagnosticLoggingSettings.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPDiagnosticLoggingSettings/MSFT_SPDiagnosticLoggingSettings.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPDistributedCacheService/MSFT_SPDistributedCacheService.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPDistributedCacheService/MSFT_SPDistributedCacheService.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPExcelServiceApp/MSFT_SPExcelServiceApp.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPExcelServiceApp/MSFT_SPExcelServiceApp.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFarmAdministrators/MSFT_SPFarmAdministrators.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFarmAdministrators/MSFT_SPFarmAdministrators.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFarmPropertyBag/MSFT_SPFarmPropertyBag.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFarmPropertyBag/MSFT_SPFarmPropertyBag.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFarmSolution/MSFT_SPFarmSolution.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFarmSolution/MSFT_SPFarmSolution.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFeature/MSFT_SPFeature.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFeature/MSFT_SPFeature.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPHealthAnalyzerRuleState/MSFT_SPHealthAnalyzerRuleState.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPHealthAnalyzerRuleState/MSFT_SPHealthAnalyzerRuleState.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPInstall/MSFT_SPInstall.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPInstall/MSFT_SPInstall.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPInstallPrereqs/MSFT_SPInstallPrereqs.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPInstallPrereqs/MSFT_SPInstallPrereqs.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPIrmSettings/MSFT_SPIrmSettings.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPIrmSettings/MSFT_SPIrmSettings.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPJoinFarm/MSFT_SPJoinFarm.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPJoinFarm/MSFT_SPJoinFarm.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPMachineTranslationServiceApp/MSFT_SPMachineTranslationServiceApp.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPMachineTranslationServiceApp/MSFT_SPMachineTranslationServiceApp.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPManagedAccount/MSFT_SPManagedAccount.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPManagedAccount/MSFT_SPManagedAccount.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceApp/MSFT_SPManagedMetaDataServiceApp.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceApp/MSFT_SPManagedMetaDataServiceApp.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPManagedPath/MSFT_SPManagedPath.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPManagedPath/MSFT_SPManagedPath.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerBinding/MSFT_SPOfficeOnlineServerBinding.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerBinding/MSFT_SPOfficeOnlineServerBinding.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPOutgoingEmailSettings/MSFT_SPOutgoingEmailSettings.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPOutgoingEmailSettings/MSFT_SPOutgoingEmailSettings.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPPasswordChangeSettings/MSFT_SPPasswordChangeSettings.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPPasswordChangeSettings/MSFT_SPPasswordChangeSettings.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPPerformancePointServiceApp/MSFT_SPPerformancePointServiceApp.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPPerformancePointServiceApp/MSFT_SPPerformancePointServiceApp.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPPowerPointAutomationServiceApp/MSFT_SPPowerPointAutomationServiceApp.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPPowerPointAutomationServiceApp/MSFT_SPPowerPointAutomationServiceApp.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPProductUpdate/MSFT_SPProductUpdate.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPProductUpdate/MSFT_SPProductUpdate.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPPublishServiceApplication/MSFT_SPPublishServiceApplication.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPPublishServiceApplication/MSFT_SPPublishServiceApplication.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPQuotaTemplate/MSFT_SPQuotaTemplate.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPQuotaTemplate/MSFT_SPQuotaTemplate.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPRemoteFarmTrust/MSFT_SPRemoteFarmTrust.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPRemoteFarmTrust/MSFT_SPRemoteFarmTrust.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchAuthoritativePage/MSFT_SPSearchAuthoritativePage.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchAuthoritativePage/MSFT_SPSearchAuthoritativePage.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchContentSource/MSFT_SPSearchContentSource.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchContentSource/MSFT_SPSearchContentSource.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchCrawlMapping/MSFT_SPSearchCrawlMapping.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchCrawlMapping/MSFT_SPSearchCrawlMapping.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchCrawlRule/MSFT_SPSearchCrawlRule.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchCrawlRule/MSFT_SPSearchCrawlRule.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchCrawlerImpactRule/MSFT_SPSearchCrawlerImpactRule.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchCrawlerImpactRule/MSFT_SPSearchCrawlerImpactRule.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchFileType/MSFT_SPSearchFileType.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchFileType/MSFT_SPSearchFileType.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchIndexPartition/MSFT_SPSearchIndexPartition.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchIndexPartition/MSFT_SPSearchIndexPartition.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchResultSource/MSFT_SPSearchResultSource.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchResultSource/MSFT_SPSearchResultSource.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchServiceApp/MSFT_SPSearchServiceApp.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchServiceApp/MSFT_SPSearchServiceApp.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchTopology/MSFT_SPSearchTopology.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchTopology/MSFT_SPSearchTopology.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSecureStoreServiceApp/MSFT_SPSecureStoreServiceApp.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSecureStoreServiceApp/MSFT_SPSecureStoreServiceApp.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPServiceAppPool/MSFT_SPServiceAppPool.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPServiceAppPool/MSFT_SPServiceAppPool.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPServiceAppProxyGroup/MSFT_SPServiceAppProxyGroup.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPServiceAppProxyGroup/MSFT_SPServiceAppProxyGroup.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPServiceAppSecurity/MSFT_SPServiceAppSecurity.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPServiceAppSecurity/MSFT_SPServiceAppSecurity.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPServiceInstance/MSFT_SPServiceInstance.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPServiceInstance/MSFT_SPServiceInstance.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSessionStateService/MSFT_SPSessionStateService.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSessionStateService/MSFT_SPSessionStateService.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPShellAdmins/MSFT_SPShellAdmins.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPShellAdmins/MSFT_SPShellAdmins.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSite/MSFT_SPSite.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSite/MSFT_SPSite.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPStateServiceApp/MSFT_SPStateServiceApp.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPStateServiceApp/MSFT_SPStateServiceApp.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSubscriptionSettingsServiceApp/MSFT_SPSubscriptionSettingsServiceApp.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSubscriptionSettingsServiceApp/MSFT_SPSubscriptionSettingsServiceApp.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPTimerJobState/MSFT_SPTimerJobState.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPTimerJobState/MSFT_SPTimerJobState.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuer/MSFT_SPTrustedIdentityTokenIssuer.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuer/MSFT_SPTrustedIdentityTokenIssuer.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPTrustedRootAuthority/MSFT_SPTrustedRootAuthority.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPTrustedRootAuthority/MSFT_SPTrustedRootAuthority.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUsageApplication/MSFT_SPUsageApplication.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUsageApplication/MSFT_SPUsageApplication.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileProperty/MSFT_SPUserProfileProperty.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileProperty/MSFT_SPUserProfileProperty.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileSection/MSFT_SPUserProfileSection.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileSection/MSFT_SPUserProfileSection.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/MSFT_SPUserProfileServiceApp.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/MSFT_SPUserProfileServiceApp.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceAppPermissions/MSFT_SPUserProfileServiceAppPermissions.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceAppPermissions/MSFT_SPUserProfileServiceAppPermissions.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncConnection/MSFT_SPUserProfileSyncConnection.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncConnection/MSFT_SPUserProfileSyncConnection.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncService/MSFT_SPUserProfileSyncService.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncService/MSFT_SPUserProfileSyncService.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPVisioServiceApp/MSFT_SPVisioServiceApp.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPVisioServiceApp/MSFT_SPVisioServiceApp.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWeb/MSFT_SPWeb.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWeb/MSFT_SPWeb.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppBlockedFileTypes/MSFT_SPWebAppBlockedFileTypes.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppBlockedFileTypes/MSFT_SPWebAppBlockedFileTypes.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppGeneralSettings/MSFT_SPWebAppGeneralSettings.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppGeneralSettings/MSFT_SPWebAppGeneralSettings.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppPermissions/MSFT_SPWebAppPermissions.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppPermissions/MSFT_SPWebAppPermissions.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppPolicy/MSFT_SPWebAppPolicy.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppPolicy/MSFT_SPWebAppPolicy.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppProxyGroup/MSFT_SPWebAppProxyGroup.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppProxyGroup/MSFT_SPWebAppProxyGroup.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppSiteUseAndDeletion/MSFT_SPWebAppSiteUseAndDeletion.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppSiteUseAndDeletion/MSFT_SPWebAppSiteUseAndDeletion.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppThrottlingSettings/MSFT_SPWebAppThrottlingSettings.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppThrottlingSettings/MSFT_SPWebAppThrottlingSettings.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppWorkflowSettings/MSFT_SPWebAppWorkflowSettings.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppWorkflowSettings/MSFT_SPWebAppWorkflowSettings.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebApplication/MSFT_SPWebApplication.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebApplication/MSFT_SPWebApplication.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebApplicationAppDomain/MSFT_SPWebApplicationAppDomain.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebApplicationAppDomain/MSFT_SPWebApplicationAppDomain.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebApplicationExtension/MSFT_SPWebApplicationExtension.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebApplicationExtension/MSFT_SPWebApplicationExtension.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/MSFT_SPWordAutomationServiceApp.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/MSFT_SPWordAutomationServiceApp.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWorkManagementServiceApp/MSFT_SPWorkManagementServiceApp.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWorkManagementServiceApp/MSFT_SPWorkManagementServiceApp.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.ContentDatabase/SPContentDatabase.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.Farm/SPFarm.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.Search/SPSearchContentSource.Schedules.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.WebAppPolicy/SPWebAppPolicy.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.WebApplication/SPWebApplication.BlockedFileTypes.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.WebApplication/SPWebApplication.GeneralSettings.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.WebApplication/SPWebApplication.Throttling.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.WebApplication/SPWebApplication.Workflow.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SharePointDsc/SharePointDsc.psd1 delete mode 100644 lib/puppet_x/dsc_resources/SystemLocaleDsc/DSCResources/MSFT_SystemLocale/MSFT_SystemLocale.psm1 delete mode 100644 lib/puppet_x/dsc_resources/SystemLocaleDsc/DSCResources/MSFT_SystemLocale/MSFT_SystemLocale.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/SystemLocaleDsc/DSCResources/MSFT_SystemLocale/en-us/MSFT_SystemLocale.psd1 delete mode 100644 lib/puppet_x/dsc_resources/SystemLocaleDsc/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/SystemLocaleDsc/SystemLocaleDsc.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xActiveDirectory/Assert-HADC.ps1 delete mode 100644 lib/puppet_x/dsc_resources/xActiveDirectory/Assert-ParentChildDomains.ps1 delete mode 100644 lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADCommon/MSFT_xADCommon.ps1 delete mode 100644 lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADCommon/MSFT_xADCommon.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADComputer/MSFT_xADComputer.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADComputer/MSFT_xADComputer.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADComputer/en-US/MSFT_xADComputer.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADDomain/MSFT_xADDomain.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADDomain/MSFT_xADDomain.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADDomainController/MSFT_xADDomainController.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADDomainController/MSFT_xADDomainController.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADDomainDefaultPasswordPolicy/MSFT_xADDomainDefaultPasswordPolicy.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADDomainDefaultPasswordPolicy/MSFT_xADDomainDefaultPasswordPolicy.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADDomainTrust/MSFT_xADDomainTrust.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADDomainTrust/MSFT_xADDomainTrust.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADGroup/MSFT_xADGroup.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADGroup/MSFT_xADGroup.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADOrganizationalUnit/MSFT_xADOrganizationalUnit.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADOrganizationalUnit/MSFT_xADOrganizationalUnit.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADRecycleBin/MSFT_xADRecycleBin.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADRecycleBin/MSFT_xADRecycleBin.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADRecycleBin/ResourceDesignerScripts/GeneratexADRecycleBinSchema.ps1 delete mode 100644 lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADUser/MSFT_xADUser.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADUser/MSFT_xADUser.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xWaitForADDomain/MSFT_xWaitForADDomain.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xWaitForADDomain/MSFT_xWaitForADDomain.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xActiveDirectory/HADCConfiguration.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xActiveDirectory/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xActiveDirectory/Misc/New-ADDomainTrust.ps1 delete mode 100644 lib/puppet_x/dsc_resources/xActiveDirectory/ParentChildConfig.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xActiveDirectory/xActiveDirectory.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/CommonResourceHelper.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsCertificationAuthority/MSFT_xAdcsCertificationAuthority.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsCertificationAuthority/MSFT_xAdcsCertificationAuthority.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsCertificationAuthority/en-us/MSFT_xAdcsCertificationAuthority.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsOnlineResponder/MSFT_xAdcsOnlineResponder.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsOnlineResponder/MSFT_xAdcsOnlineResponder.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsOnlineResponder/en-us/MSFT_xAdcsOnlineResponder.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsWebEnrollment/MSFT_xAdcsWebEnrollment.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsWebEnrollment/MSFT_xAdcsWebEnrollment.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsWebEnrollment/en-us/MSFT_xAdcsWebEnrollment.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xAdcsDeployment/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xAdcsDeployment/xAdcsDeployment.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureAffinityGroup/MSFT_xAzureAffinityGroup.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureAffinityGroup/MSFT_xAzureAffinityGroup.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureQuickVM/MSFT_xAzureQuickVM.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureQuickVM/MSFT_xAzureQuickVM.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureService/MSFT_xAzureService.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureService/MSFT_xAzureService.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureSqlDatabase/MSFT_xAzureSqlDatabase.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureSqlDatabase/MSFT_xAzureSqlDatabase.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureSqlDatabaseServerFirewallRule/MSFT_xAzureSqlDatabaseServerFirewallRule.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureSqlDatabaseServerFirewallRule/MSFT_xAzureSqlDatabaseServerFirewallRule.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureStorageAccount/MSFT_xAzureStorageAccount.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureStorageAccount/MSFT_xAzureStorageAccount.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureSubscription/MSFT_xAzureSubscription.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureSubscription/MSFT_xAzureSubscription.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureVM/MSFT_xAzureVM.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureVM/MSFT_xAzureVM.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureVMDscConfiguration/MSFT_xAzureVMDscConfiguration.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureVMDscConfiguration/MSFT_xAzureVMDscConfiguration.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureVMDscExtension/MSFT_xAzureVMDscExtension.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureVMDscExtension/MSFT_xAzureVMDscExtension.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xAzure/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xAzure/ResourceDesignerScripts/GenerateXAzureSqlDatabase.ps1 delete mode 100644 lib/puppet_x/dsc_resources/xAzure/ResourceDesignerScripts/GenerateXAzureSqlDatabaseServerFirewallRule.ps1 delete mode 100644 lib/puppet_x/dsc_resources/xAzure/xAzure.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackAdmin/MSFT_xAzurePackAdmin.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackAdmin/MSFT_xAzurePackAdmin.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackDatabaseSetting/MSFT_xAzurePackDatabaseSetting.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackDatabaseSetting/MSFT_xAzurePackDatabaseSetting.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackFQDN/MSFT_xAzurePackFQDN.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackFQDN/MSFT_xAzurePackFQDN.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackIdentityProvider/MSFT_xAzurePackIdentityProvider.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackIdentityProvider/MSFT_xAzurePackIdentityProvider.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackRelyingParty/MSFT_xAzurePackRelyingParty.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackRelyingParty/MSFT_xAzurePackRelyingParty.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackResourceProvider/MSFT_xAzurePackResourceProvider.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackResourceProvider/MSFT_xAzurePackResourceProvider.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackSetup/MSFT_xAzurePackSetup.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackSetup/MSFT_xAzurePackSetup.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackUpdate/MSFT_xAzurePackUpdate.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackUpdate/MSFT_xAzurePackUpdate.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xAzurePack/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xAzurePack/en-US/xPDT.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xAzurePack/xAzurePack.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xAzurePack/xPDT.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xBitlocker/DSCResources/MSFT_xBLAutoBitlocker/MSFT_xBLAutoBitlocker.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xBitlocker/DSCResources/MSFT_xBLAutoBitlocker/MSFT_xBLAutoBitlocker.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xBitlocker/DSCResources/MSFT_xBLBitlocker/MSFT_xBLBitlocker.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xBitlocker/DSCResources/MSFT_xBLBitlocker/MSFT_xBLBitlocker.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xBitlocker/DSCResources/MSFT_xBLTpm/MSFT_xBLTpm.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xBitlocker/DSCResources/MSFT_xBLTpm/MSFT_xBLTpm.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xBitlocker/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xBitlocker/Misc/xBitlockerCommon.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xBitlocker/xBitlocker.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertReq/MSFT_xCertReq.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertReq/MSFT_xCertReq.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertReq/en-us/MSFT_xCertReq.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertificateExport/MSFT_xCertificateExport.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertificateExport/MSFT_xCertificateExport.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertificateExport/en-us/MSFT_xCertificateExport.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertificateImport/MSFT_xCertificateImport.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertificateImport/MSFT_xCertificateImport.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertificateImport/en-us/MSFT_xCertificateImport.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xPfxImport/MSFT_xPfxImport.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xPfxImport/MSFT_xPfxImport.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xPfxImport/en-us/MSFT_xPfxImport.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xWaitForCertificateServices/MSFT_xWaitForCertificateServices.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xWaitForCertificateServices/MSFT_xWaitForCertificateServices.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xWaitForCertificateServices/en-us/MSFT_xWaitForCertificateServices.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xCertificate/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xCertificate/Modules/CertificateDsc.Common/CertificateDSc.Common.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xCertificate/Modules/CertificateDsc.Common/en-us/CertificateDsc.Common.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xCertificate/Modules/CertificateDsc.PDT/CertificateDsc.PDT.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xCertificate/Modules/CertificateDsc.PDT/en-us/CertificateDsc.PDT.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xCertificate/Modules/CertificateDsc.ResourceHelper/CertificateDsc.ResourceHelper.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xCertificate/xCertificate.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/CommonResourceHelper.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xComputer/MSFT_xComputer.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xComputer/MSFT_xComputer.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xOfflineDomainJoin/MSFT_xOfflineDomainJoin.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xOfflineDomainJoin/MSFT_xOfflineDomainJoin.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xOfflineDomainJoin/en-us/MSFT_xOfflineDomainJoin.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xPowerPlan/MSFT_xPowerPlan.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xPowerPlan/MSFT_xPowerPlan.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xPowerPlan/en-US/MSFT_xPowerPlan.schema.mfl delete mode 100644 lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xPowerPlan/en-US/MSFT_xPowerPlan.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xScheduledTask/MSFT_xScheduledTask.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xScheduledTask/MSFT_xScheduledTask.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xVirtualMemory/MSFT_xVirtualMemory.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xVirtualMemory/MSFT_xVirtualMemory.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xComputerManagement/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xComputerManagement/xComputerManagement.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xCredSSP/DSCResources/MSFT_xCredSSP/MSFT_xCredSSP.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xCredSSP/DSCResources/MSFT_xCredSSP/MSFT_xCredSSP.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xCredSSP/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xCredSSP/xCredSSP.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceFolder/MSFT_xDFSNamespaceFolder.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceFolder/MSFT_xDFSNamespaceFolder.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceFolder/en-us/MSFT_xDFSNamespaceFolder.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceRoot/MSFT_xDFSNamespaceRoot.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceRoot/MSFT_xDFSNamespaceRoot.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceRoot/en-us/MSFT_xDFSNamespaceRoot.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceServerConfiguration/MSFT_xDFSNamespaceServerConfiguration.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceServerConfiguration/MSFT_xDFSNamespaceServerConfiguration.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceServerConfiguration/en-us/MSFT_xDFSNamespaceServerConfiguration.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroup/MSFT_xDFSReplicationGroup.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroup/MSFT_xDFSReplicationGroup.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroup/en-us/MSFT_xDFSReplicationGroup.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupConnection/MSFT_xDFSReplicationGroupConnection.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupConnection/MSFT_xDFSReplicationGroupConnection.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupConnection/en-us/MSFT_xDFSReplicationGroupConnection.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupFolder/MSFT_xDFSReplicationGroupFolder.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupFolder/MSFT_xDFSReplicationGroupFolder.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupFolder/en-us/MSFT_xDFSReplicationGroupFolder.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupMembership/MSFT_xDFSReplicationGroupMembership.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupMembership/MSFT_xDFSReplicationGroupMembership.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupMembership/en-us/MSFT_xDFSReplicationGroupMembership.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xDFS/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xDFS/Modules/DFSDsc.ResourceHelper/DFSDsc.ResourceHelper.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xDFS/xDFS.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDBPackage/MSFT_xDBPackage.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDBPackage/MSFT_xDBPackage.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDatabase/MSFT_xDatabase.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDatabase/MSFT_xDatabase.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDatabaseLogin/MSFT_xDatabaseLogin.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDatabaseLogin/MSFT_xDatabaseLogin.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDatabaseLogin/MSFT_xDatabaseLoginWithDefaultDB.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDatabaseServer/MSFT_xDatabaseServer.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDatabaseServer/MSFT_xDatabaseServer.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xDatabase/DSCResources/xDatabase_Common/xDatabase_Common.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xDatabase/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xDatabase/xDatabase.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xDefender/DSCResources/MSFT_xMpPreference/MSFT_xMpPreference.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xDefender/DSCResources/MSFT_xMpPreference/MSFT_xMpPreference.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xDefender/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xDefender/xDefender.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/Helper.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerAuthorization/MSFT_xDhcpServerAuthorization.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerAuthorization/MSFT_xDhcpServerAuthorization.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerClass/MSFT_xDhcpServerClass.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerClass/MSFT_xDhcpServerClass.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerOption/MSFT_xDhcpServerOption.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerOption/MSFT_xDhcpServerOption.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerOptionDefinition/MSFT_xDhcpServerOptionDefinition.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerReservation/MSFT_xDhcpServerReservation.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerReservation/MSFT_xDhcpServerReservation.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerScope/MSFT_xDhcpServerScope.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerScope/MSFT_xDhcpServerScope.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xDhcpServer/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xDhcpServer/Misc/New-DhcpServerOptionResource.ps1 delete mode 100644 lib/puppet_x/dsc_resources/xDhcpServer/Misc/New-DhcpServerReservationResource.ps1 delete mode 100644 lib/puppet_x/dsc_resources/xDhcpServer/Misc/New-DhcpServerScopeResource.ps1 delete mode 100644 lib/puppet_x/dsc_resources/xDhcpServer/xDhcpServer.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xDismFeature/DSCResources/MSFT_xDismFeature/MSFT_xDismFeature.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xDismFeature/DSCResources/MSFT_xDismFeature/MSFT_xDismFeature.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xDismFeature/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xDismFeature/xDismFeature.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xDnsServer/DSCResources/Helper.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsARecord/MSFT_xDnsARecord.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsARecord/MSFT_xDnsARecord.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsRecord/MSFT_xDnsRecord.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsRecord/MSFT_xDnsRecord.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerADZone/Helper.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerADZone/MSFT_xDnsServerADZone.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerADZone/MSFT_xDnsServerADZone.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerForwarder/MSFT_xDnsServerForwarder.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerForwarder/MSFT_xDnsServerForwarder.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerPrimaryZone/MSFT_xDnsServerPrimaryZone.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerPrimaryZone/MSFT_xDnsServerPrimaryZone.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerSecondaryZone/MSFT_xDnsServerSecondaryZone.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerSecondaryZone/MSFT_xDnsServerSecondaryZone.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerZoneTransfer/MSFT_xDnsServerZoneTransfer.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerZoneTransfer/MSFT_xDnsServerZoneTransfer.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xDnsServer/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xDnsServer/Misc/New-DnsServerSecondaryZone.ps1 delete mode 100644 lib/puppet_x/dsc_resources/xDnsServer/Misc/New-DnsServerZoneTransfer.ps1 delete mode 100644 lib/puppet_x/dsc_resources/xDnsServer/xDnsServer.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchActiveSyncVirtualDirectory/MSFT_xExchActiveSyncVirtualDirectory.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchActiveSyncVirtualDirectory/MSFT_xExchActiveSyncVirtualDirectory.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchAntiMalwareScanning/MSFT_xExchAntiMalwareScanning.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchAntiMalwareScanning/MSFT_xExchAntiMalwareScanning.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchAutoMountPoint/MSFT_xExchAutoMountPoint.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchAutoMountPoint/MSFT_xExchAutoMountPoint.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchAutodiscoverVirtualDirectory/MSFT_xExchAutodiscoverVirtualDirectory.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchAutodiscoverVirtualDirectory/MSFT_xExchAutodiscoverVirtualDirectory.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchClientAccessServer/MSFT_xExchClientAccessServer.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchClientAccessServer/MSFT_xExchClientAccessServer.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchDatabaseAvailabilityGroup/MSFT_xExchDatabaseAvailabilityGroup.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchDatabaseAvailabilityGroup/MSFT_xExchDatabaseAvailabilityGroup.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchDatabaseAvailabilityGroupMember/MSFT_xExchDatabaseAvailabilityGroupMember.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchDatabaseAvailabilityGroupMember/MSFT_xExchDatabaseAvailabilityGroupMember.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchDatabaseAvailabilityGroupNetwork/MSFT_xExchDatabaseAvailabilityGroupNetwork.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchDatabaseAvailabilityGroupNetwork/MSFT_xExchDatabaseAvailabilityGroupNetwork.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchEcpVirtualDirectory/MSFT_xExchEcpVirtualDirectory.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchEcpVirtualDirectory/MSFT_xExchEcpVirtualDirectory.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchEventLogLevel/MSFT_xExchEventLogLevel.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchEventLogLevel/MSFT_xExchEventLogLevel.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchExchangeCertificate/MSFT_xExchExchangeCertificate.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchExchangeCertificate/MSFT_xExchExchangeCertificate.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchExchangeServer/MSFT_xExchExchangeServer.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchExchangeServer/MSFT_xExchExchangeServer.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchImapSettings/MSFT_xExchImapSettings.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchImapSettings/MSFT_xExchImapSettings.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchInstall/MSFT_xExchInstall.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchInstall/MSFT_xExchInstall.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchJetstress/MSFT_xExchJetstress.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchJetstress/MSFT_xExchJetstress.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchJetstressCleanup/MSFT_xExchJetstressCleanup.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchJetstressCleanup/MSFT_xExchJetstressCleanup.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMailboxDatabase/MSFT_xExchMailboxDatabase.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMailboxDatabase/MSFT_xExchMailboxDatabase.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMailboxDatabaseCopy/MSFT_xExchMailboxDatabaseCopy.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMailboxDatabaseCopy/MSFT_xExchMailboxDatabaseCopy.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMailboxServer/MSFT_xExchMailboxServer.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMailboxServer/MSFT_xExchMailboxServer.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMailboxTransportService/MSFT_xExchMailboxTransportService.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMailboxTransportService/MSFT_xExchMailboxTransportService.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMaintenanceMode/MSFT_xExchMaintenanceMode.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMaintenanceMode/MSFT_xExchMaintenanceMode.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMaintenanceMode/TransportMaintenance.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMapiVirtualDirectory/MSFT_xExchMapiVirtualDirectory.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMapiVirtualDirectory/MSFT_xExchMapiVirtualDirectory.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchOabVirtualDirectory/MSFT_xExchOabVirtualDirectory.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchOabVirtualDirectory/MSFT_xExchOabVirtualDirectory.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchOutlookAnywhere/MSFT_xExchOutlookAnywhere.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchOutlookAnywhere/MSFT_xExchOutlookAnywhere.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchOwaVirtualDirectory/MSFT_xExchOwaVirtualDirectory.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchOwaVirtualDirectory/MSFT_xExchOwaVirtualDirectory.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchPopSettings/MSFT_xExchPopSettings.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchPopSettings/MSFT_xExchPopSettings.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchPowershellVirtualDirectory/MSFT_xExchPowerShellVirtualDirectory.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchPowershellVirtualDirectory/MSFT_xExchPowerShellVirtualDirectory.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchReceiveConnector/MSFT_xExchReceiveConnector.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchReceiveConnector/MSFT_xExchReceiveConnector.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchTransportService/MSFT_xExchTransportService.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchTransportService/MSFT_xExchTransportService.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchUMCallRouterSettings/MSFT_xExchUMCallRouterSettings.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchUMCallRouterSettings/MSFT_xExchUMCallRouterSettings.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchUMService/MSFT_xExchUMService.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchUMService/MSFT_xExchUMService.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchWaitForADPrep/MSFT_xExchWaitForADPrep.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchWaitForADPrep/MSFT_xExchWaitForADPrep.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchWaitForDAG/MSFT_xExchWaitForDAG.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchWaitForDAG/MSFT_xExchWaitForDAG.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchWaitForMailboxDatabase/MSFT_xExchWaitForMailboxDatabase.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchWaitForMailboxDatabase/MSFT_xExchWaitForMailboxDatabase.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchWebServicesVirtualDirectory/MSFT_xExchWebServicesVirtualDirectory.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchWebServicesVirtualDirectory/MSFT_xExchWebServicesVirtualDirectory.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xExchange/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xExchange/Misc/xExchangeCommon.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/Misc/xExchangeDiskPart.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xExchange/xExchange.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/CommonResourceHelper.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xCluster/MSFT_xCluster.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xCluster/MSFT_xCluster.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xCluster/en-US/MSFT_xCluster.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterDisk/MSFT_xClusterDisk.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterDisk/MSFT_xClusterDisk.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterDisk/en-US/MSFT_xClusterDisk.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterNetwork/MSFT_xClusterNetwork.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterNetwork/MSFT_xClusterNetwork.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterNetwork/en-US/MSFT_xClusterNetwork.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterPreferredOwner/MSFT_xClusterPreferredOwner.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterPreferredOwner/MSFT_xClusterPreferredOwner.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterPreferredOwner/en-US/MSFT_xClusterPreferredOwner.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterQuorum/MSFT_xClusterQuorum.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterQuorum/MSFT_xClusterQuorum.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterQuorum/en-US/MSFT_xClusterQuorum.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xWaitForCluster/MSFT_xWaitForCluster.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xWaitForCluster/MSFT_xWaitForCluster.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xWaitForCluster/en-US/MSFT_xWaitForCluster.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xFailOverCluster/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xFailOverCluster/xFailOverCluster.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xHyper-V/DSCResources/HyperVCommon/HyperVCommon.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xHyper-V/DSCResources/HyperVCommon/en-us/HyperVCommon.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVHD/MSFT_xVHD.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVHD/MSFT_xVHD.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMDvdDrive/MSFT_xVMDvdDrive.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMDvdDrive/MSFT_xVMDvdDrive.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMDvdDrive/en-us/MSFT_xVMDvdDrive.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMHost/MSFT_xVMHost.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMHost/MSFT_xVMHost.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMHost/en-US/MSFT_xVMHost.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMHyperV/MSFT_xVMHyperV.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMHyperV/MSFT_xVMHyperV.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMNetworkAdapter/MSFT_xVMNetworkAdapter.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMNetworkAdapter/MSFT_xVMNetworkAdapter.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMNetworkAdapter/en-US/MSFT_xVMNetworkAdapter.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMProcessor/MSFT_xVMProcessor.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMProcessor/MSFT_xVMProcessor.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMProcessor/en-US/MSFT_xVMProcessor.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMSwitch/MSFT_xVMSwitch.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMSwitch/MSFT_xVMSwitch.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMSwitch/en-us/MSFT_xVMSwitch.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVhdFileDirectory/MSFT_xVhdFileDirectory.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVhdFileDirectory/MSFT_xVhdFileDirectory.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xHyper-V/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xHyper-V/Misc/VHDResourceGenerator.ps1 delete mode 100644 lib/puppet_x/dsc_resources/xHyper-V/Misc/VMResourceGenerator.ps1 delete mode 100644 lib/puppet_x/dsc_resources/xHyper-V/Misc/VMSwitchGenerator.ps1 delete mode 100644 lib/puppet_x/dsc_resources/xHyper-V/xHyper-V.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xInternetExplorerHomePage/DSCResources/xInternetExplorerHomePage/xInternetExplorerHomePage.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xInternetExplorerHomePage/DSCResources/xInternetExplorerHomePage/xInternetExplorerHomePage.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xInternetExplorerHomePage/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xInternetExplorerHomePage/xInternetExplorerHomePage.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xJea/DSCResources/Library/Helper.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xJea/DSCResources/Library/JeaAccount.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xJea/DSCResources/Library/JeaDir.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xJea/DSCResources/Library/JeaInitFile.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xJea/DSCResources/Library/JeaProxy.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xJea/DSCResources/MSFT_xJeaEndpoint/MSFT_xJeaEndpoint.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xJea/DSCResources/MSFT_xJeaEndpoint/MSFT_xJeaEndpoint.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xJea/DSCResources/MSFT_xJeaToolkit/MSFT_xJeaToolkit.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xJea/DSCResources/MSFT_xJeaToolkit/MSFT_xJeaToolkit.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xJea/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xJea/Util/Initialize-ToolKit.ps1 delete mode 100644 lib/puppet_x/dsc_resources/xJea/Util/SafeProxy.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xJea/xJea.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xJea/xjea.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlDatabase/MSFT_xMySqlDatabase.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlDatabase/MSFT_xMySqlDatabase.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlDatabase/xMySqlDatabaseDesigner.ps1 delete mode 100644 lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlGrant/MSFT_xMySqlGrant.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlGrant/MSFT_xMySqlGrant.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlGrant/en-US/MSFT_xMySqlGrant.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlGrant/xMySqlGrantDesigner.ps1 delete mode 100644 lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlServer/MSFT_xMySqlServer.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlServer/MSFT_xMySqlServer.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlUser/MSFT_xMySqlUser.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlUser/MSFT_xMySqlUser.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlUser/en-US/MSFT_xMySqlUser.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlUser/xMySqlUserDesigner.ps1 delete mode 100644 lib/puppet_x/dsc_resources/xMySql/DscResources/xMySqlProvision/xMySqlProvision.Schema.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xMySql/DscResources/xMySqlProvision/xMySqlProvision.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xMySql/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xMySql/MSFT_xMySqlUtilities.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xMySql/xMySql.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDNSServerAddress/MSFT_xDNSServerAddress.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDNSServerAddress/MSFT_xDNSServerAddress.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDNSServerAddress/en-US/MSFT_xDNSServerAddress.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDefaultGatewayAddress/MSFT_xDefaultGatewayAddress.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDefaultGatewayAddress/MSFT_xDefaultGatewayAddress.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDefaultGatewayAddress/en-US/MSFT_xDefaultGatewayAddress.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDhcpClient/MSFT_xDhcpClient.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDhcpClient/MSFT_xDhcpClient.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDhcpClient/en-US/MSFT_xDhcpClient.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDnsClientGlobalSetting/MSFT_xDnsClientGlobalSetting.data.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDnsClientGlobalSetting/MSFT_xDnsClientGlobalSetting.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDnsClientGlobalSetting/MSFT_xDnsClientGlobalSetting.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDnsClientGlobalSetting/en-US/MSFT_xDnsClientGlobalSetting.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDnsConnectionSuffix/MSFT_xDnsConnectionSuffix.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDnsConnectionSuffix/MSFT_xDnsConnectionSuffix.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDnsConnectionSuffix/en-US/MSFT_xDnsConnectionSuffix.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xFirewall/MSFT_xFirewall.Schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xFirewall/MSFT_xFirewall.data.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xFirewall/MSFT_xFirewall.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xFirewall/en-US/MSFT_xFirewall.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xFirewallProfile/MSFT_xFirewallProfile.data.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xFirewallProfile/MSFT_xFirewallProfile.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xFirewallProfile/MSFT_xFirewallProfile.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xFirewallProfile/en-US/MSFT_xFirewallProfile.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xHostsFile/MSFT_xHostsFile.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xHostsFile/MSFT_xHostsFile.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xHostsFile/en-US/MSFT_xHostsFile.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xIPAddress/MSFT_xIPAddress.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xIPAddress/MSFT_xIPAddress.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xIPAddress/en-US/MSFT_xIPAddress.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterBinding/MSFT_xNetAdapterBinding.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterBinding/MSFT_xNetAdapterBinding.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterBinding/en-US/MSFT_xNetAdapterBinding.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterLso/MSFT_xNetAdapterLso.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterLso/MSFT_xNetAdapterLso.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterLso/en-US/MSFT_xNetAdapterLso.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterName/MSFT_xNetAdapterName.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterName/MSFT_xNetAdapterName.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterName/en-us/MSFT_xNetAdapterName.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterRDMA/MSFT_xNetAdapterRDMA.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterRDMA/MSFT_xNetAdapterRDMA.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterRDMA/en-US/MSFT_xNetAdapterRDMA.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetBIOS/MSFT_xNetBIOS.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetBIOS/MSFT_xNetBIOS.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetBIOS/en-US/MSFT_xNetBIOS.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetConnectionProfile/MSFT_xNetConnectionProfile.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetConnectionProfile/MSFT_xNetConnectionProfile.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetConnectionProfile/en-US/MSFT_xNetConnectionProfile.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetworkTeam/MSFT_xNetworkTeam.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetworkTeam/MSFT_xNetworkTeam.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetworkTeam/en-US/MSFT_xNetworkTeam.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetworkTeamInterface/MSFT_xNetworkTeamInterface.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetworkTeamInterface/MSFT_xNetworkTeamInterface.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetworkTeamInterface/en-US/MSFT_xNetworkTeamInterface.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xRoute/MSFT_xRoute.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xRoute/MSFT_xRoute.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xRoute/en-US/MSFT_xRoute.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/Modules/NetworkingDsc.Common/NetworkingDsc.Common.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/Modules/NetworkingDsc.Common/en-us/NetworkingDsc.Common.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/Modules/NetworkingDsc.ResourceHelper/NetworkingDsc.ResourceHelper.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/PSScriptAnalyzerSettings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xNetworking/xNetworking.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCPullServerSetup/PublishModulesAndMofsToPullServer.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xArchive/MSFT_xArchive.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xArchive/MSFT_xArchive.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xArchive/en-US/MSFT_xArchive.schema.mfl delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xArchive/en-US/MSFT_xArchive.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xDSCWebService/MSFT_xDSCWebService.Schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xDSCWebService/MSFT_xDSCWebService.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xDSCWebService/PSWSIISEndpoint.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xDSCWebService/SecureTLSProtocols.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xDSCWebService/UseSecurityBestPractices.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xEnvironmentResource/MSFT_xEnvironmentResource.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xEnvironmentResource/MSFT_xEnvironmentResource.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xEnvironmentResource/en-US/MSFT_xEnvironmentResource.schema.mfl delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xEnvironmentResource/en-US/MSFT_xEnvironmentResource.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xGroupResource/MSFT_xGroupResource.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xGroupResource/MSFT_xGroupResource.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xGroupResource/en-US/MSFT_xGroupResource.schema.mfl delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xGroupResource/en-US/MSFT_xGroupResource.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xMsiPackage/MSFT_xMsiPackage.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xMsiPackage/MSFT_xMsiPackage.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xMsiPackage/en-US/MSFT_xMsiPackage.schema.mfl delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xMsiPackage/en-US/MSFT_xMsiPackage.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xPSSessionConfiguration/MSFT_xPSSessionConfiguration.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xPSSessionConfiguration/MSFT_xPSSessionConfiguration.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xPackageResource/MSFT_xPackageResource.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xPackageResource/MSFT_xPackageResource.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xPackageResource/en-US/MSFT_xPackageResource.schema.mfl delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xPackageResource/en-US/MSFT_xPackageResource.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xRegistryResource/MSFT_xRegistryResource.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xRegistryResource/MSFT_xRegistryResource.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xRegistryResource/en-US/MSFT_xRegistryResource.schema.mfl delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xRegistryResource/en-US/MSFT_xRegistryResource.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xRemoteFile/MSFT_xRemoteFile.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xRemoteFile/MSFT_xRemoteFile.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xRemoteFile/en-us/MSFT_xRemoteFile.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xScriptResource/MSFT_xScriptResource.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xScriptResource/MSFT_xScriptResource.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xScriptResource/en-US/MSFT_xScriptResource.schema.mfl delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xScriptResource/en-US/MSFT_xScriptResource.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xUserResource/MSFT_xUserResource.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xUserResource/MSFT_xUserResource.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xUserResource/en-US/MSFT_xUserResource.schema.mfl delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xUserResource/en-US/MSFT_xUserResource.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsFeature/MSFT_xWindowsFeature.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsFeature/MSFT_xWindowsFeature.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsFeature/en-US/MSFT_xWindowsFeature.schema.mfl delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsFeature/en-US/MSFT_xWindowsFeature.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsOptionalFeature/MSFT_xWindowsOptionalFeature.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsOptionalFeature/MSFT_xWindowsOptionalFeature.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsOptionalFeature/en-US/MSFT_xWindowsOptionalFeature.schema.mfl delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsOptionalFeature/en-US/MSFT_xWindowsOptionalFeature.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsPackageCab/MSFT_xWindowsPackageCab.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsPackageCab/MSFT_xWindowsPackageCab.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsPackageCab/en-US/MSFT_xWindowsPackageCab.schema.mfl delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsPackageCab/en-US/MSFT_xWindowsPackageCab.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsProcess/MSFT_xWindowsProcess.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsProcess/MSFT_xWindowsProcess.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsProcess/en-US/MSFT_xWindowsProcess.schema.mfl delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsProcess/en-US/MSFT_xWindowsProcess.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xFileUpload/xFileUpload.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xFileUpload/xFileUpload.schema.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xGroupSet/xGroupSet.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xGroupSet/xGroupSet.schema.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xProcessSet/xProcessSet.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xProcessSet/xProcessSet.schema.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xWindowsFeatureSet/xWindowsFeatureSet.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xWindowsFeatureSet/xWindowsFeatureSet.schema.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xWindowsOptionalFeatureSet/xWindowsOptionalFeatureSet.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xWindowsOptionalFeatureSet/xWindowsOptionalFeatureSet.schema.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/ResourceDesignerScripts/GenerateXRemoteFileSchema.ps1 delete mode 100644 lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/ResourceDesignerScripts/New-PSSessionConfigurationResource.ps1 delete mode 100644 lib/puppet_x/dsc_resources/xPendingReboot/DSCResources/MSFT_xPendingReboot/MSFT_xPendingReboot.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xPendingReboot/DSCResources/MSFT_xPendingReboot/MSFT_xPendingReboot.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xPendingReboot/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xPendingReboot/xPendingReboot.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xPhp/DscResources/xPhpProvision/xPhpProvision.Schema.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xPhp/DscResources/xPhpProvision/xPhpProvision.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xPhp/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xPhp/xPhp.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xPowerShellExecutionPolicy/DSCResources/MSFT_xPowerShellExecutionPolicy/MSFT_xPowerShellExecutionPolicy.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xPowerShellExecutionPolicy/DSCResources/MSFT_xPowerShellExecutionPolicy/MSFT_xPowerShellExecutionPolicy.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xPowerShellExecutionPolicy/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xPowerShellExecutionPolicy/xPowerShellExecutionPolicy.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xRemoteDesktopAdmin/DSCResources/xRemoteDesktopAdmin/xRemoteDesktopAdmin.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xRemoteDesktopAdmin/DSCResources/xRemoteDesktopAdmin/xRemoteDesktopAdmin.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xRemoteDesktopAdmin/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xRemoteDesktopAdmin/xRemoteDesktopAdmin.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/DSCResources/MSFT_xRDRemoteApp/MSFT_xRDRemoteApp.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/DSCResources/MSFT_xRDRemoteApp/MSFT_xRDRemoteApp.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/DSCResources/MSFT_xRDSessionCollection/MSFT_xRDSessionCollection.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/DSCResources/MSFT_xRDSessionCollection/MSFT_xRDSessionCollection.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/DSCResources/MSFT_xRDSessionCollectionConfiguration/MSFT_xRDSessionCollectionConfiguration.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/DSCResources/MSFT_xRDSessionCollectionConfiguration/MSFT_xRDSessionCollectionConfiguration.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/DSCResources/MSFT_xRDSessionDeployment/MSFT_xRDSessionDeployment.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/DSCResources/MSFT_xRDSessionDeployment/MSFT_xRDSessionDeployment.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/xRemoteDesktopSessionHost.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/xRemoteDesktopSessionHostCommon.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xRobocopy/DSCResources/MSFT_xRobocopy/MSFT_xRobocopy.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xRobocopy/DSCResources/MSFT_xRobocopy/MSFT_xRobocopy.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xRobocopy/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xRobocopy/Resources/xDscResourceDesigner_CreateScript.ps1 delete mode 100644 lib/puppet_x/dsc_resources/xRobocopy/xRobocopy.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xSCDPM/DSCResources/MSFT_xSCDPMConsoleSetup/MSFT_xSCDPMConsoleSetup.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCDPM/DSCResources/MSFT_xSCDPMConsoleSetup/MSFT_xSCDPMConsoleSetup.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSCDPM/DSCResources/MSFT_xSCDPMDatabaseServerSetup/MSFT_xSCDPMDatabaseServerSetup.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCDPM/DSCResources/MSFT_xSCDPMDatabaseServerSetup/MSFT_xSCDPMDatabaseServerSetup.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSCDPM/DSCResources/MSFT_xSCDPMServerSetup/MSFT_xSCDPMServerSetup.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCDPM/DSCResources/MSFT_xSCDPMServerSetup/MSFT_xSCDPMServerSetup.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSCDPM/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xSCDPM/en-US/xPDT.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xSCDPM/xPDT.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCDPM/xSCDPM.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMAdmin/MSFT_xSCOMAdmin.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMAdmin/MSFT_xSCOMAdmin.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMConsoleSetup/MSFT_xSCOMConsoleSetup.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMConsoleSetup/MSFT_xSCOMConsoleSetup.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMConsoleUpdate/MSFT_xSCOMConsoleUpdate.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMConsoleUpdate/MSFT_xSCOMConsoleUpdate.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMManagementPack/MSFT_xSCOMManagementPack.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMManagementPack/MSFT_xSCOMManagementPack.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMManagementServerSetup/MSFT_xSCOMManagementServerSetup.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMManagementServerSetup/MSFT_xSCOMManagementServerSetup.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMManagementServerUpdate/MSFT_xSCOMManagementServerUpdate.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMManagementServerUpdate/MSFT_xSCOMManagementServerUpdate.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMReportingServerSetup/MSFT_xSCOMReportingServerSetup.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMReportingServerSetup/MSFT_xSCOMReportingServerSetup.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMWebConsoleServerSetup/MSFT_xSCOMWebConsoleServerSetup.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMWebConsoleServerSetup/MSFT_xSCOMWebConsoleServerSetup.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMWebConsoleServerUpdate/MSFT_xSCOMWebConsoleServerUpdate.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMWebConsoleServerUpdate/MSFT_xSCOMWebConsoleServerUpdate.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSCOM/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xSCOM/en-US/xPDT.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xSCOM/xPDT.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCOM/xSCOM.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xRunbookDirectory/MSFT_xRunbookDirectory.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xRunbookDirectory/MSFT_xRunbookDirectory.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSCSMAPowerShellSetup/MSFT_xSCSMAPowerShellSetup.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSCSMAPowerShellSetup/MSFT_xSCSMAPowerShellSetup.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSCSMARunbookWorkerServerSetup/MSFT_xSCSMARunbookWorkerServerSetup.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSCSMARunbookWorkerServerSetup/MSFT_xSCSMARunbookWorkerServerSetup.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSCSMAWebServiceServerSetup/MSFT_xSCSMAWebServiceServerSetup.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSCSMAWebServiceServerSetup/MSFT_xSCSMAWebServiceServerSetup.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSmaCredential/MSFT_xSmaCredential.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSmaCredential/MSFT_xSmaCredential.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSmaVariable/MSFT_xSmaVariable.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSmaVariable/MSFT_xSmaVariable.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSCSMA/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xSCSMA/en-US/xPDT.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xSCSMA/xPDT.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCSMA/xSCSMA.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFServer/MSFT_xSCSPFServer.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFServer/MSFT_xSCSPFServer.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFServerSetup/MSFT_xSCSPFServerSetup.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFServerSetup/MSFT_xSCSPFServerSetup.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFServerUpdate/MSFT_xSCSPFServerUpdate.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFServerUpdate/MSFT_xSCSPFServerUpdate.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFSetting/MSFT_xSCSPFSetting.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFSetting/MSFT_xSCSPFSetting.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFStamp/MSFT_xSCSPFStamp.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFStamp/MSFT_xSCSPFStamp.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSCSPF/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xSCSPF/en-US/xPDT.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xSCSPF/xPDT.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCSPF/xSCSPF.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xSCSR/DSCResources/MSFT_xSCSRServerSetup/MSFT_xSCSRServerSetup.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCSR/DSCResources/MSFT_xSCSRServerSetup/MSFT_xSCSRServerSetup.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSCSR/DSCResources/MSFT_xSCSRServerUpdate/MSFT_xSCSRServerUpdate.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCSR/DSCResources/MSFT_xSCSRServerUpdate/MSFT_xSCSRServerUpdate.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSCSR/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xSCSR/en-US/xPDT.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xSCSR/xPDT.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCSR/xSCSR.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMAdmin/MSFT_xSCVMMAdmin.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMAdmin/MSFT_xSCVMMAdmin.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMConsoleSetup/MSFT_xSCVMMConsoleSetup.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMConsoleSetup/MSFT_xSCVMMConsoleSetup.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMConsoleUpdate/MSFT_xSCVMMConsoleUpdate.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMConsoleUpdate/MSFT_xSCVMMConsoleUpdate.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMManagementServerSetup/MSFT_xSCVMMManagementServerSetup.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMManagementServerSetup/MSFT_xSCVMMManagementServerSetup.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMManagementServerUpdate/MSFT_xSCVMMManagementServerUpdate.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMManagementServerUpdate/MSFT_xSCVMMManagementServerUpdate.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSCVMM/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xSCVMM/en-US/xPDT.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xSCVMM/xPDT.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSCVMM/xSCVMM.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLAOGroupEnsure/MSFT_xSQLAOGroupEnsure.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLAOGroupEnsure/MSFT_xSQLAOGroupEnsure.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLAOGroupJoin/MSFT_xSQLAOGroupJoin.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLAOGroupJoin/MSFT_xSQLAOGroupJoin.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAlias/MSFT_xSQLServerAlias.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAlias/MSFT_xSQLServerAlias.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroup/MSFT_xSQLServerAlwaysOnAvailabilityGroup.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroup/MSFT_xSQLServerAlwaysOnAvailabilityGroup.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupReplica/MSFT_xSQLServerAlwaysOnAvailabilityGroupReplica.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupReplica/MSFT_xSQLServerAlwaysOnAvailabilityGroupReplica.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAlwaysOnService/MSFT_xSQLServerAlwaysOnService.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAlwaysOnService/MSFT_xSQLServerAlwaysOnService.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAvailabilityGroupListener/MSFT_xSQLServerAvailabilityGroupListener.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAvailabilityGroupListener/MSFT_xSQLServerAvailabilityGroupListener.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerConfiguration/MSFT_xSQLServerConfiguration.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerConfiguration/MSFT_xSQLServerConfiguration.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabase/MSFT_xSQLServerDatabase.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabase/MSFT_xSQLServerDatabase.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabaseOwner/MSFT_xSQLServerDatabaseOwner.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabaseOwner/MSFT_xSQLServerDatabaseOwner.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabasePermission/MSFT_xSQLServerDatabasePermission.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabasePermission/MSFT_xSQLServerDatabasePermission.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabaseRecoveryModel/MSFT_xSQLServerDatabaseRecoveryModel.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabaseRecoveryModel/MSFT_xSQLServerDatabaseRecoveryModel.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabaseRole/MSFT_xSQLServerDatabaseRole.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabaseRole/MSFT_xSQLServerDatabaseRole.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerEndpoint/MSFT_xSQLServerEndpoint.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerEndpoint/MSFT_xSQLServerEndpoint.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerEndpointPermission/MSFT_xSQLServerEndpointPermission.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerEndpointPermission/MSFT_xSQLServerEndpointPermission.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerEndpointState/MSFT_xSQLServerEndpointState.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerEndpointState/MSFT_xSQLServerEndpointState.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerFailoverClusterSetup/MSFT_xSQLServerFailoverClusterSetup.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerFailoverClusterSetup/MSFT_xSQLServerFailoverClusterSetup.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerFirewall/MSFT_xSQLServerFirewall.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerFirewall/MSFT_xSQLServerFirewall.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerLogin/MSFT_xSQLServerLogin.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerLogin/MSFT_xSQLServerLogin.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerMaxDop/MSFT_xSQLServerMaxDop.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerMaxDop/MSFT_xSQLServerMaxDop.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerMemory/MSFT_xSQLServerMemory.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerMemory/MSFT_xSQLServerMemory.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerNetwork/MSFT_xSQLServerNetwork.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerNetwork/MSFT_xSQLServerNetwork.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerPermission/MSFT_xSQLServerPermission.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerPermission/MSFT_xSQLServerPermission.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerRSConfig/MSFT_xSQLServerRSConfig.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerRSConfig/MSFT_xSQLServerRSConfig.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerRSSecureConnectionLevel/MSFT_xSQLServerRSSecureConnectionLevel.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerRSSecureConnectionLevel/MSFT_xSQLServerRSSecureConnectionLevel.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerReplication/MSFT_xSQLServerReplication.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerReplication/MSFT_xSQLServerReplication.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerRole/MSFT_xSQLServerRole.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerRole/MSFT_xSQLServerRole.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerScript/MSFT_xSQLServerScript.Schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerScript/MSFT_xSQLServerScript.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerSetup/MSFT_xSQLServerSetup.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerSetup/MSFT_xSQLServerSetup.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xWaitForAvailabilityGroup/MSFT_xWaitForAvailabilityGroup.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xWaitForAvailabilityGroup/MSFT_xWaitForAvailabilityGroup.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/en-US/xPDT.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/en-US/xSQLServer.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/xPDT.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/xSQLServer.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xSQLServer/xSQLServerHelper.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSmbShare/DscResources/MSFT_xSmbShare/MSFT_xSmbShare.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSmbShare/DscResources/MSFT_xSmbShare/MSFT_xSmbShare.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSmbShare/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xSmbShare/xSmbShare.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlAlias/MSFT_xSqlAlias.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlAlias/MSFT_xSqlAlias.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlHAEndPoint/MSFT_xSqlHAEndPoint.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlHAEndPoint/MSFT_xSqlHAEndPoint.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlHAGroup/MSFT_xSqlHAGroup.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlHAGroup/MSFT_xSqlHAGroup.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlHAService/MSFT_xSqlHAService.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlHAService/MSFT_xSqlHAService.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlServerInstall/MSFT_xSqlServerInstall.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlServerInstall/MSFT_xSqlServerInstall.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xWaitForSqlHAGroup/MSFT_xWaitForSqlHAGroup.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xWaitForSqlHAGroup/MSFT_xWaitForSqlHAGroup.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xSqlPs/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xSqlPs/xSqlPs.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xDisk/MSFT_xDisk.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xDisk/MSFT_xDisk.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xDisk/en-us/MSFT_xDisk.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xDiskAccessPath/MSFT_xDiskAccessPath.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xDiskAccessPath/MSFT_xDiskAccessPath.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xDiskAccessPath/en-us/MSFT_xDiskAccessPath.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xMountImage/MSFT_xMountImage.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xMountImage/MSFT_xMountImage.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xMountImage/en-us/MSFT_xMountImage.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xWaitForDisk/MSFT_xWaitForDisk.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xWaitForDisk/MSFT_xWaitForDisk.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xWaitForDisk/en-us/MSFT_xWaitForDisk.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xWaitForVolume/MSFT_xWaitForVolume.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xWaitForVolume/MSFT_xWaitForVolume.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xWaitForVolume/en-us/MSFT_xWaitForVolume.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xStorage/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xStorage/Modules/StorageDsc.Common/StorageDsc.Common.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xStorage/Modules/StorageDsc.Common/en-us/StorageDsc.Common.strings.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xStorage/Modules/StorageDsc.ResourceHelper/StorageDsc.ResourceHelper.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xStorage/xStorage.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xTimeZone/DSCResources/SetTimeZone.cs delete mode 100644 lib/puppet_x/dsc_resources/xTimeZone/DSCResources/TimezoneHelper.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xTimeZone/DSCResources/en-us/TimezoneHelper.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xTimeZone/DSCResources/xTimeZone/en-us/xTimeZone.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xTimeZone/DSCResources/xTimeZone/xTimeZone.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xTimeZone/DSCResources/xTimeZone/xTimeZone.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xTimeZone/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xTimeZone/xTimeZone.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/Helper.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIIsHandler/MSFT_xIisHandler.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIIsHandler/MSFT_xIisHandler.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisFeatureDelegation/MSFT_xIisFeatureDelegation.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisFeatureDelegation/MSFT_xIisFeatureDelegation.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisLogging/MSFT_xIisLogging.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisLogging/MSFT_xIisLogging.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisMimeTypeMapping/MSFT_xIisMimeTypeMapping.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisMimeTypeMapping/MSFT_xIisMimeTypeMapping.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisModule/MSFT_xIisModule.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisModule/MSFT_xIisModule.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisModule/xIisModuleDesigner.ps1 delete mode 100644 lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xSSLSettings/MSFT_xSSLSettings.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xSSLSettings/MSFT_xSSLSettings.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebAppPool/MSFT_xWebAppPool.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebAppPool/MSFT_xWebAppPool.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebAppPoolDefaults/MSFT_xWebAppPoolDefaults.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebAppPoolDefaults/MSFT_xWebAppPoolDefaults.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebApplication/MSFT_xWebApplication.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebApplication/MSFT_xWebApplication.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebConfigKeyValue/MSFT_xWebConfigKeyValue.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebConfigKeyValue/MSFT_xWebConfigKeyValue.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebSiteDefaults/MSFT_xWebSiteDefaults.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebSiteDefaults/MSFT_xWebSiteDefaults.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebVirtualDirectory/MSFT_xWebVirtualDirectory.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebVirtualDirectory/MSFT_xWebVirtualDirectory.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebsite/MSFT_xWebsite.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebsite/MSFT_xWebsite.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xWebAdministration/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xWebAdministration/xWebAdministration.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xWebDeploy/DSCResources/xWebDeploy/xWebDeploy.Schema.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xWebDeploy/DSCResources/xWebDeploy/xWebDeploy.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xWebDeploy/DSCResources/xWebPackageDeploy/xWebPackageDeploy.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xWebDeploy/DSCResources/xWebPackageDeploy/xWebPackageDeploy.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xWebDeploy/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xWebDeploy/xWebDeploy.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xWinEventLog/DSCResources/MSFT_xWinEventLog/MSFT_xWinEventLog.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xWinEventLog/DSCResources/MSFT_xWinEventLog/MSFT_xWinEventLog.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xWinEventLog/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xWinEventLog/xWinEventLog.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xWinEventLog/xWinEventLog.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xWindowsEventForwarding/DSCResources/MSFT_xWEFCollector/MSFT_xWEFCollector.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xWindowsEventForwarding/DSCResources/MSFT_xWEFCollector/MSFT_xWEFCollector.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xWindowsEventForwarding/DSCResources/MSFT_xWEFSubscription/MSFT_xWEFSubscription.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xWindowsEventForwarding/DSCResources/MSFT_xWEFSubscription/MSFT_xWEFSubscription.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xWindowsEventForwarding/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xWindowsEventForwarding/xWindowsEventForwarding.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xWindowsRestore/DSCResources/xSystemRestore/xSystemRestore.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xWindowsRestore/DSCResources/xSystemRestore/xSystemRestore.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xWindowsRestore/DSCResources/xSystemRestorePoint/xSystemRestorePoint.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xWindowsRestore/DSCResources/xSystemRestorePoint/xSystemRestorePoint.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xWindowsRestore/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xWindowsRestore/xWindowsRestore.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xWindowsUpdate/DscResources/MSFT_xMicrosoftUpdate/MSFT_xMicrosoftUpdate.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xWindowsUpdate/DscResources/MSFT_xMicrosoftUpdate/MSFT_xMicrosoftUpdate.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xWindowsUpdate/DscResources/MSFT_xWindowsUpdate/MSFT_xWindowsUpdate.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xWindowsUpdate/DscResources/MSFT_xWindowsUpdate/MSFT_xWindowsUpdate.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xWindowsUpdate/DscResources/MSFT_xWindowsUpdateAgent/MSFT_xWindowsUpdateAgent.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xWindowsUpdate/DscResources/MSFT_xWindowsUpdateAgent/MSFT_xWindowsUpdateAgent.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xWindowsUpdate/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xWindowsUpdate/xWindowsUpdate.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xWordPress/DscResources/MSFT_xWordPressSite/MSFT_xWordPressSite.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xWordPress/DscResources/MSFT_xWordPressSite/MSFT_xWordPressSite.schema.mof delete mode 100644 lib/puppet_x/dsc_resources/xWordPress/DscResources/MSFT_xWordPressSite/xWordPressSite.ps1 delete mode 100644 lib/puppet_x/dsc_resources/xWordPress/DscResources/xIisWordPressSite/xIisWordPressSite.Schema.psm1 delete mode 100644 lib/puppet_x/dsc_resources/xWordPress/DscResources/xIisWordPressSite/xIisWordPressSite.psd1 delete mode 100644 lib/puppet_x/dsc_resources/xWordPress/LICENSE delete mode 100644 lib/puppet_x/dsc_resources/xWordPress/xWordPress.psd1 delete mode 100644 spec/unit/puppet/type/dsc_archive_spec.rb delete mode 100644 spec/unit/puppet/type/dsc_environment_spec.rb delete mode 100644 spec/unit/puppet/type/dsc_file_spec.rb delete mode 100644 spec/unit/puppet/type/dsc_group_spec.rb delete mode 100644 spec/unit/puppet/type/dsc_log_spec.rb delete mode 100644 spec/unit/puppet/type/dsc_package_spec.rb delete mode 100644 spec/unit/puppet/type/dsc_registry_spec.rb delete mode 100644 spec/unit/puppet/type/dsc_script_spec.rb delete mode 100644 spec/unit/puppet/type/dsc_service_spec.rb delete mode 100644 spec/unit/puppet/type/dsc_user_spec.rb delete mode 100644 spec/unit/puppet/type/dsc_windowsfeature_spec.rb delete mode 100644 spec/unit/puppet/type/dsc_windowsoptionalfeature_spec.rb delete mode 100644 spec/unit/puppet/type/dsc_windowsprocess_spec.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/environment/env_delete_var.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/environment/env_new_var.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/environment/env_no_value.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/environment/env_update_path_var.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/environment/env_update_var.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/file/dir_recurse.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/file/dir_remove_dir.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/file/dir_valid_path.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/file/dir_valid_unicode_path.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/file/file_remove_file.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/file/file_valid_path_contents.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/file/file_valid_path_source.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/file/file_valid_unicode_contents.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/file/file_valid_unicode_path.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/file/file_valid_unicode_source.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/file/negative/file_invalid_force.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/file/negative/file_invalid_path.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/file/negative/file_invalid_sourcepath.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/group/group_remove.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/group/group_unicode_groupname.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/group/group_valid_members.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/group/negative/group_add_non-existent_user.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/group/negative/group_invalid_groupname.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/group/negative/group_member_conflict.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/package/negative/package_failed_install.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/package/negative/package_invalid_msi.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/package/negative/package_invalid_path.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/package/negative/package_invalid_productid.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/package/package_uninstall.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/package/package_valid_args.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/package/package_valid_msi.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/package/package_valid_returncode.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/registry/negative/reg_invalid_binary_value.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/registry/negative/reg_invalid_dword_value.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/registry/negative/reg_invalid_key.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/registry/reg_force_value.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/registry/reg_remove_value.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/registry/reg_valid_binary_valuedata.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/registry/reg_valid_dword_hex_valuedata.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/registry/reg_valid_dword_valuedata.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/registry/reg_valid_implicit_valuedata.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/registry/reg_valid_key_valuename.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/service/negative/service_incompatible_startup_state.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/service/negative/service_invalid_name.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/service/service_remove.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/service/service_valid_name_startuptype_state.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/user/negative/user_invalid_password.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/user/negative/user_invalid_passwordneverexpires.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/user/negative/user_invalid_username.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/user/user_remove.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/user/user_valid_password.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/user/user_valid_unicode.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/waitforall/negative/waitforall_blacklist.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/waitforany/negative/waitforany_blacklist.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/waitforsome/negative/waitforsome_blacklist.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/windowsprocess/negative/process_invalid_path.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/windowsprocess/process_kill.rb delete mode 100755 tests/acceptance/tests/basic_dsc_resources/windowsprocess/process_valid_args.rb delete mode 100755 tests/acceptance/tests/user_scenarios/vendored_resource.rb delete mode 100755 tests/files/test_installer/README.md delete mode 100755 tests/files/test_installer/test.nsi delete mode 100755 tests/files/test_installer/test.txt delete mode 100755 tests/files/test_installer/test_program_installer.exe delete mode 100755 tests/integration/tests/user_scenarios/create_mysql_database_server.rb delete mode 100755 tests/integration/tests/user_scenarios/kitchen_sink.rb delete mode 100755 tests/integration/tests/user_scenarios/negative/blacklist_xchrome.rb delete mode 100755 tests/integration/tests/user_scenarios/negative/blacklist_xfirefox.rb delete mode 100755 tests/manifests/user_scenarios/kitchen_sink.pp.erb diff --git a/lib/puppet/type/dsc_archive.rb b/lib/puppet/type/dsc_archive.rb deleted file mode 100644 index d03c5e7b..00000000 --- a/lib/puppet/type/dsc_archive.rb +++ /dev/null @@ -1,187 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_archive) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC Archive resource type. - Automatically generated from - 'PSDesiredStateConfiguration/DSCResources/MSFT_ArchiveResource/MSFT_ArchiveResource.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_path is a required attribute') if self[:dsc_path].nil? - fail('dsc_destination is a required attribute') if self[:dsc_destination].nil? - end - - def dscmeta_resource_friendly_name; 'Archive' end - def dscmeta_resource_name; 'MSFT_ArchiveResource' end - def dscmeta_module_name; 'PSDesiredStateConfiguration' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Path - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_path) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Path" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Destination - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_destination) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Destination" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Validate - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_validate) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Validate" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Checksum - # Type: string - # IsMandatory: False - # Values: ["SHA-1", "SHA-256", "SHA-512", "CreatedDate", "ModifiedDate"] - newparam(:dsc_checksum) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Checksum - Valid values are SHA-1, SHA-256, SHA-512, CreatedDate, ModifiedDate." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['SHA-1', 'sha-1', 'SHA-256', 'sha-256', 'SHA-512', 'sha-512', 'CreatedDate', 'createddate', 'ModifiedDate', 'modifieddate'].include?(value) - fail("Invalid value '#{value}'. Valid values are SHA-1, SHA-256, SHA-512, CreatedDate, ModifiedDate") - end - end - end - - # Name: Force - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_force) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Force" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_archive).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_auditpolicycsv.rb b/lib/puppet/type/dsc_auditpolicycsv.rb deleted file mode 100644 index c81344f4..00000000 --- a/lib/puppet/type/dsc_auditpolicycsv.rb +++ /dev/null @@ -1,103 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_auditpolicycsv) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC AuditPolicyCsv resource type. - Automatically generated from - 'AuditPolicyDsc/DSCResources/MSFT_AuditPolicyCsv/MSFT_AuditPolicyCsv.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_issingleinstance is a required attribute') if self[:dsc_issingleinstance].nil? - end - - def dscmeta_resource_friendly_name; 'AuditPolicyCsv' end - def dscmeta_resource_name; 'MSFT_AuditPolicyCsv' end - def dscmeta_module_name; 'AuditPolicyDsc' end - def dscmeta_module_version; '1.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: IsSingleInstance - # Type: string - # IsMandatory: True - # Values: ["Yes"] - newparam(:dsc_issingleinstance) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes' Valid values are Yes." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Yes', 'yes'].include?(value) - fail("Invalid value '#{value}'. Valid values are Yes") - end - end - end - - # Name: CsvPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_csvpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CsvPath - Path to a CSV backup of Auditing settings" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_auditpolicycsv).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_auditpolicyoption.rb b/lib/puppet/type/dsc_auditpolicyoption.rb deleted file mode 100644 index e03629dc..00000000 --- a/lib/puppet/type/dsc_auditpolicyoption.rb +++ /dev/null @@ -1,108 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_auditpolicyoption) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC AuditPolicyOption resource type. - Automatically generated from - 'AuditPolicyDsc/DSCResources/MSFT_AuditPolicyOption/MSFT_AuditPolicyOption.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - fail('dsc_value is a required attribute') if self[:dsc_value].nil? - end - - def dscmeta_resource_friendly_name; 'AuditPolicyOption' end - def dscmeta_resource_name; 'MSFT_AuditPolicyOption' end - def dscmeta_module_name; 'AuditPolicyDsc' end - def dscmeta_module_version; '1.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: ["CrashOnAuditFail", "FullPrivilegeAuditing", "AuditBaseObjects", "AuditBaseDirectories"] - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the audit policy option to set. Valid values are CrashOnAuditFail, FullPrivilegeAuditing, AuditBaseObjects, AuditBaseDirectories." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['CrashOnAuditFail', 'crashonauditfail', 'FullPrivilegeAuditing', 'fullprivilegeauditing', 'AuditBaseObjects', 'auditbaseobjects', 'AuditBaseDirectories', 'auditbasedirectories'].include?(value) - fail("Invalid value '#{value}'. Valid values are CrashOnAuditFail, FullPrivilegeAuditing, AuditBaseObjects, AuditBaseDirectories") - end - end - end - - # Name: Value - # Type: string - # IsMandatory: True - # Values: ["Enabled", "Disabled"] - newparam(:dsc_value) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Value - The value to set the audit policy option to. Valid values are Enabled, Disabled." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Enabled', 'enabled', 'Disabled', 'disabled'].include?(value) - fail("Invalid value '#{value}'. Valid values are Enabled, Disabled") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_auditpolicyoption).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_auditpolicysubcategory.rb b/lib/puppet/type/dsc_auditpolicysubcategory.rb deleted file mode 100644 index b56d8e9b..00000000 --- a/lib/puppet/type/dsc_auditpolicysubcategory.rb +++ /dev/null @@ -1,125 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_auditpolicysubcategory) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC AuditPolicySubcategory resource type. - Automatically generated from - 'AuditPolicyDsc/DSCResources/MSFT_AuditPolicySubcategory/MSFT_AuditPolicySubcategory.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - fail('dsc_auditflag is a required attribute') if self[:dsc_auditflag].nil? - end - - def dscmeta_resource_friendly_name; 'AuditPolicySubcategory' end - def dscmeta_resource_name; 'MSFT_AuditPolicySubcategory' end - def dscmeta_module_name; 'AuditPolicyDsc' end - def dscmeta_module_version; '1.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the Subcategory to be configured." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AuditFlag - # Type: string - # IsMandatory: True - # Values: ["Success", "Failure"] - newparam(:dsc_auditflag) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AuditFlag - The audit flag to be configured. Valid values are Success, Failure." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Success', 'success', 'Failure', 'failure'].include?(value) - fail("Invalid value '#{value}'. Valid values are Success, Failure") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies whether the flag should be enabled or disabled. To enable the flag, set this property to Present. To disable the flag, set this property to Absent. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_auditpolicysubcategory).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_environment.rb b/lib/puppet/type/dsc_environment.rb deleted file mode 100644 index 862f058e..00000000 --- a/lib/puppet/type/dsc_environment.rb +++ /dev/null @@ -1,135 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_environment) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC Environment resource type. - Automatically generated from - 'PSDesiredStateConfiguration/DSCResources/MSFT_EnvironmentResource/MSFT_EnvironmentResource.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'Environment' end - def dscmeta_resource_name; 'MSFT_EnvironmentResource' end - def dscmeta_module_name; 'PSDesiredStateConfiguration' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Value - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_value) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Value" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Path - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_path) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Path" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_environment).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_group.rb b/lib/puppet/type/dsc_group.rb deleted file mode 100644 index 15f10caa..00000000 --- a/lib/puppet/type/dsc_group.rb +++ /dev/null @@ -1,189 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_group) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC Group resource type. - Automatically generated from - 'PSDesiredStateConfiguration/DSCResources/MSFT_GroupResource/MSFT_GroupResource.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_groupname is a required attribute') if self[:dsc_groupname].nil? - end - - def dscmeta_resource_friendly_name; 'Group' end - def dscmeta_resource_name; 'MSFT_GroupResource' end - def dscmeta_module_name; 'PSDesiredStateConfiguration' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: GroupName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_groupname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "GroupName" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Description - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_description) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Description" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Members - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_members, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Members" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: MembersToInclude - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_memberstoinclude, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "MembersToInclude" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: MembersToExclude - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_memberstoexclude, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "MembersToExclude" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_group).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_log.rb b/lib/puppet/type/dsc_log.rb deleted file mode 100644 index eed8e831..00000000 --- a/lib/puppet/type/dsc_log.rb +++ /dev/null @@ -1,82 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_log) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC Log resource type. - Automatically generated from - 'PSDesiredStateConfiguration/DSCResources/MSFT_LogResource/MSFT_LogResource.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - end - - def dscmeta_resource_friendly_name; 'Log' end - def dscmeta_resource_name; 'MSFT_LogResource' end - def dscmeta_module_name; 'PSDesiredStateConfiguration' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Message - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_message) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Message" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_log).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_officeonlineserverfarm.rb b/lib/puppet/type/dsc_officeonlineserverfarm.rb deleted file mode 100644 index 851c80c7..00000000 --- a/lib/puppet/type/dsc_officeonlineserverfarm.rb +++ /dev/null @@ -1,891 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_officeonlineserverfarm) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC OfficeOnlineServerFarm resource type. - Automatically generated from - 'OfficeOnlineServerDsc/DSCResources/MSFT_OfficeOnlineServerFarm/MSFT_OfficeOnlineServerFarm.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_internalurl is a required attribute') if self[:dsc_internalurl].nil? - end - - def dscmeta_resource_friendly_name; 'OfficeOnlineServerFarm' end - def dscmeta_resource_name; 'MSFT_OfficeOnlineServerFarm' end - def dscmeta_module_name; 'OfficeOnlineServerDsc' end - def dscmeta_module_version; '1.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: AllowCEIP - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowceip) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowCEIP - Enables Customer Experience Improvement Program (CEIP) reporting on all servers in the Office Web Apps Server farm" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AllowHttp - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowhttp) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowHttp - Indicates that IIS sites should be provisioned on port 80 for HTTP access. Use AllowHTTP only in environments where all computers require IPSEC (full encryption) or in test environments that do not contain sensitive files." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AllowHttpSecureStoreConnections - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowhttpsecurestoreconnections) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowHttpSecureStoreConnections - Indicates that secure store connections can be made by using non-SSL connections (such as HTTP). The default is False." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: CacheLocation - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_cachelocation) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CacheLocation - Specifies the location of the global disk cache that is used to store rendered image files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CacheSizeInGB - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_cachesizeingb) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "CacheSizeInGB - Specifies the maximum size of the global disk cache in gigabytes." - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: CertificateName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_certificatename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CertificateName - Specifies the friendly name of the certificate that Office Web Apps Server uses to create HTTPS bindings." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ClipartEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_clipartenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ClipartEnabled - Enables support for inserting clip art from Office.com into Office documents. This feature requires server-to-web communication, configured either directly or by using a proxy that you specify by using the Proxy parameter." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DocumentInfoCacheSize - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_documentinfocachesize) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "DocumentInfoCacheSize - Specifies the maximum number of document conversion records that are stored in a memory cache." - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: EditingEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_editingenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "EditingEnabled - Enables support for editing in the browser. The default is False. Only set to True if you have the appropriate licensing to use the editing functionality." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ExcelAllowExternalData - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_excelallowexternaldata) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ExcelAllowExternalData - Enables the refresh of supported external data in Excel Web App workbooks where workbooks contain connections to external data. The default is True." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ExcelConnectionLifetime - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_excelconnectionlifetime) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "ExcelConnectionLifetime - Specifies the duration, in seconds, of external data connections for Excel Web App. The default is 1800 seconds." - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ExcelExternalDataCacheLifetime - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_excelexternaldatacachelifetime) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "ExcelExternalDataCacheLifetime - Specifes the duration, in seconds, of the external data cache lifetime in Excel Web App. The default is 300 seconds." - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ExcelPrivateBytesMax - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_excelprivatebytesmax) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "ExcelPrivateBytesMax - Specifies the maximum private bytes, in megabytes, used by Excel Web App. When set to -1, the maximum private bytes use 50 percent of physical memory on the computer." - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ExcelRequestDurationMax - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_excelrequestdurationmax) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "ExcelRequestDurationMax - Specifies the maximum duration, in seconds, for a single request in a session. After this time elapses, the request times out." - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ExcelSessionTimeout - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_excelsessiontimeout) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "ExcelSessionTimeout - Specifies the time, in seconds, that a session remains active in Excel Web App when there is no user activity." - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ExcelUdfsAllowed - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_exceludfsallowed) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ExcelUdfsAllowed - Activates user-defined functions for use with Web Excel." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ExcelWarnOnDataRefresh - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_excelwarnondatarefresh) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ExcelWarnOnDataRefresh - Turns off or on the warning dialog displayed when data refreshes in Excel Web App." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ExcelWorkbookSizeMax - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_excelworkbooksizemax) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "ExcelWorkbookSizeMax - Specifies the maximum size, in megabytes, of a workbook that can be loaded." - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ExcelMemoryCacheThreshold - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_excelmemorycachethreshold) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "ExcelMemoryCacheThreshold - The percentage of the Maximum Private Bytes that can be allocated to inactive objects. When the memory cache threshold is exceeded, cached objects that are not currently in use are released." - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ExcelUnusedObjectAgeMax - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_excelunusedobjectagemax) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "ExcelUnusedObjectAgeMax - The maximum time (in minutes) that inactive objects remain in the memory cache. Inactive objects are objects that are not used in a session." - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ExcelCachingUnusedFiles - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_excelcachingunusedfiles) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ExcelCachingUnusedFiles - Enable caching of files that are no longer in use by Web Excel sessions." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ExcelAbortOnRefreshOnOpenFail - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_excelabortonrefreshonopenfail) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ExcelAbortOnRefreshOnOpenFail - Specifies that the loading of a Web Excel file automatically fails if an automatic data refresh operation fails when the file is opened." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ExcelAutomaticVolatileFunctionCacheLifetime - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_excelautomaticvolatilefunctioncachelifetime) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "ExcelAutomaticVolatileFunctionCacheLifetime - Specifies the maximum time, in seconds, that a computed value for a volatile function is cached for automatic recalculations." - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ExcelConcurrentDataRequestsPerSessionMax - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_excelconcurrentdatarequestspersessionmax) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "ExcelConcurrentDataRequestsPerSessionMax - Specifies the maximum number of concurrent external data requests allowed in each session. If a session must issue more than this number of requests, additional requests must be queued. The scope of this setting is the logical server." - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ExcelDefaultWorkbookCalcMode - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_exceldefaultworkbookcalcmode) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ExcelDefaultWorkbookCalcMode - Specifies the calculation mode of workbooks. Settings other than File override the workbook settings." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ExcelRestExternalDataEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_excelrestexternaldataenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ExcelRestExternalDataEnabled - Specifies whether requests from the Representational State Transfer (REST) Application Programming Interface (API) are permitted to refresh external data connections." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ExcelChartAndImageSizeMax - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_excelchartandimagesizemax) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "ExcelChartAndImageSizeMax - Specifies the maximum size, in megabytes, of a chart or image that can be opened." - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ExternalURL - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_externalurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ExternalURL - Specifies the URL root that clients use to access the Office Web Apps Server farm from the Internet. In the case of a load-balanced, multiserver Office Web Apps Server farm, the external URL is bound to the IP address of the external-facing load balancer." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: FarmOU - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_farmou) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FarmOU - Specifies the name of the Active Directory organizational unit (OU) that servers must be a member of to join the Office Web Apps Server farm. Use this parameter to prevent unauthorized servers (that is, servers that are not in the OU) from joining an Office Web Apps Server farm." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InternalURL - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_internalurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InternalURL - Specifies the URL root that clients use to access the Office Web Apps Server farm from the intranet." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: LogLocation - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_loglocation) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogLocation - Specifies the location on the local computer where activity logs are stored." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: LogRetentionInDays - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_logretentionindays) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "LogRetentionInDays - Specifies the number of days that log entries are stored. Log entries older than the configured date are trimmed." - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: LogVerbosity - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_logverbosity) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogVerbosity - Specifies how much information is stored in the trace log files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MaxMemoryCacheSizeInMB - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_maxmemorycachesizeinmb) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "MaxMemoryCacheSizeInMB - Specifies, in megabytes, the maximum amount of memory that the rendering cache can use." - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MaxTranslationCharacterCount - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_maxtranslationcharactercount) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "MaxTranslationCharacterCount - Specifies the maximum amount of characters a document can have in order to be translated." - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: OpenFromUncEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_openfromuncenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "OpenFromUncEnabled - Turns on or off the ability to use Online Viewers to view Office files from a UNC path." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: OpenFromUrlEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_openfromurlenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "OpenFromUrlEnabled - Turns on or off the ability to use Online Viewers to view Office files from a URL or UNC path." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: OpenFromUrlThrottlingEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_openfromurlthrottlingenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "OpenFromUrlThrottlingEnabled - Throttles the number of open from URL requests from any given server in a time period. The default throttling values, which are not configurable, make sure that an Office Web Apps Server farm will not overwhelm a single server with requests for content to be viewed in the Online Viewers." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Proxy - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_proxy) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Proxy - Specifies the URL of the proxy server that is configured to allow HTTP requests to external sites. Typically configured in conjunction with the ClipartEnabled and TranslationEnabled parameters." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RecycleActiveProcessCount - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_recycleactiveprocesscount) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "RecycleActiveProcessCount - Specifies the number of files that a single Word or PowerPoint process can render before the process is recycled." - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: RenderingLocalCacheLocation - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_renderinglocalcachelocation) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RenderingLocalCacheLocation - Specifies the location of the temporary cache for use by the Word and PowerPoint Viewing Services." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SSLOffloaded - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_ssloffloaded) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "SSLOffloaded - Indicates to the servers in the Office Web Apps Server farm that SSL is offloaded to the load balancer. When SSLOffloaded is enabled, web applications are bound to port 80 (HTTP) on the local server. However, HTML that references other resources, such as CSS or images, uses HTTPS URLs for those references." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: TranslationEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_translationenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "TranslationEnabled - Enables support for automatic document translation using Microsoft Translator, an online service that translates text between languages. The translated file is shown in the Word Web App. Because Microsoft Translator is an online service, you must enable server-to-web communication directly or by using a proxy that you specify by using the Proxy parameter." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: TranslationServiceAddress - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_translationserviceaddress) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TranslationServiceAddress - Specifies the URL of the translation server that translation requests are sent to. The default is the Microsoft Translator online service. Typically you will not use this parameter unless you must change translation services." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: TranslationServiceAppId - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_translationserviceappid) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TranslationServiceAppId - Specifies the application ID for the translation service. The default is the public application ID for Office Web Apps. Typically you will not use this parameter unless you have negotiated with Microsoft Translator for additional services and they have provided you with a private application ID." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AllowOutboundHttp - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowoutboundhttp) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowOutboundHttp" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ExcelUseEffectiveUserName - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_exceluseeffectiveusername) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ExcelUseEffectiveUserName" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: S2SCertificateName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_s2scertificatename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "S2SCertificateName" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RemovePersonalInformationFromLogs - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_removepersonalinformationfromlogs) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RemovePersonalInformationFromLogs" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: PicturePasteDisabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_picturepastedisabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "PicturePasteDisabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_officeonlineserverfarm).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_officeonlineserverinstall.rb b/lib/puppet/type/dsc_officeonlineserverinstall.rb deleted file mode 100644 index 763a9b9f..00000000 --- a/lib/puppet/type/dsc_officeonlineserverinstall.rb +++ /dev/null @@ -1,105 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_officeonlineserverinstall) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC OfficeOnlineServerInstall resource type. - Automatically generated from - 'OfficeOnlineServerDsc/DSCResources/MSFT_OfficeOnlineServerInstall/MSFT_OfficeOnlineServerInstall.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_ensure is a required attribute') if self[:dsc_ensure].nil? - end - - def dscmeta_resource_friendly_name; 'OfficeOnlineServerInstall' end - def dscmeta_resource_name; 'MSFT_OfficeOnlineServerInstall' end - def dscmeta_module_name; 'OfficeOnlineServerDsc' end - def dscmeta_module_version; '1.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: True - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Set to 'present' to specificy that the product should be installed. Valid values are Present, Absent." - isrequired - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Path - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_path) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Path - Path to setup.exe" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_officeonlineserverinstall).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_officeonlineservermachine.rb b/lib/puppet/type/dsc_officeonlineservermachine.rb deleted file mode 100644 index fdfea6d3..00000000 --- a/lib/puppet/type/dsc_officeonlineservermachine.rb +++ /dev/null @@ -1,123 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_officeonlineservermachine) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC OfficeOnlineServerMachine resource type. - Automatically generated from - 'OfficeOnlineServerDsc/DSCResources/MSFT_OfficeOnlineServerMachine/MSFT_OfficeOnlineServerMachine.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_machinetojoin is a required attribute') if self[:dsc_machinetojoin].nil? - end - - def dscmeta_resource_friendly_name; 'OfficeOnlineServerMachine' end - def dscmeta_resource_name; 'MSFT_OfficeOnlineServerMachine' end - def dscmeta_module_name; 'OfficeOnlineServerDsc' end - def dscmeta_module_version; '1.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Ensure Present or Absent Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Roles - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_roles, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Roles - Specifies one or more server roles, separated by commas, to assign to the new server. If no roles are specified, then the server is assigned all roles." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: MachineToJoin - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_machinetojoin) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MachineToJoin - Specifies the name of any server that is already a member of the Office Web Apps Server farm." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_officeonlineservermachine).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_package.rb b/lib/puppet/type/dsc_package.rb deleted file mode 100644 index 167d2f6b..00000000 --- a/lib/puppet/type/dsc_package.rb +++ /dev/null @@ -1,295 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_package) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC Package resource type. - Automatically generated from - 'PSDesiredStateConfiguration/DSCResources/MSFT_PackageResource/MSFT_PackageResource.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - fail('dsc_productid is a required attribute') if self[:dsc_productid].nil? - end - - def dscmeta_resource_friendly_name; 'Package' end - def dscmeta_resource_name; 'MSFT_PackageResource' end - def dscmeta_module_name; 'PSDesiredStateConfiguration' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Path - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_path) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Path" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ProductId - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_productid) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProductId" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Arguments - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_arguments) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Arguments" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: ReturnCode - # Type: uint32[] - # IsMandatory: False - # Values: None - newparam(:dsc_returncode, :array_matching => :all) do - def mof_type; 'uint32[]' end - def mof_is_embedded?; false end - desc "ReturnCode" - validate do |value| - unless value.kind_of?(Array) || (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value '#{value}'. Should be an integer or an array of integers") - end - end - munge do |value| - v = PuppetX::Dsc::TypeHelpers.munge_integer(value) - v.is_a?(Array) ? v : Array(v) - end - end - - # Name: LogPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_logpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: PackageDescription - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_packagedescription) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "PackageDescription" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Publisher - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_publisher) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Publisher" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstalledOn - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_installedon) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstalledOn" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Size - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_size) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "Size" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: Version - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_version) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Version" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Installed - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_installed) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Installed" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_package).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_registry.rb b/lib/puppet/type/dsc_registry.rb deleted file mode 100644 index 89cfb50d..00000000 --- a/lib/puppet/type/dsc_registry.rb +++ /dev/null @@ -1,189 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_registry) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC Registry resource type. - Automatically generated from - 'PSDesiredStateConfiguration/DSCResources/MSFT_RegistryResource/MSFT_RegistryResource.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_key is a required attribute') if self[:dsc_key].nil? - fail('dsc_valuename is a required attribute') if self[:dsc_valuename].nil? - end - - def dscmeta_resource_friendly_name; 'Registry' end - def dscmeta_resource_name; 'MSFT_RegistryResource' end - def dscmeta_module_name; 'PSDesiredStateConfiguration' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Key - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_key) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Key" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ValueName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_valuename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ValueName" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ValueData - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_valuedata, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ValueData" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: ValueType - # Type: string - # IsMandatory: False - # Values: ["String", "Binary", "Dword", "Qword", "MultiString", "ExpandString"] - newparam(:dsc_valuetype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ValueType - Valid values are String, Binary, Dword, Qword, MultiString, ExpandString." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['String', 'string', 'Binary', 'binary', 'Dword', 'dword', 'Qword', 'qword', 'MultiString', 'multistring', 'ExpandString', 'expandstring'].include?(value) - fail("Invalid value '#{value}'. Valid values are String, Binary, Dword, Qword, MultiString, ExpandString") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Hex - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_hex) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Hex" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Force - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_force) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Force" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_registry).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_runbookdirectory.rb b/lib/puppet/type/dsc_runbookdirectory.rb deleted file mode 100644 index d305c58f..00000000 --- a/lib/puppet/type/dsc_runbookdirectory.rb +++ /dev/null @@ -1,157 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_runbookdirectory) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC RunbookDirectory resource type. - Automatically generated from - 'xSCSMA/DSCResources/MSFT_xRunbookDirectory/MSFT_xRunbookDirectory.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_runbookpath is a required attribute') if self[:dsc_runbookpath].nil? - fail('dsc_webserviceendpoint is a required attribute') if self[:dsc_webserviceendpoint].nil? - end - - def dscmeta_resource_friendly_name; 'RunbookDirectory' end - def dscmeta_resource_name; 'MSFT_xRunbookDirectory' end - def dscmeta_module_name; 'xSCSMA' end - def dscmeta_module_version; '1.5.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:published) { provider.create } - newvalue(:draft) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :published } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Published", "Draft", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - The import state of runbooks found at RunbookPath. This can be Published, Draft, or Absent Valid values are Published, Draft, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Published', 'published', 'Draft', 'draft', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Published, Draft, Absent") - end - end - end - - # Name: RunbookPath - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_runbookpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RunbookPath - Path to Runbook(s) to be imported. Accepts wildcards." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Matches - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_matches) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Matches - Describes the validity of the imported Runbook(s)." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: WebServiceEndpoint - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_webserviceendpoint) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WebServiceEndpoint - URL of SMA's web service endpoint." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Port - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_port) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "Port - Port of the SMA web site. Defaults to the SMA default of 9090." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_runbookdirectory).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_script.rb b/lib/puppet/type/dsc_script.rb deleted file mode 100644 index 9049ec70..00000000 --- a/lib/puppet/type/dsc_script.rb +++ /dev/null @@ -1,149 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_script) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC Script resource type. - Automatically generated from - 'PSDesiredStateConfiguration/DSCResources/MSFT_ScriptResource/MSFT_ScriptResource.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_getscript is a required attribute') if self[:dsc_getscript].nil? - fail('dsc_setscript is a required attribute') if self[:dsc_setscript].nil? - fail('dsc_testscript is a required attribute') if self[:dsc_testscript].nil? - end - - def dscmeta_resource_friendly_name; 'Script' end - def dscmeta_resource_name; 'MSFT_ScriptResource' end - def dscmeta_module_name; 'PSDesiredStateConfiguration' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: GetScript - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_getscript) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "GetScript" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SetScript - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_setscript) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SetScript" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: TestScript - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_testscript) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TestScript" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Result - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_result) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Result" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_script).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_securitysetting.rb b/lib/puppet/type/dsc_securitysetting.rb deleted file mode 100644 index 28992797..00000000 --- a/lib/puppet/type/dsc_securitysetting.rb +++ /dev/null @@ -1,462 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_securitysetting) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SecuritySetting resource type. - Automatically generated from - 'SecurityPolicyDsc/DSCResources/MSFT_SecuritySetting/MSFT_SecuritySetting.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SecuritySetting' end - def dscmeta_resource_name; 'MSFT_SecuritySetting' end - def dscmeta_module_name; 'SecurityPolicyDsc' end - def dscmeta_module_version; '1.5.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: ["MinimumPasswordAge", "MaximumPasswordAge", "MinimumPasswordLength", "PasswordComplexity", "PasswordHistorySize", "LockoutBadCount", "ForceLogoffWhenHourExpire", "NewAdministratorName", "NewGuestName", "ClearTextPassword", "LSAAnonymousNameLookup", "EnableAdminAccount", "EnableGuestAccount", "ResetLockoutCount", "LockoutDuration", "MaxServiceAge", "MaxTicketAge", "MaxRenewAge", "MaxClockSkew", "TicketValidateClient"] - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - This is just here to avoid conflicts Valid values are MinimumPasswordAge, MaximumPasswordAge, MinimumPasswordLength, PasswordComplexity, PasswordHistorySize, LockoutBadCount, ForceLogoffWhenHourExpire, NewAdministratorName, NewGuestName, ClearTextPassword, LSAAnonymousNameLookup, EnableAdminAccount, EnableGuestAccount, ResetLockoutCount, LockoutDuration, MaxServiceAge, MaxTicketAge, MaxRenewAge, MaxClockSkew, TicketValidateClient." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['MinimumPasswordAge', 'minimumpasswordage', 'MaximumPasswordAge', 'maximumpasswordage', 'MinimumPasswordLength', 'minimumpasswordlength', 'PasswordComplexity', 'passwordcomplexity', 'PasswordHistorySize', 'passwordhistorysize', 'LockoutBadCount', 'lockoutbadcount', 'ForceLogoffWhenHourExpire', 'forcelogoffwhenhourexpire', 'NewAdministratorName', 'newadministratorname', 'NewGuestName', 'newguestname', 'ClearTextPassword', 'cleartextpassword', 'LSAAnonymousNameLookup', 'lsaanonymousnamelookup', 'EnableAdminAccount', 'enableadminaccount', 'EnableGuestAccount', 'enableguestaccount', 'ResetLockoutCount', 'resetlockoutcount', 'LockoutDuration', 'lockoutduration', 'MaxServiceAge', 'maxserviceage', 'MaxTicketAge', 'maxticketage', 'MaxRenewAge', 'maxrenewage', 'MaxClockSkew', 'maxclockskew', 'TicketValidateClient', 'ticketvalidateclient'].include?(value) - fail("Invalid value '#{value}'. Valid values are MinimumPasswordAge, MaximumPasswordAge, MinimumPasswordLength, PasswordComplexity, PasswordHistorySize, LockoutBadCount, ForceLogoffWhenHourExpire, NewAdministratorName, NewGuestName, ClearTextPassword, LSAAnonymousNameLookup, EnableAdminAccount, EnableGuestAccount, ResetLockoutCount, LockoutDuration, MaxServiceAge, MaxTicketAge, MaxRenewAge, MaxClockSkew, TicketValidateClient") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Desired state of resource. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: MinimumPasswordAge - # Type: sint16 - # IsMandatory: False - # Values: None - newparam(:dsc_minimumpasswordage) do - def mof_type; 'sint16' end - def mof_is_embedded?; false end - desc "MinimumPasswordAge" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MaximumPasswordAge - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_maximumpasswordage) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "MaximumPasswordAge" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MinimumPasswordLength - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_minimumpasswordlength) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "MinimumPasswordLength" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: PasswordComplexity - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_passwordcomplexity) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "PasswordComplexity" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: PasswordHistorySize - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_passwordhistorysize) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "PasswordHistorySize" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: LockoutBadCount - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_lockoutbadcount) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "LockoutBadCount" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ForceLogoffWhenHourExpire - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_forcelogoffwhenhourexpire) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "ForceLogoffWhenHourExpire" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: NewAdministratorName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_newadministratorname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "NewAdministratorName" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: NewGuestName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_newguestname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "NewGuestName" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ClearTextPassword - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_cleartextpassword) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "ClearTextPassword" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: LSAAnonymousNameLookup - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_lsaanonymousnamelookup) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "LSAAnonymousNameLookup" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: EnableAdminAccount - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_enableadminaccount) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "EnableAdminAccount" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: EnableGuestAccount - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_enableguestaccount) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "EnableGuestAccount" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ResetLockoutCount - # Type: sint16 - # IsMandatory: False - # Values: None - newparam(:dsc_resetlockoutcount) do - def mof_type; 'sint16' end - def mof_is_embedded?; false end - desc "ResetLockoutCount" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: LockoutDuration - # Type: sint16 - # IsMandatory: False - # Values: None - newparam(:dsc_lockoutduration) do - def mof_type; 'sint16' end - def mof_is_embedded?; false end - desc "LockoutDuration" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MaxServiceAge - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_maxserviceage) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "MaxServiceAge" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MaxTicketAge - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_maxticketage) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "MaxTicketAge" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MaxRenewAge - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_maxrenewage) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "MaxRenewAge" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MaxClockSkew - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_maxclockskew) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "MaxClockSkew" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: TicketValidateClient - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_ticketvalidateclient) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "TicketValidateClient" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_securitysetting).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_securitytemplate.rb b/lib/puppet/type/dsc_securitytemplate.rb deleted file mode 100644 index 2e22e0f7..00000000 --- a/lib/puppet/type/dsc_securitytemplate.rb +++ /dev/null @@ -1,103 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_securitytemplate) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SecurityTemplate resource type. - Automatically generated from - 'SecurityPolicyDsc/DSCResources/MSFT_SecurityTemplate/MSFT_SecurityTemplate.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_issingleinstance is a required attribute') if self[:dsc_issingleinstance].nil? - end - - def dscmeta_resource_friendly_name; 'SecurityTemplate' end - def dscmeta_resource_name; 'MSFT_SecurityTemplate' end - def dscmeta_module_name; 'SecurityPolicyDsc' end - def dscmeta_module_version; '1.5.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: IsSingleInstance - # Type: string - # IsMandatory: True - # Values: ["Yes"] - newparam(:dsc_issingleinstance) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes' Valid values are Yes." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Yes', 'yes'].include?(value) - fail("Invalid value '#{value}'. Valid values are Yes") - end - end - end - - # Name: Path - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_path) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Path - The path to the desired security policy template (.inf)" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_securitytemplate).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_smavariable.rb b/lib/puppet/type/dsc_smavariable.rb deleted file mode 100644 index 0a37b4c2..00000000 --- a/lib/puppet/type/dsc_smavariable.rb +++ /dev/null @@ -1,186 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_smavariable) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SmaVariable resource type. - Automatically generated from - 'xSCSMA/DSCResources/MSFT_xSmaVariable/MSFT_xSmaVariable.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - fail('dsc_webserviceendpoint is a required attribute') if self[:dsc_webserviceendpoint].nil? - end - - def dscmeta_resource_friendly_name; 'SmaVariable' end - def dscmeta_resource_name; 'MSFT_xSmaVariable' end - def dscmeta_module_name; 'xSCSMA' end - def dscmeta_module_version; '1.5.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Desired state of SMA variable Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Name of SMA variable." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: value - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_value) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "value - Value of SMA variable." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Description - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_description) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Description - Description of SMA variable." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Set - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_set) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Set - Set is true if existing SMA variable matches configuration." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: WebServiceEndpoint - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_webserviceendpoint) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WebServiceEndpoint - Web service endpoint of SMA instance." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Port - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_port) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "Port - Port to reach the web service endpoint. Defaults to the SMA default of 9090." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_smavariable).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spaccessserviceapp.rb b/lib/puppet/type/dsc_spaccessserviceapp.rb deleted file mode 100644 index 59d122bb..00000000 --- a/lib/puppet/type/dsc_spaccessserviceapp.rb +++ /dev/null @@ -1,151 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spaccessserviceapp) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPAccessServiceApp resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPAccessServiceApp/MSFT_SPAccessServiceApp.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPAccessServiceApp' end - def dscmeta_resource_name; 'MSFT_SPAccessServiceApp' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the service application" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ApplicationPool - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_applicationpool) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ApplicationPool - The name of the application pool to run the service app in" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databaseserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseServer - The name of the database server to host Access Services databases" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present ensures service app exists, absent ensures it is removed Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spaccessserviceapp).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spaccessservices2010.rb b/lib/puppet/type/dsc_spaccessservices2010.rb deleted file mode 100644 index 4e0b24f4..00000000 --- a/lib/puppet/type/dsc_spaccessservices2010.rb +++ /dev/null @@ -1,136 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spaccessservices2010) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPAccessServices2010 resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPAccessServices2010/MSFT_SPAccessServices2010.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPAccessServices2010' end - def dscmeta_resource_name; 'MSFT_SPAccessServices2010' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the service application" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ApplicationPool - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_applicationpool) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ApplicationPool - The name of the application pool to run the service app in" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present ensures service app exists, absent ensures it is removed Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run thsi resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spaccessservices2010).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spalternateurl.rb b/lib/puppet/type/dsc_spalternateurl.rb deleted file mode 100644 index e0869a33..00000000 --- a/lib/puppet/type/dsc_spalternateurl.rb +++ /dev/null @@ -1,156 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spalternateurl) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPAlternateUrl resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPAlternateUrl/MSFT_SPAlternateUrl.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_webappurl is a required attribute') if self[:dsc_webappurl].nil? - fail('dsc_zone is a required attribute') if self[:dsc_zone].nil? - end - - def dscmeta_resource_friendly_name; 'SPAlternateUrl' end - def dscmeta_resource_name; 'MSFT_SPAlternateUrl' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: WebAppUrl - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_webappurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WebAppUrl - The URL of the web application to apply the alternate URL to" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Zone - # Type: string - # IsMandatory: True - # Values: ["Default", "Intranet", "Extranet", "Custom", "Internet"] - newparam(:dsc_zone) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Zone - The Zone to use for the alternate URL Valid values are Default, Intranet, Extranet, Custom, Internet." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Default', 'default', 'Intranet', 'intranet', 'Extranet', 'extranet', 'Custom', 'custom', 'Internet', 'internet'].include?(value) - fail("Invalid value '#{value}'. Valid values are Default, Intranet, Extranet, Custom, Internet") - end - end - end - - # Name: Url - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_url) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Url - The new alternate URL" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present ensures the URL is set for this zone on this web app, Absent ensures it is removed Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spalternateurl).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spantivirussettings.rb b/lib/puppet/type/dsc_spantivirussettings.rb deleted file mode 100644 index 96b47cb5..00000000 --- a/lib/puppet/type/dsc_spantivirussettings.rb +++ /dev/null @@ -1,186 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spantivirussettings) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPAntivirusSettings resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPAntivirusSettings/MSFT_SPAntivirusSettings.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_scanondownload is a required attribute') if self[:dsc_scanondownload].nil? - end - - def dscmeta_resource_friendly_name; 'SPAntivirusSettings' end - def dscmeta_resource_name; 'MSFT_SPAntivirusSettings' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: ScanOnDownload - # Type: boolean - # IsMandatory: True - # Values: None - newparam(:dsc_scanondownload) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ScanOnDownload - Should documents be scanned before being downloaded" - isrequired - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ScanOnUpload - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_scanonupload) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ScanOnUpload - Should documents be scanned on upload" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AllowDownloadInfected - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowdownloadinfected) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowDownloadInfected - Should documents that are infected be allowed to be downloaded" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AttemptToClean - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_attempttoclean) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AttemptToClean - Should infected documents be handed to the AV engine to attempt cleaning" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: TimeoutDuration - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_timeoutduration) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "TimeoutDuration - What is the timeout for an AV scan in seconds" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: NumberOfThreads - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_numberofthreads) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "NumberOfThreads - How many concurrent threads should the AV engine be able to run on a server" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spantivirussettings).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spappcatalog.rb b/lib/puppet/type/dsc_spappcatalog.rb deleted file mode 100644 index a035b83a..00000000 --- a/lib/puppet/type/dsc_spappcatalog.rb +++ /dev/null @@ -1,101 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spappcatalog) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPAppCatalog resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPAppCatalog/MSFT_SPAppCatalog.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_siteurl is a required attribute') if self[:dsc_siteurl].nil? - end - - def dscmeta_resource_friendly_name; 'SPAppCatalog' end - def dscmeta_resource_name; 'MSFT_SPAppCatalog' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: SiteUrl - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_siteurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SiteUrl - The URL of the site collection that will be the app catalog for the web app that it is in" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spappcatalog).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spappdomain.rb b/lib/puppet/type/dsc_spappdomain.rb deleted file mode 100644 index 95746ab8..00000000 --- a/lib/puppet/type/dsc_spappdomain.rb +++ /dev/null @@ -1,116 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spappdomain) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPAppDomain resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPAppDomain/MSFT_SPAppDomain.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_appdomain is a required attribute') if self[:dsc_appdomain].nil? - end - - def dscmeta_resource_friendly_name; 'SPAppDomain' end - def dscmeta_resource_name; 'MSFT_SPAppDomain' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: AppDomain - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_appdomain) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AppDomain - The domain name for apps to use in this farm" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Prefix - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_prefix) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Prefix - The prefix to go on to app URLs" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spappdomain).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spappmanagementserviceapp.rb b/lib/puppet/type/dsc_spappmanagementserviceapp.rb deleted file mode 100644 index e6bd6b2a..00000000 --- a/lib/puppet/type/dsc_spappmanagementserviceapp.rb +++ /dev/null @@ -1,181 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spappmanagementserviceapp) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPAppManagementServiceApp resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPAppManagementServiceApp/MSFT_SPAppManagementServiceApp.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPAppManagementServiceApp' end - def dscmeta_resource_name; 'MSFT_SPAppManagementServiceApp' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the app management service application" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ProxyName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_proxyname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProxyName - The proxy name, if not specified will be /Name of service app/ Proxy" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ApplicationPool - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_applicationpool) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ApplicationPool - The app pool that should be used to run the service app" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databasename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseName - The name of the database for the service application" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databaseserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseServer - The name of the server for the database" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present ensures service app exists, absent ensures it is removed Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spappmanagementserviceapp).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spappstoresettings.rb b/lib/puppet/type/dsc_spappstoresettings.rb deleted file mode 100644 index 3ed57b38..00000000 --- a/lib/puppet/type/dsc_spappstoresettings.rb +++ /dev/null @@ -1,133 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spappstoresettings) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPAppStoreSettings resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPAppStoreSettings/MSFT_SPAppStoreSettings.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_webappurl is a required attribute') if self[:dsc_webappurl].nil? - end - - def dscmeta_resource_friendly_name; 'SPAppStoreSettings' end - def dscmeta_resource_name; 'MSFT_SPAppStoreSettings' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: WebAppUrl - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_webappurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WebAppUrl - The URL of the web application" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AllowAppPurchases - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowapppurchases) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowAppPurchases - Specifies if App Purchases from the SharePoint Store are allowed" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AllowAppsForOffice - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowappsforoffice) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowAppsForOffice - Specifies if App Purchases for Office applications are allowed" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spappstoresettings).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spbcsserviceapp.rb b/lib/puppet/type/dsc_spbcsserviceapp.rb deleted file mode 100644 index 80d57e37..00000000 --- a/lib/puppet/type/dsc_spbcsserviceapp.rb +++ /dev/null @@ -1,166 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spbcsserviceapp) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPBCSServiceApp resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPBCSServiceApp/MSFT_SPBCSServiceApp.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPBCSServiceApp' end - def dscmeta_resource_name; 'MSFT_SPBCSServiceApp' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the BCS service app" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ApplicationPool - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_applicationpool) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ApplicationPool - The application pool it should run in" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databasename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseName - Name of the database to create for the service app" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databaseserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseServer - Name of the database server to host the database on" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present ensures service app exists, absent ensures it is removed Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spbcsserviceapp).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spblobcachesettings.rb b/lib/puppet/type/dsc_spblobcachesettings.rb deleted file mode 100644 index 45ea2e90..00000000 --- a/lib/puppet/type/dsc_spblobcachesettings.rb +++ /dev/null @@ -1,203 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spblobcachesettings) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPBlobCacheSettings resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPBlobCacheSettings/MSFT_SPBlobCacheSettings.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_webappurl is a required attribute') if self[:dsc_webappurl].nil? - fail('dsc_zone is a required attribute') if self[:dsc_zone].nil? - end - - def dscmeta_resource_friendly_name; 'SPBlobCacheSettings' end - def dscmeta_resource_name; 'MSFT_SPBlobCacheSettings' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: WebAppUrl - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_webappurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WebAppUrl - The URL of the web application" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Zone - # Type: string - # IsMandatory: True - # Values: ["Default", "Intranet", "Internet", "Custom", "Extranet"] - newparam(:dsc_zone) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Zone - The zone of the web application for which blob cache has to be configured Valid values are Default, Intranet, Internet, Custom, Extranet." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Default', 'default', 'Intranet', 'intranet', 'Internet', 'internet', 'Custom', 'custom', 'Extranet', 'extranet'].include?(value) - fail("Invalid value '#{value}'. Valid values are Default, Intranet, Internet, Custom, Extranet") - end - end - end - - # Name: EnableCache - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_enablecache) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "EnableCache - Specify if the blob cache has to be enabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Location - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_location) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Location - The location where the blob cache has to store its files" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MaxSizeInGB - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_maxsizeingb) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "MaxSizeInGB - The maximum size (in GB) of disk space the blob cache is allowed to use" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MaxAgeInSeconds - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_maxageinseconds) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "MaxAgeInSeconds - The maximum age (in seconds) that a browser caches a blob" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: FileTypes - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_filetypes) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FileTypes - Specify the file types that must be stored by the blob cache" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spblobcachesettings).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spcacheaccounts.rb b/lib/puppet/type/dsc_spcacheaccounts.rb deleted file mode 100644 index 6d6a2cd7..00000000 --- a/lib/puppet/type/dsc_spcacheaccounts.rb +++ /dev/null @@ -1,147 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spcacheaccounts) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPCacheAccounts resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPCacheAccounts/MSFT_SPCacheAccounts.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_webappurl is a required attribute') if self[:dsc_webappurl].nil? - end - - def dscmeta_resource_friendly_name; 'SPCacheAccounts' end - def dscmeta_resource_name; 'MSFT_SPCacheAccounts' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: WebAppUrl - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_webappurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WebAppUrl - The URL of the web application to set the accounts for" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SuperUserAlias - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_superuseralias) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SuperUserAlias - The account name for the super user" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SuperReaderAlias - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_superreaderalias) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SuperReaderAlias - The account name for the super reader" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SetWebAppPolicy - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_setwebapppolicy) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "SetWebAppPolicy - Should the web app policy be set for these accounts?" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spcacheaccounts).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spconfigwizard.rb b/lib/puppet/type/dsc_spconfigwizard.rb deleted file mode 100644 index c84bd3f2..00000000 --- a/lib/puppet/type/dsc_spconfigwizard.rb +++ /dev/null @@ -1,149 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spconfigwizard) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPConfigWizard resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPConfigWizard/MSFT_SPConfigWizard.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_ensure is a required attribute') if self[:dsc_ensure].nil? - end - - def dscmeta_resource_friendly_name; 'SPConfigWizard' end - def dscmeta_resource_name; 'MSFT_SPConfigWizard' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: True - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present to install SharePoint. Absent is currently not supported Valid values are Present, Absent." - isrequired - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: DatabaseUpgradeDays - # Type: string[] - # IsMandatory: False - # Values: ["mon", "tue", "wed", "thu", "fri", "sat", "sun"] - newparam(:dsc_databaseupgradedays, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "DatabaseUpgradeDays - Specify on which dates running the Configuration Wizard is allowed Valid values are mon, tue, wed, thu, fri, sat, sun." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - if value.kind_of?(Array) - unless (['mon', 'mon', 'tue', 'tue', 'wed', 'wed', 'thu', 'thu', 'fri', 'fri', 'sat', 'sat', 'sun', 'sun'] & value).count == value.count - fail("Invalid value #{value}. Valid values are mon, tue, wed, thu, fri, sat, sun") - end - end - if value.kind_of?(String) - unless ['mon', 'mon', 'tue', 'tue', 'wed', 'wed', 'thu', 'thu', 'fri', 'fri', 'sat', 'sat', 'sun', 'sun'].include?(value) - fail("Invalid value #{value}. Valid values are mon, tue, wed, thu, fri, sat, sun") - end - end - end - munge do |value| - Array(value) - end - end - - # Name: DatabaseUpgradeTime - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databaseupgradetime) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseUpgradeTime - Specify in which time frame running the Configuration Wizard is allowed" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spconfigwizard).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spcontentdatabase.rb b/lib/puppet/type/dsc_spcontentdatabase.rb deleted file mode 100644 index 81240235..00000000 --- a/lib/puppet/type/dsc_spcontentdatabase.rb +++ /dev/null @@ -1,203 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spcontentdatabase) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPContentDatabase resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPContentDatabase/MSFT_SPContentDatabase.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPContentDatabase' end - def dscmeta_resource_name; 'MSFT_SPContentDatabase' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Specifies the name of the content database" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databaseserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseServer - The name of the database server to host the content DB" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: WebAppUrl - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_webappurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WebAppUrl - The URL of the web application" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Enabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_enabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Enabled - Should the database be enabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: WarningSiteCount - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_warningsitecount) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "WarningSiteCount - Specify the site collection warning limit for the content database" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MaximumSiteCount - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_maximumsitecount) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "MaximumSiteCount - Specify the site collection maximum limit for the content database" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present to create this database, absent to ensure it does not exist Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spcontentdatabase).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spcreatefarm.rb b/lib/puppet/type/dsc_spcreatefarm.rb deleted file mode 100644 index 4e35ed90..00000000 --- a/lib/puppet/type/dsc_spcreatefarm.rb +++ /dev/null @@ -1,219 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spcreatefarm) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPCreateFarm resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPCreateFarm/MSFT_SPCreateFarm.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_farmconfigdatabasename is a required attribute') if self[:dsc_farmconfigdatabasename].nil? - fail('dsc_databaseserver is a required attribute') if self[:dsc_databaseserver].nil? - end - - def dscmeta_resource_friendly_name; 'SPCreateFarm' end - def dscmeta_resource_name; 'MSFT_SPCreateFarm' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: FarmConfigDatabaseName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_farmconfigdatabasename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FarmConfigDatabaseName - Name of the configuration database" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseServer - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_databaseserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseServer - Server that will host the configuration and admin content databases" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: FarmAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_farmaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "FarmAccount - The account to use as the main farm account" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("FarmAccount", value) - end - end - - # Name: Passphrase - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_passphrase) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Passphrase - The passphrase to use to allow servers to join this farm" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Passphrase", value) - end - end - - # Name: AdminContentDatabaseName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_admincontentdatabasename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AdminContentDatabaseName - The name of the admin content database" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CentralAdministrationPort - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_centraladministrationport) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "CentralAdministrationPort - What port will Central Admin be provisioned to - default is 9999" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: CentralAdministrationAuth - # Type: string - # IsMandatory: False - # Values: ["NTLM", "Kerberos"] - newparam(:dsc_centraladministrationauth) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CentralAdministrationAuth - The authentication provider of the CentralAdministration web application Valid values are NTLM, Kerberos." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['NTLM', 'ntlm', 'Kerberos', 'kerberos'].include?(value) - fail("Invalid value '#{value}'. Valid values are NTLM, Kerberos") - end - end - end - - # Name: ServerRole - # Type: string - # IsMandatory: False - # Values: ["Application", "ApplicationWithSearch", "Custom", "DistributedCache", "Search", "SingleServer", "SingleServerFarm", "WebFrontEnd", "WebFrontEndWithDistributedCache"] - newparam(:dsc_serverrole) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServerRole - SharePoint 2016 only - the MinRole role to enroll this server as Valid values are Application, ApplicationWithSearch, Custom, DistributedCache, Search, SingleServer, SingleServerFarm, WebFrontEnd, WebFrontEndWithDistributedCache." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Application', 'application', 'ApplicationWithSearch', 'applicationwithsearch', 'Custom', 'custom', 'DistributedCache', 'distributedcache', 'Search', 'search', 'SingleServer', 'singleserver', 'SingleServerFarm', 'singleserverfarm', 'WebFrontEnd', 'webfrontend', 'WebFrontEndWithDistributedCache', 'webfrontendwithdistributedcache'].include?(value) - fail("Invalid value '#{value}'. Valid values are Application, ApplicationWithSearch, Custom, DistributedCache, Search, SingleServer, SingleServerFarm, WebFrontEnd, WebFrontEndWithDistributedCache") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spcreatefarm).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spdatabaseaag.rb b/lib/puppet/type/dsc_spdatabaseaag.rb deleted file mode 100644 index ce677ff2..00000000 --- a/lib/puppet/type/dsc_spdatabaseaag.rb +++ /dev/null @@ -1,151 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spdatabaseaag) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPDatabaseAAG resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPDatabaseAAG/MSFT_SPDatabaseAAG.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_databasename is a required attribute') if self[:dsc_databasename].nil? - end - - def dscmeta_resource_friendly_name; 'SPDatabaseAAG' end - def dscmeta_resource_name; 'MSFT_SPDatabaseAAG' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: DatabaseName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_databasename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseName - The name of the database to put in the AlwaysOn group" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AGName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_agname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AGName - Name of the AlwaysOn group on the SQL server - this must already exist" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: FileShare - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_fileshare) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FileShare - The fileshare to use for the SQL backup when adding to the group" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present if the database should be in this AlwaysOn group, or Absent if it should not be in the group Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spdatabaseaag).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spdesignersettings.rb b/lib/puppet/type/dsc_spdesignersettings.rb deleted file mode 100644 index a8b86a33..00000000 --- a/lib/puppet/type/dsc_spdesignersettings.rb +++ /dev/null @@ -1,231 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spdesignersettings) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPDesignerSettings resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPDesignerSettings/MSFT_SPDesignerSettings.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_url is a required attribute') if self[:dsc_url].nil? - end - - def dscmeta_resource_friendly_name; 'SPDesignerSettings' end - def dscmeta_resource_name; 'MSFT_SPDesignerSettings' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Url - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_url) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Url - The URL of the web application or site collection to configure" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SettingsScope - # Type: string - # IsMandatory: False - # Values: ["WebApplication", "SiteCollection"] - newparam(:dsc_settingsscope) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SettingsScope - Define the scope of the configuration - either WebApplication or SiteCollection Valid values are WebApplication, SiteCollection." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['WebApplication', 'webapplication', 'SiteCollection', 'sitecollection'].include?(value) - fail("Invalid value '#{value}'. Valid values are WebApplication, SiteCollection") - end - end - end - - # Name: AllowSharePointDesigner - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowsharepointdesigner) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowSharePointDesigner - Allow the use of SharePoint Designer" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AllowDetachPagesFromDefinition - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowdetachpagesfromdefinition) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowDetachPagesFromDefinition - Allow pages to be un-ghosted by SharePoint Designer" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AllowCustomiseMasterPage - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowcustomisemasterpage) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowCustomiseMasterPage - Allow masterpages to be changed by SharePoint Designer" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AllowManageSiteURLStructure - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowmanagesiteurlstructure) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowManageSiteURLStructure - Allow site URL structure to be changed by SharePoint Designer" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AllowCreateDeclarativeWorkflow - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowcreatedeclarativeworkflow) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowCreateDeclarativeWorkflow - Allow users to create declarative workflows with SharePoint Designer" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AllowSavePublishDeclarativeWorkflow - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowsavepublishdeclarativeworkflow) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowSavePublishDeclarativeWorkflow - Allow users to save and re-publish declarative workflows with SharePoint Designer" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AllowSaveDeclarativeWorkflowAsTemplate - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowsavedeclarativeworkflowastemplate) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowSaveDeclarativeWorkflowAsTemplate - Allow users to save declarative workflows as a template from SharePoint Designer" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spdesignersettings).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spdiagnosticloggingsettings.rb b/lib/puppet/type/dsc_spdiagnosticloggingsettings.rb deleted file mode 100644 index cf3b98b6..00000000 --- a/lib/puppet/type/dsc_spdiagnosticloggingsettings.rb +++ /dev/null @@ -1,389 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spdiagnosticloggingsettings) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPDiagnosticLoggingSettings resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPDiagnosticLoggingSettings/MSFT_SPDiagnosticLoggingSettings.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_logpath is a required attribute') if self[:dsc_logpath].nil? - end - - def dscmeta_resource_friendly_name; 'SPDiagnosticLoggingSettings' end - def dscmeta_resource_name; 'MSFT_SPDiagnosticLoggingSettings' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: LogPath - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_logpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogPath - The physical path on each server to store ULS logs" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: LogSpaceInGB - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_logspaceingb) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "LogSpaceInGB - The space in GB that should be used to store ULS logs" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: AppAnalyticsAutomaticUploadEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_appanalyticsautomaticuploadenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AppAnalyticsAutomaticUploadEnabled - Should app analytics automatically be uploaded" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: CustomerExperienceImprovementProgramEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_customerexperienceimprovementprogramenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "CustomerExperienceImprovementProgramEnabled - Should the customer experience program be enabled in this farm" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DaysToKeepLogs - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_daystokeeplogs) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "DaysToKeepLogs - How many days should ULS logs be kept for" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: DownloadErrorReportingUpdatesEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_downloaderrorreportingupdatesenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DownloadErrorReportingUpdatesEnabled - Should updates to error reporting tools be automatically downloaded" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ErrorReportingAutomaticUploadEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_errorreportingautomaticuploadenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ErrorReportingAutomaticUploadEnabled - Should error reports be automatically uploaded" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ErrorReportingEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_errorreportingenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ErrorReportingEnabled - Should reporting of errors be enabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: EventLogFloodProtectionEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_eventlogfloodprotectionenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "EventLogFloodProtectionEnabled - Protect event logs with Event Log Flood Protection" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: EventLogFloodProtectionNotifyInterval - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_eventlogfloodprotectionnotifyinterval) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "EventLogFloodProtectionNotifyInterval - What interval should the event logs report a flood event" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: EventLogFloodProtectionQuietPeriod - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_eventlogfloodprotectionquietperiod) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "EventLogFloodProtectionQuietPeriod - What quiet period should reset the event log flood protection thresholds" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: EventLogFloodProtectionThreshold - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_eventlogfloodprotectionthreshold) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "EventLogFloodProtectionThreshold - What is the event log flood protection threshold" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: EventLogFloodProtectionTriggerPeriod - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_eventlogfloodprotectiontriggerperiod) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "EventLogFloodProtectionTriggerPeriod - What is the time period that will trigger event log flood protection" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: LogCutInterval - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_logcutinterval) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "LogCutInterval - How many minutes of activity will a ULS log file leep in an individual file" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: LogMaxDiskSpaceUsageEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_logmaxdiskspaceusageenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "LogMaxDiskSpaceUsageEnabled - Will the maximum disk space setting be enabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ScriptErrorReportingDelay - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_scripterrorreportingdelay) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "ScriptErrorReportingDelay - What delay will be set before script error reporting is triggered" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ScriptErrorReportingEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_scripterrorreportingenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ScriptErrorReportingEnabled - Is script error reporting enabled in this farm" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ScriptErrorReportingRequireAuth - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_scripterrorreportingrequireauth) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ScriptErrorReportingRequireAuth - Require users to be authenticated to allow script errors to be reported" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spdiagnosticloggingsettings).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spdistributedcacheservice.rb b/lib/puppet/type/dsc_spdistributedcacheservice.rb deleted file mode 100644 index d3b7197d..00000000 --- a/lib/puppet/type/dsc_spdistributedcacheservice.rb +++ /dev/null @@ -1,188 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spdistributedcacheservice) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPDistributedCacheService resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPDistributedCacheService/MSFT_SPDistributedCacheService.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPDistributedCacheService' end - def dscmeta_resource_name; 'MSFT_SPDistributedCacheService' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - A name to assign to this resource - not really used. For example - AppFabricCachingService" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present to ensure the current server should be running distributed cache, absent to ensure that it isn't running Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: CacheSizeInMB - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_cachesizeinmb) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "CacheSizeInMB - How many MB should be used for the cache. The maximum supported is 16384" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ServiceAccount - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_serviceaccount) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServiceAccount - The name of the service account to run the service as. This should already be registered as a managed account in SharePoint" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ServerProvisionOrder - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_serverprovisionorder, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ServerProvisionOrder - A list of servers which specifies the order they should provision the cache in to ensure that two servers do not do it at the same time" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: CreateFirewallRules - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_createfirewallrules) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "CreateFirewallRules - Should the Windows Firewall rules for distributed cache be created?" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spdistributedcacheservice).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spexcelserviceapp.rb b/lib/puppet/type/dsc_spexcelserviceapp.rb deleted file mode 100644 index dc97db81..00000000 --- a/lib/puppet/type/dsc_spexcelserviceapp.rb +++ /dev/null @@ -1,463 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spexcelserviceapp) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - class PuppetX::Dsc::TypeHelpers - def self.validate_MSFT_SPExcelFileLocation(mof_type_map, name, value) - required = ['locationtype'] - allowed = ['address','abortonrefreshonopenfail','automaticvolatilefunctioncachelifetime','chartandimagesizemax','concurrentdatarequestspersessionmax','defaultworkbookcalcmode','description','displaygranularextdataerrors','externaldataallowed','includechildren','manualextdatacachelifetime','newworkbooksessiontimeout','periodicextdatacachelifetime','requestdurationmax','restexternaldataallowed','sessiontimeout','shortsessiontimeout','udfsallowed','warnondatarefresh','workbooksizemax'] - lowkey_hash = Hash[value.map { |k, v| [k.to_s.downcase, v] }] - - missing = required - lowkey_hash.keys - unless missing.empty? - fail "#{name} is missing the following required keys: #{missing.join(',')}" - end - - extraneous = lowkey_hash.keys - required - allowed - unless extraneous.empty? - fail "#{name} includes invalid keys: #{extraneous.join(',')}" - end - - lowkey_hash.keys.each do |key| - if lowkey_hash[key] - validate_mof_type(mof_type_map[key], 'MSFT_SPExcelFileLocation', key, lowkey_hash[key]) - end - end - end - end - - @doc = %q{ - The DSC SPExcelServiceApp resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPExcelServiceApp/MSFT_SPExcelServiceApp.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPExcelServiceApp' end - def dscmeta_resource_name; 'MSFT_SPExcelServiceApp' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the service application" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ApplicationPool - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_applicationpool) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ApplicationPool - The name of the application pool to run the service app in" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: TrustedFileLocations - # Type: MSFT_SPExcelFileLocation[] - # IsMandatory: False - # Values: None - newparam(:dsc_trustedfilelocations, :array_matching => :all) do - def mof_type; 'MSFT_SPExcelFileLocation[]' end - def mof_is_embedded?; true end - def mof_type_map - {"address"=>{:type=>"string"}, "locationtype"=>{:type=>"string", :values=>["SharePoint", "UNC", "HTTP"]}, "abortonrefreshonopenfail"=>{:type=>"boolean"}, "automaticvolatilefunctioncachelifetime"=>{:type=>"uint32"}, "chartandimagesizemax"=>{:type=>"uint32"}, "concurrentdatarequestspersessionmax"=>{:type=>"uint32"}, "defaultworkbookcalcmode"=>{:type=>"string", :values=>["File", "Manual", "Auto", "AutoDataTables"]}, "description"=>{:type=>"string"}, "displaygranularextdataerrors"=>{:type=>"boolean"}, "externaldataallowed"=>{:type=>"string", :values=>["None", "Dcl", "DclandEmbedded"]}, "includechildren"=>{:type=>"boolean"}, "manualextdatacachelifetime"=>{:type=>"uint32"}, "newworkbooksessiontimeout"=>{:type=>"uint32"}, "periodicextdatacachelifetime"=>{:type=>"uint32"}, "requestdurationmax"=>{:type=>"uint32"}, "restexternaldataallowed"=>{:type=>"boolean"}, "sessiontimeout"=>{:type=>"uint32"}, "shortsessiontimeout"=>{:type=>"uint32"}, "udfsallowed"=>{:type=>"boolean"}, "warnondatarefresh"=>{:type=>"boolean"}, "workbooksizemax"=>{:type=>"uint32"}} - end - desc "TrustedFileLocations - Trusted file locations for the service app" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be an array of hashes or a hash") - end - (value.kind_of?(Hash) ? [value] : value).each_with_index do |v, i| - fail "TrustedFileLocations value at index #{i} should be a Hash" unless v.is_a? Hash - - PuppetX::Dsc::TypeHelpers.validate_MSFT_SPExcelFileLocation(mof_type_map, "TrustedFileLocations", v) - end - end - munge do |value| - value.kind_of?(Hash) ? - [PuppetX::Dsc::TypeHelpers.munge_embeddedinstance(mof_type_map, value)] : - value.map { |v| PuppetX::Dsc::TypeHelpers.munge_embeddedinstance(mof_type_map, v) } - end - end - - # Name: CachingOfUnusedFilesEnable - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_cachingofunusedfilesenable) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "CachingOfUnusedFilesEnable - Specifies that files that are no longer used by Excel Services Application can remain in the cache for later use." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: CrossDomainAccessAllowed - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_crossdomainaccessallowed) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "CrossDomainAccessAllowed - Specifies that trusted workbooks and data connection files can be requested and rendered by Web Parts or pages that reside in other HTTP domains." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: EncryptedUserConnectionRequired - # Type: string - # IsMandatory: False - # Values: ["None", "Connection"] - newparam(:dsc_encrypteduserconnectionrequired) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "EncryptedUserConnectionRequired - Requires that encryption is used between the end-user and the server running Excel Services Application. Valid values are None, Connection." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['None', 'none', 'Connection', 'connection'].include?(value) - fail("Invalid value '#{value}'. Valid values are None, Connection") - end - end - end - - # Name: ExternalDataConnectionLifetime - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_externaldataconnectionlifetime) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "ExternalDataConnectionLifetime - Specifies the maximum number of seconds that an external data connection can remain open in the connection pool." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: FileAccessMethod - # Type: string - # IsMandatory: False - # Values: ["UseImpersonation", "UseFileAccessAccount"] - newparam(:dsc_fileaccessmethod) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FileAccessMethod - Specifies the authentication method that Excel Services Application uses to retrieve files. Valid values are UseImpersonation, UseFileAccessAccount." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['UseImpersonation', 'useimpersonation', 'UseFileAccessAccount', 'usefileaccessaccount'].include?(value) - fail("Invalid value '#{value}'. Valid values are UseImpersonation, UseFileAccessAccount") - end - end - end - - # Name: LoadBalancingScheme - # Type: string - # IsMandatory: False - # Values: ["RoundRobin", "Local", "WorkbookURL"] - newparam(:dsc_loadbalancingscheme) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LoadBalancingScheme - Specifies the load-balancing schema that is used by the Excel Services Application Web service application to send requests to different back-end Excel Services Application computers. Valid values are RoundRobin, Local, WorkbookURL." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['RoundRobin', 'roundrobin', 'Local', 'local', 'WorkbookURL', 'workbookurl'].include?(value) - fail("Invalid value '#{value}'. Valid values are RoundRobin, Local, WorkbookURL") - end - end - end - - # Name: MemoryCacheThreshold - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_memorycachethreshold) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "MemoryCacheThreshold - Specifies the percentage of the maximum private bytes that can be allocated to inactive objects." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: PrivateBytesMax - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_privatebytesmax) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "PrivateBytesMax - Specifies the maximum private bytes, in megabytes, that are used by Excel Services Application." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: SessionsPerUserMax - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_sessionsperusermax) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "SessionsPerUserMax - Specifies the maximum number of sessions allowed for a user." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: SiteCollectionAnonymousSessionsMax - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_sitecollectionanonymoussessionsmax) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "SiteCollectionAnonymousSessionsMax - Specifies the maximum number of anonymous sessions allowed per site collection." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: TerminateProcessOnAccessViolation - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_terminateprocessonaccessviolation) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "TerminateProcessOnAccessViolation - Terminates Excel Services Application when an access violation occurs in the process." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ThrottleAccessViolationsPerSiteCollection - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_throttleaccessviolationspersitecollection) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "ThrottleAccessViolationsPerSiteCollection - Specifies that if a workbook causes an access violation error on Excel Services Application, all files originating from that workbook's site collection are blocked from loading for the specified period (in seconds)." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: UnattendedAccountApplicationId - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_unattendedaccountapplicationid) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UnattendedAccountApplicationId - Specifies that the application ID that is used to look up the unattended service account credentials from the secure storage service that is specified by the UnattendedAccountSecureServiceAppName parameter." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UnusedObjectAgeMax - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_unusedobjectagemax) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "UnusedObjectAgeMax - Specifies the maximum amount of time, in minutes, that objects not currently used in a session are kept in the memory cache." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: WorkbookCache - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_workbookcache) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WorkbookCache - Specifies the local file system location of the cache that is used to store workbooks that are used by Excel Services Application." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: WorkbookCacheSizeMax - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_workbookcachesizemax) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "WorkbookCacheSizeMax - Specifies the maximum allowable size, in megabytes, of an individual session." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present ensures service app exists, absent ensures it is removed Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spexcelserviceapp).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spfarm.rb b/lib/puppet/type/dsc_spfarm.rb deleted file mode 100644 index 88967488..00000000 --- a/lib/puppet/type/dsc_spfarm.rb +++ /dev/null @@ -1,253 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spfarm) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPFarm resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_ensure is a required attribute') if self[:dsc_ensure].nil? - end - - def dscmeta_resource_friendly_name; 'SPFarm' end - def dscmeta_resource_name; 'MSFT_SPFarm' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: True - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present to create/join the farm. Absent is currently not supported Valid values are Present, Absent." - isrequired - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: FarmConfigDatabaseName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_farmconfigdatabasename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FarmConfigDatabaseName - Name of the configuration database" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databaseserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseServer - Server that will host the configuration and admin content databases" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: FarmAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_farmaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "FarmAccount - The account to use as the main farm account" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("FarmAccount", value) - end - end - - # Name: Passphrase - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_passphrase) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Passphrase - The passphrase to use to allow servers to join this farm" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Passphrase", value) - end - end - - # Name: AdminContentDatabaseName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_admincontentdatabasename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AdminContentDatabaseName - The name of the admin content database" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RunCentralAdmin - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_runcentraladmin) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RunCentralAdmin - Should the central admin site run on this specific server?" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: CentralAdministrationPort - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_centraladministrationport) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "CentralAdministrationPort - What port will Central Admin be provisioned to - default is 9999" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: CentralAdministrationAuth - # Type: string - # IsMandatory: False - # Values: ["NTLM", "Kerberos"] - newparam(:dsc_centraladministrationauth) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CentralAdministrationAuth - The authentication provider of the CentralAdministration web application Valid values are NTLM, Kerberos." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['NTLM', 'ntlm', 'Kerberos', 'kerberos'].include?(value) - fail("Invalid value '#{value}'. Valid values are NTLM, Kerberos") - end - end - end - - # Name: ServerRole - # Type: string - # IsMandatory: False - # Values: ["Application", "ApplicationWithSearch", "Custom", "DistributedCache", "Search", "SingleServer", "SingleServerFarm", "WebFrontEnd", "WebFrontEndWithDistributedCache"] - newparam(:dsc_serverrole) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServerRole - SharePoint 2016 only - the MinRole role to enroll this server as Valid values are Application, ApplicationWithSearch, Custom, DistributedCache, Search, SingleServer, SingleServerFarm, WebFrontEnd, WebFrontEndWithDistributedCache." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Application', 'application', 'ApplicationWithSearch', 'applicationwithsearch', 'Custom', 'custom', 'DistributedCache', 'distributedcache', 'Search', 'search', 'SingleServer', 'singleserver', 'SingleServerFarm', 'singleserverfarm', 'WebFrontEnd', 'webfrontend', 'WebFrontEndWithDistributedCache', 'webfrontendwithdistributedcache'].include?(value) - fail("Invalid value '#{value}'. Valid values are Application, ApplicationWithSearch, Custom, DistributedCache, Search, SingleServer, SingleServerFarm, WebFrontEnd, WebFrontEndWithDistributedCache") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spfarm).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spfarmadministrators.rb b/lib/puppet/type/dsc_spfarmadministrators.rb deleted file mode 100644 index 1e1ad30c..00000000 --- a/lib/puppet/type/dsc_spfarmadministrators.rb +++ /dev/null @@ -1,155 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spfarmadministrators) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPFarmAdministrators resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPFarmAdministrators/MSFT_SPFarmAdministrators.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPFarmAdministrators' end - def dscmeta_resource_name; 'MSFT_SPFarmAdministrators' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - A generic name for this resource, its value is not important" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Members - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_members, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Members - A list of members to set the group to. Those not in this list will be removed" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: MembersToInclude - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_memberstoinclude, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "MembersToInclude - A list of members to add. Members not in this list will be left in the group" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: MembersToExclude - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_memberstoexclude, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "MembersToExclude - A list of members to remove. Members not in this list will be left in the group" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spfarmadministrators).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spfarmpropertybag.rb b/lib/puppet/type/dsc_spfarmpropertybag.rb deleted file mode 100644 index 22fb7e4e..00000000 --- a/lib/puppet/type/dsc_spfarmpropertybag.rb +++ /dev/null @@ -1,136 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spfarmpropertybag) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPFarmPropertyBag resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPFarmPropertyBag/MSFT_SPFarmPropertyBag.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_key is a required attribute') if self[:dsc_key].nil? - end - - def dscmeta_resource_friendly_name; 'SPFarmPropertyBag' end - def dscmeta_resource_name; 'MSFT_SPFarmPropertyBag' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Key - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_key) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Key - The key of the SPFarm property bag" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Value - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_value) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Value - Value of the SPfarm property bag" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Set to present to ensure the SPfarm property exists, or absent to ensure it is removed Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spfarmpropertybag).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spfarmsolution.rb b/lib/puppet/type/dsc_spfarmsolution.rb deleted file mode 100644 index fcdae18b..00000000 --- a/lib/puppet/type/dsc_spfarmsolution.rb +++ /dev/null @@ -1,203 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spfarmsolution) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPFarmSolution resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPFarmSolution/MSFT_SPFarmSolution.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPFarmSolution' end - def dscmeta_resource_name; 'MSFT_SPFarmSolution' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The filename of the WSP package" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: LiteralPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_literalpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LiteralPath - The full path to the WSP file" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: WebApplications - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_webapplications, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "WebApplications - A list of the web applications to deploy this to" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present if the WSP should be deployed, or Absent if it should be removed Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Version - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_version) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Version - The version of the package that is being modified" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Deployed - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_deployed) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Deployed - Should the solution be deployed to the farm, or just installed to the farm" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: SolutionLevel - # Type: string - # IsMandatory: False - # Values: ["14", "15", "All"] - newparam(:dsc_solutionlevel) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SolutionLevel - What compatability level should the WSP be deployed as? Valid values are 14, 15, All." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['14', '14', '15', '15', 'All', 'all'].include?(value) - fail("Invalid value '#{value}'. Valid values are 14, 15, All") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spfarmsolution).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spfeature.rb b/lib/puppet/type/dsc_spfeature.rb deleted file mode 100644 index e7038f2f..00000000 --- a/lib/puppet/type/dsc_spfeature.rb +++ /dev/null @@ -1,171 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spfeature) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPFeature resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPFeature/MSFT_SPFeature.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - fail('dsc_url is a required attribute') if self[:dsc_url].nil? - end - - def dscmeta_resource_friendly_name; 'SPFeature' end - def dscmeta_resource_name; 'MSFT_SPFeature' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the feature" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: FeatureScope - # Type: string - # IsMandatory: False - # Values: ["Farm", "WebApplication", "Site", "Web"] - newparam(:dsc_featurescope) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FeatureScope - The scope to change the feature at - Farm, WebApplication, SiteCollection or Site Valid values are Farm, WebApplication, Site, Web." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Farm', 'farm', 'WebApplication', 'webapplication', 'Site', 'site', 'Web', 'web'].include?(value) - fail("Invalid value '#{value}'. Valid values are Farm, WebApplication, Site, Web") - end - end - end - - # Name: Url - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_url) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Url - The URL to change the feature at" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present if the feature is to be enabled, Absent if it is to be disabled Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Version - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_version) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Version - The version of the feature to check against" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spfeature).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_sphealthanalyzerrulestate.rb b/lib/puppet/type/dsc_sphealthanalyzerrulestate.rb deleted file mode 100644 index 7e49f4ad..00000000 --- a/lib/puppet/type/dsc_sphealthanalyzerrulestate.rb +++ /dev/null @@ -1,169 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_sphealthanalyzerrulestate) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPHealthAnalyzerRuleState resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPHealthAnalyzerRuleState/MSFT_SPHealthAnalyzerRuleState.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPHealthAnalyzerRuleState' end - def dscmeta_resource_name; 'MSFT_SPHealthAnalyzerRuleState' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the rule exactly as it appears in central admin" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Enabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_enabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Enabled - Should the rule be enabled?" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: RuleScope - # Type: string - # IsMandatory: False - # Values: ["All Servers", "Any Server"] - newparam(:dsc_rulescope) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RuleScope - What is the scope of this rule Valid values are All Servers, Any Server." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['All Servers', 'all servers', 'Any Server', 'any server'].include?(value) - fail("Invalid value '#{value}'. Valid values are All Servers, Any Server") - end - end - end - - # Name: Schedule - # Type: string - # IsMandatory: False - # Values: ["Hourly", "Daily", "Weekly", "Monthly", "OnDemandOnly"] - newparam(:dsc_schedule) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Schedule - How often should the rule check Valid values are Hourly, Daily, Weekly, Monthly, OnDemandOnly." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Hourly', 'hourly', 'Daily', 'daily', 'Weekly', 'weekly', 'Monthly', 'monthly', 'OnDemandOnly', 'ondemandonly'].include?(value) - fail("Invalid value '#{value}'. Valid values are Hourly, Daily, Weekly, Monthly, OnDemandOnly") - end - end - end - - # Name: FixAutomatically - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_fixautomatically) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "FixAutomatically - Should the rule fix itself automatically" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_sphealthanalyzerrulestate).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spinstall.rb b/lib/puppet/type/dsc_spinstall.rb deleted file mode 100644 index ae016a87..00000000 --- a/lib/puppet/type/dsc_spinstall.rb +++ /dev/null @@ -1,150 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spinstall) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPInstall resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPInstall/MSFT_SPInstall.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_binarydir is a required attribute') if self[:dsc_binarydir].nil? - end - - def dscmeta_resource_friendly_name; 'SPInstall' end - def dscmeta_resource_name; 'MSFT_SPInstall' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: BinaryDir - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_binarydir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "BinaryDir - The directory that contains all of the SharePoint binaries" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ProductKey - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_productkey) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProductKey - The product key to use during the installation" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstallPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_installpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstallPath - The install directory to use in the installation, leave blank to use the setup defaults" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DataPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_datapath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DataPath - The data directory to use in the installation, leave blank to use the setup defaults" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present to install SharePoint. Absent is currently not supported Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spinstall).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spinstalllanguagepack.rb b/lib/puppet/type/dsc_spinstalllanguagepack.rb deleted file mode 100644 index e118d364..00000000 --- a/lib/puppet/type/dsc_spinstalllanguagepack.rb +++ /dev/null @@ -1,164 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spinstalllanguagepack) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPInstallLanguagePack resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_binarydir is a required attribute') if self[:dsc_binarydir].nil? - end - - def dscmeta_resource_friendly_name; 'SPInstallLanguagePack' end - def dscmeta_resource_name; 'MSFT_SPInstallLanguagePack' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: BinaryDir - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_binarydir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "BinaryDir - The directory that contains all of the SharePoint binaries" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: BinaryInstallDays - # Type: string[] - # IsMandatory: False - # Values: ["mon", "tue", "wed", "thu", "fri", "sat", "sun"] - newparam(:dsc_binaryinstalldays, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "BinaryInstallDays - Specify on which dates the installation is allowed Valid values are mon, tue, wed, thu, fri, sat, sun." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - if value.kind_of?(Array) - unless (['mon', 'mon', 'tue', 'tue', 'wed', 'wed', 'thu', 'thu', 'fri', 'fri', 'sat', 'sat', 'sun', 'sun'] & value).count == value.count - fail("Invalid value #{value}. Valid values are mon, tue, wed, thu, fri, sat, sun") - end - end - if value.kind_of?(String) - unless ['mon', 'mon', 'tue', 'tue', 'wed', 'wed', 'thu', 'thu', 'fri', 'fri', 'sat', 'sat', 'sun', 'sun'].include?(value) - fail("Invalid value #{value}. Valid values are mon, tue, wed, thu, fri, sat, sun") - end - end - end - munge do |value| - Array(value) - end - end - - # Name: BinaryInstallTime - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_binaryinstalltime) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "BinaryInstallTime - Specify in which time frame the installation is allowed" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present to install SharePoint. Absent is currently not supported Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spinstalllanguagepack).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spinstallprereqs.rb b/lib/puppet/type/dsc_spinstallprereqs.rb deleted file mode 100644 index 9a832038..00000000 --- a/lib/puppet/type/dsc_spinstallprereqs.rb +++ /dev/null @@ -1,376 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spinstallprereqs) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPInstallPrereqs resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPInstallPrereqs/MSFT_SPInstallPrereqs.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_installerpath is a required attribute') if self[:dsc_installerpath].nil? - end - - def dscmeta_resource_friendly_name; 'SPInstallPrereqs' end - def dscmeta_resource_name; 'MSFT_SPInstallPrereqs' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: InstallerPath - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_installerpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstallerPath - The full path to prerequisiteinstaller.exe" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: OnlineMode - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_onlinemode) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "OnlineMode - Should the installer download prerequisites from the internet or not" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: SXSpath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sxspath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SXSpath - The path to the Windows Server Operating System SXS source files, for use in closed environments without access to Windows Update" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLNCli - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlncli) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLNCli - The path to the installer for this prerequisite" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: PowerShell - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_powershell) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "PowerShell - The path to the installer for this prerequisite" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: NETFX - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_netfx) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "NETFX - The path to the installer for this prerequisite" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: IDFX - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_idfx) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IDFX - The path to the installer for this prerequisite" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Sync - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sync) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Sync - The path to the installer for this prerequisite" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AppFabric - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_appfabric) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AppFabric - The path to the installer for this prerequisite" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: IDFX11 - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_idfx11) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IDFX11 - The path to the installer for this prerequisite" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MSIPCClient - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_msipcclient) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MSIPCClient - The path to the installer for this prerequisite" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: WCFDataServices - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_wcfdataservices) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WCFDataServices - The path to the installer for this prerequisite" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: KB2671763 - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_kb2671763) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "KB2671763 - The path to the installer for this prerequisite" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: WCFDataServices56 - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_wcfdataservices56) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WCFDataServices56 - The path to the installer for this prerequisite" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MSVCRT11 - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_msvcrt11) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MSVCRT11 - The path to the installer for this prerequisite" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MSVCRT14 - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_msvcrt14) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MSVCRT14 - The path to the installer for this prerequisite" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: KB3092423 - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_kb3092423) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "KB3092423 - The path to the installer for this prerequisite" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ODBC - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_odbc) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ODBC - The path to the installer for this prerequisite" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DotNetFx - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_dotnetfx) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DotNetFx - The path to the installer for this prerequisite" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present to install the prerequisites. Absent is currently not supported Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spinstallprereqs).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spirmsettings.rb b/lib/puppet/type/dsc_spirmsettings.rb deleted file mode 100644 index aeeb7db8..00000000 --- a/lib/puppet/type/dsc_spirmsettings.rb +++ /dev/null @@ -1,137 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spirmsettings) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPIrmSettings resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPIrmSettings/MSFT_SPIrmSettings.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_ensure is a required attribute') if self[:dsc_ensure].nil? - end - - def dscmeta_resource_friendly_name; 'SPIrmSettings' end - def dscmeta_resource_name; 'MSFT_SPIrmSettings' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: True - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Enable or Disable IRM on this farm Valid values are Present, Absent." - isrequired - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: UseADRMS - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_useadrms) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "UseADRMS - Use the RMS server published in this farm's Active Directory" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: RMSserver - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_rmsserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RMSserver - Use the specified RMS server, must provide in URL format" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spirmsettings).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spjoinfarm.rb b/lib/puppet/type/dsc_spjoinfarm.rb deleted file mode 100644 index e21538df..00000000 --- a/lib/puppet/type/dsc_spjoinfarm.rb +++ /dev/null @@ -1,152 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spjoinfarm) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPJoinFarm resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPJoinFarm/MSFT_SPJoinFarm.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_farmconfigdatabasename is a required attribute') if self[:dsc_farmconfigdatabasename].nil? - fail('dsc_databaseserver is a required attribute') if self[:dsc_databaseserver].nil? - end - - def dscmeta_resource_friendly_name; 'SPJoinFarm' end - def dscmeta_resource_name; 'MSFT_SPJoinFarm' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: FarmConfigDatabaseName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_farmconfigdatabasename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FarmConfigDatabaseName - The name of the config database to connect to" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseServer - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_databaseserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseServer - The server that hosts the config database" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Passphrase - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_passphrase) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Passphrase - The passphrase that should be used to join the farm" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Passphrase", value) - end - end - - # Name: ServerRole - # Type: string - # IsMandatory: False - # Values: ["Application", "ApplicationWithSearch", "Custom", "DistributedCache", "Search", "SingleServer", "SingleServerFarm", "WebFrontEnd", "WebFrontEndWithDistributedCache"] - newparam(:dsc_serverrole) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServerRole - SharePoint 2016 only - the MinRole role to enroll this server as Valid values are Application, ApplicationWithSearch, Custom, DistributedCache, Search, SingleServer, SingleServerFarm, WebFrontEnd, WebFrontEndWithDistributedCache." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Application', 'application', 'ApplicationWithSearch', 'applicationwithsearch', 'Custom', 'custom', 'DistributedCache', 'distributedcache', 'Search', 'search', 'SingleServer', 'singleserver', 'SingleServerFarm', 'singleserverfarm', 'WebFrontEnd', 'webfrontend', 'WebFrontEndWithDistributedCache', 'webfrontendwithdistributedcache'].include?(value) - fail("Invalid value '#{value}'. Valid values are Application, ApplicationWithSearch, Custom, DistributedCache, Search, SingleServer, SingleServerFarm, WebFrontEnd, WebFrontEndWithDistributedCache") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spjoinfarm).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spmachinetranslationserviceapp.rb b/lib/puppet/type/dsc_spmachinetranslationserviceapp.rb deleted file mode 100644 index f54fb5ad..00000000 --- a/lib/puppet/type/dsc_spmachinetranslationserviceapp.rb +++ /dev/null @@ -1,166 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spmachinetranslationserviceapp) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPMachineTranslationServiceApp resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPMachineTranslationServiceApp/MSFT_SPMachineTranslationServiceApp.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPMachineTranslationServiceApp' end - def dscmeta_resource_name; 'MSFT_SPMachineTranslationServiceApp' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Specifies the name of the service application." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databasename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseName - Specifies the name of the database for the service application." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databaseserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseServer - Specifies the name of the database server for the service application." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ApplicationPool - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_applicationpool) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ApplicationPool - Specifies the application pool to use with the service application." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present ensures service app exists, absent ensures it is removed Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spmachinetranslationserviceapp).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spmanagedaccount.rb b/lib/puppet/type/dsc_spmanagedaccount.rb deleted file mode 100644 index 9919a220..00000000 --- a/lib/puppet/type/dsc_spmanagedaccount.rb +++ /dev/null @@ -1,188 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spmanagedaccount) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPManagedAccount resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPManagedAccount/MSFT_SPManagedAccount.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_accountname is a required attribute') if self[:dsc_accountname].nil? - end - - def dscmeta_resource_friendly_name; 'SPManagedAccount' end - def dscmeta_resource_name; 'MSFT_SPManagedAccount' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: AccountName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_accountname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AccountName - The username of the account" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Account - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_account) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Account - The credential with password of the account" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Account", value) - end - end - - # Name: EmailNotification - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_emailnotification) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "EmailNotification - How many days before a password change should an email be sent" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: PreExpireDays - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_preexpiredays) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "PreExpireDays - How many days before a password expires should it be changed" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: Schedule - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_schedule) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Schedule - What is the schedule for the password reset" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present ensures managed account exists, absent ensures it is removed Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spmanagedaccount).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spmanagedmetadataserviceapp.rb b/lib/puppet/type/dsc_spmanagedmetadataserviceapp.rb deleted file mode 100644 index 634a2757..00000000 --- a/lib/puppet/type/dsc_spmanagedmetadataserviceapp.rb +++ /dev/null @@ -1,214 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spmanagedmetadataserviceapp) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPManagedMetaDataServiceApp resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceApp/MSFT_SPManagedMetaDataServiceApp.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPManagedMetaDataServiceApp' end - def dscmeta_resource_name; 'MSFT_SPManagedMetaDataServiceApp' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the managed metadata service application" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ProxyName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_proxyname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProxyName - The proxy name, if not specified will be /Name of service app/ Proxy" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ApplicationPool - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_applicationpool) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ApplicationPool - The application pool that the service app will use" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databaseserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseServer - The name of the database server which will host the application" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databasename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseName - The name of the database for the service application" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: TermStoreAdministrators - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_termstoreadministrators, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "TermStoreAdministrators - A list of the users/groups who are administrators of the term store" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present ensures service app exists, absent ensures it is removed Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: ContentTypeHubUrl - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_contenttypehuburl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ContentTypeHubUrl - The URL of the content type hub for this app (only set when the app is provisioned)" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spmanagedmetadataserviceapp).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spmanagedpath.rb b/lib/puppet/type/dsc_spmanagedpath.rb deleted file mode 100644 index e504c435..00000000 --- a/lib/puppet/type/dsc_spmanagedpath.rb +++ /dev/null @@ -1,170 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spmanagedpath) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPManagedPath resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPManagedPath/MSFT_SPManagedPath.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_webappurl is a required attribute') if self[:dsc_webappurl].nil? - fail('dsc_relativeurl is a required attribute') if self[:dsc_relativeurl].nil? - end - - def dscmeta_resource_friendly_name; 'SPManagedPath' end - def dscmeta_resource_name; 'MSFT_SPManagedPath' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: WebAppUrl - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_webappurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WebAppUrl - The URL of the web application to apply the managed path to - this is ignored for host header web applications" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RelativeUrl - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_relativeurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RelativeUrl - The relative URL of the managed path" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Explicit - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_explicit) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Explicit - Should the host header be explicit? If false then it is a wildcard" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: HostHeader - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_hostheader) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "HostHeader - Is this a host header web application?" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present ensures managed path exists, absent ensures it is removed Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spmanagedpath).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spofficeonlineserverbinding.rb b/lib/puppet/type/dsc_spofficeonlineserverbinding.rb deleted file mode 100644 index 79b40f77..00000000 --- a/lib/puppet/type/dsc_spofficeonlineserverbinding.rb +++ /dev/null @@ -1,139 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spofficeonlineserverbinding) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPOfficeOnlineServerBinding resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerBinding/MSFT_SPOfficeOnlineServerBinding.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_zone is a required attribute') if self[:dsc_zone].nil? - end - - def dscmeta_resource_friendly_name; 'SPOfficeOnlineServerBinding' end - def dscmeta_resource_name; 'MSFT_SPOfficeOnlineServerBinding' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Zone - # Type: string - # IsMandatory: True - # Values: ["Internal-HTTP", "Internal-HTTPS", "External-HTTP", "External-HTTPS"] - newparam(:dsc_zone) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Zone - The zone for this binding Valid values are Internal-HTTP, Internal-HTTPS, External-HTTP, External-HTTPS." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Internal-HTTP', 'internal-http', 'Internal-HTTPS', 'internal-https', 'External-HTTP', 'external-http', 'External-HTTPS', 'external-https'].include?(value) - fail("Invalid value '#{value}'. Valid values are Internal-HTTP, Internal-HTTPS, External-HTTP, External-HTTPS") - end - end - end - - # Name: DnsName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_dnsname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DnsName - The DNS name of the server/s that are running Office Web Apps" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present ensures the binding for this zone exists, absent ensures it doesn't Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spofficeonlineserverbinding).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spoutgoingemailsettings.rb b/lib/puppet/type/dsc_spoutgoingemailsettings.rb deleted file mode 100644 index 35dca2ab..00000000 --- a/lib/puppet/type/dsc_spoutgoingemailsettings.rb +++ /dev/null @@ -1,195 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spoutgoingemailsettings) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPOutgoingEmailSettings resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPOutgoingEmailSettings/MSFT_SPOutgoingEmailSettings.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_webappurl is a required attribute') if self[:dsc_webappurl].nil? - end - - def dscmeta_resource_friendly_name; 'SPOutgoingEmailSettings' end - def dscmeta_resource_name; 'MSFT_SPOutgoingEmailSettings' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: WebAppUrl - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_webappurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WebAppUrl - The URL of the web application. If you want to set the global settings use the Central Admin URL" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SMTPServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_smtpserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SMTPServer - The SMTP server for outgoing mail" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: FromAddress - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_fromaddress) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FromAddress - The from address to put on messages" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ReplyToAddress - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_replytoaddress) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ReplyToAddress - The email address that replies should be directed to" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CharacterSet - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_characterset) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CharacterSet - The character set to use on messages" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UseTLS - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_usetls) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "UseTLS - Use TLS when connecting to the SMTP server (SharePoint 2016 only)" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: SMTPPort - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_smtpport) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "SMTPPort - The port which is used to connect to the SMTP server (SharePoint 2016 only)" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spoutgoingemailsettings).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_sppasswordchangesettings.rb b/lib/puppet/type/dsc_sppasswordchangesettings.rb deleted file mode 100644 index 1ae8c462..00000000 --- a/lib/puppet/type/dsc_sppasswordchangesettings.rb +++ /dev/null @@ -1,155 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_sppasswordchangesettings) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPPasswordChangeSettings resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPPasswordChangeSettings/MSFT_SPPasswordChangeSettings.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_mailaddress is a required attribute') if self[:dsc_mailaddress].nil? - end - - def dscmeta_resource_friendly_name; 'SPPasswordChangeSettings' end - def dscmeta_resource_name; 'MSFT_SPPasswordChangeSettings' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: MailAddress - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_mailaddress) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MailAddress - The email address to send notifications of password changes to" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DaysBeforeExpiry - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_daysbeforeexpiry) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "DaysBeforeExpiry - The number of days before password expiry to send send emails" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: PasswordChangeWaitTimeSeconds - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_passwordchangewaittimeseconds) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "PasswordChangeWaitTimeSeconds - The duration that a password reset will wait for before it times out" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: NumberOfRetries - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_numberofretries) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "NumberOfRetries - How many retries if the password change fails" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_sppasswordchangesettings).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spperformancepointserviceapp.rb b/lib/puppet/type/dsc_spperformancepointserviceapp.rb deleted file mode 100644 index 0c995ff6..00000000 --- a/lib/puppet/type/dsc_spperformancepointserviceapp.rb +++ /dev/null @@ -1,181 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spperformancepointserviceapp) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPPerformancePointServiceApp resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPPerformancePointServiceApp/MSFT_SPPerformancePointServiceApp.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPPerformancePointServiceApp' end - def dscmeta_resource_name; 'MSFT_SPPerformancePointServiceApp' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the service application" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ProxyName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_proxyname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProxyName - The proxy name, if not specified will be /Name of service app/ Proxy" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ApplicationPool - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_applicationpool) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ApplicationPool - The name of the application pool to run the service app in" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databasename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseName - The name of the database for the service app" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databaseserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseServer - The name of the database server to host the database" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present ensures service app exists, absent ensures it is removed Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spperformancepointserviceapp).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_sppowerpointautomationserviceapp.rb b/lib/puppet/type/dsc_sppowerpointautomationserviceapp.rb deleted file mode 100644 index 70e3294a..00000000 --- a/lib/puppet/type/dsc_sppowerpointautomationserviceapp.rb +++ /dev/null @@ -1,241 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_sppowerpointautomationserviceapp) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPPowerPointAutomationServiceApp resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPPowerPointAutomationServiceApp/MSFT_SPPowerPointAutomationServiceApp.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPPowerPointAutomationServiceApp' end - def dscmeta_resource_name; 'MSFT_SPPowerPointAutomationServiceApp' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the service application" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ProxyName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_proxyname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProxyName - The name of the service application proxy" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ApplicationPool - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_applicationpool) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ApplicationPool - The name of the application pool to run the service app in" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CacheExpirationPeriodInSeconds - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_cacheexpirationperiodinseconds) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "CacheExpirationPeriodInSeconds - Specifies the maximum time, in seconds, that items remain in the back-end server cache. The default value is 600 seconds (10 minutes)." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MaximumConversionsPerWorker - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_maximumconversionsperworker) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "MaximumConversionsPerWorker - Specifies the maximum number of presentations that a conversion worker process can convert before recycling. The default value is 5." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: WorkerKeepAliveTimeoutInSeconds - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_workerkeepalivetimeoutinseconds) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "WorkerKeepAliveTimeoutInSeconds - Specifies the maximum time, in seconds, that a conversion worker process can be unresponsive before being terminated. The default value is 120 seconds." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: WorkerProcessCount - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_workerprocesscount) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "WorkerProcessCount - Specifies the number of active instances of the conversion worker process on each back-end. This value must be less than the Windows Communication Foundation (WCF) connection limit for this computer. The default value is 3." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: WorkerTimeoutInSeconds - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_workertimeoutinseconds) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "WorkerTimeoutInSeconds - Specifies the maximum time, in seconds, that a conversion worker process is given for any single conversion. The default is 300 seconds (5 minutes)." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Ensure the crawl rule is Present or Absent Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run thsi resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_sppowerpointautomationserviceapp).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spproductupdate.rb b/lib/puppet/type/dsc_spproductupdate.rb deleted file mode 100644 index 9dfa81f2..00000000 --- a/lib/puppet/type/dsc_spproductupdate.rb +++ /dev/null @@ -1,180 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spproductupdate) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPProductUpdate resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPProductUpdate/MSFT_SPProductUpdate.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_setupfile is a required attribute') if self[:dsc_setupfile].nil? - end - - def dscmeta_resource_friendly_name; 'SPProductUpdate' end - def dscmeta_resource_name; 'MSFT_SPProductUpdate' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: SetupFile - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_setupfile) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SetupFile - The name of the update setup file" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ShutdownServices - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_shutdownservices) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ShutdownServices - Shutdown SharePoint services to speed up installation" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: BinaryInstallDays - # Type: string[] - # IsMandatory: False - # Values: ["mon", "tue", "wed", "thu", "fri", "sat", "sun"] - newparam(:dsc_binaryinstalldays, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "BinaryInstallDays - Specify on which dates the installation is allowed Valid values are mon, tue, wed, thu, fri, sat, sun." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - if value.kind_of?(Array) - unless (['mon', 'mon', 'tue', 'tue', 'wed', 'wed', 'thu', 'thu', 'fri', 'fri', 'sat', 'sat', 'sun', 'sun'] & value).count == value.count - fail("Invalid value #{value}. Valid values are mon, tue, wed, thu, fri, sat, sun") - end - end - if value.kind_of?(String) - unless ['mon', 'mon', 'tue', 'tue', 'wed', 'wed', 'thu', 'thu', 'fri', 'fri', 'sat', 'sat', 'sun', 'sun'].include?(value) - fail("Invalid value #{value}. Valid values are mon, tue, wed, thu, fri, sat, sun") - end - end - end - munge do |value| - Array(value) - end - end - - # Name: BinaryInstallTime - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_binaryinstalltime) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "BinaryInstallTime - Specify in which time frame the installation is allowed" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present to install SharePoint. Absent is currently not supported Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spproductupdate).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_sppublishserviceapplication.rb b/lib/puppet/type/dsc_sppublishserviceapplication.rb deleted file mode 100644 index 54743c5d..00000000 --- a/lib/puppet/type/dsc_sppublishserviceapplication.rb +++ /dev/null @@ -1,121 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_sppublishserviceapplication) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPPublishServiceApplication resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPPublishServiceApplication/MSFT_SPPublishServiceApplication.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPPublishServiceApplication' end - def dscmeta_resource_name; 'MSFT_SPPublishServiceApplication' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the service application to publish" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present to ensure it runs on this server, or absent to ensure it is stopped Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_sppublishserviceapplication).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spquotatemplate.rb b/lib/puppet/type/dsc_spquotatemplate.rb deleted file mode 100644 index 762e3ecf..00000000 --- a/lib/puppet/type/dsc_spquotatemplate.rb +++ /dev/null @@ -1,193 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spquotatemplate) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPQuotaTemplate resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPQuotaTemplate/MSFT_SPQuotaTemplate.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPQuotaTemplate' end - def dscmeta_resource_name; 'MSFT_SPQuotaTemplate' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the quota template" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: StorageMaxInMB - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_storagemaxinmb) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "StorageMaxInMB - The maximum storage for sites of this template in MB" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: StorageWarningInMB - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_storagewarninginmb) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "StorageWarningInMB - The amount of storage for sites of this template that triggers a warning" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MaximumUsagePointsSolutions - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_maximumusagepointssolutions) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "MaximumUsagePointsSolutions - The maximum number of performance points for sandbox solutions for this template" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: WarningUsagePointsSolutions - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_warningusagepointssolutions) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "WarningUsagePointsSolutions - The warning number of performance points for sandbox solutions for this template" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present to create this template, absent to ensure it does not exist Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spquotatemplate).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spremotefarmtrust.rb b/lib/puppet/type/dsc_spremotefarmtrust.rb deleted file mode 100644 index 1a9882b4..00000000 --- a/lib/puppet/type/dsc_spremotefarmtrust.rb +++ /dev/null @@ -1,151 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spremotefarmtrust) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPRemoteFarmTrust resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPRemoteFarmTrust/MSFT_SPRemoteFarmTrust.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPRemoteFarmTrust' end - def dscmeta_resource_name; 'MSFT_SPRemoteFarmTrust' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - A name of the remote farm, used to create token issuer and root authority" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RemoteWebAppUrl - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_remotewebappurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RemoteWebAppUrl - The URL of a web app in the remote farm, must use HTTPS" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: LocalWebAppUrl - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_localwebappurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LocalWebAppUrl - The URL of a local web app to connect the remote farm to" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Set to present to ensure the trust exists, or absent to ensure it is removed Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spremotefarmtrust).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spsearchauthoritativepage.rb b/lib/puppet/type/dsc_spsearchauthoritativepage.rb deleted file mode 100644 index fcfb49dc..00000000 --- a/lib/puppet/type/dsc_spsearchauthoritativepage.rb +++ /dev/null @@ -1,171 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spsearchauthoritativepage) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPSearchAuthoritativePage resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPSearchAuthoritativePage/MSFT_SPSearchAuthoritativePage.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_serviceappname is a required attribute') if self[:dsc_serviceappname].nil? - fail('dsc_path is a required attribute') if self[:dsc_path].nil? - end - - def dscmeta_resource_friendly_name; 'SPSearchAuthoritativePage' end - def dscmeta_resource_name; 'MSFT_SPSearchAuthoritativePage' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: ServiceAppName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_serviceappname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServiceAppName - Search Service Application Name" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Path - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_path) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Path - Source URI for the authoritative page" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Level - # Type: real32 - # IsMandatory: False - # Values: None - newparam(:dsc_level) do - def mof_type; 'real32' end - def mof_is_embedded?; false end - desc "Level - Level of Authoratitive Page, values between 0.0 and 2.0" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Action - # Type: string - # IsMandatory: False - # Values: ["Authoratative", "Demoted"] - newparam(:dsc_action) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Action - The resource will either make the page authoritative or demoted based on this value Valid values are Authoratative, Demoted." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Authoratative', 'authoratative', 'Demoted', 'demoted'].include?(value) - fail("Invalid value '#{value}'. Valid values are Authoratative, Demoted") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Ensure the Authoritative is Present or Absent Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spsearchauthoritativepage).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spsearchcontentsource.rb b/lib/puppet/type/dsc_spsearchcontentsource.rb deleted file mode 100644 index d7464ac3..00000000 --- a/lib/puppet/type/dsc_spsearchcontentsource.rb +++ /dev/null @@ -1,345 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spsearchcontentsource) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - class PuppetX::Dsc::TypeHelpers - def self.validate_MSFT_SPSearchCrawlSchedule(mof_type_map, name, value) - required = ['scheduletype'] - allowed = ['crawlscheduledaysofmonth','crawlscheduledaysofweek','crawlschedulemonthsofyear','starthour','startminute','crawlschedulerepeatduration','crawlschedulerepeatinterval','crawlscheduleruneveryinterval'] - lowkey_hash = Hash[value.map { |k, v| [k.to_s.downcase, v] }] - - missing = required - lowkey_hash.keys - unless missing.empty? - fail "#{name} is missing the following required keys: #{missing.join(',')}" - end - - extraneous = lowkey_hash.keys - required - allowed - unless extraneous.empty? - fail "#{name} includes invalid keys: #{extraneous.join(',')}" - end - - lowkey_hash.keys.each do |key| - if lowkey_hash[key] - validate_mof_type(mof_type_map[key], 'MSFT_SPSearchCrawlSchedule', key, lowkey_hash[key]) - end - end - end - end - - @doc = %q{ - The DSC SPSearchContentSource resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPSearchContentSource/MSFT_SPSearchContentSource.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - fail('dsc_serviceappname is a required attribute') if self[:dsc_serviceappname].nil? - end - - def dscmeta_resource_friendly_name; 'SPSearchContentSource' end - def dscmeta_resource_name; 'MSFT_SPSearchContentSource' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the content source" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ServiceAppName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_serviceappname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServiceAppName - The name of the search service app that this content source exists within" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ContentSourceType - # Type: string - # IsMandatory: False - # Values: ["SharePoint", "Website", "FileShare"] - newparam(:dsc_contentsourcetype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ContentSourceType - The type of content source - currently only SharePoint, Website and File Shares are supported Valid values are SharePoint, Website, FileShare." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['SharePoint', 'sharepoint', 'Website', 'website', 'FileShare', 'fileshare'].include?(value) - fail("Invalid value '#{value}'. Valid values are SharePoint, Website, FileShare") - end - end - end - - # Name: Addresses - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_addresses, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Addresses - A list of the addresses this content source includes" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: CrawlSetting - # Type: string - # IsMandatory: False - # Values: ["CrawlEverything", "CrawlFirstOnly", "Custom"] - newparam(:dsc_crawlsetting) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CrawlSetting - Should the crawler index everything, just the first site or page, or a custom depth (applies to websites only) Valid values are CrawlEverything, CrawlFirstOnly, Custom." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['CrawlEverything', 'crawleverything', 'CrawlFirstOnly', 'crawlfirstonly', 'Custom', 'custom'].include?(value) - fail("Invalid value '#{value}'. Valid values are CrawlEverything, CrawlFirstOnly, Custom") - end - end - end - - # Name: ContinuousCrawl - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_continuouscrawl) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ContinuousCrawl - Should this content source use continuous crawl (SharePoint sites only)" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: IncrementalSchedule - # Type: MSFT_SPSearchCrawlSchedule - # IsMandatory: False - # Values: None - newparam(:dsc_incrementalschedule) do - def mof_type; 'MSFT_SPSearchCrawlSchedule' end - def mof_is_embedded?; true end - def mof_type_map - {"scheduletype"=>{:type=>"string", :values=>["None", "Daily", "Weekly", "Monthly"]}, "crawlscheduledaysofmonth"=>{:type=>"uint32"}, "crawlscheduledaysofweek"=>{:type=>"string[]", :values=>["Everyday", "Weekdays", "Weekends", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]}, "crawlschedulemonthsofyear"=>{:type=>"string[]", :values=>["AllMonths", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]}, "starthour"=>{:type=>"uint32"}, "startminute"=>{:type=>"uint32"}, "crawlschedulerepeatduration"=>{:type=>"uint32"}, "crawlschedulerepeatinterval"=>{:type=>"uint32"}, "crawlscheduleruneveryinterval"=>{:type=>"uint32"}} - end - desc "IncrementalSchedule - What is the incremental schedule for this content source" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_SPSearchCrawlSchedule(mof_type_map, "IncrementalSchedule", value) - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_embeddedinstance(mof_type_map, value) - end - end - - # Name: FullSchedule - # Type: MSFT_SPSearchCrawlSchedule - # IsMandatory: False - # Values: None - newparam(:dsc_fullschedule) do - def mof_type; 'MSFT_SPSearchCrawlSchedule' end - def mof_is_embedded?; true end - def mof_type_map - {"scheduletype"=>{:type=>"string", :values=>["None", "Daily", "Weekly", "Monthly"]}, "crawlscheduledaysofmonth"=>{:type=>"uint32"}, "crawlscheduledaysofweek"=>{:type=>"string[]", :values=>["Everyday", "Weekdays", "Weekends", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]}, "crawlschedulemonthsofyear"=>{:type=>"string[]", :values=>["AllMonths", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]}, "starthour"=>{:type=>"uint32"}, "startminute"=>{:type=>"uint32"}, "crawlschedulerepeatduration"=>{:type=>"uint32"}, "crawlschedulerepeatinterval"=>{:type=>"uint32"}, "crawlscheduleruneveryinterval"=>{:type=>"uint32"}} - end - desc "FullSchedule - What is the full schedule for this content source" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_SPSearchCrawlSchedule(mof_type_map, "FullSchedule", value) - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_embeddedinstance(mof_type_map, value) - end - end - - # Name: Priority - # Type: string - # IsMandatory: False - # Values: ["Normal", "High"] - newparam(:dsc_priority) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Priority - What is the priority on this content source Valid values are Normal, High." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Normal', 'normal', 'High', 'high'].include?(value) - fail("Invalid value '#{value}'. Valid values are Normal, High") - end - end - end - - # Name: LimitPageDepth - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_limitpagedepth) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "LimitPageDepth - How many pages deep should the crawler go (-1 = unlimited, website sources only)" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: LimitServerHops - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_limitserverhops) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "LimitServerHops - How many server hops should the crawler make (-1 = unlimtied, website sources only)" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present if the source should exist, absent if it should not Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Force - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_force) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Force - Specify true if DSC is allowed to delete and recreate a content source to apply the correct settings, otherwise false will just report errors if a change can not be applied." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spsearchcontentsource).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spsearchcrawlerimpactrule.rb b/lib/puppet/type/dsc_spsearchcrawlerimpactrule.rb deleted file mode 100644 index 14058c8d..00000000 --- a/lib/puppet/type/dsc_spsearchcrawlerimpactrule.rb +++ /dev/null @@ -1,189 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spsearchcrawlerimpactrule) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPSearchCrawlerImpactRule resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPSearchCrawlerImpactRule/MSFT_SPSearchCrawlerImpactRule.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_serviceappname is a required attribute') if self[:dsc_serviceappname].nil? - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPSearchCrawlerImpactRule' end - def dscmeta_resource_name; 'MSFT_SPSearchCrawlerImpactRule' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: ServiceAppName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_serviceappname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServiceAppName - Search Service Application Name" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The Site for the crawl impact rule" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Behavior - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_behavior) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Behavior - The Behavior (RequestLimit or WaitTime) for this crawl impact rule" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RequestLimit - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_requestlimit) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "RequestLimit - The RequestLimit setting for the crawl impact rule" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: WaitTime - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_waittime) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "WaitTime - The WaitTime setting for the crawl impact rule" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Ensure the crawl rule is Present or Absent Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spsearchcrawlerimpactrule).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spsearchcrawlmapping.rb b/lib/puppet/type/dsc_spsearchcrawlmapping.rb deleted file mode 100644 index 71f3b64b..00000000 --- a/lib/puppet/type/dsc_spsearchcrawlmapping.rb +++ /dev/null @@ -1,153 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spsearchcrawlmapping) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPSearchCrawlMapping resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPSearchCrawlMapping/MSFT_SPSearchCrawlMapping.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_serviceappname is a required attribute') if self[:dsc_serviceappname].nil? - fail('dsc_url is a required attribute') if self[:dsc_url].nil? - end - - def dscmeta_resource_friendly_name; 'SPSearchCrawlMapping' end - def dscmeta_resource_name; 'MSFT_SPSearchCrawlMapping' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: ServiceAppName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_serviceappname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServiceAppName - Search Service Application Name" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Url - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_url) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Url - Source URI for the crawl mapping" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Target - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_target) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Target - Target URI for the crawl mapping" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Ensure the crawl mapping is Present or Absent Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spsearchcrawlmapping).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spsearchcrawlrule.rb b/lib/puppet/type/dsc_spsearchcrawlrule.rb deleted file mode 100644 index 0733cee8..00000000 --- a/lib/puppet/type/dsc_spsearchcrawlrule.rb +++ /dev/null @@ -1,231 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spsearchcrawlrule) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPSearchCrawlRule resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPSearchCrawlRule/MSFT_SPSearchCrawlRule.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_path is a required attribute') if self[:dsc_path].nil? - end - - def dscmeta_resource_friendly_name; 'SPSearchCrawlRule' end - def dscmeta_resource_name; 'MSFT_SPSearchCrawlRule' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Path - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_path) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Path - The name of the search service application" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ServiceAppName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_serviceappname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServiceAppName - The name of the search service application" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AuthenticationType - # Type: string - # IsMandatory: False - # Values: ["DefaultRuleAccess", "BasicAccountRuleAccess", "CertificateRuleAccess", "NTLMAccountRuleAccess", "FormRuleAccess", "CookieRuleAccess", "AnonymousAccess"] - newparam(:dsc_authenticationtype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AuthenticationType - Authentication type used by the crawl rule Valid values are DefaultRuleAccess, BasicAccountRuleAccess, CertificateRuleAccess, NTLMAccountRuleAccess, FormRuleAccess, CookieRuleAccess, AnonymousAccess." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['DefaultRuleAccess', 'defaultruleaccess', 'BasicAccountRuleAccess', 'basicaccountruleaccess', 'CertificateRuleAccess', 'certificateruleaccess', 'NTLMAccountRuleAccess', 'ntlmaccountruleaccess', 'FormRuleAccess', 'formruleaccess', 'CookieRuleAccess', 'cookieruleaccess', 'AnonymousAccess', 'anonymousaccess'].include?(value) - fail("Invalid value '#{value}'. Valid values are DefaultRuleAccess, BasicAccountRuleAccess, CertificateRuleAccess, NTLMAccountRuleAccess, FormRuleAccess, CookieRuleAccess, AnonymousAccess") - end - end - end - - # Name: RuleType - # Type: string - # IsMandatory: False - # Values: ["InclusionRule", "ExclusionRule"] - newparam(:dsc_ruletype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RuleType - The type of the rule Valid values are InclusionRule, ExclusionRule." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['InclusionRule', 'inclusionrule', 'ExclusionRule', 'exclusionrule'].include?(value) - fail("Invalid value '#{value}'. Valid values are InclusionRule, ExclusionRule") - end - end - end - - # Name: CrawlConfigurationRules - # Type: string[] - # IsMandatory: False - # Values: ["FollowLinksNoPageCrawl", "CrawlComplexUrls", "CrawlAsHTTP"] - newparam(:dsc_crawlconfigurationrules, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "CrawlConfigurationRules - The configuration options for this rule Valid values are FollowLinksNoPageCrawl, CrawlComplexUrls, CrawlAsHTTP." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - if value.kind_of?(Array) - unless (['FollowLinksNoPageCrawl', 'followlinksnopagecrawl', 'CrawlComplexUrls', 'crawlcomplexurls', 'CrawlAsHTTP', 'crawlashttp'] & value).count == value.count - fail("Invalid value #{value}. Valid values are FollowLinksNoPageCrawl, CrawlComplexUrls, CrawlAsHTTP") - end - end - if value.kind_of?(String) - unless ['FollowLinksNoPageCrawl', 'followlinksnopagecrawl', 'CrawlComplexUrls', 'crawlcomplexurls', 'CrawlAsHTTP', 'crawlashttp'].include?(value) - fail("Invalid value #{value}. Valid values are FollowLinksNoPageCrawl, CrawlComplexUrls, CrawlAsHTTP") - end - end - end - munge do |value| - Array(value) - end - end - - # Name: AuthenticationCredentials - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_authenticationcredentials) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "AuthenticationCredentials - The credentials used for this crawl rule (used for types BasicAccountRuleAccess and NTLMAccountRuleAccess)" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("AuthenticationCredentials", value) - end - end - - # Name: CertificateName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_certificatename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CertificateName - The certificate used for this crawl rule (used for type CertificateRuleAccess)" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present if the crawl rule should exist, absent if it should not Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spsearchcrawlrule).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spsearchfiletype.rb b/lib/puppet/type/dsc_spsearchfiletype.rb deleted file mode 100644 index 48258206..00000000 --- a/lib/puppet/type/dsc_spsearchfiletype.rb +++ /dev/null @@ -1,184 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spsearchfiletype) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPSearchFileType resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPSearchFileType/MSFT_SPSearchFileType.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_filetype is a required attribute') if self[:dsc_filetype].nil? - fail('dsc_serviceappname is a required attribute') if self[:dsc_serviceappname].nil? - end - - def dscmeta_resource_friendly_name; 'SPSearchFileType' end - def dscmeta_resource_name; 'MSFT_SPSearchFileType' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: FileType - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_filetype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FileType - The name of the file type" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ServiceAppName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_serviceappname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServiceAppName - The name of the search service application" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Description - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_description) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Description - The description of the file type" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MimeType - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_mimetype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MimeType - The mime type of the file type" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Enabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_enabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Enabled - The state of the file type" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present if the file type should exist, absent if it should not Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spsearchfiletype).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spsearchindexpartition.rb b/lib/puppet/type/dsc_spsearchindexpartition.rb deleted file mode 100644 index d3c90c6e..00000000 --- a/lib/puppet/type/dsc_spsearchindexpartition.rb +++ /dev/null @@ -1,154 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spsearchindexpartition) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPSearchIndexPartition resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPSearchIndexPartition/MSFT_SPSearchIndexPartition.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_index is a required attribute') if self[:dsc_index].nil? - fail('dsc_serviceappname is a required attribute') if self[:dsc_serviceappname].nil? - end - - def dscmeta_resource_friendly_name; 'SPSearchIndexPartition' end - def dscmeta_resource_name; 'MSFT_SPSearchIndexPartition' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Index - # Type: uint32 - # IsMandatory: True - # Values: None - newparam(:dsc_index) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "Index - The number of the partition in this farm" - isrequired - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: Servers - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_servers, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Servers - A list of the servers that this partition should exist on" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: RootDirectory - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_rootdirectory) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RootDirectory - The directory that the index should use locally on each server to store data" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ServiceAppName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_serviceappname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServiceAppName - The name of the search service application" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spsearchindexpartition).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spsearchresultsource.rb b/lib/puppet/type/dsc_spsearchresultsource.rb deleted file mode 100644 index f34dc22d..00000000 --- a/lib/puppet/type/dsc_spsearchresultsource.rb +++ /dev/null @@ -1,184 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spsearchresultsource) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPSearchResultSource resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPSearchResultSource/MSFT_SPSearchResultSource.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPSearchResultSource' end - def dscmeta_resource_name; 'MSFT_SPSearchResultSource' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the result source" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SearchServiceAppName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_searchserviceappname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SearchServiceAppName - The name of the search service application to associate this result source with" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Query - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_query) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Query - The query to pass to the provider source" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ProviderType - # Type: string - # IsMandatory: False - # Values: ["Exchange Search Provider", "Local People Provider", "Local SharePoint Provider", "OpenSearch Provider", "Remote People Provider", "Remote SharePoint Provider"] - newparam(:dsc_providertype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProviderType - The provider type to use for the result source Valid values are Exchange Search Provider, Local People Provider, Local SharePoint Provider, OpenSearch Provider, Remote People Provider, Remote SharePoint Provider." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Exchange Search Provider', 'exchange search provider', 'Local People Provider', 'local people provider', 'Local SharePoint Provider', 'local sharepoint provider', 'OpenSearch Provider', 'opensearch provider', 'Remote People Provider', 'remote people provider', 'Remote SharePoint Provider', 'remote sharepoint provider'].include?(value) - fail("Invalid value '#{value}'. Valid values are Exchange Search Provider, Local People Provider, Local SharePoint Provider, OpenSearch Provider, Remote People Provider, Remote SharePoint Provider") - end - end - end - - # Name: ConnectionUrl - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_connectionurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ConnectionUrl - The URI to connect to the remote location" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present if the result source should exist, absent if it should not Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spsearchresultsource).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spsearchserviceapp.rb b/lib/puppet/type/dsc_spsearchserviceapp.rb deleted file mode 100644 index b036c741..00000000 --- a/lib/puppet/type/dsc_spsearchserviceapp.rb +++ /dev/null @@ -1,244 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spsearchserviceapp) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPSearchServiceApp resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPSearchServiceApp/MSFT_SPSearchServiceApp.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPSearchServiceApp' end - def dscmeta_resource_name; 'MSFT_SPSearchServiceApp' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the search service application" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ProxyName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_proxyname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProxyName - The proxy name, if not specified will be /Name of service app/ Proxy" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ApplicationPool - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_applicationpool) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ApplicationPool - The application pool that it should run in" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SearchCenterUrl - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_searchcenterurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SearchCenterUrl - The URL of the enterprise search center site collection" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databasename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseName - The name of the database (noting that some search databases will use this as a prefix)" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databaseserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseServer - The server that host the databases for this service application" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DefaultContentAccessAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_defaultcontentaccessaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "DefaultContentAccessAccount - The default content access account for this search service app" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("DefaultContentAccessAccount", value) - end - end - - # Name: CloudIndex - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_cloudindex) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "CloudIndex - Should this search service application be a cloud based service app" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present if the service app should exist, absent if it should not Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: WindowsServiceAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_windowsserviceaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "WindowsServiceAccount - Sets the windows services for search to run as this account" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("WindowsServiceAccount", value) - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spsearchserviceapp).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spsearchtopology.rb b/lib/puppet/type/dsc_spsearchtopology.rb deleted file mode 100644 index 17289a4e..00000000 --- a/lib/puppet/type/dsc_spsearchtopology.rb +++ /dev/null @@ -1,224 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spsearchtopology) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPSearchTopology resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPSearchTopology/MSFT_SPSearchTopology.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_serviceappname is a required attribute') if self[:dsc_serviceappname].nil? - end - - def dscmeta_resource_friendly_name; 'SPSearchTopology' end - def dscmeta_resource_name; 'MSFT_SPSearchTopology' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: ServiceAppName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_serviceappname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServiceAppName - The name of the search service application for this topology" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Admin - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_admin, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Admin - A list of servers that will run the admin component" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: Crawler - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_crawler, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Crawler - A list of servers that will run the crawler component" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: ContentProcessing - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_contentprocessing, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ContentProcessing - A list of servers that will run the content processing component" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: AnalyticsProcessing - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_analyticsprocessing, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "AnalyticsProcessing - A list of servers that will run the analytics processing component" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: QueryProcessing - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_queryprocessing, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "QueryProcessing - A list of servers that will run the query processing component" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: IndexPartition - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_indexpartition, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "IndexPartition - A list of servers that will host the first (0) index partition" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: FirstPartitionDirectory - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_firstpartitiondirectory) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FirstPartitionDirectory - The local directory servers will use to store the first index partition" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spsearchtopology).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spsecurestoreserviceapp.rb b/lib/puppet/type/dsc_spsecurestoreserviceapp.rb deleted file mode 100644 index 0010ba6d..00000000 --- a/lib/puppet/type/dsc_spsecurestoreserviceapp.rb +++ /dev/null @@ -1,296 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spsecurestoreserviceapp) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPSecureStoreServiceApp resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPSecureStoreServiceApp/MSFT_SPSecureStoreServiceApp.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPSecureStoreServiceApp' end - def dscmeta_resource_name; 'MSFT_SPSecureStoreServiceApp' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the secure store service app" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ProxyName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_proxyname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProxyName - The proxy name, if not specified will be /Name of service app/ Proxy" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ApplicationPool - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_applicationpool) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ApplicationPool - The name of the application pool it will run in" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AuditingEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_auditingenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AuditingEnabled - Is auditing enabled for this service app" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AuditlogMaxSize - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_auditlogmaxsize) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "AuditlogMaxSize - What is the maximum size of the audit log in MB" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: DatabaseCredentials - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_databasecredentials) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "DatabaseCredentials - What SQL credentials should be used to access the database" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("DatabaseCredentials", value) - end - end - - # Name: DatabaseName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databasename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseName - The name of the database for the service app" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databaseserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseServer - The name of the database server to host the database" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseAuthenticationType - # Type: string - # IsMandatory: False - # Values: ["Windows", "SQL"] - newparam(:dsc_databaseauthenticationtype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseAuthenticationType - What type of authentication should be used to access the database Valid values are Windows, SQL." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Windows', 'windows', 'SQL', 'sql'].include?(value) - fail("Invalid value '#{value}'. Valid values are Windows, SQL") - end - end - end - - # Name: FailoverDatabaseServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_failoverdatabaseserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FailoverDatabaseServer - The name of the database server hosting a failover instance of the database" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: PartitionMode - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_partitionmode) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "PartitionMode - Is partition mode enabled for this service app" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Sharing - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_sharing) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Sharing - Is sharing enabled for this service app" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present if the service app should exist, absent if it should not Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spsecurestoreserviceapp).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spserviceapppool.rb b/lib/puppet/type/dsc_spserviceapppool.rb deleted file mode 100644 index f86feeee..00000000 --- a/lib/puppet/type/dsc_spserviceapppool.rb +++ /dev/null @@ -1,136 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spserviceapppool) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPServiceAppPool resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPServiceAppPool/MSFT_SPServiceAppPool.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPServiceAppPool' end - def dscmeta_resource_name; 'MSFT_SPServiceAppPool' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of application pool" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ServiceAccount - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_serviceaccount) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServiceAccount - The name of the managed account to run this service account as" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present if the service app pool should exist, absent if it should not Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spserviceapppool).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spserviceappproxygroup.rb b/lib/puppet/type/dsc_spserviceappproxygroup.rb deleted file mode 100644 index 357c9e53..00000000 --- a/lib/puppet/type/dsc_spserviceappproxygroup.rb +++ /dev/null @@ -1,175 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spserviceappproxygroup) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPServiceAppProxyGroup resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPServiceAppProxyGroup/MSFT_SPServiceAppProxyGroup.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPServiceAppProxyGroup' end - def dscmeta_resource_name; 'MSFT_SPServiceAppProxyGroup' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Name of the Proxy Group to create" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present creates the proxy group if it does not already exist, Absent will delete the proxy group if it exists Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: ServiceAppProxies - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_serviceappproxies, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ServiceAppProxies - List of service application proxies that belong in this proxy group, all others will be removed" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: ServiceAppProxiesToInclude - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_serviceappproxiestoinclude, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ServiceAppProxiesToInclude - List of service application proxies to add to this proxy group, existing proxies will remain" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: ServiceAppProxiesToExclude - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_serviceappproxiestoexclude, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ServiceAppProxiesToExclude - List of service application proxies to remove from this proxy grop, all others will remain" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spserviceappproxygroup).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spserviceappsecurity.rb b/lib/puppet/type/dsc_spserviceappsecurity.rb deleted file mode 100644 index 7523254d..00000000 --- a/lib/puppet/type/dsc_spserviceappsecurity.rb +++ /dev/null @@ -1,218 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spserviceappsecurity) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - class PuppetX::Dsc::TypeHelpers - def self.validate_MSFT_SPServiceAppSecurityEntry(mof_type_map, name, value) - required = ['accesslevel'] - allowed = ['username'] - lowkey_hash = Hash[value.map { |k, v| [k.to_s.downcase, v] }] - - missing = required - lowkey_hash.keys - unless missing.empty? - fail "#{name} is missing the following required keys: #{missing.join(',')}" - end - - extraneous = lowkey_hash.keys - required - allowed - unless extraneous.empty? - fail "#{name} includes invalid keys: #{extraneous.join(',')}" - end - - lowkey_hash.keys.each do |key| - if lowkey_hash[key] - validate_mof_type(mof_type_map[key], 'MSFT_SPServiceAppSecurityEntry', key, lowkey_hash[key]) - end - end - end - end - - @doc = %q{ - The DSC SPServiceAppSecurity resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPServiceAppSecurity/MSFT_SPServiceAppSecurity.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_serviceappname is a required attribute') if self[:dsc_serviceappname].nil? - fail('dsc_securitytype is a required attribute') if self[:dsc_securitytype].nil? - end - - def dscmeta_resource_friendly_name; 'SPServiceAppSecurity' end - def dscmeta_resource_name; 'MSFT_SPServiceAppSecurity' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: ServiceAppName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_serviceappname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServiceAppName - The name of the service application you wish to apply security settings to" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SecurityType - # Type: string - # IsMandatory: True - # Values: ["Administrators", "SharingPermissions"] - newparam(:dsc_securitytype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SecurityType - Administrators will set the administrators for the service app, SharingPermissions will set those granted access through the permissions button seen in the Sharing section of the ribbon in central admin Valid values are Administrators, SharingPermissions." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Administrators', 'administrators', 'SharingPermissions', 'sharingpermissions'].include?(value) - fail("Invalid value '#{value}'. Valid values are Administrators, SharingPermissions") - end - end - end - - # Name: Members - # Type: MSFT_SPServiceAppSecurityEntry[] - # IsMandatory: False - # Values: None - newparam(:dsc_members, :array_matching => :all) do - def mof_type; 'MSFT_SPServiceAppSecurityEntry[]' end - def mof_is_embedded?; true end - def mof_type_map - {"username"=>{:type=>"string"}, "accesslevel"=>{:type=>"string", :values=>["Change Permissions", "Full Control", "Write", "Read"]}} - end - desc "Members - A list of members to set the group to. Those not in this list will be removed" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be an array of hashes or a hash") - end - (value.kind_of?(Hash) ? [value] : value).each_with_index do |v, i| - fail "Members value at index #{i} should be a Hash" unless v.is_a? Hash - - PuppetX::Dsc::TypeHelpers.validate_MSFT_SPServiceAppSecurityEntry(mof_type_map, "Members", v) - end - end - munge do |value| - value.kind_of?(Hash) ? - [PuppetX::Dsc::TypeHelpers.munge_embeddedinstance(mof_type_map, value)] : - value.map { |v| PuppetX::Dsc::TypeHelpers.munge_embeddedinstance(mof_type_map, v) } - end - end - - # Name: MembersToInclude - # Type: MSFT_SPServiceAppSecurityEntry[] - # IsMandatory: False - # Values: None - newparam(:dsc_memberstoinclude, :array_matching => :all) do - def mof_type; 'MSFT_SPServiceAppSecurityEntry[]' end - def mof_is_embedded?; true end - def mof_type_map - {"username"=>{:type=>"string"}, "accesslevel"=>{:type=>"string", :values=>["Change Permissions", "Full Control", "Write", "Read"]}} - end - desc "MembersToInclude - A list of members to add. Members not in this list will be left in the group" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be an array of hashes or a hash") - end - (value.kind_of?(Hash) ? [value] : value).each_with_index do |v, i| - fail "MembersToInclude value at index #{i} should be a Hash" unless v.is_a? Hash - - PuppetX::Dsc::TypeHelpers.validate_MSFT_SPServiceAppSecurityEntry(mof_type_map, "MembersToInclude", v) - end - end - munge do |value| - value.kind_of?(Hash) ? - [PuppetX::Dsc::TypeHelpers.munge_embeddedinstance(mof_type_map, value)] : - value.map { |v| PuppetX::Dsc::TypeHelpers.munge_embeddedinstance(mof_type_map, v) } - end - end - - # Name: MembersToExclude - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_memberstoexclude, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "MembersToExclude - A list of members to remove. Members not in this list will be left in the group" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spserviceappsecurity).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spserviceinstance.rb b/lib/puppet/type/dsc_spserviceinstance.rb deleted file mode 100644 index 3efe3bb4..00000000 --- a/lib/puppet/type/dsc_spserviceinstance.rb +++ /dev/null @@ -1,121 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spserviceinstance) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPServiceInstance resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPServiceInstance/MSFT_SPServiceInstance.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPServiceInstance' end - def dscmeta_resource_name; 'MSFT_SPServiceInstance' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the service instance to manage" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present to ensure it runs on this server, or absent to ensure it is stopped Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spserviceinstance).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spsessionstateservice.rb b/lib/puppet/type/dsc_spsessionstateservice.rb deleted file mode 100644 index 17e5702b..00000000 --- a/lib/puppet/type/dsc_spsessionstateservice.rb +++ /dev/null @@ -1,156 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spsessionstateservice) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPSessionStateService resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPSessionStateService/MSFT_SPSessionStateService.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_databasename is a required attribute') if self[:dsc_databasename].nil? - fail('dsc_databaseserver is a required attribute') if self[:dsc_databaseserver].nil? - end - - def dscmeta_resource_friendly_name; 'SPSessionStateService' end - def dscmeta_resource_name; 'MSFT_SPSessionStateService' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: DatabaseName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_databasename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseName - The name of the database for the service" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseServer - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_databaseserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseServer - The name of the database server for the database" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present is the state service should be enabled, absent if it should be disabled Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: SessionTimeout - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_sessiontimeout) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "SessionTimeout - What is the timeout on sessions" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spsessionstateservice).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spshelladmins.rb b/lib/puppet/type/dsc_spshelladmins.rb deleted file mode 100644 index 83402294..00000000 --- a/lib/puppet/type/dsc_spshelladmins.rb +++ /dev/null @@ -1,222 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spshelladmins) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - class PuppetX::Dsc::TypeHelpers - def self.validate_MSFT_SPContentDatabasePermissions(mof_type_map, name, value) - required = [] - allowed = ['name','members','memberstoinclude','memberstoexclude'] - lowkey_hash = Hash[value.map { |k, v| [k.to_s.downcase, v] }] - - missing = required - lowkey_hash.keys - unless missing.empty? - fail "#{name} is missing the following required keys: #{missing.join(',')}" - end - - extraneous = lowkey_hash.keys - required - allowed - unless extraneous.empty? - fail "#{name} includes invalid keys: #{extraneous.join(',')}" - end - - lowkey_hash.keys.each do |key| - if lowkey_hash[key] - validate_mof_type(mof_type_map[key], 'MSFT_SPContentDatabasePermissions', key, lowkey_hash[key]) - end - end - end - end - - @doc = %q{ - The DSC SPShellAdmins resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPShellAdmins/MSFT_SPShellAdmins.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPShellAdmins' end - def dscmeta_resource_name; 'MSFT_SPShellAdmins' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Name for the config, used for administration purposes" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Members - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_members, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Members - Exact list of accounts that will have to get Shell Admin permissions" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: MembersToInclude - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_memberstoinclude, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "MembersToInclude - List of all accounts that must be in the Shell Admins group" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: MembersToExclude - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_memberstoexclude, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "MembersToExclude - List of all accounts that are not allowed to have Shell Admin permissions" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: ContentDatabases - # Type: MSFT_SPContentDatabasePermissions[] - # IsMandatory: False - # Values: None - newparam(:dsc_contentdatabases, :array_matching => :all) do - def mof_type; 'MSFT_SPContentDatabasePermissions[]' end - def mof_is_embedded?; true end - def mof_type_map - {"name"=>{:type=>"string"}, "members"=>{:type=>"string[]"}, "memberstoinclude"=>{:type=>"string[]"}, "memberstoexclude"=>{:type=>"string[]"}} - end - desc "ContentDatabases - Shell Admin configuration of Content Databases" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be an array of hashes or a hash") - end - (value.kind_of?(Hash) ? [value] : value).each_with_index do |v, i| - fail "ContentDatabases value at index #{i} should be a Hash" unless v.is_a? Hash - - PuppetX::Dsc::TypeHelpers.validate_MSFT_SPContentDatabasePermissions(mof_type_map, "ContentDatabases", v) - end - end - munge do |value| - value.kind_of?(Hash) ? - [PuppetX::Dsc::TypeHelpers.munge_embeddedinstance(mof_type_map, value)] : - value.map { |v| PuppetX::Dsc::TypeHelpers.munge_embeddedinstance(mof_type_map, v) } - end - end - - # Name: AllContentDatabases - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allcontentdatabases) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllContentDatabases - Specify if all content databases must get the same config as the general config" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spshelladmins).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spsite.rb b/lib/puppet/type/dsc_spsite.rb deleted file mode 100644 index 3f572db7..00000000 --- a/lib/puppet/type/dsc_spsite.rb +++ /dev/null @@ -1,287 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spsite) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPSite resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPSite/MSFT_SPSite.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_url is a required attribute') if self[:dsc_url].nil? - end - - def dscmeta_resource_friendly_name; 'SPSite' end - def dscmeta_resource_name; 'MSFT_SPSite' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Url - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_url) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Url - The URL of the site collection" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: OwnerAlias - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_owneralias) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "OwnerAlias - The username of the site collection administrator" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CompatibilityLevel - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_compatibilitylevel) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "CompatibilityLevel - The compatibility level of the site" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ContentDatabase - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_contentdatabase) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ContentDatabase - The name of the content database to create the site in" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Description - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_description) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Description - The description to apply to the site collection" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: HostHeaderWebApplication - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_hostheaderwebapplication) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "HostHeaderWebApplication - The URL of the host header web application to create this site in" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Language - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_language) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "Language - The language code of the site" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: Name - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The display name of the site collection" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: OwnerEmail - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_owneremail) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "OwnerEmail - The email address of the site collection administrator" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: QuotaTemplate - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_quotatemplate) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "QuotaTemplate - The quota template to apply to the site collection" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SecondaryEmail - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_secondaryemail) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SecondaryEmail - The secondary site collection admin email address" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SecondaryOwnerAlias - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_secondaryowneralias) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SecondaryOwnerAlias - The secondary site collection admin username" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Template - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_template) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Template - The template to apply to the site collection" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spsite).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spstateserviceapp.rb b/lib/puppet/type/dsc_spstateserviceapp.rb deleted file mode 100644 index 39721587..00000000 --- a/lib/puppet/type/dsc_spstateserviceapp.rb +++ /dev/null @@ -1,167 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spstateserviceapp) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPStateServiceApp resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPStateServiceApp/MSFT_SPStateServiceApp.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPStateServiceApp' end - def dscmeta_resource_name; 'MSFT_SPStateServiceApp' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the state service app" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseCredentials - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_databasecredentials) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "DatabaseCredentials - The database credentials for accessing the database" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("DatabaseCredentials", value) - end - end - - # Name: DatabaseName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databasename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseName - The name of the database for the service app" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databaseserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseServer - The name of the database server" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present if the service app should exist, absent if it should not Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spstateserviceapp).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spsubscriptionsettingsserviceapp.rb b/lib/puppet/type/dsc_spsubscriptionsettingsserviceapp.rb deleted file mode 100644 index 9fb14e56..00000000 --- a/lib/puppet/type/dsc_spsubscriptionsettingsserviceapp.rb +++ /dev/null @@ -1,166 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spsubscriptionsettingsserviceapp) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPSubscriptionSettingsServiceApp resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPSubscriptionSettingsServiceApp/MSFT_SPSubscriptionSettingsServiceApp.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPSubscriptionSettingsServiceApp' end - def dscmeta_resource_name; 'MSFT_SPSubscriptionSettingsServiceApp' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the subscription settings service app" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ApplicationPool - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_applicationpool) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ApplicationPool - The name of the application pool the service app runs in" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databasename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseName - The name of the database for the service app" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databaseserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseServer - The name of the database server" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present if the service app should exist, absent if it should not Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spsubscriptionsettingsserviceapp).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_sptimerjobstate.rb b/lib/puppet/type/dsc_sptimerjobstate.rb deleted file mode 100644 index 826fb18d..00000000 --- a/lib/puppet/type/dsc_sptimerjobstate.rb +++ /dev/null @@ -1,147 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_sptimerjobstate) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPTimerJobState resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPTimerJobState/MSFT_SPTimerJobState.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPTimerJobState' end - def dscmeta_resource_name; 'MSFT_SPTimerJobState' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The internal name of the timer job (not the display name)" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: WebApplication - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_webapplication) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WebApplication - The name of the web application that the timer job belongs to" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Enabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_enabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Enabled - Should the timer job be enabled or not" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Schedule - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_schedule) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Schedule - The schedule for the timer job to execute on" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_sptimerjobstate).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_sptrustedidentitytokenissuer.rb b/lib/puppet/type/dsc_sptrustedidentitytokenissuer.rb deleted file mode 100644 index 95f7f5fe..00000000 --- a/lib/puppet/type/dsc_sptrustedidentitytokenissuer.rb +++ /dev/null @@ -1,292 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_sptrustedidentitytokenissuer) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - class PuppetX::Dsc::TypeHelpers - def self.validate_MSFT_SPClaimTypeMapping(mof_type_map, name, value) - required = ['incomingclaimtype'] - allowed = ['name','localclaimtype'] - lowkey_hash = Hash[value.map { |k, v| [k.to_s.downcase, v] }] - - missing = required - lowkey_hash.keys - unless missing.empty? - fail "#{name} is missing the following required keys: #{missing.join(',')}" - end - - extraneous = lowkey_hash.keys - required - allowed - unless extraneous.empty? - fail "#{name} includes invalid keys: #{extraneous.join(',')}" - end - - lowkey_hash.keys.each do |key| - if lowkey_hash[key] - validate_mof_type(mof_type_map[key], 'MSFT_SPClaimTypeMapping', key, lowkey_hash[key]) - end - end - end - end - - @doc = %q{ - The DSC SPTrustedIdentityTokenIssuer resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuer/MSFT_SPTrustedIdentityTokenIssuer.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPTrustedIdentityTokenIssuer' end - def dscmeta_resource_name; 'MSFT_SPTrustedIdentityTokenIssuer' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Name of the SPTrustedIdentityTokenIssuer" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Description - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_description) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Description - Description of the SPTrustedIdentityTokenIssuer" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Realm - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_realm) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Realm - Default Realm that is passed to identity provider" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SignInUrl - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_signinurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SignInUrl - URL of the identity provider where user is redirected to for authentication" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: IdentifierClaim - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_identifierclaim) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IdentifierClaim - Identity claim type that uniquely identifies the user" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ClaimsMappings - # Type: MSFT_SPClaimTypeMapping[] - # IsMandatory: False - # Values: None - newparam(:dsc_claimsmappings, :array_matching => :all) do - def mof_type; 'MSFT_SPClaimTypeMapping[]' end - def mof_is_embedded?; true end - def mof_type_map - {"name"=>{:type=>"string"}, "incomingclaimtype"=>{:type=>"string"}, "localclaimtype"=>{:type=>"string"}} - end - desc "ClaimsMappings - Array of MSFT_SPClaimTypeMapping to use with cmdlet New-SPClaimTypeMapping" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be an array of hashes or a hash") - end - (value.kind_of?(Hash) ? [value] : value).each_with_index do |v, i| - fail "ClaimsMappings value at index #{i} should be a Hash" unless v.is_a? Hash - - PuppetX::Dsc::TypeHelpers.validate_MSFT_SPClaimTypeMapping(mof_type_map, "ClaimsMappings", v) - end - end - munge do |value| - value.kind_of?(Hash) ? - [PuppetX::Dsc::TypeHelpers.munge_embeddedinstance(mof_type_map, value)] : - value.map { |v| PuppetX::Dsc::TypeHelpers.munge_embeddedinstance(mof_type_map, v) } - end - end - - # Name: SigningCertificateThumbprint - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_signingcertificatethumbprint) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SigningCertificateThumbprint - Specify the thumbprint of the signing certificate, which must be located in certificate store LocalMachine\\My" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SigningCertificateFilePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_signingcertificatefilepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SigningCertificateFilePath - Specify the file path to the signing certificate if it is not stored in the local certificate store already" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ClaimProviderName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_claimprovidername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ClaimProviderName - Name of a claims provider to set with this SPTrustedIdentityTokenIssuer" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ProviderSignOutUri - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_providersignouturi) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProviderSignOutUri - Sign-out URL" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present if the SPTrustedIdentityTokenIssuer should be created, or Absent if it should be removed Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_sptrustedidentitytokenissuer).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_sptrustedrootauthority.rb b/lib/puppet/type/dsc_sptrustedrootauthority.rb deleted file mode 100644 index f9a34afa..00000000 --- a/lib/puppet/type/dsc_sptrustedrootauthority.rb +++ /dev/null @@ -1,136 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_sptrustedrootauthority) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPTrustedRootAuthority resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPTrustedRootAuthority/MSFT_SPTrustedRootAuthority.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPTrustedRootAuthority' end - def dscmeta_resource_name; 'MSFT_SPTrustedRootAuthority' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Specifies the name of the trusted root authority to create." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CertificateThumbprint - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_certificatethumbprint) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CertificateThumbprint - Specifies the X.509 certificate of the trusted root authority, as a certificate thumbprint." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present ensures service app exists, absent ensures it is removed Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_sptrustedrootauthority).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spusageapplication.rb b/lib/puppet/type/dsc_spusageapplication.rb deleted file mode 100644 index d9263aa8..00000000 --- a/lib/puppet/type/dsc_spusageapplication.rb +++ /dev/null @@ -1,251 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spusageapplication) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPUsageApplication resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPUsageApplication/MSFT_SPUsageApplication.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPUsageApplication' end - def dscmeta_resource_name; 'MSFT_SPUsageApplication' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the service application" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databasename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseName - The name of the database for the service app" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databaseserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseServer - The name of the database server" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseCredentials - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_databasecredentials) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "DatabaseCredentials - The credentials to use to access the database" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("DatabaseCredentials", value) - end - end - - # Name: FailoverDatabaseServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_failoverdatabaseserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FailoverDatabaseServer - The name of the failover database server" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UsageLogCutTime - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_usagelogcuttime) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "UsageLogCutTime - The time in minutes to cut over to new log files" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: UsageLogLocation - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_usageloglocation) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UsageLogLocation - The location on each server to store the log files" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UsageLogMaxFileSizeKB - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_usagelogmaxfilesizekb) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "UsageLogMaxFileSizeKB - The maximum file size for log files in KB" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: UsageLogMaxSpaceGB - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_usagelogmaxspacegb) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "UsageLogMaxSpaceGB - The total space of all log files on disk in GB" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present if the service app should exist, absent if it should not Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spusageapplication).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spuserprofileproperty.rb b/lib/puppet/type/dsc_spuserprofileproperty.rb deleted file mode 100644 index 3f99bae2..00000000 --- a/lib/puppet/type/dsc_spuserprofileproperty.rb +++ /dev/null @@ -1,458 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spuserprofileproperty) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPUserProfileProperty resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPUserProfileProperty/MSFT_SPUserProfileProperty.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPUserProfileProperty' end - def dscmeta_resource_name; 'MSFT_SPUserProfileProperty' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The internal name of the user profile property" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present if the property should exist, absent if it should be removed Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: UserProfileService - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_userprofileservice) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UserProfileService - The name of the user profile service application" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DisplayName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_displayname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DisplayName - The display name of the property" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Type - # Type: string - # IsMandatory: False - # Values: ["BigInteger", "Binary", "Boolean", "Date", "DateNoYear", "DateTime", "Email", "Float", "Guid", "HTML", "Integer", "Person", "String", "StringMultiValue", "TimeZone", "URL"] - newparam(:dsc_type) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Type - The type of the property Valid values are BigInteger, Binary, Boolean, Date, DateNoYear, DateTime, Email, Float, Guid, HTML, Integer, Person, String, StringMultiValue, TimeZone, URL." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['BigInteger', 'biginteger', 'Binary', 'binary', 'Boolean', 'boolean', 'Date', 'date', 'DateNoYear', 'datenoyear', 'DateTime', 'datetime', 'Email', 'email', 'Float', 'float', 'Guid', 'guid', 'HTML', 'html', 'Integer', 'integer', 'Person', 'person', 'String', 'string', 'StringMultiValue', 'stringmultivalue', 'TimeZone', 'timezone', 'URL', 'url'].include?(value) - fail("Invalid value '#{value}'. Valid values are BigInteger, Binary, Boolean, Date, DateNoYear, DateTime, Email, Float, Guid, HTML, Integer, Person, String, StringMultiValue, TimeZone, URL") - end - end - end - - # Name: Description - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_description) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Description - The description of the property" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: PolicySetting - # Type: string - # IsMandatory: False - # Values: ["Mandatory", "Optin", "Optout", "Disabled"] - newparam(:dsc_policysetting) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "PolicySetting - The policy setting to apply to the property Valid values are Mandatory, Optin, Optout, Disabled." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Mandatory', 'mandatory', 'Optin', 'optin', 'Optout', 'optout', 'Disabled', 'disabled'].include?(value) - fail("Invalid value '#{value}'. Valid values are Mandatory, Optin, Optout, Disabled") - end - end - end - - # Name: PrivacySetting - # Type: string - # IsMandatory: False - # Values: ["Public", "Contacts", "Organization", "Manager", "Private"] - newparam(:dsc_privacysetting) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "PrivacySetting - The privacy setting for the property Valid values are Public, Contacts, Organization, Manager, Private." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Public', 'public', 'Contacts', 'contacts', 'Organization', 'organization', 'Manager', 'manager', 'Private', 'private'].include?(value) - fail("Invalid value '#{value}'. Valid values are Public, Contacts, Organization, Manager, Private") - end - end - end - - # Name: MappingConnectionName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_mappingconnectionname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MappingConnectionName - The name of the UPS connect to map this property to" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MappingPropertyName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_mappingpropertyname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MappingPropertyName - The name of the property from the UPS connection to map to" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MappingDirection - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_mappingdirection) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MappingDirection - The direction of the mapping, either Import or Export" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Length - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_length) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "Length - The length of the field" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: DisplayOrder - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_displayorder) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "DisplayOrder - The display order to put the property in to the list at" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: IsEventLog - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_iseventlog) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "IsEventLog - Is this field used for event logging" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: IsVisibleOnEditor - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_isvisibleoneditor) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "IsVisibleOnEditor - Is this field visible when editing a users profile, or hidden from editing" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: IsVisibleOnViewer - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_isvisibleonviewer) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "IsVisibleOnViewer - Is this field visible when viewing a users profile" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: IsUserEditable - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_isusereditable) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "IsUserEditable - Is this field able to be edited by a user, or only an administrator" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: IsAlias - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_isalias) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "IsAlias - Is this field an alias that can be used to refer to a user by" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: IsSearchable - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_issearchable) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "IsSearchable - Is this field able to be searched upon" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: UserOverridePrivacy - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_useroverrideprivacy) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "UserOverridePrivacy - Can users override the default privacy policy" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: TermStore - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_termstore) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TermStore - The name of the term store to look up managed terms from" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: TermGroup - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_termgroup) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TermGroup - The name of the term store group that terms are in for this field" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: TermSet - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_termset) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TermSet - The name of the term set to allow values to be selected from" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spuserprofileproperty).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spuserprofilesection.rb b/lib/puppet/type/dsc_spuserprofilesection.rb deleted file mode 100644 index e47bdaaa..00000000 --- a/lib/puppet/type/dsc_spuserprofilesection.rb +++ /dev/null @@ -1,169 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spuserprofilesection) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPUserProfileSection resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPUserProfileSection/MSFT_SPUserProfileSection.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPUserProfileSection' end - def dscmeta_resource_name; 'MSFT_SPUserProfileSection' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The internal name of the user profile section" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present if the section should exist, absent if it should be removed Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: UserProfileService - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_userprofileservice) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UserProfileService - The name of the user profile service application this section exists in" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DisplayName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_displayname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DisplayName - The display name of the section" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DisplayOrder - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_displayorder) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "DisplayOrder - A number used to sort sections by" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spuserprofilesection).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spuserprofileserviceapp.rb b/lib/puppet/type/dsc_spuserprofileserviceapp.rb deleted file mode 100644 index b64a5fd3..00000000 --- a/lib/puppet/type/dsc_spuserprofileserviceapp.rb +++ /dev/null @@ -1,304 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spuserprofileserviceapp) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPUserProfileServiceApp resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/MSFT_SPUserProfileServiceApp.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPUserProfileServiceApp' end - def dscmeta_resource_name; 'MSFT_SPUserProfileServiceApp' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the user profile service" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ProxyName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_proxyname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProxyName - The proxy name, if not specified will be /Name of service app/ Proxy" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ApplicationPool - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_applicationpool) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ApplicationPool - The name of the application pool to run the service app in" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: FarmAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_farmaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "FarmAccount - The farm account to use when provisioning the app" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("FarmAccount", value) - end - end - - # Name: MySiteHostLocation - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_mysitehostlocation) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MySiteHostLocation - The URL of the my site host collection" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ProfileDBName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_profiledbname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProfileDBName - The name of the profile database" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ProfileDBServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_profiledbserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProfileDBServer - The name of the server to host the profile database" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SocialDBName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_socialdbname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SocialDBName - The name of the social database" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SocialDBServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_socialdbserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SocialDBServer - The name of the database server to host the social database" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SyncDBName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_syncdbname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SyncDBName - The name of the sync database" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SyncDBServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_syncdbserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SyncDBServer - The name of the database server to host the sync database" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: EnableNetBIOS - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_enablenetbios) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "EnableNetBIOS - Whether Farm should resolve NetBIOS domain names" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: NoILMUsed - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_noilmused) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "NoILMUsed - Specifies if the service application should be configured to use AD Import" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present if the service app should exist, absent if it should not Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spuserprofileserviceapp).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spuserprofileserviceapppermissions.rb b/lib/puppet/type/dsc_spuserprofileserviceapppermissions.rb deleted file mode 100644 index b368fbe6..00000000 --- a/lib/puppet/type/dsc_spuserprofileserviceapppermissions.rb +++ /dev/null @@ -1,155 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spuserprofileserviceapppermissions) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPUserProfileServiceAppPermissions resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPUserProfileServiceAppPermissions/MSFT_SPUserProfileServiceAppPermissions.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_proxyname is a required attribute') if self[:dsc_proxyname].nil? - end - - def dscmeta_resource_friendly_name; 'SPUserProfileServiceAppPermissions' end - def dscmeta_resource_name; 'MSFT_SPUserProfileServiceAppPermissions' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: ProxyName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_proxyname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProxyName - The name of the proxy that is attached to the user profile service you wish to set permissions for" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CreatePersonalSite - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_createpersonalsite, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "CreatePersonalSite - A list of user principals that will have the Create personal site permission" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: FollowAndEditProfile - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_followandeditprofile, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "FollowAndEditProfile - A list of user principals that will have the Follow users and edit profile permission" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: UseTagsAndNotes - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_usetagsandnotes, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "UseTagsAndNotes - A list of user principals that will have the Use tags and notes permission" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spuserprofileserviceapppermissions).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spuserprofilesyncconnection.rb b/lib/puppet/type/dsc_spuserprofilesyncconnection.rb deleted file mode 100644 index e760da03..00000000 --- a/lib/puppet/type/dsc_spuserprofilesyncconnection.rb +++ /dev/null @@ -1,248 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spuserprofilesyncconnection) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPUserProfileSyncConnection resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPUserProfileSyncConnection/MSFT_SPUserProfileSyncConnection.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPUserProfileSyncConnection' end - def dscmeta_resource_name; 'MSFT_SPUserProfileSyncConnection' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the connection" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Forest - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_forest) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Forest - The name of the AD forest to read from" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UserProfileService - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_userprofileservice) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UserProfileService - The name of the user profile service that this connection is attached to" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ConnectionCredentials - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_connectioncredentials) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "ConnectionCredentials - The credentials to connect to Active Directory with" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("ConnectionCredentials", value) - end - end - - # Name: IncludedOUs - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_includedous, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "IncludedOUs - A list of the OUs to import users from" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: ExcludedOUs - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_excludedous, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ExcludedOUs - A list of the OUs to ignore users from" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: Server - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_server) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Server - The specific AD server to connect to" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UseSSL - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_usessl) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "UseSSL - Should SSL be used for the connection" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Force - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_force) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Force - Set to true to run the set method on every call to this resource" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ConnectionType - # Type: string - # IsMandatory: False - # Values: ["ActiveDirectory", "BusinessDataCatalog"] - newparam(:dsc_connectiontype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ConnectionType - The type of the connection - currently only Active Directory is supported Valid values are ActiveDirectory, BusinessDataCatalog." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['ActiveDirectory', 'activedirectory', 'BusinessDataCatalog', 'businessdatacatalog'].include?(value) - fail("Invalid value '#{value}'. Valid values are ActiveDirectory, BusinessDataCatalog") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spuserprofilesyncconnection).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spuserprofilesyncservice.rb b/lib/puppet/type/dsc_spuserprofilesyncservice.rb deleted file mode 100644 index f74dcf1b..00000000 --- a/lib/puppet/type/dsc_spuserprofilesyncservice.rb +++ /dev/null @@ -1,153 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spuserprofilesyncservice) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPUserProfileSyncService resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPUserProfileSyncService/MSFT_SPUserProfileSyncService.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_userprofileserviceappname is a required attribute') if self[:dsc_userprofileserviceappname].nil? - end - - def dscmeta_resource_friendly_name; 'SPUserProfileSyncService' end - def dscmeta_resource_name; 'MSFT_SPUserProfileSyncService' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: UserProfileServiceAppName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_userprofileserviceappname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UserProfileServiceAppName - The name of the user profile service for this sync instance" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present to ensure the service is running, absent to ensure it is not Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: FarmAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_farmaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "FarmAccount - The farm account, which is needed to provision the service app" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("FarmAccount", value) - end - end - - # Name: RunOnlyWhenWriteable - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_runonlywhenwriteable) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RunOnlyWhenWriteable - Should the sync service only run when the user profile database is in a writeable state?" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spuserprofilesyncservice).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spvisioserviceapp.rb b/lib/puppet/type/dsc_spvisioserviceapp.rb deleted file mode 100644 index 03cf46d0..00000000 --- a/lib/puppet/type/dsc_spvisioserviceapp.rb +++ /dev/null @@ -1,151 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spvisioserviceapp) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPVisioServiceApp resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPVisioServiceApp/MSFT_SPVisioServiceApp.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPVisioServiceApp' end - def dscmeta_resource_name; 'MSFT_SPVisioServiceApp' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the service application" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ApplicationPool - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_applicationpool) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ApplicationPool - The name of the application pool to run the service app in" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ProxyName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_proxyname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProxyName - The name of the Visio Service Application Proxy" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present if the service app should exist, absent if it should not Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spvisioserviceapp).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spweb.rb b/lib/puppet/type/dsc_spweb.rb deleted file mode 100644 index 825cdc75..00000000 --- a/lib/puppet/type/dsc_spweb.rb +++ /dev/null @@ -1,248 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spweb) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPWeb resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPWeb/MSFT_SPWeb.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_url is a required attribute') if self[:dsc_url].nil? - end - - def dscmeta_resource_friendly_name; 'SPWeb' end - def dscmeta_resource_name; 'MSFT_SPWeb' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Url - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_url) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Url - The URL of the web" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present if the web should exist or Absent if it should be removed Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Description - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_description) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Description - The description to apply to the web" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Name - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The Name of the web" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Language - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_language) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "Language - The Lanhuage (LCID) of the web" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: Template - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_template) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Template - The WebTemplate to use to create the web" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UniquePermissions - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_uniquepermissions) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "UniquePermissions - True if the web should have unique permissions, otherwise false." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: UseParentTopNav - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_useparenttopnav) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "UseParentTopNav - True if the web should use the parent nav bar, otherwise false." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AddToQuickLaunch - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_addtoquicklaunch) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AddToQuickLaunch - True if the web should be in the quick launch of the parent web, otherwise false." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AddToTopNav - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_addtotopnav) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AddToTopNav - True if the web should be added to the top nav bar of the parent web, otherwise false." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spweb).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spwebappblockedfiletypes.rb b/lib/puppet/type/dsc_spwebappblockedfiletypes.rb deleted file mode 100644 index 7b836bf2..00000000 --- a/lib/puppet/type/dsc_spwebappblockedfiletypes.rb +++ /dev/null @@ -1,155 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spwebappblockedfiletypes) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPWebAppBlockedFileTypes resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPWebAppBlockedFileTypes/MSFT_SPWebAppBlockedFileTypes.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_url is a required attribute') if self[:dsc_url].nil? - end - - def dscmeta_resource_friendly_name; 'SPWebAppBlockedFileTypes' end - def dscmeta_resource_name; 'MSFT_SPWebAppBlockedFileTypes' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Url - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_url) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Url - The URL of the web application to set blocked file types for" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Blocked - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_blocked, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Blocked - This is a fixed list to use for blocked file types in this web app" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: EnsureBlocked - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_ensureblocked, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "EnsureBlocked - This list of file types that will always be added to the list for this web app. Types not in this list will be left in the list" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: EnsureAllowed - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_ensureallowed, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "EnsureAllowed - This list of file types that will always be removedfrom the list for this web app. Types not in this list will be left in the list" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spwebappblockedfiletypes).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spwebappgeneralsettings.rb b/lib/puppet/type/dsc_spwebappgeneralsettings.rb deleted file mode 100644 index 7e2f3cac..00000000 --- a/lib/puppet/type/dsc_spwebappgeneralsettings.rb +++ /dev/null @@ -1,419 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spwebappgeneralsettings) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPWebAppGeneralSettings resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPWebAppGeneralSettings/MSFT_SPWebAppGeneralSettings.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_url is a required attribute') if self[:dsc_url].nil? - end - - def dscmeta_resource_friendly_name; 'SPWebAppGeneralSettings' end - def dscmeta_resource_name; 'MSFT_SPWebAppGeneralSettings' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Url - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_url) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Url - The URL of the web app to set the general settings for" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: TimeZone - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_timezone) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "TimeZone - The timezone code to use for this web app. A full list is at https://msdn.microsoft.com/en-us/library/office/microsoft.sharepoint.spregionalsettings.timezones.aspx" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: Alerts - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_alerts) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Alerts - Should alerts be enabled for this web app" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AlertsLimit - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_alertslimit) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "AlertsLimit - What is the maximum number of alerts that a user can create in this web app" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: RSS - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_rss) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RSS - Should RSS feeds be enabled in this web app" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: BlogAPI - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_blogapi) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "BlogAPI - Should the Blog API be enabled in this web app" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: BlogAPIAuthenticated - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_blogapiauthenticated) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "BlogAPIAuthenticated - Is authentication required for the blog API" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: BrowserFileHandling - # Type: string - # IsMandatory: False - # Values: ["Strict", "Permissive"] - newparam(:dsc_browserfilehandling) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "BrowserFileHandling - What file handling mode should be used in this web app - strict or permissive Valid values are Strict, Permissive." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Strict', 'strict', 'Permissive', 'permissive'].include?(value) - fail("Invalid value '#{value}'. Valid values are Strict, Permissive") - end - end - end - - # Name: SecurityValidation - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_securityvalidation) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "SecurityValidation - Is security validation enforced in this web app" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: SecurityValidationExpires - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_securityvalidationexpires) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "SecurityValidationExpires - Does security validation expire after a set time" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: SecurityValidationTimeOutMinutes - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_securityvalidationtimeoutminutes) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "SecurityValidationTimeOutMinutes - Number of minutes security validation will expire if securityvalidationexpires is set" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: RecycleBinEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_recyclebinenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RecycleBinEnabled - Is the recycle bin enabled in this web application" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: RecycleBinCleanupEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_recyclebincleanupenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RecycleBinCleanupEnabled - Is automatic cleanup of the recycle bin enabled in this web app" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: RecycleBinRetentionPeriod - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_recyclebinretentionperiod) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "RecycleBinRetentionPeriod - How many days does the recycle bin keep content for" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: SecondStageRecycleBinQuota - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_secondstagerecyclebinquota) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "SecondStageRecycleBinQuota - How much content does the second stage recycle bin keep content for" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MaximumUploadSize - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_maximumuploadsize) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "MaximumUploadSize - What is the maximum file upload size for this web app (in MB)" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: CustomerExperienceProgram - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_customerexperienceprogram) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "CustomerExperienceProgram - Should the customer experience program be enabled in this web app" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AllowOnlineWebPartCatalog - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowonlinewebpartcatalog) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowOnlineWebPartCatalog - Should the Online WebPart Gallery be enabled for this web app" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: SelfServiceSiteCreationEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_selfservicesitecreationenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "SelfServiceSiteCreationEnabled - Should Self Service Site Creation be enabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: PresenceEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_presenceenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "PresenceEnabled - Is Skype for Business presence enabled for this web app" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spwebappgeneralsettings).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spwebapplication.rb b/lib/puppet/type/dsc_spwebapplication.rb deleted file mode 100644 index a7210a43..00000000 --- a/lib/puppet/type/dsc_spwebapplication.rb +++ /dev/null @@ -1,306 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spwebapplication) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPWebApplication resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPWebApplication/MSFT_SPWebApplication.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPWebApplication' end - def dscmeta_resource_name; 'MSFT_SPWebApplication' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the web application" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ApplicationPool - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_applicationpool) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ApplicationPool - The name of the application pool to run this site in" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ApplicationPoolAccount - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_applicationpoolaccount) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ApplicationPoolAccount - The name of the managed account to run the app pool with" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Url - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_url) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Url - The URL of the web application" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AllowAnonymous - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowanonymous) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowAnonymous - Should anonymous access be enabled for this web app" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AuthenticationMethod - # Type: string - # IsMandatory: False - # Values: ["NTLM", "Kerberos", "Claims", "Classic"] - newparam(:dsc_authenticationmethod) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AuthenticationMethod - What authentication mode should be used for the web app Valid values are NTLM, Kerberos, Claims, Classic." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['NTLM', 'ntlm', 'Kerberos', 'kerberos', 'Claims', 'claims', 'Classic', 'classic'].include?(value) - fail("Invalid value '#{value}'. Valid values are NTLM, Kerberos, Claims, Classic") - end - end - end - - # Name: AuthenticationProvider - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_authenticationprovider) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AuthenticationProvider - What authentication provider should be used for the web app. This value is required when AuthenticationMethod is set to Claims" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databasename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseName - The name of the first content database to be created with this web app" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databaseserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseServer - The name of the database server to host the default content DB" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: HostHeader - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_hostheader) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "HostHeader - The host header to use for the web app" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Path - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_path) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Path - The path on the local servers to host the IIS web site from" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Port - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_port) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Port - The port to run the site on" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UseSSL - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_usessl) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "UseSSL - Should this web app use SSL" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present if the web app should exist, absent if it should not Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spwebapplication).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spwebapplicationappdomain.rb b/lib/puppet/type/dsc_spwebapplicationappdomain.rb deleted file mode 100644 index 93c84360..00000000 --- a/lib/puppet/type/dsc_spwebapplicationappdomain.rb +++ /dev/null @@ -1,167 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spwebapplicationappdomain) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPWebApplicationAppDomain resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPWebApplicationAppDomain/MSFT_SPWebApplicationAppDomain.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_webapplication is a required attribute') if self[:dsc_webapplication].nil? - fail('dsc_zone is a required attribute') if self[:dsc_zone].nil? - end - - def dscmeta_resource_friendly_name; 'SPWebApplicationAppDomain' end - def dscmeta_resource_name; 'MSFT_SPWebApplicationAppDomain' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: WebApplication - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_webapplication) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WebApplication - The URL of the web application to set the app domain for" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Zone - # Type: string - # IsMandatory: True - # Values: ["Default", "Internet", "Intranet", "Extranet", "Custom"] - newparam(:dsc_zone) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Zone - The zone that this app domain applies to Valid values are Default, Internet, Intranet, Extranet, Custom." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Default', 'default', 'Internet', 'internet', 'Intranet', 'intranet', 'Extranet', 'extranet', 'Custom', 'custom'].include?(value) - fail("Invalid value '#{value}'. Valid values are Default, Internet, Intranet, Extranet, Custom") - end - end - end - - # Name: AppDomain - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_appdomain) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AppDomain - The domain for apps in this web app zone" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Port - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_port) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Port - The port to run apps on" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SSL - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_ssl) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "SSL - Should apps run under SSL" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spwebapplicationappdomain).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spwebapplicationextension.rb b/lib/puppet/type/dsc_spwebapplicationextension.rb deleted file mode 100644 index 142c468f..00000000 --- a/lib/puppet/type/dsc_spwebapplicationextension.rb +++ /dev/null @@ -1,281 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spwebapplicationextension) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPWebApplicationExtension resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPWebApplicationExtension/MSFT_SPWebApplicationExtension.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_webappurl is a required attribute') if self[:dsc_webappurl].nil? - fail('dsc_zone is a required attribute') if self[:dsc_zone].nil? - end - - def dscmeta_resource_friendly_name; 'SPWebApplicationExtension' end - def dscmeta_resource_name; 'MSFT_SPWebApplicationExtension' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: WebAppUrl - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_webappurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WebAppUrl - The URL of the parent web application" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Name - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the web application extension" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Url - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_url) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Url - The URL of the web application extension" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Zone - # Type: string - # IsMandatory: True - # Values: ["Default", "Intranet", "Internet", "Extranet", "Custom"] - newparam(:dsc_zone) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Zone - Specifies one of the five zones with which the internal URL of this new extension is to be associated. Valid values are Default, Intranet, Internet, Extranet, Custom." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Default', 'default', 'Intranet', 'intranet', 'Internet', 'internet', 'Extranet', 'extranet', 'Custom', 'custom'].include?(value) - fail("Invalid value '#{value}'. Valid values are Default, Intranet, Internet, Extranet, Custom") - end - end - end - - # Name: AllowAnonymous - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowanonymous) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowAnonymous - Should anonymous access be enabled for this web app extension" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AuthenticationMethod - # Type: string - # IsMandatory: False - # Values: ["NTLM", "Kerberos", "Claims"] - newparam(:dsc_authenticationmethod) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AuthenticationMethod - What authentication mode should be used for the web app extension Valid values are NTLM, Kerberos, Claims." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['NTLM', 'ntlm', 'Kerberos', 'kerberos', 'Claims', 'claims'].include?(value) - fail("Invalid value '#{value}'. Valid values are NTLM, Kerberos, Claims") - end - end - end - - # Name: AuthenticationProvider - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_authenticationprovider) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AuthenticationProvider - What authentication provider should be used for the web app. This value is required when AuthenticationMethod is set to Claims" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: HostHeader - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_hostheader) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "HostHeader - The host header to use for the web app extension" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Path - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_path) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Path - The path on the local servers to host the IIS web site from" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Port - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_port) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Port - The port to run the site on" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UseSSL - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_usessl) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "UseSSL - Should this web app extension use SSL" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present if the web app should exist, absent if it should not Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spwebapplicationextension).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spwebapppermissions.rb b/lib/puppet/type/dsc_spwebapppermissions.rb deleted file mode 100644 index 49eef931..00000000 --- a/lib/puppet/type/dsc_spwebapppermissions.rb +++ /dev/null @@ -1,201 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spwebapppermissions) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPWebAppPermissions resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPWebAppPermissions/MSFT_SPWebAppPermissions.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_webappurl is a required attribute') if self[:dsc_webappurl].nil? - end - - def dscmeta_resource_friendly_name; 'SPWebAppPermissions' end - def dscmeta_resource_name; 'MSFT_SPWebAppPermissions' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: WebAppUrl - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_webappurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WebAppUrl - The url of the web application" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ListPermissions - # Type: string[] - # IsMandatory: False - # Values: ["Manage Lists", "Override List Behaviors", "Add Items", "Edit Items", "Delete Items", "View Items", "Approve Items", "Open Items", "View Versions", "Delete Versions", "Create Alerts", "View Application Pages"] - newparam(:dsc_listpermissions, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ListPermissions - List permissions that need to be configured Valid values are Manage Lists, Override List Behaviors, Add Items, Edit Items, Delete Items, View Items, Approve Items, Open Items, View Versions, Delete Versions, Create Alerts, View Application Pages." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - if value.kind_of?(Array) - unless (['Manage Lists', 'manage lists', 'Override List Behaviors', 'override list behaviors', 'Add Items', 'add items', 'Edit Items', 'edit items', 'Delete Items', 'delete items', 'View Items', 'view items', 'Approve Items', 'approve items', 'Open Items', 'open items', 'View Versions', 'view versions', 'Delete Versions', 'delete versions', 'Create Alerts', 'create alerts', 'View Application Pages', 'view application pages'] & value).count == value.count - fail("Invalid value #{value}. Valid values are Manage Lists, Override List Behaviors, Add Items, Edit Items, Delete Items, View Items, Approve Items, Open Items, View Versions, Delete Versions, Create Alerts, View Application Pages") - end - end - if value.kind_of?(String) - unless ['Manage Lists', 'manage lists', 'Override List Behaviors', 'override list behaviors', 'Add Items', 'add items', 'Edit Items', 'edit items', 'Delete Items', 'delete items', 'View Items', 'view items', 'Approve Items', 'approve items', 'Open Items', 'open items', 'View Versions', 'view versions', 'Delete Versions', 'delete versions', 'Create Alerts', 'create alerts', 'View Application Pages', 'view application pages'].include?(value) - fail("Invalid value #{value}. Valid values are Manage Lists, Override List Behaviors, Add Items, Edit Items, Delete Items, View Items, Approve Items, Open Items, View Versions, Delete Versions, Create Alerts, View Application Pages") - end - end - end - munge do |value| - Array(value) - end - end - - # Name: SitePermissions - # Type: string[] - # IsMandatory: False - # Values: ["Manage Permissions", "View Web Analytics Data", "Create Subsites", "Manage Web Site", "Add and Customize Pages", "Apply Themes and Borders", "Apply Style Sheets", "Create Groups", "Browse Directories", "Use Self-Service Site Creation", "View Pages", "Enumerate Permissions", "Browse User Information", "Manage Alerts", "Use Remote Interfaces", "Use Client Integration Features", "Open", "Edit Personal User Information"] - newparam(:dsc_sitepermissions, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "SitePermissions - Site permissions that need to be configured Valid values are Manage Permissions, View Web Analytics Data, Create Subsites, Manage Web Site, Add and Customize Pages, Apply Themes and Borders, Apply Style Sheets, Create Groups, Browse Directories, Use Self-Service Site Creation, View Pages, Enumerate Permissions, Browse User Information, Manage Alerts, Use Remote Interfaces, Use Client Integration Features, Open, Edit Personal User Information." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - if value.kind_of?(Array) - unless (['Manage Permissions', 'manage permissions', 'View Web Analytics Data', 'view web analytics data', 'Create Subsites', 'create subsites', 'Manage Web Site', 'manage web site', 'Add and Customize Pages', 'add and customize pages', 'Apply Themes and Borders', 'apply themes and borders', 'Apply Style Sheets', 'apply style sheets', 'Create Groups', 'create groups', 'Browse Directories', 'browse directories', 'Use Self-Service Site Creation', 'use self-service site creation', 'View Pages', 'view pages', 'Enumerate Permissions', 'enumerate permissions', 'Browse User Information', 'browse user information', 'Manage Alerts', 'manage alerts', 'Use Remote Interfaces', 'use remote interfaces', 'Use Client Integration Features', 'use client integration features', 'Open', 'open', 'Edit Personal User Information', 'edit personal user information'] & value).count == value.count - fail("Invalid value #{value}. Valid values are Manage Permissions, View Web Analytics Data, Create Subsites, Manage Web Site, Add and Customize Pages, Apply Themes and Borders, Apply Style Sheets, Create Groups, Browse Directories, Use Self-Service Site Creation, View Pages, Enumerate Permissions, Browse User Information, Manage Alerts, Use Remote Interfaces, Use Client Integration Features, Open, Edit Personal User Information") - end - end - if value.kind_of?(String) - unless ['Manage Permissions', 'manage permissions', 'View Web Analytics Data', 'view web analytics data', 'Create Subsites', 'create subsites', 'Manage Web Site', 'manage web site', 'Add and Customize Pages', 'add and customize pages', 'Apply Themes and Borders', 'apply themes and borders', 'Apply Style Sheets', 'apply style sheets', 'Create Groups', 'create groups', 'Browse Directories', 'browse directories', 'Use Self-Service Site Creation', 'use self-service site creation', 'View Pages', 'view pages', 'Enumerate Permissions', 'enumerate permissions', 'Browse User Information', 'browse user information', 'Manage Alerts', 'manage alerts', 'Use Remote Interfaces', 'use remote interfaces', 'Use Client Integration Features', 'use client integration features', 'Open', 'open', 'Edit Personal User Information', 'edit personal user information'].include?(value) - fail("Invalid value #{value}. Valid values are Manage Permissions, View Web Analytics Data, Create Subsites, Manage Web Site, Add and Customize Pages, Apply Themes and Borders, Apply Style Sheets, Create Groups, Browse Directories, Use Self-Service Site Creation, View Pages, Enumerate Permissions, Browse User Information, Manage Alerts, Use Remote Interfaces, Use Client Integration Features, Open, Edit Personal User Information") - end - end - end - munge do |value| - Array(value) - end - end - - # Name: PersonalPermissions - # Type: string[] - # IsMandatory: False - # Values: ["Manage Personal Views", "Add/Remove Personal Web Parts", "Update Personal Web Parts"] - newparam(:dsc_personalpermissions, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "PersonalPermissions - Personal permissions that need to be configured Valid values are Manage Personal Views, Add/Remove Personal Web Parts, Update Personal Web Parts." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - if value.kind_of?(Array) - unless (['Manage Personal Views', 'manage personal views', 'Add/Remove Personal Web Parts', 'add/remove personal web parts', 'Update Personal Web Parts', 'update personal web parts'] & value).count == value.count - fail("Invalid value #{value}. Valid values are Manage Personal Views, Add/Remove Personal Web Parts, Update Personal Web Parts") - end - end - if value.kind_of?(String) - unless ['Manage Personal Views', 'manage personal views', 'Add/Remove Personal Web Parts', 'add/remove personal web parts', 'Update Personal Web Parts', 'update personal web parts'].include?(value) - fail("Invalid value #{value}. Valid values are Manage Personal Views, Add/Remove Personal Web Parts, Update Personal Web Parts") - end - end - end - munge do |value| - Array(value) - end - end - - # Name: AllPermissions - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allpermissions) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllPermissions - Set all permissions" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spwebapppermissions).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spwebapppolicy.rb b/lib/puppet/type/dsc_spwebapppolicy.rb deleted file mode 100644 index 046207a7..00000000 --- a/lib/puppet/type/dsc_spwebapppolicy.rb +++ /dev/null @@ -1,224 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spwebapppolicy) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - class PuppetX::Dsc::TypeHelpers - def self.validate_MSFT_SPWebPolicyPermissions(mof_type_map, name, value) - required = [] - allowed = ['username','permissionlevel','identitytype','actassystemaccount'] - lowkey_hash = Hash[value.map { |k, v| [k.to_s.downcase, v] }] - - missing = required - lowkey_hash.keys - unless missing.empty? - fail "#{name} is missing the following required keys: #{missing.join(',')}" - end - - extraneous = lowkey_hash.keys - required - allowed - unless extraneous.empty? - fail "#{name} includes invalid keys: #{extraneous.join(',')}" - end - - lowkey_hash.keys.each do |key| - if lowkey_hash[key] - validate_mof_type(mof_type_map[key], 'MSFT_SPWebPolicyPermissions', key, lowkey_hash[key]) - end - end - end - end - - @doc = %q{ - The DSC SPWebAppPolicy resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPWebAppPolicy/MSFT_SPWebAppPolicy.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_webappurl is a required attribute') if self[:dsc_webappurl].nil? - end - - def dscmeta_resource_friendly_name; 'SPWebAppPolicy' end - def dscmeta_resource_name; 'MSFT_SPWebAppPolicy' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: WebAppUrl - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_webappurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WebAppUrl - The URL of the web application" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Members - # Type: MSFT_SPWebPolicyPermissions[] - # IsMandatory: False - # Values: None - newparam(:dsc_members, :array_matching => :all) do - def mof_type; 'MSFT_SPWebPolicyPermissions[]' end - def mof_is_embedded?; true end - def mof_type_map - {"username"=>{:type=>"string"}, "permissionlevel"=>{:type=>"string[]", :values=>["Deny All", "Deny Write", "Full Read", "Full Control"]}, "identitytype"=>{:type=>"string", :values=>["Claims", "Native"]}, "actassystemaccount"=>{:type=>"boolean"}} - end - desc "Members - Exact list of accounts that will have to get Web Policy permissions" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be an array of hashes or a hash") - end - (value.kind_of?(Hash) ? [value] : value).each_with_index do |v, i| - fail "Members value at index #{i} should be a Hash" unless v.is_a? Hash - - PuppetX::Dsc::TypeHelpers.validate_MSFT_SPWebPolicyPermissions(mof_type_map, "Members", v) - end - end - munge do |value| - value.kind_of?(Hash) ? - [PuppetX::Dsc::TypeHelpers.munge_embeddedinstance(mof_type_map, value)] : - value.map { |v| PuppetX::Dsc::TypeHelpers.munge_embeddedinstance(mof_type_map, v) } - end - end - - # Name: MembersToInclude - # Type: MSFT_SPWebPolicyPermissions[] - # IsMandatory: False - # Values: None - newparam(:dsc_memberstoinclude, :array_matching => :all) do - def mof_type; 'MSFT_SPWebPolicyPermissions[]' end - def mof_is_embedded?; true end - def mof_type_map - {"username"=>{:type=>"string"}, "permissionlevel"=>{:type=>"string[]", :values=>["Deny All", "Deny Write", "Full Read", "Full Control"]}, "identitytype"=>{:type=>"string", :values=>["Claims", "Native"]}, "actassystemaccount"=>{:type=>"boolean"}} - end - desc "MembersToInclude - List of all accounts that must be in the Web Policy group" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be an array of hashes or a hash") - end - (value.kind_of?(Hash) ? [value] : value).each_with_index do |v, i| - fail "MembersToInclude value at index #{i} should be a Hash" unless v.is_a? Hash - - PuppetX::Dsc::TypeHelpers.validate_MSFT_SPWebPolicyPermissions(mof_type_map, "MembersToInclude", v) - end - end - munge do |value| - value.kind_of?(Hash) ? - [PuppetX::Dsc::TypeHelpers.munge_embeddedinstance(mof_type_map, value)] : - value.map { |v| PuppetX::Dsc::TypeHelpers.munge_embeddedinstance(mof_type_map, v) } - end - end - - # Name: MembersToExclude - # Type: MSFT_SPWebPolicyPermissions[] - # IsMandatory: False - # Values: None - newparam(:dsc_memberstoexclude, :array_matching => :all) do - def mof_type; 'MSFT_SPWebPolicyPermissions[]' end - def mof_is_embedded?; true end - def mof_type_map - {"username"=>{:type=>"string"}, "permissionlevel"=>{:type=>"string[]", :values=>["Deny All", "Deny Write", "Full Read", "Full Control"]}, "identitytype"=>{:type=>"string", :values=>["Claims", "Native"]}, "actassystemaccount"=>{:type=>"boolean"}} - end - desc "MembersToExclude - List of all accounts that are not allowed to have any Web Policy permissions" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be an array of hashes or a hash") - end - (value.kind_of?(Hash) ? [value] : value).each_with_index do |v, i| - fail "MembersToExclude value at index #{i} should be a Hash" unless v.is_a? Hash - - PuppetX::Dsc::TypeHelpers.validate_MSFT_SPWebPolicyPermissions(mof_type_map, "MembersToExclude", v) - end - end - munge do |value| - value.kind_of?(Hash) ? - [PuppetX::Dsc::TypeHelpers.munge_embeddedinstance(mof_type_map, value)] : - value.map { |v| PuppetX::Dsc::TypeHelpers.munge_embeddedinstance(mof_type_map, v) } - end - end - - # Name: SetCacheAccountsPolicy - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_setcacheaccountspolicy) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "SetCacheAccountsPolicy - Include the Cache Accounts in the policy or not" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spwebapppolicy).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spwebappproxygroup.rb b/lib/puppet/type/dsc_spwebappproxygroup.rb deleted file mode 100644 index 7930157c..00000000 --- a/lib/puppet/type/dsc_spwebappproxygroup.rb +++ /dev/null @@ -1,116 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spwebappproxygroup) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPWebAppProxyGroup resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPWebAppProxyGroup/MSFT_SPWebAppProxyGroup.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_webappurl is a required attribute') if self[:dsc_webappurl].nil? - end - - def dscmeta_resource_friendly_name; 'SPWebAppProxyGroup' end - def dscmeta_resource_name; 'MSFT_SPWebAppProxyGroup' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: WebAppUrl - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_webappurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WebAppUrl - URL of the web application" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ServiceAppProxyGroup - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_serviceappproxygroup) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServiceAppProxyGroup - Name of the Service Application Proxy Group" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spwebappproxygroup).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spwebappsiteuseanddeletion.rb b/lib/puppet/type/dsc_spwebappsiteuseanddeletion.rb deleted file mode 100644 index 4d74492d..00000000 --- a/lib/puppet/type/dsc_spwebappsiteuseanddeletion.rb +++ /dev/null @@ -1,169 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spwebappsiteuseanddeletion) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPWebAppSiteUseAndDeletion resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPWebAppSiteUseAndDeletion/MSFT_SPWebAppSiteUseAndDeletion.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_url is a required attribute') if self[:dsc_url].nil? - end - - def dscmeta_resource_friendly_name; 'SPWebAppSiteUseAndDeletion' end - def dscmeta_resource_name; 'MSFT_SPWebAppSiteUseAndDeletion' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Url - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_url) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Url - The URL of the web application" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SendUnusedSiteCollectionNotifications - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_sendunusedsitecollectionnotifications) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "SendUnusedSiteCollectionNotifications - Should emails be sent to notify site owners of unused site collections" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: UnusedSiteNotificationPeriod - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_unusedsitenotificationperiod) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "UnusedSiteNotificationPeriod - How many days should pass before a site is flagged as unused" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: AutomaticallyDeleteUnusedSiteCollections - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_automaticallydeleteunusedsitecollections) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AutomaticallyDeleteUnusedSiteCollections - Should unused site collection be automatically deleted" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: UnusedSiteNotificationsBeforeDeletion - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_unusedsitenotificationsbeforedeletion) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "UnusedSiteNotificationsBeforeDeletion - How many days before an unused site is deleted should an email be sent to the owner" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spwebappsiteuseanddeletion).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spwebappthrottlingsettings.rb b/lib/puppet/type/dsc_spwebappthrottlingsettings.rb deleted file mode 100644 index 72036822..00000000 --- a/lib/puppet/type/dsc_spwebappthrottlingsettings.rb +++ /dev/null @@ -1,316 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spwebappthrottlingsettings) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - class PuppetX::Dsc::TypeHelpers - def self.validate_MSFT_SPWebApplicationHappyHour(mof_type_map, name, value) - required = [] - allowed = ['hour','minute','duration'] - lowkey_hash = Hash[value.map { |k, v| [k.to_s.downcase, v] }] - - missing = required - lowkey_hash.keys - unless missing.empty? - fail "#{name} is missing the following required keys: #{missing.join(',')}" - end - - extraneous = lowkey_hash.keys - required - allowed - unless extraneous.empty? - fail "#{name} includes invalid keys: #{extraneous.join(',')}" - end - - lowkey_hash.keys.each do |key| - if lowkey_hash[key] - validate_mof_type(mof_type_map[key], 'MSFT_SPWebApplicationHappyHour', key, lowkey_hash[key]) - end - end - end - end - - @doc = %q{ - The DSC SPWebAppThrottlingSettings resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPWebAppThrottlingSettings/MSFT_SPWebAppThrottlingSettings.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_url is a required attribute') if self[:dsc_url].nil? - end - - def dscmeta_resource_friendly_name; 'SPWebAppThrottlingSettings' end - def dscmeta_resource_name; 'MSFT_SPWebAppThrottlingSettings' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Url - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_url) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Url - The URL of the web application" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ListViewThreshold - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_listviewthreshold) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "ListViewThreshold - What should the list view threshold for this site be set to" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: AllowObjectModelOverride - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowobjectmodeloverride) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowObjectModelOverride - Should object model code be able to be override the list view threshold" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AdminThreshold - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_adminthreshold) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "AdminThreshold - What is the list view threshold for site administrators" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ListViewLookupThreshold - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_listviewlookupthreshold) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "ListViewLookupThreshold - What is the maximum number of lookup fields in a single list view" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: HappyHourEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_happyhourenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "HappyHourEnabled - Should the happy hour window be enabled for this web app" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: HappyHour - # Type: MSFT_SPWebApplicationHappyHour - # IsMandatory: False - # Values: None - newparam(:dsc_happyhour) do - def mof_type; 'MSFT_SPWebApplicationHappyHour' end - def mof_is_embedded?; true end - def mof_type_map - {"hour"=>{:type=>"uint32"}, "minute"=>{:type=>"uint32"}, "duration"=>{:type=>"uint32"}} - end - desc "HappyHour - The time window for happy hour" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_SPWebApplicationHappyHour(mof_type_map, "HappyHour", value) - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_embeddedinstance(mof_type_map, value) - end - end - - # Name: UniquePermissionThreshold - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_uniquepermissionthreshold) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "UniquePermissionThreshold - What is the limit for unique permissions on a single object in this web app" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: RequestThrottling - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_requestthrottling) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RequestThrottling - Is request throttling enabled on this web app" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ChangeLogEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_changelogenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ChangeLogEnabled - Is the change log enabled for this web app" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ChangeLogExpiryDays - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_changelogexpirydays) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "ChangeLogExpiryDays - How many days does the change log store data for" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: EventHandlersEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_eventhandlersenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "EventHandlersEnabled - Are event handlers enabled in the web application" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spwebappthrottlingsettings).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spwebappworkflowsettings.rb b/lib/puppet/type/dsc_spwebappworkflowsettings.rb deleted file mode 100644 index 442e6a8b..00000000 --- a/lib/puppet/type/dsc_spwebappworkflowsettings.rb +++ /dev/null @@ -1,149 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spwebappworkflowsettings) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPWebAppWorkflowSettings resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPWebAppWorkflowSettings/MSFT_SPWebAppWorkflowSettings.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_url is a required attribute') if self[:dsc_url].nil? - end - - def dscmeta_resource_friendly_name; 'SPWebAppWorkflowSettings' end - def dscmeta_resource_name; 'MSFT_SPWebAppWorkflowSettings' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Url - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_url) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Url - The URL of the web application" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ExternalWorkflowParticipantsEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_externalworkflowparticipantsenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ExternalWorkflowParticipantsEnabled - Are external workflow participants enabled in the web app" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: UserDefinedWorkflowsEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_userdefinedworkflowsenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "UserDefinedWorkflowsEnabled - Are user defined workflows enabled in this web app" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: EmailToNoPermissionWorkflowParticipantsEnable - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_emailtonopermissionworkflowparticipantsenable) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "EmailToNoPermissionWorkflowParticipantsEnable - Are documents sent via email to external participants of workflow" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spwebappworkflowsettings).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spwordautomationserviceapp.rb b/lib/puppet/type/dsc_spwordautomationserviceapp.rb deleted file mode 100644 index 730d479e..00000000 --- a/lib/puppet/type/dsc_spwordautomationserviceapp.rb +++ /dev/null @@ -1,406 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spwordautomationserviceapp) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPWordAutomationServiceApp resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/MSFT_SPWordAutomationServiceApp.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPWordAutomationServiceApp' end - def dscmeta_resource_name; 'MSFT_SPWordAutomationServiceApp' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - THe name of the service application" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present to ensure the app exists, absent to ensure that it does not Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: ApplicationPool - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_applicationpool) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ApplicationPool - The name of the application pool to run the service app in" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databasename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseName - The name of the database for the service app" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databaseserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseServer - The name of the server that will host the database" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SupportedFileFormats - # Type: string[] - # IsMandatory: False - # Values: ["docx", "doc", "mht", "rtf", "xml"] - newparam(:dsc_supportedfileformats, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "SupportedFileFormats - The list of supported file types Valid values are docx, doc, mht, rtf, xml." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - if value.kind_of?(Array) - unless (['docx', 'docx', 'doc', 'doc', 'mht', 'mht', 'rtf', 'rtf', 'xml', 'xml'] & value).count == value.count - fail("Invalid value #{value}. Valid values are docx, doc, mht, rtf, xml") - end - end - if value.kind_of?(String) - unless ['docx', 'docx', 'doc', 'doc', 'mht', 'mht', 'rtf', 'rtf', 'xml', 'xml'].include?(value) - fail("Invalid value #{value}. Valid values are docx, doc, mht, rtf, xml") - end - end - end - munge do |value| - Array(value) - end - end - - # Name: DisableEmbeddedFonts - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_disableembeddedfonts) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DisableEmbeddedFonts - Should embedded fonts be disabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: MaximumMemoryUsage - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_maximummemoryusage) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "MaximumMemoryUsage - What is the maximum amount of memory the service app should use (in MB)" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: RecycleThreshold - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_recyclethreshold) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "RecycleThreshold - What is the recycle threshold for this service app" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: DisableBinaryFileScan - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_disablebinaryfilescan) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DisableBinaryFileScan - Should binary file scans be disabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ConversionProcesses - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_conversionprocesses) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "ConversionProcesses - How many conversion processes can be run at once" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: JobConversionFrequency - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_jobconversionfrequency) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "JobConversionFrequency - How frequently should new jobs be started from the queue (in minutes)" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: NumberOfConversionsPerProcess - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_numberofconversionsperprocess) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "NumberOfConversionsPerProcess - How many document conversions should be included in a single process" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: TimeBeforeConversionIsMonitored - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_timebeforeconversionismonitored) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "TimeBeforeConversionIsMonitored - How long can a conversion be run before it becomes monitored" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MaximumConversionAttempts - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_maximumconversionattempts) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "MaximumConversionAttempts - What is the maximum number of attempts to convert a document" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MaximumSyncConversionRequests - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_maximumsyncconversionrequests) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "MaximumSyncConversionRequests - What is the maximum number of sync conversion requests for the service app" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: KeepAliveTimeout - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_keepalivetimeout) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "KeepAliveTimeout - How long is the keep alive timeout set to for the service app" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MaximumConversionTime - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_maximumconversiontime) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "MaximumConversionTime - What is the maximum time in seconds for a document conversion to be allowed to run" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spwordautomationserviceapp).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_spworkmanagementserviceapp.rb b/lib/puppet/type/dsc_spworkmanagementserviceapp.rb deleted file mode 100644 index 35108b29..00000000 --- a/lib/puppet/type/dsc_spworkmanagementserviceapp.rb +++ /dev/null @@ -1,259 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_spworkmanagementserviceapp) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SPWorkManagementServiceApp resource type. - Automatically generated from - 'SharePointDsc/DSCResources/MSFT_SPWorkManagementServiceApp/MSFT_SPWorkManagementServiceApp.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'SPWorkManagementServiceApp' end - def dscmeta_resource_name; 'MSFT_SPWorkManagementServiceApp' end - def dscmeta_module_name; 'SharePointDsc' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the work management service application" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ProxyName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_proxyname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProxyName - The proxy name, if not specified will be /Name of service app/ Proxy" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present to ensure the app exists, Absent to ensure it is removed Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: ApplicationPool - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_applicationpool) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ApplicationPool - The name of the application pool this will run in" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MinimumTimeBetweenEwsSyncSubscriptionSearches - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_minimumtimebetweenewssyncsubscriptionsearches) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "MinimumTimeBetweenEwsSyncSubscriptionSearches - The minimum amount of time bween EWS sync subscription searches" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MinimumTimeBetweenProviderRefreshes - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_minimumtimebetweenproviderrefreshes) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "MinimumTimeBetweenProviderRefreshes - The minimum time between provider refreshes" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MinimumTimeBetweenSearchQueries - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_minimumtimebetweensearchqueries) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "MinimumTimeBetweenSearchQueries - The minimum time between search queries" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: NumberOfSubscriptionSyncsPerEwsSyncRun - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_numberofsubscriptionsyncsperewssyncrun) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "NumberOfSubscriptionSyncsPerEwsSyncRun - The number of subscription syncronisations per EWS sync run" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: NumberOfUsersEwsSyncWillProcessAtOnce - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_numberofusersewssyncwillprocessatonce) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "NumberOfUsersEwsSyncWillProcessAtOnce - How many users will EWS calls include at once" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: NumberOfUsersPerEwsSyncBatch - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_numberofusersperewssyncbatch) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "NumberOfUsersPerEwsSyncBatch - How many users are included in a batch for EWS" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: InstallAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_installaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "InstallAccount - POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("InstallAccount", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_spworkmanagementserviceapp).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_systemlocale.rb b/lib/puppet/type/dsc_systemlocale.rb deleted file mode 100644 index 74357638..00000000 --- a/lib/puppet/type/dsc_systemlocale.rb +++ /dev/null @@ -1,103 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_systemlocale) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC SystemLocale resource type. - Automatically generated from - 'SystemLocaleDsc/DSCResources/MSFT_SystemLocale/MSFT_SystemLocale.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_issingleinstance is a required attribute') if self[:dsc_issingleinstance].nil? - end - - def dscmeta_resource_friendly_name; 'SystemLocale' end - def dscmeta_resource_name; 'MSFT_SystemLocale' end - def dscmeta_module_name; 'SystemLocaleDsc' end - def dscmeta_module_version; '1.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: IsSingleInstance - # Type: string - # IsMandatory: True - # Values: ["Yes"] - newparam(:dsc_issingleinstance) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes' Valid values are Yes." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Yes', 'yes'].include?(value) - fail("Invalid value '#{value}'. Valid values are Yes") - end - end - end - - # Name: SystemLocale - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_systemlocale) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SystemLocale - Specifies the System Locale." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_systemlocale).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_user.rb b/lib/puppet/type/dsc_user.rb deleted file mode 100644 index a7466644..00000000 --- a/lib/puppet/type/dsc_user.rb +++ /dev/null @@ -1,214 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_user) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC User resource type. - Automatically generated from - 'PSDesiredStateConfiguration/DSCResources/MSFT_UserResource/MSFT_UserResource.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_username is a required attribute') if self[:dsc_username].nil? - end - - def dscmeta_resource_friendly_name; 'User' end - def dscmeta_resource_name; 'MSFT_UserResource' end - def dscmeta_module_name; 'PSDesiredStateConfiguration' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: UserName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_username) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UserName" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: FullName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_fullname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FullName" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Description - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_description) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Description" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Password - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_password) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Password" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Password", value) - end - end - - # Name: Disabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_disabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Disabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: PasswordNeverExpires - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_passwordneverexpires) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "PasswordNeverExpires" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: PasswordChangeRequired - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_passwordchangerequired) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "PasswordChangeRequired" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: PasswordChangeNotAllowed - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_passwordchangenotallowed) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "PasswordChangeNotAllowed" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_user).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_userrightsassignment.rb b/lib/puppet/type/dsc_userrightsassignment.rb deleted file mode 100644 index f98df599..00000000 --- a/lib/puppet/type/dsc_userrightsassignment.rb +++ /dev/null @@ -1,142 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_userrightsassignment) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC UserRightsAssignment resource type. - Automatically generated from - 'SecurityPolicyDsc/DSCResources/MSFT_UserRightsAssignment/MSFT_UserRightsAssignment.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_policy is a required attribute') if self[:dsc_policy].nil? - end - - def dscmeta_resource_friendly_name; 'UserRightsAssignment' end - def dscmeta_resource_name; 'MSFT_UserRightsAssignment' end - def dscmeta_module_name; 'SecurityPolicyDsc' end - def dscmeta_module_version; '1.5.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Policy - # Type: string - # IsMandatory: True - # Values: ["Create_a_token_object", "Access_this_computer_from_the_network", "Change_the_system_time", "Deny_log_on_as_a_batch_job", "Deny_log_on_through_Remote_Desktop_Services", "Create_global_objects", "Remove_computer_from_docking_station", "Deny_access_to_this_computer_from_the_network", "Act_as_part_of_the_operating_system", "Modify_firmware_environment_values", "Deny_log_on_locally", "Access_Credential_Manager_as_a_trusted_caller", "Restore_files_and_directories", "Change_the_time_zone", "Replace_a_process_level_token", "Manage_auditing_and_security_log", "Create_symbolic_links", "Modify_an_object_label", "Enable_computer_and_user_accounts_to_be_trusted_for_delegation", "Generate_security_audits", "Increase_a_process_working_set", "Take_ownership_of_files_or_other_objects", "Bypass_traverse_checking", "Log_on_as_a_service", "Shut_down_the_system", "Lock_pages_in_memory", "Impersonate_a_client_after_authentication", "Profile_system_performance", "Debug_programs", "Profile_single_process", "Allow_log_on_through_Remote_Desktop_Services", "Allow_log_on_locally", "Increase_scheduling_priority", "Synchronize_directory_service_data", "Add_workstations_to_domain", "Adjust_memory_quotas_for_a_process", "Obtain_an_impersonation_token_for_another_user_in_the_same_session", "Perform_volume_maintenance_tasks", "Load_and_unload_device_drivers", "Force_shutdown_from_a_remote_system", "Back_up_files_and_directories", "Create_a_pagefile", "Deny_log_on_as_a_service", "Log_on_as_a_batch_job", "Create_permanent_shared_objects"] - newparam(:dsc_policy) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Policy - The policy name of the user rights assignment to be configured. Valid values are Create_a_token_object, Access_this_computer_from_the_network, Change_the_system_time, Deny_log_on_as_a_batch_job, Deny_log_on_through_Remote_Desktop_Services, Create_global_objects, Remove_computer_from_docking_station, Deny_access_to_this_computer_from_the_network, Act_as_part_of_the_operating_system, Modify_firmware_environment_values, Deny_log_on_locally, Access_Credential_Manager_as_a_trusted_caller, Restore_files_and_directories, Change_the_time_zone, Replace_a_process_level_token, Manage_auditing_and_security_log, Create_symbolic_links, Modify_an_object_label, Enable_computer_and_user_accounts_to_be_trusted_for_delegation, Generate_security_audits, Increase_a_process_working_set, Take_ownership_of_files_or_other_objects, Bypass_traverse_checking, Log_on_as_a_service, Shut_down_the_system, Lock_pages_in_memory, Impersonate_a_client_after_authentication, Profile_system_performance, Debug_programs, Profile_single_process, Allow_log_on_through_Remote_Desktop_Services, Allow_log_on_locally, Increase_scheduling_priority, Synchronize_directory_service_data, Add_workstations_to_domain, Adjust_memory_quotas_for_a_process, Obtain_an_impersonation_token_for_another_user_in_the_same_session, Perform_volume_maintenance_tasks, Load_and_unload_device_drivers, Force_shutdown_from_a_remote_system, Back_up_files_and_directories, Create_a_pagefile, Deny_log_on_as_a_service, Log_on_as_a_batch_job, Create_permanent_shared_objects." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Create_a_token_object', 'create_a_token_object', 'Access_this_computer_from_the_network', 'access_this_computer_from_the_network', 'Change_the_system_time', 'change_the_system_time', 'Deny_log_on_as_a_batch_job', 'deny_log_on_as_a_batch_job', 'Deny_log_on_through_Remote_Desktop_Services', 'deny_log_on_through_remote_desktop_services', 'Create_global_objects', 'create_global_objects', 'Remove_computer_from_docking_station', 'remove_computer_from_docking_station', 'Deny_access_to_this_computer_from_the_network', 'deny_access_to_this_computer_from_the_network', 'Act_as_part_of_the_operating_system', 'act_as_part_of_the_operating_system', 'Modify_firmware_environment_values', 'modify_firmware_environment_values', 'Deny_log_on_locally', 'deny_log_on_locally', 'Access_Credential_Manager_as_a_trusted_caller', 'access_credential_manager_as_a_trusted_caller', 'Restore_files_and_directories', 'restore_files_and_directories', 'Change_the_time_zone', 'change_the_time_zone', 'Replace_a_process_level_token', 'replace_a_process_level_token', 'Manage_auditing_and_security_log', 'manage_auditing_and_security_log', 'Create_symbolic_links', 'create_symbolic_links', 'Modify_an_object_label', 'modify_an_object_label', 'Enable_computer_and_user_accounts_to_be_trusted_for_delegation', 'enable_computer_and_user_accounts_to_be_trusted_for_delegation', 'Generate_security_audits', 'generate_security_audits', 'Increase_a_process_working_set', 'increase_a_process_working_set', 'Take_ownership_of_files_or_other_objects', 'take_ownership_of_files_or_other_objects', 'Bypass_traverse_checking', 'bypass_traverse_checking', 'Log_on_as_a_service', 'log_on_as_a_service', 'Shut_down_the_system', 'shut_down_the_system', 'Lock_pages_in_memory', 'lock_pages_in_memory', 'Impersonate_a_client_after_authentication', 'impersonate_a_client_after_authentication', 'Profile_system_performance', 'profile_system_performance', 'Debug_programs', 'debug_programs', 'Profile_single_process', 'profile_single_process', 'Allow_log_on_through_Remote_Desktop_Services', 'allow_log_on_through_remote_desktop_services', 'Allow_log_on_locally', 'allow_log_on_locally', 'Increase_scheduling_priority', 'increase_scheduling_priority', 'Synchronize_directory_service_data', 'synchronize_directory_service_data', 'Add_workstations_to_domain', 'add_workstations_to_domain', 'Adjust_memory_quotas_for_a_process', 'adjust_memory_quotas_for_a_process', 'Obtain_an_impersonation_token_for_another_user_in_the_same_session', 'obtain_an_impersonation_token_for_another_user_in_the_same_session', 'Perform_volume_maintenance_tasks', 'perform_volume_maintenance_tasks', 'Load_and_unload_device_drivers', 'load_and_unload_device_drivers', 'Force_shutdown_from_a_remote_system', 'force_shutdown_from_a_remote_system', 'Back_up_files_and_directories', 'back_up_files_and_directories', 'Create_a_pagefile', 'create_a_pagefile', 'Deny_log_on_as_a_service', 'deny_log_on_as_a_service', 'Log_on_as_a_batch_job', 'log_on_as_a_batch_job', 'Create_permanent_shared_objects', 'create_permanent_shared_objects'].include?(value) - fail("Invalid value '#{value}'. Valid values are Create_a_token_object, Access_this_computer_from_the_network, Change_the_system_time, Deny_log_on_as_a_batch_job, Deny_log_on_through_Remote_Desktop_Services, Create_global_objects, Remove_computer_from_docking_station, Deny_access_to_this_computer_from_the_network, Act_as_part_of_the_operating_system, Modify_firmware_environment_values, Deny_log_on_locally, Access_Credential_Manager_as_a_trusted_caller, Restore_files_and_directories, Change_the_time_zone, Replace_a_process_level_token, Manage_auditing_and_security_log, Create_symbolic_links, Modify_an_object_label, Enable_computer_and_user_accounts_to_be_trusted_for_delegation, Generate_security_audits, Increase_a_process_working_set, Take_ownership_of_files_or_other_objects, Bypass_traverse_checking, Log_on_as_a_service, Shut_down_the_system, Lock_pages_in_memory, Impersonate_a_client_after_authentication, Profile_system_performance, Debug_programs, Profile_single_process, Allow_log_on_through_Remote_Desktop_Services, Allow_log_on_locally, Increase_scheduling_priority, Synchronize_directory_service_data, Add_workstations_to_domain, Adjust_memory_quotas_for_a_process, Obtain_an_impersonation_token_for_another_user_in_the_same_session, Perform_volume_maintenance_tasks, Load_and_unload_device_drivers, Force_shutdown_from_a_remote_system, Back_up_files_and_directories, Create_a_pagefile, Deny_log_on_as_a_service, Log_on_as_a_batch_job, Create_permanent_shared_objects") - end - end - end - - # Name: Identity - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_identity, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Identity - The identity of the user or group to be added or removed from the user rights assignment." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: Force - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_force) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Force - Specifies whether to Force the change" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Desired state of resource. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_userrightsassignment).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_windowsfeature.rb b/lib/puppet/type/dsc_windowsfeature.rb deleted file mode 100644 index 93dec761..00000000 --- a/lib/puppet/type/dsc_windowsfeature.rb +++ /dev/null @@ -1,181 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_windowsfeature) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC WindowsFeature resource type. - Automatically generated from - 'PSDesiredStateConfiguration/DSCResources/MSFT_RoleResource/MSFT_RoleResource.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'WindowsFeature' end - def dscmeta_resource_name; 'MSFT_RoleResource' end - def dscmeta_module_name; 'PSDesiredStateConfiguration' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if the role or feature is expected to be installed on not on the machine.\nPresent {default} \nAbsent \n Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: DisplayName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_displayname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DisplayName" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Source - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_source) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Source" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: IncludeAllSubFeature - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_includeallsubfeature) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "IncludeAllSubFeature" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: LogPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_logpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_windowsfeature).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_windowsoptionalfeature.rb b/lib/puppet/type/dsc_windowsoptionalfeature.rb deleted file mode 100644 index 8147106e..00000000 --- a/lib/puppet/type/dsc_windowsoptionalfeature.rb +++ /dev/null @@ -1,235 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_windowsoptionalfeature) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC WindowsOptionalFeature resource type. - Automatically generated from - 'PSDesiredStateConfiguration/DSCResources/MSFT_WindowsOptionalFeature/MSFT_WindowsOptionalFeature.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'WindowsOptionalFeature' end - def dscmeta_resource_name; 'MSFT_WindowsOptionalFeature' end - def dscmeta_module_name; 'PSDesiredStateConfiguration' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:enable) { provider.create } - newvalue(:disable) { provider.destroy } - defaultto { :enable } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Enable", "Disable"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Valid values are Enable, Disable." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Enable', 'enable', 'Disable', 'disable'].include?(value) - fail("Invalid value '#{value}'. Valid values are Enable, Disable") - end - end - end - - # Name: Source - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_source, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Source" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: NoWindowsUpdateCheck - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_nowindowsupdatecheck) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "NoWindowsUpdateCheck" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: RemoveFilesOnDisable - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_removefilesondisable) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RemoveFilesOnDisable" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: LogLevel - # Type: string - # IsMandatory: False - # Values: ["ErrorsOnly", "ErrorsAndWarning", "ErrorsAndWarningAndInformation"] - newparam(:dsc_loglevel) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogLevel - Valid values are ErrorsOnly, ErrorsAndWarning, ErrorsAndWarningAndInformation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['ErrorsOnly', 'errorsonly', 'ErrorsAndWarning', 'errorsandwarning', 'ErrorsAndWarningAndInformation', 'errorsandwarningandinformation'].include?(value) - fail("Invalid value '#{value}'. Valid values are ErrorsOnly, ErrorsAndWarning, ErrorsAndWarningAndInformation") - end - end - end - - # Name: LogPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_logpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CustomProperties - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_customproperties, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "CustomProperties" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: Description - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_description) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Description" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DisplayName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_displayname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DisplayName" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_windowsoptionalfeature).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_windowsprocess.rb b/lib/puppet/type/dsc_windowsprocess.rb deleted file mode 100644 index cda895fd..00000000 --- a/lib/puppet/type/dsc_windowsprocess.rb +++ /dev/null @@ -1,287 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_windowsprocess) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC WindowsProcess resource type. - Automatically generated from - 'PSDesiredStateConfiguration/DSCResources/MSFT_ProcessResource/MSFT_ProcessResource.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_path is a required attribute') if self[:dsc_path].nil? - fail('dsc_arguments is a required attribute') if self[:dsc_arguments].nil? - end - - def dscmeta_resource_friendly_name; 'WindowsProcess' end - def dscmeta_resource_name; 'MSFT_ProcessResource' end - def dscmeta_module_name; 'PSDesiredStateConfiguration' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Path - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_path) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Path" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Arguments - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_arguments) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Arguments" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: StandardOutputPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_standardoutputpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "StandardOutputPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: StandardErrorPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_standarderrorpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "StandardErrorPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: StandardInputPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_standardinputpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "StandardInputPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: WorkingDirectory - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_workingdirectory) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WorkingDirectory" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: PagedMemorySize - # Type: uint64 - # IsMandatory: False - # Values: None - newparam(:dsc_pagedmemorysize) do - def mof_type; 'uint64' end - def mof_is_embedded?; false end - desc "PagedMemorySize" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: NonPagedMemorySize - # Type: uint64 - # IsMandatory: False - # Values: None - newparam(:dsc_nonpagedmemorysize) do - def mof_type; 'uint64' end - def mof_is_embedded?; false end - desc "NonPagedMemorySize" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: VirtualMemorySize - # Type: uint64 - # IsMandatory: False - # Values: None - newparam(:dsc_virtualmemorysize) do - def mof_type; 'uint64' end - def mof_is_embedded?; false end - desc "VirtualMemorySize" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: HandleCount - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_handlecount) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "HandleCount" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ProcessId - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_processid) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "ProcessId" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_windowsprocess).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xadcomputer.rb b/lib/puppet/type/dsc_xadcomputer.rb deleted file mode 100644 index b1c7f747..00000000 --- a/lib/puppet/type/dsc_xadcomputer.rb +++ /dev/null @@ -1,320 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xadcomputer) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xADComputer resource type. - Automatically generated from - 'xActiveDirectory/DSCResources/MSFT_xADComputer/MSFT_xADComputer.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_computername is a required attribute') if self[:dsc_computername].nil? - end - - def dscmeta_resource_friendly_name; 'xADComputer' end - def dscmeta_resource_name; 'MSFT_xADComputer' end - def dscmeta_module_name; 'xActiveDirectory' end - def dscmeta_module_version; '2.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: ComputerName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_computername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ComputerName - Specifies the name of the computer" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Location - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_location) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Location - Specifies the location of the computer, such as an office number" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DnsHostName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_dnshostname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DnsHostName - Specifies the fully qualified domain name (FQDN) of the computer" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ServicePrincipalNames - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_serviceprincipalnames, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ServicePrincipalNames - Specifies the service principal names for the computer account" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: UserPrincipalName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_userprincipalname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UserPrincipalName - Specifies the UPN assigned to the computer account" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DisplayName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_displayname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DisplayName - Specifies the display name of the computer" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Path - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_path) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Path - Specifies the X.500 path of the Organizational Unit (OU) or container where the computer is located" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Description - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_description) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Description - Specifies a description of the computer object" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Enabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_enabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Enabled - Specifies if the computer account is enabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Manager - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_manager) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Manager - Specifies the user or group Distinguished Name that manages the computer object" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DomainController - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domaincontroller) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainController - Specifies the Active Directory Domain Services instance to connect to perform the task" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DomainAdministratorCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_domainadministratorcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "DomainAdministratorCredential - Specifies the user account credentials to use to perform the task" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("DomainAdministratorCredential", value) - end - end - - # Name: RequestFile - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_requestfile) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RequestFile - Specifies the full path to the Offline Domain Join Request file to create." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: DistinguishedName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_distinguishedname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DistinguishedName - Returns the X.500 path of the computer object" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SID - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sid) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SID - Returns the security identifier of the computer object" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xadcomputer).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xadcscertificationauthority.rb b/lib/puppet/type/dsc_xadcscertificationauthority.rb deleted file mode 100644 index af624d9f..00000000 --- a/lib/puppet/type/dsc_xadcscertificationauthority.rb +++ /dev/null @@ -1,423 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xadcscertificationauthority) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xAdcsCertificationAuthority resource type. - Automatically generated from - 'xAdcsDeployment/DSCResources/MSFT_xAdcsCertificationAuthority/MSFT_xAdcsCertificationAuthority.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_catype is a required attribute') if self[:dsc_catype].nil? - end - - def dscmeta_resource_friendly_name; 'xAdcsCertificationAuthority' end - def dscmeta_resource_name; 'MSFT_xAdcsCertificationAuthority' end - def dscmeta_module_name; 'xAdcsDeployment' end - def dscmeta_module_version; '1.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: CAType - # Type: string - # IsMandatory: True - # Values: ["EnterpriseRootCA", "EnterpriseSubordinateCA", "StandaloneRootCA", "StandaloneSubordinateCA"] - newparam(:dsc_catype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CAType - Specifies the type of certification authority to install. The possible values are EnterpriseRootCA, EnterpriseSubordinateCA, StandaloneRootCA, or StandaloneSubordinateCA. Valid values are EnterpriseRootCA, EnterpriseSubordinateCA, StandaloneRootCA, StandaloneSubordinateCA." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['EnterpriseRootCA', 'enterpriserootca', 'EnterpriseSubordinateCA', 'enterprisesubordinateca', 'StandaloneRootCA', 'standalonerootca', 'StandaloneSubordinateCA', 'standalonesubordinateca'].include?(value) - fail("Invalid value '#{value}'. Valid values are EnterpriseRootCA, EnterpriseSubordinateCA, StandaloneRootCA, StandaloneSubordinateCA") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential - To install an enterprise certification authority, the computer must be joined to an Active Directory Domain Services domain and a user account that is a member of the Enterprise Admin group is required. To install a standalone certification authority, the computer can be in a workgroup or AD DS domain. If the computer is in a workgroup, a user account that is a member of Administrators is required. If the computer is in an AD DS domain, a user account that is a member of Domain Admins is required." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies whether the Certificate Authority should be installed or uninstalled. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: CACommonName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_cacommonname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CACommonName - Specifies the certification authority common name." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CADistinguishedNameSuffix - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_cadistinguishednamesuffix) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CADistinguishedNameSuffix - Specifies the certification authority distinguished name suffix." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CertFile - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_certfile) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CertFile - Specifies the file name of certification authority PKCS 12 formatted certificate file." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CertFilePassword - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_certfilepassword) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "CertFilePassword - Specifies the password for certification authority certificate file." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("CertFilePassword", value) - end - end - - # Name: CertificateID - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_certificateid) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CertificateID - Specifies the thumbprint or serial number of certification authority certificate." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CryptoProviderName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_cryptoprovidername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CryptoProviderName - The name of the cryptographic service provider or key storage provider that is used to generate or store the private key for the CA." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseDirectory - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databasedirectory) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseDirectory - Specifies the folder location of the certification authority database." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: HashAlgorithmName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_hashalgorithmname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "HashAlgorithmName - Specifies the signature hash algorithm used by the certification authority." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: IgnoreUnicode - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_ignoreunicode) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "IgnoreUnicode - Specifies that Unicode characters are allowed in certification authority name string." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: KeyContainerName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_keycontainername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "KeyContainerName - Specifies the name of an existing private key container." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: KeyLength - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_keylength) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "KeyLength - Specifies the bit length for new certification authority key." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: LogDirectory - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_logdirectory) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogDirectory - Specifies the folder location of the certification authority database log." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: OutputCertRequestFile - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_outputcertrequestfile) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "OutputCertRequestFile - Specifies the folder location for certificate request file." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: OverwriteExistingCAinDS - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_overwriteexistingcainds) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "OverwriteExistingCAinDS - Specifies that the computer object in the Active Directory Domain Service domain should be overwritten with the same computer name." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: OverwriteExistingDatabase - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_overwriteexistingdatabase) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "OverwriteExistingDatabase - Specifies that the existing certification authority database should be overwritten." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: OverwriteExistingKey - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_overwriteexistingkey) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "OverwriteExistingKey - Overwrite existing key container with the same name" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ParentCA - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_parentca) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ParentCA - Specifies the configuration string of the parent certification authority that will certify this CA." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ValidityPeriod - # Type: string - # IsMandatory: False - # Values: ["Hours", "Days", "Months", "Years"] - newparam(:dsc_validityperiod) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ValidityPeriod - Specifies the validity period of the certification authority certificate in hours, days, weeks, months or years. If this is a subordinate CA, do not use this parameter, because the validity period is determined by the parent CA. Valid values are Hours, Days, Months, Years." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Hours', 'hours', 'Days', 'days', 'Months', 'months', 'Years', 'years'].include?(value) - fail("Invalid value '#{value}'. Valid values are Hours, Days, Months, Years") - end - end - end - - # Name: ValidityPeriodUnits - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_validityperiodunits) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "ValidityPeriodUnits - Validity period of the certification authority certificate. If this is a subordinate CA, do not specify this parameter because the validity period is determined by the parent CA." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xadcscertificationauthority).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xadcsonlineresponder.rb b/lib/puppet/type/dsc_xadcsonlineresponder.rb deleted file mode 100644 index f01af8cc..00000000 --- a/lib/puppet/type/dsc_xadcsonlineresponder.rb +++ /dev/null @@ -1,124 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xadcsonlineresponder) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xAdcsOnlineResponder resource type. - Automatically generated from - 'xAdcsDeployment/DSCResources/MSFT_xAdcsOnlineResponder/MSFT_xAdcsOnlineResponder.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_issingleinstance is a required attribute') if self[:dsc_issingleinstance].nil? - end - - def dscmeta_resource_friendly_name; 'xAdcsOnlineResponder' end - def dscmeta_resource_name; 'MSFT_xAdcsOnlineResponder' end - def dscmeta_module_name; 'xAdcsDeployment' end - def dscmeta_module_version; '1.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: IsSingleInstance - # Type: string - # IsMandatory: True - # Values: ["Yes"] - newparam(:dsc_issingleinstance) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes' Valid values are Yes." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Yes', 'yes'].include?(value) - fail("Invalid value '#{value}'. Valid values are Yes") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential - If the Online Responder service is configured to use Standalone certification authority, then an account that is a member of the local Administrators on the CA is required. If the Online Responder service is configured to use an Enterprise CA, then an account that is a member of Domain Admins is required." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies whether the Online Responder feature should be installed or uninstalled. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xadcsonlineresponder).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xadcswebenrollment.rb b/lib/puppet/type/dsc_xadcswebenrollment.rb deleted file mode 100644 index a36c6e8d..00000000 --- a/lib/puppet/type/dsc_xadcswebenrollment.rb +++ /dev/null @@ -1,139 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xadcswebenrollment) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xAdcsWebEnrollment resource type. - Automatically generated from - 'xAdcsDeployment/DSCResources/MSFT_xAdcsWebEnrollment/MSFT_xAdcsWebEnrollment.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_issingleinstance is a required attribute') if self[:dsc_issingleinstance].nil? - end - - def dscmeta_resource_friendly_name; 'xAdcsWebEnrollment' end - def dscmeta_resource_name; 'MSFT_xAdcsWebEnrollment' end - def dscmeta_module_name; 'xAdcsDeployment' end - def dscmeta_module_version; '1.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: IsSingleInstance - # Type: string - # IsMandatory: True - # Values: ["Yes"] - newparam(:dsc_issingleinstance) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes' Valid values are Yes." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Yes', 'yes'].include?(value) - fail("Invalid value '#{value}'. Valid values are Yes") - end - end - end - - # Name: CAConfig - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_caconfig) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CAConfig - CAConfig parameter string. Do not specify this if there is a local CA installed." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential - If the Web Enrollment service is configured to use Standalone certification authority, then an account that is a member of the local Administrators on the CA is required. If the Web Enrollment service is configured to use an Enterprise CA, then an account that is a member of Domain Admins is required." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies whether the Web Enrollment feature should be installed or uninstalled. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xadcswebenrollment).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xaddomain.rb b/lib/puppet/type/dsc_xaddomain.rb deleted file mode 100644 index 99a67fe3..00000000 --- a/lib/puppet/type/dsc_xaddomain.rb +++ /dev/null @@ -1,208 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xaddomain) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xADDomain resource type. - Automatically generated from - 'xActiveDirectory/DSCResources/MSFT_xADDomain/MSFT_xADDomain.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_domainname is a required attribute') if self[:dsc_domainname].nil? - end - - def dscmeta_resource_friendly_name; 'xADDomain' end - def dscmeta_resource_name; 'MSFT_xADDomain' end - def dscmeta_module_name; 'xActiveDirectory' end - def dscmeta_module_version; '2.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: DomainName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_domainname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainName - Name of the domain to which the user will be added" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DomainAdministratorCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_domainadministratorcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "DomainAdministratorCredential - Credentials used to query for domain existence" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("DomainAdministratorCredential", value) - end - end - - # Name: SafemodeAdministratorPassword - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_safemodeadministratorpassword) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SafemodeAdministratorPassword - Password for the administrator account when the computer is started in Safe Mode" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SafemodeAdministratorPassword", value) - end - end - - # Name: ParentDomainName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_parentdomainname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ParentDomainName - Fully qualified name of the parent domain" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DomainNetbiosName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domainnetbiosname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainNetbiosName - NetBIOS name for the new domain" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DnsDelegationCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_dnsdelegationcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "DnsDelegationCredential - Credential used for creating DNS delegation" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("DnsDelegationCredential", value) - end - end - - # Name: DatabasePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databasepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabasePath - Path to a directory that contains the domain database" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: LogPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_logpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogPath - Path to a directory for the log file that will be written" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SysvolPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sysvolpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SysvolPath - Path to a directory where the Sysvol file will be written" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xaddomain).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xaddomaincontroller.rb b/lib/puppet/type/dsc_xaddomaincontroller.rb deleted file mode 100644 index 0f5f8502..00000000 --- a/lib/puppet/type/dsc_xaddomaincontroller.rb +++ /dev/null @@ -1,177 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xaddomaincontroller) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xADDomainController resource type. - Automatically generated from - 'xActiveDirectory/DSCResources/MSFT_xADDomainController/MSFT_xADDomainController.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_domainname is a required attribute') if self[:dsc_domainname].nil? - end - - def dscmeta_resource_friendly_name; 'xADDomainController' end - def dscmeta_resource_name; 'MSFT_xADDomainController' end - def dscmeta_module_name; 'xActiveDirectory' end - def dscmeta_module_version; '2.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: DomainName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_domainname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainName" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DomainAdministratorCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_domainadministratorcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "DomainAdministratorCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("DomainAdministratorCredential", value) - end - end - - # Name: SafemodeAdministratorPassword - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_safemodeadministratorpassword) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SafemodeAdministratorPassword" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SafemodeAdministratorPassword", value) - end - end - - # Name: DatabasePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databasepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabasePath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: LogPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_logpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SysvolPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sysvolpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SysvolPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SiteName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sitename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SiteName" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xaddomaincontroller).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xaddomaindefaultpasswordpolicy.rb b/lib/puppet/type/dsc_xaddomaindefaultpasswordpolicy.rb deleted file mode 100644 index cb0a620c..00000000 --- a/lib/puppet/type/dsc_xaddomaindefaultpasswordpolicy.rb +++ /dev/null @@ -1,274 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xaddomaindefaultpasswordpolicy) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xADDomainDefaultPasswordPolicy resource type. - Automatically generated from - 'xActiveDirectory/DSCResources/MSFT_xADDomainDefaultPasswordPolicy/MSFT_xADDomainDefaultPasswordPolicy.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_domainname is a required attribute') if self[:dsc_domainname].nil? - end - - def dscmeta_resource_friendly_name; 'xADDomainDefaultPasswordPolicy' end - def dscmeta_resource_name; 'MSFT_xADDomainDefaultPasswordPolicy' end - def dscmeta_module_name; 'xActiveDirectory' end - def dscmeta_module_version; '2.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: DomainName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_domainname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainName - Name of the domain to which the password policy will be applied" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ComplexityEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_complexityenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ComplexityEnabled - Whether password complexity is enabled for the default password policy" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: LockoutDuration - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_lockoutduration) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "LockoutDuration - Length of time that an account is locked after the number of failed login attempts (minutes)" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: LockoutObservationWindow - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_lockoutobservationwindow) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "LockoutObservationWindow - Maximum time between two unsuccessful login attempts before the counter is reset to 0 (minutes)" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: LockoutThreshold - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_lockoutthreshold) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "LockoutThreshold - Number of unsuccessful login attempts that are permitted before an account is locked out" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MinPasswordAge - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_minpasswordage) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "MinPasswordAge - Minimum length of time that you can have the same password (minutes)" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MaxPasswordAge - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_maxpasswordage) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "MaxPasswordAge - Maximum length of time that you can have the same password (minutes)" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MinPasswordLength - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_minpasswordlength) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "MinPasswordLength - Minimum number of characters that a password must contain" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: PasswordHistoryCount - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_passwordhistorycount) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "PasswordHistoryCount - Number of previous passwords to remember" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ReversibleEncryptionEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_reversibleencryptionenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ReversibleEncryptionEnabled - Whether the directory must store passwords using reversible encryption" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DomainController - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domaincontroller) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainController - Active Directory domain controller to enact the change upon" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential - Credentials used to access the domain" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xaddomaindefaultpasswordpolicy).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xaddomaintrust.rb b/lib/puppet/type/dsc_xaddomaintrust.rb deleted file mode 100644 index 8b47a3fd..00000000 --- a/lib/puppet/type/dsc_xaddomaintrust.rb +++ /dev/null @@ -1,174 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xaddomaintrust) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xADDomainTrust resource type. - Automatically generated from - 'xActiveDirectory/DSCResources/MSFT_xADDomainTrust/MSFT_xADDomainTrust.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_targetdomainname is a required attribute') if self[:dsc_targetdomainname].nil? - fail('dsc_sourcedomainname is a required attribute') if self[:dsc_sourcedomainname].nil? - end - - def dscmeta_resource_friendly_name; 'xADDomainTrust' end - def dscmeta_resource_name; 'MSFT_xADDomainTrust' end - def dscmeta_module_name; 'xActiveDirectory' end - def dscmeta_module_version; '2.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Should this resource be present or absent Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: TargetDomainAdministratorCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_targetdomainadministratorcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "TargetDomainAdministratorCredential - Credentials to authenticate to the target domain" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("TargetDomainAdministratorCredential", value) - end - end - - # Name: TargetDomainName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_targetdomainname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TargetDomainName - Name of the AD domain that is being trusted" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: TrustType - # Type: string - # IsMandatory: False - # Values: ["External", "Forest"] - newparam(:dsc_trusttype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TrustType - Type of trust Valid values are External, Forest." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['External', 'external', 'Forest', 'forest'].include?(value) - fail("Invalid value '#{value}'. Valid values are External, Forest") - end - end - end - - # Name: TrustDirection - # Type: string - # IsMandatory: False - # Values: ["Bidirectional", "Inbound", "Outbound"] - newparam(:dsc_trustdirection) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TrustDirection - Direction of trust Valid values are Bidirectional, Inbound, Outbound." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Bidirectional', 'bidirectional', 'Inbound', 'inbound', 'Outbound', 'outbound'].include?(value) - fail("Invalid value '#{value}'. Valid values are Bidirectional, Inbound, Outbound") - end - end - end - - # Name: SourceDomainName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_sourcedomainname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourceDomainName - Name of the AD domain that is requesting the trust" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xaddomaintrust).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xadgroup.rb b/lib/puppet/type/dsc_xadgroup.rb deleted file mode 100644 index ab4a01b7..00000000 --- a/lib/puppet/type/dsc_xadgroup.rb +++ /dev/null @@ -1,319 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xadgroup) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xADGroup resource type. - Automatically generated from - 'xActiveDirectory/DSCResources/MSFT_xADGroup/MSFT_xADGroup.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_groupname is a required attribute') if self[:dsc_groupname].nil? - end - - def dscmeta_resource_friendly_name; 'xADGroup' end - def dscmeta_resource_name; 'MSFT_xADGroup' end - def dscmeta_module_name; 'xActiveDirectory' end - def dscmeta_module_version; '2.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: GroupName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_groupname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "GroupName - Name of the Active Directory group" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: GroupScope - # Type: string - # IsMandatory: False - # Values: ["DomainLocal", "Global", "Universal"] - newparam(:dsc_groupscope) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "GroupScope - Active Directory group scope Valid values are DomainLocal, Global, Universal." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['DomainLocal', 'domainlocal', 'Global', 'global', 'Universal', 'universal'].include?(value) - fail("Invalid value '#{value}'. Valid values are DomainLocal, Global, Universal") - end - end - end - - # Name: Category - # Type: string - # IsMandatory: False - # Values: ["Security", "Distribution"] - newparam(:dsc_category) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Category - Active Directory group category Valid values are Security, Distribution." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Security', 'security', 'Distribution', 'distribution'].include?(value) - fail("Invalid value '#{value}'. Valid values are Security, Distribution") - end - end - end - - # Name: Path - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_path) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Path - Location of the group within Active Directory expressed as a Distinguished Name" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Should this resource be present or absent Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Description - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_description) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Description - Description of the Active Directory group" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DisplayName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_displayname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DisplayName - Display name of the Active Directory group" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential - Credentials used to enact the change upon" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: DomainController - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domaincontroller) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainController - Active Directory domain controller to enact the change upon" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Members - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_members, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Members - Active Directory group membership should match membership exactly" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: MembersToInclude - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_memberstoinclude, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "MembersToInclude - Active Directory group should include these members" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: MembersToExclude - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_memberstoexclude, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "MembersToExclude - Active Directory group should NOT include these members" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: MembershipAttribute - # Type: string - # IsMandatory: False - # Values: ["SamAccountName", "DistinguishedName", "ObjectGUID", "SID"] - newparam(:dsc_membershipattribute) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MembershipAttribute - Active Directory attribute used to perform membership operations Valid values are SamAccountName, DistinguishedName, ObjectGUID, SID." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['SamAccountName', 'samaccountname', 'DistinguishedName', 'distinguishedname', 'ObjectGUID', 'objectguid', 'SID', 'sid'].include?(value) - fail("Invalid value '#{value}'. Valid values are SamAccountName, DistinguishedName, ObjectGUID, SID") - end - end - end - - # Name: ManagedBy - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_managedby) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ManagedBy - Active Directory managed by attribute specified as a DistinguishedName" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Notes - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_notes) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Notes - Active Directory group notes field" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xadgroup).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xadorganizationalunit.rb b/lib/puppet/type/dsc_xadorganizationalunit.rb deleted file mode 100644 index c4ba929e..00000000 --- a/lib/puppet/type/dsc_xadorganizationalunit.rb +++ /dev/null @@ -1,169 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xadorganizationalunit) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xADOrganizationalUnit resource type. - Automatically generated from - 'xActiveDirectory/DSCResources/MSFT_xADOrganizationalUnit/MSFT_xADOrganizationalUnit.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - fail('dsc_path is a required attribute') if self[:dsc_path].nil? - end - - def dscmeta_resource_friendly_name; 'xADOrganizationalUnit' end - def dscmeta_resource_name; 'MSFT_xADOrganizationalUnit' end - def dscmeta_module_name; 'xActiveDirectory' end - def dscmeta_module_version; '2.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of OU" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Path - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_path) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Path - Specifies the X500 path of the OU or container where the new object is created" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential - The credential to be used to perform the operation on Active Directory" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: ProtectedFromAccidentalDeletion - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_protectedfromaccidentaldeletion) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ProtectedFromAccidentalDeletion - Defaults to True" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Description - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_description) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Description - The description of the OU" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xadorganizationalunit).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xadrecyclebin.rb b/lib/puppet/type/dsc_xadrecyclebin.rb deleted file mode 100644 index b28792e8..00000000 --- a/lib/puppet/type/dsc_xadrecyclebin.rb +++ /dev/null @@ -1,131 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xadrecyclebin) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xADRecycleBin resource type. - Automatically generated from - 'xActiveDirectory/DSCResources/MSFT_xADRecycleBin/MSFT_xADRecycleBin.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_forestfqdn is a required attribute') if self[:dsc_forestfqdn].nil? - end - - def dscmeta_resource_friendly_name; 'xADRecycleBin' end - def dscmeta_resource_name; 'MSFT_xADRecycleBin' end - def dscmeta_module_name; 'xActiveDirectory' end - def dscmeta_module_version; '2.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: ForestFQDN - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_forestfqdn) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ForestFQDN" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: EnterpriseAdministratorCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_enterpriseadministratorcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "EnterpriseAdministratorCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("EnterpriseAdministratorCredential", value) - end - end - - # Name: RecycleBinEnabled - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_recyclebinenabled) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RecycleBinEnabled" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ForestMode - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_forestmode) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ForestMode" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xadrecyclebin).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xaduser.rb b/lib/puppet/type/dsc_xaduser.rb deleted file mode 100644 index 33b33c9f..00000000 --- a/lib/puppet/type/dsc_xaduser.rb +++ /dev/null @@ -1,775 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xaduser) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xADUser resource type. - Automatically generated from - 'xActiveDirectory/DSCResources/MSFT_xADUser/MSFT_xADUser.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_domainname is a required attribute') if self[:dsc_domainname].nil? - fail('dsc_username is a required attribute') if self[:dsc_username].nil? - end - - def dscmeta_resource_friendly_name; 'xADUser' end - def dscmeta_resource_name; 'MSFT_xADUser' end - def dscmeta_module_name; 'xActiveDirectory' end - def dscmeta_module_version; '2.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: DomainName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_domainname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainName - Name of the domain where the user account is located (only used if password is managed)" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UserName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_username) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UserName - Specifies the Security Account Manager (SAM) account name of the user (ldapDisplayName 'sAMAccountName')" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Password - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_password) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Password - Specifies a new password value for the account" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Password", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies whether the user account is created or deleted Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: CommonName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_commonname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CommonName - Specifies the common nane assigned to the user account (ldapDisplayName 'cn')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UserPrincipalName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_userprincipalname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UserPrincipalName - Specifies the UPN assigned to the user account (ldapDisplayName 'userPrincipalName')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DisplayName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_displayname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DisplayName - Specifies the display name of the object (ldapDisplayName 'displayName')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Path - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_path) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Path - Specifies the X.500 path of the Organizational Unit (OU) or container where the new object is created" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: GivenName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_givenname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "GivenName - Specifies the user's given name (ldapDisplayName 'givenName')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Initials - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_initials) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Initials - Specifies the initials that represent part of a user's name (ldapDisplayName 'initials')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Surname - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_surname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Surname - Specifies the user's last name or surname (ldapDisplayName 'sn')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Description - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_description) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Description - Specifies a description of the object (ldapDisplayName 'description')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: StreetAddress - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_streetaddress) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "StreetAddress - Specifies the user's street address (ldapDisplayName 'streetAddress')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: POBox - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_pobox) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "POBox - Specifies the user's post office box number (ldapDisplayName 'postOfficeBox')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: City - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_city) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "City - Specifies the user's town or city (ldapDisplayName 'l')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: State - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_state) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "State - Specifies the user's or Organizational Unit's state or province (ldapDisplayName 'st')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: PostalCode - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_postalcode) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "PostalCode - Specifies the user's postal code or zip code (ldapDisplayName 'postalCode')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Country - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_country) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Country - Specifies the country or region code for the user's language of choice (ldapDisplayName 'c')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Department - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_department) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Department - Specifies the user's department (ldapDisplayName 'department')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Division - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_division) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Division - Specifies the user's division (ldapDisplayName 'division')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Company - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_company) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Company - Specifies the user's company (ldapDisplayName 'company')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Office - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_office) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Office - Specifies the location of the user's office or place of business (ldapDisplayName 'physicalDeliveryOfficeName')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: JobTitle - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_jobtitle) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "JobTitle - Specifies the user's title (ldapDisplayName 'title')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: EmailAddress - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_emailaddress) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "EmailAddress - Specifies the user's e-mail address (ldapDisplayName 'mail')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: EmployeeID - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_employeeid) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "EmployeeID - Specifies the user's employee ID (ldapDisplayName 'employeeID')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: EmployeeNumber - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_employeenumber) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "EmployeeNumber - Specifies the user's employee number (ldapDisplayName 'employeeNumber')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: HomeDirectory - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_homedirectory) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "HomeDirectory - Specifies a user's home directory path (ldapDisplayName 'homeDirectory')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: HomeDrive - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_homedrive) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "HomeDrive - Specifies a drive that is associated with the UNC path defined by the HomeDirectory property (ldapDisplayName 'homeDrive')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: HomePage - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_homepage) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "HomePage - Specifies the URL of the home page of the object (ldapDisplayName 'wWWHomePage')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ProfilePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_profilepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProfilePath - Specifies a path to the user's profile (ldapDisplayName 'profilePath')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: LogonScript - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_logonscript) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogonScript - Specifies a path to the user's log on script (ldapDisplayName 'scriptPath')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Notes - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_notes) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Notes - Specifies the notes attached to the user's accoutn (ldapDisplayName 'info')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: OfficePhone - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_officephone) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "OfficePhone - Specifies the user's office telephone number (ldapDisplayName 'telephoneNumber')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MobilePhone - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_mobilephone) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MobilePhone - Specifies the user's mobile phone number (ldapDisplayName 'mobile')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Fax - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_fax) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Fax - Specifies the user's fax phone number (ldapDisplayName 'facsimileTelephoneNumber')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: HomePhone - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_homephone) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "HomePhone - Specifies the user's home telephone number (ldapDisplayName 'homePhone')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Pager - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_pager) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Pager - Specifies the user's pager number (ldapDisplayName 'pager')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: IPPhone - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_ipphone) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IPPhone - Specifies the user's IP telephony phone number (ldapDisplayName 'ipPhone')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Manager - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_manager) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Manager - Specifies the user's manager specified as a Distinguished Name (ldapDisplayName 'manager')" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Enabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_enabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Enabled - Specifies if the account is enabled (default True)" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: CannotChangePassword - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_cannotchangepassword) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "CannotChangePassword - Specifies whether the account password can be changed" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: PasswordNeverExpires - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_passwordneverexpires) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "PasswordNeverExpires - Specifies whether the password of an account can expire" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DomainController - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domaincontroller) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainController - Specifies the Active Directory Domain Services instance to use to perform the task." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DomainAdministratorCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_domainadministratorcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "DomainAdministratorCredential - Specifies the user account credentials to use to perform this task" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("DomainAdministratorCredential", value) - end - end - - # Name: PasswordAuthentication - # Type: string - # IsMandatory: False - # Values: ["Default", "Negotiate"] - newparam(:dsc_passwordauthentication) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "PasswordAuthentication - Specifies the authentication context type used when testing passwords Valid values are Default, Negotiate." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Default', 'default', 'Negotiate', 'negotiate'].include?(value) - fail("Invalid value '#{value}'. Valid values are Default, Negotiate") - end - end - end - - # Name: DistinguishedName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_distinguishedname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DistinguishedName - Returns the X.500 path of the object" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xaduser).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xarchive.rb b/lib/puppet/type/dsc_xarchive.rb deleted file mode 100644 index 3d69b9d6..00000000 --- a/lib/puppet/type/dsc_xarchive.rb +++ /dev/null @@ -1,188 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xarchive) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xArchive resource type. - Automatically generated from - 'xPSDesiredStateConfiguration/DSCResources/MSFT_xArchive/MSFT_xArchive.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_path is a required attribute') if self[:dsc_path].nil? - fail('dsc_destination is a required attribute') if self[:dsc_destination].nil? - end - - def dscmeta_resource_friendly_name; 'xArchive' end - def dscmeta_resource_name; 'MSFT_xArchive' end - def dscmeta_module_name; 'xPSDesiredStateConfiguration' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Path - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_path) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Path - The path to the archive file that should be expanded to or removed from the specified destination." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Destination - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_destination) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Destination - The path where the specified archive file should be expanded to or removed from." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies whether or not the expanded content of the archive file at the specified path should exist at the specified destination. To update the specified destination to have the expanded content of the archive file at the specified path, specify this property as Present. To remove the expanded content of the archive file at the specified path from the specified destination, specify this property as Absent. The default value is Present. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Validate - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_validate) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Validate - Specifies whether or not to validate that a file at the destination with the same name as a file in the archive actually matches that corresponding file in the archive by the specified checksum method. If the file does not match and Ensure is specified as Present and Force is not specified, the resource will throw an error that the file at the desintation cannot be overwritten. If the file does not match and Ensure is specified as Present and Force is specified, the file at the desintation will be overwritten. If the file does not match and Ensure is specified as Absent, the file at the desintation will not be removed. The default value is false." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Checksum - # Type: string - # IsMandatory: False - # Values: ["SHA-1", "SHA-256", "SHA-512", "CreatedDate", "ModifiedDate"] - newparam(:dsc_checksum) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Checksum - The Checksum method to use to validate whether or not a file at the destination with the same name as a file in the archive actually matches that corresponding file in the archive. An invalid argument exception will be thrown if Checksum is specified while Validate is specified as false. ModifiedDate will check that the LastWriteTime property of the file at the destination matches the LastWriteTime property of the file in the archive. CreatedDate will check that the CreationTime property of the file at the destination matches the CreationTime property of the file in the archive. SHA-1, SHA-256, and SHA-512 will check that the hash of the file at the destination by the specified SHA method matches the hash of the file in the archive by the specified SHA method. The default value is ModifiedDate. Valid values are SHA-1, SHA-256, SHA-512, CreatedDate, ModifiedDate." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['SHA-1', 'sha-1', 'SHA-256', 'sha-256', 'SHA-512', 'sha-512', 'CreatedDate', 'createddate', 'ModifiedDate', 'modifieddate'].include?(value) - fail("Invalid value '#{value}'. Valid values are SHA-1, SHA-256, SHA-512, CreatedDate, ModifiedDate") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential - The credential of a user account with permissions to access the specified archive path and destination if needed." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Force - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_force) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Force - Specifies whether or not any existing files or directories at the destination with the same name as a file or directory in the archive should be overwritten to match the file or directory in the archive. When this property is false, an error will be thrown if an item at the destination needs to be overwritten. The default value is false." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xarchive).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xazureaffinitygroup.rb b/lib/puppet/type/dsc_xazureaffinitygroup.rb deleted file mode 100644 index 276ce787..00000000 --- a/lib/puppet/type/dsc_xazureaffinitygroup.rb +++ /dev/null @@ -1,150 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xazureaffinitygroup) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xAzureAffinityGroup resource type. - Automatically generated from - 'xAzure/DSCResources/MSFT_xAzureAffinityGroup/MSFT_xAzureAffinityGroup.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xAzureAffinityGroup' end - def dscmeta_resource_name; 'MSFT_xAzureAffinityGroup' end - def dscmeta_module_name; 'xAzure' end - def dscmeta_module_version; '0.2.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Specifies a name for the new affinity group that is unique to the subscription." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies whether the Azure Affinity Group should be present or absent. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Location - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_location) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Location - Specifies the geographical location of the data center where the affinity group will be created. This must match a value from the Name property of objects returned by Get-AzureLocation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Description - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_description) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Description - Specifies a description for the affinity group. The description may be up to 1024 characters in length. " - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Label - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_label) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Label - Specifies a label for the affinity group. The label may be up to 100 characters in length. " - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xazureaffinitygroup).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xazurepackadmin.rb b/lib/puppet/type/dsc_xazurepackadmin.rb deleted file mode 100644 index a1f54f46..00000000 --- a/lib/puppet/type/dsc_xazurepackadmin.rb +++ /dev/null @@ -1,169 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xazurepackadmin) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xAzurePackAdmin resource type. - Automatically generated from - 'xAzurePack/DSCResources/MSFT_xAzurePackAdmin/MSFT_xAzurePackAdmin.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_principal is a required attribute') if self[:dsc_principal].nil? - fail('dsc_sqlserver is a required attribute') if self[:dsc_sqlserver].nil? - end - - def dscmeta_resource_friendly_name; 'xAzurePackAdmin' end - def dscmeta_resource_name; 'MSFT_xAzurePackAdmin' end - def dscmeta_module_name; 'xAzurePack' end - def dscmeta_module_version; '1.4.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if the principal is an Azure Pack admin.\nPresent {default} \nAbsent \n Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Principal - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_principal) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Principal - The Azure Pack admin principal." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AzurePackAdminCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_azurepackadmincredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "AzurePackAdminCredential - Credential to be used to perform the installation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("AzurePackAdminCredential", value) - end - end - - # Name: SQLServer - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_sqlserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLServer - Database server for the Azure Pack databases." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLInstance - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlinstance) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLInstance - Database instance for the Azure Pack databases." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: dbUser - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_dbuser) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "dbUser - SQL user to be used to create the database if the SetupCredential cannot be used." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("dbUser", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xazurepackadmin).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xazurepackdatabasesetting.rb b/lib/puppet/type/dsc_xazurepackdatabasesetting.rb deleted file mode 100644 index b3951fbf..00000000 --- a/lib/puppet/type/dsc_xazurepackdatabasesetting.rb +++ /dev/null @@ -1,184 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xazurepackdatabasesetting) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xAzurePackDatabaseSetting resource type. - Automatically generated from - 'xAzurePack/DSCResources/MSFT_xAzurePackDatabaseSetting/MSFT_xAzurePackDatabaseSetting.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_namespace is a required attribute') if self[:dsc_namespace].nil? - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - fail('dsc_sqlserver is a required attribute') if self[:dsc_sqlserver].nil? - end - - def dscmeta_resource_friendly_name; 'xAzurePackDatabaseSetting' end - def dscmeta_resource_name; 'MSFT_xAzurePackDatabaseSetting' end - def dscmeta_module_name; 'xAzurePack' end - def dscmeta_module_version; '1.4.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Namespace - # Type: string - # IsMandatory: True - # Values: ["AdminSite", "TenantSite"] - newparam(:dsc_namespace) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Namespace - Specifies the namespace. Valid values are AdminSite, TenantSite." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['AdminSite', 'adminsite', 'TenantSite', 'tenantsite'].include?(value) - fail("Invalid value '#{value}'. Valid values are AdminSite, TenantSite") - end - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Specifies the name of the setting." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Value - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_value) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Value - Specifies the value of the setting." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AzurePackAdminCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_azurepackadmincredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "AzurePackAdminCredential - Credential to be used to perform the installation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("AzurePackAdminCredential", value) - end - end - - # Name: SQLServer - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_sqlserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLServer - Database server for the Azure Pack databases." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLInstance - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlinstance) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLInstance - Database instance for the Azure Pack databases." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: dbUser - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_dbuser) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "dbUser - SQL user to be used to create the database if the SetupCredential cannot be used." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("dbUser", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xazurepackdatabasesetting).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xazurepackfqdn.rb b/lib/puppet/type/dsc_xazurepackfqdn.rb deleted file mode 100644 index 16a8894f..00000000 --- a/lib/puppet/type/dsc_xazurepackfqdn.rb +++ /dev/null @@ -1,183 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xazurepackfqdn) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xAzurePackFQDN resource type. - Automatically generated from - 'xAzurePack/DSCResources/MSFT_xAzurePackFQDN/MSFT_xAzurePackFQDN.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_namespace is a required attribute') if self[:dsc_namespace].nil? - end - - def dscmeta_resource_friendly_name; 'xAzurePackFQDN' end - def dscmeta_resource_name; 'MSFT_xAzurePackFQDN' end - def dscmeta_module_name; 'xAzurePack' end - def dscmeta_module_version; '1.4.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Namespace - # Type: string - # IsMandatory: True - # Values: ["AdminSite", "AuthSite", "TenantSite", "WindowsAuthSite"] - newparam(:dsc_namespace) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Namespace - Specifies a namespace. Valid values are AdminSite, AuthSite, TenantSite, WindowsAuthSite." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['AdminSite', 'adminsite', 'AuthSite', 'authsite', 'TenantSite', 'tenantsite', 'WindowsAuthSite', 'windowsauthsite'].include?(value) - fail("Invalid value '#{value}'. Valid values are AdminSite, AuthSite, TenantSite, WindowsAuthSite") - end - end - end - - # Name: FullyQualifiedDomainName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_fullyqualifieddomainname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FullyQualifiedDomainName - Specifies a Fully Qualified Domain Name (FQDN)." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Port - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_port) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "Port - Specifies a port number." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: AzurePackAdminCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_azurepackadmincredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "AzurePackAdminCredential - Credential to be used to perform the installation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("AzurePackAdminCredential", value) - end - end - - # Name: SQLServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLServer - Database server for the Azure Pack databases." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLInstance - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlinstance) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLInstance - Database instance for the Azure Pack databases." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: dbUser - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_dbuser) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "dbUser - SQL user to be used to create the database if the SetupCredential cannot be used." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("dbUser", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xazurepackfqdn).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xazurepackidentityprovider.rb b/lib/puppet/type/dsc_xazurepackidentityprovider.rb deleted file mode 100644 index 919a00b5..00000000 --- a/lib/puppet/type/dsc_xazurepackidentityprovider.rb +++ /dev/null @@ -1,183 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xazurepackidentityprovider) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xAzurePackIdentityProvider resource type. - Automatically generated from - 'xAzurePack/DSCResources/MSFT_xAzurePackIdentityProvider/MSFT_xAzurePackIdentityProvider.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_target is a required attribute') if self[:dsc_target].nil? - end - - def dscmeta_resource_friendly_name; 'xAzurePackIdentityProvider' end - def dscmeta_resource_name; 'MSFT_xAzurePackIdentityProvider' end - def dscmeta_module_name; 'xAzurePack' end - def dscmeta_module_version; '1.4.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Target - # Type: string - # IsMandatory: True - # Values: ["Membership", "Windows"] - newparam(:dsc_target) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Target - Specifies the target site. Valid values are Membership, Windows." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Membership', 'membership', 'Windows', 'windows'].include?(value) - fail("Invalid value '#{value}'. Valid values are Membership, Windows") - end - end - end - - # Name: FullyQualifiedDomainName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_fullyqualifieddomainname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FullyQualifiedDomainName - Specifies a Fully Qualified Domain Name (FQDN)." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Port - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_port) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "Port - Specifies a port number." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: AzurePackAdminCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_azurepackadmincredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "AzurePackAdminCredential - Credential to be used to perform the installation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("AzurePackAdminCredential", value) - end - end - - # Name: SQLServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLServer - Database server for the Azure Pack databases." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLInstance - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlinstance) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLInstance - Database instance for the Azure Pack databases." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: dbUser - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_dbuser) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "dbUser - SQL user to be used to create the database if the SetupCredential cannot be used." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("dbUser", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xazurepackidentityprovider).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xazurepackrelyingparty.rb b/lib/puppet/type/dsc_xazurepackrelyingparty.rb deleted file mode 100644 index 2bdf01e1..00000000 --- a/lib/puppet/type/dsc_xazurepackrelyingparty.rb +++ /dev/null @@ -1,185 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xazurepackrelyingparty) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xAzurePackRelyingParty resource type. - Automatically generated from - 'xAzurePack/DSCResources/MSFT_xAzurePackRelyingParty/MSFT_xAzurePackRelyingParty.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_target is a required attribute') if self[:dsc_target].nil? - fail('dsc_fullyqualifieddomainname is a required attribute') if self[:dsc_fullyqualifieddomainname].nil? - end - - def dscmeta_resource_friendly_name; 'xAzurePackRelyingParty' end - def dscmeta_resource_name; 'MSFT_xAzurePackRelyingParty' end - def dscmeta_module_name; 'xAzurePack' end - def dscmeta_module_version; '1.4.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Target - # Type: string - # IsMandatory: True - # Values: ["Admin", "Tenant"] - newparam(:dsc_target) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Target - Specifies the target site. Valid values are Admin, Tenant." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Admin', 'admin', 'Tenant', 'tenant'].include?(value) - fail("Invalid value '#{value}'. Valid values are Admin, Tenant") - end - end - end - - # Name: FullyQualifiedDomainName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_fullyqualifieddomainname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FullyQualifiedDomainName - Specifies a Fully Qualified Domain Name (FQDN)." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Port - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_port) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "Port - Specifies a port number." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: AzurePackAdminCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_azurepackadmincredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "AzurePackAdminCredential - Credential to be used to perform the installation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("AzurePackAdminCredential", value) - end - end - - # Name: SQLServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLServer - Database server for the Azure Pack databases." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLInstance - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlinstance) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLInstance - Database instance for the Azure Pack databases." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: dbUser - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_dbuser) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "dbUser - SQL user to be used to create the database if the SetupCredential cannot be used." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("dbUser", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xazurepackrelyingparty).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xazurepackresourceprovider.rb b/lib/puppet/type/dsc_xazurepackresourceprovider.rb deleted file mode 100644 index 67578930..00000000 --- a/lib/puppet/type/dsc_xazurepackresourceprovider.rb +++ /dev/null @@ -1,638 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xazurepackresourceprovider) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xAzurePackResourceProvider resource type. - Automatically generated from - 'xAzurePack/DSCResources/MSFT_xAzurePackResourceProvider/MSFT_xAzurePackResourceProvider.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xAzurePackResourceProvider' end - def dscmeta_resource_name; 'MSFT_xAzurePackResourceProvider' end - def dscmeta_module_name; 'xAzurePack' end - def dscmeta_module_version; '1.4.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: AuthenticationSite - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_authenticationsite) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AuthenticationSite - URL of the authentication site." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AdminUri - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_adminuri) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AdminUri - Specifies the URI of the Windows Azure Pack administrator API." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Specifies the name of a resource provider." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AzurePackAdminCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_azurepackadmincredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "AzurePackAdminCredential - Credential to be used to perform the installation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("AzurePackAdminCredential", value) - end - end - - # Name: DisplayName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_displayname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DisplayName - Specifies the display name of a resource provider." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Enabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_enabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Enabled - Enables the resource provider." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: PassthroughEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_passthroughenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "PassthroughEnabled - Indicates whether the resource provider supports API pass-through." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AllowAnonymousAccess - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowanonymousaccess) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowAnonymousAccess - Specifies the URI of the Windows Azure Pack administrator API." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AllowMultipleInstances - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowmultipleinstances) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowMultipleInstances - Indicates that the cmdlet allows multiple instances of the resource provider." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AdminForwardingAddress - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_adminforwardingaddress) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AdminForwardingAddress - Specifies an administrative forwarding address for a resource provider." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AdminAuthenticationMode - # Type: string - # IsMandatory: False - # Values: ["None", "Basic", "Windows"] - newparam(:dsc_adminauthenticationmode) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AdminAuthenticationMode - Specifies the administrative authentication mode for a resource provider. Valid values are None, Basic, Windows." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['None', 'none', 'Basic', 'basic', 'Windows', 'windows'].include?(value) - fail("Invalid value '#{value}'. Valid values are None, Basic, Windows") - end - end - end - - # Name: AdminAuthenticationUser - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_adminauthenticationuser) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "AdminAuthenticationUser - Specifies, as a PSCredential object, an administrative user name and password to connect to a resource provider." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("AdminAuthenticationUser", value) - end - end - - # Name: AdminAuthenticationUsername - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_adminauthenticationusername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AdminAuthenticationUsername - Output for the administrative user name." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: TenantForwardingAddress - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_tenantforwardingaddress) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TenantForwardingAddress - Specifies the tenant forwarding address of a resource provider." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: TenantAuthenticationMode - # Type: string - # IsMandatory: False - # Values: ["None", "Basic", "Windows"] - newparam(:dsc_tenantauthenticationmode) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TenantAuthenticationMode - Specifies the tenant authentication mode for a resource provider. Valid values are None, Basic, Windows." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['None', 'none', 'Basic', 'basic', 'Windows', 'windows'].include?(value) - fail("Invalid value '#{value}'. Valid values are None, Basic, Windows") - end - end - end - - # Name: TenantAuthenticationUser - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_tenantauthenticationuser) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "TenantAuthenticationUser - Specifies, as a PSCredential object, a tenant user name and password to connect to a resource provider." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("TenantAuthenticationUser", value) - end - end - - # Name: TenantAuthenticationUsername - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_tenantauthenticationusername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TenantAuthenticationUsername - Output for the tenant user name." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: TenantSourceUriTemplate - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_tenantsourceuritemplate) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TenantSourceUriTemplate - Specifies the tenant source URI template of a resource provider." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: TenantTargetUriTemplate - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_tenanttargeturitemplate) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TenantTargetUriTemplate - Specifies the tenant target URI template of a resource provider." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UsageForwardingAddress - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_usageforwardingaddress) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UsageForwardingAddress - Specifies the tenant forwarding address of a resource provider." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UsageAuthenticationMode - # Type: string - # IsMandatory: False - # Values: ["None", "Basic", "Windows"] - newparam(:dsc_usageauthenticationmode) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UsageAuthenticationMode - Specifies the usage authentication mode for a resource provider. Valid values are None, Basic, Windows." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['None', 'none', 'Basic', 'basic', 'Windows', 'windows'].include?(value) - fail("Invalid value '#{value}'. Valid values are None, Basic, Windows") - end - end - end - - # Name: UsageAuthenticationUser - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_usageauthenticationuser) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "UsageAuthenticationUser - Specifies, as a PSCredential object, a usage user name and password to connect to a resource provider." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("UsageAuthenticationUser", value) - end - end - - # Name: UsageAuthenticationUsername - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_usageauthenticationusername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UsageAuthenticationUsername - Output for the usage user name." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: HealthCheckForwardingAddress - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_healthcheckforwardingaddress) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "HealthCheckForwardingAddress - Specifies the health check forwarding address for a resource provider." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: HealthCheckAuthenticationMode - # Type: string - # IsMandatory: False - # Values: ["None", "Basic", "Windows"] - newparam(:dsc_healthcheckauthenticationmode) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "HealthCheckAuthenticationMode - Specifies the health check authentication mode for a resource provider. Valid values are None, Basic, Windows." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['None', 'none', 'Basic', 'basic', 'Windows', 'windows'].include?(value) - fail("Invalid value '#{value}'. Valid values are None, Basic, Windows") - end - end - end - - # Name: HealthCheckAuthenticationUser - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_healthcheckauthenticationuser) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "HealthCheckAuthenticationUser - Specifies, as a PSCredential object, a health check user name and password to connect to a resource provider." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("HealthCheckAuthenticationUser", value) - end - end - - # Name: HealthCheckAuthenticationUsername - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_healthcheckauthenticationusername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "HealthCheckAuthenticationUsername - Output for the health check user name." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: NotificationForwardingAddress - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_notificationforwardingaddress) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "NotificationForwardingAddress - Specifies the notification forwarding address of a resource provider." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: NotificationAuthenticationMode - # Type: string - # IsMandatory: False - # Values: ["None", "Basic", "Windows"] - newparam(:dsc_notificationauthenticationmode) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "NotificationAuthenticationMode - Specifies the notification authentication mode for a resource provider. Valid values are None, Basic, Windows." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['None', 'none', 'Basic', 'basic', 'Windows', 'windows'].include?(value) - fail("Invalid value '#{value}'. Valid values are None, Basic, Windows") - end - end - end - - # Name: NotificationAuthenticationUser - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_notificationauthenticationuser) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "NotificationAuthenticationUser - Specifies, as a PSCredential object, a notification user name and password to connect to a resource provider." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("NotificationAuthenticationUser", value) - end - end - - # Name: NotificationAuthenticationUsername - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_notificationauthenticationusername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "NotificationAuthenticationUsername - Output for the notification user name." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstanceId - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_instanceid) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstanceId - Specifies an ID for an instance of a resource provider." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstanceDisplayName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_instancedisplayname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstanceDisplayName - Specifies a display name for an instance of a resource provider." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MaxQuotaUpdateBatchSize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_maxquotaupdatebatchsize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MaxQuotaUpdateBatchSize - Specifies the number of subscriptions that can be updated in a single request." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SubscriptionStatusPollingInterval - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_subscriptionstatuspollinginterval) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SubscriptionStatusPollingInterval - Specifies the time interval at which the management service polls the resource provider for subscription status updates." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Type - # Type: string - # IsMandatory: False - # Values: ["Standard", "UsageProvider", "CloudServiceProvider"] - newparam(:dsc_type) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Type - Specifies the type of the resource provider. Valid values are Standard, UsageProvider, CloudServiceProvider." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Standard', 'standard', 'UsageProvider', 'usageprovider', 'CloudServiceProvider', 'cloudserviceprovider'].include?(value) - fail("Invalid value '#{value}'. Valid values are Standard, UsageProvider, CloudServiceProvider") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xazurepackresourceprovider).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xazurepacksetup.rb b/lib/puppet/type/dsc_xazurepacksetup.rb deleted file mode 100644 index 99a34795..00000000 --- a/lib/puppet/type/dsc_xazurepacksetup.rb +++ /dev/null @@ -1,231 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xazurepacksetup) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xAzurePackSetup resource type. - Automatically generated from - 'xAzurePack/DSCResources/MSFT_xAzurePackSetup/MSFT_xAzurePackSetup.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_role is a required attribute') if self[:dsc_role].nil? - fail('dsc_action is a required attribute') if self[:dsc_action].nil? - end - - def dscmeta_resource_friendly_name; 'xAzurePackSetup' end - def dscmeta_resource_name; 'MSFT_xAzurePackSetup' end - def dscmeta_module_name; 'xAzurePack' end - def dscmeta_module_version; '1.4.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Role - # Type: string - # IsMandatory: True - # Values: ["Admin API", "Tenant API", "Tenant Public API", "SQL Server Extension", "MySQL Extension", "Admin Site", "Admin Authentication Site", "Tenant Site", "Tenant Authentication Site"] - newparam(:dsc_role) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Role - The Azure Pack role to be installed or initialized. Valid values are Admin API, Tenant API, Tenant Public API, SQL Server Extension, MySQL Extension, Admin Site, Admin Authentication Site, Tenant Site, Tenant Authentication Site." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Admin API', 'admin api', 'Tenant API', 'tenant api', 'Tenant Public API', 'tenant public api', 'SQL Server Extension', 'sql server extension', 'MySQL Extension', 'mysql extension', 'Admin Site', 'admin site', 'Admin Authentication Site', 'admin authentication site', 'Tenant Site', 'tenant site', 'Tenant Authentication Site', 'tenant authentication site'].include?(value) - fail("Invalid value '#{value}'. Valid values are Admin API, Tenant API, Tenant Public API, SQL Server Extension, MySQL Extension, Admin Site, Admin Authentication Site, Tenant Site, Tenant Authentication Site") - end - end - end - - # Name: Action - # Type: string - # IsMandatory: True - # Values: ["Install", "Initialize"] - newparam(:dsc_action) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Action - Install or initialize. Valid values are Install, Initialize." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Install', 'install', 'Initialize', 'initialize'].include?(value) - fail("Invalid value '#{value}'. Valid values are Install, Initialize") - end - end - end - - # Name: SourcePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourcePath - UNC path to the root of the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SourceFolder - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcefolder) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourceFolder - Folder within the source path containing the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SetupCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_setupcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SetupCredential - Credential to be used to perform the installation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SetupCredential", value) - end - end - - # Name: Passphrase - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_passphrase) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Passphrase - Passphrase for the Azure Pack deployment." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Passphrase", value) - end - end - - # Name: SQLServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLServer - Database server for the Azure Pack databases." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLInstance - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlinstance) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLInstance - Database instance for the Azure Pack databases." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: dbUser - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_dbuser) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "dbUser - SQL user to be used to create the database if the SetupCredential cannot be used." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("dbUser", value) - end - end - - # Name: EnableCeip - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_enableceip) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "EnableCeip - Enable Customer Experience Improvement Program." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xazurepacksetup).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xazurepackupdate.rb b/lib/puppet/type/dsc_xazurepackupdate.rb deleted file mode 100644 index f1889b48..00000000 --- a/lib/puppet/type/dsc_xazurepackupdate.rb +++ /dev/null @@ -1,134 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xazurepackupdate) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xAzurePackUpdate resource type. - Automatically generated from - 'xAzurePack/DSCResources/MSFT_xAzurePackUpdate/MSFT_xAzurePackUpdate.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_role is a required attribute') if self[:dsc_role].nil? - end - - def dscmeta_resource_friendly_name; 'xAzurePackUpdate' end - def dscmeta_resource_name; 'MSFT_xAzurePackUpdate' end - def dscmeta_module_name; 'xAzurePack' end - def dscmeta_module_version; '1.4.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Role - # Type: string - # IsMandatory: True - # Values: ["Admin API", "Tenant API", "Tenant Public API", "SQL Server Extension", "MySQL Extension", "Admin Site", "Admin Authentication Site", "Tenant Site", "Tenant Authentication Site"] - newparam(:dsc_role) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Role - The Azure Pack role to be updated. Valid values are Admin API, Tenant API, Tenant Public API, SQL Server Extension, MySQL Extension, Admin Site, Admin Authentication Site, Tenant Site, Tenant Authentication Site." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Admin API', 'admin api', 'Tenant API', 'tenant api', 'Tenant Public API', 'tenant public api', 'SQL Server Extension', 'sql server extension', 'MySQL Extension', 'mysql extension', 'Admin Site', 'admin site', 'Admin Authentication Site', 'admin authentication site', 'Tenant Site', 'tenant site', 'Tenant Authentication Site', 'tenant authentication site'].include?(value) - fail("Invalid value '#{value}'. Valid values are Admin API, Tenant API, Tenant Public API, SQL Server Extension, MySQL Extension, Admin Site, Admin Authentication Site, Tenant Site, Tenant Authentication Site") - end - end - end - - # Name: SourcePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourcePath - UNC path to the root of the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SourceFolder - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcefolder) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourceFolder - Folder within the source path containing the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SetupCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_setupcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SetupCredential - Credential to be used to perform the installation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SetupCredential", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xazurepackupdate).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xazurequickvm.rb b/lib/puppet/type/dsc_xazurequickvm.rb deleted file mode 100644 index 41b8d37a..00000000 --- a/lib/puppet/type/dsc_xazurequickvm.rb +++ /dev/null @@ -1,227 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xazurequickvm) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xAzureQuickVM resource type. - Automatically generated from - 'xAzure/DSCResources/MSFT_xAzureQuickVM/MSFT_xAzureQuickVM.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xAzureQuickVM' end - def dscmeta_resource_name; 'MSFT_xAzureQuickVM' end - def dscmeta_module_name; 'xAzure' end - def dscmeta_module_version; '0.2.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Specifies the name of the virtual machine." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies whether the Azure VM should be present or absent. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: ImageName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_imagename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ImageName - Specifies the name of the operating system image to use to create the operating system disk." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ServiceName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_servicename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServiceName - Specifies the new or existing service name. " - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Linux - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_linux) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Linux - Creates a Linux virtual machine." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: LinuxUser - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_linuxuser) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LinuxUser - Specifies the Linux administrative account name to create." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Windows - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_windows) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Windows - Creates a Windows virtual machine." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AdminUsername - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_adminusername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AdminUsername - Specifies the name for the administrative account to create." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Password - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_password) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Password - Specifies the password for the administrative account." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstanceSize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_instancesize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstanceSize - Specifies the size of the instance. For a list of virtual machine sizes, see http://msdn.microsoft.com/library/azure/dn197896.aspx" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xazurequickvm).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xazureservice.rb b/lib/puppet/type/dsc_xazureservice.rb deleted file mode 100644 index 6a4ced75..00000000 --- a/lib/puppet/type/dsc_xazureservice.rb +++ /dev/null @@ -1,150 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xazureservice) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xAzureService resource type. - Automatically generated from - 'xAzure/DSCResources/MSFT_xAzureService/MSFT_xAzureService.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_servicename is a required attribute') if self[:dsc_servicename].nil? - end - - def dscmeta_resource_friendly_name; 'xAzureService' end - def dscmeta_resource_name; 'MSFT_xAzureService' end - def dscmeta_module_name; 'xAzure' end - def dscmeta_module_version; '0.2.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: ServiceName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_servicename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServiceName - Specifies a name for the new cloud service that is unique to the subscription." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies whether the service should be present or absent. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Description - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_description) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Description - Specifies the Azure Affinity Group for the service." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AffinityGroup - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_affinitygroup) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AffinityGroup - Specifies a description for the service." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Label - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_label) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Label - Specifies a label for the service." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xazureservice).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xazuresqldatabase.rb b/lib/puppet/type/dsc_xazuresqldatabase.rb deleted file mode 100644 index f360467d..00000000 --- a/lib/puppet/type/dsc_xazuresqldatabase.rb +++ /dev/null @@ -1,214 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xazuresqldatabase) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xAzureSqlDatabase resource type. - Automatically generated from - 'xAzure/DSCResources/MSFT_xAzureSqlDatabase/MSFT_xAzureSqlDatabase.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xAzureSqlDatabase' end - def dscmeta_resource_name; 'MSFT_xAzureSqlDatabase' end - def dscmeta_module_name; 'xAzure' end - def dscmeta_module_version; '0.2.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Name of the database" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MaximumSizeInGB - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_maximumsizeingb) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "MaximumSizeInGB - Maximum size of the database in GB" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: Collation - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_collation) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Collation - Collation of the database" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Edition - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_edition) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Edition - Edition of the database" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ServerCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_servercredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "ServerCredential - Credential to the database server" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("ServerCredential", value) - end - end - - # Name: ServerName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_servername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServerName - Name of the database server" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AzureSubscriptionName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_azuresubscriptionname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AzureSubscriptionName - Specifies the name of the Azure subscription that should be set to Current" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AzurePublishSettingsFile - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_azurepublishsettingsfile) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AzurePublishSettingsFile - Specifies the location of the Publish Settings file for the Azure Subscription" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Ensure that database is present or absent Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xazuresqldatabase).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xazuresqldatabaseserverfirewallrule.rb b/lib/puppet/type/dsc_xazuresqldatabaseserverfirewallrule.rb deleted file mode 100644 index e2c1ea26..00000000 --- a/lib/puppet/type/dsc_xazuresqldatabaseserverfirewallrule.rb +++ /dev/null @@ -1,182 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xazuresqldatabaseserverfirewallrule) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xAzureSqlDatabaseServerFirewallRule resource type. - Automatically generated from - 'xAzure/DSCResources/MSFT_xAzureSqlDatabaseServerFirewallRule/MSFT_xAzureSqlDatabaseServerFirewallRule.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_rulename is a required attribute') if self[:dsc_rulename].nil? - fail('dsc_servername is a required attribute') if self[:dsc_servername].nil? - end - - def dscmeta_resource_friendly_name; 'xAzureSqlDatabaseServerFirewallRule' end - def dscmeta_resource_name; 'MSFT_xAzureSqlDatabaseServerFirewallRule' end - def dscmeta_module_name; 'xAzure' end - def dscmeta_module_version; '0.2.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: RuleName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_rulename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RuleName - Name of the firewall rule" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ServerName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_servername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServerName - Name of the database server for which firewall rule should be created" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: StartIPAddress - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_startipaddress) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "StartIPAddress - Start IP address of the firewall rule" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: EndIPAddress - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_endipaddress) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "EndIPAddress - End IP address of the firewall rule" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AzureSubscriptionName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_azuresubscriptionname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AzureSubscriptionName - Specifies the name of the Azure subscription that should be set to Current" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AzurePublishSettingsFile - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_azurepublishsettingsfile) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AzurePublishSettingsFile - Specifies the location of the Publish Settings file for the Azure Subscription" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Ensure that firewall rule is present or absent Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xazuresqldatabaseserverfirewallrule).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xazurestorageaccount.rb b/lib/puppet/type/dsc_xazurestorageaccount.rb deleted file mode 100644 index 2e3c191d..00000000 --- a/lib/puppet/type/dsc_xazurestorageaccount.rb +++ /dev/null @@ -1,165 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xazurestorageaccount) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xAzureStorageAccount resource type. - Automatically generated from - 'xAzure/DSCResources/MSFT_xAzureStorageAccount/MSFT_xAzureStorageAccount.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_storageaccountname is a required attribute') if self[:dsc_storageaccountname].nil? - end - - def dscmeta_resource_friendly_name; 'xAzureStorageAccount' end - def dscmeta_resource_name; 'MSFT_xAzureStorageAccount' end - def dscmeta_module_name; 'xAzure' end - def dscmeta_module_version; '0.2.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: StorageAccountName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_storageaccountname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "StorageAccountName - Specifies a name for the storage account. The storage account name must be unique to Windows Azure and must be between 3 and 24 characters in length and use lowercase letters and numbers only." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies whether the Azure Storage Account should be present or absent. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: AffinityGroup - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_affinitygroup) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AffinityGroup - Specifies the name of an existing affinity group in the current subscription. You can specify either a Location or an AffinityGroup parameter, but not both. " - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Container - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_container) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Container - Specifies a name for the Container that should be created in the Azure Storage Account." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Folder - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_folder) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Folder - Specifies a local folder. All files in the root of the folder will be uploaded to the new container." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Label - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_label) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Label - Specifies a label for the storage account. The label may be up to 100 characters in length." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xazurestorageaccount).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xazuresubscription.rb b/lib/puppet/type/dsc_xazuresubscription.rb deleted file mode 100644 index 5a6172e1..00000000 --- a/lib/puppet/type/dsc_xazuresubscription.rb +++ /dev/null @@ -1,120 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xazuresubscription) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xAzureSubscription resource type. - Automatically generated from - 'xAzure/DSCResources/MSFT_xAzureSubscription/MSFT_xAzureSubscription.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_azuresubscriptionname is a required attribute') if self[:dsc_azuresubscriptionname].nil? - end - - def dscmeta_resource_friendly_name; 'xAzureSubscription' end - def dscmeta_resource_name; 'MSFT_xAzureSubscription' end - def dscmeta_module_name; 'xAzure' end - def dscmeta_module_version; '0.2.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies whether the subscription should be present or absent. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: AzureSubscriptionName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_azuresubscriptionname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AzureSubscriptionName - Specifies the name of the Azure subscription that should be set to Current." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AzurePublishSettingsFile - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_azurepublishsettingsfile) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AzurePublishSettingsFile - Specifies the location of the Publish Settings file for the Azure Subscription." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xazuresubscription).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xazurevm.rb b/lib/puppet/type/dsc_xazurevm.rb deleted file mode 100644 index c658bdf1..00000000 --- a/lib/puppet/type/dsc_xazurevm.rb +++ /dev/null @@ -1,258 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xazurevm) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xAzureVM resource type. - Automatically generated from - 'xAzure/DSCResources/MSFT_xAzureVM/MSFT_xAzureVM.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xAzureVM' end - def dscmeta_resource_name; 'MSFT_xAzureVM' end - def dscmeta_module_name; 'xAzure' end - def dscmeta_module_version; '0.2.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Specifies the name of the virtual machine." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies whether the Azure VM should be present or absent. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: ImageName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_imagename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ImageName - Specifies the name of the operating system image to use to create the operating system disk." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ServiceName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_servicename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServiceName - Specifies the new or existing service name." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: StorageAccountName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_storageaccountname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "StorageAccountName - Specifies the name of the storage account for the VM." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstanceSize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_instancesize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstanceSize - Specifies the size of the instance. For a list of virtual machine sizes, see http://msdn.microsoft.com/library/azure/dn197896.aspx" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Linux - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_linux) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Linux - Creates a Linux virtual machine." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Windows - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_windows) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Windows - Creates a Windows virtual machine." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: ExtensionContainerName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_extensioncontainername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ExtensionContainerName - The name of the Container in Azure Blob storage where the script files will reside. Case sensitive." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ExtensionFileList - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_extensionfilelist) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ExtensionFileList - List of files in Azure Blob container that should be copied in to the VM. Case sensitive." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ExtensionScriptName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_extensionscriptname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ExtensionScriptName - Name of one of the files in the container that will be exectued at startup. Case sensitive." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xazurevm).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xazurevmdscconfiguration.rb b/lib/puppet/type/dsc_xazurevmdscconfiguration.rb deleted file mode 100644 index e0fcc6cf..00000000 --- a/lib/puppet/type/dsc_xazurevmdscconfiguration.rb +++ /dev/null @@ -1,180 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xazurevmdscconfiguration) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xAzureVMDscConfiguration resource type. - Automatically generated from - 'xAzure/DSCResources/MSFT_xAzureVMDscConfiguration/MSFT_xAzureVMDscConfiguration.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_storageaccountname is a required attribute') if self[:dsc_storageaccountname].nil? - end - - def dscmeta_resource_friendly_name; 'xAzureVMDscConfiguration' end - def dscmeta_resource_name; 'MSFT_xAzureVMDscConfiguration' end - def dscmeta_module_name; 'xAzure' end - def dscmeta_module_version; '0.2.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: StorageAccountName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_storageaccountname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "StorageAccountName - Specifies name of the existing storage account." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies whether the supplied Configuration is Present or Absent in Azure Storage Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: ContainerName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_containername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ContainerName - Specifies the name of the Container in the Azure Storage Account." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ConfigurationPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_configurationpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ConfigurationPath - Specifies location of the Dsc Configuration document" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AzureSubscriptionName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_azuresubscriptionname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AzureSubscriptionName - Specifies the name of the Azure subscription that should be set to Current." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AzurePublishSettingsPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_azurepublishsettingspath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AzurePublishSettingsPath - Specifies the location of the Publish Settings file for the Azure Subscription." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: BlobUri - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_bloburi) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "BlobUri - Absolute Uri of the Blob" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xazurevmdscconfiguration).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xazurevmdscextension.rb b/lib/puppet/type/dsc_xazurevmdscextension.rb deleted file mode 100644 index ae1f6926..00000000 --- a/lib/puppet/type/dsc_xazurevmdscextension.rb +++ /dev/null @@ -1,312 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xazurevmdscextension) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xAzureVMDscExtension resource type. - Automatically generated from - 'xAzure/DSCResources/MSFT_xAzureVMDscExtension/MSFT_xAzureVMDscExtension.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_vmname is a required attribute') if self[:dsc_vmname].nil? - end - - def dscmeta_resource_friendly_name; 'xAzureVMDscExtension' end - def dscmeta_resource_name; 'MSFT_xAzureVMDscExtension' end - def dscmeta_module_name; 'xAzure' end - def dscmeta_module_version; '0.2.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: VMName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_vmname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "VMName - Specifies name of the VM. This is used together with ServiceName to construct a persistent vm object." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ServiceName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_servicename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServiceName - Specifies name of the Service where the VM is deployed." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ConfigurationArchive - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_configurationarchive) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ConfigurationArchive - The name of the configuration package .zip file that was previously uploaded by Publish-AzureVMDscConfiguration. This parameter must specify only the name of the file, without any path." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: StorageAccountName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_storageaccountname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "StorageAccountName - Specifies the name of the Storage Account used to create the Storage Context. The Azure Storage Context provides the security settings used to access the configuration script. This context should provide read access to the container specified by ContainerName." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ConfigurationArgument - # Type: MSFT_KeyValuePair - # IsMandatory: False - # Values: None - newparam(:dsc_configurationargument) do - def mof_type; 'MSFT_KeyValuePair' end - def mof_is_embedded?; true end - desc "ConfigurationArgument - A hashtable specifying the arguments to the configuration function. The keys correspond to the parameter names and the values to the parameter values." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - fail 'ConfigurationArgument may only have a single key / value pair' unless value.length == 1 - end - end - - # Name: ConfigurationDataPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_configurationdatapath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ConfigurationDataPath - The path to a .psd1 file that specifies the data for the configuration function." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Configuration - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_configuration) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Configuration - Name of the configuration script or module that will be invoked by the DSC Extension." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ContainerName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_containername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ContainerName - Name of the Azure Storage Container where the ConfigurationArchive is located." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Force - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_force) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Force - By default Set-AzureVMDscExtension will not overwrite any existing blobs. Use -Force to overwrite them." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ReferenceName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_referencename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ReferenceName - The Extension Reference Name" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: StorageEndpointSuffix - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_storageendpointsuffix) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "StorageEndpointSuffix - The DNS endpoint suffix for all storage services, e.g. core.windows.net" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Version - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_version) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Version - The specific version of the DSC Extension to use. If not given, it will default to 1.*" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: TimeStamp - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_timestamp) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TimeStamp - Returns the timestamp of the last DSC Extension execution." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Code - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_code) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Code - Returns the message code for the latest oepration by the DSC Extension." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Message - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_message) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Message - Returns the formatted message string for the latest operation by the DSC Extension." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Status - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_status) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Status - Returns the state of the DSC Extension from Azure." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xazurevmdscextension).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xblautobitlocker.rb b/lib/puppet/type/dsc_xblautobitlocker.rb deleted file mode 100644 index 1a1149aa..00000000 --- a/lib/puppet/type/dsc_xblautobitlocker.rb +++ /dev/null @@ -1,395 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xblautobitlocker) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xBLAutoBitlocker resource type. - Automatically generated from - 'xBitlocker/DSCResources/MSFT_xBLAutoBitlocker/MSFT_xBLAutoBitlocker.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_drivetype is a required attribute') if self[:dsc_drivetype].nil? - end - - def dscmeta_resource_friendly_name; 'xBLAutoBitlocker' end - def dscmeta_resource_name; 'MSFT_xBLAutoBitlocker' end - def dscmeta_module_name; 'xBitlocker' end - def dscmeta_module_version; '1.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: DriveType - # Type: string - # IsMandatory: True - # Values: ["Fixed", "Removable"] - newparam(:dsc_drivetype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DriveType - Valid values are Fixed, Removable." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Fixed', 'fixed', 'Removable', 'removable'].include?(value) - fail("Invalid value '#{value}'. Valid values are Fixed, Removable") - end - end - end - - # Name: MinDiskCapacityGB - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_mindiskcapacitygb) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "MinDiskCapacityGB" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: PrimaryProtector - # Type: string - # IsMandatory: False - # Values: ["PasswordProtector", "RecoveryPasswordProtector", "StartupKeyProtector", "TpmProtector"] - newparam(:dsc_primaryprotector) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "PrimaryProtector - Valid values are PasswordProtector, RecoveryPasswordProtector, StartupKeyProtector, TpmProtector." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['PasswordProtector', 'passwordprotector', 'RecoveryPasswordProtector', 'recoverypasswordprotector', 'StartupKeyProtector', 'startupkeyprotector', 'TpmProtector', 'tpmprotector'].include?(value) - fail("Invalid value '#{value}'. Valid values are PasswordProtector, RecoveryPasswordProtector, StartupKeyProtector, TpmProtector") - end - end - end - - # Name: AutoUnlock - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_autounlock) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AutoUnlock" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AdAccountOrGroup - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_adaccountorgroup) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AdAccountOrGroup" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AdAccountOrGroupProtector - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_adaccountorgroupprotector) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AdAccountOrGroupProtector" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: EncryptionMethod - # Type: string - # IsMandatory: False - # Values: ["Aes128", "Aes256"] - newparam(:dsc_encryptionmethod) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "EncryptionMethod - Valid values are Aes128, Aes256." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Aes128', 'aes128', 'Aes256', 'aes256'].include?(value) - fail("Invalid value '#{value}'. Valid values are Aes128, Aes256") - end - end - end - - # Name: HardwareEncryption - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_hardwareencryption) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "HardwareEncryption" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Password - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_password) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Password" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Password", value) - end - end - - # Name: PasswordProtector - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_passwordprotector) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "PasswordProtector" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Pin - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_pin) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Pin" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Pin", value) - end - end - - # Name: RecoveryKeyPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_recoverykeypath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RecoveryKeyPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RecoveryKeyProtector - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_recoverykeyprotector) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RecoveryKeyProtector" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: RecoveryPasswordProtector - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_recoverypasswordprotector) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RecoveryPasswordProtector" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Service - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_service) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Service" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: SkipHardwareTest - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_skiphardwaretest) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "SkipHardwareTest" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: StartupKeyPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_startupkeypath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "StartupKeyPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: StartupKeyProtector - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_startupkeyprotector) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "StartupKeyProtector" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: TpmProtector - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_tpmprotector) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "TpmProtector" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: UsedSpaceOnly - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_usedspaceonly) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "UsedSpaceOnly" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xblautobitlocker).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xblbitlocker.rb b/lib/puppet/type/dsc_xblbitlocker.rb deleted file mode 100644 index 1f267584..00000000 --- a/lib/puppet/type/dsc_xblbitlocker.rb +++ /dev/null @@ -1,390 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xblbitlocker) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xBLBitlocker resource type. - Automatically generated from - 'xBitlocker/DSCResources/MSFT_xBLBitlocker/MSFT_xBLBitlocker.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_mountpoint is a required attribute') if self[:dsc_mountpoint].nil? - end - - def dscmeta_resource_friendly_name; 'xBLBitlocker' end - def dscmeta_resource_name; 'MSFT_xBLBitlocker' end - def dscmeta_module_name; 'xBitlocker' end - def dscmeta_module_version; '1.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: MountPoint - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_mountpoint) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MountPoint" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: PrimaryProtector - # Type: string - # IsMandatory: False - # Values: ["PasswordProtector", "RecoveryPasswordProtector", "StartupKeyProtector", "TpmProtector"] - newparam(:dsc_primaryprotector) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "PrimaryProtector - Valid values are PasswordProtector, RecoveryPasswordProtector, StartupKeyProtector, TpmProtector." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['PasswordProtector', 'passwordprotector', 'RecoveryPasswordProtector', 'recoverypasswordprotector', 'StartupKeyProtector', 'startupkeyprotector', 'TpmProtector', 'tpmprotector'].include?(value) - fail("Invalid value '#{value}'. Valid values are PasswordProtector, RecoveryPasswordProtector, StartupKeyProtector, TpmProtector") - end - end - end - - # Name: AutoUnlock - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_autounlock) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AutoUnlock" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AllowImmediateReboot - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowimmediatereboot) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowImmediateReboot" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AdAccountOrGroup - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_adaccountorgroup) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AdAccountOrGroup" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AdAccountOrGroupProtector - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_adaccountorgroupprotector) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AdAccountOrGroupProtector" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: EncryptionMethod - # Type: string - # IsMandatory: False - # Values: ["Aes128", "Aes256"] - newparam(:dsc_encryptionmethod) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "EncryptionMethod - Valid values are Aes128, Aes256." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Aes128', 'aes128', 'Aes256', 'aes256'].include?(value) - fail("Invalid value '#{value}'. Valid values are Aes128, Aes256") - end - end - end - - # Name: HardwareEncryption - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_hardwareencryption) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "HardwareEncryption" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Password - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_password) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Password" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Password", value) - end - end - - # Name: PasswordProtector - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_passwordprotector) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "PasswordProtector" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Pin - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_pin) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Pin" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Pin", value) - end - end - - # Name: RecoveryKeyPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_recoverykeypath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RecoveryKeyPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RecoveryKeyProtector - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_recoverykeyprotector) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RecoveryKeyProtector" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: RecoveryPasswordProtector - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_recoverypasswordprotector) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RecoveryPasswordProtector" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Service - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_service) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Service" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: SkipHardwareTest - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_skiphardwaretest) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "SkipHardwareTest" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: StartupKeyPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_startupkeypath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "StartupKeyPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: StartupKeyProtector - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_startupkeyprotector) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "StartupKeyProtector" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: TpmProtector - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_tpmprotector) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "TpmProtector" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: UsedSpaceOnly - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_usedspaceonly) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "UsedSpaceOnly" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xblbitlocker).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xbltpm.rb b/lib/puppet/type/dsc_xbltpm.rb deleted file mode 100644 index 68f594d8..00000000 --- a/lib/puppet/type/dsc_xbltpm.rb +++ /dev/null @@ -1,133 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xbltpm) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xBLTpm resource type. - Automatically generated from - 'xBitlocker/DSCResources/MSFT_xBLTpm/MSFT_xBLTpm.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_identity is a required attribute') if self[:dsc_identity].nil? - end - - def dscmeta_resource_friendly_name; 'xBLTpm' end - def dscmeta_resource_name; 'MSFT_xBLTpm' end - def dscmeta_module_name; 'xBitlocker' end - def dscmeta_module_version; '1.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Identity - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_identity) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Identity" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AllowClear - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowclear) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowClear" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AllowPhysicalPresence - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowphysicalpresence) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowPhysicalPresence" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AllowImmediateReboot - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowimmediatereboot) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowImmediateReboot" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xbltpm).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xcertificateexport.rb b/lib/puppet/type/dsc_xcertificateexport.rb deleted file mode 100644 index 75438750..00000000 --- a/lib/puppet/type/dsc_xcertificateexport.rb +++ /dev/null @@ -1,332 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xcertificateexport) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xCertificateExport resource type. - Automatically generated from - 'xCertificate/DSCResources/MSFT_xCertificateExport/MSFT_xCertificateExport.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_path is a required attribute') if self[:dsc_path].nil? - end - - def dscmeta_resource_friendly_name; 'xCertificateExport' end - def dscmeta_resource_name; 'MSFT_xCertificateExport' end - def dscmeta_module_name; 'xCertificate' end - def dscmeta_module_version; '3.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Path - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_path) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Path - The path to the file you that will contain the exported certificate." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Thumbprint - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_thumbprint) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Thumbprint - The thumbprint of the certificate to export. Certificate selector parameter." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: FriendlyName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_friendlyname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FriendlyName - The friendly name of the certificate to export. Certificate selector parameter." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Subject - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_subject) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Subject - The subject of the certificate to export. Certificate selector parameter." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DNSName - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_dnsname, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "DNSName - The subject alternative name of the certificate to export must contain these values. Certificate selector parameter." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: Issuer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_issuer) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Issuer - The issuer of the certificate to export. Certificate selector parameter." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: KeyUsage - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_keyusage, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "KeyUsage - The key usage of the certificate to export must contain these values. Certificate selector parameter." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: EnhancedKeyUsage - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_enhancedkeyusage, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "EnhancedKeyUsage - The enhanced key usage of the certificate to export must contain these values. Certificate selector parameter." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: Store - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_store) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Store - The Windows Certificate Store Name to search for the certificate to export from. Certificate selector parameter. Defaults to 'My'." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AllowExpired - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowexpired) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowExpired - Allow an expired certificate to be exported. Certificate selector parameter." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: MatchSource - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_matchsource) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "MatchSource - Causes an existing exported certificate to be compared with the certificate identified for export and re-exported if it does not match." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Type - # Type: string - # IsMandatory: False - # Values: ["Cert", "P7B", "SST", "PFX"] - newparam(:dsc_type) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Type - Specifies the type of certificate to export. Valid values are Cert, P7B, SST, PFX." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Cert', 'cert', 'P7B', 'p7b', 'SST', 'sst', 'PFX', 'pfx'].include?(value) - fail("Invalid value '#{value}'. Valid values are Cert, P7B, SST, PFX") - end - end - end - - # Name: ChainOption - # Type: string - # IsMandatory: False - # Values: ["BuildChain", "EndEntityCertOnly"] - newparam(:dsc_chainoption) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ChainOption - Specifies the options for building a chain when exporting a PFX certificate. Valid values are BuildChain, EndEntityCertOnly." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['BuildChain', 'buildchain', 'EndEntityCertOnly', 'endentitycertonly'].include?(value) - fail("Invalid value '#{value}'. Valid values are BuildChain, EndEntityCertOnly") - end - end - end - - # Name: Password - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_password) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Password - Specifies the password used to protect an exported PFX file." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Password", value) - end - end - - # Name: ProtectTo - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_protectto, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ProtectTo - Specifies an array of strings for the username or group name that can access the private key of an exported PFX file without any password." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: IsExported - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_isexported) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "IsExported - Returns true if the certificate file already exists and therefore has been exported." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xcertificateexport).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xcertificateimport.rb b/lib/puppet/type/dsc_xcertificateimport.rb deleted file mode 100644 index 8fcfc69d..00000000 --- a/lib/puppet/type/dsc_xcertificateimport.rb +++ /dev/null @@ -1,157 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xcertificateimport) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xCertificateImport resource type. - Automatically generated from - 'xCertificate/DSCResources/MSFT_xCertificateImport/MSFT_xCertificateImport.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_thumbprint is a required attribute') if self[:dsc_thumbprint].nil? - fail('dsc_location is a required attribute') if self[:dsc_location].nil? - fail('dsc_store is a required attribute') if self[:dsc_store].nil? - end - - def dscmeta_resource_friendly_name; 'xCertificateImport' end - def dscmeta_resource_name; 'MSFT_xCertificateImport' end - def dscmeta_module_name; 'xCertificate' end - def dscmeta_module_version; '3.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Thumbprint - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_thumbprint) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Thumbprint - The thumbprint (unique identifier) of the certificate you're importing." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Path - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_path) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Path - The path to the CER file you want to import." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Location - # Type: string - # IsMandatory: True - # Values: ["LocalMachine", "CurrentUser"] - newparam(:dsc_location) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Location - The Windows Certificate Store Location to import the certificate to. Valid values are LocalMachine, CurrentUser." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['LocalMachine', 'localmachine', 'CurrentUser', 'currentuser'].include?(value) - fail("Invalid value '#{value}'. Valid values are LocalMachine, CurrentUser") - end - end - end - - # Name: Store - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_store) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Store - The Windows Certificate Store Name to import the certificate to." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies whether the certificate should be present or absent. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xcertificateimport).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xcertreq.rb b/lib/puppet/type/dsc_xcertreq.rb deleted file mode 100644 index 292cf603..00000000 --- a/lib/puppet/type/dsc_xcertreq.rb +++ /dev/null @@ -1,332 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xcertreq) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xCertReq resource type. - Automatically generated from - 'xCertificate/DSCResources/MSFT_xCertReq/MSFT_xCertReq.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_subject is a required attribute') if self[:dsc_subject].nil? - end - - def dscmeta_resource_friendly_name; 'xCertReq' end - def dscmeta_resource_name; 'MSFT_xCertReq' end - def dscmeta_module_name; 'xCertificate' end - def dscmeta_module_version; '3.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Subject - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_subject) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Subject - Provide the text string to use as the subject of the certificate." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CAType - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_catype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CAType - The type of CA in use, Standalone/Enterprise." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CAServerFQDN - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_caserverfqdn) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CAServerFQDN - The FQDN of the Active Directory Certificate Authority on the local area network. Leave empty to automatically locate." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CARootName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_carootname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CARootName - The name of the certificate authority, by default this will be in format domain-servername-ca. Leave empty to automatically locate." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: KeyLength - # Type: string - # IsMandatory: False - # Values: ["1024", "2048", "4096", "8192"] - newparam(:dsc_keylength) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "KeyLength - The bit length of the encryption key to be used. Defaults to 2048. Valid values are 1024, 2048, 4096, 8192." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['1024', '1024', '2048', '2048', '4096', '4096', '8192', '8192'].include?(value) - fail("Invalid value '#{value}'. Valid values are 1024, 2048, 4096, 8192") - end - end - end - - # Name: Exportable - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_exportable) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Exportable - The option to allow the certificate to be exportable, by default it will be true." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ProviderName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_providername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProviderName - The selection of provider for the type of encryption to be used." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: OID - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_oid) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "OID - The Object Identifier that is used to name the object." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: KeyUsage - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_keyusage) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "KeyUsage - The Keyusage is a restriction method that determines what a certificate can be used for." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CertificateTemplate - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_certificatetemplate) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CertificateTemplate - The template used for the definition of the certificate." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SubjectAltName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_subjectaltname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SubjectAltName - The subject alternative name used to create the certificate." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential - The credentials that will be used to access the template in the Certificate Authority." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: AutoRenew - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_autorenew) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AutoRenew - Determines if the resource will also renew a certificate within 7 days of expiration." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: CepURL - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_cepurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CepURL - The URL to the Certification Enrollment Policy Service." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CesURL - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_cesurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CesURL - The URL to the Certification Enrollment Service." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UseMachineContext - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_usemachinecontext) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "UseMachineContext - Indicates whether or not the flag -adminforcemachine will be used when requesting certificates. Necessary for certain templates like e.g. DomainControllerAuthentication" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: FriendlyName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_friendlyname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FriendlyName - Specifies a friendly name for the certificate." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xcertreq).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xcluster.rb b/lib/puppet/type/dsc_xcluster.rb deleted file mode 100644 index 1065d1aa..00000000 --- a/lib/puppet/type/dsc_xcluster.rb +++ /dev/null @@ -1,116 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xcluster) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xCluster resource type. - Automatically generated from - 'xFailOverCluster/DSCResources/MSFT_xCluster/MSFT_xCluster.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xCluster' end - def dscmeta_resource_name; 'MSFT_xCluster' end - def dscmeta_module_name; 'xFailOverCluster' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Name of the Cluster" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: StaticIPAddress - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_staticipaddress) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "StaticIPAddress - StaticIPAddress of the Cluster" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DomainAdministratorCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_domainadministratorcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "DomainAdministratorCredential - Credential to create the cluster" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("DomainAdministratorCredential", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xcluster).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xclusterdisk.rb b/lib/puppet/type/dsc_xclusterdisk.rb deleted file mode 100644 index 46197ed4..00000000 --- a/lib/puppet/type/dsc_xclusterdisk.rb +++ /dev/null @@ -1,120 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xclusterdisk) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xClusterDisk resource type. - Automatically generated from - 'xFailOverCluster/DSCResources/MSFT_xClusterDisk/MSFT_xClusterDisk.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_number is a required attribute') if self[:dsc_number].nil? - end - - def dscmeta_resource_friendly_name; 'xClusterDisk' end - def dscmeta_resource_name; 'MSFT_xClusterDisk' end - def dscmeta_module_name; 'xFailOverCluster' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Number - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_number) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Number - The disk number of the cluster disk." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Define if the cluster disk should be added (Present) or removed (Absent). Default value is 'Present'. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Label - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_label) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Label - The disk label that should be assigned to the disk on the Failover Cluster disk resource." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xclusterdisk).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xclusternetwork.rb b/lib/puppet/type/dsc_xclusternetwork.rb deleted file mode 100644 index 23680673..00000000 --- a/lib/puppet/type/dsc_xclusternetwork.rb +++ /dev/null @@ -1,150 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xclusternetwork) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xClusterNetwork resource type. - Automatically generated from - 'xFailOverCluster/DSCResources/MSFT_xClusterNetwork/MSFT_xClusterNetwork.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_address is a required attribute') if self[:dsc_address].nil? - fail('dsc_addressmask is a required attribute') if self[:dsc_addressmask].nil? - end - - def dscmeta_resource_friendly_name; 'xClusterNetwork' end - def dscmeta_resource_name; 'MSFT_xClusterNetwork' end - def dscmeta_module_name; 'xFailOverCluster' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Address - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_address) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Address - The address for the cluster network in the format '10.0.0.0'." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AddressMask - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_addressmask) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AddressMask - The address mask for the cluster network in the format '255.255.255.0'." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Name - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the cluster network. If the cluster network name is not in desired state it will be renamed to match this name." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Role - # Type: string - # IsMandatory: False - # Values: ["0", "1", "3"] - newparam(:dsc_role) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Role - he role of the cluster network. If the cluster network role is not in desired state it will change to match this role. Valid values are 0, 1, 3." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['0', '0', '1', '1', '3', '3'].include?(value) - fail("Invalid value '#{value}'. Valid values are 0, 1, 3") - end - end - end - - # Name: Metric - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_metric) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Metric - The metric number for the cluster network. If the cluster network metric number is not in desired state it will be changed to match this metric number." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xclusternetwork).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xclusterpreferredowner.rb b/lib/puppet/type/dsc_xclusterpreferredowner.rb deleted file mode 100644 index 7232c05f..00000000 --- a/lib/puppet/type/dsc_xclusterpreferredowner.rb +++ /dev/null @@ -1,158 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xclusterpreferredowner) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xClusterPreferredOwner resource type. - Automatically generated from - 'xFailOverCluster/DSCResources/MSFT_xClusterPreferredOwner/MSFT_xClusterPreferredOwner.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_clustergroup is a required attribute') if self[:dsc_clustergroup].nil? - fail('dsc_clustername is a required attribute') if self[:dsc_clustername].nil? - end - - def dscmeta_resource_friendly_name; 'xClusterPreferredOwner' end - def dscmeta_resource_name; 'MSFT_xClusterPreferredOwner' end - def dscmeta_module_name; 'xFailOverCluster' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: ClusterGroup - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_clustergroup) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ClusterGroup - Name of the cluster group." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ClusterName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_clustername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ClusterName - Name of the cluster." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Nodes - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_nodes, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Nodes - The nodes to set as owners." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: ClusterResources - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_clusterresources, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ClusterResources - he resources to set preferred owners on." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - If the preferred owners should be present or absent. Default value is 'Present'. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xclusterpreferredowner).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xclusterquorum.rb b/lib/puppet/type/dsc_xclusterquorum.rb deleted file mode 100644 index f7a57261..00000000 --- a/lib/puppet/type/dsc_xclusterquorum.rb +++ /dev/null @@ -1,121 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xclusterquorum) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xClusterQuorum resource type. - Automatically generated from - 'xFailOverCluster/DSCResources/MSFT_xClusterQuorum/MSFT_xClusterQuorum.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_issingleinstance is a required attribute') if self[:dsc_issingleinstance].nil? - end - - def dscmeta_resource_friendly_name; 'xClusterQuorum' end - def dscmeta_resource_name; 'MSFT_xClusterQuorum' end - def dscmeta_module_name; 'xFailOverCluster' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: IsSingleInstance - # Type: string - # IsMandatory: True - # Values: ["Yes"] - newparam(:dsc_issingleinstance) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes'. Valid values are Yes." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Yes', 'yes'].include?(value) - fail("Invalid value '#{value}'. Valid values are Yes") - end - end - end - - # Name: Type - # Type: string - # IsMandatory: False - # Values: ["NodeMajority", "NodeAndDiskMajority", "NodeAndFileShareMajority", "DiskOnly"] - newparam(:dsc_type) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Type - Quorum type to use. Can be set to either NodeMajority, NodeAndDiskMajority, NodeAndFileShareMajority or DiskOnly. Valid values are NodeMajority, NodeAndDiskMajority, NodeAndFileShareMajority, DiskOnly." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['NodeMajority', 'nodemajority', 'NodeAndDiskMajority', 'nodeanddiskmajority', 'NodeAndFileShareMajority', 'nodeandfilesharemajority', 'DiskOnly', 'diskonly'].include?(value) - fail("Invalid value '#{value}'. Valid values are NodeMajority, NodeAndDiskMajority, NodeAndFileShareMajority, DiskOnly") - end - end - end - - # Name: Resource - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_resource) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Resource - The name of the disk or file share resource to use as witness. This parameter is optional if the quorum type is set to NodeMajority." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xclusterquorum).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xcomputer.rb b/lib/puppet/type/dsc_xcomputer.rb deleted file mode 100644 index d47f541c..00000000 --- a/lib/puppet/type/dsc_xcomputer.rb +++ /dev/null @@ -1,177 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xcomputer) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xComputer resource type. - Automatically generated from - 'xComputerManagement/DSCResources/MSFT_xComputer/MSFT_xComputer.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xComputer' end - def dscmeta_resource_name; 'MSFT_xComputer' end - def dscmeta_module_name; 'xComputerManagement' end - def dscmeta_module_version; '2.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DomainName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domainname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainName" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: JoinOU - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_joinou) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "JoinOU" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CurrentOU - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_currentou) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CurrentOU" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: UnjoinCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_unjoincredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "UnjoinCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("UnjoinCredential", value) - end - end - - # Name: WorkGroupName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_workgroupname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WorkGroupName" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xcomputer).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xcredssp.rb b/lib/puppet/type/dsc_xcredssp.rb deleted file mode 100644 index af821315..00000000 --- a/lib/puppet/type/dsc_xcredssp.rb +++ /dev/null @@ -1,142 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xcredssp) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xCredSSP resource type. - Automatically generated from - 'xCredSSP/DSCResources/MSFT_xCredSSP/MSFT_xCredSSP.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_role is a required attribute') if self[:dsc_role].nil? - end - - def dscmeta_resource_friendly_name; 'xCredSSP' end - def dscmeta_resource_name; 'MSFT_xCredSSP' end - def dscmeta_module_name; 'xCredSSP' end - def dscmeta_module_version; '1.3.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Role - # Type: string - # IsMandatory: True - # Values: ["Server", "Client"] - newparam(:dsc_role) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Role - Specifies the CredSSP role.\nServer \nClient \n Valid values are Server, Client." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Server', 'server', 'Client', 'client'].include?(value) - fail("Invalid value '#{value}'. Valid values are Server, Client") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if the role is expected to be enabled on the machine.\nPresent {default} \nAbsent \n Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: DelegateComputers - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_delegatecomputers, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "DelegateComputers - Specifies the array of computers that CredSSP client can delegate to." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: SuppressReboot - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_suppressreboot) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "SuppressReboot - Specifies if a reboot should be supressed. Default is False" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xcredssp).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xdatabase.rb b/lib/puppet/type/dsc_xdatabase.rb deleted file mode 100644 index 4f520080..00000000 --- a/lib/puppet/type/dsc_xdatabase.rb +++ /dev/null @@ -1,214 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xdatabase) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xDatabase resource type. - Automatically generated from - 'xDatabase/DSCResources/MSFT_xDatabase/MSFT_xDatabase.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_databasename is a required attribute') if self[:dsc_databasename].nil? - end - - def dscmeta_resource_friendly_name; 'xDatabase' end - def dscmeta_resource_name; 'MSFT_xDatabase' end - def dscmeta_module_name; 'xDatabase' end - def dscmeta_module_version; '1.6.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Credentials - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credentials) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credentials - Credentials to Connect to the sql server" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credentials", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: SqlServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SqlServer - Sql Server Name" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SqlServerVersion - # Type: string - # IsMandatory: False - # Values: ["2008-R2", "2012", "2014"] - newparam(:dsc_sqlserverversion) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SqlServerVersion - Sql Server Version For DacFx Valid values are 2008-R2, 2012, 2014." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['2008-R2', '2008-r2', '2012', '2012', '2014', '2014'].include?(value) - fail("Invalid value '#{value}'. Valid values are 2008-R2, 2012, 2014") - end - end - end - - # Name: BacPacPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_bacpacpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "BacPacPath - Path to BacPac, if this is specified resore is performed" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_databasename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseName - Name of the Database" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DacPacPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_dacpacpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DacPacPath - Path to DacPac, if this is specified dacpac deployment is performed" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DacPacApplicationName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_dacpacapplicationname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DacPacApplicationName - DacPac Application Name for Registration" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DacPacApplicationVersion - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_dacpacapplicationversion) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DacPacApplicationVersion - DacPac Application Version for Registration" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xdatabase).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xdatabaselogin.rb b/lib/puppet/type/dsc_xdatabaselogin.rb deleted file mode 100644 index f9f90bae..00000000 --- a/lib/puppet/type/dsc_xdatabaselogin.rb +++ /dev/null @@ -1,169 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xdatabaselogin) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xDatabaseLogin resource type. - Automatically generated from - 'xDatabase/DSCResources/MSFT_xDatabaseLogin/MSFT_xDatabaseLogin.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_loginname is a required attribute') if self[:dsc_loginname].nil? - end - - def dscmeta_resource_friendly_name; 'xDatabaseLogin' end - def dscmeta_resource_name; 'MSFT_xDatabaseLogin' end - def dscmeta_module_name; 'xDatabase' end - def dscmeta_module_version; '1.6.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: LoginName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_loginname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LoginName" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: LoginPassword - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_loginpassword) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LoginPassword" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SqlAuthType - # Type: string - # IsMandatory: False - # Values: ["Windows", "SQL"] - newparam(:dsc_sqlauthtype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SqlAuthType - Valid values are Windows, SQL." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Windows', 'windows', 'SQL', 'sql'].include?(value) - fail("Invalid value '#{value}'. Valid values are Windows, SQL") - end - end - end - - # Name: SqlServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SqlServer - Sql Server Name" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SqlConnectionCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_sqlconnectioncredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SqlConnectionCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SqlConnectionCredential", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xdatabaselogin).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xdatabaseserver.rb b/lib/puppet/type/dsc_xdatabaseserver.rb deleted file mode 100644 index 4ce4e17a..00000000 --- a/lib/puppet/type/dsc_xdatabaseserver.rb +++ /dev/null @@ -1,88 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xdatabaseserver) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xDatabaseServer resource type. - Automatically generated from - 'xDatabase/DSCResources/MSFT_xDatabaseServer/MSFT_xDatabaseServer.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_loginmode is a required attribute') if self[:dsc_loginmode].nil? - end - - def dscmeta_resource_friendly_name; 'xDatabaseServer' end - def dscmeta_resource_name; 'MSFT_xDatabaseServer' end - def dscmeta_module_name; 'xDatabase' end - def dscmeta_module_version; '1.6.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: LoginMode - # Type: string - # IsMandatory: True - # Values: ["Windows", "Mixed"] - newparam(:dsc_loginmode) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LoginMode - Valid values are Windows, Mixed." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Windows', 'windows', 'Mixed', 'mixed'].include?(value) - fail("Invalid value '#{value}'. Valid values are Windows, Mixed") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xdatabaseserver).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xdbpackage.rb b/lib/puppet/type/dsc_xdbpackage.rb deleted file mode 100644 index 3e676bcb..00000000 --- a/lib/puppet/type/dsc_xdbpackage.rb +++ /dev/null @@ -1,167 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xdbpackage) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xDBPackage resource type. - Automatically generated from - 'xDatabase/DSCResources/MSFT_xDBPackage/MSFT_xDBPackage.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_databasename is a required attribute') if self[:dsc_databasename].nil? - end - - def dscmeta_resource_friendly_name; 'xDBPackage' end - def dscmeta_resource_name; 'MSFT_xDBPackage' end - def dscmeta_module_name; 'xDatabase' end - def dscmeta_module_version; '1.6.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Credentials - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credentials) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credentials - Credentials to Connect to the sql server" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credentials", value) - end - end - - # Name: DatabaseName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_databasename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseName - Name of the Database" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SqlServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SqlServer - Sql Server Name" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Path - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_path) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Path - Path to BacPac/DacPac" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Type - # Type: string - # IsMandatory: False - # Values: ["DACPAC", "BACPAC"] - newparam(:dsc_type) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Type - Type for backup(Extract id done for DACPAC and Import for BACPAC) Valid values are DACPAC, BACPAC." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['DACPAC', 'dacpac', 'BACPAC', 'bacpac'].include?(value) - fail("Invalid value '#{value}'. Valid values are DACPAC, BACPAC") - end - end - end - - # Name: SqlServerVersion - # Type: string - # IsMandatory: False - # Values: ["2008-R2", "2012", "2014"] - newparam(:dsc_sqlserverversion) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SqlServerVersion - Sql Server Version For DacFx Valid values are 2008-R2, 2012, 2014." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['2008-R2', '2008-r2', '2012', '2012', '2014', '2014'].include?(value) - fail("Invalid value '#{value}'. Valid values are 2008-R2, 2012, 2014") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xdbpackage).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xdefaultgatewayaddress.rb b/lib/puppet/type/dsc_xdefaultgatewayaddress.rb deleted file mode 100644 index 6ffed70b..00000000 --- a/lib/puppet/type/dsc_xdefaultgatewayaddress.rb +++ /dev/null @@ -1,120 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xdefaultgatewayaddress) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xDefaultGatewayAddress resource type. - Automatically generated from - 'xNetworking/DSCResources/MSFT_xDefaultGatewayAddress/MSFT_xDefaultGatewayAddress.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_interfacealias is a required attribute') if self[:dsc_interfacealias].nil? - fail('dsc_addressfamily is a required attribute') if self[:dsc_addressfamily].nil? - end - - def dscmeta_resource_friendly_name; 'xDefaultGatewayAddress' end - def dscmeta_resource_name; 'MSFT_xDefaultGatewayAddress' end - def dscmeta_module_name; 'xNetworking' end - def dscmeta_module_version; '5.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: InterfaceAlias - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_interfacealias) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InterfaceAlias - Alias of the network interface for which the default gateway address is set." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AddressFamily - # Type: string - # IsMandatory: True - # Values: ["IPv4", "IPv6"] - newparam(:dsc_addressfamily) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AddressFamily - IP address family. Valid values are IPv4, IPv6." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['IPv4', 'ipv4', 'IPv6', 'ipv6'].include?(value) - fail("Invalid value '#{value}'. Valid values are IPv4, IPv6") - end - end - end - - # Name: Address - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_address) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Address - The desired default gateway address - if not provided default gateway will be removed." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xdefaultgatewayaddress).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xdfsnamespacefolder.rb b/lib/puppet/type/dsc_xdfsnamespacefolder.rb deleted file mode 100644 index 9b8b2bbf..00000000 --- a/lib/puppet/type/dsc_xdfsnamespacefolder.rb +++ /dev/null @@ -1,238 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xdfsnamespacefolder) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xDFSNamespaceFolder resource type. - Automatically generated from - 'xDFS/DSCResources/MSFT_xDFSNamespaceFolder/MSFT_xDFSNamespaceFolder.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_path is a required attribute') if self[:dsc_path].nil? - fail('dsc_targetpath is a required attribute') if self[:dsc_targetpath].nil? - end - - def dscmeta_resource_friendly_name; 'xDFSNamespaceFolder' end - def dscmeta_resource_name; 'MSFT_xDFSNamespaceFolder' end - def dscmeta_module_name; 'xDFS' end - def dscmeta_module_version; '3.2.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Path - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_path) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Path - Specifies a path for the root of a DFS namespace." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: TargetPath - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_targetpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TargetPath - Specifies a path for a root target of the DFS namespace." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies if the DFS Namespace root should exist. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Description - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_description) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Description - The description of the DFS Namespace." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: EnableInsiteReferrals - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_enableinsitereferrals) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "EnableInsiteReferrals - Indicates whether a DFS namespace server provides a client only with referrals that are in the same site as the client." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: EnableTargetFailback - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_enabletargetfailback) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "EnableTargetFailback - Indicates whether a DFS namespace uses target failback." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ReferralPriorityClass - # Type: string - # IsMandatory: False - # Values: ["Global-High", "SiteCost-High", "SiteCost-Normal", "SiteCost-Low", "Global-Low"] - newparam(:dsc_referralpriorityclass) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ReferralPriorityClass - Specifies the target priority class for a DFS namespace root. Valid values are Global-High, SiteCost-High, SiteCost-Normal, SiteCost-Low, Global-Low." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Global-High', 'global-high', 'SiteCost-High', 'sitecost-high', 'SiteCost-Normal', 'sitecost-normal', 'SiteCost-Low', 'sitecost-low', 'Global-Low', 'global-low'].include?(value) - fail("Invalid value '#{value}'. Valid values are Global-High, SiteCost-High, SiteCost-Normal, SiteCost-Low, Global-Low") - end - end - end - - # Name: ReferralPriorityRank - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_referralpriorityrank) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "ReferralPriorityRank - Specifies the priority rank, as an integer, for a root target of the DFS namespace." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: TimeToLiveSec - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_timetolivesec) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "TimeToLiveSec - Specifies a TTL interval, in seconds, for referrals." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: State - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_state) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "State" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xdfsnamespacefolder).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xdfsnamespaceroot.rb b/lib/puppet/type/dsc_xdfsnamespaceroot.rb deleted file mode 100644 index 7896db63..00000000 --- a/lib/puppet/type/dsc_xdfsnamespaceroot.rb +++ /dev/null @@ -1,304 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xdfsnamespaceroot) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xDFSNamespaceRoot resource type. - Automatically generated from - 'xDFS/DSCResources/MSFT_xDFSNamespaceRoot/MSFT_xDFSNamespaceRoot.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_path is a required attribute') if self[:dsc_path].nil? - fail('dsc_targetpath is a required attribute') if self[:dsc_targetpath].nil? - end - - def dscmeta_resource_friendly_name; 'xDFSNamespaceRoot' end - def dscmeta_resource_name; 'MSFT_xDFSNamespaceRoot' end - def dscmeta_module_name; 'xDFS' end - def dscmeta_module_version; '3.2.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Path - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_path) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Path - Specifies a path for the root of a DFS namespace." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: TargetPath - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_targetpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TargetPath - Specifies a path for a root target of the DFS namespace." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies if the DFS Namespace root should exist. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Type - # Type: string - # IsMandatory: False - # Values: ["Standalone", "DomainV1", "DomainV2"] - newparam(:dsc_type) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Type - Specifies the type of a DFS namespace as a Type object. Valid values are Standalone, DomainV1, DomainV2." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Standalone', 'standalone', 'DomainV1', 'domainv1', 'DomainV2', 'domainv2'].include?(value) - fail("Invalid value '#{value}'. Valid values are Standalone, DomainV1, DomainV2") - end - end - end - - # Name: Description - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_description) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Description - The description of the DFS Namespace." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: EnableSiteCosting - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_enablesitecosting) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "EnableSiteCosting - Indicates whether a DFS namespace uses cost-based selection." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: EnableInsiteReferrals - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_enableinsitereferrals) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "EnableInsiteReferrals - Indicates whether a DFS namespace server provides a client only with referrals that are in the same site as the client." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: EnableAccessBasedEnumeration - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_enableaccessbasedenumeration) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "EnableAccessBasedEnumeration - Indicates whether a DFS namespace uses access-based enumeration." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: EnableRootScalability - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_enablerootscalability) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "EnableRootScalability - Indicates whether a DFS namespace uses root scalability mode." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: EnableTargetFailback - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_enabletargetfailback) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "EnableTargetFailback - Indicates whether a DFS namespace uses target failback." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ReferralPriorityClass - # Type: string - # IsMandatory: False - # Values: ["Global-High", "SiteCost-High", "SiteCost-Normal", "SiteCost-Low", "Global-Low"] - newparam(:dsc_referralpriorityclass) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ReferralPriorityClass - Specifies the target priority class for a DFS namespace root. Valid values are Global-High, SiteCost-High, SiteCost-Normal, SiteCost-Low, Global-Low." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Global-High', 'global-high', 'SiteCost-High', 'sitecost-high', 'SiteCost-Normal', 'sitecost-normal', 'SiteCost-Low', 'sitecost-low', 'Global-Low', 'global-low'].include?(value) - fail("Invalid value '#{value}'. Valid values are Global-High, SiteCost-High, SiteCost-Normal, SiteCost-Low, Global-Low") - end - end - end - - # Name: ReferralPriorityRank - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_referralpriorityrank) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "ReferralPriorityRank - Specifies the priority rank, as an integer, for a root target of the DFS namespace." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: TimeToLiveSec - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_timetolivesec) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "TimeToLiveSec - Specifies a TTL interval, in seconds, for referrals." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: State - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_state) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "State" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xdfsnamespaceroot).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xdfsnamespaceserverconfiguration.rb b/lib/puppet/type/dsc_xdfsnamespaceserverconfiguration.rb deleted file mode 100644 index 8c0d7066..00000000 --- a/lib/puppet/type/dsc_xdfsnamespaceserverconfiguration.rb +++ /dev/null @@ -1,140 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xdfsnamespaceserverconfiguration) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xDFSNamespaceServerConfiguration resource type. - Automatically generated from - 'xDFS/DSCResources/MSFT_xDFSNamespaceServerConfiguration/MSFT_xDFSNamespaceServerConfiguration.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_issingleinstance is a required attribute') if self[:dsc_issingleinstance].nil? - end - - def dscmeta_resource_friendly_name; 'xDFSNamespaceServerConfiguration' end - def dscmeta_resource_name; 'MSFT_xDFSNamespaceServerConfiguration' end - def dscmeta_module_name; 'xDFS' end - def dscmeta_module_version; '3.2.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: IsSingleInstance - # Type: string - # IsMandatory: True - # Values: ["Yes"] - newparam(:dsc_issingleinstance) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes'. Valid values are Yes." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Yes', 'yes'].include?(value) - fail("Invalid value '#{value}'. Valid values are Yes") - end - end - end - - # Name: LdapTimeoutSec - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_ldaptimeoutsec) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "LdapTimeoutSec - Specifies a time-out value, in seconds, for Lightweight Directory Access Protocol (LDAP) requests for the DFS namespace server." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: SyncIntervalSec - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_syncintervalsec) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "SyncIntervalSec - This interval controls how often domain-based DFS namespace root servers and domain controllers connect to the PDC emulator to get updates of DFS namespace metadata." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: UseFQDN - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_usefqdn) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "UseFQDN - Indicates whether a DFS namespace server uses FQDNs in referrals." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xdfsnamespaceserverconfiguration).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xdfsreplicationgroup.rb b/lib/puppet/type/dsc_xdfsreplicationgroup.rb deleted file mode 100644 index b5747299..00000000 --- a/lib/puppet/type/dsc_xdfsreplicationgroup.rb +++ /dev/null @@ -1,207 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xdfsreplicationgroup) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xDFSReplicationGroup resource type. - Automatically generated from - 'xDFS/DSCResources/MSFT_xDFSReplicationGroup/MSFT_xDFSReplicationGroup.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_groupname is a required attribute') if self[:dsc_groupname].nil? - end - - def dscmeta_resource_friendly_name; 'xDFSReplicationGroup' end - def dscmeta_resource_name; 'MSFT_xDFSReplicationGroup' end - def dscmeta_module_name; 'xDFS' end - def dscmeta_module_version; '3.2.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: GroupName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_groupname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "GroupName - The name of the DFS Replication Group." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies whether the DSF Replication Group should exist. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Description - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_description) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Description - A description for the DFS Replication Group." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Members - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_members, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Members - A list of computers that are members of this Replication Group. These can be specified using either the ComputerName or FQDN name for each member. If an FQDN name is used and the DomainName parameter is set, the FQDN domain name must match." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: Folders - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_folders, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Folders - A list of folders that are replicated in this Replication Group." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: Topology - # Type: string - # IsMandatory: False - # Values: ["Fullmesh", "Manual"] - newparam(:dsc_topology) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Topology - This allows a replication topology to assign to the Replication Group. It defaults to Manual, which will not automatically create a topology. If set to Fullmesh, a full mesh topology between all members will be created. Valid values are Fullmesh, Manual." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Fullmesh', 'fullmesh', 'Manual', 'manual'].include?(value) - fail("Invalid value '#{value}'. Valid values are Fullmesh, Manual") - end - end - end - - # Name: ContentPaths - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_contentpaths, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ContentPaths - An array of DFS Replication Group Content Paths to use for each of the Folders. This can have one entry for each Folder in the Folders parameter and should be set in th same order. If any entry is not blank then the Content Paths will need to be set manually by using the xDFSReplicationGroupMembership resource." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: DomainName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domainname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainName - The AD domain the Replication Group should created in." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xdfsreplicationgroup).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xdfsreplicationgroupconnection.rb b/lib/puppet/type/dsc_xdfsreplicationgroupconnection.rb deleted file mode 100644 index 4bc9cabc..00000000 --- a/lib/puppet/type/dsc_xdfsreplicationgroupconnection.rb +++ /dev/null @@ -1,205 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xdfsreplicationgroupconnection) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xDFSReplicationGroupConnection resource type. - Automatically generated from - 'xDFS/DSCResources/MSFT_xDFSReplicationGroupConnection/MSFT_xDFSReplicationGroupConnection.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_groupname is a required attribute') if self[:dsc_groupname].nil? - fail('dsc_sourcecomputername is a required attribute') if self[:dsc_sourcecomputername].nil? - fail('dsc_destinationcomputername is a required attribute') if self[:dsc_destinationcomputername].nil? - end - - def dscmeta_resource_friendly_name; 'xDFSReplicationGroupConnection' end - def dscmeta_resource_name; 'MSFT_xDFSReplicationGroupConnection' end - def dscmeta_module_name; 'xDFS' end - def dscmeta_module_version; '3.2.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: GroupName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_groupname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "GroupName - The name of the DFS Replication Group." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SourceComputerName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_sourcecomputername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourceComputerName - The name of the Replication Group source computer for the connection. This can be specified using either the ComputerName or FQDN name for the member. If an FQDN name is used and the DomainName parameter is set, the FQDN domain name must match." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DestinationComputerName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_destinationcomputername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DestinationComputerName - The name of the Replication Group destination computer for the connection. This can be specified using either the ComputerName or FQDN name for the member. If an FQDN name is used and the DomainName parameter is set, the FQDN domain name must match." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies whether the DSF Replication Group connection should exist. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Description - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_description) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Description - A description for the DFS Replication Group connection." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: EnsureEnabled - # Type: string - # IsMandatory: False - # Values: ["Enabled", "Disabled"] - newparam(:dsc_ensureenabled) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "EnsureEnabled - Ensures that connection is either Enabled or Disabled. Valid values are Enabled, Disabled." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Enabled', 'enabled', 'Disabled', 'disabled'].include?(value) - fail("Invalid value '#{value}'. Valid values are Enabled, Disabled") - end - end - end - - # Name: EnsureRDCEnabled - # Type: string - # IsMandatory: False - # Values: ["Enabled", "Disabled"] - newparam(:dsc_ensurerdcenabled) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "EnsureRDCEnabled - Ensures remote differential compression is Enabled or Disabled. Valid values are Enabled, Disabled." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Enabled', 'enabled', 'Disabled', 'disabled'].include?(value) - fail("Invalid value '#{value}'. Valid values are Enabled, Disabled") - end - end - end - - # Name: DomainName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domainname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainName - The name of the AD Domain the DFS Replication Group connection should be in." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xdfsreplicationgroupconnection).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xdfsreplicationgroupfolder.rb b/lib/puppet/type/dsc_xdfsreplicationgroupfolder.rb deleted file mode 100644 index 40c71a60..00000000 --- a/lib/puppet/type/dsc_xdfsreplicationgroupfolder.rb +++ /dev/null @@ -1,183 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xdfsreplicationgroupfolder) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xDFSReplicationGroupFolder resource type. - Automatically generated from - 'xDFS/DSCResources/MSFT_xDFSReplicationGroupFolder/MSFT_xDFSReplicationGroupFolder.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_groupname is a required attribute') if self[:dsc_groupname].nil? - fail('dsc_foldername is a required attribute') if self[:dsc_foldername].nil? - end - - def dscmeta_resource_friendly_name; 'xDFSReplicationGroupFolder' end - def dscmeta_resource_name; 'MSFT_xDFSReplicationGroupFolder' end - def dscmeta_module_name; 'xDFS' end - def dscmeta_module_version; '3.2.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: GroupName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_groupname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "GroupName - The name of the DFS Replication Group." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: FolderName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_foldername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FolderName - The name of the DFS Replication Group Folder." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Description - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_description) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Description - A description for the DFS Replication Group Folder." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: FilenameToExclude - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_filenametoexclude, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "FilenameToExclude - An array of file names to exclude from replication." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: DirectoryNameToExclude - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_directorynametoexclude, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "DirectoryNameToExclude - An array of directory names to exclude from replication." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: DfsnPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_dfsnpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DfsnPath - The DFS Namespace Path to this Replication Group folder is mapped to. This does NOT create the Namespace folders, it only sets the name in the folder object." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DomainName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domainname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainName - The name of the AD Domain the DFS Replication Group Folder will be in." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xdfsreplicationgroupfolder).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xdfsreplicationgroupmembership.rb b/lib/puppet/type/dsc_xdfsreplicationgroupmembership.rb deleted file mode 100644 index dd089c70..00000000 --- a/lib/puppet/type/dsc_xdfsreplicationgroupmembership.rb +++ /dev/null @@ -1,211 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xdfsreplicationgroupmembership) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xDFSReplicationGroupMembership resource type. - Automatically generated from - 'xDFS/DSCResources/MSFT_xDFSReplicationGroupMembership/MSFT_xDFSReplicationGroupMembership.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_groupname is a required attribute') if self[:dsc_groupname].nil? - fail('dsc_foldername is a required attribute') if self[:dsc_foldername].nil? - fail('dsc_computername is a required attribute') if self[:dsc_computername].nil? - end - - def dscmeta_resource_friendly_name; 'xDFSReplicationGroupMembership' end - def dscmeta_resource_name; 'MSFT_xDFSReplicationGroupMembership' end - def dscmeta_module_name; 'xDFS' end - def dscmeta_module_version; '3.2.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: GroupName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_groupname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "GroupName - The name of the DFS Replication Group." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: FolderName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_foldername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FolderName - The name of the DFS Replication Group Folder." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ComputerName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_computername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ComputerName - The computer name of the Replication Group member. This can be specified using either the ComputerName or FQDN name for the member. If an FQDN name is used and the DomainName parameter is set, the FQDN domain name must match." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ContentPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_contentpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ContentPath - The local content path for the DFS Replication Group Folder." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: StagingPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_stagingpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "StagingPath - The local staging path for the DFS Replication Group Folder." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ConflictAndDeletedPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_conflictanddeletedpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ConflictAndDeletedPath - The local content and deleted path for the DFS Replication Group Folder." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ReadOnly - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_readonly) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ReadOnly - Specify if this content path should be read only." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: PrimaryMember - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_primarymember) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "PrimaryMember - Used to configure this as the Primary Member. Every folder must have at least one primary member for initial replication to take place." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DomainName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domainname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainName - The name of the AD Domain the DFS Replication Group this replication group is in." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xdfsreplicationgroupmembership).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xdhcpclient.rb b/lib/puppet/type/dsc_xdhcpclient.rb deleted file mode 100644 index d43fbe02..00000000 --- a/lib/puppet/type/dsc_xdhcpclient.rb +++ /dev/null @@ -1,123 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xdhcpclient) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xDHCPClient resource type. - Automatically generated from - 'xNetworking/DSCResources/MSFT_xDhcpClient/MSFT_xDhcpClient.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_interfacealias is a required attribute') if self[:dsc_interfacealias].nil? - fail('dsc_addressfamily is a required attribute') if self[:dsc_addressfamily].nil? - end - - def dscmeta_resource_friendly_name; 'xDHCPClient' end - def dscmeta_resource_name; 'MSFT_xDHCPClient' end - def dscmeta_module_name; 'xNetworking' end - def dscmeta_module_version; '5.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: InterfaceAlias - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_interfacealias) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InterfaceAlias - Alias of the network interface for which the DHCP Client is set." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AddressFamily - # Type: string - # IsMandatory: True - # Values: ["IPv4", "IPv6"] - newparam(:dsc_addressfamily) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AddressFamily - IP address family. Valid values are IPv4, IPv6." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['IPv4', 'ipv4', 'IPv6', 'ipv6'].include?(value) - fail("Invalid value '#{value}'. Valid values are IPv4, IPv6") - end - end - end - - # Name: State - # Type: string - # IsMandatory: False - # Values: ["Enabled", "Disabled"] - newparam(:dsc_state) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "State - The desired state of the DHCP Client. Valid values are Enabled, Disabled." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Enabled', 'enabled', 'Disabled', 'disabled'].include?(value) - fail("Invalid value '#{value}'. Valid values are Enabled, Disabled") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xdhcpclient).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xdhcpserverauthorization.rb b/lib/puppet/type/dsc_xdhcpserverauthorization.rb deleted file mode 100644 index ec37c32e..00000000 --- a/lib/puppet/type/dsc_xdhcpserverauthorization.rb +++ /dev/null @@ -1,120 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xdhcpserverauthorization) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xDhcpServerAuthorization resource type. - Automatically generated from - 'xDhcpServer/DSCResources/MSFT_xDhcpServerAuthorization/MSFT_xDhcpServerAuthorization.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_ensure is a required attribute') if self[:dsc_ensure].nil? - end - - def dscmeta_resource_friendly_name; 'xDhcpServerAuthorization' end - def dscmeta_resource_name; 'MSFT_xDhcpServerAuthorization' end - def dscmeta_module_name; 'xDhcpServer' end - def dscmeta_module_version; '1.6.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: DnsName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_dnsname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DnsName - DHCP Server FQDN" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: IPAddress - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_ipaddress) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IPAddress - DHCP Server IP Address" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: True - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Whether the DHCP server should be authorised within Active Directory Valid values are Present, Absent." - isrequired - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xdhcpserverauthorization).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xdhcpserverclass.rb b/lib/puppet/type/dsc_xdhcpserverclass.rb deleted file mode 100644 index 5d3fdc0d..00000000 --- a/lib/puppet/type/dsc_xdhcpserverclass.rb +++ /dev/null @@ -1,179 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xdhcpserverclass) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xDhcpServerClass resource type. - Automatically generated from - 'xDhcpServer/DSCResources/MSFT_xDhcpServerClass/MSFT_xDhcpServerClass.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - fail('dsc_type is a required attribute') if self[:dsc_type].nil? - fail('dsc_asciidata is a required attribute') if self[:dsc_asciidata].nil? - fail('dsc_addressfamily is a required attribute') if self[:dsc_addressfamily].nil? - fail('dsc_ensure is a required attribute') if self[:dsc_ensure].nil? - end - - def dscmeta_resource_friendly_name; 'xDhcpServerClass' end - def dscmeta_resource_name; 'MSFT_xDhcpServerClass' end - def dscmeta_module_name; 'xDhcpServer' end - def dscmeta_module_version; '1.6.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Class Name" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Type - # Type: string - # IsMandatory: True - # Values: ["Vendor", "User"] - newparam(:dsc_type) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Type - Class Type, Vendor or User Valid values are Vendor, User." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Vendor', 'vendor', 'User', 'user'].include?(value) - fail("Invalid value '#{value}'. Valid values are Vendor, User") - end - end - end - - # Name: AsciiData - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_asciidata) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AsciiData - Class Data, in ASCII format" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Description - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_description) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Description - Class Description" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AddressFamily - # Type: string - # IsMandatory: True - # Values: ["IPv4"] - newparam(:dsc_addressfamily) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AddressFamily - Class address family. Currently needs to be IPv4 Valid values are IPv4." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['IPv4', 'ipv4'].include?(value) - fail("Invalid value '#{value}'. Valid values are IPv4") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: True - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Whether the DHCP server Class should exist Valid values are Present, Absent." - isrequired - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xdhcpserverclass).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xdhcpserveroption.rb b/lib/puppet/type/dsc_xdhcpserveroption.rb deleted file mode 100644 index 40cf5da1..00000000 --- a/lib/puppet/type/dsc_xdhcpserveroption.rb +++ /dev/null @@ -1,174 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xdhcpserveroption) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xDhcpServerOption resource type. - Automatically generated from - 'xDhcpServer/DSCResources/MSFT_xDhcpServerOption/MSFT_xDhcpServerOption.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_scopeid is a required attribute') if self[:dsc_scopeid].nil? - end - - def dscmeta_resource_friendly_name; 'xDhcpServerOption' end - def dscmeta_resource_name; 'MSFT_xDhcpServerOption' end - def dscmeta_module_name; 'xDhcpServer' end - def dscmeta_module_version; '1.6.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: ScopeID - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_scopeid) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ScopeID - ScopeId for which options are set" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DnsServerIPAddress - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_dnsserveripaddress, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "DnsServerIPAddress - IP address of DNS Servers" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: DnsDomain - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_dnsdomain) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DnsDomain - Domain name of DNS Server" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Router - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_router, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Router - IP address of the router/default gateway." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: AddressFamily - # Type: string - # IsMandatory: False - # Values: ["IPv4"] - newparam(:dsc_addressfamily) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AddressFamily - Address family type Valid values are IPv4." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['IPv4', 'ipv4'].include?(value) - fail("Invalid value '#{value}'. Valid values are IPv4") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Whether option should be set or removed Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xdhcpserveroption).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xdhcpserverreservation.rb b/lib/puppet/type/dsc_xdhcpserverreservation.rb deleted file mode 100644 index 1cd97b65..00000000 --- a/lib/puppet/type/dsc_xdhcpserverreservation.rb +++ /dev/null @@ -1,170 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xdhcpserverreservation) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xDhcpServerReservation resource type. - Automatically generated from - 'xDhcpServer/DSCResources/MSFT_xDhcpServerReservation/MSFT_xDhcpServerReservation.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_scopeid is a required attribute') if self[:dsc_scopeid].nil? - fail('dsc_ipaddress is a required attribute') if self[:dsc_ipaddress].nil? - end - - def dscmeta_resource_friendly_name; 'xDhcpServerReservation' end - def dscmeta_resource_name; 'MSFT_xDhcpServerReservation' end - def dscmeta_module_name; 'xDhcpServer' end - def dscmeta_module_version; '1.6.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: ScopeID - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_scopeid) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ScopeID - ScopeId for which reservations are set" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: IPAddress - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_ipaddress) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IPAddress - IP address of the reservation for which the properties are modified" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ClientMACAddress - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_clientmacaddress) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ClientMACAddress - Client MAC Address to set on the reservation" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Name - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Reservation name" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AddressFamily - # Type: string - # IsMandatory: False - # Values: ["IPv4"] - newparam(:dsc_addressfamily) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AddressFamily - Address family type Valid values are IPv4." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['IPv4', 'ipv4'].include?(value) - fail("Invalid value '#{value}'. Valid values are IPv4") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Whether option should be set or removed Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xdhcpserverreservation).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xdhcpserverscope.rb b/lib/puppet/type/dsc_xdhcpserverscope.rb deleted file mode 100644 index aef3448b..00000000 --- a/lib/puppet/type/dsc_xdhcpserverscope.rb +++ /dev/null @@ -1,218 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xdhcpserverscope) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xDhcpServerScope resource type. - Automatically generated from - 'xDhcpServer/DSCResources/MSFT_xDhcpServerScope/MSFT_xDhcpServerScope.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_ipstartrange is a required attribute') if self[:dsc_ipstartrange].nil? - fail('dsc_ipendrange is a required attribute') if self[:dsc_ipendrange].nil? - end - - def dscmeta_resource_friendly_name; 'xDhcpServerScope' end - def dscmeta_resource_name; 'MSFT_xDhcpServerScope' end - def dscmeta_module_name; 'xDhcpServer' end - def dscmeta_module_version; '1.6.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: IPStartRange - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_ipstartrange) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IPStartRange - Starting address to set for this scope" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: IPEndRange - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_ipendrange) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IPEndRange - Ending address to set for this scope" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Name - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Name of DHCP Scope" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SubnetMask - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_subnetmask) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SubnetMask - Subnet mask for the scope specified in IP address format" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: LeaseDuration - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_leaseduration) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LeaseDuration - Time interval for which an IP address should be leased" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: State - # Type: string - # IsMandatory: False - # Values: ["Active", "Inactive"] - newparam(:dsc_state) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "State - Whether scope should be active or inactive Valid values are Active, Inactive." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Active', 'active', 'Inactive', 'inactive'].include?(value) - fail("Invalid value '#{value}'. Valid values are Active, Inactive") - end - end - end - - # Name: AddressFamily - # Type: string - # IsMandatory: False - # Values: ["IPv4"] - newparam(:dsc_addressfamily) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AddressFamily - Address family type Valid values are IPv4." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['IPv4', 'ipv4'].include?(value) - fail("Invalid value '#{value}'. Valid values are IPv4") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Whether scope should be set or removed Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: ScopeID - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_scopeid) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ScopeID - ScopeId for the given scope" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xdhcpserverscope).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xdisk.rb b/lib/puppet/type/dsc_xdisk.rb deleted file mode 100644 index 2a578c47..00000000 --- a/lib/puppet/type/dsc_xdisk.rb +++ /dev/null @@ -1,219 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xdisk) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xDisk resource type. - Automatically generated from - 'xStorage/DSCResources/MSFT_xDisk/MSFT_xDisk.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_driveletter is a required attribute') if self[:dsc_driveletter].nil? - end - - def dscmeta_resource_friendly_name; 'xDisk' end - def dscmeta_resource_name; 'MSFT_xDisk' end - def dscmeta_module_name; 'xStorage' end - def dscmeta_module_version; '3.2.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: DriveLetter - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_driveletter) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DriveLetter - Specifies the identifier for which disk to modify." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DiskId - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_diskid) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DiskId - Specifies the disk identifier for the disk to modify." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DiskIdType - # Type: string - # IsMandatory: False - # Values: ["Number", "UniqueId"] - newparam(:dsc_diskidtype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DiskIdType - Specifies the identifier type the DiskId contains. Defaults to Number. Valid values are Number, UniqueId." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Number', 'number', 'UniqueId', 'uniqueid'].include?(value) - fail("Invalid value '#{value}'. Valid values are Number, UniqueId") - end - end - end - - # Name: Size - # Type: uint64 - # IsMandatory: False - # Values: None - newparam(:dsc_size) do - def mof_type; 'uint64' end - def mof_is_embedded?; false end - desc "Size - Specifies the size of new volume. Leave empty to use the remaining free space." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: FSLabel - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_fslabel) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FSLabel - Define volume label if required." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AllocationUnitSize - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_allocationunitsize) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "AllocationUnitSize - Specifies the allocation unit size to use when formatting the volume." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: FSFormat - # Type: string - # IsMandatory: False - # Values: ["NTFS", "ReFS"] - newparam(:dsc_fsformat) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FSFormat - Specifies the file system format of the new volume. Valid values are NTFS, ReFS." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['NTFS', 'ntfs', 'ReFS', 'refs'].include?(value) - fail("Invalid value '#{value}'. Valid values are NTFS, ReFS") - end - end - end - - # Name: AllowDestructive - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowdestructive) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowDestructive - Specifies if potentially destructive operations may occur." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ClearDisk - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_cleardisk) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ClearDisk - Specifies if the disks partition schema should be removed entirely, even if data and oem partitions are present. Only possible with AllowDestructive enabled." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xdisk).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xdiskaccesspath.rb b/lib/puppet/type/dsc_xdiskaccesspath.rb deleted file mode 100644 index b5df8236..00000000 --- a/lib/puppet/type/dsc_xdiskaccesspath.rb +++ /dev/null @@ -1,187 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xdiskaccesspath) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xDiskAccessPath resource type. - Automatically generated from - 'xStorage/DSCResources/MSFT_xDiskAccessPath/MSFT_xDiskAccessPath.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_accesspath is a required attribute') if self[:dsc_accesspath].nil? - end - - def dscmeta_resource_friendly_name; 'xDiskAccessPath' end - def dscmeta_resource_name; 'MSFT_xDiskAccessPath' end - def dscmeta_module_name; 'xStorage' end - def dscmeta_module_version; '3.2.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: AccessPath - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_accesspath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AccessPath - Specifies the access path folder to the assign the disk volume to." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DiskId - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_diskid) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DiskId - Specifies the disk identifier for the disk to modify." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DiskIdType - # Type: string - # IsMandatory: False - # Values: ["Number", "UniqueId"] - newparam(:dsc_diskidtype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DiskIdType - Specifies the identifier type the DiskId contains. Defaults to Number. Valid values are Number, UniqueId." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Number', 'number', 'UniqueId', 'uniqueid'].include?(value) - fail("Invalid value '#{value}'. Valid values are Number, UniqueId") - end - end - end - - # Name: Size - # Type: uint64 - # IsMandatory: False - # Values: None - newparam(:dsc_size) do - def mof_type; 'uint64' end - def mof_is_embedded?; false end - desc "Size - Specifies the size of new volume." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: FSLabel - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_fslabel) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FSLabel - Define volume label if required." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AllocationUnitSize - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_allocationunitsize) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "AllocationUnitSize - Specifies the allocation unit size to use when formatting the volume." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: FSFormat - # Type: string - # IsMandatory: False - # Values: ["NTFS", "ReFS"] - newparam(:dsc_fsformat) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FSFormat - Specifies the file system format of the new volume. Valid values are NTFS, ReFS." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['NTFS', 'ntfs', 'ReFS', 'refs'].include?(value) - fail("Invalid value '#{value}'. Valid values are NTFS, ReFS") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xdiskaccesspath).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xdismfeature.rb b/lib/puppet/type/dsc_xdismfeature.rb deleted file mode 100644 index f39e8e5d..00000000 --- a/lib/puppet/type/dsc_xdismfeature.rb +++ /dev/null @@ -1,120 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xdismfeature) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xDismFeature resource type. - Automatically generated from - 'xDismFeature/DSCResources/MSFT_xDismFeature/MSFT_xDismFeature.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xDismFeature' end - def dscmeta_resource_name; 'MSFT_xDismFeature' end - def dscmeta_module_name; 'xDismFeature' end - def dscmeta_module_version; '1.2.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if the feature is expected to be enabled on the machine.\nPresent {default} \nAbsent \n Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Name of the feature." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Source - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_source) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Source - Optional location of Source." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xdismfeature).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xdnsarecord.rb b/lib/puppet/type/dsc_xdnsarecord.rb deleted file mode 100644 index 950c5646..00000000 --- a/lib/puppet/type/dsc_xdnsarecord.rb +++ /dev/null @@ -1,137 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xdnsarecord) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xDnsARecord resource type. - Automatically generated from - 'xDnsServer/DSCResources/MSFT_xDnsARecord/MSFT_xDnsARecord.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - fail('dsc_zone is a required attribute') if self[:dsc_zone].nil? - end - - def dscmeta_resource_friendly_name; 'xDnsARecord' end - def dscmeta_resource_name; 'MSFT_xDnsARecord' end - def dscmeta_module_name; 'xDnsServer' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Zone - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_zone) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Zone" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Target - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_target) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Target" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Should this DNS resource record be present or absent Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xdnsarecord).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xdnsclientglobalsetting.rb b/lib/puppet/type/dsc_xdnsclientglobalsetting.rb deleted file mode 100644 index c5cfe581..00000000 --- a/lib/puppet/type/dsc_xdnsclientglobalsetting.rb +++ /dev/null @@ -1,140 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xdnsclientglobalsetting) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xDnsClientGlobalSetting resource type. - Automatically generated from - 'xNetworking/DSCResources/MSFT_xDnsClientGlobalSetting/MSFT_xDnsClientGlobalSetting.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_issingleinstance is a required attribute') if self[:dsc_issingleinstance].nil? - end - - def dscmeta_resource_friendly_name; 'xDnsClientGlobalSetting' end - def dscmeta_resource_name; 'MSFT_xDnsClientGlobalSetting' end - def dscmeta_module_name; 'xNetworking' end - def dscmeta_module_version; '5.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: IsSingleInstance - # Type: string - # IsMandatory: True - # Values: ["Yes"] - newparam(:dsc_issingleinstance) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes'. Valid values are Yes." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Yes', 'yes'].include?(value) - fail("Invalid value '#{value}'. Valid values are Yes") - end - end - end - - # Name: SuffixSearchList - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_suffixsearchlist, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "SuffixSearchList - Specifies a list of global suffixes that can be used in the specified order by the DNS client for resolving the IP address of the computer name." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: UseDevolution - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_usedevolution) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "UseDevolution - Specifies that devolution is activated." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DevolutionLevel - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_devolutionlevel) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "DevolutionLevel - Specifies the number of labels up to which devolution should occur." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xdnsclientglobalsetting).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xdnsconnectionsuffix.rb b/lib/puppet/type/dsc_xdnsconnectionsuffix.rb deleted file mode 100644 index d9763737..00000000 --- a/lib/puppet/type/dsc_xdnsconnectionsuffix.rb +++ /dev/null @@ -1,152 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xdnsconnectionsuffix) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xDnsConnectionSuffix resource type. - Automatically generated from - 'xNetworking/DSCResources/MSFT_xDnsConnectionSuffix/MSFT_xDnsConnectionSuffix.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_interfacealias is a required attribute') if self[:dsc_interfacealias].nil? - end - - def dscmeta_resource_friendly_name; 'xDnsConnectionSuffix' end - def dscmeta_resource_name; 'MSFT_xDnsConnectionSuffix' end - def dscmeta_module_name; 'xNetworking' end - def dscmeta_module_version; '5.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: InterfaceAlias - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_interfacealias) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InterfaceAlias - Alias of the network interface for which the DNS server address is set." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ConnectionSpecificSuffix - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_connectionspecificsuffix) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ConnectionSpecificSuffix - DNS connection-specific suffix to assign to the network interface." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RegisterThisConnectionsAddress - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_registerthisconnectionsaddress) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RegisterThisConnectionsAddress - Specifies that the IP address for this connection is to be registered." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: UseSuffixWhenRegistering - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_usesuffixwhenregistering) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "UseSuffixWhenRegistering - Specifies that this host name and the connection specific suffix for this connection are to be registered." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Ensure that the network interface connection-specific suffix is present or not. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xdnsconnectionsuffix).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xdnsrecord.rb b/lib/puppet/type/dsc_xdnsrecord.rb deleted file mode 100644 index 65e16119..00000000 --- a/lib/puppet/type/dsc_xdnsrecord.rb +++ /dev/null @@ -1,157 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xdnsrecord) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xDnsRecord resource type. - Automatically generated from - 'xDnsServer/DSCResources/MSFT_xDnsRecord/MSFT_xDnsRecord.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - fail('dsc_zone is a required attribute') if self[:dsc_zone].nil? - fail('dsc_target is a required attribute') if self[:dsc_target].nil? - end - - def dscmeta_resource_friendly_name; 'xDnsRecord' end - def dscmeta_resource_name; 'MSFT_xDnsRecord' end - def dscmeta_module_name; 'xDnsServer' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Zone - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_zone) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Zone" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Type - # Type: string - # IsMandatory: False - # Values: ["ARecord", "CName"] - newparam(:dsc_type) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Type - Valid values are ARecord, CName." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['ARecord', 'arecord', 'CName', 'cname'].include?(value) - fail("Invalid value '#{value}'. Valid values are ARecord, CName") - end - end - end - - # Name: Target - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_target) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Target" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Should this DNS resource record be present or absent Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xdnsrecord).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xdnsserveraddress.rb b/lib/puppet/type/dsc_xdnsserveraddress.rb deleted file mode 100644 index da78f847..00000000 --- a/lib/puppet/type/dsc_xdnsserveraddress.rb +++ /dev/null @@ -1,139 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xdnsserveraddress) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xDNSServerAddress resource type. - Automatically generated from - 'xNetworking/DSCResources/MSFT_xDNSServerAddress/MSFT_xDNSServerAddress.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_interfacealias is a required attribute') if self[:dsc_interfacealias].nil? - fail('dsc_addressfamily is a required attribute') if self[:dsc_addressfamily].nil? - end - - def dscmeta_resource_friendly_name; 'xDNSServerAddress' end - def dscmeta_resource_name; 'MSFT_xDNSServerAddress' end - def dscmeta_module_name; 'xNetworking' end - def dscmeta_module_version; '5.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: InterfaceAlias - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_interfacealias) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InterfaceAlias - Alias of the network interface for which the DNS server address is set." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AddressFamily - # Type: string - # IsMandatory: True - # Values: ["IPv4", "IPv6"] - newparam(:dsc_addressfamily) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AddressFamily - IP address family. Valid values are IPv4, IPv6." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['IPv4', 'ipv4', 'IPv6', 'ipv6'].include?(value) - fail("Invalid value '#{value}'. Valid values are IPv4, IPv6") - end - end - end - - # Name: Address - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_address, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Address - The desired DNS Server address(es). Exclude to enable DHCP." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: Validate - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_validate) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Validate - Requires that the DNS Server addresses be validated if they are updated. It will cause the resource to throw a 'A general error occurred that is not covered by a more specific error code.' error if set to True and specified DNS Servers are not accessible." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xdnsserveraddress).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xdnsserveradzone.rb b/lib/puppet/type/dsc_xdnsserveradzone.rb deleted file mode 100644 index 32c39e19..00000000 --- a/lib/puppet/type/dsc_xdnsserveradzone.rb +++ /dev/null @@ -1,187 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xdnsserveradzone) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xDnsServerADZone resource type. - Automatically generated from - 'xDnsServer/DSCResources/MSFT_xDnsServerADZone/MSFT_xDnsServerADZone.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xDnsServerADZone' end - def dscmeta_resource_name; 'MSFT_xDnsServerADZone' end - def dscmeta_module_name; 'xDnsServer' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - DNS Server zone name" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DynamicUpdate - # Type: string - # IsMandatory: False - # Values: ["None", "NonsecureAndSecure", "Secure"] - newparam(:dsc_dynamicupdate) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DynamicUpdate - Dynamic zone update option Valid values are None, NonsecureAndSecure, Secure." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['None', 'none', 'NonsecureAndSecure', 'nonsecureandsecure', 'Secure', 'secure'].include?(value) - fail("Invalid value '#{value}'. Valid values are None, NonsecureAndSecure, Secure") - end - end - end - - # Name: ReplicationScope - # Type: string - # IsMandatory: False - # Values: ["Custom", "Domain", "Forest", "Legacy"] - newparam(:dsc_replicationscope) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ReplicationScope - Replication scope option Valid values are Custom, Domain, Forest, Legacy." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Custom', 'custom', 'Domain', 'domain', 'Forest', 'forest', 'Legacy', 'legacy'].include?(value) - fail("Invalid value '#{value}'. Valid values are Custom, Domain, Forest, Legacy") - end - end - end - - # Name: DirectoryPartitionName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_directorypartitionname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DirectoryPartitionName - Directory partition name" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ComputerName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_computername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ComputerName - DNS Server name" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential - Credential used to set zone" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Whether the DNS zone should be available or removed Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xdnsserveradzone).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xdnsserverforwarder.rb b/lib/puppet/type/dsc_xdnsserverforwarder.rb deleted file mode 100644 index 8751303d..00000000 --- a/lib/puppet/type/dsc_xdnsserverforwarder.rb +++ /dev/null @@ -1,106 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xdnsserverforwarder) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xDnsServerForwarder resource type. - Automatically generated from - 'xDnsServer/DSCResources/MSFT_xDnsServerForwarder/MSFT_xDnsServerForwarder.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_issingleinstance is a required attribute') if self[:dsc_issingleinstance].nil? - end - - def dscmeta_resource_friendly_name; 'xDnsServerForwarder' end - def dscmeta_resource_name; 'MSFT_xDnsServerForwarder' end - def dscmeta_module_name; 'xDnsServer' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: IsSingleInstance - # Type: string - # IsMandatory: True - # Values: ["Yes"] - newparam(:dsc_issingleinstance) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes' Valid values are Yes." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Yes', 'yes'].include?(value) - fail("Invalid value '#{value}'. Valid values are Yes") - end - end - end - - # Name: IPAddresses - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_ipaddresses, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "IPAddresses" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xdnsserverforwarder).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xdnsserverprimaryzone.rb b/lib/puppet/type/dsc_xdnsserverprimaryzone.rb deleted file mode 100644 index 2504481c..00000000 --- a/lib/puppet/type/dsc_xdnsserverprimaryzone.rb +++ /dev/null @@ -1,138 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xdnsserverprimaryzone) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xDnsServerPrimaryZone resource type. - Automatically generated from - 'xDnsServer/DSCResources/MSFT_xDnsServerPrimaryZone/MSFT_xDnsServerPrimaryZone.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xDnsServerPrimaryZone' end - def dscmeta_resource_name; 'MSFT_xDnsServerPrimaryZone' end - def dscmeta_module_name; 'xDnsServer' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - DNS Server primary zone name" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ZoneFile - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_zonefile) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ZoneFile - DNS Server primary zone file" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DynamicUpdate - # Type: string - # IsMandatory: False - # Values: ["None", "NonsecureAndSecure"] - newparam(:dsc_dynamicupdate) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DynamicUpdate - Dynamic zone update option Valid values are None, NonsecureAndSecure." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['None', 'none', 'NonsecureAndSecure', 'nonsecureandsecure'].include?(value) - fail("Invalid value '#{value}'. Valid values are None, NonsecureAndSecure") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Whether the DNS zone should be available or removed Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xdnsserverprimaryzone).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xdnsserversecondaryzone.rb b/lib/puppet/type/dsc_xdnsserversecondaryzone.rb deleted file mode 100644 index b617fb58..00000000 --- a/lib/puppet/type/dsc_xdnsserversecondaryzone.rb +++ /dev/null @@ -1,138 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xdnsserversecondaryzone) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xDnsServerSecondaryZone resource type. - Automatically generated from - 'xDnsServer/DSCResources/MSFT_xDnsServerSecondaryZone/MSFT_xDnsServerSecondaryZone.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xDnsServerSecondaryZone' end - def dscmeta_resource_name; 'MSFT_xDnsServerSecondaryZone' end - def dscmeta_module_name; 'xDnsServer' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Name of the secondary zone" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MasterServers - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_masterservers, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "MasterServers - IP address or DNS name of the secondary DNS servers" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Should this resource be present or absent Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Type - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_type) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Type - Type of the DNS server zone" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xdnsserversecondaryzone).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xdnsserverzonetransfer.rb b/lib/puppet/type/dsc_xdnsserverzonetransfer.rb deleted file mode 100644 index 0928b380..00000000 --- a/lib/puppet/type/dsc_xdnsserverzonetransfer.rb +++ /dev/null @@ -1,121 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xdnsserverzonetransfer) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xDnsServerZoneTransfer resource type. - Automatically generated from - 'xDnsServer/DSCResources/MSFT_xDnsServerZoneTransfer/MSFT_xDnsServerZoneTransfer.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xDnsServerZoneTransfer' end - def dscmeta_resource_name; 'MSFT_xDnsServerZoneTransfer' end - def dscmeta_module_name; 'xDnsServer' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Name of the DNS zone" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Type - # Type: string - # IsMandatory: False - # Values: ["None", "Any", "Named", "Specific"] - newparam(:dsc_type) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Type - Type of transfer allowed Valid values are None, Any, Named, Specific." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['None', 'none', 'Any', 'any', 'Named', 'named', 'Specific', 'specific'].include?(value) - fail("Invalid value '#{value}'. Valid values are None, Any, Named, Specific") - end - end - end - - # Name: SecondaryServer - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_secondaryserver, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "SecondaryServer - IP address or DNS name of DNS servers where zone information can be transfered" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xdnsserverzonetransfer).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xdscwebservice.rb b/lib/puppet/type/dsc_xdscwebservice.rb deleted file mode 100644 index b21b2d4b..00000000 --- a/lib/puppet/type/dsc_xdscwebservice.rb +++ /dev/null @@ -1,306 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xdscwebservice) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xDSCWebService resource type. - Automatically generated from - 'xPSDesiredStateConfiguration/DSCResources/MSFT_xDSCWebService/MSFT_xDSCWebService.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_endpointname is a required attribute') if self[:dsc_endpointname].nil? - end - - def dscmeta_resource_friendly_name; 'xDSCWebService' end - def dscmeta_resource_name; 'MSFT_xDSCWebService' end - def dscmeta_module_name; 'xPSDesiredStateConfiguration' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: EndpointName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_endpointname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "EndpointName" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CertificateThumbPrint - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_certificatethumbprint) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CertificateThumbPrint - Can take the value AllowUnencryptedTraffic for setting up a non SSL based endpoint" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Port - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_port) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "Port" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: PhysicalPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_physicalpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "PhysicalPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: State - # Type: string - # IsMandatory: False - # Values: ["Started", "Stopped"] - newparam(:dsc_state) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "State - Valid values are Started, Stopped." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Started', 'started', 'Stopped', 'stopped'].include?(value) - fail("Invalid value '#{value}'. Valid values are Started, Stopped") - end - end - end - - # Name: DatabasePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databasepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabasePath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ModulePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_modulepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ModulePath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ConfigurationPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_configurationpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ConfigurationPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DSCServerUrl - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_dscserverurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DSCServerUrl" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RegistrationKeyPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_registrationkeypath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RegistrationKeyPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AcceptSelfSignedCertificates - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_acceptselfsignedcertificates) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AcceptSelfSignedCertificates" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: UseSecurityBestPractices - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_usesecuritybestpractices) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "UseSecurityBestPractices - This property will ensure that the Pull Server is created with the most secure practices" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DisableSecurityBestPractices - # Type: string[] - # IsMandatory: False - # Values: ["SecureTLSProtocols"] - newparam(:dsc_disablesecuritybestpractices, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "DisableSecurityBestPractices - Valid values are SecureTLSProtocols." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - if value.kind_of?(Array) - unless (['SecureTLSProtocols', 'securetlsprotocols'] & value).count == value.count - fail("Invalid value #{value}. Valid values are SecureTLSProtocols") - end - end - if value.kind_of?(String) - unless ['SecureTLSProtocols', 'securetlsprotocols'].include?(value) - fail("Invalid value #{value}. Valid values are SecureTLSProtocols") - end - end - end - munge do |value| - Array(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xdscwebservice).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xenvironment.rb b/lib/puppet/type/dsc_xenvironment.rb deleted file mode 100644 index 351c210d..00000000 --- a/lib/puppet/type/dsc_xenvironment.rb +++ /dev/null @@ -1,164 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xenvironment) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xEnvironment resource type. - Automatically generated from - 'xPSDesiredStateConfiguration/DSCResources/MSFT_xEnvironmentResource/MSFT_xEnvironmentResource.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xEnvironment' end - def dscmeta_resource_name; 'MSFT_xEnvironmentResource' end - def dscmeta_module_name; 'xPSDesiredStateConfiguration' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the environment variable for which you want to ensure a specific state." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Value - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_value) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Value - The desired value for the environment variable." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies if the environment varaible should exist. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Path - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_path) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Path - Indicates whether or not the environment variable is the Path variable." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Target - # Type: string[] - # IsMandatory: False - # Values: ["Process", "Machine"] - newparam(:dsc_target, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Target - Indicates the target where the environment variable should be set. Valid values are Process, Machine." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - if value.kind_of?(Array) - unless (['Process', 'process', 'Machine', 'machine'] & value).count == value.count - fail("Invalid value #{value}. Valid values are Process, Machine") - end - end - if value.kind_of?(String) - unless ['Process', 'process', 'Machine', 'machine'].include?(value) - fail("Invalid value #{value}. Valid values are Process, Machine") - end - end - end - munge do |value| - Array(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xenvironment).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchactivesyncvirtualdirectory.rb b/lib/puppet/type/dsc_xexchactivesyncvirtualdirectory.rb deleted file mode 100644 index 34aed037..00000000 --- a/lib/puppet/type/dsc_xexchactivesyncvirtualdirectory.rb +++ /dev/null @@ -1,313 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchactivesyncvirtualdirectory) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchActiveSyncVirtualDirectory resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchActiveSyncVirtualDirectory/MSFT_xExchActiveSyncVirtualDirectory.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_identity is a required attribute') if self[:dsc_identity].nil? - end - - def dscmeta_resource_friendly_name; 'xExchActiveSyncVirtualDirectory' end - def dscmeta_resource_name; 'MSFT_xExchActiveSyncVirtualdirectory' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Identity - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_identity) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Identity" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: AllowServiceRestart - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowservicerestart) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowServiceRestart" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AutoCertBasedAuth - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_autocertbasedauth) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AutoCertBasedAuth" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AutoCertBasedAuthThumbprint - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_autocertbasedauththumbprint) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AutoCertBasedAuthThumbprint" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AutoCertBasedAuthHttpsBindings - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_autocertbasedauthhttpsbindings, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "AutoCertBasedAuthHttpsBindings" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: BasicAuthEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_basicauthenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "BasicAuthEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ClientCertAuth - # Type: string - # IsMandatory: False - # Values: ["Ignore", "Accepted", "Required"] - newparam(:dsc_clientcertauth) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ClientCertAuth - Valid values are Ignore, Accepted, Required." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Ignore', 'ignore', 'Accepted', 'accepted', 'Required', 'required'].include?(value) - fail("Invalid value '#{value}'. Valid values are Ignore, Accepted, Required") - end - end - end - - # Name: CompressionEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_compressionenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "CompressionEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DomainController - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domaincontroller) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainController" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ExternalAuthenticationMethods - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_externalauthenticationmethods, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ExternalAuthenticationMethods" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: ExternalUrl - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_externalurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ExternalUrl" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InternalAuthenticationMethods - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_internalauthenticationmethods, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "InternalAuthenticationMethods" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: InternalUrl - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_internalurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InternalUrl" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: WindowsAuthEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_windowsauthenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "WindowsAuthEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchactivesyncvirtualdirectory).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchantimalwarescanning.rb b/lib/puppet/type/dsc_xexchantimalwarescanning.rb deleted file mode 100644 index caa7f91d..00000000 --- a/lib/puppet/type/dsc_xexchantimalwarescanning.rb +++ /dev/null @@ -1,118 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchantimalwarescanning) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchAntiMalwareScanning resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchAntiMalwareScanning/MSFT_xExchAntiMalwareScanning.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_enabled is a required attribute') if self[:dsc_enabled].nil? - end - - def dscmeta_resource_friendly_name; 'xExchAntiMalwareScanning' end - def dscmeta_resource_name; 'MSFT_xExchAntiMalwareScanning' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Enabled - # Type: boolean - # IsMandatory: True - # Values: None - newparam(:dsc_enabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Enabled - Whether Exchange Anti-malware scanning should be Enabled" - isrequired - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential - Credentials used to establish a remote Powershell session to Exchange" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: AllowServiceRestart - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowservicerestart) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowServiceRestart - Whether the Transport services should be automatically restarted after a status change" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchantimalwarescanning).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchautodiscovervirtualdirectory.rb b/lib/puppet/type/dsc_xexchautodiscovervirtualdirectory.rb deleted file mode 100644 index 2bb29798..00000000 --- a/lib/puppet/type/dsc_xexchautodiscovervirtualdirectory.rb +++ /dev/null @@ -1,196 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchautodiscovervirtualdirectory) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchAutodiscoverVirtualDirectory resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchAutodiscoverVirtualDirectory/MSFT_xExchAutodiscoverVirtualDirectory.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_identity is a required attribute') if self[:dsc_identity].nil? - end - - def dscmeta_resource_friendly_name; 'xExchAutodiscoverVirtualDirectory' end - def dscmeta_resource_name; 'MSFT_xExchAutodiscoverVirtualDirectory' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Identity - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_identity) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Identity" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: AllowServiceRestart - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowservicerestart) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowServiceRestart" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: BasicAuthentication - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_basicauthentication) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "BasicAuthentication" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DigestAuthentication - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_digestauthentication) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DigestAuthentication" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DomainController - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domaincontroller) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainController" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: WindowsAuthentication - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_windowsauthentication) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "WindowsAuthentication" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: WSSecurityAuthentication - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_wssecurityauthentication) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "WSSecurityAuthentication" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchautodiscovervirtualdirectory).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchautomountpoint.rb b/lib/puppet/type/dsc_xexchautomountpoint.rb deleted file mode 100644 index 57226e79..00000000 --- a/lib/puppet/type/dsc_xexchautomountpoint.rb +++ /dev/null @@ -1,264 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchautomountpoint) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchAutoMountPoint resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchAutoMountPoint/MSFT_xExchAutoMountPoint.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_identity is a required attribute') if self[:dsc_identity].nil? - end - - def dscmeta_resource_friendly_name; 'xExchAutoMountPoint' end - def dscmeta_resource_name; 'MSFT_xExchAutoMountPoint' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Identity - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_identity) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Identity" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AutoDagDatabasesRootFolderPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_autodagdatabasesrootfolderpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AutoDagDatabasesRootFolderPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AutoDagVolumesRootFolderPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_autodagvolumesrootfolderpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AutoDagVolumesRootFolderPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DiskToDBMap - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_disktodbmap, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "DiskToDBMap" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: SpareVolumeCount - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_sparevolumecount) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "SpareVolumeCount" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: EnsureExchangeVolumeMountPointIsLast - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_ensureexchangevolumemountpointislast) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "EnsureExchangeVolumeMountPointIsLast" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: CreateSubfolders - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_createsubfolders) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "CreateSubfolders" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: FileSystem - # Type: string - # IsMandatory: False - # Values: ["NTFS", "REFS"] - newparam(:dsc_filesystem) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FileSystem - Valid values are NTFS, REFS." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['NTFS', 'ntfs', 'REFS', 'refs'].include?(value) - fail("Invalid value '#{value}'. Valid values are NTFS, REFS") - end - end - end - - # Name: MinDiskSize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_mindisksize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MinDiskSize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: PartitioningScheme - # Type: string - # IsMandatory: False - # Values: ["MBR", "GPT"] - newparam(:dsc_partitioningscheme) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "PartitioningScheme - Valid values are MBR, GPT." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['MBR', 'mbr', 'GPT', 'gpt'].include?(value) - fail("Invalid value '#{value}'. Valid values are MBR, GPT") - end - end - end - - # Name: UnitSize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_unitsize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UnitSize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: VolumePrefix - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_volumeprefix) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "VolumePrefix" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchautomountpoint).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchclientaccessserver.rb b/lib/puppet/type/dsc_xexchclientaccessserver.rb deleted file mode 100644 index 836efbd9..00000000 --- a/lib/puppet/type/dsc_xexchclientaccessserver.rb +++ /dev/null @@ -1,197 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchclientaccessserver) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchClientAccessServer resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchClientAccessServer/MSFT_xExchClientAccessServer.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_identity is a required attribute') if self[:dsc_identity].nil? - end - - def dscmeta_resource_friendly_name; 'xExchClientAccessServer' end - def dscmeta_resource_name; 'MSFT_xExchClientAccessServer' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Identity - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_identity) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Identity" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: AutoDiscoverServiceInternalUri - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_autodiscoverserviceinternaluri) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AutoDiscoverServiceInternalUri" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AutoDiscoverSiteScope - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_autodiscoversitescope, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "AutoDiscoverSiteScope" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: DomainController - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domaincontroller) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainController" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AlternateServiceAccountCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_alternateserviceaccountcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "AlternateServiceAccountCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("AlternateServiceAccountCredential", value) - end - end - - # Name: CleanUpInvalidAlternateServiceAccountCredentials - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_cleanupinvalidalternateserviceaccountcredentials) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "CleanUpInvalidAlternateServiceAccountCredentials" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: RemoveAlternateServiceAccountCredentials - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_removealternateserviceaccountcredentials) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RemoveAlternateServiceAccountCredentials" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchclientaccessserver).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchdatabaseavailabilitygroup.rb b/lib/puppet/type/dsc_xexchdatabaseavailabilitygroup.rb deleted file mode 100644 index 128a029b..00000000 --- a/lib/puppet/type/dsc_xexchdatabaseavailabilitygroup.rb +++ /dev/null @@ -1,497 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchdatabaseavailabilitygroup) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchDatabaseAvailabilityGroup resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchDatabaseAvailabilityGroup/MSFT_xExchDatabaseAvailabilityGroup.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xExchDatabaseAvailabilityGroup' end - def dscmeta_resource_name; 'MSFT_xExchDatabaseAvailabilityGroup' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: AutoDagTotalNumberOfServers - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_autodagtotalnumberofservers) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "AutoDagTotalNumberOfServers" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: AlternateWitnessDirectory - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_alternatewitnessdirectory) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AlternateWitnessDirectory" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AlternateWitnessServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_alternatewitnessserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AlternateWitnessServer" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AutoDagAutoRedistributeEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_autodagautoredistributeenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AutoDagAutoRedistributeEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AutoDagAutoReseedEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_autodagautoreseedenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AutoDagAutoReseedEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AutoDagDatabaseCopiesPerDatabase - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_autodagdatabasecopiesperdatabase) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "AutoDagDatabaseCopiesPerDatabase" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: AutoDagDatabaseCopiesPerVolume - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_autodagdatabasecopiespervolume) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "AutoDagDatabaseCopiesPerVolume" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: AutoDagDatabasesRootFolderPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_autodagdatabasesrootfolderpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AutoDagDatabasesRootFolderPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AutoDagDiskReclaimerEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_autodagdiskreclaimerenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AutoDagDiskReclaimerEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AutoDagTotalNumberOfDatabases - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_autodagtotalnumberofdatabases) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "AutoDagTotalNumberOfDatabases" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: AutoDagVolumesRootFolderPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_autodagvolumesrootfolderpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AutoDagVolumesRootFolderPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseAvailabilityGroupIpAddresses - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_databaseavailabilitygroupipaddresses, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "DatabaseAvailabilityGroupIpAddresses" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: DatacenterActivationMode - # Type: string - # IsMandatory: False - # Values: ["Off", "DagOnly"] - newparam(:dsc_datacenteractivationmode) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatacenterActivationMode - Valid values are Off, DagOnly." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Off', 'off', 'DagOnly', 'dagonly'].include?(value) - fail("Invalid value '#{value}'. Valid values are Off, DagOnly") - end - end - end - - # Name: DomainController - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domaincontroller) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainController" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: FileSystem - # Type: string - # IsMandatory: False - # Values: ["NTFS", "ReFS"] - newparam(:dsc_filesystem) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FileSystem - Valid values are NTFS, ReFS." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['NTFS', 'ntfs', 'ReFS', 'refs'].include?(value) - fail("Invalid value '#{value}'. Valid values are NTFS, ReFS") - end - end - end - - # Name: ManualDagNetworkConfiguration - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_manualdagnetworkconfiguration) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ManualDagNetworkConfiguration" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: NetworkCompression - # Type: string - # IsMandatory: False - # Values: ["Disabled", "Enabled", "InterSubnetOnly", "SeedOnly"] - newparam(:dsc_networkcompression) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "NetworkCompression - Valid values are Disabled, Enabled, InterSubnetOnly, SeedOnly." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Disabled', 'disabled', 'Enabled', 'enabled', 'InterSubnetOnly', 'intersubnetonly', 'SeedOnly', 'seedonly'].include?(value) - fail("Invalid value '#{value}'. Valid values are Disabled, Enabled, InterSubnetOnly, SeedOnly") - end - end - end - - # Name: NetworkEncryption - # Type: string - # IsMandatory: False - # Values: ["Disabled", "Enabled", "InterSubnetOnly", "SeedOnly"] - newparam(:dsc_networkencryption) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "NetworkEncryption - Valid values are Disabled, Enabled, InterSubnetOnly, SeedOnly." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Disabled', 'disabled', 'Enabled', 'enabled', 'InterSubnetOnly', 'intersubnetonly', 'SeedOnly', 'seedonly'].include?(value) - fail("Invalid value '#{value}'. Valid values are Disabled, Enabled, InterSubnetOnly, SeedOnly") - end - end - end - - # Name: PreferenceMoveFrequency - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_preferencemovefrequency) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "PreferenceMoveFrequency" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ReplayLagManagerEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_replaylagmanagerenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ReplayLagManagerEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ReplicationPort - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_replicationport) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "ReplicationPort" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: SkipDagValidation - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_skipdagvalidation) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "SkipDagValidation" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: WitnessDirectory - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_witnessdirectory) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WitnessDirectory" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: WitnessServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_witnessserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WitnessServer" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchdatabaseavailabilitygroup).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchdatabaseavailabilitygroupmember.rb b/lib/puppet/type/dsc_xexchdatabaseavailabilitygroupmember.rb deleted file mode 100644 index f823cc41..00000000 --- a/lib/puppet/type/dsc_xexchdatabaseavailabilitygroupmember.rb +++ /dev/null @@ -1,147 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchdatabaseavailabilitygroupmember) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchDatabaseAvailabilityGroupMember resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchDatabaseAvailabilityGroupMember/MSFT_xExchDatabaseAvailabilityGroupMember.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_mailboxserver is a required attribute') if self[:dsc_mailboxserver].nil? - end - - def dscmeta_resource_friendly_name; 'xExchDatabaseAvailabilityGroupMember' end - def dscmeta_resource_name; 'MSFT_xExchDatabaseAvailabilityGroupMember' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: MailboxServer - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_mailboxserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MailboxServer" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: DAGName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_dagname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DAGName" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DomainController - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domaincontroller) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainController" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SkipDagValidation - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_skipdagvalidation) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "SkipDagValidation" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchdatabaseavailabilitygroupmember).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchdatabaseavailabilitygroupnetwork.rb b/lib/puppet/type/dsc_xexchdatabaseavailabilitygroupnetwork.rb deleted file mode 100644 index e34898d9..00000000 --- a/lib/puppet/type/dsc_xexchdatabaseavailabilitygroupnetwork.rb +++ /dev/null @@ -1,201 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchdatabaseavailabilitygroupnetwork) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchDatabaseAvailabilityGroupNetwork resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchDatabaseAvailabilityGroupNetwork/MSFT_xExchDatabaseAvailabilityGroupNetwork.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xExchDatabaseAvailabilityGroupNetwork' end - def dscmeta_resource_name; 'MSFT_xExchDatabaseAvailabilityGroupNetwork' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: DatabaseAvailabilityGroup - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databaseavailabilitygroup) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseAvailabilityGroup" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: DomainController - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domaincontroller) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainController" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: IgnoreNetwork - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_ignorenetwork) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "IgnoreNetwork" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ReplicationEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_replicationenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ReplicationEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Subnets - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_subnets, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Subnets" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchdatabaseavailabilitygroupnetwork).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchecpvirtualdirectory.rb b/lib/puppet/type/dsc_xexchecpvirtualdirectory.rb deleted file mode 100644 index fa978ae5..00000000 --- a/lib/puppet/type/dsc_xexchecpvirtualdirectory.rb +++ /dev/null @@ -1,260 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchecpvirtualdirectory) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchEcpVirtualDirectory resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchEcpVirtualDirectory/MSFT_xExchEcpVirtualDirectory.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_identity is a required attribute') if self[:dsc_identity].nil? - end - - def dscmeta_resource_friendly_name; 'xExchEcpVirtualDirectory' end - def dscmeta_resource_name; 'MSFT_xExchEcpVirtualDirectory' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Identity - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_identity) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Identity" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: AllowServiceRestart - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowservicerestart) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowServiceRestart" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AdfsAuthentication - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_adfsauthentication) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AdfsAuthentication" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: BasicAuthentication - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_basicauthentication) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "BasicAuthentication" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DigestAuthentication - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_digestauthentication) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DigestAuthentication" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DomainController - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domaincontroller) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainController" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ExternalAuthenticationMethods - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_externalauthenticationmethods, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ExternalAuthenticationMethods" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: FormsAuthentication - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_formsauthentication) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "FormsAuthentication" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ExternalUrl - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_externalurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ExternalUrl" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InternalUrl - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_internalurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InternalUrl" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: WindowsAuthentication - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_windowsauthentication) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "WindowsAuthentication" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchecpvirtualdirectory).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexcheventloglevel.rb b/lib/puppet/type/dsc_xexcheventloglevel.rb deleted file mode 100644 index 98491572..00000000 --- a/lib/puppet/type/dsc_xexcheventloglevel.rb +++ /dev/null @@ -1,119 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexcheventloglevel) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchEventLogLevel resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchEventLogLevel/MSFT_xExchEventLogLevel.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_identity is a required attribute') if self[:dsc_identity].nil? - end - - def dscmeta_resource_friendly_name; 'xExchEventLogLevel' end - def dscmeta_resource_name; 'MSFT_xExchEventLogLevel' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Identity - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_identity) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Identity - The Identity parameter specifies the name of the event logging category for which you want to set the event logging level." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential - Credentials used to establish a remote Powershell session to Exchange" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Level - # Type: string - # IsMandatory: False - # Values: ["Lowest", "Low", "Medium", "High", "Expert"] - newparam(:dsc_level) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Level - The Level parameter specifies the log level for the specific event logging category. Valid values are Lowest, Low, Medium, High, Expert." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Lowest', 'lowest', 'Low', 'low', 'Medium', 'medium', 'High', 'high', 'Expert', 'expert'].include?(value) - fail("Invalid value '#{value}'. Valid values are Lowest, Low, Medium, High, Expert") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexcheventloglevel).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchexchangecertificate.rb b/lib/puppet/type/dsc_xexchexchangecertificate.rb deleted file mode 100644 index 4e021253..00000000 --- a/lib/puppet/type/dsc_xexchexchangecertificate.rb +++ /dev/null @@ -1,201 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchexchangecertificate) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchExchangeCertificate resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchExchangeCertificate/MSFT_xExchExchangeCertificate.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_thumbprint is a required attribute') if self[:dsc_thumbprint].nil? - end - - def dscmeta_resource_friendly_name; 'xExchExchangeCertificate' end - def dscmeta_resource_name; 'MSFT_xExchExchangeCertificate' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Thumbprint - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_thumbprint) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Thumbprint" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: AllowExtraServices - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowextraservices) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowExtraServices" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: CertCreds - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_certcreds) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "CertCreds" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("CertCreds", value) - end - end - - # Name: CertFilePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_certfilepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CertFilePath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DomainController - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domaincontroller) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainController" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Services - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_services, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Services" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchexchangecertificate).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchexchangeserver.rb b/lib/puppet/type/dsc_xexchexchangeserver.rb deleted file mode 100644 index fed3730a..00000000 --- a/lib/puppet/type/dsc_xexchexchangeserver.rb +++ /dev/null @@ -1,208 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchexchangeserver) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchExchangeServer resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchExchangeServer/MSFT_xExchExchangeServer.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_identity is a required attribute') if self[:dsc_identity].nil? - end - - def dscmeta_resource_friendly_name; 'xExchExchangeServer' end - def dscmeta_resource_name; 'MSFT_xExchExchangeServer' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Identity - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_identity) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Identity" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: AllowServiceRestart - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowservicerestart) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowServiceRestart" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: CustomerFeedbackEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_customerfeedbackenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "CustomerFeedbackEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DomainController - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domaincontroller) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainController" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InternetWebProxy - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_internetwebproxy) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InternetWebProxy" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MonitoringGroup - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_monitoringgroup) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MonitoringGroup" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ProductKey - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_productkey) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProductKey" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: WorkloadManagementPolicy - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_workloadmanagementpolicy) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WorkloadManagementPolicy" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchexchangeserver).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchimapsettings.rb b/lib/puppet/type/dsc_xexchimapsettings.rb deleted file mode 100644 index b1976648..00000000 --- a/lib/puppet/type/dsc_xexchimapsettings.rb +++ /dev/null @@ -1,183 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchimapsettings) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchImapSettings resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchImapSettings/MSFT_xExchImapSettings.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_server is a required attribute') if self[:dsc_server].nil? - end - - def dscmeta_resource_friendly_name; 'xExchImapSettings' end - def dscmeta_resource_name; 'MSFT_xExchImapSettings' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Server - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_server) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Server" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: AllowServiceRestart - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowservicerestart) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowServiceRestart" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DomainController - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domaincontroller) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainController" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: LoginType - # Type: string - # IsMandatory: False - # Values: ["PlainTextLogin", "PlainTextAuthentication", "SecureLogin"] - newparam(:dsc_logintype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LoginType - Valid values are PlainTextLogin, PlainTextAuthentication, SecureLogin." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['PlainTextLogin', 'plaintextlogin', 'PlainTextAuthentication', 'plaintextauthentication', 'SecureLogin', 'securelogin'].include?(value) - fail("Invalid value '#{value}'. Valid values are PlainTextLogin, PlainTextAuthentication, SecureLogin") - end - end - end - - # Name: ExternalConnectionSettings - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_externalconnectionsettings, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ExternalConnectionSettings" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: X509CertificateName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_x509certificatename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "X509CertificateName" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchimapsettings).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchinstall.rb b/lib/puppet/type/dsc_xexchinstall.rb deleted file mode 100644 index 0498994f..00000000 --- a/lib/puppet/type/dsc_xexchinstall.rb +++ /dev/null @@ -1,118 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchinstall) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchInstall resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchInstall/MSFT_xExchInstall.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_path is a required attribute') if self[:dsc_path].nil? - fail('dsc_arguments is a required attribute') if self[:dsc_arguments].nil? - end - - def dscmeta_resource_friendly_name; 'xExchInstall' end - def dscmeta_resource_name; 'MSFT_xExchInstall' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Path - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_path) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Path - Full path to setup.exe in the Exchange 2013 setup directory" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Arguments - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_arguments) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Arguments - Command line arguments to pass to setup.exe" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential - The credentials to use to perform the installation" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchinstall).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchjetstress.rb b/lib/puppet/type/dsc_xexchjetstress.rb deleted file mode 100644 index 6026fdb2..00000000 --- a/lib/puppet/type/dsc_xexchjetstress.rb +++ /dev/null @@ -1,154 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchjetstress) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchJetstress resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchJetstress/MSFT_xExchJetstress.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_type is a required attribute') if self[:dsc_type].nil? - end - - def dscmeta_resource_friendly_name; 'xExchJetstress' end - def dscmeta_resource_name; 'MSFT_xExchJetstress' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Type - # Type: string - # IsMandatory: True - # Values: ["Performance", "Stress", "DatabaseBackup", "SoftRecovery"] - newparam(:dsc_type) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Type - Specifies the Type which was defined in the JetstressConfig.xml file. Valid values are Performance, Stress, DatabaseBackup, or SoftRecovery. Defaults to Performance. Valid values are Performance, Stress, DatabaseBackup, SoftRecovery." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Performance', 'performance', 'Stress', 'stress', 'DatabaseBackup', 'databasebackup', 'SoftRecovery', 'softrecovery'].include?(value) - fail("Invalid value '#{value}'. Valid values are Performance, Stress, DatabaseBackup, SoftRecovery") - end - end - end - - # Name: JetstressPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_jetstresspath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "JetstressPath - The path to the folder where Jetstress is installed, and which contains JetstressCmd.exe" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: JetstressParams - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_jetstressparams) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "JetstressParams - Command line parameters to pass into JetstressCmd.exe" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MaxWaitMinutes - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_maxwaitminutes) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "MaxWaitMinutes - The maximum amount of time that the Scheduled Task which runs Jetstress can execute for. Defaults to 0, which means there is no time limit." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MinAchievedIOPS - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_minachievediops) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "MinAchievedIOPS - The minimum value reported in the Achieved Transactional I/O per Second section of the Jetstress report for the run to be considered successful. Defaults to 0." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchjetstress).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchjetstresscleanup.rb b/lib/puppet/type/dsc_xexchjetstresscleanup.rb deleted file mode 100644 index 1071bf67..00000000 --- a/lib/puppet/type/dsc_xexchjetstresscleanup.rb +++ /dev/null @@ -1,183 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchjetstresscleanup) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchJetstressCleanup resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchJetstressCleanup/MSFT_xExchJetstressCleanup.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_jetstresspath is a required attribute') if self[:dsc_jetstresspath].nil? - end - - def dscmeta_resource_friendly_name; 'xExchJetstressCleanup' end - def dscmeta_resource_name; 'MSFT_xExchJetstressCleanup' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: JetstressPath - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_jetstresspath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "JetstressPath - The path to the folder where Jetstress is installed, and which contains JetstressCmd.exe" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ConfigFilePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_configfilepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ConfigFilePath - Either ConfigFilePath, or DatabasePaths AND LogPaths MUST be specified. ConfigFilePath takes precedence. This is the full path to the JetstressConfig.xml file. If ConfigFilePath is specified, the config file will be used to determine the database and log folders that need to be removed" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabasePaths - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_databasepaths, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "DatabasePaths - Either ConfigFilePath, or DatabasePaths AND LogPaths MUST be specified. DatabasePaths specifies the paths to database directories that should be cleaned up." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: DeleteAssociatedMountPoints - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_deleteassociatedmountpoints) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DeleteAssociatedMountPoints - Defaults to $false. If specified, indicates that mount points associated with the Jetstress database and log paths should be removed" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: LogPaths - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_logpaths, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "LogPaths - Either ConfigFilePath, or DatabasePaths AND LogPaths MUST be specified. LogPaths specifies the paths to log directories that should be cleaned up." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: OutputSaveLocation - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_outputsavelocation) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "OutputSaveLocation - If RemoveBinaries is set to $true and Jetstress output was saved to the default location (the installation path of Jetstress), specifies the folder path to copy the Jetstress output files to." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RemoveBinaries - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_removebinaries) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RemoveBinaries - Specifies that the files in the Jetstress installation directory should be removed" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchjetstresscleanup).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchmailboxdatabase.rb b/lib/puppet/type/dsc_xexchmailboxdatabase.rb deleted file mode 100644 index 8a5bc731..00000000 --- a/lib/puppet/type/dsc_xexchmailboxdatabase.rb +++ /dev/null @@ -1,552 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchmailboxdatabase) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchMailboxDatabase resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchMailboxDatabase/MSFT_xExchMailboxDatabase.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xExchMailboxDatabase' end - def dscmeta_resource_name; 'MSFT_xExchMailboxDatabase' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: DatabaseCopyCount - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_databasecopycount) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "DatabaseCopyCount" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: Server - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_server) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Server" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: EdbFilePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_edbfilepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "EdbFilePath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: LogFolderPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_logfolderpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogFolderPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AdServerSettingsPreferredServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_adserversettingspreferredserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AdServerSettingsPreferredServer" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SkipInitialDatabaseMount - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_skipinitialdatabasemount) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "SkipInitialDatabaseMount" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AllowServiceRestart - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowservicerestart) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowServiceRestart" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AutoDagExcludeFromMonitoring - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_autodagexcludefrommonitoring) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AutoDagExcludeFromMonitoring" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: BackgroundDatabaseMaintenance - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_backgrounddatabasemaintenance) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "BackgroundDatabaseMaintenance" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: CalendarLoggingQuota - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_calendarloggingquota) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CalendarLoggingQuota" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CircularLoggingEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_circularloggingenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "CircularLoggingEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DataMoveReplicationConstraint - # Type: string - # IsMandatory: False - # Values: ["None", "SecondCopy", "SecondDatacenter", "AllDatacenters", "AllCopies"] - newparam(:dsc_datamovereplicationconstraint) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DataMoveReplicationConstraint - Valid values are None, SecondCopy, SecondDatacenter, AllDatacenters, AllCopies." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['None', 'none', 'SecondCopy', 'secondcopy', 'SecondDatacenter', 'seconddatacenter', 'AllDatacenters', 'alldatacenters', 'AllCopies', 'allcopies'].include?(value) - fail("Invalid value '#{value}'. Valid values are None, SecondCopy, SecondDatacenter, AllDatacenters, AllCopies") - end - end - end - - # Name: DeletedItemRetention - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_deleteditemretention) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DeletedItemRetention" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DomainController - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domaincontroller) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainController" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: EventHistoryRetentionPeriod - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_eventhistoryretentionperiod) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "EventHistoryRetentionPeriod" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: IndexEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_indexenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "IndexEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: IsExcludedFromProvisioning - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_isexcludedfromprovisioning) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "IsExcludedFromProvisioning" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: IsExcludedFromProvisioningReason - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_isexcludedfromprovisioningreason) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IsExcludedFromProvisioningReason" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: IssueWarningQuota - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_issuewarningquota) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IssueWarningQuota" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: IsSuspendedFromProvisioning - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_issuspendedfromprovisioning) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "IsSuspendedFromProvisioning" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: JournalRecipient - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_journalrecipient) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "JournalRecipient" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MailboxRetention - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_mailboxretention) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MailboxRetention" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MountAtStartup - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_mountatstartup) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "MountAtStartup" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: OfflineAddressBook - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_offlineaddressbook) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "OfflineAddressBook" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ProhibitSendQuota - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_prohibitsendquota) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProhibitSendQuota" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ProhibitSendReceiveQuota - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_prohibitsendreceivequota) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProhibitSendReceiveQuota" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RecoverableItemsQuota - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_recoverableitemsquota) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RecoverableItemsQuota" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RecoverableItemsWarningQuota - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_recoverableitemswarningquota) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RecoverableItemsWarningQuota" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RetainDeletedItemsUntilBackup - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_retaindeleteditemsuntilbackup) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RetainDeletedItemsUntilBackup" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchmailboxdatabase).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchmailboxdatabasecopy.rb b/lib/puppet/type/dsc_xexchmailboxdatabasecopy.rb deleted file mode 100644 index 521e839b..00000000 --- a/lib/puppet/type/dsc_xexchmailboxdatabasecopy.rb +++ /dev/null @@ -1,226 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchmailboxdatabasecopy) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchMailboxDatabaseCopy resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchMailboxDatabaseCopy/MSFT_xExchMailboxDatabaseCopy.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_identity is a required attribute') if self[:dsc_identity].nil? - end - - def dscmeta_resource_friendly_name; 'xExchMailboxDatabaseCopy' end - def dscmeta_resource_name; 'MSFT_xExchMailboxDatabaseCopy' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Identity - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_identity) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Identity" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: MailboxServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_mailboxserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MailboxServer" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AdServerSettingsPreferredServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_adserversettingspreferredserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AdServerSettingsPreferredServer" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AllowServiceRestart - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowservicerestart) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowServiceRestart" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ActivationPreference - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_activationpreference) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "ActivationPreference" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: DomainController - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domaincontroller) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainController" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ReplayLagTime - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_replaylagtime) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ReplayLagTime" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SeedingPostponed - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_seedingpostponed) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "SeedingPostponed" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: TruncationLagTime - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_truncationlagtime) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TruncationLagTime" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchmailboxdatabasecopy).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchmailboxserver.rb b/lib/puppet/type/dsc_xexchmailboxserver.rb deleted file mode 100644 index dc29d484..00000000 --- a/lib/puppet/type/dsc_xexchmailboxserver.rb +++ /dev/null @@ -1,853 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchmailboxserver) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchMailboxServer resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchMailboxServer/MSFT_xExchMailboxServer.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_identity is a required attribute') if self[:dsc_identity].nil? - end - - def dscmeta_resource_friendly_name; 'xExchMailboxServer' end - def dscmeta_resource_name; 'MSFT_xExchMailboxServer' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Identity - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_identity) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Identity - The Identity parameter specifies the Mailbox server that you want to modify." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential - Credentials used to establish a remote Powershell session to Exchange" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: AutoDatabaseMountDial - # Type: string - # IsMandatory: False - # Values: ["BestAvailability", "GoodAvailability", "Lossless"] - newparam(:dsc_autodatabasemountdial) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AutoDatabaseMountDial - The AutoDatabaseMountDial parameter specifies the automatic database mount behavior for a continuous replication environment after a database failover. Valid values are BestAvailability, GoodAvailability, Lossless." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['BestAvailability', 'bestavailability', 'GoodAvailability', 'goodavailability', 'Lossless', 'lossless'].include?(value) - fail("Invalid value '#{value}'. Valid values are BestAvailability, GoodAvailability, Lossless") - end - end - end - - # Name: CalendarRepairIntervalEndWindow - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_calendarrepairintervalendwindow) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "CalendarRepairIntervalEndWindow - The CalendarRepairIntervalEndWindow parameter specifies the number of days into the future to repair calendars. For example, if this parameter is set to 90, the Calendar Repair Assistant repairs calendars on this Mailbox server 90 days from now." - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: CalendarRepairLogDirectorySizeLimit - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_calendarrepairlogdirectorysizelimit) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CalendarRepairLogDirectorySizeLimit - The CalendarRepairLogDirectorySizeLimit parameter specifies the size limit for all log files for the Calendar Repair Assistant. After the limit is reached, the oldest files are deleted." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CalendarRepairLogEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_calendarrepairlogenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "CalendarRepairLogEnabled - The CalendarRepairLogEnabled parameter specifies whether the Calendar Repair Attendant logs items that it repairs. The repair log doesn't contain failed repair attempts." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: CalendarRepairLogFileAgeLimit - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_calendarrepairlogfileagelimit) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CalendarRepairLogFileAgeLimit - The CalendarRepairLogFileAgeLimit parameter specifies how long to retain calendar repair logs. Log files that exceed the maximum retention period are deleted." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CalendarRepairLogPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_calendarrepairlogpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CalendarRepairLogPath - The CalendarRepairLogPath parameter specifies the location of the calendar repair log files on the Mailbox server." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CalendarRepairLogSubjectLoggingEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_calendarrepairlogsubjectloggingenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "CalendarRepairLogSubjectLoggingEnabled - The CalendarRepairLogSubjectLoggingEnabled parameter specifies that the subject of the repaired calendar item is logged in the calendar repair log." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: CalendarRepairMissingItemFixDisabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_calendarrepairmissingitemfixdisabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "CalendarRepairMissingItemFixDisabled - The CalendarRepairMissingItemFixDisabled parameter specifies that the Calendar Repair Assistant won't fix missing attendee calendar items for mailboxes homed on this Mailbox server." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: CalendarRepairMode - # Type: string - # IsMandatory: False - # Values: ["ValidateOnly", "RepairAndValidate"] - newparam(:dsc_calendarrepairmode) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CalendarRepairMode - The CalendarRepairMode parameter specifies the mode that the Calendar Repair Assistant will run in. Valid values are ValidateOnly, RepairAndValidate." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['ValidateOnly', 'validateonly', 'RepairAndValidate', 'repairandvalidate'].include?(value) - fail("Invalid value '#{value}'. Valid values are ValidateOnly, RepairAndValidate") - end - end - end - - # Name: CalendarRepairWorkCycle - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_calendarrepairworkcycle) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CalendarRepairWorkCycle - The CalendarRepairWorkCycle parameter specifies the time span in which all mailboxes on the specified server will be scanned by the Calendar Repair Assistant. Calendars that have inconsistencies will be flagged and repaired according to the interval specified by the CalendarRepairWorkCycleCheckpoint parameter." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CalendarRepairWorkCycleCheckpoint - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_calendarrepairworkcyclecheckpoint) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CalendarRepairWorkCycleCheckpoint - The CalendarRepairWorkCycleCheckpoint parameter specifies the time span at which all mailboxes will be identified as needing work completed on them." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DomainController - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domaincontroller) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainController - The DomainController parameter specifies the fully qualified domain name (FQDN) of the domain controller that writes this configuration change to Active Directory." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseCopyActivationDisabledAndMoveNow - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_databasecopyactivationdisabledandmovenow) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DatabaseCopyActivationDisabledAndMoveNow - The DatabaseCopyActivationDisabledAndMoveNow parameter specifies whether to prevent databases from being mounted on this Mailbox server if there are other healthy copies of the databases on other Mailbox servers. It will also immediately move any mounted databases on the server to other servers if copies exist and are healthy." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DatabaseCopyAutoActivationPolicy - # Type: string - # IsMandatory: False - # Values: ["Blocked", "IntrasiteOnly", "Unrestricted"] - newparam(:dsc_databasecopyautoactivationpolicy) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseCopyAutoActivationPolicy - The DatabaseCopyAutoActivationPolicy parameter specifies the type of automatic activation available for mailbox database copies on the specified Mailbox server. Valid values are Blocked, IntrasiteOnly, and Unrestricted. Valid values are Blocked, IntrasiteOnly, Unrestricted." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Blocked', 'blocked', 'IntrasiteOnly', 'intrasiteonly', 'Unrestricted', 'unrestricted'].include?(value) - fail("Invalid value '#{value}'. Valid values are Blocked, IntrasiteOnly, Unrestricted") - end - end - end - - # Name: FolderLogForManagedFoldersEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_folderlogformanagedfoldersenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "FolderLogForManagedFoldersEnabled - The FolderLogForManagedFoldersEnabled parameter specifies whether the folder log for managed folders is enabled for messages that were moved to managed folders." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ForceGroupMetricsGeneration - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_forcegroupmetricsgeneration) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ForceGroupMetricsGeneration - The ForceGroupMetricsGeneration parameter specifies that group metrics information must be generated on the Mailbox server regardless of whether that server generates an offline address book (OAB). By default, group metrics are generated only on servers that generate OABs. Group metrics information is used by MailTips to inform senders about how many recipients their messages will be sent to. You need to use this parameter if your organization doesn't generate OABs and you want the group metrics data to be available." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: IsExcludedFromProvisioning - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_isexcludedfromprovisioning) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "IsExcludedFromProvisioning - The IsExcludedFromProvisioning parameter specifies that the Mailbox server isn't considered by the OAB provisioning load balancer. If the IsExcludedFromProvisioning parameter is set to $true, the server won't be used for provisioning a new OAB or for moving existing OABs." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: JournalingLogForManagedFoldersEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_journalinglogformanagedfoldersenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "JournalingLogForManagedFoldersEnabled - The JournalingLogForManagedFoldersEnabled parameter specifies whether the log for managed folders is enabled for journaling. The two possible values for this parameter are $true or $false. If you specify $true, information about messages that were journaled is logged. The logs are located at the location you specify with the LogPathForManagedFolders parameter." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Locale - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_locale, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Locale - The Locale parameter specifies the locale. A locale is a collection of language-related user preferences such as writing system, calendar, and date format." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: LogDirectorySizeLimitForManagedFolders - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_logdirectorysizelimitformanagedfolders) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogDirectorySizeLimitForManagedFolders - The LogDirectorySizeLimitForManagedFolders parameter specifies the size limit for all managed folder log files from a single message database. After the limit is reached for a set of managed folder log files from a message database, the oldest files are deleted to make space for new files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: LogFileAgeLimitForManagedFolders - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_logfileagelimitformanagedfolders) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogFileAgeLimitForManagedFolders - The LogFileAgeLimitForManagedFolders parameter specifies how long to retain managed folder logs. Log files that exceed the maximum retention period are deleted." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: LogFileSizeLimitForManagedFolders - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_logfilesizelimitformanagedfolders) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogFileSizeLimitForManagedFolders - The LogFileSizeLimitForManagedFolders parameter specifies the maximum size for each managed folder log file. When the log file size limit is reached, a new log file is created." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: LogPathForManagedFolders - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_logpathformanagedfolders) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogPathForManagedFolders - The LogPathForManagedFolders parameter specifies the path to the directory that stores the managed folder log files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MailboxProcessorWorkCycle - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_mailboxprocessorworkcycle) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MailboxProcessorWorkCycle - The MailboxProcessorWorkCycle parameter specifies how often to scan for locked mailboxes." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ManagedFolderAssistantSchedule - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_managedfolderassistantschedule, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ManagedFolderAssistantSchedule - The ManagedFolderAssistantSchedule parameter specifies the intervals each week during which the Managed Folder Assistant applies messaging records management (MRM) settings to managed folders. The format is StartDay.Time-EndDay." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: ManagedFolderWorkCycle - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_managedfolderworkcycle) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ManagedFolderWorkCycle - The ManagedFolderWorkCycle parameter specifies the time span in which all mailboxes on the specified server will be processed by the Managed Folder Assistant. The Managed Folder Assistant applies retention policies according to the ManagedFolderWorkCycleCheckpoint interval." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ManagedFolderWorkCycleCheckpoint - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_managedfolderworkcyclecheckpoint) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ManagedFolderWorkCycleCheckpoint - The ManagedFolderWorkCycleCheckpoint parameter specifies the time span at which to refresh the list of mailboxes so that new mailboxes that have been created or moved will be part of the work queue. Also, as mailboxes are prioritized, existing mailboxes that haven't been successfully processed for a long time will be placed higher in the queue and will have a greater chance of being processed again in the same work cycle." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MAPIEncryptionRequired - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_mapiencryptionrequired) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "MAPIEncryptionRequired - The MAPIEncryptionRequired parameter specifies whether Exchange blocks MAPI clients that don't use encrypted remote procedure calls (RPCs)." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: MaximumActiveDatabases - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_maximumactivedatabases) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MaximumActiveDatabases - The MaximumActiveDatabases parameter specifies the number of databases that can be mounted on this Mailbox server. This parameter accepts numeric values." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MaximumPreferredActiveDatabases - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_maximumpreferredactivedatabases) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MaximumPreferredActiveDatabases - The MaximumPreferredActiveDatabases parameter specifies a preferred maximum number of databases that a server should have. This value is different from the actual maximum, which is configured using the MaximumActiveDatabases parameter. The value of MaximumPreferredActiveDatabases is only honored during best copy and server selection, database and server switchovers, and when rebalancing the DAG." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: OABGeneratorWorkCycle - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_oabgeneratorworkcycle) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "OABGeneratorWorkCycle - The OABGeneratorWorkCycle parameter specifies the time span in which the OAB generation on the specified server will be processed." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: OABGeneratorWorkCycleCheckpoint - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_oabgeneratorworkcyclecheckpoint) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "OABGeneratorWorkCycleCheckpoint - The OABGeneratorWorkCycleCheckpoint parameter specifies the time span at which to run OAB generation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: PublicFolderWorkCycle - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_publicfolderworkcycle) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "PublicFolderWorkCycle - The PublicFolderWorkCycle parameter is used by the public folder assistant to determine how often the mailboxes in a database are processed by the assistant." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: PublicFolderWorkCycleCheckpoint - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_publicfolderworkcyclecheckpoint) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "PublicFolderWorkCycleCheckpoint - The PublicFolderWorkCycleCheckpoint determines how often the mailbox list for a database is evaluated. The processing speed is also calculated." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RetentionLogForManagedFoldersEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_retentionlogformanagedfoldersenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RetentionLogForManagedFoldersEnabled - The RetentionLogForManagedFoldersEnabled parameter specifies whether the Managed Folder Assistant logs information about messages that have reached their retention limits." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: SharingPolicySchedule - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_sharingpolicyschedule, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "SharingPolicySchedule - The SharingPolicySchedule parameter specifies the intervals each week during which the sharing policy runs. The Sharing Policy Assistant checks permissions on shared calendar items and contact folders in users' mailboxes against the assigned sharing policy. The assistant lowers or removes permissions according to the policy. The format is StartDay.Time-EndDay.Time." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: SharingPolicyWorkCycle - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sharingpolicyworkcycle) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SharingPolicyWorkCycle - The SharingPolicyWorkCycle parameter specifies the time span in which all mailboxes on the specified server will be scanned by the Sharing Policy Assistant. The Sharing Policy Assistant scans all mailboxes and enables or disables sharing polices according to the interval specified by the SharingPolicyWorkCycle." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SharingPolicyWorkCycleCheckpoint - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sharingpolicyworkcyclecheckpoint) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SharingPolicyWorkCycleCheckpoint - The SharingPolicyWorkCycleCheckpoint parameter specifies the time span at which to refresh the list of mailboxes so that new mailboxes that have been created or moved will be part of the work queue. Also, as mailboxes are prioritized, existing mailboxes that haven't been successfully processed for a long time will be placed higher in the queue and will have a greater chance of being processed again in the same work cycle." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SharingSyncWorkCycle - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sharingsyncworkcycle) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SharingSyncWorkCycle - The SharingSyncWorkCycle parameter specifies the time span in which all mailboxes on the specified server will be synced to the cloud-based service by the Sharing Sync Assistant. Mailboxes that require syncing will be synced according to the interval specified by the SharingSyncWorkCycleCheckpoint parameter." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SharingSyncWorkCycleCheckpoint - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sharingsyncworkcyclecheckpoint) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SharingSyncWorkCycleCheckpoint - The SharingSyncWorkCycleCheckpoint parameter specifies the time span at which to refresh the list of mailboxes so that new mailboxes that have been created or moved will be part of the work queue. Also, as mailboxes are prioritized, existing mailboxes that haven't been successfully processed for a long time will be placed higher in the queue and will have a greater chance of being processed again in the same work cycle." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SiteMailboxWorkCycle - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sitemailboxworkcycle) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SiteMailboxWorkCycle - The SiteMailboxWorkCycle parameter specifies the time span in which the site mailbox information on the specified server will be processed." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SiteMailboxWorkCycleCheckpoint - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sitemailboxworkcyclecheckpoint) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SiteMailboxWorkCycleCheckpoint - The SiteMailboxWorkCycleCheckpoint parameter specifies the time span at which to refresh the site mailbox workcycle." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SubjectLogForManagedFoldersEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_subjectlogformanagedfoldersenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "SubjectLogForManagedFoldersEnabled - The SubjectLogForManagedFoldersEnabled parameter specifies whether the subject of messages is displayed in managed folder logs." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: TopNWorkCycle - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_topnworkcycle) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TopNWorkCycle - The TopNWorkCycle parameter specifies the time span in which all mailboxes that have Unified Messaging on the specified server will be scanned by the TopN Words Assistant. The TopN Words Assistant scans voice mail for the most frequently used words to aid in transcription." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: TopNWorkCycleCheckpoint - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_topnworkcyclecheckpoint) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TopNWorkCycleCheckpoint - The TopNWorkCycleCheckpoint parameter specifies the time span at which to refresh the list of mailboxes so that new mailboxes that have been created or moved will be part of the work queue. Also, as mailboxes are prioritized, existing mailboxes that haven't been successfully processed for a long time will be placed higher in the queue and will have a greater chance of being processed again in the same work cycle." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UMReportingWorkCycle - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_umreportingworkcycle) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UMReportingWorkCycle - The UMReportingWorkCycle parameter specifies the time span in which the arbitration mailbox named SystemMailbox{e0dc1c29-89c3-4034-b678-e6c29d823ed9} on the specified server will be scanned by the Unified Messaging Reporting Assistant. The Unified Messaging Reporting Assistant updates the Call Statistics reports by reading Unified Messaging call data records for an organization on a regular basis." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UMReportingWorkCycleCheckpoint - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_umreportingworkcyclecheckpoint) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UMReportingWorkCycleCheckpoint - The UMReportingWorkCycleCheckpoint parameter specifies the time span at which the arbitration mailbox named SystemMailbox{e0dc1c29-89c3-4034-b678-e6c29d823ed9} will be marked by processing." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: WacDiscoveryEndpoint - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_wacdiscoveryendpoint) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WacDiscoveryEndpoint - The WacDiscoveryEndpoint parameter specifies the Office Online Server endpoint to use. Exchange 2016 only." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchmailboxserver).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchmailboxtransportservice.rb b/lib/puppet/type/dsc_xexchmailboxtransportservice.rb deleted file mode 100644 index 3839d80d..00000000 --- a/lib/puppet/type/dsc_xexchmailboxtransportservice.rb +++ /dev/null @@ -1,456 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchmailboxtransportservice) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchMailboxTransportService resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchMailboxTransportService/MSFT_xExchMailboxTransportService.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_identity is a required attribute') if self[:dsc_identity].nil? - end - - def dscmeta_resource_friendly_name; 'xExchMailboxTransportService' end - def dscmeta_resource_name; 'MSFT_xExchMailboxTransportService' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Identity - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_identity) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Identity" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: AllowServiceRestart - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowservicerestart) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowServiceRestart" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ConnectivityLogEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_connectivitylogenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ConnectivityLogEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ConnectivityLogMaxAge - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_connectivitylogmaxage) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ConnectivityLogMaxAge" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ConnectivityLogMaxDirectorySize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_connectivitylogmaxdirectorysize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ConnectivityLogMaxDirectorySize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ConnectivityLogMaxFileSize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_connectivitylogmaxfilesize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ConnectivityLogMaxFileSize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ConnectivityLogPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_connectivitylogpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ConnectivityLogPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ContentConversionTracingEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_contentconversiontracingenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ContentConversionTracingEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: MaxConcurrentMailboxDeliveries - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_maxconcurrentmailboxdeliveries) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "MaxConcurrentMailboxDeliveries" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MaxConcurrentMailboxSubmissions - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_maxconcurrentmailboxsubmissions) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "MaxConcurrentMailboxSubmissions" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: PipelineTracingEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_pipelinetracingenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "PipelineTracingEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: PipelineTracingPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_pipelinetracingpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "PipelineTracingPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: PipelineTracingSenderAddress - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_pipelinetracingsenderaddress) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "PipelineTracingSenderAddress" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ReceiveProtocolLogMaxAge - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_receiveprotocollogmaxage) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ReceiveProtocolLogMaxAge" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ReceiveProtocolLogMaxDirectorySize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_receiveprotocollogmaxdirectorysize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ReceiveProtocolLogMaxDirectorySize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ReceiveProtocolLogMaxFileSize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_receiveprotocollogmaxfilesize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ReceiveProtocolLogMaxFileSize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ReceiveProtocolLogPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_receiveprotocollogpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ReceiveProtocolLogPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RoutingTableLogMaxAge - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_routingtablelogmaxage) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RoutingTableLogMaxAge" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RoutingTableLogMaxDirectorySize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_routingtablelogmaxdirectorysize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RoutingTableLogMaxDirectorySize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RoutingTableLogPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_routingtablelogpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RoutingTableLogPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SendProtocolLogMaxAge - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sendprotocollogmaxage) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SendProtocolLogMaxAge" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SendProtocolLogMaxDirectorySize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sendprotocollogmaxdirectorysize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SendProtocolLogMaxDirectorySize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SendProtocolLogMaxFileSize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sendprotocollogmaxfilesize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SendProtocolLogMaxFileSize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SendProtocolLogPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sendprotocollogpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SendProtocolLogPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchmailboxtransportservice).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchmaintenancemode.rb b/lib/puppet/type/dsc_xexchmaintenancemode.rb deleted file mode 100644 index de48afef..00000000 --- a/lib/puppet/type/dsc_xexchmaintenancemode.rb +++ /dev/null @@ -1,182 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchmaintenancemode) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchMaintenanceMode resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchMaintenanceMode/MSFT_xExchMaintenanceMode.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_enabled is a required attribute') if self[:dsc_enabled].nil? - end - - def dscmeta_resource_friendly_name; 'xExchMaintenanceMode' end - def dscmeta_resource_name; 'MSFT_xExchMaintenanceMode' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Enabled - # Type: boolean - # IsMandatory: True - # Values: None - newparam(:dsc_enabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Enabled - Whether the server should be put into Maintenance Mode. When Enabled is set to True, the server will be put in Maintenance Mode. If False, the server will be taken out of Maintenance Mode." - isrequired - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential - Credentials used to establish a remote Powershell session to Exchange" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: AdditionalComponentsToActivate - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_additionalcomponentstoactivate, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "AdditionalComponentsToActivate - When taking a server out of Maintenance Mode, the following components will be set to Active by default: ServerWideOffline, UMCallRouter, HighAvailability, Monitoring, RecoveryActionsEnabled. This parameter specifies an additional list of components to set to Active." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: DomainController - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domaincontroller) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainController - The DomainController parameter specifies the fully qualified domain name (FQDN) of the domain controller that writes this configuration change to Active Directory." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MovePreferredDatabasesBack - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_movepreferreddatabasesback) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "MovePreferredDatabasesBack - Whether to move back databases with an Activation Preference of one for this server after taking the server out of Maintenance Mode. Defaults to False." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: SetInactiveComponentsFromAnyRequesterToActive - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_setinactivecomponentsfromanyrequestertoactive) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "SetInactiveComponentsFromAnyRequesterToActive - Whether components that were set to Inactive by outside Requesters should also be set to Active when exiting Maintenance Mode. Defaults to False." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: UpgradedServerVersion - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_upgradedserverversion) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UpgradedServerVersion - Optional string to specify what the server version will be after applying a Cumulative Update. If the server is already at this version, requests to put the server in Maintenance Mode will be ignored. Version should be in the format ##.#.####.#, as in 15.0.1104.5." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchmaintenancemode).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchmapivirtualdirectory.rb b/lib/puppet/type/dsc_xexchmapivirtualdirectory.rb deleted file mode 100644 index 1fe7214b..00000000 --- a/lib/puppet/type/dsc_xexchmapivirtualdirectory.rb +++ /dev/null @@ -1,180 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchmapivirtualdirectory) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchMapiVirtualDirectory resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchMapiVirtualDirectory/MSFT_xExchMapiVirtualDirectory.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_identity is a required attribute') if self[:dsc_identity].nil? - end - - def dscmeta_resource_friendly_name; 'xExchMapiVirtualDirectory' end - def dscmeta_resource_name; 'MSFT_xExchMapiVirtualDirectory' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Identity - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_identity) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Identity" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: AllowServiceRestart - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowservicerestart) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowServiceRestart" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DomainController - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domaincontroller) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainController" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ExternalUrl - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_externalurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ExternalUrl" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: IISAuthenticationMethods - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_iisauthenticationmethods, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "IISAuthenticationMethods" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: InternalUrl - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_internalurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InternalUrl" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchmapivirtualdirectory).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchoabvirtualdirectory.rb b/lib/puppet/type/dsc_xexchoabvirtualdirectory.rb deleted file mode 100644 index 56dd47ea..00000000 --- a/lib/puppet/type/dsc_xexchoabvirtualdirectory.rb +++ /dev/null @@ -1,300 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchoabvirtualdirectory) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchOabVirtualDirectory resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchOabVirtualDirectory/MSFT_xExchOabVirtualDirectory.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_identity is a required attribute') if self[:dsc_identity].nil? - end - - def dscmeta_resource_friendly_name; 'xExchOabVirtualDirectory' end - def dscmeta_resource_name; 'MSFT_xExchOabVirtualDirectory' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Identity - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_identity) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Identity" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: OABsToDistribute - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_oabstodistribute, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "OABsToDistribute" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: AllowServiceRestart - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowservicerestart) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowServiceRestart" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: BasicAuthentication - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_basicauthentication) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "BasicAuthentication" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DomainController - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domaincontroller) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainController" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ExtendedProtectionFlags - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_extendedprotectionflags, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ExtendedProtectionFlags" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: ExtendedProtectionSPNList - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_extendedprotectionspnlist, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ExtendedProtectionSPNList" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: ExtendedProtectionTokenChecking - # Type: string - # IsMandatory: False - # Values: ["None", "Allow", "Require"] - newparam(:dsc_extendedprotectiontokenchecking) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ExtendedProtectionTokenChecking - Valid values are None, Allow, Require." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['None', 'none', 'Allow', 'allow', 'Require', 'require'].include?(value) - fail("Invalid value '#{value}'. Valid values are None, Allow, Require") - end - end - end - - # Name: ExternalUrl - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_externalurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ExternalUrl" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InternalUrl - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_internalurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InternalUrl" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: PollInterval - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_pollinterval) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "PollInterval" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: RequireSSL - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_requiressl) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RequireSSL" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: WindowsAuthentication - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_windowsauthentication) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "WindowsAuthentication" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchoabvirtualdirectory).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchoutlookanywhere.rb b/lib/puppet/type/dsc_xexchoutlookanywhere.rb deleted file mode 100644 index 988b32e0..00000000 --- a/lib/puppet/type/dsc_xexchoutlookanywhere.rb +++ /dev/null @@ -1,318 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchoutlookanywhere) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchOutlookAnywhere resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchOutlookAnywhere/MSFT_xExchOutlookAnywhere.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_identity is a required attribute') if self[:dsc_identity].nil? - end - - def dscmeta_resource_friendly_name; 'xExchOutlookAnywhere' end - def dscmeta_resource_name; 'MSFT_xExchOutlookAnywhere' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Identity - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_identity) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Identity" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: AllowServiceRestart - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowservicerestart) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowServiceRestart" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DomainController - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domaincontroller) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainController" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ExternalClientsRequireSsl - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_externalclientsrequiressl) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ExternalClientsRequireSsl" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ExtendedProtectionFlags - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_extendedprotectionflags, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ExtendedProtectionFlags" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: ExtendedProtectionSPNList - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_extendedprotectionspnlist, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ExtendedProtectionSPNList" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: ExtendedProtectionTokenChecking - # Type: string - # IsMandatory: False - # Values: ["Allow", "None", "Require"] - newparam(:dsc_extendedprotectiontokenchecking) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ExtendedProtectionTokenChecking - Valid values are Allow, None, Require." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Allow', 'allow', 'None', 'none', 'Require', 'require'].include?(value) - fail("Invalid value '#{value}'. Valid values are Allow, None, Require") - end - end - end - - # Name: ExternalClientAuthenticationMethod - # Type: string - # IsMandatory: False - # Values: ["Ntlm", "Basic", "Negotiate"] - newparam(:dsc_externalclientauthenticationmethod) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ExternalClientAuthenticationMethod - Valid values are Ntlm, Basic, Negotiate." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Ntlm', 'ntlm', 'Basic', 'basic', 'Negotiate', 'negotiate'].include?(value) - fail("Invalid value '#{value}'. Valid values are Ntlm, Basic, Negotiate") - end - end - end - - # Name: ExternalHostname - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_externalhostname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ExternalHostname" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: IISAuthenticationMethods - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_iisauthenticationmethods, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "IISAuthenticationMethods" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: InternalClientAuthenticationMethod - # Type: string - # IsMandatory: False - # Values: ["Ntlm", "Basic", "Negotiate"] - newparam(:dsc_internalclientauthenticationmethod) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InternalClientAuthenticationMethod - Valid values are Ntlm, Basic, Negotiate." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Ntlm', 'ntlm', 'Basic', 'basic', 'Negotiate', 'negotiate'].include?(value) - fail("Invalid value '#{value}'. Valid values are Ntlm, Basic, Negotiate") - end - end - end - - # Name: InternalClientsRequireSsl - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_internalclientsrequiressl) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "InternalClientsRequireSsl" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: InternalHostname - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_internalhostname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InternalHostname" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SSLOffloading - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_ssloffloading) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "SSLOffloading" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchoutlookanywhere).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchowavirtualdirectory.rb b/lib/puppet/type/dsc_xexchowavirtualdirectory.rb deleted file mode 100644 index 5338e36a..00000000 --- a/lib/puppet/type/dsc_xexchowavirtualdirectory.rb +++ /dev/null @@ -1,405 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchowavirtualdirectory) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchOwaVirtualDirectory resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchOwaVirtualDirectory/MSFT_xExchOwaVirtualDirectory.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_identity is a required attribute') if self[:dsc_identity].nil? - end - - def dscmeta_resource_friendly_name; 'xExchOwaVirtualDirectory' end - def dscmeta_resource_name; 'MSFT_xExchOwaVirtualDirectory' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Identity - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_identity) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Identity" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: AdfsAuthentication - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_adfsauthentication) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AdfsAuthentication" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AllowServiceRestart - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowservicerestart) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowServiceRestart" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: BasicAuthentication - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_basicauthentication) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "BasicAuthentication" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ChangePasswordEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_changepasswordenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ChangePasswordEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DigestAuthentication - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_digestauthentication) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DigestAuthentication" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DomainController - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domaincontroller) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainController" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ExternalAuthenticationMethods - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_externalauthenticationmethods, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ExternalAuthenticationMethods" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: ExternalUrl - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_externalurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ExternalUrl" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: FormsAuthentication - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_formsauthentication) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "FormsAuthentication" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: InternalUrl - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_internalurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InternalUrl" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstantMessagingEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_instantmessagingenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "InstantMessagingEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: InstantMessagingCertificateThumbprint - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_instantmessagingcertificatethumbprint) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstantMessagingCertificateThumbprint" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstantMessagingServerName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_instantmessagingservername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstantMessagingServerName" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstantMessagingType - # Type: string - # IsMandatory: False - # Values: ["None", "Ocs"] - newparam(:dsc_instantmessagingtype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstantMessagingType - Valid values are None, Ocs." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['None', 'none', 'Ocs', 'ocs'].include?(value) - fail("Invalid value '#{value}'. Valid values are None, Ocs") - end - end - end - - # Name: LogonPagePublicPrivateSelectionEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_logonpagepublicprivateselectionenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "LogonPagePublicPrivateSelectionEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: LogonPageLightSelectionEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_logonpagelightselectionenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "LogonPageLightSelectionEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: WindowsAuthentication - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_windowsauthentication) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "WindowsAuthentication" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: LogonFormat - # Type: string - # IsMandatory: False - # Values: ["FullDomain", "UserName", "PrincipalName"] - newparam(:dsc_logonformat) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogonFormat - Valid values are FullDomain, UserName, PrincipalName." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['FullDomain', 'fulldomain', 'UserName', 'username', 'PrincipalName', 'principalname'].include?(value) - fail("Invalid value '#{value}'. Valid values are FullDomain, UserName, PrincipalName") - end - end - end - - # Name: DefaultDomain - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_defaultdomain) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DefaultDomain" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchowavirtualdirectory).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchpopsettings.rb b/lib/puppet/type/dsc_xexchpopsettings.rb deleted file mode 100644 index 18cf2f77..00000000 --- a/lib/puppet/type/dsc_xexchpopsettings.rb +++ /dev/null @@ -1,183 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchpopsettings) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchPopSettings resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchPopSettings/MSFT_xExchPopSettings.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_server is a required attribute') if self[:dsc_server].nil? - end - - def dscmeta_resource_friendly_name; 'xExchPopSettings' end - def dscmeta_resource_name; 'MSFT_xExchPopSettings' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Server - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_server) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Server" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: AllowServiceRestart - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowservicerestart) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowServiceRestart" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DomainController - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domaincontroller) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainController" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: LoginType - # Type: string - # IsMandatory: False - # Values: ["PlainTextLogin", "PlainTextAuthentication", "SecureLogin"] - newparam(:dsc_logintype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LoginType - Valid values are PlainTextLogin, PlainTextAuthentication, SecureLogin." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['PlainTextLogin', 'plaintextlogin', 'PlainTextAuthentication', 'plaintextauthentication', 'SecureLogin', 'securelogin'].include?(value) - fail("Invalid value '#{value}'. Valid values are PlainTextLogin, PlainTextAuthentication, SecureLogin") - end - end - end - - # Name: ExternalConnectionSettings - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_externalconnectionsettings, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ExternalConnectionSettings" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: X509CertificateName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_x509certificatename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "X509CertificateName" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchpopsettings).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchpowershellvirtualdirectory.rb b/lib/puppet/type/dsc_xexchpowershellvirtualdirectory.rb deleted file mode 100644 index b09e240b..00000000 --- a/lib/puppet/type/dsc_xexchpowershellvirtualdirectory.rb +++ /dev/null @@ -1,226 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchpowershellvirtualdirectory) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchPowerShellVirtualDirectory resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchPowershellVirtualDirectory/MSFT_xExchPowerShellVirtualDirectory.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_identity is a required attribute') if self[:dsc_identity].nil? - end - - def dscmeta_resource_friendly_name; 'xExchPowerShellVirtualDirectory' end - def dscmeta_resource_name; 'MSFT_xExchPowerShellVirtualDirectory' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Identity - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_identity) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Identity" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: AllowServiceRestart - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowservicerestart) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowServiceRestart" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: BasicAuthentication - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_basicauthentication) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "BasicAuthentication" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: CertificateAuthentication - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_certificateauthentication) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "CertificateAuthentication" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DomainController - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domaincontroller) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainController" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ExternalUrl - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_externalurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ExternalUrl" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InternalUrl - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_internalurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InternalUrl" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RequireSSL - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_requiressl) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RequireSSL" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: WindowsAuthentication - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_windowsauthentication) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "WindowsAuthentication" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchpowershellvirtualdirectory).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchreceiveconnector.rb b/lib/puppet/type/dsc_xexchreceiveconnector.rb deleted file mode 100644 index b49251c4..00000000 --- a/lib/puppet/type/dsc_xexchreceiveconnector.rb +++ /dev/null @@ -1,950 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchreceiveconnector) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchReceiveConnector resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchReceiveConnector/MSFT_xExchReceiveConnector.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_identity is a required attribute') if self[:dsc_identity].nil? - end - - def dscmeta_resource_friendly_name; 'xExchReceiveConnector' end - def dscmeta_resource_name; 'MSFT_xExchReceiveConnector' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Identity - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_identity) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Identity" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: AdvertiseClientSettings - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_advertiseclientsettings) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AdvertiseClientSettings" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AuthMechanism - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_authmechanism, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "AuthMechanism" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: Banner - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_banner) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Banner" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: BareLinefeedRejectionEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_barelinefeedrejectionenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "BareLinefeedRejectionEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: BinaryMimeEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_binarymimeenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "BinaryMimeEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Bindings - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_bindings, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Bindings" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: ChunkingEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_chunkingenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ChunkingEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Comment - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_comment) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Comment" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ConnectionInactivityTimeout - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_connectioninactivitytimeout) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ConnectionInactivityTimeout" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ConnectionTimeout - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_connectiontimeout) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ConnectionTimeout" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DefaultDomain - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_defaultdomain) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DefaultDomain" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DeliveryStatusNotificationEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_deliverystatusnotificationenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DeliveryStatusNotificationEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DomainController - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domaincontroller) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainController" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DomainSecureEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_domainsecureenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DomainSecureEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: EightBitMimeEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_eightbitmimeenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "EightBitMimeEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: EnableAuthGSSAPI - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_enableauthgssapi) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "EnableAuthGSSAPI" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Enabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_enabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Enabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: EnhancedStatusCodesEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_enhancedstatuscodesenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "EnhancedStatusCodesEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ExtendedRightAllowEntries - # Type: MSFT_KeyValuePair[] - # IsMandatory: False - # Values: None - newparam(:dsc_extendedrightallowentries) do - def mof_type; 'MSFT_KeyValuePair[]' end - def mof_is_embedded?; true end - desc "ExtendedRightAllowEntries" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - end - end - - # Name: ExtendedRightDenyEntries - # Type: MSFT_KeyValuePair[] - # IsMandatory: False - # Values: None - newparam(:dsc_extendedrightdenyentries) do - def mof_type; 'MSFT_KeyValuePair[]' end - def mof_is_embedded?; true end - desc "ExtendedRightDenyEntries" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - end - end - - # Name: ExtendedProtectionPolicy - # Type: string - # IsMandatory: False - # Values: ["None", "Allow", "Require"] - newparam(:dsc_extendedprotectionpolicy) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ExtendedProtectionPolicy - Valid values are None, Allow, Require." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['None', 'none', 'Allow', 'allow', 'Require', 'require'].include?(value) - fail("Invalid value '#{value}'. Valid values are None, Allow, Require") - end - end - end - - # Name: Fqdn - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_fqdn) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Fqdn" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: LongAddressesEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_longaddressesenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "LongAddressesEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: MaxAcknowledgementDelay - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_maxacknowledgementdelay) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MaxAcknowledgementDelay" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MaxHeaderSize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_maxheadersize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MaxHeaderSize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MaxHopCount - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_maxhopcount) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "MaxHopCount" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MaxInboundConnection - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_maxinboundconnection) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MaxInboundConnection" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MaxInboundConnectionPercentagePerSource - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_maxinboundconnectionpercentagepersource) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "MaxInboundConnectionPercentagePerSource" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MaxInboundConnectionPerSource - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_maxinboundconnectionpersource) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MaxInboundConnectionPerSource" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MaxLocalHopCount - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_maxlocalhopcount) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "MaxLocalHopCount" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MaxLogonFailures - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_maxlogonfailures) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "MaxLogonFailures" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MaxMessageSize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_maxmessagesize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MaxMessageSize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MaxProtocolErrors - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_maxprotocolerrors) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MaxProtocolErrors" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MaxRecipientsPerMessage - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_maxrecipientspermessage) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "MaxRecipientsPerMessage" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MessageRateLimit - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_messageratelimit) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MessageRateLimit" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MessageRateSource - # Type: string - # IsMandatory: False - # Values: ["None", "IPAddress", "User", "All"] - newparam(:dsc_messageratesource) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MessageRateSource - Valid values are None, IPAddress, User, All." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['None', 'none', 'IPAddress', 'ipaddress', 'User', 'user', 'All', 'all'].include?(value) - fail("Invalid value '#{value}'. Valid values are None, IPAddress, User, All") - end - end - end - - # Name: OrarEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_orarenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "OrarEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: PermissionGroups - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_permissiongroups, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "PermissionGroups" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: PipeliningEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_pipeliningenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "PipeliningEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ProtocolLoggingLevel - # Type: string - # IsMandatory: False - # Values: ["None", "Verbose"] - newparam(:dsc_protocollogginglevel) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProtocolLoggingLevel - Valid values are None, Verbose." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['None', 'none', 'Verbose', 'verbose'].include?(value) - fail("Invalid value '#{value}'. Valid values are None, Verbose") - end - end - end - - # Name: RemoteIPRanges - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_remoteipranges, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "RemoteIPRanges" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: RequireEHLODomain - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_requireehlodomain) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RequireEHLODomain" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: RequireTLS - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_requiretls) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RequireTLS" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ServiceDiscoveryFqdn - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_servicediscoveryfqdn) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServiceDiscoveryFqdn" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SizeEnabled - # Type: string - # IsMandatory: False - # Values: ["Enabled", "Disabled", "EnabledWithoutValue"] - newparam(:dsc_sizeenabled) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SizeEnabled - Valid values are Enabled, Disabled, EnabledWithoutValue." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Enabled', 'enabled', 'Disabled', 'disabled', 'EnabledWithoutValue', 'enabledwithoutvalue'].include?(value) - fail("Invalid value '#{value}'. Valid values are Enabled, Disabled, EnabledWithoutValue") - end - end - end - - # Name: SuppressXAnonymousTls - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_suppressxanonymoustls) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "SuppressXAnonymousTls" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: TarpitInterval - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_tarpitinterval) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TarpitInterval" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: TlsCertificateName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_tlscertificatename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TlsCertificateName" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: TlsDomainCapabilities - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_tlsdomaincapabilities, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "TlsDomainCapabilities" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: TransportRole - # Type: string - # IsMandatory: False - # Values: ["FrontendTransport", "HubTransport"] - newparam(:dsc_transportrole) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TransportRole - Valid values are FrontendTransport, HubTransport." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['FrontendTransport', 'frontendtransport', 'HubTransport', 'hubtransport'].include?(value) - fail("Invalid value '#{value}'. Valid values are FrontendTransport, HubTransport") - end - end - end - - # Name: Usage - # Type: string - # IsMandatory: False - # Values: ["Client", "Internal", "Internet", "Partner", "Custom"] - newparam(:dsc_usage) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Usage - Valid values are Client, Internal, Internet, Partner, Custom." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Client', 'client', 'Internal', 'internal', 'Internet', 'internet', 'Partner', 'partner', 'Custom', 'custom'].include?(value) - fail("Invalid value '#{value}'. Valid values are Client, Internal, Internet, Partner, Custom") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchreceiveconnector).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchtransportservice.rb b/lib/puppet/type/dsc_xexchtransportservice.rb deleted file mode 100644 index 53743072..00000000 --- a/lib/puppet/type/dsc_xexchtransportservice.rb +++ /dev/null @@ -1,1459 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchtransportservice) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchTransportService resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchTransportService/MSFT_xExchTransportService.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_identity is a required attribute') if self[:dsc_identity].nil? - end - - def dscmeta_resource_friendly_name; 'xExchTransportService' end - def dscmeta_resource_name; 'MSFT_xExchTransportService' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Identity - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_identity) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Identity" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: AllowServiceRestart - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowservicerestart) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowServiceRestart" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ActiveUserStatisticsLogMaxAge - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_activeuserstatisticslogmaxage) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ActiveUserStatisticsLogMaxAge" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ActiveUserStatisticsLogMaxDirectorySize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_activeuserstatisticslogmaxdirectorysize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ActiveUserStatisticsLogMaxDirectorySize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ActiveUserStatisticsLogMaxFileSize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_activeuserstatisticslogmaxfilesize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ActiveUserStatisticsLogMaxFileSize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ActiveUserStatisticsLogPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_activeuserstatisticslogpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ActiveUserStatisticsLogPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AgentLogEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_agentlogenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AgentLogEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AgentLogMaxAge - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_agentlogmaxage) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AgentLogMaxAge" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AgentLogMaxDirectorySize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_agentlogmaxdirectorysize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AgentLogMaxDirectorySize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AgentLogMaxFileSize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_agentlogmaxfilesize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AgentLogMaxFileSize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AgentLogPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_agentlogpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AgentLogPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ConnectivityLogEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_connectivitylogenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ConnectivityLogEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ConnectivityLogMaxAge - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_connectivitylogmaxage) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ConnectivityLogMaxAge" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ConnectivityLogMaxDirectorySize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_connectivitylogmaxdirectorysize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ConnectivityLogMaxDirectorySize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ConnectivityLogMaxFileSize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_connectivitylogmaxfilesize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ConnectivityLogMaxFileSize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ConnectivityLogPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_connectivitylogpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ConnectivityLogPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ContentConversionTracingEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_contentconversiontracingenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ContentConversionTracingEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DelayNotificationTimeout - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_delaynotificationtimeout) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DelayNotificationTimeout" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DnsLogEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_dnslogenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DnsLogEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DnsLogMaxAge - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_dnslogmaxage) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DnsLogMaxAge" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DnsLogMaxDirectorySize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_dnslogmaxdirectorysize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DnsLogMaxDirectorySize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DnsLogMaxFileSize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_dnslogmaxfilesize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DnsLogMaxFileSize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DnsLogPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_dnslogpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DnsLogPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ExternalDNSAdapterEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_externaldnsadapterenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ExternalDNSAdapterEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ExternalDNSAdapterGuid - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_externaldnsadapterguid) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ExternalDNSAdapterGuid" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ExternalDNSProtocolOption - # Type: string - # IsMandatory: False - # Values: ["Any", "UseTcpOnly", "UseUdpOnly"] - newparam(:dsc_externaldnsprotocoloption) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ExternalDNSProtocolOption - Valid values are Any, UseTcpOnly, UseUdpOnly." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Any', 'any', 'UseTcpOnly', 'usetcponly', 'UseUdpOnly', 'useudponly'].include?(value) - fail("Invalid value '#{value}'. Valid values are Any, UseTcpOnly, UseUdpOnly") - end - end - end - - # Name: ExternalDNSServers - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_externaldnsservers, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ExternalDNSServers" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: ExternalIPAddress - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_externalipaddress) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ExternalIPAddress" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InternalDNSAdapterEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_internaldnsadapterenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "InternalDNSAdapterEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: InternalDNSAdapterGuid - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_internaldnsadapterguid) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InternalDNSAdapterGuid" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InternalDNSProtocolOption - # Type: string - # IsMandatory: False - # Values: ["Any", "UseTcpOnly", "UseUdpOnly"] - newparam(:dsc_internaldnsprotocoloption) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InternalDNSProtocolOption - Valid values are Any, UseTcpOnly, UseUdpOnly." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Any', 'any', 'UseTcpOnly', 'usetcponly', 'UseUdpOnly', 'useudponly'].include?(value) - fail("Invalid value '#{value}'. Valid values are Any, UseTcpOnly, UseUdpOnly") - end - end - end - - # Name: InternalDNSServers - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_internaldnsservers, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "InternalDNSServers" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: IntraOrgConnectorProtocolLoggingLevel - # Type: string - # IsMandatory: False - # Values: ["None", "Verbose"] - newparam(:dsc_intraorgconnectorprotocollogginglevel) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IntraOrgConnectorProtocolLoggingLevel - Valid values are None, Verbose." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['None', 'none', 'Verbose', 'verbose'].include?(value) - fail("Invalid value '#{value}'. Valid values are None, Verbose") - end - end - end - - # Name: IntraOrgConnectorSmtpMaxMessagesPerConnection - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_intraorgconnectorsmtpmaxmessagesperconnection) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "IntraOrgConnectorSmtpMaxMessagesPerConnection" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: IrmLogEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_irmlogenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "IrmLogEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: IrmLogMaxAge - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_irmlogmaxage) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IrmLogMaxAge" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: IrmLogMaxDirectorySize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_irmlogmaxdirectorysize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IrmLogMaxDirectorySize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: IrmLogMaxFileSize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_irmlogmaxfilesize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IrmLogMaxFileSize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: IrmLogPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_irmlogpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IrmLogPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MaxConcurrentMailboxDeliveries - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_maxconcurrentmailboxdeliveries) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "MaxConcurrentMailboxDeliveries" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MaxConcurrentMailboxSubmissions - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_maxconcurrentmailboxsubmissions) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "MaxConcurrentMailboxSubmissions" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MaxConnectionRatePerMinute - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_maxconnectionrateperminute) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "MaxConnectionRatePerMinute" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MaxOutboundConnections - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_maxoutboundconnections) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MaxOutboundConnections" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MaxPerDomainOutboundConnections - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_maxperdomainoutboundconnections) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MaxPerDomainOutboundConnections" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MessageExpirationTimeout - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_messageexpirationtimeout) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MessageExpirationTimeout" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MessageRetryInterval - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_messageretryinterval) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MessageRetryInterval" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MessageTrackingLogEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_messagetrackinglogenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "MessageTrackingLogEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: MessageTrackingLogMaxAge - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_messagetrackinglogmaxage) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MessageTrackingLogMaxAge" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MessageTrackingLogMaxDirectorySize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_messagetrackinglogmaxdirectorysize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MessageTrackingLogMaxDirectorySize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MessageTrackingLogMaxFileSize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_messagetrackinglogmaxfilesize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MessageTrackingLogMaxFileSize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MessageTrackingLogPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_messagetrackinglogpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MessageTrackingLogPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MessageTrackingLogSubjectLoggingEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_messagetrackinglogsubjectloggingenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "MessageTrackingLogSubjectLoggingEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: OutboundConnectionFailureRetryInterval - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_outboundconnectionfailureretryinterval) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "OutboundConnectionFailureRetryInterval" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: PickupDirectoryMaxHeaderSize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_pickupdirectorymaxheadersize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "PickupDirectoryMaxHeaderSize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: PickupDirectoryMaxMessagesPerMinute - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_pickupdirectorymaxmessagesperminute) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "PickupDirectoryMaxMessagesPerMinute" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: PickupDirectoryMaxRecipientsPerMessage - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_pickupdirectorymaxrecipientspermessage) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "PickupDirectoryMaxRecipientsPerMessage" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: PickupDirectoryPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_pickupdirectorypath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "PickupDirectoryPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: PipelineTracingEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_pipelinetracingenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "PipelineTracingEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: PipelineTracingPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_pipelinetracingpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "PipelineTracingPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: PipelineTracingSenderAddress - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_pipelinetracingsenderaddress) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "PipelineTracingSenderAddress" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: PoisonMessageDetectionEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_poisonmessagedetectionenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "PoisonMessageDetectionEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: PoisonThreshold - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_poisonthreshold) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "PoisonThreshold" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: QueueLogMaxAge - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_queuelogmaxage) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "QueueLogMaxAge" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: QueueLogMaxDirectorySize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_queuelogmaxdirectorysize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "QueueLogMaxDirectorySize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: QueueLogMaxFileSize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_queuelogmaxfilesize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "QueueLogMaxFileSize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: QueueLogPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_queuelogpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "QueueLogPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: QueueMaxIdleTime - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_queuemaxidletime) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "QueueMaxIdleTime" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ReceiveProtocolLogMaxAge - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_receiveprotocollogmaxage) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ReceiveProtocolLogMaxAge" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ReceiveProtocolLogMaxDirectorySize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_receiveprotocollogmaxdirectorysize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ReceiveProtocolLogMaxDirectorySize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ReceiveProtocolLogMaxFileSize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_receiveprotocollogmaxfilesize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ReceiveProtocolLogMaxFileSize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ReceiveProtocolLogPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_receiveprotocollogpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ReceiveProtocolLogPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RecipientValidationCacheEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_recipientvalidationcacheenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RecipientValidationCacheEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ReplayDirectoryPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_replaydirectorypath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ReplayDirectoryPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RootDropDirectoryPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_rootdropdirectorypath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RootDropDirectoryPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RoutingTableLogMaxAge - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_routingtablelogmaxage) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RoutingTableLogMaxAge" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RoutingTableLogMaxDirectorySize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_routingtablelogmaxdirectorysize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RoutingTableLogMaxDirectorySize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RoutingTableLogPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_routingtablelogpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RoutingTableLogPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SendProtocolLogMaxAge - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sendprotocollogmaxage) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SendProtocolLogMaxAge" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SendProtocolLogMaxDirectorySize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sendprotocollogmaxdirectorysize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SendProtocolLogMaxDirectorySize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SendProtocolLogMaxFileSize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sendprotocollogmaxfilesize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SendProtocolLogMaxFileSize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SendProtocolLogPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sendprotocollogpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SendProtocolLogPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ServerStatisticsLogMaxAge - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_serverstatisticslogmaxage) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServerStatisticsLogMaxAge" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ServerStatisticsLogMaxDirectorySize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_serverstatisticslogmaxdirectorysize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServerStatisticsLogMaxDirectorySize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ServerStatisticsLogMaxFileSize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_serverstatisticslogmaxfilesize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServerStatisticsLogMaxFileSize" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ServerStatisticsLogPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_serverstatisticslogpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServerStatisticsLogPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: TransientFailureRetryCount - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_transientfailureretrycount) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "TransientFailureRetryCount" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: TransientFailureRetryInterval - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_transientfailureretryinterval) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TransientFailureRetryInterval" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UseDowngradedExchangeServerAuth - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_usedowngradedexchangeserverauth) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "UseDowngradedExchangeServerAuth" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchtransportservice).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchumcallroutersettings.rb b/lib/puppet/type/dsc_xexchumcallroutersettings.rb deleted file mode 100644 index 0ae241cd..00000000 --- a/lib/puppet/type/dsc_xexchumcallroutersettings.rb +++ /dev/null @@ -1,134 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchumcallroutersettings) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchUMCallRouterSettings resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchUMCallRouterSettings/MSFT_xExchUMCallRouterSettings.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_server is a required attribute') if self[:dsc_server].nil? - end - - def dscmeta_resource_friendly_name; 'xExchUMCallRouterSettings' end - def dscmeta_resource_name; 'MSFT_xExchUMCallRouterSettings' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Server - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_server) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Server - Hostname of the UM server to configure" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential - Credentials used to establish a remote Powershell session to Exchange" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: UMStartupMode - # Type: string - # IsMandatory: False - # Values: ["TCP", "TLS", "Dual"] - newparam(:dsc_umstartupmode) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UMStartupMode - UMStartupMode for the UM call router Valid values are TCP, TLS, Dual." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['TCP', 'tcp', 'TLS', 'tls', 'Dual', 'dual'].include?(value) - fail("Invalid value '#{value}'. Valid values are TCP, TLS, Dual") - end - end - end - - # Name: DomainController - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domaincontroller) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainController - Optional Domain Controller to connect to" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchumcallroutersettings).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchumservice.rb b/lib/puppet/type/dsc_xexchumservice.rb deleted file mode 100644 index ae331de9..00000000 --- a/lib/puppet/type/dsc_xexchumservice.rb +++ /dev/null @@ -1,152 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchumservice) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchUMService resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchUMService/MSFT_xExchUMService.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_identity is a required attribute') if self[:dsc_identity].nil? - end - - def dscmeta_resource_friendly_name; 'xExchUMService' end - def dscmeta_resource_name; 'MSFT_xExchUMService' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Identity - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_identity) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Identity" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: UMStartupMode - # Type: string - # IsMandatory: False - # Values: ["TCP", "TLS", "Dual"] - newparam(:dsc_umstartupmode) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UMStartupMode - Valid values are TCP, TLS, Dual." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['TCP', 'tcp', 'TLS', 'tls', 'Dual', 'dual'].include?(value) - fail("Invalid value '#{value}'. Valid values are TCP, TLS, Dual") - end - end - end - - # Name: DialPlans - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_dialplans, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "DialPlans" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: DomainController - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domaincontroller) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainController" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchumservice).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchwaitforadprep.rb b/lib/puppet/type/dsc_xexchwaitforadprep.rb deleted file mode 100644 index cd50e4f4..00000000 --- a/lib/puppet/type/dsc_xexchwaitforadprep.rb +++ /dev/null @@ -1,209 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchwaitforadprep) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchWaitForADPrep resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchWaitForADPrep/MSFT_xExchWaitForADPrep.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_identity is a required attribute') if self[:dsc_identity].nil? - end - - def dscmeta_resource_friendly_name; 'xExchWaitForADPrep' end - def dscmeta_resource_name; 'MSFT_xExchWaitForADPrep' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Identity - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_identity) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Identity - Not actually used. Enter anything, as long as it's not null" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential - Credentials used to perform Active Directory lookups against the Schema, Configuration, and Domain naming contexts" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: SchemaVersion - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_schemaversion) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "SchemaVersion - Specifies that the Active Directory schema should have been prepared using Exchange 2013 'setup /PrepareSchema', and should be at the specified version" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: OrganizationVersion - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_organizationversion) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "OrganizationVersion - Specifies that the Exchange Organization should have been prepared using Exchange 2013 'setup /PrepareAD', and should be at the specified version" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: DomainVersion - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_domainversion) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "DomainVersion - Specifies that the domain containing the target Exchange 2013 server was prepared using setup /PrepareAD, /PrepareDomain, or /PrepareAllDomains, and should be at the specified version" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ExchangeDomains - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_exchangedomains, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ExchangeDomains - The FQDN's of domains that should be checked for DomainVersion in addition to the domain that this Exchange server belongs to" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: RetryIntervalSec - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_retryintervalsec) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "RetryIntervalSec - How many seconds to wait between retries when checking whether AD has been prepped. Defaults to 60." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: RetryCount - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_retrycount) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "RetryCount - How many retry attempts should be made to see if AD has been prepped before an exception is thrown. Defaults to 30." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchwaitforadprep).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchwaitfordag.rb b/lib/puppet/type/dsc_xexchwaitfordag.rb deleted file mode 100644 index f8a7febc..00000000 --- a/lib/puppet/type/dsc_xexchwaitfordag.rb +++ /dev/null @@ -1,152 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchwaitfordag) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchWaitForDAG resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchWaitForDAG/MSFT_xExchWaitForDAG.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_identity is a required attribute') if self[:dsc_identity].nil? - end - - def dscmeta_resource_friendly_name; 'xExchWaitForDAG' end - def dscmeta_resource_name; 'MSFT_xExchWaitForDAG' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Identity - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_identity) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Identity" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: DomainController - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domaincontroller) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainController" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RetryIntervalSec - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_retryintervalsec) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "RetryIntervalSec" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: RetryCount - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_retrycount) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "RetryCount" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchwaitfordag).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchwaitformailboxdatabase.rb b/lib/puppet/type/dsc_xexchwaitformailboxdatabase.rb deleted file mode 100644 index 96ebd3ff..00000000 --- a/lib/puppet/type/dsc_xexchwaitformailboxdatabase.rb +++ /dev/null @@ -1,167 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchwaitformailboxdatabase) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchWaitForMailboxDatabase resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchWaitForMailboxDatabase/MSFT_xExchWaitForMailboxDatabase.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_identity is a required attribute') if self[:dsc_identity].nil? - end - - def dscmeta_resource_friendly_name; 'xExchWaitForMailboxDatabase' end - def dscmeta_resource_name; 'MSFT_xExchWaitForMailboxDatabase' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Identity - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_identity) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Identity" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: AdServerSettingsPreferredServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_adserversettingspreferredserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AdServerSettingsPreferredServer" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DomainController - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domaincontroller) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainController" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RetryIntervalSec - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_retryintervalsec) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "RetryIntervalSec" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: RetryCount - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_retrycount) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "RetryCount" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchwaitformailboxdatabase).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xexchwebservicesvirtualdirectory.rb b/lib/puppet/type/dsc_xexchwebservicesvirtualdirectory.rb deleted file mode 100644 index 245817c2..00000000 --- a/lib/puppet/type/dsc_xexchwebservicesvirtualdirectory.rb +++ /dev/null @@ -1,273 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xexchwebservicesvirtualdirectory) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xExchWebServicesVirtualDirectory resource type. - Automatically generated from - 'xExchange/DSCResources/MSFT_xExchWebServicesVirtualDirectory/MSFT_xExchWebServicesVirtualDirectory.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_identity is a required attribute') if self[:dsc_identity].nil? - end - - def dscmeta_resource_friendly_name; 'xExchWebServicesVirtualDirectory' end - def dscmeta_resource_name; 'MSFT_xExchWebServicesVirtualDirectory' end - def dscmeta_module_name; 'xExchange' end - def dscmeta_module_version; '1.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Identity - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_identity) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Identity" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: AllowServiceRestart - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowservicerestart) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowServiceRestart" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: BasicAuthentication - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_basicauthentication) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "BasicAuthentication" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: CertificateAuthentication - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_certificateauthentication) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "CertificateAuthentication" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DigestAuthentication - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_digestauthentication) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DigestAuthentication" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DomainController - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_domaincontroller) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainController" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ExternalUrl - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_externalurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ExternalUrl" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InternalNLBBypassUrl - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_internalnlbbypassurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InternalNLBBypassUrl" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InternalUrl - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_internalurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InternalUrl" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: OAuthAuthentication - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_oauthauthentication) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "OAuthAuthentication" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: WindowsAuthentication - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_windowsauthentication) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "WindowsAuthentication" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: WSSecurityAuthentication - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_wssecurityauthentication) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "WSSecurityAuthentication" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xexchwebservicesvirtualdirectory).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xfirewall.rb b/lib/puppet/type/dsc_xfirewall.rb deleted file mode 100644 index 4ff3b514..00000000 --- a/lib/puppet/type/dsc_xfirewall.rb +++ /dev/null @@ -1,621 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xfirewall) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xFirewall resource type. - Automatically generated from - 'xNetworking/DSCResources/MSFT_xFirewall/MSFT_xFirewall.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xFirewall' end - def dscmeta_resource_name; 'MSFT_xFirewall' end - def dscmeta_module_name; 'xNetworking' end - def dscmeta_module_version; '5.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Name of the Firewall Rule" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DisplayName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_displayname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DisplayName - Localized, user-facing name of the Firewall Rule being created" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Group - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_group) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Group - Name of the Firewall Group where we want to put the Firewall Rule" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Ensure the presence/absence of the resource Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Enabled - # Type: string - # IsMandatory: False - # Values: ["True", "False"] - newparam(:dsc_enabled) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Enabled - Enable or disable the supplied configuration Valid values are True, False." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['True', 'true', 'False', 'false'].include?(value) - fail("Invalid value '#{value}'. Valid values are True, False") - end - end - end - - # Name: Action - # Type: string - # IsMandatory: False - # Values: ["NotConfigured", "Allow", "Block"] - newparam(:dsc_action) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Action - Allow or Block the supplied configuration Valid values are NotConfigured, Allow, Block." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['NotConfigured', 'notconfigured', 'Allow', 'allow', 'Block', 'block'].include?(value) - fail("Invalid value '#{value}'. Valid values are NotConfigured, Allow, Block") - end - end - end - - # Name: Profile - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_profile, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Profile - Specifies one or more profiles to which the rule is assigned" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: Direction - # Type: string - # IsMandatory: False - # Values: ["Inbound", "Outbound"] - newparam(:dsc_direction) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Direction - Direction of the connection Valid values are Inbound, Outbound." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Inbound', 'inbound', 'Outbound', 'outbound'].include?(value) - fail("Invalid value '#{value}'. Valid values are Inbound, Outbound") - end - end - end - - # Name: RemotePort - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_remoteport, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "RemotePort - Specific Port used for filter. Specified by port number, range, or keyword" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: LocalPort - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_localport, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "LocalPort - Local Port used for the filter" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: Protocol - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_protocol) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Protocol - Specific Protocol for filter. Specified by name, number, or range" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Description - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_description) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Description - Documentation for the Rule." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Program - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_program) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Program - Path and file name of the program for which the rule is applied" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Service - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_service) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Service - Specifies the short name of a Windows service to which the firewall rule applies" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Authentication - # Type: string - # IsMandatory: False - # Values: ["NotRequired", "Required", "NoEncap"] - newparam(:dsc_authentication) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Authentication - Specifies that authentication is required on firewall rules Valid values are NotRequired, Required, NoEncap." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['NotRequired', 'notrequired', 'Required', 'required', 'NoEncap', 'noencap'].include?(value) - fail("Invalid value '#{value}'. Valid values are NotRequired, Required, NoEncap") - end - end - end - - # Name: Encryption - # Type: string - # IsMandatory: False - # Values: ["NotRequired", "Required", "Dynamic"] - newparam(:dsc_encryption) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Encryption - Specifies that encryption in authentication is required on firewall rules Valid values are NotRequired, Required, Dynamic." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['NotRequired', 'notrequired', 'Required', 'required', 'Dynamic', 'dynamic'].include?(value) - fail("Invalid value '#{value}'. Valid values are NotRequired, Required, Dynamic") - end - end - end - - # Name: InterfaceAlias - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_interfacealias, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "InterfaceAlias - Specifies the alias of the interface that applies to the traffic" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: InterfaceType - # Type: string - # IsMandatory: False - # Values: ["Any", "Wired", "Wireless", "RemoteAccess"] - newparam(:dsc_interfacetype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InterfaceType - Specifies that only network connections made through the indicated interface types are subject to the requirements of this rule Valid values are Any, Wired, Wireless, RemoteAccess." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Any', 'any', 'Wired', 'wired', 'Wireless', 'wireless', 'RemoteAccess', 'remoteaccess'].include?(value) - fail("Invalid value '#{value}'. Valid values are Any, Wired, Wireless, RemoteAccess") - end - end - end - - # Name: LocalAddress - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_localaddress, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "LocalAddress - Specifies that network packets with matching IP addresses match this rule" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: LocalUser - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_localuser) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LocalUser - Specifies the principals to which network traffic this firewall rule applies" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Package - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_package) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Package - Specifies the Windows Store application to which the firewall rule applies" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Platform - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_platform, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Platform - Specifies which version of Windows the associated rule applies" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: RemoteAddress - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_remoteaddress, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "RemoteAddress - Specifies that network packets with matching IP addresses match this rule" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: RemoteMachine - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_remotemachine) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RemoteMachine - Specifies that matching IPsec rules of the indicated computer accounts are created" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RemoteUser - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_remoteuser) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RemoteUser - Specifies that matching IPsec rules of the indicated user accounts are created" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DynamicTransport - # Type: string - # IsMandatory: False - # Values: ["Any", "ProximityApps", "ProximitySharing", "WifiDirectPrinting", "WifiDirectDisplay", "WifiDirectDevices"] - newparam(:dsc_dynamictransport) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DynamicTransport - Specifies a dynamic transport Valid values are Any, ProximityApps, ProximitySharing, WifiDirectPrinting, WifiDirectDisplay, WifiDirectDevices." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Any', 'any', 'ProximityApps', 'proximityapps', 'ProximitySharing', 'proximitysharing', 'WifiDirectPrinting', 'wifidirectprinting', 'WifiDirectDisplay', 'wifidirectdisplay', 'WifiDirectDevices', 'wifidirectdevices'].include?(value) - fail("Invalid value '#{value}'. Valid values are Any, ProximityApps, ProximitySharing, WifiDirectPrinting, WifiDirectDisplay, WifiDirectDevices") - end - end - end - - # Name: EdgeTraversalPolicy - # Type: string - # IsMandatory: False - # Values: ["Block", "Allow", "DeferToUser", "DeferToApp"] - newparam(:dsc_edgetraversalpolicy) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "EdgeTraversalPolicy - Specifies that matching firewall rules of the indicated edge traversal policy are created Valid values are Block, Allow, DeferToUser, DeferToApp." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Block', 'block', 'Allow', 'allow', 'DeferToUser', 'defertouser', 'DeferToApp', 'defertoapp'].include?(value) - fail("Invalid value '#{value}'. Valid values are Block, Allow, DeferToUser, DeferToApp") - end - end - end - - # Name: IcmpType - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_icmptype, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "IcmpType - Specifies the ICMP type codes" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: LocalOnlyMapping - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_localonlymapping) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "LocalOnlyMapping - Indicates that matching firewall rules of the indicated value are created" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: LooseSourceMapping - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_loosesourcemapping) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "LooseSourceMapping - Indicates that matching firewall rules of the indicated value are created" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: OverrideBlockRules - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_overrideblockrules) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "OverrideBlockRules - Indicates that matching network traffic that would otherwise be blocked are allowed" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Owner - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_owner) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Owner - Specifies that matching firewall rules of the indicated owner are created" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DisplayGroup - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_displaygroup) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DisplayGroup - The current value of the Display Group of the Firewall Rule" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xfirewall).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xfirewallprofile.rb b/lib/puppet/type/dsc_xfirewallprofile.rb deleted file mode 100644 index dcca82a3..00000000 --- a/lib/puppet/type/dsc_xfirewallprofile.rb +++ /dev/null @@ -1,391 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xfirewallprofile) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xFirewallProfile resource type. - Automatically generated from - 'xNetworking/DSCResources/MSFT_xFirewallProfile/MSFT_xFirewallProfile.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xFirewallProfile' end - def dscmeta_resource_name; 'MSFT_xFirewallProfile' end - def dscmeta_module_name; 'xNetworking' end - def dscmeta_module_version; '5.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: ["Domain", "Public", "Private"] - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the firewall profile to configure. Valid values are Domain, Public, Private." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Domain', 'domain', 'Public', 'public', 'Private', 'private'].include?(value) - fail("Invalid value '#{value}'. Valid values are Domain, Public, Private") - end - end - end - - # Name: AllowInboundRules - # Type: string - # IsMandatory: False - # Values: ["True", "False", "NotConfigured"] - newparam(:dsc_allowinboundrules) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AllowInboundRules - Specifies that the firewall blocks inbound traffic. Valid values are True, False, NotConfigured." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['True', 'true', 'False', 'false', 'NotConfigured', 'notconfigured'].include?(value) - fail("Invalid value '#{value}'. Valid values are True, False, NotConfigured") - end - end - end - - # Name: AllowLocalFirewallRules - # Type: string - # IsMandatory: False - # Values: ["True", "False", "NotConfigured"] - newparam(:dsc_allowlocalfirewallrules) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AllowLocalFirewallRules - Specifies that the local firewall rules should be merged into the effective policy along with Group Policy settings. Valid values are True, False, NotConfigured." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['True', 'true', 'False', 'false', 'NotConfigured', 'notconfigured'].include?(value) - fail("Invalid value '#{value}'. Valid values are True, False, NotConfigured") - end - end - end - - # Name: AllowLocalIPsecRules - # Type: string - # IsMandatory: False - # Values: ["True", "False", "NotConfigured"] - newparam(:dsc_allowlocalipsecrules) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AllowLocalIPsecRules - Specifies that the local IPsec rules should be merged into the effective policy along with Group Policy settings. Valid values are True, False, NotConfigured." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['True', 'true', 'False', 'false', 'NotConfigured', 'notconfigured'].include?(value) - fail("Invalid value '#{value}'. Valid values are True, False, NotConfigured") - end - end - end - - # Name: AllowUnicastResponseToMulticast - # Type: string - # IsMandatory: False - # Values: ["True", "False", "NotConfigured"] - newparam(:dsc_allowunicastresponsetomulticast) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AllowUnicastResponseToMulticast - Allows unicast responses to multi-cast traffic. Valid values are True, False, NotConfigured." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['True', 'true', 'False', 'false', 'NotConfigured', 'notconfigured'].include?(value) - fail("Invalid value '#{value}'. Valid values are True, False, NotConfigured") - end - end - end - - # Name: AllowUserApps - # Type: string - # IsMandatory: False - # Values: ["True", "False", "NotConfigured"] - newparam(:dsc_allowuserapps) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AllowUserApps - Specifies that traffic from local user applications is allowed through the firewall. Valid values are True, False, NotConfigured." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['True', 'true', 'False', 'false', 'NotConfigured', 'notconfigured'].include?(value) - fail("Invalid value '#{value}'. Valid values are True, False, NotConfigured") - end - end - end - - # Name: AllowUserPorts - # Type: string - # IsMandatory: False - # Values: ["True", "False", "NotConfigured"] - newparam(:dsc_allowuserports) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AllowUserPorts - Specifies that traffic is allowed through local user ports. Valid values are True, False, NotConfigured." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['True', 'true', 'False', 'false', 'NotConfigured', 'notconfigured'].include?(value) - fail("Invalid value '#{value}'. Valid values are True, False, NotConfigured") - end - end - end - - # Name: DefaultInboundAction - # Type: string - # IsMandatory: False - # Values: ["Block", "Allow", "NotConfigured"] - newparam(:dsc_defaultinboundaction) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DefaultInboundAction - Specifies how to filter inbound traffic. Valid values are Block, Allow, NotConfigured." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Block', 'block', 'Allow', 'allow', 'NotConfigured', 'notconfigured'].include?(value) - fail("Invalid value '#{value}'. Valid values are Block, Allow, NotConfigured") - end - end - end - - # Name: DefaultOutboundAction - # Type: string - # IsMandatory: False - # Values: ["Block", "Allow", "NotConfigured"] - newparam(:dsc_defaultoutboundaction) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DefaultOutboundAction - Specifies how to filter outbound traffic. Valid values are Block, Allow, NotConfigured." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Block', 'block', 'Allow', 'allow', 'NotConfigured', 'notconfigured'].include?(value) - fail("Invalid value '#{value}'. Valid values are Block, Allow, NotConfigured") - end - end - end - - # Name: DisabledInterfaceAliases - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_disabledinterfacealiases, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "DisabledInterfaceAliases - Specifies a list of interfaces on which firewall settings are excluded." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: Enabled - # Type: string - # IsMandatory: False - # Values: ["True", "False", "NotConfigured"] - newparam(:dsc_enabled) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Enabled - Specifies that devolution is activated. Valid values are True, False, NotConfigured." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['True', 'true', 'False', 'false', 'NotConfigured', 'notconfigured'].include?(value) - fail("Invalid value '#{value}'. Valid values are True, False, NotConfigured") - end - end - end - - # Name: EnableStealthModeForIPsec - # Type: string - # IsMandatory: False - # Values: ["True", "False", "NotConfigured"] - newparam(:dsc_enablestealthmodeforipsec) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "EnableStealthModeForIPsec - Enables stealth mode for IPsec traffic. Valid values are True, False, NotConfigured." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['True', 'true', 'False', 'false', 'NotConfigured', 'notconfigured'].include?(value) - fail("Invalid value '#{value}'. Valid values are True, False, NotConfigured") - end - end - end - - # Name: LogAllowed - # Type: string - # IsMandatory: False - # Values: ["True", "False", "NotConfigured"] - newparam(:dsc_logallowed) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogAllowed - Specifies how to log the allowed packets in the location specified by the LogFileName parameter. Valid values are True, False, NotConfigured." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['True', 'true', 'False', 'false', 'NotConfigured', 'notconfigured'].include?(value) - fail("Invalid value '#{value}'. Valid values are True, False, NotConfigured") - end - end - end - - # Name: LogBlocked - # Type: string - # IsMandatory: False - # Values: ["True", "False", "NotConfigured"] - newparam(:dsc_logblocked) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogBlocked - Specifies how to log the dropped packets in the location specified by the LogFileName parameter. Valid values are True, False, NotConfigured." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['True', 'true', 'False', 'false', 'NotConfigured', 'notconfigured'].include?(value) - fail("Invalid value '#{value}'. Valid values are True, False, NotConfigured") - end - end - end - - # Name: LogFileName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_logfilename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogFileName - Specifies the path and filename of the file to which Windows Server writes log entries." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: LogIgnored - # Type: string - # IsMandatory: False - # Values: ["True", "False", "NotConfigured"] - newparam(:dsc_logignored) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogIgnored - Specifies how to log the ignored packets in the location specified by the LogFileName parameter. Valid values are True, False, NotConfigured." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['True', 'true', 'False', 'false', 'NotConfigured', 'notconfigured'].include?(value) - fail("Invalid value '#{value}'. Valid values are True, False, NotConfigured") - end - end - end - - # Name: LogMaxSizeKilobytes - # Type: uint64 - # IsMandatory: False - # Values: None - newparam(:dsc_logmaxsizekilobytes) do - def mof_type; 'uint64' end - def mof_is_embedded?; false end - desc "LogMaxSizeKilobytes - Specifies the maximum file size of the log, in kilobytes. The acceptable values for this parameter are: 1 through 32767." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: NotifyOnListen - # Type: string - # IsMandatory: False - # Values: ["True", "False", "NotConfigured"] - newparam(:dsc_notifyonlisten) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "NotifyOnListen - Allows the notification of listening for inbound connections by a service. Valid values are True, False, NotConfigured." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['True', 'true', 'False', 'false', 'NotConfigured', 'notconfigured'].include?(value) - fail("Invalid value '#{value}'. Valid values are True, False, NotConfigured") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xfirewallprofile).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xgroup.rb b/lib/puppet/type/dsc_xgroup.rb deleted file mode 100644 index 8401971a..00000000 --- a/lib/puppet/type/dsc_xgroup.rb +++ /dev/null @@ -1,190 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xgroup) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xGroup resource type. - Automatically generated from - 'xPSDesiredStateConfiguration/DSCResources/MSFT_xGroupResource/MSFT_xGroupResource.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_groupname is a required attribute') if self[:dsc_groupname].nil? - end - - def dscmeta_resource_friendly_name; 'xGroup' end - def dscmeta_resource_name; 'MSFT_xGroupResource' end - def dscmeta_module_name; 'xPSDesiredStateConfiguration' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: GroupName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_groupname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "GroupName - The name of the group to create, modify, or remove." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Indicates if the group should exist or not. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Description - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_description) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Description - The description the group should have." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Members - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_members, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Members - The members the group should have." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: MembersToInclude - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_memberstoinclude, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "MembersToInclude - The members the group should include." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: MembersToExclude - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_memberstoexclude, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "MembersToExclude - The members the group should exclude." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential - A credential to resolve non-local group members." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xgroup).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xhostsfile.rb b/lib/puppet/type/dsc_xhostsfile.rb deleted file mode 100644 index 31745122..00000000 --- a/lib/puppet/type/dsc_xhostsfile.rb +++ /dev/null @@ -1,120 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xhostsfile) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xHostsFile resource type. - Automatically generated from - 'xNetworking/DSCResources/MSFT_xHostsFile/MSFT_xHostsFile.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_hostname is a required attribute') if self[:dsc_hostname].nil? - end - - def dscmeta_resource_friendly_name; 'xHostsFile' end - def dscmeta_resource_name; 'MSFT_xHostsFile' end - def dscmeta_module_name; 'xNetworking' end - def dscmeta_module_version; '5.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: HostName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_hostname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "HostName - Specifies the name of the computer that will be mapped to an IP address." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: IPAddress - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_ipaddress) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IPAddress - Specifies the IP Address that should be mapped to the host name." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies if the hosts file entry should be created or deleted. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xhostsfile).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xhotfix.rb b/lib/puppet/type/dsc_xhotfix.rb deleted file mode 100644 index 093691de..00000000 --- a/lib/puppet/type/dsc_xhotfix.rb +++ /dev/null @@ -1,151 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xhotfix) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xHotfix resource type. - Automatically generated from - 'xWindowsUpdate/DscResources/MSFT_xWindowsUpdate/MSFT_xWindowsUpdate.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_path is a required attribute') if self[:dsc_path].nil? - end - - def dscmeta_resource_friendly_name; 'xHotfix' end - def dscmeta_resource_name; 'MSFT_xWindowsUpdate' end - def dscmeta_module_name; 'xWindowsUpdate' end - def dscmeta_module_version; '2.7.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Path - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_path) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Path - Specifies the path that contains the msu file for the hotfix installation." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Id - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_id) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Id - Specifies the Hotfix ID." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Log - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_log) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Log - Specifies the location of the log that contains information from the installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies whether the hotfix needs to be installed or uninstalled. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential - Specifies the credential to use to authenticate to a UNC share if the path is on a UNC share." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xhotfix).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xiisfeaturedelegation.rb b/lib/puppet/type/dsc_xiisfeaturedelegation.rb deleted file mode 100644 index 4ad49a45..00000000 --- a/lib/puppet/type/dsc_xiisfeaturedelegation.rb +++ /dev/null @@ -1,105 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xiisfeaturedelegation) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xIisFeatureDelegation resource type. - Automatically generated from - 'xWebAdministration/DSCResources/MSFT_xIisFeatureDelegation/MSFT_xIisFeatureDelegation.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_sectionname is a required attribute') if self[:dsc_sectionname].nil? - fail('dsc_overridemode is a required attribute') if self[:dsc_overridemode].nil? - end - - def dscmeta_resource_friendly_name; 'xIisFeatureDelegation' end - def dscmeta_resource_name; 'MSFT_xIisFeatureDelegation' end - def dscmeta_module_name; 'xWebAdministration' end - def dscmeta_module_version; '1.18.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: SectionName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_sectionname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SectionName" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: OverrideMode - # Type: string - # IsMandatory: True - # Values: ["Allow", "Deny"] - newparam(:dsc_overridemode) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "OverrideMode - Valid values are Allow, Deny." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Allow', 'allow', 'Deny', 'deny'].include?(value) - fail("Invalid value '#{value}'. Valid values are Allow, Deny") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xiisfeaturedelegation).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xiishandler.rb b/lib/puppet/type/dsc_xiishandler.rb deleted file mode 100644 index 8e6fbcf7..00000000 --- a/lib/puppet/type/dsc_xiishandler.rb +++ /dev/null @@ -1,105 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xiishandler) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xIisHandler resource type. - Automatically generated from - 'xWebAdministration/DSCResources/MSFT_xIIsHandler/MSFT_xIisHandler.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xIisHandler' end - def dscmeta_resource_name; 'MSFT_xIisHandler' end - def dscmeta_module_name; 'xWebAdministration' end - def dscmeta_module_version; '1.18.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xiishandler).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xiislogging.rb b/lib/puppet/type/dsc_xiislogging.rb deleted file mode 100644 index 57b63853..00000000 --- a/lib/puppet/type/dsc_xiislogging.rb +++ /dev/null @@ -1,180 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xiislogging) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xIisLogging resource type. - Automatically generated from - 'xWebAdministration/DSCResources/MSFT_xIisLogging/MSFT_xIisLogging.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_logpath is a required attribute') if self[:dsc_logpath].nil? - end - - def dscmeta_resource_friendly_name; 'xIisLogging' end - def dscmeta_resource_name; 'MSFT_xIisLogging' end - def dscmeta_module_name; 'xWebAdministration' end - def dscmeta_module_version; '1.18.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: LogPath - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_logpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogPath - The directory to be used for logfiles" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: LogFlags - # Type: string[] - # IsMandatory: False - # Values: ["Date", "Time", "ClientIP", "UserName", "SiteName", "ComputerName", "ServerIP", "Method", "UriStem", "UriQuery", "HttpStatus", "Win32Status", "BytesSent", "BytesRecv", "TimeTaken", "ServerPort", "UserAgent", "Cookie", "Referer", "ProtocolVersion", "Host", "HttpSubStatus"] - newparam(:dsc_logflags, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "LogFlags - The W3C logging fields Valid values are Date, Time, ClientIP, UserName, SiteName, ComputerName, ServerIP, Method, UriStem, UriQuery, HttpStatus, Win32Status, BytesSent, BytesRecv, TimeTaken, ServerPort, UserAgent, Cookie, Referer, ProtocolVersion, Host, HttpSubStatus." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - if value.kind_of?(Array) - unless (['Date', 'date', 'Time', 'time', 'ClientIP', 'clientip', 'UserName', 'username', 'SiteName', 'sitename', 'ComputerName', 'computername', 'ServerIP', 'serverip', 'Method', 'method', 'UriStem', 'uristem', 'UriQuery', 'uriquery', 'HttpStatus', 'httpstatus', 'Win32Status', 'win32status', 'BytesSent', 'bytessent', 'BytesRecv', 'bytesrecv', 'TimeTaken', 'timetaken', 'ServerPort', 'serverport', 'UserAgent', 'useragent', 'Cookie', 'cookie', 'Referer', 'referer', 'ProtocolVersion', 'protocolversion', 'Host', 'host', 'HttpSubStatus', 'httpsubstatus'] & value).count == value.count - fail("Invalid value #{value}. Valid values are Date, Time, ClientIP, UserName, SiteName, ComputerName, ServerIP, Method, UriStem, UriQuery, HttpStatus, Win32Status, BytesSent, BytesRecv, TimeTaken, ServerPort, UserAgent, Cookie, Referer, ProtocolVersion, Host, HttpSubStatus") - end - end - if value.kind_of?(String) - unless ['Date', 'date', 'Time', 'time', 'ClientIP', 'clientip', 'UserName', 'username', 'SiteName', 'sitename', 'ComputerName', 'computername', 'ServerIP', 'serverip', 'Method', 'method', 'UriStem', 'uristem', 'UriQuery', 'uriquery', 'HttpStatus', 'httpstatus', 'Win32Status', 'win32status', 'BytesSent', 'bytessent', 'BytesRecv', 'bytesrecv', 'TimeTaken', 'timetaken', 'ServerPort', 'serverport', 'UserAgent', 'useragent', 'Cookie', 'cookie', 'Referer', 'referer', 'ProtocolVersion', 'protocolversion', 'Host', 'host', 'HttpSubStatus', 'httpsubstatus'].include?(value) - fail("Invalid value #{value}. Valid values are Date, Time, ClientIP, UserName, SiteName, ComputerName, ServerIP, Method, UriStem, UriQuery, HttpStatus, Win32Status, BytesSent, BytesRecv, TimeTaken, ServerPort, UserAgent, Cookie, Referer, ProtocolVersion, Host, HttpSubStatus") - end - end - end - munge do |value| - Array(value) - end - end - - # Name: LogPeriod - # Type: string - # IsMandatory: False - # Values: ["Hourly", "Daily", "Weekly", "Monthly", "MaxSize"] - newparam(:dsc_logperiod) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogPeriod - How often the log file should rollover Valid values are Hourly, Daily, Weekly, Monthly, MaxSize." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Hourly', 'hourly', 'Daily', 'daily', 'Weekly', 'weekly', 'Monthly', 'monthly', 'MaxSize', 'maxsize'].include?(value) - fail("Invalid value '#{value}'. Valid values are Hourly, Daily, Weekly, Monthly, MaxSize") - end - end - end - - # Name: LogTruncateSize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_logtruncatesize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogTruncateSize - How large the file should be before it is truncated" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: LoglocalTimeRollover - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_loglocaltimerollover) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "LoglocalTimeRollover - Use the localtime for file naming and rollover" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: LogFormat - # Type: string - # IsMandatory: False - # Values: ["IIS", "W3C", "NCSA"] - newparam(:dsc_logformat) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogFormat - Format of the Logfiles. Only W3C supports LogFlags Valid values are IIS, W3C, NCSA." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['IIS', 'iis', 'W3C', 'w3c', 'NCSA', 'ncsa'].include?(value) - fail("Invalid value '#{value}'. Valid values are IIS, W3C, NCSA") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xiislogging).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xiismimetypemapping.rb b/lib/puppet/type/dsc_xiismimetypemapping.rb deleted file mode 100644 index efebfe98..00000000 --- a/lib/puppet/type/dsc_xiismimetypemapping.rb +++ /dev/null @@ -1,122 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xiismimetypemapping) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xIisMimeTypeMapping resource type. - Automatically generated from - 'xWebAdministration/DSCResources/MSFT_xIisMimeTypeMapping/MSFT_xIisMimeTypeMapping.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_extension is a required attribute') if self[:dsc_extension].nil? - fail('dsc_mimetype is a required attribute') if self[:dsc_mimetype].nil? - end - - def dscmeta_resource_friendly_name; 'xIisMimeTypeMapping' end - def dscmeta_resource_name; 'MSFT_xIisMimeTypeMapping' end - def dscmeta_module_name; 'xWebAdministration' end - def dscmeta_module_version; '1.18.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Extension - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_extension) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Extension" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MimeType - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_mimetype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MimeType" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xiismimetypemapping).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xiismodule.rb b/lib/puppet/type/dsc_xiismodule.rb deleted file mode 100644 index da682695..00000000 --- a/lib/puppet/type/dsc_xiismodule.rb +++ /dev/null @@ -1,202 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xiismodule) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xIisModule resource type. - Automatically generated from - 'xWebAdministration/DSCResources/MSFT_xIisModule/MSFT_xIisModule.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_path is a required attribute') if self[:dsc_path].nil? - end - - def dscmeta_resource_friendly_name; 'xIisModule' end - def dscmeta_resource_name; 'MSFT_xIisModule' end - def dscmeta_module_name; 'xWebAdministration' end - def dscmeta_module_version; '1.18.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Path - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_path) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Path - The path to the module, usually a dll, to be added to IIS." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Name - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The logical name of the module to add to IIS." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RequestPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_requestpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RequestPath - The allowed request Path example: *.php" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Verb - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_verb, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Verb - The supported verbs for the module." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: SiteName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sitename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SiteName - The IIS Site to register the module." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Should the module be present or absent. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: ModuleType - # Type: string - # IsMandatory: False - # Values: ["FastCgiModule"] - newparam(:dsc_moduletype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ModuleType - The type of the module. Valid values are FastCgiModule." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['FastCgiModule', 'fastcgimodule'].include?(value) - fail("Invalid value '#{value}'. Valid values are FastCgiModule") - end - end - end - - # Name: EndPointSetup - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_endpointsetup) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "EndPointSetup - The End Point is setup. Such as a Fast Cgi endpoint." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xiismodule).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xinternetexplorerhomepage.rb b/lib/puppet/type/dsc_xinternetexplorerhomepage.rb deleted file mode 100644 index 2cbe284c..00000000 --- a/lib/puppet/type/dsc_xinternetexplorerhomepage.rb +++ /dev/null @@ -1,120 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xinternetexplorerhomepage) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xInternetExplorerHomePage resource type. - Automatically generated from - 'xInternetExplorerHomePage/DSCResources/xInternetExplorerHomePage/xInternetExplorerHomePage.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_startpage is a required attribute') if self[:dsc_startpage].nil? - end - - def dscmeta_resource_friendly_name; 'xInternetExplorerHomePage' end - def dscmeta_resource_name; 'xInternetExplorerHomePage' end - def dscmeta_module_name; 'xInternetExplorerHomePage' end - def dscmeta_module_version; '1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: StartPage - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_startpage) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "StartPage - Specifies the URL for the home page of Internet Explorer." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SecondaryStartPages - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_secondarystartpages) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SecondaryStartPages - Specifies the URL for the secondary home pages of Internet Explorer." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Should the IE home page is configured or unconfigured. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xinternetexplorerhomepage).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xipaddress.rb b/lib/puppet/type/dsc_xipaddress.rb deleted file mode 100644 index 3daa0c5a..00000000 --- a/lib/puppet/type/dsc_xipaddress.rb +++ /dev/null @@ -1,123 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xipaddress) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xIPAddress resource type. - Automatically generated from - 'xNetworking/DSCResources/MSFT_xIPAddress/MSFT_xIPAddress.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_interfacealias is a required attribute') if self[:dsc_interfacealias].nil? - fail('dsc_addressfamily is a required attribute') if self[:dsc_addressfamily].nil? - end - - def dscmeta_resource_friendly_name; 'xIPAddress' end - def dscmeta_resource_name; 'MSFT_xIPAddress' end - def dscmeta_module_name; 'xNetworking' end - def dscmeta_module_version; '5.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: IPAddress - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_ipaddress, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "IPAddress - The desired IP address, optionally including prefix length using CIDR notation." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: InterfaceAlias - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_interfacealias) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InterfaceAlias - Alias of the network interface for which the IP address should be set." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AddressFamily - # Type: string - # IsMandatory: True - # Values: ["IPv4", "IPv6"] - newparam(:dsc_addressfamily) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AddressFamily - IP address family. Valid values are IPv4, IPv6." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['IPv4', 'ipv4', 'IPv6', 'ipv6'].include?(value) - fail("Invalid value '#{value}'. Valid values are IPv4, IPv6") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xipaddress).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xjeaendpoint.rb b/lib/puppet/type/dsc_xjeaendpoint.rb deleted file mode 100644 index b6d2ad4c..00000000 --- a/lib/puppet/type/dsc_xjeaendpoint.rb +++ /dev/null @@ -1,172 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xjeaendpoint) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xJeaEndPoint resource type. - Automatically generated from - 'xJea/DSCResources/MSFT_xJeaEndpoint/MSFT_xJeaEndpoint.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xJeaEndPoint' end - def dscmeta_resource_name; 'MSFT_xJeaEndpoint' end - def dscmeta_module_name; 'xJea' end - def dscmeta_module_version; '0.3.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Name of the JEA toolkit to be generated" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Toolkit - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_toolkit, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Toolkit - List of Jea Toolkits to make available via this endpoint" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: SecurityDescriptorSddl - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_securitydescriptorsddl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SecurityDescriptorSddl - Sddl to define who can access this JeaEndpoint" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Group - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_group, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Group - List of local groups that this Endpoints JeaSessionAccount should be a member of" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: CleanAll - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_cleanall) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "CleanAll" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xjeaendpoint).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xjeatoolkit.rb b/lib/puppet/type/dsc_xjeatoolkit.rb deleted file mode 100644 index 7034999a..00000000 --- a/lib/puppet/type/dsc_xjeatoolkit.rb +++ /dev/null @@ -1,156 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xjeatoolkit) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xJeaToolKit resource type. - Automatically generated from - 'xJea/DSCResources/MSFT_xJeaToolkit/MSFT_xJeaToolkit.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xJeaToolKit' end - def dscmeta_resource_name; 'MSFT_xJeaToolkit' end - def dscmeta_module_name; 'xJea' end - def dscmeta_module_version; '0.3.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Name of the JEA toolkit to be generated" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CommandSpecs - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_commandspecs) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CommandSpecs - CSV formated list of command specifications" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ScriptDirectory - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_scriptdirectory, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ScriptDirectory - array of script directories that can be run" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: Applications - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_applications, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Applications - Array of executables that are allowed to run" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xjeatoolkit).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xmicrosoftupdate.rb b/lib/puppet/type/dsc_xmicrosoftupdate.rb deleted file mode 100644 index ba1e6b32..00000000 --- a/lib/puppet/type/dsc_xmicrosoftupdate.rb +++ /dev/null @@ -1,90 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xmicrosoftupdate) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xMicrosoftUpdate resource type. - Automatically generated from - 'xWindowsUpdate/DscResources/MSFT_xMicrosoftUpdate/MSFT_xMicrosoftUpdate.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_ensure is a required attribute') if self[:dsc_ensure].nil? - end - - def dscmeta_resource_friendly_name; 'xMicrosoftUpdate' end - def dscmeta_resource_name; 'MSFT_xMicrosoftUpdate' end - def dscmeta_module_name; 'xWindowsUpdate' end - def dscmeta_module_version; '2.7.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: True - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Indicates that the Microsoft Update is enabled or is disabled. Valid values are Present, Absent." - isrequired - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xmicrosoftupdate).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xmountimage.rb b/lib/puppet/type/dsc_xmountimage.rb deleted file mode 100644 index 899480b8..00000000 --- a/lib/puppet/type/dsc_xmountimage.rb +++ /dev/null @@ -1,156 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xmountimage) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xMountImage resource type. - Automatically generated from - 'xStorage/DSCResources/MSFT_xMountImage/MSFT_xMountImage.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_imagepath is a required attribute') if self[:dsc_imagepath].nil? - end - - def dscmeta_resource_friendly_name; 'xMountImage' end - def dscmeta_resource_name; 'MSFT_xMountImage' end - def dscmeta_module_name; 'xStorage' end - def dscmeta_module_version; '3.2.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: ImagePath - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_imagepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ImagePath - Specifies the path of the VHD or ISO file." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DriveLetter - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_driveletter) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DriveLetter - Specifies the drive letter to mount this VHD or ISO to." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: StorageType - # Type: string - # IsMandatory: False - # Values: ["ISO", "VHD", "VHDx", "VHDSet"] - newparam(:dsc_storagetype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "StorageType - Specifies the storage type of a file. If the StorageType parameter is not specified, then the storage type is determined by file extension. Valid values are ISO, VHD, VHDx, VHDSet." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['ISO', 'iso', 'VHD', 'vhd', 'VHDx', 'vhdx', 'VHDSet', 'vhdset'].include?(value) - fail("Invalid value '#{value}'. Valid values are ISO, VHD, VHDx, VHDSet") - end - end - end - - # Name: Access - # Type: string - # IsMandatory: False - # Values: ["ReadOnly", "ReadWrite"] - newparam(:dsc_access) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Access - Allows a VHD file to be mounted in read-only or read-write mode. ISO files are mounted in read-only mode regardless of what parameter value you provide. Valid values are ReadOnly, ReadWrite." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['ReadOnly', 'readonly', 'ReadWrite', 'readwrite'].include?(value) - fail("Invalid value '#{value}'. Valid values are ReadOnly, ReadWrite") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Determines whether the VHD or ISO should be mounted or not. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xmountimage).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xmppreference.rb b/lib/puppet/type/dsc_xmppreference.rb deleted file mode 100644 index 71f113b1..00000000 --- a/lib/puppet/type/dsc_xmppreference.rb +++ /dev/null @@ -1,981 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xmppreference) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xMpPreference resource type. - Automatically generated from - 'xDefender/DSCResources/MSFT_xMpPreference/MSFT_xMpPreference.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xMpPreference' end - def dscmeta_resource_name; 'MSFT_xMpPreference' end - def dscmeta_module_name; 'xDefender' end - def dscmeta_module_version; '0.2.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Provide the text string to uniquely identify this group of settings" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ExclusionPath - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_exclusionpath, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ExclusionPath - Specifies an array of file paths to exclude from scheduled and real-time scanning. You can specify a folder to exclude all the files under the folder." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: ExclusionExtension - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_exclusionextension, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ExclusionExtension - Specifies an array of file name extensions, such as obj or lib, to exclude from scheduled, custom, and real-time scanning." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: ExclusionProcess - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_exclusionprocess, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ExclusionProcess - Specifies an array of processes, as paths to process images. The cmdlet excludes any files opened by the processes that you specify from scheduled and real-time scanning. Specifying this parameter excludes files opened by executable programs only. The cmdlet does not exclude the processes themselves. To exclude a process, specify it by using the ExclusionPath parameter." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: RealTimeScanDirection - # Type: string - # IsMandatory: False - # Values: ["Both", "Incoming", "Outgoing"] - newparam(:dsc_realtimescandirection) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RealTimeScanDirection - Specifies scanning configuration for incoming and outgoing files on NTFS volumes. Specify a value for this parameter to enhance performance on servers which have a large number of file transfers, but need scanning for either incoming or outgoing files. Evaluate this configuration based on the server role. For non-NTFS volumes, Windows Defender performs full monitoring of file and program activity. Valid values are Both, Incoming, Outgoing." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Both', 'both', 'Incoming', 'incoming', 'Outgoing', 'outgoing'].include?(value) - fail("Invalid value '#{value}'. Valid values are Both, Incoming, Outgoing") - end - end - end - - # Name: QuarantinePurgeItemsAfterDelay - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_quarantinepurgeitemsafterdelay) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "QuarantinePurgeItemsAfterDelay - Specifies the number of days to keep items in the Quarantine folder. If you specify a value of zero or do not specify a value for this parameter, items stay in the Quarantine folder indefinitely." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: RemediationScheduleDay - # Type: string - # IsMandatory: False - # Values: ["Everyday", "Never", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"] - newparam(:dsc_remediationscheduleday) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RemediationScheduleDay - Specifies the day of the week on which to perform a scheduled full scan in order to complete remediation. Alternatively, specify everyday for this full scan or never. The default value is Never. If you specify a value of Never or do not specify a value, Windows Defender performs a scheduled full scan to complete remediation by using a default frequency. Valid values are Everyday, Never, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Everyday', 'everyday', 'Never', 'never', 'Monday', 'monday', 'Tuesday', 'tuesday', 'Wednesday', 'wednesday', 'Thursday', 'thursday', 'Friday', 'friday', 'Saturday', 'saturday', 'Sunday', 'sunday'].include?(value) - fail("Invalid value '#{value}'. Valid values are Everyday, Never, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday") - end - end - end - - # Name: RemediationScheduleTime - # Type: datetime - # IsMandatory: False - # Values: None - newparam(:dsc_remediationscheduletime) do - def mof_type; 'datetime' end - def mof_is_embedded?; false end - desc "RemediationScheduleTime - Specifies the time of day, as the number of minutes after midnight, to perform a scheduled scan. The time refers to the local time on the computer. If you do not specify a value for this parameter, a scheduled scan runs at the default time of two hours after midnight." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ReportingAdditionalActionTimeOut - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_reportingadditionalactiontimeout) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "ReportingAdditionalActionTimeOut - Specifies the number of minutes before a detection in the additional action state changes to the cleared state." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ReportingNonCriticalTimeOut - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_reportingnoncriticaltimeout) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "ReportingNonCriticalTimeOut - Specifies the number of minutes before a detection in the non-critically failed state changes to the cleared state." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ReportingCriticalFailureTimeOut - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_reportingcriticalfailuretimeout) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "ReportingCriticalFailureTimeOut - Specifies the number of minutes before a detection in the critically failed state changes to either the additional action state or the cleared state." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ScanAvgCPULoadFactor - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_scanavgcpuloadfactor) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "ScanAvgCPULoadFactor - Specifies the maxium percentage CPU usage for a scan. The acceptable values for this parameter are: integers from 5 through 100, and the value 0, which disables CPU throttling. Windows Defender does not exceed the percentage of CPU usage that you specify. The default value is 50." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: CheckForSignaturesBeforeRunningScan - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_checkforsignaturesbeforerunningscan) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "CheckForSignaturesBeforeRunningScan - Indicates whether to check for new virus and spyware definitions before Windows Defender runs a scan. If you specify a value of $True, Windows Defender checks for new definitions. If you specify $False or do not specify a value, the scan begins with existing definitions. This value applies to scheduled scans and to scans that you start from the command line, but it does not affect scans that you start from the user interface." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ScanPurgeItemsAfterDelay - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_scanpurgeitemsafterdelay) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "ScanPurgeItemsAfterDelay - Specifies the number of days to keep items in the scan history folder. After this time, Windows Defender removes the items. If you specify a value of zero, Windows Defender does not remove items. If you do not specify a value, Windows Defender removes items from the scan history folder after the default length of time, which is 30 days." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ScanOnlyIfIdleEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_scanonlyifidleenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ScanOnlyIfIdleEnabled - Indicates whether to start scheduled scans only when the computer is not in use. If you specify a value of $True or do not specify a value, Windows Defender runs schedules scans when the computer is on, but not in use." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ScanParameters - # Type: string - # IsMandatory: False - # Values: ["FullSCan", "QuickScan"] - newparam(:dsc_scanparameters) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ScanParameters - Specifies the scan type to use during a scheduled scan. If you do not specify this parameter, Windows Defender uses the default value of quick scan. Valid values are FullSCan, QuickScan." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['FullSCan', 'fullscan', 'QuickScan', 'quickscan'].include?(value) - fail("Invalid value '#{value}'. Valid values are FullSCan, QuickScan") - end - end - end - - # Name: ScanScheduleDay - # Type: string - # IsMandatory: False - # Values: ["Everyday", "Never", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"] - newparam(:dsc_scanscheduleday) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ScanScheduleDay - Specifies the day of the week on which to perform a scheduled scan. Alternatively, specify everyday for a scheduled scan or never. If you specify a value of Never or do not specify a value, Windows Defender performs a scheduled scan by using a default frequency. Valid values are Everyday, Never, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Everyday', 'everyday', 'Never', 'never', 'Monday', 'monday', 'Tuesday', 'tuesday', 'Wednesday', 'wednesday', 'Thursday', 'thursday', 'Friday', 'friday', 'Saturday', 'saturday', 'Sunday', 'sunday'].include?(value) - fail("Invalid value '#{value}'. Valid values are Everyday, Never, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday") - end - end - end - - # Name: ScanScheduleQuickScanTime - # Type: datetime - # IsMandatory: False - # Values: None - newparam(:dsc_scanschedulequickscantime) do - def mof_type; 'datetime' end - def mof_is_embedded?; false end - desc "ScanScheduleQuickScanTime - Specifies the time of day, as the number of minutes after midnight, to perform a scheduled quick scan. The time refers to the local time on the computer. If you do not specify a value for this parameter, a scheduled quick scan runs at the time specified by the ScanScheduleTime parameter. That parameter has a default time of two hours after midnight." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ScanScheduleTime - # Type: datetime - # IsMandatory: False - # Values: None - newparam(:dsc_scanscheduletime) do - def mof_type; 'datetime' end - def mof_is_embedded?; false end - desc "ScanScheduleTime - Specifies the time of day, as the number of minutes after midnight, to perform a scheduled scan. The time refers to the local time on the computer. If you do not specify a value for this parameter, a scheduled scan runs at a default time of two hours after midnight." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SignatureFirstAuGracePeriod - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_signaturefirstaugraceperiod) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "SignatureFirstAuGracePeriod - Specifies a grace period, in minutes, for the definition. If a definition successfully updates within this period, Windows Defender abandons any service initiated updates. This parameter overrides the value of the CheckForSignaturesBeforeRunningScan parameter." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: SignatureAuGracePeriod - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_signatureaugraceperiod) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "SignatureAuGracePeriod - Specifies a grace period, in minutes, for the definition. If a definition successfully updates within this period, Windows Defender abandons any service initiated updates." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: SignatureDefinitionUpdateFileSharesSources - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_signaturedefinitionupdatefilesharessources) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SignatureDefinitionUpdateFileSharesSources - Specifies file-share sources for definition updates. Specify sources as a bracketed sequence of Universal Naming Convention (UNC) locations, separated by the pipeline symbol. If you specify a value for this parameter, Windows Defender attempts to connect to the shares in the order that you specify. After Windows Defender updates a definition, it stops attempting to connect to shares on the list. If you do not specify a value for this parameter, the list is empty." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SignatureDisableUpdateOnStartupWithoutEngine - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_signaturedisableupdateonstartupwithoutengine) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "SignatureDisableUpdateOnStartupWithoutEngine - Indicates whether to initiate definition updates even if no antimalware engine is present. If you specify a value of $True or do not specify a value, Windows Defender initiates definition updates on startup. If you specify a value of $False, and if no antimalware engine is present, Windows Defender does not initiate definition updates on startup." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: SignatureFallbackOrder - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_signaturefallbackorder) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SignatureFallbackOrder - Specifies the order in which to contact different definition update sources. Specify the types of update sources in the order in which you want Windows Defender to contact them, enclosed in braces and separated by the pipeline symbol." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SignatureScheduleDay - # Type: string - # IsMandatory: False - # Values: ["Everyday", "Never", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"] - newparam(:dsc_signaturescheduleday) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SignatureScheduleDay - Specifies the day of the week on which to check for definition updates. Alternatively, specify everyday for a scheduled scan or never. If you specify a value of Never or do not specify a value, Windows Defender checks for definition updates by using a default frequency. Valid values are Everyday, Never, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Everyday', 'everyday', 'Never', 'never', 'Monday', 'monday', 'Tuesday', 'tuesday', 'Wednesday', 'wednesday', 'Thursday', 'thursday', 'Friday', 'friday', 'Saturday', 'saturday', 'Sunday', 'sunday'].include?(value) - fail("Invalid value '#{value}'. Valid values are Everyday, Never, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday") - end - end - end - - # Name: SignatureScheduleTime - # Type: datetime - # IsMandatory: False - # Values: None - newparam(:dsc_signaturescheduletime) do - def mof_type; 'datetime' end - def mof_is_embedded?; false end - desc "SignatureScheduleTime - Specifies the time of day, as the number of minutes after midnight, to check for definition updates. The time refers to the local time on the computer. If you do not specify a value for this parameter, Windows Defender checks for definition updates at the default time of 15 minutes before the scheduled scan time." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SignatureUpdateCatchupInterval - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_signatureupdatecatchupinterval) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "SignatureUpdateCatchupInterval - Specifies the number of days after which Windows Defender requires a catch-up definition update. If you do not specify a value for this parameter, Windows Defender requires a catch-up definition update after the default value of one day." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: SignatureUpdateInterval - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_signatureupdateinterval) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "SignatureUpdateInterval - Specifies the interval, in hours, at which to check for definition updates. The acceptable values for this parameter are: integers from 1 through 24. If you do not specify a value for this parameter, Windows Defender checks at the default interval. You can use this parameter instead of the SignatureScheduleDay parameter and SignatureScheduleTime parameter. " - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MAPSReporting - # Type: string - # IsMandatory: False - # Values: ["Advanced", "Basic", "Disabled"] - newparam(:dsc_mapsreporting) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MAPSReporting - Specifies the type of membership in Microsoft Active Protection Service. Microsoft Active Protection Service is an online community that helps you choose how to respond to potential threats. The community also helps prevent the spread of new malicious software. If you join this community, you can choose to automatically send basic or additional information about detected software. Additional information helps Microsoft create new definitions. In some instances, personal information might unintentionally be sent to Microsoft. However, Microsoft will not use this information to identify you or contact you. Valid values are Advanced, Basic, Disabled." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Advanced', 'advanced', 'Basic', 'basic', 'Disabled', 'disabled'].include?(value) - fail("Invalid value '#{value}'. Valid values are Advanced, Basic, Disabled") - end - end - end - - # Name: DisablePrivacyMode - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_disableprivacymode) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DisablePrivacyMode - Indicates whether to disable privacy mode. Privacy mode prevents users, other than administrators, from displaying threat history." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: RandomizeScheduleTaskTimes - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_randomizescheduletasktimes) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RandomizeScheduleTaskTimes - Indicates whether to select a random time for the scheduled start and scheduled update for definitions. If you specify a value of $True or do not specify a value, scheduled tasks begin within 30 minutes, before or after, the scheduled time. If you randomize the start times, it can distribute the impact of scanning. For example, if several virtual machines share the same host, randomized start times prevents all the hosts from starting the scheduled tasks at the same time." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DisableBehaviorMonitoring - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_disablebehaviormonitoring) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DisableBehaviorMonitoring - Indicates whether to enable behavior monitoring. If you specify a value of $True or do not specify a value, Windows Defender enables behavior monitoring" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DisableIntrusionPreventionSystem - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_disableintrusionpreventionsystem) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DisableIntrusionPreventionSystem - Indicates whether to configure network protection against exploitation of known vulnerabilities. If you specify a value of $True or do not specify a value, network protection is enabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DisableIOAVProtection - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_disableioavprotection) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DisableIOAVProtection - Indicates whether Windows Defender scans all downloaded files and attachments. If you specify a value of $True or do not specify a value, scanning downloaded files and attachments is enabled. " - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DisableRealtimeMonitoring - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_disablerealtimemonitoring) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DisableRealtimeMonitoring - Indicates whether to use real-time protection. If you specify a value of $True or do not specify a value, Windows Defender uses real-time protection. We recommend that you enable Windows Defender to use real-time protection." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DisableScriptScanning - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_disablescriptscanning) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DisableScriptScanning - Specifies whether to disable the scanning of scripts during malware scans." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DisableArchiveScanning - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_disablearchivescanning) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DisableArchiveScanning - Indicates whether to scan archive files, such as .zip and .cab files, for malicious and unwanted software. If you specify a value of $True or do not specify a value, Windows Defender scans archive files." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DisableAutoExclusions - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_disableautoexclusions) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DisableAutoExclusions - Indicates whether to disable the Automatic Exclusions feature for the server." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DisableCatchupFullScan - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_disablecatchupfullscan) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DisableCatchupFullScan - Indicates whether Windows Defender runs catch-up scans for scheduled full scans. A computer can miss a scheduled scan, usually because the computer is turned off at the scheduled time. If you specify a value of $True, after the computer misses two scheduled full scans, Windows Defender runs a catch-up scan the next time someone logs on to the computer. If you specify a value of $False or do not specify a value, the computer does not run catch-up scans for scheduled full scans." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DisableCatchupQuickScan - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_disablecatchupquickscan) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DisableCatchupQuickScan - Indicates whether Windows Defender runs catch-up scans for scheduled quick scans. A computer can miss a scheduled scan, usually because the computer is off at the scheduled time. If you specify a value of $True, after the computer misses two scheduled quick scans, Windows Defender runs a catch-up scan the next time someone logs onto the computer. If you specify a value of $False or do not specify a value, the computer does not run catch-up scans for scheduled quick scans. " - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DisableEmailScanning - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_disableemailscanning) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DisableEmailScanning - Indicates whether Windows Defender parses the mailbox and mail files, according to their specific format, in order to analyze mail bodies and attachments. Windows Defender supports several formats, including .pst, .dbx, .mbx, .mime, and .binhex. If you specify a value of $True, Windows Defender performs email scanning. If you specify a value of $False or do not specify a value, Windows Defender does not perform email scanning. " - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DisableRemovableDriveScanning - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_disableremovabledrivescanning) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DisableRemovableDriveScanning - Indicates whether to scan for malicious and unwanted software in removable drives, such as flash drives, during a full scan. If you specify a value of $True, Windows Defender scans removable drives during any type of scan. If you specify a value of $False or do not specify a value, Windows Defender does not scan removable drives during a full scan. Windows Defender can still scan removable drives during quick scans or custom scans." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DisableRestorePoint - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_disablerestorepoint) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DisableRestorePoint - Indicates whether to disable scanning of restore points." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DisableScanningMappedNetworkDrivesForFullScan - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_disablescanningmappednetworkdrivesforfullscan) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DisableScanningMappedNetworkDrivesForFullScan - Indicates whether to scan mapped network drives. If you specify a value of $True, Windows Defender scans mapped network drives. If you specify a value of $False or do not specify a value, Windows Defender does not scan mapped network drives." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DisableScanningNetworkFiles - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_disablescanningnetworkfiles) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DisableScanningNetworkFiles - Indicates whether to scan for network files. If you specify a value of $True, Windows Defender scans network files. If you specify a value of $False or do not specify a value, Windows Defender does not scan network files. We do not recommend that you scan network files." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: UILockdown - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_uilockdown) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "UILockdown - Indicates whether to disable UI lockdown mode. If you specify a value of $True, Windows Defender disables UI lockdown mode. If you specify $False or do not specify a value, UI lockdown mode is enabled." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ThreatIDDefaultAction_Ids - # Type: uint64 - # IsMandatory: False - # Values: None - newparam(:dsc_threatiddefaultaction_ids) do - def mof_type; 'uint64' end - def mof_is_embedded?; false end - desc "ThreatIDDefaultAction_Ids - Specifies an array of the actions to take for the IDs specified by using the ThreatIDDefaultAction_Ids parameter." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ThreatIDDefaultAction_Actions - # Type: string - # IsMandatory: False - # Values: ["Allow", "Block", "Clean", "NoAction", "Quarantine", "Remove", "UserDefined"] - newparam(:dsc_threatiddefaultaction_actions) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ThreatIDDefaultAction_Actions - Specifies which automatic remediation action to take for an unknonwn level threat. Valid values are Allow, Block, Clean, NoAction, Quarantine, Remove, UserDefined." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Allow', 'allow', 'Block', 'block', 'Clean', 'clean', 'NoAction', 'noaction', 'Quarantine', 'quarantine', 'Remove', 'remove', 'UserDefined', 'userdefined'].include?(value) - fail("Invalid value '#{value}'. Valid values are Allow, Block, Clean, NoAction, Quarantine, Remove, UserDefined") - end - end - end - - # Name: UnknownThreatDefaultAction - # Type: string - # IsMandatory: False - # Values: ["Allow", "Block", "Clean", "NoAction", "Quarantine", "Remove", "UserDefined"] - newparam(:dsc_unknownthreatdefaultaction) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UnknownThreatDefaultAction - Specifies which automatic remediation action to take for a low level threat. Valid values are Allow, Block, Clean, NoAction, Quarantine, Remove, UserDefined." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Allow', 'allow', 'Block', 'block', 'Clean', 'clean', 'NoAction', 'noaction', 'Quarantine', 'quarantine', 'Remove', 'remove', 'UserDefined', 'userdefined'].include?(value) - fail("Invalid value '#{value}'. Valid values are Allow, Block, Clean, NoAction, Quarantine, Remove, UserDefined") - end - end - end - - # Name: LowThreatDefaultAction - # Type: string - # IsMandatory: False - # Values: ["Allow", "Block", "Clean", "NoAction", "Quarantine", "Remove", "UserDefined"] - newparam(:dsc_lowthreatdefaultaction) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LowThreatDefaultAction - Specifies which automatic remediation action to take for a low level threat. Valid values are Allow, Block, Clean, NoAction, Quarantine, Remove, UserDefined." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Allow', 'allow', 'Block', 'block', 'Clean', 'clean', 'NoAction', 'noaction', 'Quarantine', 'quarantine', 'Remove', 'remove', 'UserDefined', 'userdefined'].include?(value) - fail("Invalid value '#{value}'. Valid values are Allow, Block, Clean, NoAction, Quarantine, Remove, UserDefined") - end - end - end - - # Name: ModerateThreatDefaultAction - # Type: string - # IsMandatory: False - # Values: ["Allow", "Block", "Clean", "NoAction", "Quarantine", "Remove", "UserDefined"] - newparam(:dsc_moderatethreatdefaultaction) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ModerateThreatDefaultAction - Specifies which automatic remediation action to take for a moderate level threat. Valid values are Allow, Block, Clean, NoAction, Quarantine, Remove, UserDefined." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Allow', 'allow', 'Block', 'block', 'Clean', 'clean', 'NoAction', 'noaction', 'Quarantine', 'quarantine', 'Remove', 'remove', 'UserDefined', 'userdefined'].include?(value) - fail("Invalid value '#{value}'. Valid values are Allow, Block, Clean, NoAction, Quarantine, Remove, UserDefined") - end - end - end - - # Name: HighThreatDefaultAction - # Type: string - # IsMandatory: False - # Values: ["Allow", "Block", "Clean", "NoAction", "Quarantine", "Remove", "UserDefined"] - newparam(:dsc_highthreatdefaultaction) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "HighThreatDefaultAction - Specifies which automatic remediation action to take for a high level threat. Valid values are Allow, Block, Clean, NoAction, Quarantine, Remove, UserDefined." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Allow', 'allow', 'Block', 'block', 'Clean', 'clean', 'NoAction', 'noaction', 'Quarantine', 'quarantine', 'Remove', 'remove', 'UserDefined', 'userdefined'].include?(value) - fail("Invalid value '#{value}'. Valid values are Allow, Block, Clean, NoAction, Quarantine, Remove, UserDefined") - end - end - end - - # Name: SevereThreatDefaultAction - # Type: string - # IsMandatory: False - # Values: ["Allow", "Block", "Clean", "NoAction", "Quarantine", "Remove", "UserDefined"] - newparam(:dsc_severethreatdefaultaction) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SevereThreatDefaultAction - Specifies which automatic remediation action to take for a severe level threat. Valid values are Allow, Block, Clean, NoAction, Quarantine, Remove, UserDefined." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Allow', 'allow', 'Block', 'block', 'Clean', 'clean', 'NoAction', 'noaction', 'Quarantine', 'quarantine', 'Remove', 'remove', 'UserDefined', 'userdefined'].include?(value) - fail("Invalid value '#{value}'. Valid values are Allow, Block, Clean, NoAction, Quarantine, Remove, UserDefined") - end - end - end - - # Name: SubmitSamplesConsent - # Type: string - # IsMandatory: False - # Values: ["Allways Prompt", "Send safe samples automatically", "Never send", "Send all samples automatically"] - newparam(:dsc_submitsamplesconsent) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SubmitSamplesConsent - Specifies how Windows Defender checks for user consent for certain samples. If consent has previously been granted, Windows Defender submits the samples. Otherwise, if the MAPSReporting parameter does not have a value of Disabled, Windows Defender prompts the user for consent. Valid values are Allways Prompt, Send safe samples automatically, Never send, Send all samples automatically." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Allways Prompt', 'allways prompt', 'Send safe samples automatically', 'send safe samples automatically', 'Never send', 'never send', 'Send all samples automatically', 'send all samples automatically'].include?(value) - fail("Invalid value '#{value}'. Valid values are Allways Prompt, Send safe samples automatically, Never send, Send all samples automatically") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xmppreference).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xmsipackage.rb b/lib/puppet/type/dsc_xmsipackage.rb deleted file mode 100644 index 409d0f14..00000000 --- a/lib/puppet/type/dsc_xmsipackage.rb +++ /dev/null @@ -1,368 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xmsipackage) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xMsiPackage resource type. - Automatically generated from - 'xPSDesiredStateConfiguration/DSCResources/MSFT_xMsiPackage/MSFT_xMsiPackage.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_productid is a required attribute') if self[:dsc_productid].nil? - end - - def dscmeta_resource_friendly_name; 'xMsiPackage' end - def dscmeta_resource_name; 'MSFT_xMsiPackage' end - def dscmeta_module_name; 'xPSDesiredStateConfiguration' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: ProductId - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_productid) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProductId - The identifying number used to find the package, usually a GUID." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Path - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_path) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Path - The path to the MSI file that should be installed or uninstalled." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies whether or not the MSI file should be installed or uninstalled. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Arguments - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_arguments) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Arguments - The arguments to be passed to the MSI package during installation or uninstallation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential - The credential of a user account to be used to mount a UNC path if needed." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: LogPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_logpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogPath - The path to the log file to log the output from the MSI execution." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: FileHash - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_filehash) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FileHash - The expected hash value of the MSI file at the given path." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: HashAlgorithm - # Type: string - # IsMandatory: False - # Values: ["SHA1", "SHA256", "SHA384", "SHA512", "MD5", "RIPEMD160"] - newparam(:dsc_hashalgorithm) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "HashAlgorithm - The algorithm used to generate the given hash value. Valid values are SHA1, SHA256, SHA384, SHA512, MD5, RIPEMD160." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['SHA1', 'sha1', 'SHA256', 'sha256', 'SHA384', 'sha384', 'SHA512', 'sha512', 'MD5', 'md5', 'RIPEMD160', 'ripemd160'].include?(value) - fail("Invalid value '#{value}'. Valid values are SHA1, SHA256, SHA384, SHA512, MD5, RIPEMD160") - end - end - end - - # Name: SignerSubject - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_signersubject) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SignerSubject - The subject that should match the signer certificate of the digital signature of the MSI file." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SignerThumbprint - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_signerthumbprint) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SignerThumbprint - The certificate thumbprint that should match the signer certificate of the digital signature of the MSI file." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ServerCertificateValidationCallback - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_servercertificatevalidationcallback) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServerCertificateValidationCallback - PowerShell code that should be used to validate SSL certificates for paths using HTTPS." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_runascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "RunAsCredential - The credential of a user account under which to run the installation or uninstallation of the MSI package." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("RunAsCredential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The display name of the MSI package." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstallSource - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_installsource) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstallSource - The path to the MSI package." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstalledOn - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_installedon) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstalledOn - The date that the MSI package was installed on or serviced on, whichever is later." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Size - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_size) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "Size - The size of the MSI package in MB." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: Version - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_version) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Version - The version number of the MSI package." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: PackageDescription - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_packagedescription) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "PackageDescription - The description of the MSI package." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Publisher - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_publisher) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Publisher - The publisher of the MSI package." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xmsipackage).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xmysqldatabase.rb b/lib/puppet/type/dsc_xmysqldatabase.rb deleted file mode 100644 index f70ee8a2..00000000 --- a/lib/puppet/type/dsc_xmysqldatabase.rb +++ /dev/null @@ -1,136 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xmysqldatabase) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xMySqlDatabase resource type. - Automatically generated from - 'xMySql/DscResources/MSFT_xMySqlDatabase/MSFT_xMySqlDatabase.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_databasename is a required attribute') if self[:dsc_databasename].nil? - end - - def dscmeta_resource_friendly_name; 'xMySqlDatabase' end - def dscmeta_resource_name; 'MSFT_xMySqlDatabase' end - def dscmeta_module_name; 'xMySql' end - def dscmeta_module_version; '2.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: DatabaseName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_databasename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseName - Name of the database." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Should the database be present or absent. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: RootCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_rootcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "RootCredential - The root credential that is used to install MySql server." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("RootCredential", value) - end - end - - # Name: MySqlVersion - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_mysqlversion) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MySqlVersion - MYSql Version Number" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xmysqldatabase).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xmysqlgrant.rb b/lib/puppet/type/dsc_xmysqlgrant.rb deleted file mode 100644 index 34f865d7..00000000 --- a/lib/puppet/type/dsc_xmysqlgrant.rb +++ /dev/null @@ -1,173 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xmysqlgrant) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xMySqlGrant resource type. - Automatically generated from - 'xMySql/DscResources/MSFT_xMySqlGrant/MSFT_xMySqlGrant.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_username is a required attribute') if self[:dsc_username].nil? - fail('dsc_databasename is a required attribute') if self[:dsc_databasename].nil? - fail('dsc_permissiontype is a required attribute') if self[:dsc_permissiontype].nil? - end - - def dscmeta_resource_friendly_name; 'xMySqlGrant' end - def dscmeta_resource_name; 'MSFT_xMySqlGrant' end - def dscmeta_module_name; 'xMySql' end - def dscmeta_module_version; '2.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: UserName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_username) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UserName - Name of MySQL user." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_databasename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseName - MySql database name to grant permissions." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RootCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_rootcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "RootCredential - MySql connection credential used for the root." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("RootCredential", value) - end - end - - # Name: PermissionType - # Type: string - # IsMandatory: True - # Values: ["ALL PRIVILEGES", "CREATE", "DROP", "DELETE", "INSERT", "SELECT", "UPDATE", "EXECUTE"] - newparam(:dsc_permissiontype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "PermissionType - MySql user permission type. Valid values are ALL PRIVILEGES, CREATE, DROP, DELETE, INSERT, SELECT, UPDATE, EXECUTE." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['ALL PRIVILEGES', 'all privileges', 'CREATE', 'create', 'DROP', 'drop', 'DELETE', 'delete', 'INSERT', 'insert', 'SELECT', 'select', 'UPDATE', 'update', 'EXECUTE', 'execute'].include?(value) - fail("Invalid value '#{value}'. Valid values are ALL PRIVILEGES, CREATE, DROP, DELETE, INSERT, SELECT, UPDATE, EXECUTE") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Ensure given grant to mySql database present or absent. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: MySqlVersion - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_mysqlversion) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MySqlVersion - MYSql Version Number" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xmysqlgrant).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xmysqlserver.rb b/lib/puppet/type/dsc_xmysqlserver.rb deleted file mode 100644 index c6962069..00000000 --- a/lib/puppet/type/dsc_xmysqlserver.rb +++ /dev/null @@ -1,136 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xmysqlserver) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xMySqlServer resource type. - Automatically generated from - 'xMySql/DscResources/MSFT_xMySqlServer/MSFT_xMySqlServer.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_mysqlversion is a required attribute') if self[:dsc_mysqlversion].nil? - end - - def dscmeta_resource_friendly_name; 'xMySqlServer' end - def dscmeta_resource_name; 'MSFT_xMySqlServer' end - def dscmeta_module_name; 'xMySql' end - def dscmeta_module_version; '2.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: MySqlVersion - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_mysqlversion) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MySqlVersion - mySql Version Number" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Ensure server is present or absent Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: RootPassword - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_rootpassword) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "RootPassword - The root credential that is used to install mySql server." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("RootPassword", value) - end - end - - # Name: Port - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_port) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Port - The port number for the service" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xmysqlserver).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xmysqluser.rb b/lib/puppet/type/dsc_xmysqluser.rb deleted file mode 100644 index e7c0e44b..00000000 --- a/lib/puppet/type/dsc_xmysqluser.rb +++ /dev/null @@ -1,152 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xmysqluser) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xMySqlUser resource type. - Automatically generated from - 'xMySql/DscResources/MSFT_xMySqlUser/MSFT_xMySqlUser.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_username is a required attribute') if self[:dsc_username].nil? - end - - def dscmeta_resource_friendly_name; 'xMySqlUser' end - def dscmeta_resource_name; 'MSFT_xMySqlUser' end - def dscmeta_module_name; 'xMySql' end - def dscmeta_module_version; '2.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: UserName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_username) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UserName - Name of MySQL user to create or remove." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UserCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_usercredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "UserCredential - Credential for MySQL user." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("UserCredential", value) - end - end - - # Name: RootCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_rootcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "RootCredential - MySQL root credential used to create a user." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("RootCredential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Ensure MySQL user is present or absent. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: MySqlVersion - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_mysqlversion) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MySqlVersion - MySQL Version Number" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xmysqluser).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xnetadapterbinding.rb b/lib/puppet/type/dsc_xnetadapterbinding.rb deleted file mode 100644 index 1caf6a7a..00000000 --- a/lib/puppet/type/dsc_xnetadapterbinding.rb +++ /dev/null @@ -1,138 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xnetadapterbinding) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xNetAdapterBinding resource type. - Automatically generated from - 'xNetworking/DSCResources/MSFT_xNetAdapterBinding/MSFT_xNetAdapterBinding.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_interfacealias is a required attribute') if self[:dsc_interfacealias].nil? - fail('dsc_componentid is a required attribute') if self[:dsc_componentid].nil? - end - - def dscmeta_resource_friendly_name; 'xNetAdapterBinding' end - def dscmeta_resource_name; 'MSFT_xNetAdapterBinding' end - def dscmeta_module_name; 'xNetworking' end - def dscmeta_module_version; '5.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: InterfaceAlias - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_interfacealias) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InterfaceAlias - Specifies the alias of a network interface. Supports the use of '*'." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ComponentId - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_componentid) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ComponentId - Specifies the underlying name of the transport or filter in the following form - ms_xxxx, such as ms_tcpip." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: State - # Type: string - # IsMandatory: False - # Values: ["Enabled", "Disabled"] - newparam(:dsc_state) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "State - Specifies if the component ID for the Interface should be Enabled or Disabled. Valid values are Enabled, Disabled." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Enabled', 'enabled', 'Disabled', 'disabled'].include?(value) - fail("Invalid value '#{value}'. Valid values are Enabled, Disabled") - end - end - end - - # Name: CurrentState - # Type: string - # IsMandatory: False - # Values: ["Enabled", "Disabled", "Mixed"] - newparam(:dsc_currentstate) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CurrentState - Returns the current state of the component ID for the Interfaces. Valid values are Enabled, Disabled, Mixed." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Enabled', 'enabled', 'Disabled', 'disabled', 'Mixed', 'mixed'].include?(value) - fail("Invalid value '#{value}'. Valid values are Enabled, Disabled, Mixed") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xnetadapterbinding).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xnetadapterlso.rb b/lib/puppet/type/dsc_xnetadapterlso.rb deleted file mode 100644 index aeb621cc..00000000 --- a/lib/puppet/type/dsc_xnetadapterlso.rb +++ /dev/null @@ -1,119 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xnetadapterlso) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xNetAdapterLso resource type. - Automatically generated from - 'xNetworking/DSCResources/MSFT_xNetAdapterLso/MSFT_xNetAdapterLso.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xNetAdapterLso' end - def dscmeta_resource_name; 'MSFT_xNetAdapterLso' end - def dscmeta_module_name; 'xNetworking' end - def dscmeta_module_version; '5.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Specifies the name of network adapter." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Protocol - # Type: string - # IsMandatory: False - # Values: ["V1IPv4", "IPv4", "IPv6"] - newparam(:dsc_protocol) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Protocol - Specifies which protocol to make changes to. Valid values are V1IPv4, IPv4, IPv6." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['V1IPv4', 'v1ipv4', 'IPv4', 'ipv4', 'IPv6', 'ipv6'].include?(value) - fail("Invalid value '#{value}'. Valid values are V1IPv4, IPv4, IPv6") - end - end - end - - # Name: State - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_state) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "State - Specifies whether LSO should be enabled or disabled." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xnetadapterlso).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xnetadaptername.rb b/lib/puppet/type/dsc_xnetadaptername.rb deleted file mode 100644 index d303679a..00000000 --- a/lib/puppet/type/dsc_xnetadaptername.rb +++ /dev/null @@ -1,245 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xnetadaptername) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xNetAdapterName resource type. - Automatically generated from - 'xNetworking/DSCResources/MSFT_xNetAdapterName/MSFT_xNetAdapterName.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_newname is a required attribute') if self[:dsc_newname].nil? - end - - def dscmeta_resource_friendly_name; 'xNetAdapterName' end - def dscmeta_resource_name; 'MSFT_xNetAdapterName' end - def dscmeta_module_name; 'xNetworking' end - def dscmeta_module_version; '5.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: NewName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_newname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "NewName - Specifies the new name of the network adapter." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Name - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - This is the name of the network adapter to find." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: PhysicalMediaType - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_physicalmediatype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "PhysicalMediaType - This is the media type of the network adapter to find." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Status - # Type: string - # IsMandatory: False - # Values: ["Up", "Disconnected", "Disabled"] - newparam(:dsc_status) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Status - This is the status of the network adapter to find. Valid values are Up, Disconnected, Disabled." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Up', 'up', 'Disconnected', 'disconnected', 'Disabled', 'disabled'].include?(value) - fail("Invalid value '#{value}'. Valid values are Up, Disconnected, Disabled") - end - end - end - - # Name: MacAddress - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_macaddress) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MacAddress - This is the MAC address of the network adapter to find." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InterfaceDescription - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_interfacedescription) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InterfaceDescription - This is the interface description of the network adapter to find." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InterfaceIndex - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_interfaceindex) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "InterfaceIndex - This is the interface index of the network adapter to find." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: InterfaceGuid - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_interfaceguid) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InterfaceGuid - This is the interface GUID of the network adapter to find." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DriverDescription - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_driverdescription) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DriverDescription - This is the driver description of the network adapter." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InterfaceNumber - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_interfacenumber) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "InterfaceNumber - This is the interface number of the network adapter if more than one are returned by the parameters." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: IgnoreMultipleMatchingAdapters - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_ignoremultiplematchingadapters) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "IgnoreMultipleMatchingAdapters - This switch will suppress an error occurring if more than one matching adapter matches the parameters passed." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xnetadaptername).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xnetadapterrdma.rb b/lib/puppet/type/dsc_xnetadapterrdma.rb deleted file mode 100644 index 5784c989..00000000 --- a/lib/puppet/type/dsc_xnetadapterrdma.rb +++ /dev/null @@ -1,101 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xnetadapterrdma) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xNetAdapterRDMA resource type. - Automatically generated from - 'xNetworking/DSCResources/MSFT_xNetAdapterRDMA/MSFT_xNetAdapterRDMA.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xNetAdapterRDMA' end - def dscmeta_resource_name; 'MSFT_xNetAdapterRDMA' end - def dscmeta_module_name; 'xNetworking' end - def dscmeta_module_version; '5.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Specifies the name of network adapter for which RDMA needs to be configured." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Enabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_enabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Enabled - Specifies whether RDMA is enabled or disabled." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xnetadapterrdma).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xnetbios.rb b/lib/puppet/type/dsc_xnetbios.rb deleted file mode 100644 index b469a6f3..00000000 --- a/lib/puppet/type/dsc_xnetbios.rb +++ /dev/null @@ -1,103 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xnetbios) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xNetBIOS resource type. - Automatically generated from - 'xNetworking/DSCResources/MSFT_xNetBIOS/MSFT_xNetBIOS.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_interfacealias is a required attribute') if self[:dsc_interfacealias].nil? - end - - def dscmeta_resource_friendly_name; 'xNetBIOS' end - def dscmeta_resource_name; 'MSFT_xNetBIOS' end - def dscmeta_module_name; 'xNetworking' end - def dscmeta_module_version; '5.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: InterfaceAlias - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_interfacealias) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InterfaceAlias - Specifies the alias of a network interface." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Setting - # Type: string - # IsMandatory: False - # Values: ["Default", "Enable", "Disable"] - newparam(:dsc_setting) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Setting - Default - Use NetBios settings from the DHCP server. If static IP, Enable NetBIOS. Valid values are Default, Enable, Disable." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Default', 'default', 'Enable', 'enable', 'Disable', 'disable'].include?(value) - fail("Invalid value '#{value}'. Valid values are Default, Enable, Disable") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xnetbios).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xnetconnectionprofile.rb b/lib/puppet/type/dsc_xnetconnectionprofile.rb deleted file mode 100644 index 67810df7..00000000 --- a/lib/puppet/type/dsc_xnetconnectionprofile.rb +++ /dev/null @@ -1,139 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xnetconnectionprofile) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xNetConnectionProfile resource type. - Automatically generated from - 'xNetworking/DSCResources/MSFT_xNetConnectionProfile/MSFT_xNetConnectionProfile.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_interfacealias is a required attribute') if self[:dsc_interfacealias].nil? - end - - def dscmeta_resource_friendly_name; 'xNetConnectionProfile' end - def dscmeta_resource_name; 'MSFT_xNetConnectionProfile' end - def dscmeta_module_name; 'xNetworking' end - def dscmeta_module_version; '5.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: InterfaceAlias - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_interfacealias) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InterfaceAlias - Specifies the alias for the Interface that is being changed." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: IPv4Connectivity - # Type: string - # IsMandatory: False - # Values: ["Disconnected", "NoTraffic", "Subnet", "LocalNetwork", "Internet"] - newparam(:dsc_ipv4connectivity) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IPv4Connectivity - Sets the Network Category for the interface. Valid values are Disconnected, NoTraffic, Subnet, LocalNetwork, Internet." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Disconnected', 'disconnected', 'NoTraffic', 'notraffic', 'Subnet', 'subnet', 'LocalNetwork', 'localnetwork', 'Internet', 'internet'].include?(value) - fail("Invalid value '#{value}'. Valid values are Disconnected, NoTraffic, Subnet, LocalNetwork, Internet") - end - end - end - - # Name: IPv6Connectivity - # Type: string - # IsMandatory: False - # Values: ["Disconnected", "NoTraffic", "Subnet", "LocalNetwork", "Internet"] - newparam(:dsc_ipv6connectivity) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IPv6Connectivity - Specifies the IPv4 Connection Value. Valid values are Disconnected, NoTraffic, Subnet, LocalNetwork, Internet." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Disconnected', 'disconnected', 'NoTraffic', 'notraffic', 'Subnet', 'subnet', 'LocalNetwork', 'localnetwork', 'Internet', 'internet'].include?(value) - fail("Invalid value '#{value}'. Valid values are Disconnected, NoTraffic, Subnet, LocalNetwork, Internet") - end - end - end - - # Name: NetworkCategory - # Type: string - # IsMandatory: False - # Values: ["Public", "Private"] - newparam(:dsc_networkcategory) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "NetworkCategory - Specifies the IPv6 Connection Value. Valid values are Public, Private." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Public', 'public', 'Private', 'private'].include?(value) - fail("Invalid value '#{value}'. Valid values are Public, Private") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xnetconnectionprofile).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xnetworkteam.rb b/lib/puppet/type/dsc_xnetworkteam.rb deleted file mode 100644 index ab21c64f..00000000 --- a/lib/puppet/type/dsc_xnetworkteam.rb +++ /dev/null @@ -1,159 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xnetworkteam) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xNetworkTeam resource type. - Automatically generated from - 'xNetworking/DSCResources/MSFT_xNetworkTeam/MSFT_xNetworkTeam.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xNetworkTeam' end - def dscmeta_resource_name; 'MSFT_xNetworkTeam' end - def dscmeta_module_name; 'xNetworking' end - def dscmeta_module_version; '5.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Specifies the name of the network team to create." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: TeamMembers - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_teammembers, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "TeamMembers - Specifies the network interfaces that should be a part of the network team. This is a comma-separated list." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: TeamingMode - # Type: string - # IsMandatory: False - # Values: ["SwitchIndependent", "LACP", "Static"] - newparam(:dsc_teamingmode) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TeamingMode - Specifies the teaming mode configuration. Valid values are SwitchIndependent, LACP, Static." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['SwitchIndependent', 'switchindependent', 'LACP', 'lacp', 'Static', 'static'].include?(value) - fail("Invalid value '#{value}'. Valid values are SwitchIndependent, LACP, Static") - end - end - end - - # Name: LoadBalancingAlgorithm - # Type: string - # IsMandatory: False - # Values: ["Dynamic", "HyperVPort", "IPAddresses", "MacAddresses", "TransportPorts"] - newparam(:dsc_loadbalancingalgorithm) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LoadBalancingAlgorithm - Specifies the load balancing algorithm for the network team. Valid values are Dynamic, HyperVPort, IPAddresses, MacAddresses, TransportPorts." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Dynamic', 'dynamic', 'HyperVPort', 'hypervport', 'IPAddresses', 'ipaddresses', 'MacAddresses', 'macaddresses', 'TransportPorts', 'transportports'].include?(value) - fail("Invalid value '#{value}'. Valid values are Dynamic, HyperVPort, IPAddresses, MacAddresses, TransportPorts") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies if the network team should be created or deleted. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xnetworkteam).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xnetworkteaminterface.rb b/lib/puppet/type/dsc_xnetworkteaminterface.rb deleted file mode 100644 index 5f2d9a36..00000000 --- a/lib/puppet/type/dsc_xnetworkteaminterface.rb +++ /dev/null @@ -1,138 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xnetworkteaminterface) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xNetworkTeamInterface resource type. - Automatically generated from - 'xNetworking/DSCResources/MSFT_xNetworkTeamInterface/MSFT_xNetworkTeamInterface.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xNetworkTeamInterface' end - def dscmeta_resource_name; 'MSFT_xNetworkTeamInterface' end - def dscmeta_module_name; 'xNetworking' end - def dscmeta_module_version; '5.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Specifies the name of the network team interface to create." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: TeamName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_teamname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TeamName - Specifies the name of the network team on which this particular interface should exist." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: VlanID - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_vlanid) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "VlanID - Specifies VlanID to be set on network team interface." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies if the network team interface should be created or deleted. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xnetworkteaminterface).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xofflinedomainjoin.rb b/lib/puppet/type/dsc_xofflinedomainjoin.rb deleted file mode 100644 index f4b7bda1..00000000 --- a/lib/puppet/type/dsc_xofflinedomainjoin.rb +++ /dev/null @@ -1,103 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xofflinedomainjoin) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xOfflineDomainJoin resource type. - Automatically generated from - 'xComputerManagement/DSCResources/MSFT_xOfflineDomainJoin/MSFT_xOfflineDomainJoin.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_issingleinstance is a required attribute') if self[:dsc_issingleinstance].nil? - end - - def dscmeta_resource_friendly_name; 'xOfflineDomainJoin' end - def dscmeta_resource_name; 'MSFT_xOfflineDomainJoin' end - def dscmeta_module_name; 'xComputerManagement' end - def dscmeta_module_version; '2.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: IsSingleInstance - # Type: string - # IsMandatory: True - # Values: ["Yes"] - newparam(:dsc_issingleinstance) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes' Valid values are Yes." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Yes', 'yes'].include?(value) - fail("Invalid value '#{value}'. Valid values are Yes") - end - end - end - - # Name: RequestFile - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_requestfile) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RequestFile - The full path to the Offline Domain Join Request file to use." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xofflinedomainjoin).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xpackage.rb b/lib/puppet/type/dsc_xpackage.rb deleted file mode 100644 index 0bf42195..00000000 --- a/lib/puppet/type/dsc_xpackage.rb +++ /dev/null @@ -1,469 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xpackage) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xPackage resource type. - Automatically generated from - 'xPSDesiredStateConfiguration/DSCResources/MSFT_xPackageResource/MSFT_xPackageResource.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - fail('dsc_productid is a required attribute') if self[:dsc_productid].nil? - end - - def dscmeta_resource_friendly_name; 'xPackage' end - def dscmeta_resource_name; 'MSFT_xPackageResource' end - def dscmeta_module_name; 'xPSDesiredStateConfiguration' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Path - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_path) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Path" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ProductId - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_productid) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProductId" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Arguments - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_arguments) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Arguments" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: ReturnCode - # Type: uint32[] - # IsMandatory: False - # Values: None - newparam(:dsc_returncode, :array_matching => :all) do - def mof_type; 'uint32[]' end - def mof_is_embedded?; false end - desc "ReturnCode" - validate do |value| - unless value.kind_of?(Array) || (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value '#{value}'. Should be an integer or an array of integers") - end - end - munge do |value| - v = PuppetX::Dsc::TypeHelpers.munge_integer(value) - v.is_a?(Array) ? v : Array(v) - end - end - - # Name: LogPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_logpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: PackageDescription - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_packagedescription) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "PackageDescription" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Publisher - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_publisher) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Publisher" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstalledOn - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_installedon) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstalledOn" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Size - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_size) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "Size" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: Version - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_version) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Version" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Installed - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_installed) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Installed" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: FileHash - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_filehash) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FileHash" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: HashAlgorithm - # Type: string - # IsMandatory: False - # Values: ["SHA1", "SHA256", "SHA384", "SHA512", "MD5", "RIPEMD160"] - newparam(:dsc_hashalgorithm) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "HashAlgorithm - Valid values are SHA1, SHA256, SHA384, SHA512, MD5, RIPEMD160." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['SHA1', 'sha1', 'SHA256', 'sha256', 'SHA384', 'sha384', 'SHA512', 'sha512', 'MD5', 'md5', 'RIPEMD160', 'ripemd160'].include?(value) - fail("Invalid value '#{value}'. Valid values are SHA1, SHA256, SHA384, SHA512, MD5, RIPEMD160") - end - end - end - - # Name: SignerSubject - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_signersubject) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SignerSubject" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SignerThumbprint - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_signerthumbprint) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SignerThumbprint" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ServerCertificateValidationCallback - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_servercertificatevalidationcallback) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServerCertificateValidationCallback" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstalledCheckRegHive - # Type: string - # IsMandatory: False - # Values: ["LocalMachine", "CurrentUser"] - newparam(:dsc_installedcheckreghive) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstalledCheckRegHive - Valid values are LocalMachine, CurrentUser." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['LocalMachine', 'localmachine', 'CurrentUser', 'currentuser'].include?(value) - fail("Invalid value '#{value}'. Valid values are LocalMachine, CurrentUser") - end - end - end - - # Name: InstalledCheckRegKey - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_installedcheckregkey) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstalledCheckRegKey" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstalledCheckRegValueName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_installedcheckregvaluename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstalledCheckRegValueName" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstalledCheckRegValueData - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_installedcheckregvaluedata) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstalledCheckRegValueData" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CreateCheckRegValue - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_createcheckregvalue) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "CreateCheckRegValue" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: RunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_runascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "RunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("RunAsCredential", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xpackage).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xpendingreboot.rb b/lib/puppet/type/dsc_xpendingreboot.rb deleted file mode 100644 index 8c29b36b..00000000 --- a/lib/puppet/type/dsc_xpendingreboot.rb +++ /dev/null @@ -1,245 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xpendingreboot) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xPendingReboot resource type. - Automatically generated from - 'xPendingReboot/DSCResources/MSFT_xPendingReboot/MSFT_xPendingReboot.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xPendingReboot' end - def dscmeta_resource_name; 'MSFT_xPendingReboot' end - def dscmeta_module_name; 'xPendingReboot' end - def dscmeta_module_version; '0.3.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Name of this pending reboot check" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SkipComponentBasedServicing - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_skipcomponentbasedservicing) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "SkipComponentBasedServicing - Specifies whether to skip reboots triggered by the Component-Based Servicing component" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ComponentBasedServicing - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_componentbasedservicing) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ComponentBasedServicing - A value indicating whether the Component-Based Servicing component requested a reboot" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: SkipWindowsUpdate - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_skipwindowsupdate) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "SkipWindowsUpdate - Specifies whether to skip reboots triggered by Windows Update" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: WindowsUpdate - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_windowsupdate) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "WindowsUpdate - A value indicating whether Windows Update requested a reboot" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: SkipPendingFileRename - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_skippendingfilerename) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "SkipPendingFileRename - Specifies whether to skip pending file rename reboots" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: PendingFileRename - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_pendingfilerename) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "PendingFileRename - A value indicating whether a pending file rename triggered a reboot" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: SkipPendingComputerRename - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_skippendingcomputerrename) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "SkipPendingComputerRename - Specifies whether to skip reboots triggered by a pending computer rename" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: PendingComputerRename - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_pendingcomputerrename) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "PendingComputerRename - A value indicating whether a pending computer rename triggered a reboot" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: SkipCcmClientSDK - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_skipccmclientsdk) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "SkipCcmClientSDK - Specifies whether to skip reboots triggered by the ConfigMgr client" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: CcmClientSDK - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_ccmclientsdk) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "CcmClientSDK - A value indicating whether the ConfigMgr client triggered a reboot" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xpendingreboot).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xpfximport.rb b/lib/puppet/type/dsc_xpfximport.rb deleted file mode 100644 index 6b901687..00000000 --- a/lib/puppet/type/dsc_xpfximport.rb +++ /dev/null @@ -1,189 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xpfximport) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xPfxImport resource type. - Automatically generated from - 'xCertificate/DSCResources/MSFT_xPfxImport/MSFT_xPfxImport.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_thumbprint is a required attribute') if self[:dsc_thumbprint].nil? - fail('dsc_location is a required attribute') if self[:dsc_location].nil? - fail('dsc_store is a required attribute') if self[:dsc_store].nil? - end - - def dscmeta_resource_friendly_name; 'xPfxImport' end - def dscmeta_resource_name; 'MSFT_xPfxImport' end - def dscmeta_module_name; 'xCertificate' end - def dscmeta_module_version; '3.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Thumbprint - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_thumbprint) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Thumbprint - The thumbprint (unique identifier) of the PFX file you're importing." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Path - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_path) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Path - The path to the PFX file you want to import." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Location - # Type: string - # IsMandatory: True - # Values: ["LocalMachine", "CurrentUser"] - newparam(:dsc_location) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Location - The Windows Certificate Store Location to import the PFX file to. Valid values are LocalMachine, CurrentUser." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['LocalMachine', 'localmachine', 'CurrentUser', 'currentuser'].include?(value) - fail("Invalid value '#{value}'. Valid values are LocalMachine, CurrentUser") - end - end - end - - # Name: Store - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_store) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Store - The Windows Certificate Store Name to import the PFX file to." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Exportable - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_exportable) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Exportable - Determines whether the private key is exportable from the machine after it has been imported" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential - A [PSCredential] object that is used to decrypt the PFX file." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies whether the PFX file should be present or absent. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xpfximport).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xpowerplan.rb b/lib/puppet/type/dsc_xpowerplan.rb deleted file mode 100644 index 6dac3b6f..00000000 --- a/lib/puppet/type/dsc_xpowerplan.rb +++ /dev/null @@ -1,103 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xpowerplan) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xPowerPlan resource type. - Automatically generated from - 'xComputerManagement/DSCResources/MSFT_xPowerPlan/MSFT_xPowerPlan.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_issingleinstance is a required attribute') if self[:dsc_issingleinstance].nil? - end - - def dscmeta_resource_friendly_name; 'xPowerPlan' end - def dscmeta_resource_name; 'MSFT_xPowerPlan' end - def dscmeta_module_name; 'xComputerManagement' end - def dscmeta_module_version; '2.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: IsSingleInstance - # Type: string - # IsMandatory: True - # Values: ["Yes"] - newparam(:dsc_issingleinstance) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes' Valid values are Yes." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Yes', 'yes'].include?(value) - fail("Invalid value '#{value}'. Valid values are Yes") - end - end - end - - # Name: Name - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the power plan to activate." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xpowerplan).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xpowershellexecutionpolicy.rb b/lib/puppet/type/dsc_xpowershellexecutionpolicy.rb deleted file mode 100644 index 60f302d6..00000000 --- a/lib/puppet/type/dsc_xpowershellexecutionpolicy.rb +++ /dev/null @@ -1,88 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xpowershellexecutionpolicy) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xPowerShellExecutionPolicy resource type. - Automatically generated from - 'xPowerShellExecutionPolicy/DSCResources/MSFT_xPowerShellExecutionPolicy/MSFT_xPowerShellExecutionPolicy.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_executionpolicy is a required attribute') if self[:dsc_executionpolicy].nil? - end - - def dscmeta_resource_friendly_name; 'xPowerShellExecutionPolicy' end - def dscmeta_resource_name; 'MSFT_xPowerShellExecutionPolicy' end - def dscmeta_module_name; 'xPowerShellExecutionPolicy' end - def dscmeta_module_version; '1.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: ExecutionPolicy - # Type: string - # IsMandatory: True - # Values: ["Bypass", "Restricted", "AllSigned", "RemoteSigned", "Unrestricted"] - newparam(:dsc_executionpolicy) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ExecutionPolicy - Changes the user preference for the Windows PowerShell execution policy. Valid values are Bypass, Restricted, AllSigned, RemoteSigned, Unrestricted." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Bypass', 'bypass', 'Restricted', 'restricted', 'AllSigned', 'allsigned', 'RemoteSigned', 'remotesigned', 'Unrestricted', 'unrestricted'].include?(value) - fail("Invalid value '#{value}'. Valid values are Bypass, Restricted, AllSigned, RemoteSigned, Unrestricted") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xpowershellexecutionpolicy).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xpsendpoint.rb b/lib/puppet/type/dsc_xpsendpoint.rb deleted file mode 100644 index e301f5a8..00000000 --- a/lib/puppet/type/dsc_xpsendpoint.rb +++ /dev/null @@ -1,169 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xpsendpoint) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xPSEndpoint resource type. - Automatically generated from - 'xPSDesiredStateConfiguration/DSCResources/MSFT_xPSSessionConfiguration/MSFT_xPSSessionConfiguration.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xPSEndpoint' end - def dscmeta_resource_name; 'MSFT_xPSSessionConfiguration' end - def dscmeta_module_name; 'xPSDesiredStateConfiguration' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Name of the PS Remoting Endpoint" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Whether to create the endpoint or delete it Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: StartupScript - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_startupscript) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "StartupScript - Path for the startup script" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_runascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "RunAsCredential - Credential for Running under different user context" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("RunAsCredential", value) - end - end - - # Name: SecurityDescriptorSDDL - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_securitydescriptorsddl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SecurityDescriptorSDDL - SDDL for allowed users to connect to this endpoint" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AccessMode - # Type: string - # IsMandatory: False - # Values: ["Local", "Remote", "Disabled"] - newparam(:dsc_accessmode) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AccessMode - Whether the endpoint is remotely accessible or has local access only or no access Valid values are Local, Remote, Disabled." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Local', 'local', 'Remote', 'remote', 'Disabled', 'disabled'].include?(value) - fail("Invalid value '#{value}'. Valid values are Local, Remote, Disabled") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xpsendpoint).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xrdremoteapp.rb b/lib/puppet/type/dsc_xrdremoteapp.rb deleted file mode 100644 index b5aa356f..00000000 --- a/lib/puppet/type/dsc_xrdremoteapp.rb +++ /dev/null @@ -1,260 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xrdremoteapp) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xRDRemoteApp resource type. - Automatically generated from - 'xRemoteDesktopSessionHost/DSCResources/MSFT_xRDRemoteApp/MSFT_xRDRemoteApp.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_alias is a required attribute') if self[:dsc_alias].nil? - fail('dsc_collectionname is a required attribute') if self[:dsc_collectionname].nil? - fail('dsc_displayname is a required attribute') if self[:dsc_displayname].nil? - fail('dsc_filepath is a required attribute') if self[:dsc_filepath].nil? - end - - def dscmeta_resource_friendly_name; 'xRDRemoteApp' end - def dscmeta_resource_name; 'MSFT_xRDRemoteApp' end - def dscmeta_module_name; 'xRemoteDesktopSessionHost' end - def dscmeta_module_version; '1.4.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Alias - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_alias) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Alias - Specifies an alias for the RemoteApp program." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CollectionName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_collectionname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CollectionName - Specifies the name of the personal virtual desktop collection or session collection. The cmdlet publishes the RemoteApp program to this collection. " - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DisplayName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_displayname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DisplayName - Specifies a name to display to users for the RemoteApp program." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: FilePath - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_filepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FilePath - Specifies a path for the executable file for the application. Do not include any environment variables." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: FileVirtualPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_filevirtualpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FileVirtualPath - Specifies a path for the application executable file. This path resolves to the same location as the value of the FilePath parameter, but it can include environment variables. " - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: FolderName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_foldername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FolderName - Specifies the name of the folder that the RemoteApp program appears in on the Remote Desktop Web Access (RD Web Access) webpage and in the Start menu for subscribed RemoteApp and Desktop Connections. " - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CommandLineSetting - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_commandlinesetting) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CommandLineSetting - Specifies whether the RemoteApp program accepts command-line arguments from the client at connection time. The acceptable values for this parameter are: Allow, DoNotAllow, Require" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RequiredCommandLine - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_requiredcommandline) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RequiredCommandLine - Specifies a string that contains command-line arguments that the client can use at connection time with the RemoteApp program. " - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: IconIndex - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_iconindex) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "IconIndex - Specifies the index within the icon file (specified by the IconPath parameter) where the RemoteApp program's icon can be found." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: IconPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_iconpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IconPath - Specifies the path to a file containing the icon to display for the RemoteApp program identified by the Alias parameter." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UserGroups - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_usergroups) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UserGroups - Specifies a domain group that can view the RemoteApp in RD Web Access, and in RemoteApp and Desktop Connections. To allow all users to see a RemoteApp program, provide a value of Null." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ShowInWebAccess - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_showinwebaccess) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ShowInWebAccess - Specifies whether to show the RemoteApp program in the RD Web Access server, and in RemoteApp and Desktop Connections that the user subscribes to. " - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xrdremoteapp).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xrdsessioncollection.rb b/lib/puppet/type/dsc_xrdsessioncollection.rb deleted file mode 100644 index ce68d2e4..00000000 --- a/lib/puppet/type/dsc_xrdsessioncollection.rb +++ /dev/null @@ -1,132 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xrdsessioncollection) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xRDSessionCollection resource type. - Automatically generated from - 'xRemoteDesktopSessionHost/DSCResources/MSFT_xRDSessionCollection/MSFT_xRDSessionCollection.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_collectionname is a required attribute') if self[:dsc_collectionname].nil? - fail('dsc_sessionhost is a required attribute') if self[:dsc_sessionhost].nil? - end - - def dscmeta_resource_friendly_name; 'xRDSessionCollection' end - def dscmeta_resource_name; 'MSFT_xRDSessionCollection' end - def dscmeta_module_name; 'xRemoteDesktopSessionHost' end - def dscmeta_module_version; '1.4.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: CollectionName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_collectionname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CollectionName - Specifies a name for the session collection. " - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SessionHost - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_sessionhost) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SessionHost - Specifies an RD Session Host server to include in the session collection. " - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CollectionDescription - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_collectiondescription) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CollectionDescription - Specifies a description for the collection." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ConnectionBroker - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_connectionbroker) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ConnectionBroker - Specifies the Remote Desktop Connection Broker (RD Connection Broker) server for a Remote Desktop deployment." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xrdsessioncollection).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xrdsessioncollectionconfiguration.rb b/lib/puppet/type/dsc_xrdsessioncollectionconfiguration.rb deleted file mode 100644 index 3b086965..00000000 --- a/lib/puppet/type/dsc_xrdsessioncollectionconfiguration.rb +++ /dev/null @@ -1,373 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xrdsessioncollectionconfiguration) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xRDSessionCollectionConfiguration resource type. - Automatically generated from - 'xRemoteDesktopSessionHost/DSCResources/MSFT_xRDSessionCollectionConfiguration/MSFT_xRDSessionCollectionConfiguration.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_collectionname is a required attribute') if self[:dsc_collectionname].nil? - end - - def dscmeta_resource_friendly_name; 'xRDSessionCollectionConfiguration' end - def dscmeta_resource_name; 'MSFT_xRDSessionCollectionConfiguration' end - def dscmeta_module_name; 'xRemoteDesktopSessionHost' end - def dscmeta_module_version; '1.4.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: CollectionName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_collectionname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CollectionName - Specifies the name of a session collection. " - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ActiveSessionLimitMin - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_activesessionlimitmin) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "ActiveSessionLimitMin - Specifies the maximum time, in minutes, an active session runs. After this period, the RD Session Host server ends the session. " - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: AuthenticateUsingNLA - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_authenticateusingnla) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AuthenticateUsingNLA - Indicates whether to use Network Level Authentication (NLA). If this value is $True, Remote Desktop uses NLA to authenticate a user before the user sees a logon screen. " - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AutomaticReconnectionEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_automaticreconnectionenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AutomaticReconnectionEnabled - Indicates whether the Remote Desktop client attempts to reconnect after a connection interruption. " - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: BrokenConnectionAction - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_brokenconnectionaction) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "BrokenConnectionAction - Specifies an action for an RD Session Host server to take after a connection interruption. The acceptable values for this parameter are: None, Disconnect, LogOff." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ClientDeviceRedirectionOptions - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_clientdeviceredirectionoptions) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ClientDeviceRedirectionOptions - Specifies a type of client device to be redirected to an RD Session Host server in this session collection. The acceptable values for this parameter are: None, AudioVideoPlayBack, AudioRecording, COMPort, PlugAndPlayDevice, SmartCard, Clipboard, LPTPort, Drive, TimeZone. You can use binary-or to combine two or more values of this enum to specify multiple client device types." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ClientPrinterAsDefault - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_clientprinterasdefault) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ClientPrinterAsDefault - Indicates whether to use the client printer or server printer as the default printer. If this value is $True, use the client printer as default. If this value is $False, use the server as default." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ClientPrinterRedirected - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_clientprinterredirected) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ClientPrinterRedirected - Indicates whether to use client printer redirection, which routes print jobs from the Remote Desktop session to a printer attached to the client computer." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: CollectionDescription - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_collectiondescription) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CollectionDescription - Specifies a description of the session collection. " - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ConnectionBroker - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_connectionbroker) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ConnectionBroker - Specifies the Remote Desktop Connection Broker (RD Connection Broker) server for a Remote Desktop deployment." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CustomRdpProperty - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_customrdpproperty) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CustomRdpProperty - Specifies Remote Desktop Protocol (RDP) settings to include in the .rdp files for all Windows Server 2012 RemoteApp programs and remote desktops published in this collection. " - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DisconnectedSessionLimitMin - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_disconnectedsessionlimitmin) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "DisconnectedSessionLimitMin - Specifies a length of time, in minutes. After client disconnection from a session for this period, the RD Session Host ends the session." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: EncryptionLevel - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_encryptionlevel) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "EncryptionLevel - Specifies the level of data encryption used for a Remote Desktop session. The acceptable values for this parameter are: Low, ClientCompatible, High, FipsCompliant. The default value is ClientCompatible." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: IdleSessionLimitMin - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_idlesessionlimitmin) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "IdleSessionLimitMin - Specifies the length of time, in minutes, to wait before an RD Session Host logs off or disconnects an idle session. The BrokenConnectionAction parameter determines whether to log off or disconnect. " - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MaxRedirectedMonitors - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_maxredirectedmonitors) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "MaxRedirectedMonitors - Specifies the maximum number of client monitors that an RD Session Host server can redirect to a remote session. The highest value for this parameter is 16." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: RDEasyPrintDriverEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_rdeasyprintdriverenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RDEasyPrintDriverEnabled - Specifies whether to enable the Remote Desktop Easy Print driver." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: SecurityLayer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_securitylayer) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SecurityLayer - Specifies which security protocol to use. The acceptable values for this parameter are: RDP, Negotiate, SSL. The default value is Negotiate." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: TemporaryFoldersDeletedOnExit - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_temporaryfoldersdeletedonexit) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "TemporaryFoldersDeletedOnExit - Specifies whether to delete temporary folders from the RD Session Host server for a disconnected session. " - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: UserGroup - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_usergroup) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UserGroup - Specifies a domain group authorized to connect to the RD Session Host servers in a session collection. " - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xrdsessioncollectionconfiguration).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xrdsessiondeployment.rb b/lib/puppet/type/dsc_xrdsessiondeployment.rb deleted file mode 100644 index 09674990..00000000 --- a/lib/puppet/type/dsc_xrdsessiondeployment.rb +++ /dev/null @@ -1,119 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xrdsessiondeployment) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xRDSessionDeployment resource type. - Automatically generated from - 'xRemoteDesktopSessionHost/DSCResources/MSFT_xRDSessionDeployment/MSFT_xRDSessionDeployment.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_sessionhost is a required attribute') if self[:dsc_sessionhost].nil? - fail('dsc_connectionbroker is a required attribute') if self[:dsc_connectionbroker].nil? - fail('dsc_webaccessserver is a required attribute') if self[:dsc_webaccessserver].nil? - end - - def dscmeta_resource_friendly_name; 'xRDSessionDeployment' end - def dscmeta_resource_name; 'MSFT_xRDSessionDeployment' end - def dscmeta_module_name; 'xRemoteDesktopSessionHost' end - def dscmeta_module_version; '1.4.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: SessionHost - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_sessionhost) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SessionHost - Specifies the FQDN of a server to host the RD Session Host role service. " - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ConnectionBroker - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_connectionbroker) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ConnectionBroker - Specifies the FQDN of a server to host the RD Connection Broker role service." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: WebAccessServer - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_webaccessserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WebAccessServer - Specifies the FQDN of a server to host the RD Web Access role service. " - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xrdsessiondeployment).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xregistry.rb b/lib/puppet/type/dsc_xregistry.rb deleted file mode 100644 index b00c5449..00000000 --- a/lib/puppet/type/dsc_xregistry.rb +++ /dev/null @@ -1,190 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xregistry) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xRegistry resource type. - Automatically generated from - 'xPSDesiredStateConfiguration/DSCResources/MSFT_xRegistryResource/MSFT_xRegistryResource.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_key is a required attribute') if self[:dsc_key].nil? - fail('dsc_valuename is a required attribute') if self[:dsc_valuename].nil? - end - - def dscmeta_resource_friendly_name; 'xRegistry' end - def dscmeta_resource_name; 'MSFT_xRegistryResource' end - def dscmeta_module_name; 'xPSDesiredStateConfiguration' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Key - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_key) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Key - The path of the registry key to add, modify, or remove. This path must include the registry hive/drive." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ValueName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_valuename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ValueName - The name of the registry value. To add or remove a registry key, specify this property as an empty string without specifying ValueType or ValueData. To modify or remove the default value of a registry key, specify this property as an empty string while also specifying ValueType or ValueData." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ValueData - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_valuedata, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ValueData - The data the specified registry key value should have as a string or an array of strings (MultiString only)." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: ValueType - # Type: string - # IsMandatory: False - # Values: ["String", "Binary", "DWord", "QWord", "MultiString", "ExpandString"] - newparam(:dsc_valuetype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ValueType - The type the specified registry key value should have. Valid values are String, Binary, DWord, QWord, MultiString, ExpandString." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['String', 'string', 'Binary', 'binary', 'DWord', 'dword', 'QWord', 'qword', 'MultiString', 'multistring', 'ExpandString', 'expandstring'].include?(value) - fail("Invalid value '#{value}'. Valid values are String, Binary, DWord, QWord, MultiString, ExpandString") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies whether or not the registry key or value should exist. To add or modify a registry key or value, set this property to Present. To remove a registry key or value, set the property to Absent. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Hex - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_hex) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Hex - Specifies whether or not the specified DWord or QWord registry key data is provided in a hexadecimal format. Not valid for types other than DWord and QWord. The default value is $false." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Force - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_force) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Force - Specifies whether or not to overwrite the specified registry key value if it already has a value or whether or not to delete a registry key that has subkeys. The default value is $false." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xregistry).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xremotedesktopadmin.rb b/lib/puppet/type/dsc_xremotedesktopadmin.rb deleted file mode 100644 index 24396d47..00000000 --- a/lib/puppet/type/dsc_xremotedesktopadmin.rb +++ /dev/null @@ -1,108 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xremotedesktopadmin) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xRemoteDesktopAdmin resource type. - Automatically generated from - 'xRemoteDesktopAdmin/DSCResources/xRemoteDesktopAdmin/xRemoteDesktopAdmin.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_ensure is a required attribute') if self[:dsc_ensure].nil? - end - - def dscmeta_resource_friendly_name; 'xRemoteDesktopAdmin' end - def dscmeta_resource_name; 'xRemoteDesktopAdmin' end - def dscmeta_module_name; 'xRemoteDesktopAdmin' end - def dscmeta_module_version; '1.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: True - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Determines whether or not the computer should accept remote connections. Present sets the value to Enabled and Absent sets the value to Disabled. Valid values are Present, Absent." - isrequired - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: UserAuthentication - # Type: string - # IsMandatory: False - # Values: ["Secure", "NonSecure"] - newparam(:dsc_userauthentication) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UserAuthentication - User Authentication. Setting this value to Secure configures the machine to require NLA. Valid values are Secure, NonSecure." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Secure', 'secure', 'NonSecure', 'nonsecure'].include?(value) - fail("Invalid value '#{value}'. Valid values are Secure, NonSecure") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xremotedesktopadmin).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xremotefile.rb b/lib/puppet/type/dsc_xremotefile.rb deleted file mode 100644 index f9173afc..00000000 --- a/lib/puppet/type/dsc_xremotefile.rb +++ /dev/null @@ -1,231 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xremotefile) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xRemoteFile resource type. - Automatically generated from - 'xPSDesiredStateConfiguration/DSCResources/MSFT_xRemoteFile/MSFT_xRemoteFile.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_destinationpath is a required attribute') if self[:dsc_destinationpath].nil? - end - - def dscmeta_resource_friendly_name; 'xRemoteFile' end - def dscmeta_resource_name; 'MSFT_xRemoteFile' end - def dscmeta_module_name; 'xPSDesiredStateConfiguration' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: DestinationPath - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_destinationpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DestinationPath - Path under which downloaded or copied file should be accessible after operation." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Uri - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_uri) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Uri - Uri of a file which should be copied or downloaded. This parameter supports HTTP and HTTPS values." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UserAgent - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_useragent) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UserAgent - User agent for the web request." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Headers - # Type: MSFT_KeyValuePair[] - # IsMandatory: False - # Values: None - newparam(:dsc_headers) do - def mof_type; 'MSFT_KeyValuePair[]' end - def mof_is_embedded?; true end - desc "Headers - Headers of the web request." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential - Specifies a user account that has permission to send the request." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: MatchSource - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_matchsource) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "MatchSource - A boolean value to indicate whether the remote file should be re-downloaded if the file in the DestinationPath was modified locally." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: TimeoutSec - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_timeoutsec) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "TimeoutSec - Specifies how long the request can be pending before it times out." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: Proxy - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_proxy) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Proxy - Uses a proxy server for the request, rather than connecting directly to the Internet resource. Should be the URI of a network proxy server (e.g 'http://10.20.30.1')." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ProxyCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_proxycredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "ProxyCredential - Specifies a user account that has permission to use the proxy server that is specified by the Proxy parameter." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("ProxyCredential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Says whether DestinationPath exists on the machine Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xremotefile).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xrobocopy.rb b/lib/puppet/type/dsc_xrobocopy.rb deleted file mode 100644 index 0e8bc10a..00000000 --- a/lib/puppet/type/dsc_xrobocopy.rb +++ /dev/null @@ -1,285 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xrobocopy) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xRobocopy resource type. - Automatically generated from - 'xRobocopy/DSCResources/MSFT_xRobocopy/MSFT_xRobocopy.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_source is a required attribute') if self[:dsc_source].nil? - fail('dsc_destination is a required attribute') if self[:dsc_destination].nil? - end - - def dscmeta_resource_friendly_name; 'xRobocopy' end - def dscmeta_resource_name; 'MSFT_xRobocopy' end - def dscmeta_module_name; 'xRobocopy' end - def dscmeta_module_version; '2.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Source - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_source) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Source - Source Directory, Drive or UNC path." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Destination - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_destination) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Destination - Destination Dir, Drive or UNC path." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Files - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_files) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Files - File(s) to copy (names/wildcards: default is all files)." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Retry - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_retry) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "Retry - Number of Retries on failed copies: default 1 million." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: Wait - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_wait) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "Wait - Wait time between retries: default is 30 seconds." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: SubdirectoriesIncludingEmpty - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_subdirectoriesincludingempty) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "SubdirectoriesIncludingEmpty - Copy subdirectories, including Empty ones." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Restartable - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_restartable) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Restartable - Copy files in restartable mode." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: MultiThreaded - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_multithreaded) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "MultiThreaded - Do multi-threaded copies with n threads (default 8). N must be at least 1 and not greater than 128. This option is incompatible with the /IPG and /EFSRAW options. Redirect output using /LOG option for better performance." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ExcludeFiles - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_excludefiles) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ExcludeFiles - Exclude Files matching given names/paths/wildcards." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: LogOutput - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_logoutput) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogOutput - Output status to LOG file." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AppendLog - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_appendlog) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AppendLog - Determine whether to overwrite log file or append." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AdditionalArgs - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_additionalargs, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "AdditionalArgs - Robocopy has MANY configuration options. Too many to present them all as DSC parameters effectively. Use this option to set additional parameters. Each parameter should be a separate array member. This array will be combined with main argument array. For a list of options run Robocopy /??? in a shell window." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Will indicate whether Destination is in sync with Source Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xrobocopy).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xroute.rb b/lib/puppet/type/dsc_xroute.rb deleted file mode 100644 index a8b770f7..00000000 --- a/lib/puppet/type/dsc_xroute.rb +++ /dev/null @@ -1,210 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xroute) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xRoute resource type. - Automatically generated from - 'xNetworking/DSCResources/MSFT_xRoute/MSFT_xRoute.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_interfacealias is a required attribute') if self[:dsc_interfacealias].nil? - fail('dsc_addressfamily is a required attribute') if self[:dsc_addressfamily].nil? - fail('dsc_destinationprefix is a required attribute') if self[:dsc_destinationprefix].nil? - fail('dsc_nexthop is a required attribute') if self[:dsc_nexthop].nil? - end - - def dscmeta_resource_friendly_name; 'xRoute' end - def dscmeta_resource_name; 'MSFT_xRoute' end - def dscmeta_module_name; 'xNetworking' end - def dscmeta_module_version; '5.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: InterfaceAlias - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_interfacealias) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InterfaceAlias - Specifies the alias of a network interface." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AddressFamily - # Type: string - # IsMandatory: True - # Values: ["IPv4", "IPv6"] - newparam(:dsc_addressfamily) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AddressFamily - Specifies the IP address family. Valid values are IPv4, IPv6." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['IPv4', 'ipv4', 'IPv6', 'ipv6'].include?(value) - fail("Invalid value '#{value}'. Valid values are IPv4, IPv6") - end - end - end - - # Name: DestinationPrefix - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_destinationprefix) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DestinationPrefix - Specifies a destination prefix of an IP route. A destination prefix consists of an IP address prefix and a prefix length, separated by a slash (/)." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: NextHop - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_nexthop) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "NextHop - Specifies the next hop for the IP route." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies whether the route should exist. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: RouteMetric - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_routemetric) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "RouteMetric - Specifies an integer route metric for an IP route." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: Publish - # Type: string - # IsMandatory: False - # Values: ["No", "Yes", "Age"] - newparam(:dsc_publish) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Publish - Specifies the publish setting of an IP route. Valid values are No, Yes, Age." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['No', 'no', 'Yes', 'yes', 'Age', 'age'].include?(value) - fail("Invalid value '#{value}'. Valid values are No, Yes, Age") - end - end - end - - # Name: PreferredLifetime - # Type: real64 - # IsMandatory: False - # Values: None - newparam(:dsc_preferredlifetime) do - def mof_type; 'real64' end - def mof_is_embedded?; false end - desc "PreferredLifetime - Specifies a preferred lifetime in seconds of an IP route." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xroute).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xscdpmconsolesetup.rb b/lib/puppet/type/dsc_xscdpmconsolesetup.rb deleted file mode 100644 index 1ebeb84d..00000000 --- a/lib/puppet/type/dsc_xscdpmconsolesetup.rb +++ /dev/null @@ -1,136 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xscdpmconsolesetup) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSCDPMConsoleSetup resource type. - Automatically generated from - 'xSCDPM/DSCResources/MSFT_xSCDPMConsoleSetup/MSFT_xSCDPMConsoleSetup.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_ensure is a required attribute') if self[:dsc_ensure].nil? - end - - def dscmeta_resource_friendly_name; 'xSCDPMConsoleSetup' end - def dscmeta_resource_name; 'MSFT_xSCDPMConsoleSetup' end - def dscmeta_module_name; 'xSCDPM' end - def dscmeta_module_version; '1.2.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: True - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if the DPM console is expected to be installed on the machine.\nPresent {default} \nAbsent \n Valid values are Present, Absent." - isrequired - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: SourcePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourcePath - UNC path to the root of the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SourceFolder - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcefolder) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourceFolder - Folder within the source path containing the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SetupCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_setupcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SetupCredential - Credential to be used to perform the installation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SetupCredential", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xscdpmconsolesetup).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xscdpmdatabaseserversetup.rb b/lib/puppet/type/dsc_xscdpmdatabaseserversetup.rb deleted file mode 100644 index 71104da9..00000000 --- a/lib/puppet/type/dsc_xscdpmdatabaseserversetup.rb +++ /dev/null @@ -1,136 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xscdpmdatabaseserversetup) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSCDPMDatabaseServerSetup resource type. - Automatically generated from - 'xSCDPM/DSCResources/MSFT_xSCDPMDatabaseServerSetup/MSFT_xSCDPMDatabaseServerSetup.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_sourcepath is a required attribute') if self[:dsc_sourcepath].nil? - end - - def dscmeta_resource_friendly_name; 'xSCDPMDatabaseServerSetup' end - def dscmeta_resource_name; 'MSFT_xSCDPMDatabaseServerSetup' end - def dscmeta_module_name; 'xSCDPM' end - def dscmeta_module_version; '1.2.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if the DPM database support files are expected to be installed on the machine.\nPresent {default} \nAbsent \n Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: SourcePath - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_sourcepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourcePath - UNC path to the root of the source files for installation." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SourceFolder - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcefolder) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourceFolder - Folder within the source path containing the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SetupCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_setupcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SetupCredential - Credential to be used to perform the installation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SetupCredential", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xscdpmdatabaseserversetup).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xscdpmserversetup.rb b/lib/puppet/type/dsc_xscdpmserversetup.rb deleted file mode 100644 index 388b7ded..00000000 --- a/lib/puppet/type/dsc_xscdpmserversetup.rb +++ /dev/null @@ -1,288 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xscdpmserversetup) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSCDPMServerSetup resource type. - Automatically generated from - 'xSCDPM/DSCResources/MSFT_xSCDPMServerSetup/MSFT_xSCDPMServerSetup.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_ensure is a required attribute') if self[:dsc_ensure].nil? - end - - def dscmeta_resource_friendly_name; 'xSCDPMServerSetup' end - def dscmeta_resource_name; 'MSFT_xSCDPMServerSetup' end - def dscmeta_module_name; 'xSCDPM' end - def dscmeta_module_version; '1.2.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: True - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if the DPM server is expected to be installed on the machine.\nPresent {default} \nAbsent \n Valid values are Present, Absent." - isrequired - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: SourcePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourcePath - UNC path to the root of the source filesfor installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SourceFolder - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcefolder) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourceFolder - Folder within the source path containing the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SetupCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_setupcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SetupCredential - Credential to be used to perform the installation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SetupCredential", value) - end - end - - # Name: UserName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_username) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UserName - User name that the software will be registered to." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CompanyName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_companyname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CompanyName - Company name that the software will be registered to." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ProductKey - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_productkey) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProductKey - Product key for licensed installations." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ProgramFiles - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_programfiles) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProgramFiles - Installation path for the software." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: YukonMachineName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_yukonmachinename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "YukonMachineName - Name of the SQL server for the DPM database." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: YukonInstanceName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_yukoninstancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "YukonInstanceName - SQL instance for the DPM database." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: YukonMachineCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_yukonmachinecredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "YukonMachineCredential - Credential to be used to access the SQL instance for DPM at installation time." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("YukonMachineCredential", value) - end - end - - # Name: ReportingMachineName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_reportingmachinename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ReportingMachineName - Name of the SQL server for reporting." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ReportingInstanceName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_reportinginstancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ReportingInstanceName - SQL instance for reporting." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ReportingMachineCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_reportingmachinecredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "ReportingMachineCredential - Credential to be used to access SQL reporting for DPM at installation time." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("ReportingMachineCredential", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xscdpmserversetup).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xscheduledtask.rb b/lib/puppet/type/dsc_xscheduledtask.rb deleted file mode 100644 index 7eed1e7f..00000000 --- a/lib/puppet/type/dsc_xscheduledtask.rb +++ /dev/null @@ -1,698 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xscheduledtask) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xScheduledTask resource type. - Automatically generated from - 'xComputerManagement/DSCResources/MSFT_xScheduledTask/MSFT_xScheduledTask.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_taskname is a required attribute') if self[:dsc_taskname].nil? - end - - def dscmeta_resource_friendly_name; 'xScheduledTask' end - def dscmeta_resource_name; 'MSFT_xScheduledTask' end - def dscmeta_module_name; 'xComputerManagement' end - def dscmeta_module_version; '2.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: TaskName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_taskname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TaskName - The name of the task" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: TaskPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_taskpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TaskPath - The path to the task - defaults to the root directory" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Description - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_description) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Description - The task description" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ActionExecutable - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_actionexecutable) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ActionExecutable - The path to the .exe for this task" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ActionArguments - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_actionarguments) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ActionArguments - The arguments to pass the executable" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ActionWorkingPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_actionworkingpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ActionWorkingPath - The working path to specify for the executable" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ScheduleType - # Type: string - # IsMandatory: False - # Values: ["Once", "Daily", "Weekly", "AtStartup", "AtLogOn"] - newparam(:dsc_scheduletype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ScheduleType - When should the task be executed Valid values are Once, Daily, Weekly, AtStartup, AtLogOn." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Once', 'once', 'Daily', 'daily', 'Weekly', 'weekly', 'AtStartup', 'atstartup', 'AtLogOn', 'atlogon'].include?(value) - fail("Invalid value '#{value}'. Valid values are Once, Daily, Weekly, AtStartup, AtLogOn") - end - end - end - - # Name: RepeatInterval - # Type: datetime - # IsMandatory: False - # Values: None - newparam(:dsc_repeatinterval) do - def mof_type; 'datetime' end - def mof_is_embedded?; false end - desc "RepeatInterval - How many units (minutes, hours, days) between each run of this task?" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: StartTime - # Type: datetime - # IsMandatory: False - # Values: None - newparam(:dsc_starttime) do - def mof_type; 'datetime' end - def mof_is_embedded?; false end - desc "StartTime - The time of day this task should start at - defaults to 12:00 AM. Not valid for AtLogon and AtStartup tasks" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Present if the task should exist, Absent if it should be removed Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Enable - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_enable) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Enable - True if the task should be enabled, false if it should be disabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ExecuteAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_executeascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "ExecuteAsCredential - The credential this task should execute as. If not specified defaults to running as the local system account" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("ExecuteAsCredential", value) - end - end - - # Name: DaysInterval - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_daysinterval) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "DaysInterval - Specifies the interval between the days in the schedule. An interval of 1 produces a daily schedule. An interval of 2 produces an every-other day schedule." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: RandomDelay - # Type: datetime - # IsMandatory: False - # Values: None - newparam(:dsc_randomdelay) do - def mof_type; 'datetime' end - def mof_is_embedded?; false end - desc "RandomDelay - Specifies a random amount of time to delay the start time of the trigger. The delay time is a random time between the time the task triggers and the time that you specify in this setting." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RepetitionDuration - # Type: datetime - # IsMandatory: False - # Values: None - newparam(:dsc_repetitionduration) do - def mof_type; 'datetime' end - def mof_is_embedded?; false end - desc "RepetitionDuration - Specifies how long the repetition pattern repeats after the task starts." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DaysOfWeek - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_daysofweek, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "DaysOfWeek - Specifies an array of the days of the week on which Task Scheduler runs the task." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: WeeksInterval - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_weeksinterval) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "WeeksInterval - Specifies the interval between the weeks in the schedule. An interval of 1 produces a weekly schedule. An interval of 2 produces an every-other week schedule." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: User - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_user) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "User - Specifies the identifier of the user for a trigger that starts a task when a user logs on." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DisallowDemandStart - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_disallowdemandstart) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DisallowDemandStart - Indicates whether the task is prohibited to run on demand or not. Defaults to $false" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DisallowHardTerminate - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_disallowhardterminate) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DisallowHardTerminate - Indicates whether the task is prohibited to be terminated or not. Defaults to $false" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Compatibility - # Type: string - # IsMandatory: False - # Values: ["AT", "V1", "Vista", "Win7", "Win8"] - newparam(:dsc_compatibility) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Compatibility - The task compatibility level. Defaults to Vista. Valid values are AT, V1, Vista, Win7, Win8." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['AT', 'at', 'V1', 'v1', 'Vista', 'vista', 'Win7', 'win7', 'Win8', 'win8'].include?(value) - fail("Invalid value '#{value}'. Valid values are AT, V1, Vista, Win7, Win8") - end - end - end - - # Name: AllowStartIfOnBatteries - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowstartifonbatteries) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowStartIfOnBatteries - Indicates whether the task should start if the machine is on batteries or not. Defaults to $false" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Hidden - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_hidden) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Hidden - Indicates that the task is hidden in the Task Scheduler UI." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: RunOnlyIfIdle - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_runonlyifidle) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RunOnlyIfIdle - Indicates that Task Scheduler runs the task only when the computer is idle." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: IdleWaitTimeout - # Type: datetime - # IsMandatory: False - # Values: None - newparam(:dsc_idlewaittimeout) do - def mof_type; 'datetime' end - def mof_is_embedded?; false end - desc "IdleWaitTimeout - Specifies the amount of time that Task Scheduler waits for an idle condition to occur." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: NetworkName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_networkname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "NetworkName - Specifies the name of a network profile that Task Scheduler uses to determine if the task can run. The Task Scheduler UI uses this setting for display purposes. Specify a network name if you specify the RunOnlyIfNetworkAvailable parameter." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DisallowStartOnRemoteAppSession - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_disallowstartonremoteappsession) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DisallowStartOnRemoteAppSession - Indicates that the task does not start if the task is triggered to run in a Remote Applications Integrated Locally (RAIL) session." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: StartWhenAvailable - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_startwhenavailable) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "StartWhenAvailable - Indicates that Task Scheduler can start the task at any time after its scheduled time has passed." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DontStopIfGoingOnBatteries - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_dontstopifgoingonbatteries) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DontStopIfGoingOnBatteries - Indicates that the task does not stop if the computer switches to battery power." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: WakeToRun - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_waketorun) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "WakeToRun - Indicates that Task Scheduler wakes the computer before it runs the task." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: IdleDuration - # Type: datetime - # IsMandatory: False - # Values: None - newparam(:dsc_idleduration) do - def mof_type; 'datetime' end - def mof_is_embedded?; false end - desc "IdleDuration - Specifies the amount of time that the computer must be in an idle state before Task Scheduler runs the task." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RestartOnIdle - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_restartonidle) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RestartOnIdle - Indicates that Task Scheduler restarts the task when the computer cycles into an idle condition more than once." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: DontStopOnIdleEnd - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_dontstoponidleend) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DontStopOnIdleEnd - Indicates that Task Scheduler does not terminate the task if the idle condition ends before the task is completed." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ExecutionTimeLimit - # Type: datetime - # IsMandatory: False - # Values: None - newparam(:dsc_executiontimelimit) do - def mof_type; 'datetime' end - def mof_is_embedded?; false end - desc "ExecutionTimeLimit - Specifies the amount of time that Task Scheduler is allowed to complete the task." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MultipleInstances - # Type: string - # IsMandatory: False - # Values: ["IgnoreNew", "Parallel", "Queue"] - newparam(:dsc_multipleinstances) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MultipleInstances - Specifies the policy that defines how Task Scheduler handles multiple instances of the task. Valid values are IgnoreNew, Parallel, Queue." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['IgnoreNew', 'ignorenew', 'Parallel', 'parallel', 'Queue', 'queue'].include?(value) - fail("Invalid value '#{value}'. Valid values are IgnoreNew, Parallel, Queue") - end - end - end - - # Name: Priority - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_priority) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "Priority - Specifies the priority level of the task. Priority must be an integer from 0 (highest priority) to 10 (lowest priority). The default value is 7. Priority levels 7 and 8 are used for background tasks. Priority levels 4, 5, and 6 are used for interactive tasks." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: RestartCount - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_restartcount) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "RestartCount - Specifies the number of times that Task Scheduler attempts to restart the task." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: RestartInterval - # Type: datetime - # IsMandatory: False - # Values: None - newparam(:dsc_restartinterval) do - def mof_type; 'datetime' end - def mof_is_embedded?; false end - desc "RestartInterval - Specifies the amount of time that Task Scheduler attempts to restart the task." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RunOnlyIfNetworkAvailable - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_runonlyifnetworkavailable) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RunOnlyIfNetworkAvailable - Indicates that Task Scheduler runs the task only when a network is available. Task Scheduler uses the NetworkID parameter and NetworkName parameter that you specify in this cmdlet to determine if the network is available." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xscheduledtask).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xscomadmin.rb b/lib/puppet/type/dsc_xscomadmin.rb deleted file mode 100644 index 57704b6a..00000000 --- a/lib/puppet/type/dsc_xscomadmin.rb +++ /dev/null @@ -1,138 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xscomadmin) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSCOMAdmin resource type. - Automatically generated from - 'xSCOM/DSCResources/MSFT_xSCOMAdmin/MSFT_xSCOMAdmin.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_principal is a required attribute') if self[:dsc_principal].nil? - fail('dsc_userrole is a required attribute') if self[:dsc_userrole].nil? - end - - def dscmeta_resource_friendly_name; 'xSCOMAdmin' end - def dscmeta_resource_name; 'MSFT_xSCOMAdmin' end - def dscmeta_module_name; 'xSCOM' end - def dscmeta_module_version; '1.3.3.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if the principal is an Operations Manager admin.\nPresent {default} \nAbsent \n Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Principal - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_principal) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Principal - The Operations Manager admin principal." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UserRole - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_userrole) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UserRole - The Operations Manager user role." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SCOMAdminCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_scomadmincredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SCOMAdminCredential - Credential to be used to perform the operations." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SCOMAdminCredential", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xscomadmin).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xscomconsolesetup.rb b/lib/puppet/type/dsc_xscomconsolesetup.rb deleted file mode 100644 index 9ceec19b..00000000 --- a/lib/puppet/type/dsc_xscomconsolesetup.rb +++ /dev/null @@ -1,223 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xscomconsolesetup) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSCOMConsoleSetup resource type. - Automatically generated from - 'xSCOM/DSCResources/MSFT_xSCOMConsoleSetup/MSFT_xSCOMConsoleSetup.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_ensure is a required attribute') if self[:dsc_ensure].nil? - end - - def dscmeta_resource_friendly_name; 'xSCOMConsoleSetup' end - def dscmeta_resource_name; 'MSFT_xSCOMConsoleSetup' end - def dscmeta_module_name; 'xSCOM' end - def dscmeta_module_version; '1.3.3.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: True - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if the OM Console is expected to be installed on the machine.\nPresent {default} \nAbsent \n Valid values are Present, Absent." - isrequired - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: SourcePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourcePath - UNC path to the root of the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SourceFolder - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcefolder) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourceFolder - Folder within the source path containing the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SetupCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_setupcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SetupCredential - Credential to be used to perform the installation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SetupCredential", value) - end - end - - # Name: InstallPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_installpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstallPath - Installation path for the software." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UseMicrosoftUpdate - # Type: uint8 - # IsMandatory: False - # Values: None - newparam(:dsc_usemicrosoftupdate) do - def mof_type; 'uint8' end - def mof_is_embedded?; false end - desc "UseMicrosoftUpdate - 0: Do not opt in to Microsoft Update. 1: Opt in to Microsoft Update." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: SendCEIPReports - # Type: uint8 - # IsMandatory: False - # Values: None - newparam(:dsc_sendceipreports) do - def mof_type; 'uint8' end - def mof_is_embedded?; false end - desc "SendCEIPReports - 0: Do not opt in to the Customer Experience Improvement Program (CEIP). 1: Opt in to CEIP." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: EnableErrorReporting - # Type: string - # IsMandatory: False - # Values: ["Never", "Queued", "Always"] - newparam(:dsc_enableerrorreporting) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "EnableErrorReporting - Never: Do not opt in to sending automatic error reports. Queued: Opt in to sending error reports, but queue the reports for review before sending. Always: Opt in to automatically send error reports. Valid values are Never, Queued, Always." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Never', 'never', 'Queued', 'queued', 'Always', 'always'].include?(value) - fail("Invalid value '#{value}'. Valid values are Never, Queued, Always") - end - end - end - - # Name: SendODRReports - # Type: uint8 - # IsMandatory: False - # Values: None - newparam(:dsc_sendodrreports) do - def mof_type; 'uint8' end - def mof_is_embedded?; false end - desc "SendODRReports - 0: Do not opt in to sending operational data reports. 1: opt in to sending operational data reports." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xscomconsolesetup).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xscomconsoleupdate.rb b/lib/puppet/type/dsc_xscomconsoleupdate.rb deleted file mode 100644 index 47564774..00000000 --- a/lib/puppet/type/dsc_xscomconsoleupdate.rb +++ /dev/null @@ -1,151 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xscomconsoleupdate) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSCOMConsoleUpdate resource type. - Automatically generated from - 'xSCOM/DSCResources/MSFT_xSCOMConsoleUpdate/MSFT_xSCOMConsoleUpdate.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_ensure is a required attribute') if self[:dsc_ensure].nil? - end - - def dscmeta_resource_friendly_name; 'xSCOMConsoleUpdate' end - def dscmeta_resource_name; 'MSFT_xSCOMConsoleUpdate' end - def dscmeta_module_name; 'xSCOM' end - def dscmeta_module_version; '1.3.3.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: True - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if the update is expected to be installed on the machine.\nPresent {default} \nAbsent \n Valid values are Present, Absent." - isrequired - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: SourcePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourcePath - UNC path to the root of the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SourceFolder - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcefolder) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourceFolder - Folder within the source path containing the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SetupCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_setupcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SetupCredential - Credential to be used to perform the installation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SetupCredential", value) - end - end - - # Name: Update - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_update) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Update - Display name of the update." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xscomconsoleupdate).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xscommanagementpack.rb b/lib/puppet/type/dsc_xscommanagementpack.rb deleted file mode 100644 index c3b0cbb2..00000000 --- a/lib/puppet/type/dsc_xscommanagementpack.rb +++ /dev/null @@ -1,176 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xscommanagementpack) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSCOMManagementPack resource type. - Automatically generated from - 'xSCOM/DSCResources/MSFT_xSCOMManagementPack/MSFT_xSCOMManagementPack.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xSCOMManagementPack' end - def dscmeta_resource_name; 'MSFT_xSCOMManagementPack' end - def dscmeta_module_name; 'xSCOM' end - def dscmeta_module_version; '1.3.3.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Name of the Management Pack." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Version - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_version) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Version - Specific version of the Management Pack, overrides MinVersion if both set." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MinVersion - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_minversion) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MinVersion - Minimum version of the Management Pack, overridden by Version if both set." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SCOMAdminCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_scomadmincredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SCOMAdminCredential - Credential with admin permissions to Operations Manager." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SCOMAdminCredential", value) - end - end - - # Name: SourcePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourcePath - UNC path to the root of the source files for installation, if omitted the Operations Manager installation folder will be used." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SourceFolder - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcefolder) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourceFolder - Folder within the source path containing the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SourceFile - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcefile) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourceFile - Name of the file in the source folder for the Management Pack." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xscommanagementpack).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xscommanagementserversetup.rb b/lib/puppet/type/dsc_xscommanagementserversetup.rb deleted file mode 100644 index ba1a93ed..00000000 --- a/lib/puppet/type/dsc_xscommanagementserversetup.rb +++ /dev/null @@ -1,507 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xscommanagementserversetup) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSCOMManagementServerSetup resource type. - Automatically generated from - 'xSCOM/DSCResources/MSFT_xSCOMManagementServerSetup/MSFT_xSCOMManagementServerSetup.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_ensure is a required attribute') if self[:dsc_ensure].nil? - end - - def dscmeta_resource_friendly_name; 'xSCOMManagementServerSetup' end - def dscmeta_resource_name; 'MSFT_xSCOMManagementServerSetup' end - def dscmeta_module_name; 'xSCOM' end - def dscmeta_module_version; '1.3.3.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: True - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if the OM management server is expected to be installed on the machine.\nPresent {default} \nAbsent \n Valid values are Present, Absent." - isrequired - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: SourcePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourcePath - UNC path to the root of the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SourceFolder - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcefolder) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourceFolder - Folder within the source path containing the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SetupCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_setupcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SetupCredential - Credential to be used to perform the installation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SetupCredential", value) - end - end - - # Name: ProductKey - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_productkey) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProductKey - Product key for licensed installations." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstallPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_installpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstallPath - Installation path for the software." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ManagementGroupName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_managementgroupname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ManagementGroupName - The name of the management group." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: FirstManagementServer - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_firstmanagementserver) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "FirstManagementServer - Is this the first Management Server?" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ManagementServicePort - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_managementserviceport) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "ManagementServicePort - Change the Management Server port on install." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ActionAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_actionaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "ActionAccount - The domain and user name of the Management server action account." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("ActionAccount", value) - end - end - - # Name: ActionAccountUsername - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_actionaccountusername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ActionAccountUsername - Output username of the Management server action account." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DASAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_dasaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "DASAccount - The domain and user name of the Data Access service account." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("DASAccount", value) - end - end - - # Name: DASAccountUsername - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_dasaccountusername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DASAccountUsername - Output username of the Data Access service account." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DataReader - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_datareader) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "DataReader - The domain and user name of the data reader account." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("DataReader", value) - end - end - - # Name: DataReaderUsername - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_datareaderusername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DataReaderUsername - Output username of the data reader account." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DataWriter - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_datawriter) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "DataWriter - The domain and user name of the data Writer account." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("DataWriter", value) - end - end - - # Name: DataWriterUsername - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_datawriterusername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DataWriterUsername - Output username of the data writer account." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SqlServerInstance - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlserverinstance) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SqlServerInstance - The SQL server and instance." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databasename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseName - The name of the Operational database." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseSize - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_databasesize) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "DatabaseSize - The size in MB of the Operational database." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: DwSqlServerInstance - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_dwsqlserverinstance) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DwSqlServerInstance - The data warehouse server and instance." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DwDatabaseName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_dwdatabasename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DwDatabaseName - The name of the data warehouse database." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DwDatabaseSize - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_dwdatabasesize) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "DwDatabaseSize - The size in MB of the data warehouse database." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: UseMicrosoftUpdate - # Type: uint8 - # IsMandatory: False - # Values: None - newparam(:dsc_usemicrosoftupdate) do - def mof_type; 'uint8' end - def mof_is_embedded?; false end - desc "UseMicrosoftUpdate - 0: Do not opt in to Microsoft Update. 1: Opt in to Microsoft Update." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: SendCEIPReports - # Type: uint8 - # IsMandatory: False - # Values: None - newparam(:dsc_sendceipreports) do - def mof_type; 'uint8' end - def mof_is_embedded?; false end - desc "SendCEIPReports - 0: Do not opt in to the Customer Experience Improvement Program (CEIP). 1: Opt in to CEIP." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: EnableErrorReporting - # Type: string - # IsMandatory: False - # Values: ["Never", "Queued", "Always"] - newparam(:dsc_enableerrorreporting) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "EnableErrorReporting - Never: Do not opt in to sending automatic error reports. Queued: Opt in to sending error reports, but queue the reports for review before sending. Always: Opt in to automatically send error reports. Valid values are Never, Queued, Always." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Never', 'never', 'Queued', 'queued', 'Always', 'always'].include?(value) - fail("Invalid value '#{value}'. Valid values are Never, Queued, Always") - end - end - end - - # Name: SendODRReports - # Type: uint8 - # IsMandatory: False - # Values: None - newparam(:dsc_sendodrreports) do - def mof_type; 'uint8' end - def mof_is_embedded?; false end - desc "SendODRReports - 0: Do not opt in to sending operational data reports. 1: opt in to sending operational data reports." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xscommanagementserversetup).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xscommanagementserverupdate.rb b/lib/puppet/type/dsc_xscommanagementserverupdate.rb deleted file mode 100644 index 5a94adbf..00000000 --- a/lib/puppet/type/dsc_xscommanagementserverupdate.rb +++ /dev/null @@ -1,151 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xscommanagementserverupdate) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSCOMManagementServerUpdate resource type. - Automatically generated from - 'xSCOM/DSCResources/MSFT_xSCOMManagementServerUpdate/MSFT_xSCOMManagementServerUpdate.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_ensure is a required attribute') if self[:dsc_ensure].nil? - end - - def dscmeta_resource_friendly_name; 'xSCOMManagementServerUpdate' end - def dscmeta_resource_name; 'MSFT_xSCOMManagementServerUpdate' end - def dscmeta_module_name; 'xSCOM' end - def dscmeta_module_version; '1.3.3.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: True - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if the update is expected to be installed on the machine.\nPresent {default} \nAbsent \n Valid values are Present, Absent." - isrequired - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: SourcePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourcePath - UNC path to the root of the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SourceFolder - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcefolder) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourceFolder - Folder within the source path containing the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SetupCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_setupcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SetupCredential - Credential to be used to perform the installation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SetupCredential", value) - end - end - - # Name: Update - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_update) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Update - Display name of the update." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xscommanagementserverupdate).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xscomreportingserversetup.rb b/lib/puppet/type/dsc_xscomreportingserversetup.rb deleted file mode 100644 index 9ad8bfd8..00000000 --- a/lib/puppet/type/dsc_xscomreportingserversetup.rb +++ /dev/null @@ -1,284 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xscomreportingserversetup) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSCOMReportingServerSetup resource type. - Automatically generated from - 'xSCOM/DSCResources/MSFT_xSCOMReportingServerSetup/MSFT_xSCOMReportingServerSetup.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_ensure is a required attribute') if self[:dsc_ensure].nil? - end - - def dscmeta_resource_friendly_name; 'xSCOMReportingServerSetup' end - def dscmeta_resource_name; 'MSFT_xSCOMReportingServerSetup' end - def dscmeta_module_name; 'xSCOM' end - def dscmeta_module_version; '1.3.3.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: True - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if the OM Reporting server is expected to be installed on the machine.\nPresent {default} \nAbsent \n Valid values are Present, Absent." - isrequired - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: SourcePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourcePath - UNC path to the root of the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SourceFolder - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcefolder) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourceFolder - Folder within the source path containing the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SetupCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_setupcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SetupCredential - Credential to be used to perform the installation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SetupCredential", value) - end - end - - # Name: InstallPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_installpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstallPath - Installation path for the software." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ManagementServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_managementserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ManagementServer - The name of the management server associated with the Reporting server." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SRSInstance - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_srsinstance) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SRSInstance - The reporting server and instance." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DataReader - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_datareader) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "DataReader - The domain and user name of the data reader account." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("DataReader", value) - end - end - - # Name: DataReaderUsername - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_datareaderusername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DataReaderUsername - Output username of the data reader account." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UseMicrosoftUpdate - # Type: uint8 - # IsMandatory: False - # Values: None - newparam(:dsc_usemicrosoftupdate) do - def mof_type; 'uint8' end - def mof_is_embedded?; false end - desc "UseMicrosoftUpdate - 0: Do not opt in to Microsoft Update. 1: Opt in to Microsoft Update." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: SendCEIPReports - # Type: uint8 - # IsMandatory: False - # Values: None - newparam(:dsc_sendceipreports) do - def mof_type; 'uint8' end - def mof_is_embedded?; false end - desc "SendCEIPReports - 0: Do not opt in to the Customer Experience Improvement Program (CEIP). 1: Opt in to CEIP." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: EnableErrorReporting - # Type: string - # IsMandatory: False - # Values: ["Never", "Queued", "Always"] - newparam(:dsc_enableerrorreporting) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "EnableErrorReporting - Never: Do not opt in to sending automatic error reports. Queued: Opt in to sending error reports, but queue the reports for review before sending. Always: Opt in to automatically send error reports. Valid values are Never, Queued, Always." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Never', 'never', 'Queued', 'queued', 'Always', 'always'].include?(value) - fail("Invalid value '#{value}'. Valid values are Never, Queued, Always") - end - end - end - - # Name: SendODRReports - # Type: uint8 - # IsMandatory: False - # Values: None - newparam(:dsc_sendodrreports) do - def mof_type; 'uint8' end - def mof_is_embedded?; false end - desc "SendODRReports - 0: Do not opt in to sending operational data reports. 1: opt in to sending operational data reports." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xscomreportingserversetup).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xscomwebconsoleserversetup.rb b/lib/puppet/type/dsc_xscomwebconsoleserversetup.rb deleted file mode 100644 index e0e39e92..00000000 --- a/lib/puppet/type/dsc_xscomwebconsoleserversetup.rb +++ /dev/null @@ -1,287 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xscomwebconsoleserversetup) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSCOMWebConsoleServerSetup resource type. - Automatically generated from - 'xSCOM/DSCResources/MSFT_xSCOMWebConsoleServerSetup/MSFT_xSCOMWebConsoleServerSetup.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_ensure is a required attribute') if self[:dsc_ensure].nil? - end - - def dscmeta_resource_friendly_name; 'xSCOMWebConsoleServerSetup' end - def dscmeta_resource_name; 'MSFT_xSCOMWebConsoleServerSetup' end - def dscmeta_module_name; 'xSCOM' end - def dscmeta_module_version; '1.3.3.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: True - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if the OM Web Console server is expected to be installed on the machine.\nPresent {default} \nAbsent \n Valid values are Present, Absent." - isrequired - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: SourcePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourcePath - UNC path to the root of the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SourceFolder - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcefolder) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourceFolder - Folder within the source path containing the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SetupCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_setupcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SetupCredential - Credential to be used to perform the installation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SetupCredential", value) - end - end - - # Name: InstallPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_installpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstallPath - Installation path for the software." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ManagementServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_managementserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ManagementServer - The name of the management server associated with the Reporting server." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: WebSiteName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_websitename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WebSiteName - The name of the website." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: WebConsoleAuthorizationMode - # Type: string - # IsMandatory: False - # Values: ["Mixed", "Network"] - newparam(:dsc_webconsoleauthorizationmode) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WebConsoleAuthorizationMode - Mixed: Used for intranet scenarios. Network: Used for extranet scenarios. Valid values are Mixed, Network." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Mixed', 'mixed', 'Network', 'network'].include?(value) - fail("Invalid value '#{value}'. Valid values are Mixed, Network") - end - end - end - - # Name: WebConsoleUseSSL - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_webconsoleusessl) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "WebConsoleUseSSL - Specify only if your website has Secure Sockets Layer (SSL) activated. " - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: UseMicrosoftUpdate - # Type: uint8 - # IsMandatory: False - # Values: None - newparam(:dsc_usemicrosoftupdate) do - def mof_type; 'uint8' end - def mof_is_embedded?; false end - desc "UseMicrosoftUpdate - 0: Do not opt in to Microsoft Update. 1: Opt in to Microsoft Update." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: SendCEIPReports - # Type: uint8 - # IsMandatory: False - # Values: None - newparam(:dsc_sendceipreports) do - def mof_type; 'uint8' end - def mof_is_embedded?; false end - desc "SendCEIPReports - 0: Do not opt in to the Customer Experience Improvement Program (CEIP). 1: Opt in to CEIP." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: EnableErrorReporting - # Type: string - # IsMandatory: False - # Values: ["Never", "Queued", "Always"] - newparam(:dsc_enableerrorreporting) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "EnableErrorReporting - Never: Do not opt in to sending automatic error reports. Queued: Opt in to sending error reports, but queue the reports for review before sending. Always: Opt in to automatically send error reports. Valid values are Never, Queued, Always." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Never', 'never', 'Queued', 'queued', 'Always', 'always'].include?(value) - fail("Invalid value '#{value}'. Valid values are Never, Queued, Always") - end - end - end - - # Name: SendODRReports - # Type: uint8 - # IsMandatory: False - # Values: None - newparam(:dsc_sendodrreports) do - def mof_type; 'uint8' end - def mof_is_embedded?; false end - desc "SendODRReports - 0: Do not opt in to sending operational data reports. 1: opt in to sending operational data reports." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xscomwebconsoleserversetup).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xscomwebconsoleserverupdate.rb b/lib/puppet/type/dsc_xscomwebconsoleserverupdate.rb deleted file mode 100644 index c046264b..00000000 --- a/lib/puppet/type/dsc_xscomwebconsoleserverupdate.rb +++ /dev/null @@ -1,151 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xscomwebconsoleserverupdate) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSCOMWebConsoleServerUpdate resource type. - Automatically generated from - 'xSCOM/DSCResources/MSFT_xSCOMWebConsoleServerUpdate/MSFT_xSCOMWebConsoleServerUpdate.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_ensure is a required attribute') if self[:dsc_ensure].nil? - end - - def dscmeta_resource_friendly_name; 'xSCOMWebConsoleServerUpdate' end - def dscmeta_resource_name; 'MSFT_xSCOMWebConsoleServerUpdate' end - def dscmeta_module_name; 'xSCOM' end - def dscmeta_module_version; '1.3.3.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: True - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if the update is expected to be installed on the machine.\nPresent {default} \nAbsent \n Valid values are Present, Absent." - isrequired - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: SourcePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourcePath - UNC path to the root of the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SourceFolder - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcefolder) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourceFolder - Folder within the source path containing the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SetupCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_setupcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SetupCredential - Credential to be used to perform the installation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SetupCredential", value) - end - end - - # Name: Update - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_update) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Update - Display name of the update." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xscomwebconsoleserverupdate).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xscript.rb b/lib/puppet/type/dsc_xscript.rb deleted file mode 100644 index 25b3acbd..00000000 --- a/lib/puppet/type/dsc_xscript.rb +++ /dev/null @@ -1,150 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xscript) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xScript resource type. - Automatically generated from - 'xPSDesiredStateConfiguration/DSCResources/MSFT_xScriptResource/MSFT_xScriptResource.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_getscript is a required attribute') if self[:dsc_getscript].nil? - fail('dsc_setscript is a required attribute') if self[:dsc_setscript].nil? - fail('dsc_testscript is a required attribute') if self[:dsc_testscript].nil? - end - - def dscmeta_resource_friendly_name; 'xScript' end - def dscmeta_resource_name; 'MSFT_xScriptResource' end - def dscmeta_module_name; 'xPSDesiredStateConfiguration' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: GetScript - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_getscript) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "GetScript - A string that can be used to create a PowerShell script block that retrieves the current state of the resource." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SetScript - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_setscript) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SetScript - A string that can be used to create a PowerShell script block that sets the resource to the desired state." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: TestScript - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_testscript) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TestScript - A string that can be used to create a PowerShell script block that validates whether or not the resource is in the desired state." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential - The credential of the user account to run the script under if needed." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Result - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_result) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Result - The result from the GetScript script block." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xscript).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xscsmapowershellsetup.rb b/lib/puppet/type/dsc_xscsmapowershellsetup.rb deleted file mode 100644 index be8cba1d..00000000 --- a/lib/puppet/type/dsc_xscsmapowershellsetup.rb +++ /dev/null @@ -1,136 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xscsmapowershellsetup) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSCSMAPowerShellSetup resource type. - Automatically generated from - 'xSCSMA/DSCResources/MSFT_xSCSMAPowerShellSetup/MSFT_xSCSMAPowerShellSetup.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_ensure is a required attribute') if self[:dsc_ensure].nil? - end - - def dscmeta_resource_friendly_name; 'xSCSMAPowerShellSetup' end - def dscmeta_resource_name; 'MSFT_xSCSMAPowerShellSetup' end - def dscmeta_module_name; 'xSCSMA' end - def dscmeta_module_version; '1.5.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: True - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if SMA PowerShell is expected to be installed on the machine.\nPresent {default} \nAbsent \n Valid values are Present, Absent." - isrequired - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: SourcePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourcePath - UNC path to the root of the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SourceFolder - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcefolder) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourceFolder - Folder within the source path containing the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SetupCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_setupcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SetupCredential - Credential to be used to perform the installation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SetupCredential", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xscsmapowershellsetup).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xscsmarunbookworkerserversetup.rb b/lib/puppet/type/dsc_xscsmarunbookworkerserversetup.rb deleted file mode 100644 index 9768a656..00000000 --- a/lib/puppet/type/dsc_xscsmarunbookworkerserversetup.rb +++ /dev/null @@ -1,287 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xscsmarunbookworkerserversetup) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSCSMARunbookWorkerServerSetup resource type. - Automatically generated from - 'xSCSMA/DSCResources/MSFT_xSCSMARunbookWorkerServerSetup/MSFT_xSCSMARunbookWorkerServerSetup.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_ensure is a required attribute') if self[:dsc_ensure].nil? - end - - def dscmeta_resource_friendly_name; 'xSCSMARunbookWorkerServerSetup' end - def dscmeta_resource_name; 'MSFT_xSCSMARunbookWorkerServerSetup' end - def dscmeta_module_name; 'xSCSMA' end - def dscmeta_module_version; '1.5.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: True - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if the SMA Runbook Worker server is expected to be installed on the machine.\nPresent {default} \nAbsent \n Valid values are Present, Absent." - isrequired - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: SourcePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourcePath - UNC path to the root of the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SourceFolder - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcefolder) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourceFolder - Folder within the source path containing the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SetupCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_setupcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SetupCredential - Credential to be used to perform the installation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SetupCredential", value) - end - end - - # Name: Service - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_service) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Service - Service account of the web service application pool." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Service", value) - end - end - - # Name: ServiceUserName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_serviceusername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServiceUserName - Output username of the Service account of the web service application pool." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SqlServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SqlServer - Name of the SQL Server for the SMA database." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SqlInstance - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlinstance) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SqlInstance - Name of the SQL Instance for the SMA database." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SqlDatabase - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqldatabase) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SqlDatabase - Name of the SMA database." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstallFolder - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_installfolder) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstallFolder - Installation folder for SMA." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ETWManifest - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_etwmanifest) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ETWManifest - Log to ETW." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SendCEIPReports - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sendceipreports) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SendCEIPReports - Participate in the Customer Experience Improvement Program." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MSUpdate - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_msupdate) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MSUpdate - Use Microsoft Update." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ProductKey - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_productkey) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProductKey - Product key for licensed installations." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xscsmarunbookworkerserversetup).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xscsmawebserviceserversetup.rb b/lib/puppet/type/dsc_xscsmawebserviceserversetup.rb deleted file mode 100644 index b1b6c9e3..00000000 --- a/lib/puppet/type/dsc_xscsmawebserviceserversetup.rb +++ /dev/null @@ -1,414 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xscsmawebserviceserversetup) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSCSMAWebServiceServerSetup resource type. - Automatically generated from - 'xSCSMA/DSCResources/MSFT_xSCSMAWebServiceServerSetup/MSFT_xSCSMAWebServiceServerSetup.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_ensure is a required attribute') if self[:dsc_ensure].nil? - end - - def dscmeta_resource_friendly_name; 'xSCSMAWebServiceServerSetup' end - def dscmeta_resource_name; 'MSFT_xSCSMAWebServiceServerSetup' end - def dscmeta_module_name; 'xSCSMA' end - def dscmeta_module_version; '1.5.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: True - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if the SMA Web Service server is expected to be installed on the machine.\nPresent {default} \nAbsent \n Valid values are Present, Absent." - isrequired - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: SourcePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourcePath - UNC path to the root of the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SourceFolder - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcefolder) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourceFolder - Folder within the source path containing the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SetupCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_setupcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SetupCredential - Credential to be used to perform the installation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SetupCredential", value) - end - end - - # Name: FirstWebServiceServer - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_firstwebserviceserver) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "FirstWebServiceServer - Is this the first Management Server?" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ApPool - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_appool) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "ApPool - Service account of the web service application pool." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("ApPool", value) - end - end - - # Name: ApPoolUsername - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_appoolusername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ApPoolUsername - Output username of the web service application pool." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AdminGroupMembers - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_admingroupmembers) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AdminGroupMembers - A comma-separated list of users to add to the IIS Administrators group." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SqlServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SqlServer - Name of the SQL Server for the SMA database." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SqlInstance - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlinstance) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SqlInstance - Name of the SQL Instance for the SMA database." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SqlDatabase - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqldatabase) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SqlDatabase - Name of the SMA database." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SiteName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sitename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SiteName - Name of the SMA web site." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: WebServicePort - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_webserviceport) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "WebServicePort - Port of the SMA web site." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: InstallFolder - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_installfolder) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstallFolder - Installation folder for SMA." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UseSSL - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_usessl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UseSSL - Use SSL?" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SpecifyCertificate - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_specifycertificate) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SpecifyCertificate - Specify an existing certificate for the SMA web site." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CertificateName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_certificatename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CertificateName - Name of the existing certificate to use." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ETWManifest - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_etwmanifest) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ETWManifest - Log to ETW." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SendCEIPReports - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sendceipreports) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SendCEIPReports - Send Customer Experience Improvement Program." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MSUpdate - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_msupdate) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MSUpdate - Use Microsoft Update." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ProductKey - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_productkey) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProductKey - Product key for licensed installations." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RunbookWorkerServers - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_runbookworkerservers, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "RunbookWorkerServers - Array of Runbook Worker servers in this deployment." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xscsmawebserviceserversetup).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xscspfserver.rb b/lib/puppet/type/dsc_xscspfserver.rb deleted file mode 100644 index e565a144..00000000 --- a/lib/puppet/type/dsc_xscspfserver.rb +++ /dev/null @@ -1,139 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xscspfserver) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSCSPFServer resource type. - Automatically generated from - 'xSCSPF/DSCResources/MSFT_xSCSPFServer/MSFT_xSCSPFServer.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xSCSPFServer' end - def dscmeta_resource_name; 'MSFT_xSCSPFServer' end - def dscmeta_module_name; 'xSCSPF' end - def dscmeta_module_version; '1.3.1.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if the SPF server exists.\nPresent {default} \nAbsent \n Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Specifies a name for the server." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ServerType - # Type: string - # IsMandatory: False - # Values: ["VMM", "OM", "DPM", "OMDW", "RDGateway", "Orchestrator", "None"] - newparam(:dsc_servertype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServerType - Specifies the type of server. Valid values are VMM, OM, DPM, OMDW, RDGateway, Orchestrator, None." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['VMM', 'vmm', 'OM', 'om', 'DPM', 'dpm', 'OMDW', 'omdw', 'RDGateway', 'rdgateway', 'Orchestrator', 'orchestrator', 'None', 'none'].include?(value) - fail("Invalid value '#{value}'. Valid values are VMM, OM, DPM, OMDW, RDGateway, Orchestrator, None") - end - end - end - - # Name: SCSPFAdminCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_scspfadmincredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SCSPFAdminCredential - Credential with admin permissions to Service Provider Foundation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SCSPFAdminCredential", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xscspfserver).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xscspfserversetup.rb b/lib/puppet/type/dsc_xscspfserversetup.rb deleted file mode 100644 index 53fa3490..00000000 --- a/lib/puppet/type/dsc_xscspfserversetup.rb +++ /dev/null @@ -1,447 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xscspfserversetup) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSCSPFServerSetup resource type. - Automatically generated from - 'xSCSPF/DSCResources/MSFT_xSCSPFServerSetup/MSFT_xSCSPFServerSetup.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_ensure is a required attribute') if self[:dsc_ensure].nil? - end - - def dscmeta_resource_friendly_name; 'xSCSPFServerSetup' end - def dscmeta_resource_name; 'MSFT_xSCSPFServerSetup' end - def dscmeta_module_name; 'xSCSPF' end - def dscmeta_module_version; '1.3.1.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: True - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if SPF server is expected to be installed on the machine.\nPresent {default} \nAbsent \n Valid values are Present, Absent." - isrequired - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: SourcePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourcePath - UNC path to the root of the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SourceFolder - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcefolder) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourceFolder - Folder within the source path containing the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SetupCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_setupcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SetupCredential - Credential to be used to perform the installation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SetupCredential", value) - end - end - - # Name: SendCEIPReports - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sendceipreports) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SendCEIPReports - Participate in the Customer Experience Improvement Program." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UseMicrosoftUpdate - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_usemicrosoftupdate) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UseMicrosoftUpdate - Use Microsoft Update." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SpecifyCertificate - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_specifycertificate) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "SpecifyCertificate - Use an existing certificate." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: CertificateName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_certificatename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CertificateName - Name of existing certificate to use." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databaseserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseServer - Name of the database server." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabasePortNumber - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_databaseportnumber) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "DatabasePortNumber - Port of the database server instance." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: DatabaseName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databasename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseName - Name of the SPF database." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: WebSitePortNumber - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_websiteportnumber) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "WebSitePortNumber - Port for the SPF web service." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: SCVMM - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_scvmm) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SCVMM - Credential for the VMM application pool." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SCVMM", value) - end - end - - # Name: SCVMMUsername - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_scvmmusername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SCVMMUsername - Output username of the VMM application pool serivce." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SCAdmin - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_scadmin) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SCAdmin - Credential for the Admin application pool" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SCAdmin", value) - end - end - - # Name: SCAdminUsername - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_scadminusername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SCAdminUsername - Output username of the Admin application pool serivce." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SCProvider - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_scprovider) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SCProvider - Credential for the Provider application pool" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SCProvider", value) - end - end - - # Name: SCProviderUsername - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_scproviderusername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SCProviderUsername - Output username of the Provider application pool serivce." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SCUsage - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_scusage) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SCUsage - Credential for the Usage application pool" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SCUsage", value) - end - end - - # Name: SCUsageUsername - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_scusageusername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SCUsageUsername - Output username of the Usage application pool serivce." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: VMMSecurityGroupUsers - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_vmmsecuritygroupusers) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "VMMSecurityGroupUsers - Administrator of the VMM application pool." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AdminSecurityGroupUsers - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_adminsecuritygroupusers) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AdminSecurityGroupUsers - Administrator of the Admin application pool" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ProviderSecurityGroupUsers - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_providersecuritygroupusers) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProviderSecurityGroupUsers - Administrator of the Provider application pool" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UsageSecurityGroupUsers - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_usagesecuritygroupusers) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UsageSecurityGroupUsers - Administrator of the Usage application pool" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xscspfserversetup).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xscspfserverupdate.rb b/lib/puppet/type/dsc_xscspfserverupdate.rb deleted file mode 100644 index e8c00dac..00000000 --- a/lib/puppet/type/dsc_xscspfserverupdate.rb +++ /dev/null @@ -1,151 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xscspfserverupdate) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSCSPFServerUpdate resource type. - Automatically generated from - 'xSCSPF/DSCResources/MSFT_xSCSPFServerUpdate/MSFT_xSCSPFServerUpdate.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_ensure is a required attribute') if self[:dsc_ensure].nil? - end - - def dscmeta_resource_friendly_name; 'xSCSPFServerUpdate' end - def dscmeta_resource_name; 'MSFT_xSCSPFServerUpdate' end - def dscmeta_module_name; 'xSCSPF' end - def dscmeta_module_version; '1.3.1.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: True - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if the update is expected to be installed on the machine.\nPresent {default} \nAbsent \n Valid values are Present, Absent." - isrequired - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: SourcePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourcePath - UNC path to the root of the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SourceFolder - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcefolder) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourceFolder - Folder within the source path containing the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SetupCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_setupcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SetupCredential - Credential to be used to perform the installation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SetupCredential", value) - end - end - - # Name: Update - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_update) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Update - Display name of the update." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xscspfserverupdate).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xscspfsetting.rb b/lib/puppet/type/dsc_xscspfsetting.rb deleted file mode 100644 index 147c2b09..00000000 --- a/lib/puppet/type/dsc_xscspfsetting.rb +++ /dev/null @@ -1,171 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xscspfsetting) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSCSPFSetting resource type. - Automatically generated from - 'xSCSPF/DSCResources/MSFT_xSCSPFSetting/MSFT_xSCSPFSetting.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_servername is a required attribute') if self[:dsc_servername].nil? - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xSCSPFSetting' end - def dscmeta_resource_name; 'MSFT_xSCSPFSetting' end - def dscmeta_module_name; 'xSCSPF' end - def dscmeta_module_version; '1.3.1.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if the SPF setting exists.\nPresent {default} \nAbsent \n Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: ServerName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_servername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServerName - Specifies the name of the server the setting is associated with." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SettingType - # Type: string - # IsMandatory: False - # Values: ["DatabaseConnectionString", "EndPointConnectionString"] - newparam(:dsc_settingtype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SettingType - Specifies either DatabaseConnectionString or EndPointConnectionString. Valid values are DatabaseConnectionString, EndPointConnectionString." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['DatabaseConnectionString', 'databaseconnectionstring', 'EndPointConnectionString', 'endpointconnectionstring'].include?(value) - fail("Invalid value '#{value}'. Valid values are DatabaseConnectionString, EndPointConnectionString") - end - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Specifies a friendly name for the setting." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Value - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_value) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Value - Specifies the value for the setting." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SCSPFAdminCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_scspfadmincredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SCSPFAdminCredential - Credential with admin permissions to Service Provider Foundation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SCSPFAdminCredential", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xscspfsetting).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xscspfstamp.rb b/lib/puppet/type/dsc_xscspfstamp.rb deleted file mode 100644 index e2a83aec..00000000 --- a/lib/puppet/type/dsc_xscspfstamp.rb +++ /dev/null @@ -1,139 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xscspfstamp) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSCSPFStamp resource type. - Automatically generated from - 'xSCSPF/DSCResources/MSFT_xSCSPFStamp/MSFT_xSCSPFStamp.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xSCSPFStamp' end - def dscmeta_resource_name; 'MSFT_xSCSPFStamp' end - def dscmeta_module_name; 'xSCSPF' end - def dscmeta_module_version; '1.3.1.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if the SPF stamp exists.\nPresent {default} \nAbsent \n Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Specifies a name for the stamp." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Servers - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_servers, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Servers - Specifies the name of one or more server objects to associate with the new stamp." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: SCSPFAdminCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_scspfadmincredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SCSPFAdminCredential - Credential with admin permissions to Service Provider Foundation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SCSPFAdminCredential", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xscspfstamp).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xscsrserversetup.rb b/lib/puppet/type/dsc_xscsrserversetup.rb deleted file mode 100644 index 7e0f532c..00000000 --- a/lib/puppet/type/dsc_xscsrserversetup.rb +++ /dev/null @@ -1,307 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xscsrserversetup) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSCSRServerSetup resource type. - Automatically generated from - 'xSCSR/DSCResources/MSFT_xSCSRServerSetup/MSFT_xSCSRServerSetup.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_ensure is a required attribute') if self[:dsc_ensure].nil? - end - - def dscmeta_resource_friendly_name; 'xSCSRServerSetup' end - def dscmeta_resource_name; 'MSFT_xSCSRServerSetup' end - def dscmeta_module_name; 'xSCSR' end - def dscmeta_module_version; '1.3.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: True - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if the Service Reporting server is expected to be installed on the machine.\nPresent {default} \nAbsent \n Valid values are Present, Absent." - isrequired - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: SourcePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourcePath - UNC path to the root of the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SourceFolder - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcefolder) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourceFolder - Folder within the source path containing the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SetupCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_setupcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SetupCredential - Credential to be used to perform the installation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SetupCredential", value) - end - end - - # Name: SendCEIPReports - # Type: string - # IsMandatory: False - # Values: ["Yes", "No"] - newparam(:dsc_sendceipreports) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SendCEIPReports - Participation in Customer Experience Improvement Program (yes or no). Valid values are Yes, No." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Yes', 'yes', 'No', 'no'].include?(value) - fail("Invalid value '#{value}'. Valid values are Yes, No") - end - end - end - - # Name: UseMicrosoftUpdate - # Type: string - # IsMandatory: False - # Values: ["Yes", "No"] - newparam(:dsc_usemicrosoftupdate) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UseMicrosoftUpdate - Participation in Microsoft Update (yes or no). Valid values are Yes, No." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Yes', 'yes', 'No', 'no'].include?(value) - fail("Invalid value '#{value}'. Valid values are Yes, No") - end - end - end - - # Name: InstallFolder - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_installfolder) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstallFolder - Folder to install to." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databaseserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseServer - Name of the server that is running SQL Server where the databases already exist, or where Setup will create them ." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseServerInstance - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databaseserverinstance) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseServerInstance - Name of the SQL Server database instance to install to." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RepositoryDatabaseName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_repositorydatabasename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RepositoryDatabaseName - Name of the usage repository database that already exists, or that Setup will create." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: StagingDatabaseName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_stagingdatabasename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "StagingDatabaseName - Name of the usage staging database that already exists, or that Setup will create." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DWDatabaseName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_dwdatabasename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DWDatabaseName - Name of the usage data warehouse database that already exists, or that Setup will create." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AnalysisDatabaseServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_analysisdatabaseserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AnalysisDatabaseServer - Name of the server that is running SQL Server where the analysis database already exists, or where Setup will create it." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AnalysisDatabaseServerInstance - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_analysisdatabaseserverinstance) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AnalysisDatabaseServerInstance - Name of the SQL Server analysis database instance to install to." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AnalysisDatabaseName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_analysisdatabasename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AnalysisDatabaseName - Name of the analysis database that already exists, or that Setup will create." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xscsrserversetup).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xscsrserverupdate.rb b/lib/puppet/type/dsc_xscsrserverupdate.rb deleted file mode 100644 index 086bf3cb..00000000 --- a/lib/puppet/type/dsc_xscsrserverupdate.rb +++ /dev/null @@ -1,151 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xscsrserverupdate) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSCSRServerUpdate resource type. - Automatically generated from - 'xSCSR/DSCResources/MSFT_xSCSRServerUpdate/MSFT_xSCSRServerUpdate.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_ensure is a required attribute') if self[:dsc_ensure].nil? - end - - def dscmeta_resource_friendly_name; 'xSCSRServerUpdate' end - def dscmeta_resource_name; 'MSFT_xSCSRServerUpdate' end - def dscmeta_module_name; 'xSCSR' end - def dscmeta_module_version; '1.3.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: True - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if the update is expected to be installed on the machine.\nPresent {default} \nAbsent \n Valid values are Present, Absent." - isrequired - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: SourcePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourcePath - UNC path to the root of the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SourceFolder - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcefolder) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourceFolder - Folder within the source path containing the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SetupCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_setupcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SetupCredential - Credential to be used to perform the installation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SetupCredential", value) - end - end - - # Name: Update - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_update) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Update - Display name of the update." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xscsrserverupdate).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xscvmmadmin.rb b/lib/puppet/type/dsc_xscvmmadmin.rb deleted file mode 100644 index 41788292..00000000 --- a/lib/puppet/type/dsc_xscvmmadmin.rb +++ /dev/null @@ -1,138 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xscvmmadmin) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSCVMMAdmin resource type. - Automatically generated from - 'xSCVMM/DSCResources/MSFT_xSCVMMAdmin/MSFT_xSCVMMAdmin.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_principal is a required attribute') if self[:dsc_principal].nil? - fail('dsc_userrole is a required attribute') if self[:dsc_userrole].nil? - end - - def dscmeta_resource_friendly_name; 'xSCVMMAdmin' end - def dscmeta_resource_name; 'MSFT_xSCVMMAdmin' end - def dscmeta_module_name; 'xSCVMM' end - def dscmeta_module_version; '1.2.4.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if the principal is an Virtual Machine Manager admin.\nPresent {default} \nAbsent \n Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Principal - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_principal) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Principal - The Virtual Machine Manager admin principal." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UserRole - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_userrole) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UserRole - The Virtual Machine Manager user role." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SCVMMAdminCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_scvmmadmincredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SCVMMAdminCredential - Credential to be used to perform the operations." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SCVMMAdminCredential", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xscvmmadmin).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xscvmmconsolesetup.rb b/lib/puppet/type/dsc_xscvmmconsolesetup.rb deleted file mode 100644 index ee50f05d..00000000 --- a/lib/puppet/type/dsc_xscvmmconsolesetup.rb +++ /dev/null @@ -1,187 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xscvmmconsolesetup) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSCVMMConsoleSetup resource type. - Automatically generated from - 'xSCVMM/DSCResources/MSFT_xSCVMMConsoleSetup/MSFT_xSCVMMConsoleSetup.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_ensure is a required attribute') if self[:dsc_ensure].nil? - end - - def dscmeta_resource_friendly_name; 'xSCVMMConsoleSetup' end - def dscmeta_resource_name; 'MSFT_xSCVMMConsoleSetup' end - def dscmeta_module_name; 'xSCVMM' end - def dscmeta_module_version; '1.2.4.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: True - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if the DPM server is expected to be installed on the machine.\nPresent {default} \nAbsent \n Valid values are Present, Absent." - isrequired - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: SourcePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourcePath - UNC path to the root of the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SourceFolder - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcefolder) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourceFolder - Folder within the source path containing the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SetupCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_setupcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SetupCredential - Credential to be used to perform the installation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SetupCredential", value) - end - end - - # Name: ProgramFiles - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_programfiles) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProgramFiles - Installation path for the software." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: IndigoTcpPort - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_indigotcpport) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "IndigoTcpPort - Port for communication with the VMM management server." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MUOptIn - # Type: uint8 - # IsMandatory: False - # Values: None - newparam(:dsc_muoptin) do - def mof_type; 'uint8' end - def mof_is_embedded?; false end - desc "MUOptIn - 0: Do not opt in to Microsoft Update. 1: Opt in to Microsoft Update." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xscvmmconsolesetup).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xscvmmconsoleupdate.rb b/lib/puppet/type/dsc_xscvmmconsoleupdate.rb deleted file mode 100644 index 53bacedd..00000000 --- a/lib/puppet/type/dsc_xscvmmconsoleupdate.rb +++ /dev/null @@ -1,151 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xscvmmconsoleupdate) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSCVMMConsoleUpdate resource type. - Automatically generated from - 'xSCVMM/DSCResources/MSFT_xSCVMMConsoleUpdate/MSFT_xSCVMMConsoleUpdate.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_ensure is a required attribute') if self[:dsc_ensure].nil? - end - - def dscmeta_resource_friendly_name; 'xSCVMMConsoleUpdate' end - def dscmeta_resource_name; 'MSFT_xSCVMMConsoleUpdate' end - def dscmeta_module_name; 'xSCVMM' end - def dscmeta_module_version; '1.2.4.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: True - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if the update is expected to be installed on the machine.\nPresent {default} \nAbsent \n Valid values are Present, Absent." - isrequired - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: SourcePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourcePath - UNC path to the root of the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SourceFolder - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcefolder) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourceFolder - Folder within the source path containing the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SetupCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_setupcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SetupCredential - Credential to be used to perform the installation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SetupCredential", value) - end - end - - # Name: Update - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_update) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Update - Display name of the update." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xscvmmconsoleupdate).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xscvmmmanagementserversetup.rb b/lib/puppet/type/dsc_xscvmmmanagementserversetup.rb deleted file mode 100644 index 4ae926de..00000000 --- a/lib/puppet/type/dsc_xscvmmmanagementserversetup.rb +++ /dev/null @@ -1,604 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xscvmmmanagementserversetup) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSCVMMManagementServerSetup resource type. - Automatically generated from - 'xSCVMM/DSCResources/MSFT_xSCVMMManagementServerSetup/MSFT_xSCVMMManagementServerSetup.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_ensure is a required attribute') if self[:dsc_ensure].nil? - end - - def dscmeta_resource_friendly_name; 'xSCVMMManagementServerSetup' end - def dscmeta_resource_name; 'MSFT_xSCVMMManagementServerSetup' end - def dscmeta_module_name; 'xSCVMM' end - def dscmeta_module_version; '1.2.4.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: True - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if the DPM server is expected to be installed on the machine.\nPresent {default} \nAbsent \n Valid values are Present, Absent." - isrequired - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: SourcePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourcePath - UNC path to the root of the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SourceFolder - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcefolder) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourceFolder - Folder within the source path containing the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SetupCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_setupcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SetupCredential - Credential to be used to perform the installation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SetupCredential", value) - end - end - - # Name: vmmService - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_vmmservice) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "vmmService - Domain account for the VMM service." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("vmmService", value) - end - end - - # Name: vmmServiceUsername - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_vmmserviceusername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "vmmServiceUsername - Output username of the VMM service." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ProductKey - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_productkey) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProductKey - Product key for licensed installations." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UserName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_username) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UserName - Display name for the user." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CompanyName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_companyname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CompanyName - Display name for the organization." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ProgramFiles - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_programfiles) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProgramFiles - Installation path for the software." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ClusterManagementServer - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_clustermanagementserver) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ClusterManagementServer - Is this a clustered Management Server?" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: FirstManagementServer - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_firstmanagementserver) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "FirstManagementServer - Is this the first Management Server?" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: CreateNewSqlDatabase - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_createnewsqldatabase) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CreateNewSqlDatabase - 0: Use an existing Microsoft SQL Server database. 1: Create a new SQL Server database." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SqlMachineName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlmachinename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SqlMachineName - Name of the server that is hosting SQL Server." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SqlInstanceName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlinstancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SqlInstanceName - Name of the new or existing instance of SQL Server." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SqlDatabaseName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqldatabasename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SqlDatabaseName - Name of the new or existing SQL Server database." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: IndigoTcpPort - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_indigotcpport) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "IndigoTcpPort - Port for communication with the VMM console." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: IndigoHTTPSPort - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_indigohttpsport) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "IndigoHTTPSPort - Port for communication with the Windows Preinstallation Environment agents." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: IndigoNETTCPPort - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_indigonettcpport) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "IndigoNETTCPPort - Port for communication with Windows Deployment Services." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: IndigoHTTPPort - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_indigohttpport) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "IndigoHTTPPort - Port for communication with Windows PE agent for time synchronization." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: WSManTcpPort - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_wsmantcpport) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "WSManTcpPort - Port for communication with agents on hosts and library servers." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: BitsTcpPort - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_bitstcpport) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "BitsTcpPort - Port for file transfers to agents on hosts and library servers." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: CreateNewLibraryShare - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_createnewlibraryshare) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CreateNewLibraryShare - 0: Use an existing library share. 1: Create a new library share." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: LibraryShareName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_librarysharename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LibraryShareName - Name of the file share to be used or created." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: LibrarySharePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_librarysharepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LibrarySharePath - Location of the existing file share or the new file share to be created." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: LibraryShareDescription - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_librarysharedescription) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LibraryShareDescription - Description of the share." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: TopContainerName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_topcontainername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TopContainerName - Container for Distributed Key Management." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: VmmServerName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_vmmservername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "VmmServerName - Clustered service name for a highly available VMM management server." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: VMMStaticIPAddress - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_vmmstaticipaddress) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "VMMStaticIPAddress - IP address for the clustered service name for a highly available VMM management server, if you are not using Dynamic Host Configuration Protocol (DHCP)." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RetainSqlDatabase - # Type: uint8 - # IsMandatory: False - # Values: None - newparam(:dsc_retainsqldatabase) do - def mof_type; 'uint8' end - def mof_is_embedded?; false end - desc "RetainSqlDatabase - 0: Remove the SQL Server database. 1: Do not remove the SQL Server database." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ForceHAVMMUninstall - # Type: uint8 - # IsMandatory: False - # Values: None - newparam(:dsc_forcehavmmuninstall) do - def mof_type; 'uint8' end - def mof_is_embedded?; false end - desc "ForceHAVMMUninstall - 0: Do not force uninstallation if setup.exe cannot verify whether this node is the final node of the highly available installation. 1: Force the uninstallation." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: SQMOptIn - # Type: uint8 - # IsMandatory: False - # Values: None - newparam(:dsc_sqmoptin) do - def mof_type; 'uint8' end - def mof_is_embedded?; false end - desc "SQMOptIn - 0: Do not opt in to the Customer Experience Improvement Program (CEIP). 1: Opt in to CEIP." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MUOptIn - # Type: uint8 - # IsMandatory: False - # Values: None - newparam(:dsc_muoptin) do - def mof_type; 'uint8' end - def mof_is_embedded?; false end - desc "MUOptIn - 0: Do not opt in to Microsoft Update. 1: Opt in to Microsoft Update." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xscvmmmanagementserversetup).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xscvmmmanagementserverupdate.rb b/lib/puppet/type/dsc_xscvmmmanagementserverupdate.rb deleted file mode 100644 index c1873ae3..00000000 --- a/lib/puppet/type/dsc_xscvmmmanagementserverupdate.rb +++ /dev/null @@ -1,151 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xscvmmmanagementserverupdate) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSCVMMManagementServerUpdate resource type. - Automatically generated from - 'xSCVMM/DSCResources/MSFT_xSCVMMManagementServerUpdate/MSFT_xSCVMMManagementServerUpdate.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_ensure is a required attribute') if self[:dsc_ensure].nil? - end - - def dscmeta_resource_friendly_name; 'xSCVMMManagementServerUpdate' end - def dscmeta_resource_name; 'MSFT_xSCVMMManagementServerUpdate' end - def dscmeta_module_name; 'xSCVMM' end - def dscmeta_module_version; '1.2.4.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: True - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if the update is expected to be installed on the machine.\nPresent {default} \nAbsent \n Valid values are Present, Absent." - isrequired - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: SourcePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourcePath - UNC path to the root of the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SourceFolder - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcefolder) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourceFolder - Folder within the source path containing the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SetupCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_setupcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SetupCredential - Credential to be used to perform the installation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SetupCredential", value) - end - end - - # Name: Update - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_update) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Update - Display name of the update." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xscvmmmanagementserverupdate).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsmacredential.rb b/lib/puppet/type/dsc_xsmacredential.rb deleted file mode 100644 index cae2a5d9..00000000 --- a/lib/puppet/type/dsc_xsmacredential.rb +++ /dev/null @@ -1,164 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsmacredential) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSmaCredential resource type. - Automatically generated from - 'xSCSMA/DSCResources/MSFT_xSmaCredential/MSFT_xSmaCredential.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xSmaCredential' end - def dscmeta_resource_name; 'MSFT_xSmaCredential' end - def dscmeta_module_name; 'xSCSMA' end - def dscmeta_module_version; '1.5.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Name of credential." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "credential - Credential object to be imported." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("credential", value) - end - end - - # Name: Description - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_description) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Description - Description of credential." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: WebServiceEndpoint - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_webserviceendpoint) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WebServiceEndpoint - Web service endpoint of SMA instance." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Port - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_port) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "Port - Port to reach the web service endpoint." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: UserName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_username) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UserName - User name of credential found within SMA" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsmacredential).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsmbshare.rb b/lib/puppet/type/dsc_xsmbshare.rb deleted file mode 100644 index 33036bc2..00000000 --- a/lib/puppet/type/dsc_xsmbshare.rb +++ /dev/null @@ -1,319 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsmbshare) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSmbShare resource type. - Automatically generated from - 'xSmbShare/DscResources/MSFT_xSmbShare/MSFT_xSmbShare.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xSmbShare' end - def dscmeta_resource_name; 'MSFT_xSmbShare' end - def dscmeta_module_name; 'xSmbShare' end - def dscmeta_module_version; '2.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Name of the SMB Share" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Path - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_path) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Path - Path to the share" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Description - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_description) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Description - Description of the share" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ChangeAccess - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_changeaccess, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ChangeAccess - Specifies which user will be granted modify permission to access the share" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: ConcurrentUserLimit - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_concurrentuserlimit) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "ConcurrentUserLimit - Specifies the maximum number of concurrently connected users that the new SMB share may accommodate. If this parameter is set to zero (0), then the number of users is unlimited. The default value is zero (0)." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: EncryptData - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_encryptdata) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "EncryptData - Indicates that the share is encrypted." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: FolderEnumerationMode - # Type: string - # IsMandatory: False - # Values: ["AccessBased", "Unrestricted"] - newparam(:dsc_folderenumerationmode) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FolderEnumerationMode - Specifies which files and folders in the new SMB share are visible to users. Valid values are AccessBased, Unrestricted." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['AccessBased', 'accessbased', 'Unrestricted', 'unrestricted'].include?(value) - fail("Invalid value '#{value}'. Valid values are AccessBased, Unrestricted") - end - end - end - - # Name: FullAccess - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_fullaccess, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "FullAccess - Specifies which accounts are granted full permission to access the share." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: NoAccess - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_noaccess, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "NoAccess - Specifies which accounts are denied access to the share." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: ReadAccess - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_readaccess, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ReadAccess - Specifies which user is granted read permission to access the share." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies if the share should be added or removed Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: ShareState - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sharestate) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ShareState - Specfies the state of the share" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ShareType - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sharetype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ShareType - Specfies the type of the share" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ShadowCopy - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_shadowcopy) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ShadowCopy - Specifies if this share is a ShadowCopy" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Special - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_special) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Special - Specifies if this share is a Special Share. Admin share, default shares, IPC$ share are examples." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsmbshare).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlalias.rb b/lib/puppet/type/dsc_xsqlalias.rb deleted file mode 100644 index 58ab9fa7..00000000 --- a/lib/puppet/type/dsc_xsqlalias.rb +++ /dev/null @@ -1,171 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlalias) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSqlAlias resource type. - Automatically generated from - 'xSqlPs/DSCResources/MSFT_xSqlAlias/MSFT_xSqlAlias.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xSqlAlias' end - def dscmeta_resource_name; 'MSFT_xSqlAlias' end - def dscmeta_module_name; 'xSqlPs' end - def dscmeta_module_version; '1.4.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Protocol - # Type: string - # IsMandatory: False - # Values: ["TCP", "NP"] - newparam(:dsc_protocol) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Protocol - Valid values are TCP, NP." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['TCP', 'tcp', 'NP', 'np'].include?(value) - fail("Invalid value '#{value}'. Valid values are TCP, NP") - end - end - end - - # Name: ServerName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_servername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServerName" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: TCPPort - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_tcpport) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "TCPPort" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: PipeName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_pipename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "PipeName" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlalias).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlaogroupensure.rb b/lib/puppet/type/dsc_xsqlaogroupensure.rb deleted file mode 100644 index 6703f41c..00000000 --- a/lib/puppet/type/dsc_xsqlaogroupensure.rb +++ /dev/null @@ -1,294 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlaogroupensure) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSQLAOGroupEnsure resource type. - Automatically generated from - 'xSQLServer/DSCResources/MSFT_xSQLAOGroupEnsure/MSFT_xSQLAOGroupEnsure.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_ensure is a required attribute') if self[:dsc_ensure].nil? - fail('dsc_availabilitygroupname is a required attribute') if self[:dsc_availabilitygroupname].nil? - end - - def dscmeta_resource_friendly_name; 'xSQLAOGroupEnsure' end - def dscmeta_resource_name; 'MSFT_xSQLAOGroupEnsure' end - def dscmeta_module_name; 'xSQLServer' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: True - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Determines whether the availability group should be added or removed. Valid values are Present, Absent." - isrequired - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: AvailabilityGroupName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_availabilitygroupname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AvailabilityGroupName - Name for availability group." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AvailabilityGroupNameListener - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_availabilitygroupnamelistener) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AvailabilityGroupNameListener - Listener name for availability group." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AvailabilityGroupNameIP - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_availabilitygroupnameip, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "AvailabilityGroupNameIP - List of IP addresses associated with listener." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: AvailabilityGroupSubMask - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_availabilitygroupsubmask, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "AvailabilityGroupSubMask - Network subnetmask for listener." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: AvailabilityGroupPort - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_availabilitygroupport) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "AvailabilityGroupPort - Port availability group should listen on." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ReadableSecondary - # Type: string - # IsMandatory: False - # Values: ["None", "ReadOnly", "ReadIntent"] - newparam(:dsc_readablesecondary) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ReadableSecondary - Mode secondaries should operate under (None, ReadOnly, ReadIntent). Valid values are None, ReadOnly, ReadIntent." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['None', 'none', 'ReadOnly', 'readonly', 'ReadIntent', 'readintent'].include?(value) - fail("Invalid value '#{value}'. Valid values are None, ReadOnly, ReadIntent") - end - end - end - - # Name: AutoBackupPreference - # Type: string - # IsMandatory: False - # Values: ["Primary", "Secondary"] - newparam(:dsc_autobackuppreference) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AutoBackupPreference - Where backups should be backed up from (Primary, Secondary). Valid values are Primary, Secondary." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Primary', 'primary', 'Secondary', 'secondary'].include?(value) - fail("Invalid value '#{value}'. Valid values are Primary, Secondary") - end - end - end - - # Name: BackupPriority - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_backuppriority) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "BackupPriority - The percentage weight for backup prority (default 50)." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: EndPointPort - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_endpointport) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "EndPointPort - he TCP port for the SQL AG Endpoint (default 5022)." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: SQLServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLServer - The SQL Server for the database." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLInstanceName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlinstancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLInstanceName - The SQL instance for the database." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SetupCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_setupcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SetupCredential - Credential to be used to Grant Permissions on SQL Server, set this to $null to use Windows Authentication." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SetupCredential", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlaogroupensure).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlaogroupjoin.rb b/lib/puppet/type/dsc_xsqlaogroupjoin.rb deleted file mode 100644 index 77d1281e..00000000 --- a/lib/puppet/type/dsc_xsqlaogroupjoin.rb +++ /dev/null @@ -1,153 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlaogroupjoin) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSQLAOGroupJoin resource type. - Automatically generated from - 'xSQLServer/DSCResources/MSFT_xSQLAOGroupJoin/MSFT_xSQLAOGroupJoin.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_ensure is a required attribute') if self[:dsc_ensure].nil? - fail('dsc_availabilitygroupname is a required attribute') if self[:dsc_availabilitygroupname].nil? - end - - def dscmeta_resource_friendly_name; 'xSQLAOGroupJoin' end - def dscmeta_resource_name; 'MSFT_xSQLAOGroupJoin' end - def dscmeta_module_name; 'xSQLServer' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: True - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - If the replica should be joined ('Present') to the Availability Group or not joined ('Absent') to the Availability Group. Valid values are Present, Absent." - isrequired - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: AvailabilityGroupName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_availabilitygroupname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AvailabilityGroupName - The name Availability Group to join." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLServer - Name of the SQL server to be configured." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLInstanceName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlinstancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLInstanceName - Name of the SQL instance to be configured." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SetupCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_setupcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SetupCredential - Credential to be used to Grant Permissions in SQL." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SetupCredential", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlaogroupjoin).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlhaendpoint.rb b/lib/puppet/type/dsc_xsqlhaendpoint.rb deleted file mode 100644 index ce34e2fb..00000000 --- a/lib/puppet/type/dsc_xsqlhaendpoint.rb +++ /dev/null @@ -1,135 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlhaendpoint) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSqlHAEndPoint resource type. - Automatically generated from - 'xSqlPs/DSCResources/MSFT_xSqlHAEndPoint/MSFT_xSqlHAEndPoint.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_instancename is a required attribute') if self[:dsc_instancename].nil? - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xSqlHAEndPoint' end - def dscmeta_resource_name; 'MSFT_xSqlHAEndPoint' end - def dscmeta_module_name; 'xSqlPs' end - def dscmeta_module_version; '1.4.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: InstanceName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_instancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstanceName - Name of Sql Instance." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AllowedUser - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_alloweduser) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AllowedUser - Windows Account that could access the HA database mirroring endpoing." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Unique name for HA database mirroring endpoint of the sql instance." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: PortNumber - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_portnumber) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "PortNumber - The single port number(nnnn) on which the Sql HA to listen to." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlhaendpoint).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlhagroup.rb b/lib/puppet/type/dsc_xsqlhagroup.rb deleted file mode 100644 index 376500da..00000000 --- a/lib/puppet/type/dsc_xsqlhagroup.rb +++ /dev/null @@ -1,195 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlhagroup) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSqlHAGroup resource type. - Automatically generated from - 'xSqlPs/DSCResources/MSFT_xSqlHAGroup/MSFT_xSqlHAGroup.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xSqlHAGroup' end - def dscmeta_resource_name; 'MSFT_xSqlHAGroup' end - def dscmeta_module_name; 'xSqlPs' end - def dscmeta_module_version; '1.4.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of sql availability group" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Database - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_database, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Database - Array of databases on the local sql instance. Each database can belong to only one HA group." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: ClusterName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_clustername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ClusterName - The name of windows failover cluster for the availability group" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseBackupPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_databasebackuppath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DatabaseBackupPath - The net share for Sql replication initialization" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstanceName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_instancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstanceName - Name of sql instance" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: EndPointName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_endpointname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "EndPointName - Name of EndPoint to access High Availability sql instance." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DomainCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_domaincredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "DomainCredential - Domain credential could get list of cluster nodes." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("DomainCredential", value) - end - end - - # Name: SqlAdministratorCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_sqladministratorcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SqlAdministratorCredential - Sql sa credential." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SqlAdministratorCredential", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlhagroup).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlhaservice.rb b/lib/puppet/type/dsc_xsqlhaservice.rb deleted file mode 100644 index 0ca46879..00000000 --- a/lib/puppet/type/dsc_xsqlhaservice.rb +++ /dev/null @@ -1,117 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlhaservice) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSqlHAService resource type. - Automatically generated from - 'xSqlPs/DSCResources/MSFT_xSqlHAService/MSFT_xSqlHAService.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_instancename is a required attribute') if self[:dsc_instancename].nil? - end - - def dscmeta_resource_friendly_name; 'xSqlHAService' end - def dscmeta_resource_name; 'MSFT_xSqlHAService' end - def dscmeta_module_name; 'xSqlPs' end - def dscmeta_module_version; '1.4.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: InstanceName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_instancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstanceName - The name of Sql instance." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SqlAdministratorCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_sqladministratorcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SqlAdministratorCredential - Sql sa credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SqlAdministratorCredential", value) - end - end - - # Name: ServiceCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_servicecredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "ServiceCredential - Domain credential to run sql service" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("ServiceCredential", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlhaservice).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlserveralias.rb b/lib/puppet/type/dsc_xsqlserveralias.rb deleted file mode 100644 index 0c58236b..00000000 --- a/lib/puppet/type/dsc_xsqlserveralias.rb +++ /dev/null @@ -1,189 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlserveralias) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSQLServerAlias resource type. - Automatically generated from - 'xSQLServer/DSCResources/MSFT_xSQLServerAlias/MSFT_xSQLServerAlias.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - fail('dsc_servername is a required attribute') if self[:dsc_servername].nil? - end - - def dscmeta_resource_friendly_name; 'xSQLServerAlias' end - def dscmeta_resource_name; 'MSFT_xSQLServerAlias' end - def dscmeta_module_name; 'xSQLServer' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of Alias (e.g. svr01\\inst01)." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Protocol - # Type: string - # IsMandatory: False - # Values: ["TCP", "NP"] - newparam(:dsc_protocol) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Protocol - Protocol to use when connecting. Valid values are 'TCP' or 'NP' (Named Pipes). Default value is 'TCP'. Valid values are TCP, NP." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['TCP', 'tcp', 'NP', 'np'].include?(value) - fail("Invalid value '#{value}'. Valid values are TCP, NP") - end - end - end - - # Name: ServerName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_servername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServerName - The SQL Server you are aliasing (the netbios name or FQDN)." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: TcpPort - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_tcpport) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "TcpPort - The TCP port SQL is listening on. Only used when protocol is set to 'TCP'. Default value is port 1433." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: UseDynamicTcpPort - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_usedynamictcpport) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "UseDynamicTcpPort - The UseDynamicTcpPort specify that the Net-Library will determine the port dynamically. The port specified in Port number will not be used. Default value is '$false'." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: PipeName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_pipename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "PipeName - Named Pipes path from the Get-TargetResource method." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Determines whether the alias should be added or removed. Default value is 'Present' Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlserveralias).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlserveralwaysonavailabilitygroup.rb b/lib/puppet/type/dsc_xsqlserveralwaysonavailabilitygroup.rb deleted file mode 100644 index 089ca85c..00000000 --- a/lib/puppet/type/dsc_xsqlserveralwaysonavailabilitygroup.rb +++ /dev/null @@ -1,312 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlserveralwaysonavailabilitygroup) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSQLServerAlwaysOnAvailabilityGroup resource type. - Automatically generated from - 'xSQLServer/DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroup/MSFT_xSQLServerAlwaysOnAvailabilityGroup.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - fail('dsc_sqlinstancename is a required attribute') if self[:dsc_sqlinstancename].nil? - end - - def dscmeta_resource_friendly_name; 'xSQLServerAlwaysOnAvailabilityGroup' end - def dscmeta_resource_name; 'MSFT_xSQLServerAlwaysOnAvailabilityGroup' end - def dscmeta_module_name; 'xSQLServer' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the availability group." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLServer - Hostname of the SQL Server to be configured." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLInstanceName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_sqlinstancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLInstanceName - Name of the SQL instance to be configued." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies if the availability group should be present or absent. Default is Present. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: AutomatedBackupPreference - # Type: string - # IsMandatory: False - # Values: ["Primary", "SecondaryOnly", "Secondary", "None"] - newparam(:dsc_automatedbackuppreference) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AutomatedBackupPreference - Specifies the automated backup preference for the availability group. Default is None Valid values are Primary, SecondaryOnly, Secondary, None." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Primary', 'primary', 'SecondaryOnly', 'secondaryonly', 'Secondary', 'secondary', 'None', 'none'].include?(value) - fail("Invalid value '#{value}'. Valid values are Primary, SecondaryOnly, Secondary, None") - end - end - end - - # Name: AvailabilityMode - # Type: string - # IsMandatory: False - # Values: ["AsynchronousCommit", "SynchronousCommit"] - newparam(:dsc_availabilitymode) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AvailabilityMode - Specifies the replica availability mode. Default is 'AsynchronousCommit'. Valid values are AsynchronousCommit, SynchronousCommit." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['AsynchronousCommit', 'asynchronouscommit', 'SynchronousCommit', 'synchronouscommit'].include?(value) - fail("Invalid value '#{value}'. Valid values are AsynchronousCommit, SynchronousCommit") - end - end - end - - # Name: BackupPriority - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_backuppriority) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "BackupPriority - Specifies the desired priority of the replicas in performing backups. The acceptable values for this parameter are: integers from 0 through 100. Of the set of replicas which are online and available, the replica that has the highest priority performs the backup. Default is 50." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: BasicAvailabilityGroup - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_basicavailabilitygroup) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "BasicAvailabilityGroup - Specifies the type of availability group is Basic. This is only available is SQL Server 2016 and later and is ignored when applied to previous versions." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ConnectionModeInPrimaryRole - # Type: string - # IsMandatory: False - # Values: ["AllowAllConnections", "AllowReadWriteConnections"] - newparam(:dsc_connectionmodeinprimaryrole) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ConnectionModeInPrimaryRole - Specifies how the availability replica handles connections when in the primary role. Valid values are AllowAllConnections, AllowReadWriteConnections." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['AllowAllConnections', 'allowallconnections', 'AllowReadWriteConnections', 'allowreadwriteconnections'].include?(value) - fail("Invalid value '#{value}'. Valid values are AllowAllConnections, AllowReadWriteConnections") - end - end - end - - # Name: ConnectionModeInSecondaryRole - # Type: string - # IsMandatory: False - # Values: ["AllowNoConnections", "AllowReadIntentConnectionsOnly", "AllowAllConnections"] - newparam(:dsc_connectionmodeinsecondaryrole) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ConnectionModeInSecondaryRole - Specifies how the availability replica handles connections when in the secondary role. Valid values are AllowNoConnections, AllowReadIntentConnectionsOnly, AllowAllConnections." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['AllowNoConnections', 'allownoconnections', 'AllowReadIntentConnectionsOnly', 'allowreadintentconnectionsonly', 'AllowAllConnections', 'allowallconnections'].include?(value) - fail("Invalid value '#{value}'. Valid values are AllowNoConnections, AllowReadIntentConnectionsOnly, AllowAllConnections") - end - end - end - - # Name: EndpointHostName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_endpointhostname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "EndpointHostName - Specifies the hostname or IP address of the availability group replica endpoint. Default is the instance network name." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: FailureConditionLevel - # Type: string - # IsMandatory: False - # Values: ["OnServerDown", "OnServerUnresponsive", "OnCriticalServerErrors", "OnModerateServerErrors", "OnAnyQualifiedFailureCondition"] - newparam(:dsc_failureconditionlevel) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FailureConditionLevel - Specifies the automatic failover behavior of the availability group. Valid values are OnServerDown, OnServerUnresponsive, OnCriticalServerErrors, OnModerateServerErrors, OnAnyQualifiedFailureCondition." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['OnServerDown', 'onserverdown', 'OnServerUnresponsive', 'onserverunresponsive', 'OnCriticalServerErrors', 'oncriticalservererrors', 'OnModerateServerErrors', 'onmoderateservererrors', 'OnAnyQualifiedFailureCondition', 'onanyqualifiedfailurecondition'].include?(value) - fail("Invalid value '#{value}'. Valid values are OnServerDown, OnServerUnresponsive, OnCriticalServerErrors, OnModerateServerErrors, OnAnyQualifiedFailureCondition") - end - end - end - - # Name: FailoverMode - # Type: string - # IsMandatory: False - # Values: ["Automatic", "Manual"] - newparam(:dsc_failovermode) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FailoverMode - Specifies the failover mode. Default is 'Manual'. Valid values are Automatic, Manual." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Automatic', 'automatic', 'Manual', 'manual'].include?(value) - fail("Invalid value '#{value}'. Valid values are Automatic, Manual") - end - end - end - - # Name: HealthCheckTimeout - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_healthchecktimeout) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "HealthCheckTimeout - Specifies the length of time, in milliseconds, after which AlwaysOn availability groups declare an unresponsive server to be unhealthy. Default is 30000." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlserveralwaysonavailabilitygroup).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlserveralwaysonavailabilitygroupreplica.rb b/lib/puppet/type/dsc_xsqlserveralwaysonavailabilitygroupreplica.rb deleted file mode 100644 index 15dad18a..00000000 --- a/lib/puppet/type/dsc_xsqlserveralwaysonavailabilitygroupreplica.rb +++ /dev/null @@ -1,337 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlserveralwaysonavailabilitygroupreplica) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSQLServerAlwaysOnAvailabilityGroupReplica resource type. - Automatically generated from - 'xSQLServer/DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupReplica/MSFT_xSQLServerAlwaysOnAvailabilityGroupReplica.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - fail('dsc_availabilitygroupname is a required attribute') if self[:dsc_availabilitygroupname].nil? - fail('dsc_sqlinstancename is a required attribute') if self[:dsc_sqlinstancename].nil? - end - - def dscmeta_resource_friendly_name; 'xSQLServerAlwaysOnAvailabilityGroupReplica' end - def dscmeta_resource_name; 'MSFT_xSQLServerAlwaysOnAvailabilityGroupReplica' end - def dscmeta_module_name; 'xSQLServer' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the availability group replica." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AvailabilityGroupName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_availabilitygroupname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AvailabilityGroupName - The name of the availability group." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLServer - Hostname of the SQL Server to be configured." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLInstanceName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_sqlinstancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLInstanceName - Name of the SQL instance to be configued." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: PrimaryReplicaSQLServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_primaryreplicasqlserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "PrimaryReplicaSQLServer - Hostname of the SQL Server where the primary replica is expected to be active. If the primary replica is not found here, the resource will attempt to find the host that holds the primary replica and connect to it." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: PrimaryReplicaSQLInstanceName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_primaryreplicasqlinstancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "PrimaryReplicaSQLInstanceName - Name of the SQL instance where the primary replica lives." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies if the availability group replica should be present or absent. Default is Present. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: AvailabilityMode - # Type: string - # IsMandatory: False - # Values: ["AsynchronousCommit", "SynchronousCommit"] - newparam(:dsc_availabilitymode) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AvailabilityMode - Specifies the replica availability mode. Default is 'AsynchronousCommit'. Valid values are AsynchronousCommit, SynchronousCommit." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['AsynchronousCommit', 'asynchronouscommit', 'SynchronousCommit', 'synchronouscommit'].include?(value) - fail("Invalid value '#{value}'. Valid values are AsynchronousCommit, SynchronousCommit") - end - end - end - - # Name: BackupPriority - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_backuppriority) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "BackupPriority - Specifies the desired priority of the replicas in performing backups. The acceptable values for this parameter are: integers from 0 through 100. Of the set of replicas which are online and available, the replica that has the highest priority performs the backup. Default is 50." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ConnectionModeInPrimaryRole - # Type: string - # IsMandatory: False - # Values: ["AllowAllConnections", "AllowReadWriteConnections"] - newparam(:dsc_connectionmodeinprimaryrole) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ConnectionModeInPrimaryRole - Specifies how the availability replica handles connections when in the primary role. Valid values are AllowAllConnections, AllowReadWriteConnections." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['AllowAllConnections', 'allowallconnections', 'AllowReadWriteConnections', 'allowreadwriteconnections'].include?(value) - fail("Invalid value '#{value}'. Valid values are AllowAllConnections, AllowReadWriteConnections") - end - end - end - - # Name: ConnectionModeInSecondaryRole - # Type: string - # IsMandatory: False - # Values: ["AllowNoConnections", "AllowReadIntentConnectionsOnly", "AllowAllConnections"] - newparam(:dsc_connectionmodeinsecondaryrole) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ConnectionModeInSecondaryRole - Specifies how the availability replica handles connections when in the secondary role. Valid values are AllowNoConnections, AllowReadIntentConnectionsOnly, AllowAllConnections." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['AllowNoConnections', 'allownoconnections', 'AllowReadIntentConnectionsOnly', 'allowreadintentconnectionsonly', 'AllowAllConnections', 'allowallconnections'].include?(value) - fail("Invalid value '#{value}'. Valid values are AllowNoConnections, AllowReadIntentConnectionsOnly, AllowAllConnections") - end - end - end - - # Name: EndpointHostName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_endpointhostname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "EndpointHostName - Specifies the hostname or IP address of the availability group replica endpoint. Default is the instance network name which is set in the code because the value can only be determined when connected to the SQL Instance." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: FailoverMode - # Type: string - # IsMandatory: False - # Values: ["Automatic", "Manual"] - newparam(:dsc_failovermode) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FailoverMode - Specifies the failover mode. Default is 'Manual'. Valid values are Automatic, Manual." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Automatic', 'automatic', 'Manual', 'manual'].include?(value) - fail("Invalid value '#{value}'. Valid values are Automatic, Manual") - end - end - end - - # Name: ReadOnlyRoutingConnectionUrl - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_readonlyroutingconnectionurl) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ReadOnlyRoutingConnectionUrl - Specifies the fully-qualified domain name (FQDN) and port to use when routing to the replica for read only connections." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ReadOnlyRoutingList - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_readonlyroutinglist, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ReadOnlyRoutingList - Specifies an ordered list of replica server names that represent the probe sequence for connection director to use when redirecting read-only connections through this availability replica. This parameter applies if the availability replica is the current primary replica of the availability group." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: SqlServerNetName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlservernetname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SqlServerNetName - Output the NetName property from the SQL Server object. Used by Get-TargetResource" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlserveralwaysonavailabilitygroupreplica).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlserveralwaysonservice.rb b/lib/puppet/type/dsc_xsqlserveralwaysonservice.rb deleted file mode 100644 index 683c9c8b..00000000 --- a/lib/puppet/type/dsc_xsqlserveralwaysonservice.rb +++ /dev/null @@ -1,140 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlserveralwaysonservice) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSQLServerAlwaysOnService resource type. - Automatically generated from - 'xSQLServer/DSCResources/MSFT_xSQLServerAlwaysOnService/MSFT_xSQLServerAlwaysOnService.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_sqlserver is a required attribute') if self[:dsc_sqlserver].nil? - fail('dsc_sqlinstancename is a required attribute') if self[:dsc_sqlinstancename].nil? - end - - def dscmeta_resource_friendly_name; 'xSQLServerAlwaysOnService' end - def dscmeta_resource_name; 'MSFT_xSQLServerAlwaysOnService' end - def dscmeta_module_name; 'xSQLServer' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - HADR is Present (enabled) or Absent (disabled) Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: SQLServer - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_sqlserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLServer - The hostname of the SQL Server to be configured" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLInstanceName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_sqlinstancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLInstanceName - Name of the SQL instance to be configured." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RestartTimeout - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_restarttimeout) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "RestartTimeout - The length of time, in seconds, to wait for the service to restart. Default is 120 seconds." - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlserveralwaysonservice).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlserveravailabilitygrouplistener.rb b/lib/puppet/type/dsc_xsqlserveravailabilitygrouplistener.rb deleted file mode 100644 index 41588204..00000000 --- a/lib/puppet/type/dsc_xsqlserveravailabilitygrouplistener.rb +++ /dev/null @@ -1,204 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlserveravailabilitygrouplistener) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSQLServerAvailabilityGroupListener resource type. - Automatically generated from - 'xSQLServer/DSCResources/MSFT_xSQLServerAvailabilityGroupListener/MSFT_xSQLServerAvailabilityGroupListener.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_instancename is a required attribute') if self[:dsc_instancename].nil? - fail('dsc_availabilitygroup is a required attribute') if self[:dsc_availabilitygroup].nil? - end - - def dscmeta_resource_friendly_name; 'xSQLServerAvailabilityGroupListener' end - def dscmeta_resource_name; 'MSFT_xSQLServerAvailabilityGroupListener' end - def dscmeta_module_name; 'xSQLServer' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: InstanceName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_instancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstanceName - The SQL Server instance name of the primary replica." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: NodeName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_nodename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "NodeName - The host name or FQDN of the primary replica." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Name - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the availability group listener, max 15 characters. This name will be used as the Virtual Computer Object (VCO)." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - If the availability group listener should be present or absent. Default value is 'Present'. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: AvailabilityGroup - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_availabilitygroup) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AvailabilityGroup - The name of the availability group to which the availability group listener is or will be connected." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: IpAddress - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_ipaddress, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "IpAddress - The IP address used for the availability group listener, in the format 192.168.10.45/255.255.252.0. If using DCHP, set to the first IP-address of the DHCP subnet, in the format 192.168.8.1/255.255.252.0. Must be valid in the cluster-allowed IP range." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: Port - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_port) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "Port - The port used for the availability group listener" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: DHCP - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_dhcp) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DHCP - If DHCP should be used for the availability group listener instead of static IP address." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlserveravailabilitygrouplistener).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlserverconfiguration.rb b/lib/puppet/type/dsc_xsqlserverconfiguration.rb deleted file mode 100644 index eb55227a..00000000 --- a/lib/puppet/type/dsc_xsqlserverconfiguration.rb +++ /dev/null @@ -1,171 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlserverconfiguration) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSQLServerConfiguration resource type. - Automatically generated from - 'xSQLServer/DSCResources/MSFT_xSQLServerConfiguration/MSFT_xSQLServerConfiguration.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_sqlserver is a required attribute') if self[:dsc_sqlserver].nil? - fail('dsc_sqlinstancename is a required attribute') if self[:dsc_sqlinstancename].nil? - fail('dsc_optionname is a required attribute') if self[:dsc_optionname].nil? - end - - def dscmeta_resource_friendly_name; 'xSQLServerConfiguration' end - def dscmeta_resource_name; 'MSFT_xSQLServerConfiguration' end - def dscmeta_module_name; 'xSQLServer' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: SQLServer - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_sqlserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLServer - The hostname of the SQL Server to be configured." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLInstanceName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_sqlinstancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLInstanceName - Name of the SQL instance to be configured." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: OptionName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_optionname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "OptionName - The name of the SQL configuration option to be checked." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: OptionValue - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_optionvalue) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "OptionValue - The desired value of the SQL configuration option." - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: RestartService - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_restartservice) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RestartService - Determines whether the instance should be restarted after updating the configuration option." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: RestartTimeout - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_restarttimeout) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "RestartTimeout - The length of time, in seconds, to wait for the service to restart. Default is 120 seconds." - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlserverconfiguration).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlserverdatabase.rb b/lib/puppet/type/dsc_xsqlserverdatabase.rb deleted file mode 100644 index da59de55..00000000 --- a/lib/puppet/type/dsc_xsqlserverdatabase.rb +++ /dev/null @@ -1,139 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlserverdatabase) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSQLServerDatabase resource type. - Automatically generated from - 'xSQLServer/DSCResources/MSFT_xSQLServerDatabase/MSFT_xSQLServerDatabase.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - fail('dsc_sqlserver is a required attribute') if self[:dsc_sqlserver].nil? - fail('dsc_sqlinstancename is a required attribute') if self[:dsc_sqlinstancename].nil? - end - - def dscmeta_resource_friendly_name; 'xSQLServerDatabase' end - def dscmeta_resource_name; 'MSFT_xSQLServerDatabase' end - def dscmeta_module_name; 'xSQLServer' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the SQL database." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if the database is added (Present) or dropped (Absent). Valid values are 'Present' or 'Absent'. Default Value is 'Present'. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: SQLServer - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_sqlserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLServer - The host name of the SQL Server to be configured." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLInstanceName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_sqlinstancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLInstanceName - The name of the SQL instance to be configured." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlserverdatabase).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlserverdatabaseowner.rb b/lib/puppet/type/dsc_xsqlserverdatabaseowner.rb deleted file mode 100644 index fa74d819..00000000 --- a/lib/puppet/type/dsc_xsqlserverdatabaseowner.rb +++ /dev/null @@ -1,130 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlserverdatabaseowner) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSQLServerDatabaseOwner resource type. - Automatically generated from - 'xSQLServer/DSCResources/MSFT_xSQLServerDatabaseOwner/MSFT_xSQLServerDatabaseOwner.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_database is a required attribute') if self[:dsc_database].nil? - end - - def dscmeta_resource_friendly_name; 'xSQLServerDatabaseOwner' end - def dscmeta_resource_name; 'MSFT_xSQLServerDatabaseOwner' end - def dscmeta_module_name; 'xSQLServer' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Database - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_database) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Database - The name of database to be configured." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Name - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the login that will become a owner of the desired sql database." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLServer - The host name of the SQL Server to be configured." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLInstanceName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlinstancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLInstanceName - The name of the SQL instance to be configured." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlserverdatabaseowner).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlserverdatabasepermission.rb b/lib/puppet/type/dsc_xsqlserverdatabasepermission.rb deleted file mode 100644 index 5a3122c1..00000000 --- a/lib/puppet/type/dsc_xsqlserverdatabasepermission.rb +++ /dev/null @@ -1,194 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlserverdatabasepermission) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSQLServerDatabasePermission resource type. - Automatically generated from - 'xSQLServer/DSCResources/MSFT_xSQLServerDatabasePermission/MSFT_xSQLServerDatabasePermission.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_database is a required attribute') if self[:dsc_database].nil? - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - fail('dsc_permissionstate is a required attribute') if self[:dsc_permissionstate].nil? - fail('dsc_sqlserver is a required attribute') if self[:dsc_sqlserver].nil? - fail('dsc_sqlinstancename is a required attribute') if self[:dsc_sqlinstancename].nil? - end - - def dscmeta_resource_friendly_name; 'xSQLServerDatabasePermission' end - def dscmeta_resource_name; 'MSFT_xSQLServerDatabasePermission' end - def dscmeta_module_name; 'xSQLServer' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - If the values should be present or absent. Valid values are 'Present' or 'Absent'. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Database - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_database) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Database - The name of the database." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the user that should be granted or denied the permission." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: PermissionState - # Type: string - # IsMandatory: True - # Values: ["Grant", "Deny"] - newparam(:dsc_permissionstate) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "PermissionState - The state of the permission. Valid values are 'Grant' or 'Deny'. Valid values are Grant, Deny." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Grant', 'grant', 'Deny', 'deny'].include?(value) - fail("Invalid value '#{value}'. Valid values are Grant, Deny") - end - end - end - - # Name: Permissions - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_permissions, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Permissions - The set of permissions for the SQL database." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: SQLServer - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_sqlserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLServer - The host name of the SQL Server to be configured." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLInstanceName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_sqlinstancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLInstanceName - The name of the SQL instance to be configured." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlserverdatabasepermission).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlserverdatabaserecoverymodel.rb b/lib/puppet/type/dsc_xsqlserverdatabaserecoverymodel.rb deleted file mode 100644 index b1512c65..00000000 --- a/lib/puppet/type/dsc_xsqlserverdatabaserecoverymodel.rb +++ /dev/null @@ -1,137 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlserverdatabaserecoverymodel) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSQLServerDatabaseRecoveryModel resource type. - Automatically generated from - 'xSQLServer/DSCResources/MSFT_xSQLServerDatabaseRecoveryModel/MSFT_xSQLServerDatabaseRecoveryModel.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - fail('dsc_sqlserver is a required attribute') if self[:dsc_sqlserver].nil? - fail('dsc_sqlinstancename is a required attribute') if self[:dsc_sqlinstancename].nil? - end - - def dscmeta_resource_friendly_name; 'xSQLServerDatabaseRecoveryModel' end - def dscmeta_resource_name; 'MSFT_xSQLServerDatabaseRecoveryModel' end - def dscmeta_module_name; 'xSQLServer' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The SQL database name" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RecoveryModel - # Type: string - # IsMandatory: False - # Values: ["Full", "Simple", "BulkLogged"] - newparam(:dsc_recoverymodel) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RecoveryModel - The recovery model to use for the database. Valid values are Full, Simple, BulkLogged." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Full', 'full', 'Simple', 'simple', 'BulkLogged', 'bulklogged'].include?(value) - fail("Invalid value '#{value}'. Valid values are Full, Simple, BulkLogged") - end - end - end - - # Name: SQLServer - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_sqlserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLServer - The host name of the SQL Server to be configured." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLInstanceName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_sqlinstancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLInstanceName - The name of the SQL instance to be configured." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlserverdatabaserecoverymodel).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlserverdatabaserole.rb b/lib/puppet/type/dsc_xsqlserverdatabaserole.rb deleted file mode 100644 index 379ace27..00000000 --- a/lib/puppet/type/dsc_xsqlserverdatabaserole.rb +++ /dev/null @@ -1,174 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlserverdatabaserole) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSQLServerDatabaseRole resource type. - Automatically generated from - 'xSQLServer/DSCResources/MSFT_xSQLServerDatabaseRole/MSFT_xSQLServerDatabaseRole.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - fail('dsc_sqlserver is a required attribute') if self[:dsc_sqlserver].nil? - fail('dsc_sqlinstancename is a required attribute') if self[:dsc_sqlinstancename].nil? - fail('dsc_database is a required attribute') if self[:dsc_database].nil? - end - - def dscmeta_resource_friendly_name; 'xSQLServerDatabaseRole' end - def dscmeta_resource_name; 'MSFT_xSQLServerDatabaseRole' end - def dscmeta_module_name; 'xSQLServer' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - If 'Present' (the default value) then the login (user) will be added to the role(s). If 'Absent' then the login (user) will be removed from the role(s). Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the login that will become a member, or removed as a member, of the role(s)." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLServer - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_sqlserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLServer - The host name of the SQL Server to be configured." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLInstanceName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_sqlinstancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLInstanceName - The name of the SQL instance to be configured." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Database - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_database) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Database - The database in which the login (user) and role(s) exist." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Role - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_role, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Role - One or more roles to which the login (user) will be added or removed." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlserverdatabaserole).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlserverendpoint.rb b/lib/puppet/type/dsc_xsqlserverendpoint.rb deleted file mode 100644 index 235a5664..00000000 --- a/lib/puppet/type/dsc_xsqlserverendpoint.rb +++ /dev/null @@ -1,170 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlserverendpoint) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSQLServerEndpoint resource type. - Automatically generated from - 'xSQLServer/DSCResources/MSFT_xSQLServerEndpoint/MSFT_xSQLServerEndpoint.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_endpointname is a required attribute') if self[:dsc_endpointname].nil? - fail('dsc_sqlinstancename is a required attribute') if self[:dsc_sqlinstancename].nil? - end - - def dscmeta_resource_friendly_name; 'xSQLServerEndpoint' end - def dscmeta_resource_name; 'MSFT_xSQLServerEndpoint' end - def dscmeta_module_name; 'xSQLServer' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: EndpointName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_endpointname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "EndpointName - The name of the endpoint." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - If the endpoint should be present or absent. Default values is 'Present'. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Port - # Type: uint16 - # IsMandatory: False - # Values: None - newparam(:dsc_port) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "Port - The network port the endpoint is listening on. Default value is 5022." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: SQLServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLServer - The host name of the SQL Server to be configured. Default value is $env:COMPUTERNAME." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLInstanceName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_sqlinstancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLInstanceName - The name of the SQL instance to be configured." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: IpAddress - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_ipaddress) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IpAddress - The network IP address the endpoint is listening on. Default the endpoint will listen on any valid IP address." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlserverendpoint).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlserverendpointpermission.rb b/lib/puppet/type/dsc_xsqlserverendpointpermission.rb deleted file mode 100644 index 1ce53658..00000000 --- a/lib/puppet/type/dsc_xsqlserverendpointpermission.rb +++ /dev/null @@ -1,170 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlserverendpointpermission) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSQLServerEndpointPermission resource type. - Automatically generated from - 'xSQLServer/DSCResources/MSFT_xSQLServerEndpointPermission/MSFT_xSQLServerEndpointPermission.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_instancename is a required attribute') if self[:dsc_instancename].nil? - fail('dsc_principal is a required attribute') if self[:dsc_principal].nil? - end - - def dscmeta_resource_friendly_name; 'xSQLServerEndpointPermission' end - def dscmeta_resource_name; 'MSFT_xSQLServerEndpointPermission' end - def dscmeta_module_name; 'xSQLServer' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: InstanceName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_instancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstanceName - The name of the SQL instance to be configured." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: NodeName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_nodename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "NodeName - The host name of the SQL Server to be configured." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - If the permission should be present or absent. Default value is 'Present'. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Name - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the endpoint." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Principal - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_principal) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Principal - The login to which permission will be set." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Permission - # Type: string - # IsMandatory: False - # Values: ["CONNECT"] - newparam(:dsc_permission) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Permission - The permission to set for the login. Valid value for permission are only CONNECT. Valid values are CONNECT." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['CONNECT', 'connect'].include?(value) - fail("Invalid value '#{value}'. Valid values are CONNECT") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlserverendpointpermission).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlserverendpointstate.rb b/lib/puppet/type/dsc_xsqlserverendpointstate.rb deleted file mode 100644 index 54bfd552..00000000 --- a/lib/puppet/type/dsc_xsqlserverendpointstate.rb +++ /dev/null @@ -1,135 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlserverendpointstate) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSQLServerEndpointState resource type. - Automatically generated from - 'xSQLServer/DSCResources/MSFT_xSQLServerEndpointState/MSFT_xSQLServerEndpointState.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_instancename is a required attribute') if self[:dsc_instancename].nil? - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xSQLServerEndpointState' end - def dscmeta_resource_name; 'MSFT_xSQLServerEndpointState' end - def dscmeta_module_name; 'xSQLServer' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: InstanceName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_instancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstanceName - The name of the SQL instance to be configured." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: NodeName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_nodename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "NodeName - The host name of the SQL Server to be configured. Default value is $env:COMPUTERNAME." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the endpoint." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: State - # Type: string - # IsMandatory: False - # Values: ["Started", "Stopped", "Disabled"] - newparam(:dsc_state) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "State - The state of the endpoint. Valid states are Started, Stopped or Disabled. Default value is 'Started'. Valid values are Started, Stopped, Disabled." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Started', 'started', 'Stopped', 'stopped', 'Disabled', 'disabled'].include?(value) - fail("Invalid value '#{value}'. Valid values are Started, Stopped, Disabled") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlserverendpointstate).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlserverfailoverclustersetup.rb b/lib/puppet/type/dsc_xsqlserverfailoverclustersetup.rb deleted file mode 100644 index 73af98fa..00000000 --- a/lib/puppet/type/dsc_xsqlserverfailoverclustersetup.rb +++ /dev/null @@ -1,795 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlserverfailoverclustersetup) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSQLServerFailoverClusterSetup resource type. - Automatically generated from - 'xSQLServer/DSCResources/MSFT_xSQLServerFailoverClusterSetup/MSFT_xSQLServerFailoverClusterSetup.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_action is a required attribute') if self[:dsc_action].nil? - fail('dsc_instancename is a required attribute') if self[:dsc_instancename].nil? - end - - def dscmeta_resource_friendly_name; 'xSQLServerFailoverClusterSetup' end - def dscmeta_resource_name; 'MSFT_xSQLServerFailoverClusterSetup' end - def dscmeta_module_name; 'xSQLServer' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Action - # Type: string - # IsMandatory: True - # Values: ["Prepare", "Complete"] - newparam(:dsc_action) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Action - Prepare or Complete. Valid values are Prepare, Complete." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Prepare', 'prepare', 'Complete', 'complete'].include?(value) - fail("Invalid value '#{value}'. Valid values are Prepare, Complete") - end - end - end - - # Name: SourcePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourcePath - UNC path to the root of the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SourceFolder - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcefolder) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourceFolder - Folder within the source path containing the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SetupCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_setupcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SetupCredential - Credential to be used to perform the installation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SetupCredential", value) - end - end - - # Name: SourceCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_sourcecredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SourceCredential - Credential to be used to access SourcePath." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SourceCredential", value) - end - end - - # Name: SuppressReboot - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_suppressreboot) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "SuppressReboot - Suppress reboot." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ForceReboot - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_forcereboot) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ForceReboot - Force reboot." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Features - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_features) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Features - SQL features to be installed." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstanceName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_instancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstanceName - SQL instance to be installed." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstanceID - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_instanceid) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstanceID - SQL instance ID, if different from InstanceName." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: PID - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_pid) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "PID - Product key for licensed installations." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UpdateEnabled - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_updateenabled) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UpdateEnabled - Enabled updates during installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UpdateSource - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_updatesource) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UpdateSource - Source of updates to be applied during installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQMReporting - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqmreporting) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQMReporting - Enable customer experience reporting." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ErrorReporting - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_errorreporting) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ErrorReporting - Enable error reporting." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: FailoverClusterGroup - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_failoverclustergroup) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FailoverClusterGroup - Name of the resource group to be used for the SQL Server failover cluster." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: FailoverClusterNetworkName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_failoverclusternetworkname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FailoverClusterNetworkName - Network name for the SQL Server failover cluster." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: FailoverClusterIPAddress - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_failoverclusteripaddress) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FailoverClusterIPAddress - IPv4 address for the SQL Server failover cluster." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstallSharedDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_installshareddir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstallSharedDir - Installation path for shared SQL files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstallSharedWOWDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_installsharedwowdir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstallSharedWOWDir - Installation path for x86 shared SQL files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstanceDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_instancedir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstanceDir - Installation path for SQL instance files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLSvcAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_sqlsvcaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SQLSvcAccount - Service account for the SQL service." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SQLSvcAccount", value) - end - end - - # Name: SQLSvcAccountUsername - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlsvcaccountusername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLSvcAccountUsername - Output username for the SQL service." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AgtSvcAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_agtsvcaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "AgtSvcAccount - Service account for the SQL Agent service." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("AgtSvcAccount", value) - end - end - - # Name: AgtSvcAccountUsername - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_agtsvcaccountusername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AgtSvcAccountUsername - Output username for the SQL Agent service." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLCollation - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlcollation) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLCollation - Collation for SQL." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLSysAdminAccounts - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_sqlsysadminaccounts, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "SQLSysAdminAccounts - Array of accounts to be made SQL administrators." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: SecurityMode - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_securitymode) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SecurityMode - Security mode." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SAPwd - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_sapwd) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SAPwd - SA password, if SecurityMode=SQL" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SAPwd", value) - end - end - - # Name: InstallSQLDataDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_installsqldatadir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstallSQLDataDir - Root path for SQL database files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLUserDBDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqluserdbdir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLUserDBDir - Path for SQL database files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLUserDBLogDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqluserdblogdir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLUserDBLogDir - Path for SQL log files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLTempDBDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqltempdbdir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLTempDBDir - Path for SQL TempDB files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLTempDBLogDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqltempdblogdir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLTempDBLogDir - Path for SQL TempDB log files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLBackupDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlbackupdir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLBackupDir - Path for SQL backup files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ASSvcAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_assvcaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "ASSvcAccount - Service account for Analysus Services service." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("ASSvcAccount", value) - end - end - - # Name: ASSvcAccountUsername - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_assvcaccountusername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ASSvcAccountUsername - Output username for the Analysis Services service." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ASCollation - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_ascollation) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ASCollation - Collation for Analysis Services." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ASSysAdminAccounts - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_assysadminaccounts, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ASSysAdminAccounts - Array of accounts to be made Analysis Services admins." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: ASDataDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_asdatadir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ASDataDir - Path for Analysis Services data files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ASLogDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_aslogdir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ASLogDir - Path for Analysis Services log files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ASBackupDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_asbackupdir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ASBackupDir - Path for Analysis Services backup files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ASTempDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_astempdir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ASTempDir - Path for Analysis Services temp files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ASConfigDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_asconfigdir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ASConfigDir - Path for Analysis Services config." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ISSvcAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_issvcaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "ISSvcAccount - Service account for Integration Services service." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("ISSvcAccount", value) - end - end - - # Name: ISSvcAccountUsername - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_issvcaccountusername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ISSvcAccountUsername - Output username for the Integration Services service." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ISFileSystemFolder - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_isfilesystemfolder) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ISFileSystemFolder - File system folder for Integration Services." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlserverfailoverclustersetup).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlserverfirewall.rb b/lib/puppet/type/dsc_xsqlserverfirewall.rb deleted file mode 100644 index f241489e..00000000 --- a/lib/puppet/type/dsc_xsqlserverfirewall.rb +++ /dev/null @@ -1,233 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlserverfirewall) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSQLServerFirewall resource type. - Automatically generated from - 'xSQLServer/DSCResources/MSFT_xSQLServerFirewall/MSFT_xSQLServerFirewall.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_features is a required attribute') if self[:dsc_features].nil? - fail('dsc_instancename is a required attribute') if self[:dsc_instancename].nil? - end - - def dscmeta_resource_friendly_name; 'xSQLServerFirewall' end - def dscmeta_resource_name; 'MSFT_xSQLServerFirewall' end - def dscmeta_module_name; 'xSQLServer' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if the SQL firewall rules are is expected to be enabled on the machine.\nPresent {default} \nAbsent \n Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: SourcePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourcePath - UNC path to the root of the source files for installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Features - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_features) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Features - SQL features to enable firewall rules for." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstanceName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_instancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstanceName - SQL instance to enable firewall rules for." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DatabaseEngineFirewall - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_databaseenginefirewall) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DatabaseEngineFirewall - Is the firewall rule for the Database Engine enabled?" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: BrowserFirewall - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_browserfirewall) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "BrowserFirewall - Is the firewall rule for the Browser enabled?" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ReportingServicesFirewall - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_reportingservicesfirewall) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ReportingServicesFirewall - Is the firewall rule for Reporting Services enabled?" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AnalysisServicesFirewall - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_analysisservicesfirewall) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AnalysisServicesFirewall - Is the firewall rule for Analysis Services enabled?" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: IntegrationServicesFirewall - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_integrationservicesfirewall) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "IntegrationServicesFirewall - Is the firewall rule for the Integration Services enabled?" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: SourceCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_sourcecredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SourceCredential - Credentials used to access the path set in the parameter 'SourcePath'." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SourceCredential", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlserverfirewall).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlserverinstall.rb b/lib/puppet/type/dsc_xsqlserverinstall.rb deleted file mode 100644 index 84ce165e..00000000 --- a/lib/puppet/type/dsc_xsqlserverinstall.rb +++ /dev/null @@ -1,313 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlserverinstall) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSqlServerInstall resource type. - Automatically generated from - 'xSqlPs/DSCResources/MSFT_xSqlServerInstall/MSFT_xSqlServerInstall.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_instancename is a required attribute') if self[:dsc_instancename].nil? - end - - def dscmeta_resource_friendly_name; 'xSqlServerInstall' end - def dscmeta_resource_name; 'MSFT_xSqlServerInstall' end - def dscmeta_module_name; 'xSqlPs' end - def dscmeta_module_version; '1.4.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: InstanceName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_instancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstanceName - The name of sql instance." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SourcePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourcePath - The share path of sql server software." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: VersionID - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_versionid) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "VersionID - The numeric version identifier for the instance to be installed" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SourcePathCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_sourcepathcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SourcePathCredential - The credential that vm could use to access net share of sql server software." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SourcePathCredential", value) - end - end - - # Name: Features - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_features) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Features - List of names of Sql Server features to install" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SqlAdministratorCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_sqladministratorcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SqlAdministratorCredential - Sql sa credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SqlAdministratorCredential", value) - end - end - - # Name: UpdateEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_updateenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "UpdateEnabled - Specify whether SQL server setup should discover and include product updates." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: SvcAccount - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_svcaccount) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SvcAccount - Specify the startup account for the SQL server service." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SysAdminAccounts - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sysadminaccounts) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SysAdminAccounts - Specify logins to be members of the sysadmin role." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AgentSvcAccount - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_agentsvcaccount) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AgentSvcAccount - Specify the account for SQL server agent service." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SqlCollation - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlcollation) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SqlCollation - Specify the default collation for SQL server" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstallSqlDataDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_installsqldatadir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstallSqlDataDir - Specify the directory for SQL server system db files" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SqlTempDBDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqltempdbdir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SqlTempDBDir - Specify the directory for TempDB files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SqlUserDBDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqluserdbdir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SqlUserDBDir - Specify the directory for UserDB data files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SqlUserDBLogDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqluserdblogdir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SqlUserDBLogDir - Specify the directory for UserDB log files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SqlBackupDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlbackupdir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SqlBackupDir - Specify the directory for backup files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlserverinstall).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlserverlogin.rb b/lib/puppet/type/dsc_xsqlserverlogin.rb deleted file mode 100644 index 71f2c3e2..00000000 --- a/lib/puppet/type/dsc_xsqlserverlogin.rb +++ /dev/null @@ -1,221 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlserverlogin) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSQLServerLogin resource type. - Automatically generated from - 'xSQLServer/DSCResources/MSFT_xSQLServerLogin/MSFT_xSQLServerLogin.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - fail('dsc_sqlserver is a required attribute') if self[:dsc_sqlserver].nil? - fail('dsc_sqlinstancename is a required attribute') if self[:dsc_sqlinstancename].nil? - end - - def dscmeta_resource_friendly_name; 'xSQLServerLogin' end - def dscmeta_resource_name; 'MSFT_xSQLServerLogin' end - def dscmeta_module_name; 'xSQLServer' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - The specified login is Present or Absent. Default is Present. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the login." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: LoginType - # Type: string - # IsMandatory: False - # Values: ["WindowsUser", "WindowsGroup", "SqlLogin", "Certificate", "AsymmetricKey", "ExternalUser", "ExternalGroup"] - newparam(:dsc_logintype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LoginType - The type of login to be created. If LoginType is 'WindowsUser' or 'WindowsGroup' then provide the name in the format DOMAIN\name. Default is WindowsUser. Unsupported login types are Certificate, AsymmetricKey, ExternalUser, and ExternalGroup. Valid values are WindowsUser, WindowsGroup, SqlLogin, Certificate, AsymmetricKey, ExternalUser, ExternalGroup." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['WindowsUser', 'windowsuser', 'WindowsGroup', 'windowsgroup', 'SqlLogin', 'sqllogin', 'Certificate', 'certificate', 'AsymmetricKey', 'asymmetrickey', 'ExternalUser', 'externaluser', 'ExternalGroup', 'externalgroup'].include?(value) - fail("Invalid value '#{value}'. Valid values are WindowsUser, WindowsGroup, SqlLogin, Certificate, AsymmetricKey, ExternalUser, ExternalGroup") - end - end - end - - # Name: SQLServer - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_sqlserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLServer - The hostname of the SQL Server to be configured." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLInstanceName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_sqlinstancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLInstanceName - Name of the SQL instance to be configured." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: LoginCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_logincredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "LoginCredential - If LoginType is 'SqlLogin' then a PSCredential is needed for the password to the login." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("LoginCredential", value) - end - end - - # Name: LoginMustChangePassword - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_loginmustchangepassword) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "LoginMustChangePassword - Specifies if the login is required to have its password change on the next login. Only applies to SQL Logins. Default is $true." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: LoginPasswordExpirationEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_loginpasswordexpirationenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "LoginPasswordExpirationEnabled - Specifies if the login password is required to expire in accordance to the operating system security policy. Only applies to SQL Logins. Default is $true." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: LoginPasswordPolicyEnforced - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_loginpasswordpolicyenforced) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "LoginPasswordPolicyEnforced - Specifies if the login password is required to conform to the password policy specified in the system security policy. Only applies to SQL Logins. Default is $true." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlserverlogin).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlservermaxdop.rb b/lib/puppet/type/dsc_xsqlservermaxdop.rb deleted file mode 100644 index 26bf7c48..00000000 --- a/lib/puppet/type/dsc_xsqlservermaxdop.rb +++ /dev/null @@ -1,154 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlservermaxdop) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSQLServerMaxDop resource type. - Automatically generated from - 'xSQLServer/DSCResources/MSFT_xSQLServerMaxDop/MSFT_xSQLServerMaxDop.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_sqlinstancename is a required attribute') if self[:dsc_sqlinstancename].nil? - end - - def dscmeta_resource_friendly_name; 'xSQLServerMaxDop' end - def dscmeta_resource_name; 'MSFT_xSQLServerMaxDop' end - def dscmeta_module_name; 'xSQLServer' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if MaxDop is configured (Present) or reset to default value (Absent) Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: DynamicAlloc - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_dynamicalloc) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DynamicAlloc - Flag to Dynamically allocate Maxdop based on Best Practices" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: MaxDop - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_maxdop) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "MaxDop - Numeric value to configure Maxdop to" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: SQLServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLServer - The host name of the SQL Server to be configured. Default value is '$env:COMPUTERNAME'." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLInstanceName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_sqlinstancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLInstanceName - The name of the SQL instance to be configured." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlservermaxdop).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlservermemory.rb b/lib/puppet/type/dsc_xsqlservermemory.rb deleted file mode 100644 index edb1e812..00000000 --- a/lib/puppet/type/dsc_xsqlservermemory.rb +++ /dev/null @@ -1,172 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlservermemory) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSQLServerMemory resource type. - Automatically generated from - 'xSQLServer/DSCResources/MSFT_xSQLServerMemory/MSFT_xSQLServerMemory.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_sqlinstancename is a required attribute') if self[:dsc_sqlinstancename].nil? - end - - def dscmeta_resource_friendly_name; 'xSQLServerMemory' end - def dscmeta_resource_name; 'MSFT_xSQLServerMemory' end - def dscmeta_module_name; 'xSQLServer' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: SQLInstanceName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_sqlinstancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLInstanceName - The name of the SQL instance to be configured." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLServer - The host name of the SQL Server to be configured. Default value is $env:COMPUTERNAME." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - When set to 'Present' then min and max memory will be set to either the value in parameter MinMemory and MaxMemory or dynamically configured when parameter DynamicAlloc is set to $true. When set to 'Absent' min and max memory will be set to default values. Default value is Present. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: DynamicAlloc - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_dynamicalloc) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DynamicAlloc - If set to $true then max memory will be dynamically configured. When this is set parameter is set to $true, the parameter MaxMemory must be set to $null or not be configured. Default value is $false." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: MinMemory - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_minmemory) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "MinMemory - Minimum amount of memory, in MB, in the buffer pool used by the instance of SQL Server." - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MaxMemory - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_maxmemory) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "MaxMemory - Maximum amount of memory, in MB, in the buffer pool used by the instance of SQL Server." - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlservermemory).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlservernetwork.rb b/lib/puppet/type/dsc_xsqlservernetwork.rb deleted file mode 100644 index bcff9a06..00000000 --- a/lib/puppet/type/dsc_xsqlservernetwork.rb +++ /dev/null @@ -1,168 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlservernetwork) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSQLServerNetwork resource type. - Automatically generated from - 'xSQLServer/DSCResources/MSFT_xSQLServerNetwork/MSFT_xSQLServerNetwork.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_instancename is a required attribute') if self[:dsc_instancename].nil? - end - - def dscmeta_resource_friendly_name; 'xSQLServerNetwork' end - def dscmeta_resource_name; 'MSFT_xSQLServerNetwork' end - def dscmeta_module_name; 'xSQLServer' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: InstanceName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_instancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstanceName - SQL Server instance name of which network protocol should be configured" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ProtocolName - # Type: string - # IsMandatory: False - # Values: ["tcp"] - newparam(:dsc_protocolname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProtocolName - Network protocol name that should be configured Valid values are tcp." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['tcp', 'tcp'].include?(value) - fail("Invalid value '#{value}'. Valid values are tcp") - end - end - end - - # Name: IsEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_isenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "IsEnabled - Is network protocol should be enabled or disabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: TCPDynamicPorts - # Type: string - # IsMandatory: False - # Values: ["0"] - newparam(:dsc_tcpdynamicports) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TCPDynamicPorts - If dynamic ports are used should be set to 0, otherwise leave empty Valid values are 0." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['0', '0'].include?(value) - fail("Invalid value '#{value}'. Valid values are 0") - end - end - end - - # Name: TCPPort - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_tcpport) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TCPPort - Sets static port for TCP/IP" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RestartService - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_restartservice) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RestartService - Controls if affected SQL Service should be restarted automatically" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlservernetwork).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlserverpermission.rb b/lib/puppet/type/dsc_xsqlserverpermission.rb deleted file mode 100644 index 1f09afca..00000000 --- a/lib/puppet/type/dsc_xsqlserverpermission.rb +++ /dev/null @@ -1,163 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlserverpermission) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSQLServerPermission resource type. - Automatically generated from - 'xSQLServer/DSCResources/MSFT_xSQLServerPermission/MSFT_xSQLServerPermission.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_instancename is a required attribute') if self[:dsc_instancename].nil? - end - - def dscmeta_resource_friendly_name; 'xSQLServerPermission' end - def dscmeta_resource_name; 'MSFT_xSQLServerPermission' end - def dscmeta_module_name; 'xSQLServer' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: InstanceName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_instancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstanceName - The SQL Server instance name." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: NodeName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_nodename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "NodeName - The host name or FQDN." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - If the permission should be present or absent. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Principal - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_principal) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Principal - The login to which permission will be set." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Permission - # Type: string[] - # IsMandatory: False - # Values: ["AlterAnyAvailabilityGroup", "ViewServerState", "AlterAnyEndPoint"] - newparam(:dsc_permission, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Permission - The permission to set for the login. Valid values are AlterAnyAvailabilityGroup, ViewServerState, AlterAnyEndPoint." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - if value.kind_of?(Array) - unless (['AlterAnyAvailabilityGroup', 'alteranyavailabilitygroup', 'ViewServerState', 'viewserverstate', 'AlterAnyEndPoint', 'alteranyendpoint'] & value).count == value.count - fail("Invalid value #{value}. Valid values are AlterAnyAvailabilityGroup, ViewServerState, AlterAnyEndPoint") - end - end - if value.kind_of?(String) - unless ['AlterAnyAvailabilityGroup', 'alteranyavailabilitygroup', 'ViewServerState', 'viewserverstate', 'AlterAnyEndPoint', 'alteranyendpoint'].include?(value) - fail("Invalid value #{value}. Valid values are AlterAnyAvailabilityGroup, ViewServerState, AlterAnyEndPoint") - end - end - end - munge do |value| - Array(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlserverpermission).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlserverreplication.rb b/lib/puppet/type/dsc_xsqlserverreplication.rb deleted file mode 100644 index bca59fab..00000000 --- a/lib/puppet/type/dsc_xsqlserverreplication.rb +++ /dev/null @@ -1,216 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlserverreplication) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSQLServerReplication resource type. - Automatically generated from - 'xSQLServer/DSCResources/MSFT_xSQLServerReplication/MSFT_xSQLServerReplication.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_instancename is a required attribute') if self[:dsc_instancename].nil? - end - - def dscmeta_resource_friendly_name; 'xSQLServerReplication' end - def dscmeta_resource_name; 'MSFT_xSQLServerReplication' end - def dscmeta_module_name; 'xSQLServer' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: InstanceName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_instancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstanceName - SQL Server instance name where replication distribution will be configured" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: DistributorMode - # Type: string - # IsMandatory: False - # Values: ["Local", "Remote"] - newparam(:dsc_distributormode) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DistributorMode - Valid values are Local, Remote." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Local', 'local', 'Remote', 'remote'].include?(value) - fail("Invalid value '#{value}'. Valid values are Local, Remote") - end - end - end - - # Name: AdminLinkCredentials - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_adminlinkcredentials) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "AdminLinkCredentials - Distributor administration link password" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("AdminLinkCredentials", value) - end - end - - # Name: DistributionDBName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_distributiondbname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DistributionDBName - Distribution database name" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RemoteDistributor - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_remotedistributor) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RemoteDistributor - Distributor server name if configuring publisher with remote distributor" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: WorkingDirectory - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_workingdirectory) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WorkingDirectory - Publisher working directory" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UseTrustedConnection - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_usetrustedconnection) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "UseTrustedConnection - Publisher security mode" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: UninstallWithForce - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_uninstallwithforce) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "UninstallWithForce - Force flag for uninstall procedure" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlserverreplication).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlserverrole.rb b/lib/puppet/type/dsc_xsqlserverrole.rb deleted file mode 100644 index 90929fc8..00000000 --- a/lib/puppet/type/dsc_xsqlserverrole.rb +++ /dev/null @@ -1,193 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlserverrole) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSQLServerRole resource type. - Automatically generated from - 'xSQLServer/DSCResources/MSFT_xSQLServerRole/MSFT_xSQLServerRole.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_serverrolename is a required attribute') if self[:dsc_serverrolename].nil? - fail('dsc_sqlserver is a required attribute') if self[:dsc_sqlserver].nil? - fail('dsc_sqlinstancename is a required attribute') if self[:dsc_sqlinstancename].nil? - end - - def dscmeta_resource_friendly_name; 'xSQLServerRole' end - def dscmeta_resource_name; 'MSFT_xSQLServerRole' end - def dscmeta_module_name; 'xSQLServer' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: ServerRoleName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_serverrolename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServerRoleName - The name of of SQL role to add or remove." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLServer - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_sqlserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLServer - The host name of the SQL Server to be configured." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLInstanceName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_sqlinstancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLInstanceName - The name of the SQL instance to be configured." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if the server role is added (Present) or dropped (Absent). Default value is 'Present'. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Members - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_members, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Members - The members the server role should have. This parameter will replace all the current server role members with the specified members." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: MembersToInclude - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_memberstoinclude, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "MembersToInclude - The members the server role should include. This parameter will only add members to a server role. Can not be used at the same time as parameter Members." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: MembersToExclude - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_memberstoexclude, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "MembersToExclude - The members the server role should exclude. This parameter will only remove members from a server role. Can only be used when parameter Ensure is set to 'Present'. Can not be used at the same time as parameter Members." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlserverrole).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlserverrsconfig.rb b/lib/puppet/type/dsc_xsqlserverrsconfig.rb deleted file mode 100644 index cb641937..00000000 --- a/lib/puppet/type/dsc_xsqlserverrsconfig.rb +++ /dev/null @@ -1,147 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlserverrsconfig) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSQLServerRSConfig resource type. - Automatically generated from - 'xSQLServer/DSCResources/MSFT_xSQLServerRSConfig/MSFT_xSQLServerRSConfig.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_instancename is a required attribute') if self[:dsc_instancename].nil? - end - - def dscmeta_resource_friendly_name; 'xSQLServerRSConfig' end - def dscmeta_resource_name; 'MSFT_xSQLServerRSConfig' end - def dscmeta_module_name; 'xSQLServer' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: InstanceName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_instancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstanceName - Name of the SQL Server Reporting Services instance to be configured." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RSSQLServer - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_rssqlserver) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RSSQLServer - Name of the SQL Server to host the Reporting Service database." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RSSQLInstanceName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_rssqlinstancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RSSQLInstanceName - Name of the SQL Server instance to host the Reporting Service database." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLAdminCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_sqladmincredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SQLAdminCredential - Credential to be used to perform the configuration." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SQLAdminCredential", value) - end - end - - # Name: IsInitialized - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_isinitialized) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "IsInitialized - Is the Reporting Services instance initialized." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlserverrsconfig).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlserverrssecureconnectionlevel.rb b/lib/puppet/type/dsc_xsqlserverrssecureconnectionlevel.rb deleted file mode 100644 index 008016de..00000000 --- a/lib/puppet/type/dsc_xsqlserverrssecureconnectionlevel.rb +++ /dev/null @@ -1,121 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlserverrssecureconnectionlevel) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSQLServerRSSecureConnectionLevel resource type. - Automatically generated from - 'xSQLServer/DSCResources/MSFT_xSQLServerRSSecureConnectionLevel/MSFT_xSQLServerRSSecureConnectionLevel.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_instancename is a required attribute') if self[:dsc_instancename].nil? - fail('dsc_secureconnectionlevel is a required attribute') if self[:dsc_secureconnectionlevel].nil? - end - - def dscmeta_resource_friendly_name; 'xSQLServerRSSecureConnectionLevel' end - def dscmeta_resource_name; 'MSFT_xSQLServerRSSecureConnectionLevel' end - def dscmeta_module_name; 'xSQLServer' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: InstanceName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_instancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstanceName - SQL instance to set secure connection level for." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SecureConnectionLevel - # Type: uint16 - # IsMandatory: True - # Values: None - newparam(:dsc_secureconnectionlevel) do - def mof_type; 'uint16' end - def mof_is_embedded?; false end - desc "SecureConnectionLevel - SQL Server Reporting Service secure connection level." - isrequired - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: SQLAdminCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_sqladmincredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SQLAdminCredential - Credential with administrative permissions to the SQL instance." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SQLAdminCredential", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlserverrssecureconnectionlevel).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlserverscript.rb b/lib/puppet/type/dsc_xsqlserverscript.rb deleted file mode 100644 index d38ca167..00000000 --- a/lib/puppet/type/dsc_xsqlserverscript.rb +++ /dev/null @@ -1,188 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlserverscript) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSQLServerScript resource type. - Automatically generated from - 'xSQLServer/DSCResources/MSFT_xSQLServerScript/MSFT_xSQLServerScript.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_serverinstance is a required attribute') if self[:dsc_serverinstance].nil? - fail('dsc_setfilepath is a required attribute') if self[:dsc_setfilepath].nil? - fail('dsc_getfilepath is a required attribute') if self[:dsc_getfilepath].nil? - fail('dsc_testfilepath is a required attribute') if self[:dsc_testfilepath].nil? - end - - def dscmeta_resource_friendly_name; 'xSQLServerScript' end - def dscmeta_resource_name; 'MSFT_xSQLServerScript' end - def dscmeta_module_name; 'xSQLServer' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: ServerInstance - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_serverinstance) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServerInstance - The name of an instance of the Database Engine. For a default instance, only specify the computer name. For a named instance, use the format ComputerName\\InstanceName" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SetFilePath - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_setfilepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SetFilePath - Path to the T-SQL file that will perform Set action." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: GetFilePath - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_getfilepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "GetFilePath - Path to the T-SQL file that will perform Get action. Any values returned by the T-SQL queries will also be returned by the cmdlet Get-DscConfiguration through the 'GetResult' property." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: TestFilePath - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_testfilepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TestFilePath - Path to the T-SQL file that will perform Test action. Any script that does not throw an error or returns null is evaluated to true. The cmdlet Invoke-SqlCmd treats T-SQL Print statements as verbose text, and will not cause the test to return false." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential - The credentials to authenticate with, using SQL Authentication. To authenticate using Windows Authentication, assign the credentials to the built-in parameter 'PsDscRunAsCredential'. If both parameters 'Credential' and 'PsDscRunAsCredential' are not assigned, then SYSTEM account will be used to authenticate using Windows Authentication." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Variable - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_variable, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Variable - Specifies, as a string array, a sqlcmd scripting variable for use in the sqlcmd script, and sets a value for the variable. Use a Windows PowerShell array to specify multiple variables and their values. For more information how to use this, please go to the help documentation for Invoke-Sqlcmd." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: GetResult - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_getresult, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "GetResult - Contains the values returned from the T-SQL script provided in the parameter 'GetFilePath' when cmdlet Get-DscConfiguration is run." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlserverscript).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsqlserversetup.rb b/lib/puppet/type/dsc_xsqlserversetup.rb deleted file mode 100644 index 97343232..00000000 --- a/lib/puppet/type/dsc_xsqlserversetup.rb +++ /dev/null @@ -1,846 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsqlserversetup) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSQLServerSetup resource type. - Automatically generated from - 'xSQLServer/DSCResources/MSFT_xSQLServerSetup/MSFT_xSQLServerSetup.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_instancename is a required attribute') if self[:dsc_instancename].nil? - end - - def dscmeta_resource_friendly_name; 'xSQLServerSetup' end - def dscmeta_resource_name; 'MSFT_xSQLServerSetup' end - def dscmeta_module_name; 'xSQLServer' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Action - # Type: string - # IsMandatory: False - # Values: ["Install", "InstallFailoverCluster", "AddNode", "PrepareFailoverCluster", "CompleteFailoverCluster"] - newparam(:dsc_action) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Action - The action to be performed. Default value is 'Install'. Valid values are Install, InstallFailoverCluster, AddNode, PrepareFailoverCluster, CompleteFailoverCluster." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Install', 'install', 'InstallFailoverCluster', 'installfailovercluster', 'AddNode', 'addnode', 'PrepareFailoverCluster', 'preparefailovercluster', 'CompleteFailoverCluster', 'completefailovercluster'].include?(value) - fail("Invalid value '#{value}'. Valid values are Install, InstallFailoverCluster, AddNode, PrepareFailoverCluster, CompleteFailoverCluster") - end - end - end - - # Name: SourcePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourcePath - The path to the root of the source files for installation. I.e and UNC path to a shared resource. Environment variables can be used in the path." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SetupCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_setupcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SetupCredential - Credential to be used to perform the installation." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SetupCredential", value) - end - end - - # Name: SourceCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_sourcecredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SourceCredential - Credentials used to access the path set in the parameter 'SourcePath'." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SourceCredential", value) - end - end - - # Name: SuppressReboot - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_suppressreboot) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "SuppressReboot - Suppresses reboot." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ForceReboot - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_forcereboot) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ForceReboot - Forces reboot." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Features - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_features) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Features - SQL features to be installed." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstanceName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_instancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstanceName - Name of the SQL instance to be installed." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstanceID - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_instanceid) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstanceID - SQL instance ID, if different from InstanceName." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ProductKey - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_productkey) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ProductKey - Product key for licensed installations." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UpdateEnabled - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_updateenabled) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UpdateEnabled - Enabled updates during installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: UpdateSource - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_updatesource) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UpdateSource - Path to the source of updates to be applied during installation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQMReporting - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqmreporting) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQMReporting - Enable customer experience reporting." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ErrorReporting - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_errorreporting) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ErrorReporting - Enable error reporting." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstallSharedDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_installshareddir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstallSharedDir - Installation path for shared SQL files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstallSharedWOWDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_installsharedwowdir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstallSharedWOWDir - Installation path for x86 shared SQL files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: InstanceDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_instancedir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstanceDir - Installation path for SQL instance files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLSvcAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_sqlsvcaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SQLSvcAccount - Service account for the SQL service." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SQLSvcAccount", value) - end - end - - # Name: SQLSvcAccountUsername - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlsvcaccountusername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLSvcAccountUsername - Output username for the SQL service." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AgtSvcAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_agtsvcaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "AgtSvcAccount - Service account for the SQL Agent service." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("AgtSvcAccount", value) - end - end - - # Name: AgtSvcAccountUsername - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_agtsvcaccountusername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AgtSvcAccountUsername - Output username for the SQL Agent service." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLCollation - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlcollation) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLCollation - Collation for SQL." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLSysAdminAccounts - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_sqlsysadminaccounts, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "SQLSysAdminAccounts - Array of accounts to be made SQL administrators." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: SecurityMode - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_securitymode) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SecurityMode - Security mode to apply to the SQL Server instance." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SAPwd - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_sapwd) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SAPwd - SA password, if SecurityMode is set to 'SQL'." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SAPwd", value) - end - end - - # Name: InstallSQLDataDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_installsqldatadir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstallSQLDataDir - Root path for SQL database files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLUserDBDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqluserdbdir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLUserDBDir - Path for SQL database files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLUserDBLogDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqluserdblogdir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLUserDBLogDir - Path for SQL log files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLTempDBDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqltempdbdir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLTempDBDir - Path for SQL TempDB files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLTempDBLogDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqltempdblogdir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLTempDBLogDir - Path for SQL TempDB log files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SQLBackupDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sqlbackupdir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SQLBackupDir - Path for SQL backup files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: FTSvcAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_ftsvcaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "FTSvcAccount - Service account for the Full Text service." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("FTSvcAccount", value) - end - end - - # Name: FTSvcAccountUsername - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_ftsvcaccountusername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FTSvcAccountUsername - Output username for the Full Text service." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RSSvcAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_rssvcaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "RSSvcAccount - Service account for Reporting Services service." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("RSSvcAccount", value) - end - end - - # Name: RSSvcAccountUsername - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_rssvcaccountusername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RSSvcAccountUsername - Output username for the Reporting Services service." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ASSvcAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_assvcaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "ASSvcAccount - Service account for Analysis Services service." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("ASSvcAccount", value) - end - end - - # Name: ASSvcAccountUsername - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_assvcaccountusername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ASSvcAccountUsername - Output username for the Analysis Services service." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ASCollation - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_ascollation) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ASCollation - Collation for Analysis Services." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ASSysAdminAccounts - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_assysadminaccounts, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "ASSysAdminAccounts - Array of accounts to be made Analysis Services admins." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: ASDataDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_asdatadir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ASDataDir - Path for Analysis Services data files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ASLogDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_aslogdir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ASLogDir - Path for Analysis Services log files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ASBackupDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_asbackupdir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ASBackupDir - Path for Analysis Services backup files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ASTempDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_astempdir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ASTempDir - Path for Analysis Services temp files." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ASConfigDir - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_asconfigdir) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ASConfigDir - Path for Analysis Services config." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ISSvcAccount - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_issvcaccount) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "ISSvcAccount - Service account for Integration Services service." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("ISSvcAccount", value) - end - end - - # Name: ISSvcAccountUsername - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_issvcaccountusername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ISSvcAccountUsername - Output username for the Integration Services service." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: BrowserSvcStartupType - # Type: string - # IsMandatory: False - # Values: ["Automatic", "Disabled", "Manual"] - newparam(:dsc_browsersvcstartuptype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "BrowserSvcStartupType - Specifies the startup mode for SQL Server Browser service. Valid values are Automatic, Disabled, Manual." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Automatic', 'automatic', 'Disabled', 'disabled', 'Manual', 'manual'].include?(value) - fail("Invalid value '#{value}'. Valid values are Automatic, Disabled, Manual") - end - end - end - - # Name: FailoverClusterGroupName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_failoverclustergroupname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FailoverClusterGroupName - The name of the resource group to create for the clustered SQL Server instance. Default is 'SQL Server (InstanceName)'." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: FailoverClusterIPAddress - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_failoverclusteripaddress, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "FailoverClusterIPAddress - Array of IP Addresses to be assigned to the clustered SQL Server instance." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: FailoverClusterNetworkName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_failoverclusternetworkname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FailoverClusterNetworkName - Host name to be assigend to the clustered SQL Server instance." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsqlserversetup).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsslsettings.rb b/lib/puppet/type/dsc_xsslsettings.rb deleted file mode 100644 index 9a6f5a43..00000000 --- a/lib/puppet/type/dsc_xsslsettings.rb +++ /dev/null @@ -1,133 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsslsettings) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSSLSettings resource type. - Automatically generated from - 'xWebAdministration/DSCResources/MSFT_xSSLSettings/MSFT_xSSLSettings.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xSSLSettings' end - def dscmeta_resource_name; 'MSFT_xSSLSettings' end - def dscmeta_module_name; 'xWebAdministration' end - def dscmeta_module_version; '1.18.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Name of website in which to modify the SSL Settings" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Bindings - # Type: string[] - # IsMandatory: False - # Values: ["", "Ssl", "SslNegotiateCert", "SslRequireCert", "Ssl128"] - newparam(:dsc_bindings, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Bindings - The Bindings in which to modify for the website Valid values are , Ssl, SslNegotiateCert, SslRequireCert, Ssl128." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - if value.kind_of?(Array) - unless (['', '', 'Ssl', 'ssl', 'SslNegotiateCert', 'sslnegotiatecert', 'SslRequireCert', 'sslrequirecert', 'Ssl128', 'ssl128'] & value).count == value.count - fail("Invalid value #{value}. Valid values are , Ssl, SslNegotiateCert, SslRequireCert, Ssl128") - end - end - if value.kind_of?(String) - unless ['', '', 'Ssl', 'ssl', 'SslNegotiateCert', 'sslnegotiatecert', 'SslRequireCert', 'sslrequirecert', 'Ssl128', 'ssl128'].include?(value) - fail("Invalid value #{value}. Valid values are , Ssl, SslNegotiateCert, SslRequireCert, Ssl128") - end - end - end - munge do |value| - Array(value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Whether the bindings should be present or absent Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsslsettings).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsystemrestore.rb b/lib/puppet/type/dsc_xsystemrestore.rb deleted file mode 100644 index 24ccf553..00000000 --- a/lib/puppet/type/dsc_xsystemrestore.rb +++ /dev/null @@ -1,108 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsystemrestore) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSystemRestore resource type. - Automatically generated from - 'xWindowsRestore/DSCResources/xSystemRestore/xSystemRestore.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_ensure is a required attribute') if self[:dsc_ensure].nil? - end - - def dscmeta_resource_friendly_name; 'xSystemRestore' end - def dscmeta_resource_name; 'xSystemRestore' end - def dscmeta_module_name; 'xWindowsRestore' end - def dscmeta_module_version; '1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: True - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Indicates that the computer restore is enabled or is disabled. Valid values are Present, Absent." - isrequired - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Drive - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_drive, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Drive - Specifies the file system drives. Enter one or more file system drive letters, each followed by a colon and a backslash and enclosed in quotation marks, such as 'C:\' or 'D:\'." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsystemrestore).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xsystemrestorepoint.rb b/lib/puppet/type/dsc_xsystemrestorepoint.rb deleted file mode 100644 index 49926c0b..00000000 --- a/lib/puppet/type/dsc_xsystemrestorepoint.rb +++ /dev/null @@ -1,123 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xsystemrestorepoint) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xSystemRestorePoint resource type. - Automatically generated from - 'xWindowsRestore/DSCResources/xSystemRestorePoint/xSystemRestorePoint.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_description is a required attribute') if self[:dsc_description].nil? - end - - def dscmeta_resource_friendly_name; 'xSystemRestorePoint' end - def dscmeta_resource_name; 'xSystemRestorePoint' end - def dscmeta_module_name; 'xWindowsRestore' end - def dscmeta_module_version; '1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Description - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_description) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Description - Specifies a descriptive name for the restore point." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RestorePointType - # Type: string - # IsMandatory: False - # Values: ["APPLICATION_INSTALL", "APPLICATION_UNINSTALL", "DEVICE_DRIVER_INSTALL", "MODIFY_SETTINGS", "CANCELLED_OPERATION"] - newparam(:dsc_restorepointtype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "RestorePointType - Specifies the type of restore point. The default is APPLICATION_INSTALL. Valid values are APPLICATION_INSTALL, APPLICATION_UNINSTALL, DEVICE_DRIVER_INSTALL, MODIFY_SETTINGS, CANCELLED_OPERATION." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['APPLICATION_INSTALL', 'application_install', 'APPLICATION_UNINSTALL', 'application_uninstall', 'DEVICE_DRIVER_INSTALL', 'device_driver_install', 'MODIFY_SETTINGS', 'modify_settings', 'CANCELLED_OPERATION', 'cancelled_operation'].include?(value) - fail("Invalid value '#{value}'. Valid values are APPLICATION_INSTALL, APPLICATION_UNINSTALL, DEVICE_DRIVER_INSTALL, MODIFY_SETTINGS, CANCELLED_OPERATION") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Indicates if the specified restore point created. Set this property to 'Absent' to ensure that the restore point does not exist. Set it to 'Present' to ensure that the restore point does exist. The default is 'Present'. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xsystemrestorepoint).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xtimezone.rb b/lib/puppet/type/dsc_xtimezone.rb deleted file mode 100644 index 3a87eb36..00000000 --- a/lib/puppet/type/dsc_xtimezone.rb +++ /dev/null @@ -1,103 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xtimezone) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xTimeZone resource type. - Automatically generated from - 'xTimeZone/DSCResources/xTimeZone/xTimeZone.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_issingleinstance is a required attribute') if self[:dsc_issingleinstance].nil? - end - - def dscmeta_resource_friendly_name; 'xTimeZone' end - def dscmeta_resource_name; 'xTimeZone' end - def dscmeta_module_name; 'xTimeZone' end - def dscmeta_module_version; '1.6.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: IsSingleInstance - # Type: string - # IsMandatory: True - # Values: ["Yes"] - newparam(:dsc_issingleinstance) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes' Valid values are Yes." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Yes', 'yes'].include?(value) - fail("Invalid value '#{value}'. Valid values are Yes") - end - end - end - - # Name: TimeZone - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_timezone) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TimeZone - Specifies the TimeZone." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xtimezone).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xuser.rb b/lib/puppet/type/dsc_xuser.rb deleted file mode 100644 index 4dcf12e1..00000000 --- a/lib/puppet/type/dsc_xuser.rb +++ /dev/null @@ -1,215 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xuser) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xUser resource type. - Automatically generated from - 'xPSDesiredStateConfiguration/DSCResources/MSFT_xUserResource/MSFT_xUserResource.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_username is a required attribute') if self[:dsc_username].nil? - end - - def dscmeta_resource_friendly_name; 'xUser' end - def dscmeta_resource_name; 'MSFT_xUserResource' end - def dscmeta_module_name; 'xPSDesiredStateConfiguration' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: UserName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_username) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "UserName - The name of the User to Create/Modify/Delete" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - An enumerated value that describes if the user is expected to exist on the machine Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: FullName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_fullname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FullName - The display name of the user" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Description - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_description) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Description - A description for the user" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Password - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_password) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Password - The password for the user" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Password", value) - end - end - - # Name: Disabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_disabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "Disabled - Value used to disable/enable a user account" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: PasswordNeverExpires - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_passwordneverexpires) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "PasswordNeverExpires - Value used to set whether a user's password expires or not" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: PasswordChangeRequired - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_passwordchangerequired) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "PasswordChangeRequired - Value used to require a user to change their password" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: PasswordChangeNotAllowed - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_passwordchangenotallowed) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "PasswordChangeNotAllowed - Value used to set whether a user can/cannot change their password" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xuser).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xvhd.rb b/lib/puppet/type/dsc_xvhd.rb deleted file mode 100644 index 4ba18e19..00000000 --- a/lib/puppet/type/dsc_xvhd.rb +++ /dev/null @@ -1,240 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xvhd) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xVHD resource type. - Automatically generated from - 'xHyper-V/DSCResources/MSFT_xVHD/MSFT_xVHD.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - fail('dsc_path is a required attribute') if self[:dsc_path].nil? - end - - def dscmeta_resource_friendly_name; 'xVHD' end - def dscmeta_resource_name; 'MSFT_xVHD' end - def dscmeta_module_name; 'xHyper-V' end - def dscmeta_module_version; '3.9.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Name of the VHD File" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Path - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_path) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Path - Folder where the VHD will be created" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ParentPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_parentpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ParentPath - Parent VHD file path, for differencing disk" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MaximumSizeBytes - # Type: uint64 - # IsMandatory: False - # Values: None - newparam(:dsc_maximumsizebytes) do - def mof_type; 'uint64' end - def mof_is_embedded?; false end - desc "MaximumSizeBytes - Maximum size of Vhd to be created" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: Generation - # Type: string - # IsMandatory: False - # Values: ["Vhd", "Vhdx"] - newparam(:dsc_generation) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Generation - Virtual disk format - Vhd or Vhdx Valid values are Vhd, Vhdx." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Vhd', 'vhd', 'Vhdx', 'vhdx'].include?(value) - fail("Invalid value '#{value}'. Valid values are Vhd, Vhdx") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Should the VHD be created or deleted Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: ID - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_id) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ID - Virtual Disk Identifier" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Type - # Type: string - # IsMandatory: False - # Values: ["Dynamic", "Fixed", "Differencing"] - newparam(:dsc_type) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Type - Type of Vhd - Dynamic, Fixed, Differencing Valid values are Dynamic, Fixed, Differencing." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Dynamic', 'dynamic', 'Fixed', 'fixed', 'Differencing', 'differencing'].include?(value) - fail("Invalid value '#{value}'. Valid values are Dynamic, Fixed, Differencing") - end - end - end - - # Name: FileSizeBytes - # Type: uint64 - # IsMandatory: False - # Values: None - newparam(:dsc_filesizebytes) do - def mof_type; 'uint64' end - def mof_is_embedded?; false end - desc "FileSizeBytes - Current size of the VHD" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: IsAttached - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_isattached) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "IsAttached - Is the VHD attached to a VM or not" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xvhd).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xvhdfile.rb b/lib/puppet/type/dsc_xvhdfile.rb deleted file mode 100644 index 299dba22..00000000 --- a/lib/puppet/type/dsc_xvhdfile.rb +++ /dev/null @@ -1,154 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xvhdfile) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - class PuppetX::Dsc::TypeHelpers - def self.validate_MSFT_xFileDirectory(mof_type_map, name, value) - required = ['destinationpath'] - allowed = ['sourcepath','ensure','type','recurse','force','content','attributes'] - lowkey_hash = Hash[value.map { |k, v| [k.to_s.downcase, v] }] - - missing = required - lowkey_hash.keys - unless missing.empty? - fail "#{name} is missing the following required keys: #{missing.join(',')}" - end - - extraneous = lowkey_hash.keys - required - allowed - unless extraneous.empty? - fail "#{name} includes invalid keys: #{extraneous.join(',')}" - end - - lowkey_hash.keys.each do |key| - if lowkey_hash[key] - validate_mof_type(mof_type_map[key], 'MSFT_xFileDirectory', key, lowkey_hash[key]) - end - end - end - end - - @doc = %q{ - The DSC xVhdFile resource type. - Automatically generated from - 'xHyper-V/DSCResources/MSFT_xVhdFileDirectory/MSFT_xVhdFileDirectory.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_vhdpath is a required attribute') if self[:dsc_vhdpath].nil? - end - - def dscmeta_resource_friendly_name; 'xVhdFile' end - def dscmeta_resource_name; 'MSFT_xVhdFileDirectory' end - def dscmeta_module_name; 'xHyper-V' end - def dscmeta_module_version; '3.9.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: VhdPath - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_vhdpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "VhdPath - Path to the VHD" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: FileDirectory - # Type: MSFT_xFileDirectory[] - # IsMandatory: False - # Values: None - newparam(:dsc_filedirectory, :array_matching => :all) do - def mof_type; 'MSFT_xFileDirectory[]' end - def mof_is_embedded?; true end - def mof_type_map - {"destinationpath"=>{:type=>"string"}, "sourcepath"=>{:type=>"string"}, "ensure"=>{:type=>"string", :values=>["Present", "Absent"]}, "type"=>{:type=>"string", :values=>["File", "Directory"]}, "recurse"=>{:type=>"boolean"}, "force"=>{:type=>"boolean"}, "content"=>{:type=>"string"}, "attributes"=>{:type=>"string[]", :values=>["ReadOnly", "Hidden", "System", "Archive"]}} - end - desc "FileDirectory - The FileDirectory objects to copy to the VHD" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be an array of hashes or a hash") - end - (value.kind_of?(Hash) ? [value] : value).each_with_index do |v, i| - fail "FileDirectory value at index #{i} should be a Hash" unless v.is_a? Hash - - PuppetX::Dsc::TypeHelpers.validate_MSFT_xFileDirectory(mof_type_map, "FileDirectory", v) - end - end - munge do |value| - value.kind_of?(Hash) ? - [PuppetX::Dsc::TypeHelpers.munge_embeddedinstance(mof_type_map, value)] : - value.map { |v| PuppetX::Dsc::TypeHelpers.munge_embeddedinstance(mof_type_map, v) } - end - end - - # Name: CheckSum - # Type: string - # IsMandatory: False - # Values: ["ModifiedDate", "SHA-1", "SHA-256", "SHA-512"] - newparam(:dsc_checksum) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CheckSum - Valid values are ModifiedDate, SHA-1, SHA-256, SHA-512." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['ModifiedDate', 'modifieddate', 'SHA-1', 'sha-1', 'SHA-256', 'sha-256', 'SHA-512', 'sha-512'].include?(value) - fail("Invalid value '#{value}'. Valid values are ModifiedDate, SHA-1, SHA-256, SHA-512") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xvhdfile).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xvirtualmemory.rb b/lib/puppet/type/dsc_xvirtualmemory.rb deleted file mode 100644 index 17a0ff64..00000000 --- a/lib/puppet/type/dsc_xvirtualmemory.rb +++ /dev/null @@ -1,141 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xvirtualmemory) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xVirtualMemory resource type. - Automatically generated from - 'xComputerManagement/DSCResources/MSFT_xVirtualMemory/MSFT_xVirtualMemory.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_drive is a required attribute') if self[:dsc_drive].nil? - fail('dsc_type is a required attribute') if self[:dsc_type].nil? - end - - def dscmeta_resource_friendly_name; 'xVirtualMemory' end - def dscmeta_resource_name; 'MSFT_xVirtualMemory' end - def dscmeta_module_name; 'xComputerManagement' end - def dscmeta_module_version; '2.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Drive - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_drive) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Drive - The drive letter for which paging settings should be set. Can be letter only, letter and colon or letter with colon and trailing slash." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Type - # Type: string - # IsMandatory: True - # Values: ["AutoManagePagingFile", "CustomSize", "SystemManagedSize", "NoPagingFile"] - newparam(:dsc_type) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Type - The type of the paging setting to use. If set to AutoManagePagingFile, the drive letter will be ignored. If set to SystemManagedSize, the values for InitialSize and MaximumSize will be ignored Valid values are AutoManagePagingFile, CustomSize, SystemManagedSize, NoPagingFile." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['AutoManagePagingFile', 'automanagepagingfile', 'CustomSize', 'customsize', 'SystemManagedSize', 'systemmanagedsize', 'NoPagingFile', 'nopagingfile'].include?(value) - fail("Invalid value '#{value}'. Valid values are AutoManagePagingFile, CustomSize, SystemManagedSize, NoPagingFile") - end - end - end - - # Name: InitialSize - # Type: sint64 - # IsMandatory: False - # Values: None - newparam(:dsc_initialsize) do - def mof_type; 'sint64' end - def mof_is_embedded?; false end - desc "InitialSize - The initial size of the page file in Megabyte" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MaximumSize - # Type: sint64 - # IsMandatory: False - # Values: None - newparam(:dsc_maximumsize) do - def mof_type; 'sint64' end - def mof_is_embedded?; false end - desc "MaximumSize - The maximum size of the page file in Megabyte" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xvirtualmemory).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xvmdvddrive.rb b/lib/puppet/type/dsc_xvmdvddrive.rb deleted file mode 100644 index f6ec2724..00000000 --- a/lib/puppet/type/dsc_xvmdvddrive.rb +++ /dev/null @@ -1,160 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xvmdvddrive) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xVMDvdDrive resource type. - Automatically generated from - 'xHyper-V/DSCResources/MSFT_xVMDvdDrive/MSFT_xVMDvdDrive.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_vmname is a required attribute') if self[:dsc_vmname].nil? - fail('dsc_controllernumber is a required attribute') if self[:dsc_controllernumber].nil? - fail('dsc_controllerlocation is a required attribute') if self[:dsc_controllerlocation].nil? - end - - def dscmeta_resource_friendly_name; 'xVMDvdDrive' end - def dscmeta_resource_name; 'MSFT_xVMDvdDrive' end - def dscmeta_module_name; 'xHyper-V' end - def dscmeta_module_version; '3.9.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: VMName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_vmname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "VMName - Specifies the name of the virtual machine to which the DVD drive is to be added." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ControllerNumber - # Type: uint32 - # IsMandatory: True - # Values: None - newparam(:dsc_controllernumber) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "ControllerNumber - Specifies the number of the controller to which the DVD drive is to be added." - isrequired - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ControllerLocation - # Type: uint32 - # IsMandatory: True - # Values: None - newparam(:dsc_controllerlocation) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "ControllerLocation - Specifies the number of the location on the controller at which the DVD drive is to be added." - isrequired - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: Path - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_path) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Path - Specifies the full path to the virtual hard disk file or physical hard disk volume for the added DVD drive." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies if the DVD Drive should exist or not. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xvmdvddrive).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xvmhost.rb b/lib/puppet/type/dsc_xvmhost.rb deleted file mode 100644 index 47967775..00000000 --- a/lib/puppet/type/dsc_xvmhost.rb +++ /dev/null @@ -1,331 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xvmhost) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xVMHost resource type. - Automatically generated from - 'xHyper-V/DSCResources/MSFT_xVMHost/MSFT_xVMHost.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_issingleinstance is a required attribute') if self[:dsc_issingleinstance].nil? - end - - def dscmeta_resource_friendly_name; 'xVMHost' end - def dscmeta_resource_name; 'MSFT_xVMHost' end - def dscmeta_module_name; 'xHyper-V' end - def dscmeta_module_version; '3.9.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: IsSingleInstance - # Type: string - # IsMandatory: True - # Values: ["Yes"] - newparam(:dsc_issingleinstance) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes'. Valid values are Yes." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Yes', 'yes'].include?(value) - fail("Invalid value '#{value}'. Valid values are Yes") - end - end - end - - # Name: EnableEnhancedSessionMode - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_enableenhancedsessionmode) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "EnableEnhancedSessionMode - Indicates whether users can use enhanced mode when they connect to virtual machines on this server by using Virtual Machine Connection." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: FibreChannelWwnn - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_fibrechannelwwnn) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FibreChannelWwnn - Specifies the default value of the World Wide Node Name on the Hyper-V host." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: FibreChannelWwpnMaximum - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_fibrechannelwwpnmaximum) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FibreChannelWwpnMaximum - Specifies the maximum value that can be used to generate World Wide Port Names on the Hyper-V host." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: FibreChannelWwpnMinimum - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_fibrechannelwwpnminimum) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "FibreChannelWwpnMinimum - Specifies the minimum value that can be used to generate the World Wide Port Names on the Hyper-V host." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MacAddressMaximum - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_macaddressmaximum) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MacAddressMaximum - Specifies the maximum MAC address using a valid hexadecimal value." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MacAddressMinimum - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_macaddressminimum) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MacAddressMinimum - Specifies the minimum MAC address using a valid hexadecimal value." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MaximumStorageMigrations - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_maximumstoragemigrations) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "MaximumStorageMigrations - Specifies the maximum number of storage migrations that can be performed at the same time on the Hyper-V host." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MaximumVirtualMachineMigrations - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_maximumvirtualmachinemigrations) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "MaximumVirtualMachineMigrations - Specifies the maximum number of live migrations that can be performed at the same time on the Hyper-V host." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: NumaSpanningEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_numaspanningenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "NumaSpanningEnabled - Specifies whether virtual machines on the Hyper-V host can use resources from more than one NUMA node." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ResourceMeteringSaveIntervalMinute - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_resourcemeteringsaveintervalminute) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "ResourceMeteringSaveIntervalMinute - Specifies how often the Hyper-V host saves the data that tracks resource usage. The range is a minimum of 60 minutes to a maximum of 1440 (24 hours)." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: UseAnyNetworkForMigration - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_useanynetworkformigration) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "UseAnyNetworkForMigration - Specifies how networks are selected for incoming live migration traffic." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: VirtualHardDiskPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_virtualharddiskpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "VirtualHardDiskPath - Specifies the default folder to store virtual hard disks on the Hyper-V host." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: VirtualMachineMigrationAuthenticationType - # Type: string - # IsMandatory: False - # Values: ["CredSSP", "Kerberos"] - newparam(:dsc_virtualmachinemigrationauthenticationtype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "VirtualMachineMigrationAuthenticationType - Specifies the type of authentication to be used for live migrations. The acceptable values for this parameter are 'Kerberos' and 'CredSSP'. Valid values are CredSSP, Kerberos." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['CredSSP', 'credssp', 'Kerberos', 'kerberos'].include?(value) - fail("Invalid value '#{value}'. Valid values are CredSSP, Kerberos") - end - end - end - - # Name: VirtualMachineMigrationPerformanceOption - # Type: string - # IsMandatory: False - # Values: ["TCPIP", "Compression", "SMB"] - newparam(:dsc_virtualmachinemigrationperformanceoption) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "VirtualMachineMigrationPerformanceOption - Specifies the performance option to use for live migration. The acceptable values for this parameter are 'TCPIP', 'Compression' and 'SMB'. Valid values are TCPIP, Compression, SMB." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['TCPIP', 'tcpip', 'Compression', 'compression', 'SMB', 'smb'].include?(value) - fail("Invalid value '#{value}'. Valid values are TCPIP, Compression, SMB") - end - end - end - - # Name: VirtualMachinePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_virtualmachinepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "VirtualMachinePath - Specifies the default folder to store virtual machine configuration files on the Hyper-V host." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xvmhost).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xvmhyperv.rb b/lib/puppet/type/dsc_xvmhyperv.rb deleted file mode 100644 index 78f72f03..00000000 --- a/lib/puppet/type/dsc_xvmhyperv.rb +++ /dev/null @@ -1,488 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xvmhyperv) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xVMHyperV resource type. - Automatically generated from - 'xHyper-V/DSCResources/MSFT_xVMHyperV/MSFT_xVMHyperV.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xVMHyperV' end - def dscmeta_resource_name; 'MSFT_xVMHyperV' end - def dscmeta_module_name; 'xHyper-V' end - def dscmeta_module_version; '3.9.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Name of the VM" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: VhdPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_vhdpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "VhdPath - VHD associated with the VM" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SwitchName - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_switchname, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "SwitchName - Virtual switch(es) associated with the VM" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: State - # Type: string - # IsMandatory: False - # Values: ["Running", "Paused", "Off"] - newparam(:dsc_state) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "State - State of the VM. Valid values are Running, Paused, Off." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Running', 'running', 'Paused', 'paused', 'Off', 'off'].include?(value) - fail("Invalid value '#{value}'. Valid values are Running, Paused, Off") - end - end - end - - # Name: Path - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_path) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Path - Folder where the VM data will be stored" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Generation - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_generation) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "Generation - Virtual machine generation" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: StartupMemory - # Type: uint64 - # IsMandatory: False - # Values: None - newparam(:dsc_startupmemory) do - def mof_type; 'uint64' end - def mof_is_embedded?; false end - desc "StartupMemory - Startup RAM for the VM." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MinimumMemory - # Type: uint64 - # IsMandatory: False - # Values: None - newparam(:dsc_minimummemory) do - def mof_type; 'uint64' end - def mof_is_embedded?; false end - desc "MinimumMemory - Minimum RAM for the VM. This enables dynamic memory." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MaximumMemory - # Type: uint64 - # IsMandatory: False - # Values: None - newparam(:dsc_maximummemory) do - def mof_type; 'uint64' end - def mof_is_embedded?; false end - desc "MaximumMemory - Maximum RAM for the VM. This enable dynamic memory." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MACAddress - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_macaddress, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "MACAddress - MAC address(es) of the VM NICs." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: ProcessorCount - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_processorcount) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "ProcessorCount - Processor count for the VM" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: WaitForIP - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_waitforip) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "WaitForIP - Waits for VM to get valid IP address." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: RestartIfNeeded - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_restartifneeded) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RestartIfNeeded - If specified, shutdowns and restarts the VM as needed for property changes" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Should the VM be created or deleted Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Notes - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_notes) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Notes - Notes about the VM." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SecureBoot - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_secureboot) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "SecureBoot - Enable secure boot for Generation 2 VMs." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: EnableGuestService - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_enableguestservice) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "EnableGuestService - Enable Guest Service Interface for the VM." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ID - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_id) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ID - VM unique ID" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Status - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_status) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Status - Status of the VM" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CPUUsage - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_cpuusage) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "CPUUsage - CPU Usage of the VM" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MemoryAssigned - # Type: uint64 - # IsMandatory: False - # Values: None - newparam(:dsc_memoryassigned) do - def mof_type; 'uint64' end - def mof_is_embedded?; false end - desc "MemoryAssigned - Memory assigned to the VM" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: Uptime - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_uptime) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Uptime - Uptime of the VM" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CreationTime - # Type: datetime - # IsMandatory: False - # Values: None - newparam(:dsc_creationtime) do - def mof_type; 'datetime' end - def mof_is_embedded?; false end - desc "CreationTime - Creation time of the VM" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: HasDynamicMemory - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_hasdynamicmemory) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "HasDynamicMemory - Does VM has dynamic memory enabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: NetworkAdapters - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_networkadapters, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "NetworkAdapters - Network adapters' IP addresses of the VM" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xvmhyperv).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xvmnetworkadapter.rb b/lib/puppet/type/dsc_xvmnetworkadapter.rb deleted file mode 100644 index 569e3a90..00000000 --- a/lib/puppet/type/dsc_xvmnetworkadapter.rb +++ /dev/null @@ -1,181 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xvmnetworkadapter) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xVMNetworkAdapter resource type. - Automatically generated from - 'xHyper-V/DSCResources/MSFT_xVMNetworkAdapter/MSFT_xVMNetworkAdapter.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_id is a required attribute') if self[:dsc_id].nil? - end - - def dscmeta_resource_friendly_name; 'xVMNetworkAdapter' end - def dscmeta_resource_name; 'MSFT_xVMNetworkAdapter' end - def dscmeta_module_name; 'xHyper-V' end - def dscmeta_module_version; '3.9.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Id - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_id) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Id" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Name - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: SwitchName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_switchname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SwitchName" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: VMName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_vmname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "VMName" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MacAddress - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_macaddress) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "MacAddress" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: DynamicMacAddress - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_dynamicmacaddress) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "DynamicMacAddress" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xvmnetworkadapter).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xvmprocessor.rb b/lib/puppet/type/dsc_xvmprocessor.rb deleted file mode 100644 index f3fb0d3f..00000000 --- a/lib/puppet/type/dsc_xvmprocessor.rb +++ /dev/null @@ -1,288 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xvmprocessor) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xVMProcessor resource type. - Automatically generated from - 'xHyper-V/DSCResources/MSFT_xVMProcessor/MSFT_xVMProcessor.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_vmname is a required attribute') if self[:dsc_vmname].nil? - end - - def dscmeta_resource_friendly_name; 'xVMProcessor' end - def dscmeta_resource_name; 'MSFT_xVMProcessor' end - def dscmeta_module_name; 'xHyper-V' end - def dscmeta_module_version; '3.9.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: VMName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_vmname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "VMName - Specifies the name of the virtual machine on which the processor is to be configured." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: EnableHostResourceProtection - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_enablehostresourceprotection) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "EnableHostResourceProtection - Specifies whether to enable host resource protection." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ExposeVirtualizationExtensions - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_exposevirtualizationextensions) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ExposeVirtualizationExtensions - Specifies whether nested virtualization is enabled." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: HwThreadCountPerCore - # Type: uint64 - # IsMandatory: False - # Values: None - newparam(:dsc_hwthreadcountpercore) do - def mof_type; 'uint64' end - def mof_is_embedded?; false end - desc "HwThreadCountPerCore - Specifies the maximum thread core per processor core." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: Maximum - # Type: uint64 - # IsMandatory: False - # Values: None - newparam(:dsc_maximum) do - def mof_type; 'uint64' end - def mof_is_embedded?; false end - desc "Maximum - Specifies the maximum percentage of resources available to the virtual machine processor to be configured. Allowed values range from 0 to 100." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MaximumCountPerNumaNode - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_maximumcountpernumanode) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "MaximumCountPerNumaNode - Specifies the maximum number of processors per NUMA node to be configured for the virtual machine." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MaximumCountPerNumaSocket - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_maximumcountpernumasocket) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "MaximumCountPerNumaSocket - Specifies the maximum number of sockets per NUMA node to be configured for the virtual machine." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: RelativeWeight - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_relativeweight) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "RelativeWeight - Specifies the priority for allocating the physical computer's processing power to this virtual machine relative to others. Allowed values range from 1 to 10000." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: Reserve - # Type: uint64 - # IsMandatory: False - # Values: None - newparam(:dsc_reserve) do - def mof_type; 'uint64' end - def mof_is_embedded?; false end - desc "Reserve - Specifies the percentage of processor resources to be reserved for this virtual machine. Allowed values range from 0 to 100." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ResourcePoolName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_resourcepoolname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ResourcePoolName - Specifies the name of the processor resource pool to be used." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CompatibilityForMigrationEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_compatibilityformigrationenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "CompatibilityForMigrationEnabled - Specifies whether the virtual processors features are to be limited for compatibility when migrating the virtual machine to another host." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: CompatibilityForOlderOperatingSystemsEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_compatibilityforolderoperatingsystemsenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "CompatibilityForOlderOperatingSystemsEnabled - Specifies whether the virtual processor's features are to be limited for compatibility with older operating systems." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: RestartIfNeeded - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_restartifneeded) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RestartIfNeeded - If specified, shutdowns and restarts the VM if needed for property changes." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xvmprocessor).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xvmswitch.rb b/lib/puppet/type/dsc_xvmswitch.rb deleted file mode 100644 index 657e1a90..00000000 --- a/lib/puppet/type/dsc_xvmswitch.rb +++ /dev/null @@ -1,223 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xvmswitch) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xVMSwitch resource type. - Automatically generated from - 'xHyper-V/DSCResources/MSFT_xVMSwitch/MSFT_xVMSwitch.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - fail('dsc_type is a required attribute') if self[:dsc_type].nil? - end - - def dscmeta_resource_friendly_name; 'xVMSwitch' end - def dscmeta_resource_name; 'MSFT_xVMSwitch' end - def dscmeta_module_name; 'xHyper-V' end - def dscmeta_module_version; '3.9.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Name of the VM Switch" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Type - # Type: string - # IsMandatory: True - # Values: ["External", "Internal", "Private"] - newparam(:dsc_type) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Type - Type of switch Valid values are External, Internal, Private." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['External', 'external', 'Internal', 'internal', 'Private', 'private'].include?(value) - fail("Invalid value '#{value}'. Valid values are External, Internal, Private") - end - end - end - - # Name: NetAdapterName - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_netadaptername, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "NetAdapterName - Network adapter name(s) for external switch type" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: AllowManagementOS - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_allowmanagementos) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "AllowManagementOS - Specify if the VM host has access to the physical NIC" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: EnableEmbeddedTeaming - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_enableembeddedteaming) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "EnableEmbeddedTeaming - Should embedded NIC teaming be used (Windows Server 2016 only)" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: BandwidthReservationMode - # Type: string - # IsMandatory: False - # Values: ["Default", "Weight", "Absolute", "None", "NA"] - newparam(:dsc_bandwidthreservationmode) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "BandwidthReservationMode - Type of Bandwidth Reservation Mode to use for the switch Valid values are Default, Weight, Absolute, None, NA." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Default', 'default', 'Weight', 'weight', 'Absolute', 'absolute', 'None', 'none', 'NA', 'na'].include?(value) - fail("Invalid value '#{value}'. Valid values are Default, Weight, Absolute, None, NA") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Whether switch should be present or absent Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Id - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_id) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Id - Unique ID for the switch" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: NetAdapterInterfaceDescription - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_netadapterinterfacedescription) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "NetAdapterInterfaceDescription - Description of the network interface" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xvmswitch).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xwaitforaddomain.rb b/lib/puppet/type/dsc_xwaitforaddomain.rb deleted file mode 100644 index 8caab022..00000000 --- a/lib/puppet/type/dsc_xwaitforaddomain.rb +++ /dev/null @@ -1,155 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xwaitforaddomain) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xWaitForADDomain resource type. - Automatically generated from - 'xActiveDirectory/DSCResources/MSFT_xWaitForADDomain/MSFT_xWaitForADDomain.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_domainname is a required attribute') if self[:dsc_domainname].nil? - end - - def dscmeta_resource_friendly_name; 'xWaitForADDomain' end - def dscmeta_resource_name; 'MSFT_xWaitForADDomain' end - def dscmeta_module_name; 'xActiveDirectory' end - def dscmeta_module_version; '2.16.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: DomainName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_domainname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DomainName" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DomainUserCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_domainusercredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "DomainUserCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("DomainUserCredential", value) - end - end - - # Name: RetryIntervalSec - # Type: uint64 - # IsMandatory: False - # Values: None - newparam(:dsc_retryintervalsec) do - def mof_type; 'uint64' end - def mof_is_embedded?; false end - desc "RetryIntervalSec" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: RetryCount - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_retrycount) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "RetryCount" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: RebootRetryCount - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_rebootretrycount) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "RebootRetryCount" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xwaitforaddomain).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xwaitforavailabilitygroup.rb b/lib/puppet/type/dsc_xwaitforavailabilitygroup.rb deleted file mode 100644 index 9e35cf04..00000000 --- a/lib/puppet/type/dsc_xwaitforavailabilitygroup.rb +++ /dev/null @@ -1,121 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xwaitforavailabilitygroup) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xWaitForAvailabilityGroup resource type. - Automatically generated from - 'xSQLServer/DSCResources/MSFT_xWaitForAvailabilityGroup/MSFT_xWaitForAvailabilityGroup.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xWaitForAvailabilityGroup' end - def dscmeta_resource_name; 'MSFT_xWaitForAvailabilityGroup' end - def dscmeta_module_name; 'xSQLServer' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Availability Group Name" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RetryIntervalSec - # Type: uint64 - # IsMandatory: False - # Values: None - newparam(:dsc_retryintervalsec) do - def mof_type; 'uint64' end - def mof_is_embedded?; false end - desc "RetryIntervalSec - Interval to check for Availability Group" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: RetryCount - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_retrycount) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "RetryCount - Maximum number of retries to check Availabilty group creation" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xwaitforavailabilitygroup).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xwaitforcertificateservices.rb b/lib/puppet/type/dsc_xwaitforcertificateservices.rb deleted file mode 100644 index a7f30b93..00000000 --- a/lib/puppet/type/dsc_xwaitforcertificateservices.rb +++ /dev/null @@ -1,138 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xwaitforcertificateservices) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xWaitForCertificateServices resource type. - Automatically generated from - 'xCertificate/DSCResources/MSFT_xWaitForCertificateServices/MSFT_xWaitForCertificateServices.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_caserverfqdn is a required attribute') if self[:dsc_caserverfqdn].nil? - fail('dsc_carootname is a required attribute') if self[:dsc_carootname].nil? - end - - def dscmeta_resource_friendly_name; 'xWaitForCertificateServices' end - def dscmeta_resource_name; 'MSFT_xWaitForCertificateServices' end - def dscmeta_module_name; 'xCertificate' end - def dscmeta_module_version; '3.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: CAServerFQDN - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_caserverfqdn) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CAServerFQDN - The FQDN of the Active Directory Certificate Service Certificate Authority to wait for." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CARootName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_carootname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CARootName - The name of the Active Directory Certificate Service Certificate Authority to wait for." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RetryIntervalSeconds - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_retryintervalseconds) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "RetryIntervalSeconds - Specifies the number of seconds to wait for the Active Directory Certificate Service Certificate Authority to become available. Defaults to 10 seconds." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: RetryCount - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_retrycount) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "RetryCount - The number of times to loop the retry interval while waiting for the Active Directory Certificate Service Certificate Authority. Defaults to 60 retries." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xwaitforcertificateservices).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xwaitforcluster.rb b/lib/puppet/type/dsc_xwaitforcluster.rb deleted file mode 100644 index 9cbae1ce..00000000 --- a/lib/puppet/type/dsc_xwaitforcluster.rb +++ /dev/null @@ -1,121 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xwaitforcluster) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xWaitForCluster resource type. - Automatically generated from - 'xFailOverCluster/DSCResources/MSFT_xWaitForCluster/MSFT_xWaitForCluster.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xWaitForCluster' end - def dscmeta_resource_name; 'MSFT_xWaitForCluster' end - def dscmeta_module_name; 'xFailOverCluster' end - def dscmeta_module_version; '1.8.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Name of the cluster to wait for." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RetryIntervalSec - # Type: uint64 - # IsMandatory: False - # Values: None - newparam(:dsc_retryintervalsec) do - def mof_type; 'uint64' end - def mof_is_embedded?; false end - desc "RetryIntervalSec - Interval to check for cluster existence. Default values is 10 seconds." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: RetryCount - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_retrycount) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "RetryCount - Maximum number of retries to check for cluster existence. Default value is 50 retries." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xwaitforcluster).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xwaitfordisk.rb b/lib/puppet/type/dsc_xwaitfordisk.rb deleted file mode 100644 index 28dbd4a1..00000000 --- a/lib/puppet/type/dsc_xwaitfordisk.rb +++ /dev/null @@ -1,139 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xwaitfordisk) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xWaitForDisk resource type. - Automatically generated from - 'xStorage/DSCResources/MSFT_xWaitForDisk/MSFT_xWaitForDisk.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_diskid is a required attribute') if self[:dsc_diskid].nil? - end - - def dscmeta_resource_friendly_name; 'xWaitForDisk' end - def dscmeta_resource_name; 'MSFT_xWaitForDisk' end - def dscmeta_module_name; 'xStorage' end - def dscmeta_module_version; '3.2.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: DiskId - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_diskid) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DiskId - Specifies the disk identifier for the disk to wait for." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DiskIdType - # Type: string - # IsMandatory: False - # Values: ["Number", "UniqueId"] - newparam(:dsc_diskidtype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DiskIdType - Specifies the identifier type the DiskId contains. Defaults to Number. Valid values are Number, UniqueId." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Number', 'number', 'UniqueId', 'uniqueid'].include?(value) - fail("Invalid value '#{value}'. Valid values are Number, UniqueId") - end - end - end - - # Name: RetryIntervalSec - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_retryintervalsec) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "RetryIntervalSec - Specifies the number of seconds to wait for the disk to become available." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: RetryCount - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_retrycount) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "RetryCount - The number of times to loop the retry interval while waiting for the disk." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xwaitfordisk).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xwaitforsqlhagroup.rb b/lib/puppet/type/dsc_xwaitforsqlhagroup.rb deleted file mode 100644 index 59902400..00000000 --- a/lib/puppet/type/dsc_xwaitforsqlhagroup.rb +++ /dev/null @@ -1,183 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xwaitforsqlhagroup) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xWaitForSqlHAGroup resource type. - Automatically generated from - 'xSqlPs/DSCResources/MSFT_xWaitForSqlHAGroup/MSFT_xWaitForSqlHAGroup.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xWaitForSqlHAGroup' end - def dscmeta_resource_name; 'MSFT_xWaitForSqlHAGroup' end - def dscmeta_module_name; 'xSqlPs' end - def dscmeta_module_version; '1.4.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of Sql High Availability group" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ClusterName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_clustername) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ClusterName - The name of windows failover cluster for the availability group." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RetryIntervalSec - # Type: uint64 - # IsMandatory: False - # Values: None - newparam(:dsc_retryintervalsec) do - def mof_type; 'uint64' end - def mof_is_embedded?; false end - desc "RetryIntervalSec - Interval to check the HA group existency" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: RetryCount - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_retrycount) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "RetryCount - Maximum number of retries to check HA group existency" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: InstanceName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_instancename) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "InstanceName - The name of sql instance." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DomainCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_domaincredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "DomainCredential - Domain credential could get list of cluster nodes." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("DomainCredential", value) - end - end - - # Name: SqlAdministratorCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_sqladministratorcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "SqlAdministratorCredential - Sql sa credential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("SqlAdministratorCredential", value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xwaitforsqlhagroup).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xwaitforvolume.rb b/lib/puppet/type/dsc_xwaitforvolume.rb deleted file mode 100644 index 899fe6c0..00000000 --- a/lib/puppet/type/dsc_xwaitforvolume.rb +++ /dev/null @@ -1,121 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xwaitforvolume) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xWaitForVolume resource type. - Automatically generated from - 'xStorage/DSCResources/MSFT_xWaitForVolume/MSFT_xWaitForVolume.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_driveletter is a required attribute') if self[:dsc_driveletter].nil? - end - - def dscmeta_resource_friendly_name; 'xWaitForVolume' end - def dscmeta_resource_name; 'MSFT_xWaitForVolume' end - def dscmeta_module_name; 'xStorage' end - def dscmeta_module_version; '3.2.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: DriveLetter - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_driveletter) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DriveLetter - Specifies the drive letter of the volume to wait for." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: RetryIntervalSec - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_retryintervalsec) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "RetryIntervalSec - Specifies the number of seconds to wait for the volume to become available." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: RetryCount - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_retrycount) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "RetryCount - The number of times to loop the retry interval while waiting for the volume." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xwaitforvolume).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xwebapplication.rb b/lib/puppet/type/dsc_xwebapplication.rb deleted file mode 100644 index 1661d300..00000000 --- a/lib/puppet/type/dsc_xwebapplication.rb +++ /dev/null @@ -1,315 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xwebapplication) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - class PuppetX::Dsc::TypeHelpers - def self.validate_MSFT_xWebApplicationAuthenticationInformation(mof_type_map, name, value) - required = [] - allowed = ['anonymous','basic','digest','windows'] - lowkey_hash = Hash[value.map { |k, v| [k.to_s.downcase, v] }] - - missing = required - lowkey_hash.keys - unless missing.empty? - fail "#{name} is missing the following required keys: #{missing.join(',')}" - end - - extraneous = lowkey_hash.keys - required - allowed - unless extraneous.empty? - fail "#{name} includes invalid keys: #{extraneous.join(',')}" - end - - lowkey_hash.keys.each do |key| - if lowkey_hash[key] - validate_mof_type(mof_type_map[key], 'MSFT_xWebApplicationAuthenticationInformation', key, lowkey_hash[key]) - end - end - end - end - - @doc = %q{ - The DSC xWebApplication resource type. - Automatically generated from - 'xWebAdministration/DSCResources/MSFT_xWebApplication/MSFT_xWebApplication.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_website is a required attribute') if self[:dsc_website].nil? - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xWebApplication' end - def dscmeta_resource_name; 'MSFT_xWebApplication' end - def dscmeta_module_name; 'xWebAdministration' end - def dscmeta_module_version; '1.18.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Website - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_website) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Website - Name of website with which web application is associated" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Name of web application" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: WebAppPool - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_webapppool) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WebAppPool - Web application pool for the web application" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: PhysicalPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_physicalpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "PhysicalPath - Physical path for the web application directory" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Whether web application should be present or absent Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: SslFlags - # Type: string[] - # IsMandatory: False - # Values: ["", "Ssl", "SslNegotiateCert", "SslRequireCert", "Ssl128"] - newparam(:dsc_sslflags, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "SslFlags - SSLFlags for the application Valid values are , Ssl, SslNegotiateCert, SslRequireCert, Ssl128." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - if value.kind_of?(Array) - unless (['', '', 'Ssl', 'ssl', 'SslNegotiateCert', 'sslnegotiatecert', 'SslRequireCert', 'sslrequirecert', 'Ssl128', 'ssl128'] & value).count == value.count - fail("Invalid value #{value}. Valid values are , Ssl, SslNegotiateCert, SslRequireCert, Ssl128") - end - end - if value.kind_of?(String) - unless ['', '', 'Ssl', 'ssl', 'SslNegotiateCert', 'sslnegotiatecert', 'SslRequireCert', 'sslrequirecert', 'Ssl128', 'ssl128'].include?(value) - fail("Invalid value #{value}. Valid values are , Ssl, SslNegotiateCert, SslRequireCert, Ssl128") - end - end - end - munge do |value| - Array(value) - end - end - - # Name: AuthenticationInfo - # Type: MSFT_xWebApplicationAuthenticationInformation - # IsMandatory: False - # Values: None - newparam(:dsc_authenticationinfo) do - def mof_type; 'MSFT_xWebApplicationAuthenticationInformation' end - def mof_is_embedded?; true end - def mof_type_map - {"anonymous"=>{:type=>"boolean"}, "basic"=>{:type=>"boolean"}, "digest"=>{:type=>"boolean"}, "windows"=>{:type=>"boolean"}} - end - desc "AuthenticationInfo - Hashtable containing authentication information (Anonymous, Basic, Digest, Windows)" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_xWebApplicationAuthenticationInformation(mof_type_map, "AuthenticationInfo", value) - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_embeddedinstance(mof_type_map, value) - end - end - - # Name: PreloadEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_preloadenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "PreloadEnabled - Allows a Application to automatically start without a request" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ServiceAutoStartEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_serviceautostartenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ServiceAutoStartEnabled - Enables Autostart on an Application." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ServiceAutoStartProvider - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_serviceautostartprovider) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServiceAutoStartProvider - Adds a AutostartProvider" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ApplicationType - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_applicationtype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ApplicationType - Adds a AutostartProvider ApplicationType" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: EnabledProtocols - # Type: string[] - # IsMandatory: False - # Values: ["http", "https", "net.tcp", "net.msmq", "net.pipe"] - newparam(:dsc_enabledprotocols, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "EnabledProtocols - Adds EnabledProtocols on an Application Valid values are http, https, net.tcp, net.msmq, net.pipe." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - if value.kind_of?(Array) - unless (['http', 'http', 'https', 'https', 'net.tcp', 'net.tcp', 'net.msmq', 'net.msmq', 'net.pipe', 'net.pipe'] & value).count == value.count - fail("Invalid value #{value}. Valid values are http, https, net.tcp, net.msmq, net.pipe") - end - end - if value.kind_of?(String) - unless ['http', 'http', 'https', 'https', 'net.tcp', 'net.tcp', 'net.msmq', 'net.msmq', 'net.pipe', 'net.pipe'].include?(value) - fail("Invalid value #{value}. Valid values are http, https, net.tcp, net.msmq, net.pipe") - end - end - end - munge do |value| - Array(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xwebapplication).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xwebapppool.rb b/lib/puppet/type/dsc_xwebapppool.rb deleted file mode 100644 index e1862b42..00000000 --- a/lib/puppet/type/dsc_xwebapppool.rb +++ /dev/null @@ -1,911 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xwebapppool) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xWebAppPool resource type. - Automatically generated from - 'xWebAdministration/DSCResources/MSFT_xWebAppPool/MSFT_xWebAppPool.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xWebAppPool' end - def dscmeta_resource_name; 'MSFT_xWebAppPool' end - def dscmeta_module_name; 'xWebAdministration' end - def dscmeta_module_version; '1.18.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Indicates the application pool name. The value must contain between 1 and 64 characters." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Indicates if the application pool exists. Set this property to Absent to ensure that the application pool does not exist. Setting it to Present (the default value) ensures that the application pool exists. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: State - # Type: string - # IsMandatory: False - # Values: ["Started", "Stopped"] - newparam(:dsc_state) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "State - Indicates the state of the application pool. The values that are allowed for this property are: Started, Stopped. Valid values are Started, Stopped." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Started', 'started', 'Stopped', 'stopped'].include?(value) - fail("Invalid value '#{value}'. Valid values are Started, Stopped") - end - end - end - - # Name: autoStart - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_autostart) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "autoStart - When set to true, indicates to the World Wide Web Publishing Service (W3SVC) that the application pool should be automatically started when it is created or when IIS is started." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: CLRConfigFile - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_clrconfigfile) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CLRConfigFile - Indicates the .NET configuration file for the application pool." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: enable32BitAppOnWin64 - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_enable32bitapponwin64) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "enable32BitAppOnWin64 - When set to true, enables a 32-bit application to run on a computer that runs a 64-bit version of Windows." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: enableConfigurationOverride - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_enableconfigurationoverride) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "enableConfigurationOverride - When set to true, indicates that delegated settings in Web.config files will processed for applications within this application pool. When set to false, all settings in Web.config files will be ignored for this application pool." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: managedPipelineMode - # Type: string - # IsMandatory: False - # Values: ["Integrated", "Classic"] - newparam(:dsc_managedpipelinemode) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "managedPipelineMode - Indicates the request-processing mode that is used to process requests for managed content. The values that are allowed for this property are: Integrated, Classic. Valid values are Integrated, Classic." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Integrated', 'integrated', 'Classic', 'classic'].include?(value) - fail("Invalid value '#{value}'. Valid values are Integrated, Classic") - end - end - end - - # Name: managedRuntimeLoader - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_managedruntimeloader) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "managedRuntimeLoader - Indicates the managed loader to use for pre-loading the application pool." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: managedRuntimeVersion - # Type: string - # IsMandatory: False - # Values: ["v4.0", "v2.0", ""] - newparam(:dsc_managedruntimeversion) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "managedRuntimeVersion - Indicates the CLR version to be used by the application pool. The values that are allowed for this property are: v4.0, v2.0, and ''. Valid values are v4.0, v2.0, ." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['v4.0', 'v4.0', 'v2.0', 'v2.0', '', ''].include?(value) - fail("Invalid value '#{value}'. Valid values are v4.0, v2.0, ") - end - end - end - - # Name: passAnonymousToken - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_passanonymoustoken) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "passAnonymousToken - When set to true, the Windows Process Activation Service (WAS) creates and passes a token for the built-in IUSR anonymous user account to the Anonymous authentication module. The Anonymous authentication module uses the token to impersonate the built-in account. When this property is set to false, the token will not be passed." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: startMode - # Type: string - # IsMandatory: False - # Values: ["OnDemand", "AlwaysRunning"] - newparam(:dsc_startmode) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "startMode - Indicates the startup type for the application pool. The values that are allowed for this property are: OnDemand, AlwaysRunning. Valid values are OnDemand, AlwaysRunning." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['OnDemand', 'ondemand', 'AlwaysRunning', 'alwaysrunning'].include?(value) - fail("Invalid value '#{value}'. Valid values are OnDemand, AlwaysRunning") - end - end - end - - # Name: queueLength - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_queuelength) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "queueLength - Indicates the maximum number of requests that HTTP.sys will queue for the application pool. The value must be a valid integer between 10 and 65535." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: cpuAction - # Type: string - # IsMandatory: False - # Values: ["NoAction", "KillW3wp", "Throttle", "ThrottleUnderLoad"] - newparam(:dsc_cpuaction) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "cpuAction - Configures the action that IIS takes when a worker process exceeds its configured CPU limit. The values that are allowed for this property are: NoAction, KillW3wp, Throttle, and ThrottleUnderLoad. Valid values are NoAction, KillW3wp, Throttle, ThrottleUnderLoad." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['NoAction', 'noaction', 'KillW3wp', 'killw3wp', 'Throttle', 'throttle', 'ThrottleUnderLoad', 'throttleunderload'].include?(value) - fail("Invalid value '#{value}'. Valid values are NoAction, KillW3wp, Throttle, ThrottleUnderLoad") - end - end - end - - # Name: cpuLimit - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_cpulimit) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "cpuLimit - Configures the maximum percentage of CPU time (in 1/1000ths of one percent) that the worker processes in the application pool are allowed to consume over a period of time as indicated by the cpuResetInterval property. The value must be a valid integer between 0 and 100000." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: cpuResetInterval - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_cpuresetinterval) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "cpuResetInterval - Indicates the reset period (in minutes) for CPU monitoring and throttling limits on the application pool. The value must be a string representation of a TimeSpan value. The valid range (in minutes) is 0 to 1440. Setting the value of this property to 0 disables CPU monitoring." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: cpuSmpAffinitized - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_cpusmpaffinitized) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "cpuSmpAffinitized - Indicates whether a particular worker process assigned to the application pool should also be assigned to a given CPU." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: cpuSmpProcessorAffinityMask - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_cpusmpprocessoraffinitymask) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "cpuSmpProcessorAffinityMask - Indicates the hexadecimal processor mask for multi-processor computers, which indicates to which CPU the worker processes in the application pool should be bound. Before this property takes effect, the cpuSmpAffinitized property must be set to true for the application pool. The value must be a valid integer between 0 and 4294967295." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: cpuSmpProcessorAffinityMask2 - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_cpusmpprocessoraffinitymask2) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "cpuSmpProcessorAffinityMask2 - Indicates the high-order DWORD hexadecimal processor mask for 64-bit multi-processor computers, which indicates to which CPU the worker processes in the application pool should be bound. Before this property takes effect, the cpuSmpAffinitized property must be set to true for the application pool. The value must be a valid integer between 0 and 4294967295." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: identityType - # Type: string - # IsMandatory: False - # Values: ["ApplicationPoolIdentity", "LocalService", "LocalSystem", "NetworkService", "SpecificUser"] - newparam(:dsc_identitytype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "identityType - Indicates the account identity under which the application pool runs. The values that are allowed for this property are: ApplicationPoolIdentity, LocalService, LocalSystem, NetworkService, and SpecificUser. Valid values are ApplicationPoolIdentity, LocalService, LocalSystem, NetworkService, SpecificUser." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['ApplicationPoolIdentity', 'applicationpoolidentity', 'LocalService', 'localservice', 'LocalSystem', 'localsystem', 'NetworkService', 'networkservice', 'SpecificUser', 'specificuser'].include?(value) - fail("Invalid value '#{value}'. Valid values are ApplicationPoolIdentity, LocalService, LocalSystem, NetworkService, SpecificUser") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential - Indicates the custom account crededentials. This property is only valid when the identityType property is set to SpecificUser." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: idleTimeout - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_idletimeout) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "idleTimeout - Indicates the amount of time (in minutes) a worker process will remain idle before it shuts down. The value must be a string representation of a TimeSpan value and must be less than the restartTimeLimit property value. The valid range (in minutes) is 0 to 43200." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: idleTimeoutAction - # Type: string - # IsMandatory: False - # Values: ["Terminate", "Suspend"] - newparam(:dsc_idletimeoutaction) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "idleTimeoutAction - Indicates the action to perform when the idle timeout duration has been reached. The values that are allowed for this property are: Terminate, Suspend. Valid values are Terminate, Suspend." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Terminate', 'terminate', 'Suspend', 'suspend'].include?(value) - fail("Invalid value '#{value}'. Valid values are Terminate, Suspend") - end - end - end - - # Name: loadUserProfile - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_loaduserprofile) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "loadUserProfile - Indicates whether IIS loads the user profile for the application pool identity." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: logEventOnProcessModel - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_logeventonprocessmodel) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "logEventOnProcessModel - Indicates that IIS should generate an event log entry for each occurrence of the specified process model events." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: logonType - # Type: string - # IsMandatory: False - # Values: ["LogonBatch", "LogonService"] - newparam(:dsc_logontype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "logonType - Indicates the logon type for the process identity. The values that are allowed for this property are: LogonBatch, LogonService. Valid values are LogonBatch, LogonService." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['LogonBatch', 'logonbatch', 'LogonService', 'logonservice'].include?(value) - fail("Invalid value '#{value}'. Valid values are LogonBatch, LogonService") - end - end - end - - # Name: manualGroupMembership - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_manualgroupmembership) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "manualGroupMembership - Indicates whether the IIS_IUSRS group Security Identifier (SID) is added to the worker process token." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: maxProcesses - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_maxprocesses) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "maxProcesses - Indicates the maximum number of worker processes that would be used for the application pool. The value must be a valid integer between 0 and 2147483647." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: pingingEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_pingingenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "pingingEnabled - Indicates whether pinging (health monitoring) is enabled for the worker process(es) serving this application pool." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: pingInterval - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_pinginterval) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "pingInterval - Indicates the period of time (in seconds) between health monitoring pings sent to the worker process(es) serving this application pool. The value must be a string representation of a TimeSpan value. The valid range (in seconds) is 1 to 4294967." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: pingResponseTime - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_pingresponsetime) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "pingResponseTime - Indicates the maximum time (in seconds) that a worker process is given to respond to a health monitoring ping. The value must be a string representation of a TimeSpan value. The valid range (in seconds) is 1 to 4294967." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: setProfileEnvironment - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_setprofileenvironment) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "setProfileEnvironment - Indicates the environment to be set based on the user profile for the new process." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: shutdownTimeLimit - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_shutdowntimelimit) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "shutdownTimeLimit - Indicates the period of time (in seconds) a worker process is given to finish processing requests and shut down. The value must be a string representation of a TimeSpan value. The valid range (in seconds) is 1 to 4294967." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: startupTimeLimit - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_startuptimelimit) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "startupTimeLimit - Indicates the period of time (in seconds) a worker process is given to start up and initialize. The value must be a string representation of a TimeSpan value. The valid range (in seconds) is 1 to 4294967." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: orphanActionExe - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_orphanactionexe) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "orphanActionExe - Indicates an executable to run when a worker process is orphaned." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: orphanActionParams - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_orphanactionparams) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "orphanActionParams - Indicates parameters for the executable that is specified in the orphanActionExe property." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: orphanWorkerProcess - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_orphanworkerprocess) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "orphanWorkerProcess - Indicates whether to assign a worker process to an orphan state instead of terminating it when the application pool fails. If true, an unresponsive worker process will be orphaned instead of terminated." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: loadBalancerCapabilities - # Type: string - # IsMandatory: False - # Values: ["HttpLevel", "TcpLevel"] - newparam(:dsc_loadbalancercapabilities) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "loadBalancerCapabilities - Indicates the response behavior of a service when it is unavailable. The values that are allowed for this property are: HttpLevel, TcpLevel. If set to HttpLevel and the application pool is stopped, HTTP.sys will return HTTP 503 error. If set to TcpLevel, HTTP.sys will reset the connection. Valid values are HttpLevel, TcpLevel." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['HttpLevel', 'httplevel', 'TcpLevel', 'tcplevel'].include?(value) - fail("Invalid value '#{value}'. Valid values are HttpLevel, TcpLevel") - end - end - end - - # Name: rapidFailProtection - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_rapidfailprotection) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "rapidFailProtection - Indicates whether rapid-fail protection is enabled. If true, the application pool is shut down if there are a specified number of worker process crashes within a specified time period." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: rapidFailProtectionInterval - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_rapidfailprotectioninterval) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "rapidFailProtectionInterval - Indicates the time interval (in minutes) during which the specified number of worker process crashes must occur before the application pool is shut down by rapid-fail protection. The value must be a string representation of a TimeSpan value. The valid range (in minutes) is 1 to 144000." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: rapidFailProtectionMaxCrashes - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_rapidfailprotectionmaxcrashes) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "rapidFailProtectionMaxCrashes - Indicates the maximum number of worker process crashes permitted before the application pool is shut down by rapid-fail protection. The value must be a valid integer between 0 and 2147483647." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: autoShutdownExe - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_autoshutdownexe) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "autoShutdownExe - Indicates an executable to run when the application pool is shut down by rapid-fail protection." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: autoShutdownParams - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_autoshutdownparams) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "autoShutdownParams - Indicates parameters for the executable that is specified in the autoShutdownExe property." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: disallowOverlappingRotation - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_disallowoverlappingrotation) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "disallowOverlappingRotation - Indicates whether the W3SVC service should start another worker process to replace the existing worker process while that process is shutting down. If true, the application pool recycle will happen such that the existing worker process exits before another worker process is created." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: disallowRotationOnConfigChange - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_disallowrotationonconfigchange) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "disallowRotationOnConfigChange - Indicates whether the W3SVC service should rotate worker processes in the application pool when the configuration has changed. If true, the application pool will not recycle when its configuration is changed." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: logEventOnRecycle - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_logeventonrecycle) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "logEventOnRecycle - Indicates that IIS should generate an event log entry for each occurrence of the specified recycling events." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: restartMemoryLimit - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_restartmemorylimit) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "restartMemoryLimit - Indicates the maximum amount of virtual memory (in KB) a worker process can consume before causing the application pool to recycle. The value must be a valid integer between 0 and 4294967295. A value of 0 means there is no limit." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: restartPrivateMemoryLimit - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_restartprivatememorylimit) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "restartPrivateMemoryLimit - Indicates the maximum amount of private memory (in KB) a worker process can consume before causing the application pool to recycle. The value must be a valid integer between 0 and 4294967295. A value of 0 means there is no limit." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: restartRequestsLimit - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_restartrequestslimit) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "restartRequestsLimit - Indicates the maximum number of requests the application pool can process before it is recycled. The value must be a valid integer between 0 and 4294967295. A value of 0 means the application pool can process an unlimited number of requests." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: restartTimeLimit - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_restarttimelimit) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "restartTimeLimit - Indicates the period of time (in minutes) after which the application pool will recycle. The value must be a string representation of a TimeSpan value. The valid range (in minutes) is 0 to 432000. A value of 0 means the application pool does not recycle on a regular interval." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: restartSchedule - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_restartschedule, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "restartSchedule - Indicates a set of specific local times, in 24 hour format, when the application pool is recycled. The value must be an array of string representations of TimeSpan values. TimeSpan values must be between 00:00:00 and 23:59:59 seconds inclusive, with a granularity of 60 seconds. Setting the value of this property to '' disables the schedule." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xwebapppool).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xwebapppooldefaults.rb b/lib/puppet/type/dsc_xwebapppooldefaults.rb deleted file mode 100644 index e2d06cd6..00000000 --- a/lib/puppet/type/dsc_xwebapppooldefaults.rb +++ /dev/null @@ -1,124 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xwebapppooldefaults) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xWebAppPoolDefaults resource type. - Automatically generated from - 'xWebAdministration/DSCResources/MSFT_xWebAppPoolDefaults/MSFT_xWebAppPoolDefaults.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_applyto is a required attribute') if self[:dsc_applyto].nil? - end - - def dscmeta_resource_friendly_name; 'xWebAppPoolDefaults' end - def dscmeta_resource_name; 'MSFT_xWebAppPoolDefaults' end - def dscmeta_module_name; 'xWebAdministration' end - def dscmeta_module_version; '1.18.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: ApplyTo - # Type: string - # IsMandatory: True - # Values: ["Machine"] - newparam(:dsc_applyto) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ApplyTo - Dummy value because we need a key, always 'Machine' Valid values are Machine." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Machine', 'machine'].include?(value) - fail("Invalid value '#{value}'. Valid values are Machine") - end - end - end - - # Name: ManagedRuntimeVersion - # Type: string - # IsMandatory: False - # Values: ["", "v2.0", "v4.0"] - newparam(:dsc_managedruntimeversion) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ManagedRuntimeVersion - applicationPools/applicationPoolDefaults/managedRuntimeVersion Valid values are , v2.0, v4.0." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['', '', 'v2.0', 'v2.0', 'v4.0', 'v4.0'].include?(value) - fail("Invalid value '#{value}'. Valid values are , v2.0, v4.0") - end - end - end - - # Name: IdentityType - # Type: string - # IsMandatory: False - # Values: ["ApplicationPoolIdentity", "LocalService", "LocalSystem", "NetworkService"] - newparam(:dsc_identitytype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IdentityType - applicationPools/applicationPoolDefaults/processModel/identityType Valid values are ApplicationPoolIdentity, LocalService, LocalSystem, NetworkService." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['ApplicationPoolIdentity', 'applicationpoolidentity', 'LocalService', 'localservice', 'LocalSystem', 'localsystem', 'NetworkService', 'networkservice'].include?(value) - fail("Invalid value '#{value}'. Valid values are ApplicationPoolIdentity, LocalService, LocalSystem, NetworkService") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xwebapppooldefaults).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xwebconfigkeyvalue.rb b/lib/puppet/type/dsc_xwebconfigkeyvalue.rb deleted file mode 100644 index 09c674ac..00000000 --- a/lib/puppet/type/dsc_xwebconfigkeyvalue.rb +++ /dev/null @@ -1,173 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xwebconfigkeyvalue) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xWebConfigKeyValue resource type. - Automatically generated from - 'xWebAdministration/DSCResources/MSFT_xWebConfigKeyValue/MSFT_xWebConfigKeyValue.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_websitepath is a required attribute') if self[:dsc_websitepath].nil? - fail('dsc_configsection is a required attribute') if self[:dsc_configsection].nil? - fail('dsc_key is a required attribute') if self[:dsc_key].nil? - end - - def dscmeta_resource_friendly_name; 'xWebConfigKeyValue' end - def dscmeta_resource_name; 'MSFT_xWebConfigKeyValue' end - def dscmeta_module_name; 'xWebAdministration' end - def dscmeta_module_version; '1.18.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: WebsitePath - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_websitepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WebsitePath - Path to website location(IIS or WebAdministration format)" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ConfigSection - # Type: string - # IsMandatory: True - # Values: ["AppSettings"] - newparam(:dsc_configsection) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ConfigSection - Config Section to be update Valid values are AppSettings." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['AppSettings', 'appsettings'].include?(value) - fail("Invalid value '#{value}'. Valid values are AppSettings") - end - end - end - - # Name: Key - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_key) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Key - Key for AppSettings" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Value - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_value) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Value - Value for AppSettings" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: IsAttribute - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_isattribute) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "IsAttribute - If the given key value pair is for attribute, default is element" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xwebconfigkeyvalue).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xwebpackagedeploy.rb b/lib/puppet/type/dsc_xwebpackagedeploy.rb deleted file mode 100644 index ea44cf18..00000000 --- a/lib/puppet/type/dsc_xwebpackagedeploy.rb +++ /dev/null @@ -1,120 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xwebpackagedeploy) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xWebPackageDeploy resource type. - Automatically generated from - 'xWebDeploy/DSCResources/xWebPackageDeploy/xWebPackageDeploy.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_destination is a required attribute') if self[:dsc_destination].nil? - end - - def dscmeta_resource_friendly_name; 'xWebPackageDeploy' end - def dscmeta_resource_name; 'xWebPackageDeploy' end - def dscmeta_module_name; 'xWebDeploy' end - def dscmeta_module_version; '1.2.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: SourcePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourcePath - Full path to the zip package." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Destination - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_destination) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Destination - WebDeploy destination for content path or website name)." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Desired state of resource. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xwebpackagedeploy).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xwebsite.rb b/lib/puppet/type/dsc_xwebsite.rb deleted file mode 100644 index 31290f0c..00000000 --- a/lib/puppet/type/dsc_xwebsite.rb +++ /dev/null @@ -1,454 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xwebsite) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - class PuppetX::Dsc::TypeHelpers - def self.validate_MSFT_xWebBindingInformation(mof_type_map, name, value) - required = ['protocol'] - allowed = ['bindinginformation','ipaddress','port','hostname','certificatethumbprint','certificatestorename','sslflags'] - lowkey_hash = Hash[value.map { |k, v| [k.to_s.downcase, v] }] - - missing = required - lowkey_hash.keys - unless missing.empty? - fail "#{name} is missing the following required keys: #{missing.join(',')}" - end - - extraneous = lowkey_hash.keys - required - allowed - unless extraneous.empty? - fail "#{name} includes invalid keys: #{extraneous.join(',')}" - end - - lowkey_hash.keys.each do |key| - if lowkey_hash[key] - validate_mof_type(mof_type_map[key], 'MSFT_xWebBindingInformation', key, lowkey_hash[key]) - end - end - end - end - class PuppetX::Dsc::TypeHelpers - def self.validate_MSFT_xWebAuthenticationInformation(mof_type_map, name, value) - required = [] - allowed = ['anonymous','basic','digest','windows'] - lowkey_hash = Hash[value.map { |k, v| [k.to_s.downcase, v] }] - - missing = required - lowkey_hash.keys - unless missing.empty? - fail "#{name} is missing the following required keys: #{missing.join(',')}" - end - - extraneous = lowkey_hash.keys - required - allowed - unless extraneous.empty? - fail "#{name} includes invalid keys: #{extraneous.join(',')}" - end - - lowkey_hash.keys.each do |key| - if lowkey_hash[key] - validate_mof_type(mof_type_map[key], 'MSFT_xWebAuthenticationInformation', key, lowkey_hash[key]) - end - end - end - end - - @doc = %q{ - The DSC xWebsite resource type. - Automatically generated from - 'xWebAdministration/DSCResources/MSFT_xWebsite/MSFT_xWebsite.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xWebsite' end - def dscmeta_resource_name; 'MSFT_xWebsite' end - def dscmeta_module_name; 'xWebAdministration' end - def dscmeta_module_version; '1.18.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: PhysicalPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_physicalpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "PhysicalPath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: State - # Type: string - # IsMandatory: False - # Values: ["Started", "Stopped"] - newparam(:dsc_state) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "State - Valid values are Started, Stopped." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Started', 'started', 'Stopped', 'stopped'].include?(value) - fail("Invalid value '#{value}'. Valid values are Started, Stopped") - end - end - end - - # Name: ApplicationPool - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_applicationpool) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ApplicationPool" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: BindingInfo - # Type: MSFT_xWebBindingInformation[] - # IsMandatory: False - # Values: None - newparam(:dsc_bindinginfo, :array_matching => :all) do - def mof_type; 'MSFT_xWebBindingInformation[]' end - def mof_is_embedded?; true end - def mof_type_map - {"protocol"=>{:type=>"string", :values=>["http", "https", "msmq.formatname", "net.msmq", "net.pipe", "net.tcp"]}, "bindinginformation"=>{:type=>"string"}, "ipaddress"=>{:type=>"string"}, "port"=>{:type=>"uint16"}, "hostname"=>{:type=>"string"}, "certificatethumbprint"=>{:type=>"string"}, "certificatestorename"=>{:type=>"string", :values=>["My", "WebHosting"]}, "sslflags"=>{:type=>"string", :values=>["0", "1", "2", "3"]}} - end - desc "BindingInfo - Website's binding information in the form of an array of embedded instances of the MSFT_xWebBindingInformation CIM class." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be an array of hashes or a hash") - end - (value.kind_of?(Hash) ? [value] : value).each_with_index do |v, i| - fail "BindingInfo value at index #{i} should be a Hash" unless v.is_a? Hash - - PuppetX::Dsc::TypeHelpers.validate_MSFT_xWebBindingInformation(mof_type_map, "BindingInfo", v) - end - end - munge do |value| - value.kind_of?(Hash) ? - [PuppetX::Dsc::TypeHelpers.munge_embeddedinstance(mof_type_map, value)] : - value.map { |v| PuppetX::Dsc::TypeHelpers.munge_embeddedinstance(mof_type_map, v) } - end - end - - # Name: DefaultPage - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_defaultpage, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "DefaultPage" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: EnabledProtocols - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_enabledprotocols) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "EnabledProtocols" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AuthenticationInfo - # Type: MSFT_xWebAuthenticationInformation - # IsMandatory: False - # Values: None - newparam(:dsc_authenticationinfo) do - def mof_type; 'MSFT_xWebAuthenticationInformation' end - def mof_is_embedded?; true end - def mof_type_map - {"anonymous"=>{:type=>"boolean"}, "basic"=>{:type=>"boolean"}, "digest"=>{:type=>"boolean"}, "windows"=>{:type=>"boolean"}} - end - desc "AuthenticationInfo - Hashtable containing authentication information (Anonymous, Basic, Digest, Windows)" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_xWebAuthenticationInformation(mof_type_map, "AuthenticationInfo", value) - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_embeddedinstance(mof_type_map, value) - end - end - - # Name: PreloadEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_preloadenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "PreloadEnabled - Allows the Website to automatically start without a request" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ServiceAutoStartEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_serviceautostartenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "ServiceAutoStartEnabled - Enables Autostart on a Website." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: ServiceAutoStartProvider - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_serviceautostartprovider) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ServiceAutoStartProvider - Adds a AutostartProvider" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ApplicationType - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_applicationtype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ApplicationType - Adds a AutostartProvider ApplicationType" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: LogPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_logpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogPath - The directory to be used for logfiles" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: LogFlags - # Type: string[] - # IsMandatory: False - # Values: ["Date", "Time", "ClientIP", "UserName", "SiteName", "ComputerName", "ServerIP", "Method", "UriStem", "UriQuery", "HttpStatus", "Win32Status", "BytesSent", "BytesRecv", "TimeTaken", "ServerPort", "UserAgent", "Cookie", "Referer", "ProtocolVersion", "Host", "HttpSubStatus"] - newparam(:dsc_logflags, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "LogFlags - The W3C logging fields Valid values are Date, Time, ClientIP, UserName, SiteName, ComputerName, ServerIP, Method, UriStem, UriQuery, HttpStatus, Win32Status, BytesSent, BytesRecv, TimeTaken, ServerPort, UserAgent, Cookie, Referer, ProtocolVersion, Host, HttpSubStatus." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - if value.kind_of?(Array) - unless (['Date', 'date', 'Time', 'time', 'ClientIP', 'clientip', 'UserName', 'username', 'SiteName', 'sitename', 'ComputerName', 'computername', 'ServerIP', 'serverip', 'Method', 'method', 'UriStem', 'uristem', 'UriQuery', 'uriquery', 'HttpStatus', 'httpstatus', 'Win32Status', 'win32status', 'BytesSent', 'bytessent', 'BytesRecv', 'bytesrecv', 'TimeTaken', 'timetaken', 'ServerPort', 'serverport', 'UserAgent', 'useragent', 'Cookie', 'cookie', 'Referer', 'referer', 'ProtocolVersion', 'protocolversion', 'Host', 'host', 'HttpSubStatus', 'httpsubstatus'] & value).count == value.count - fail("Invalid value #{value}. Valid values are Date, Time, ClientIP, UserName, SiteName, ComputerName, ServerIP, Method, UriStem, UriQuery, HttpStatus, Win32Status, BytesSent, BytesRecv, TimeTaken, ServerPort, UserAgent, Cookie, Referer, ProtocolVersion, Host, HttpSubStatus") - end - end - if value.kind_of?(String) - unless ['Date', 'date', 'Time', 'time', 'ClientIP', 'clientip', 'UserName', 'username', 'SiteName', 'sitename', 'ComputerName', 'computername', 'ServerIP', 'serverip', 'Method', 'method', 'UriStem', 'uristem', 'UriQuery', 'uriquery', 'HttpStatus', 'httpstatus', 'Win32Status', 'win32status', 'BytesSent', 'bytessent', 'BytesRecv', 'bytesrecv', 'TimeTaken', 'timetaken', 'ServerPort', 'serverport', 'UserAgent', 'useragent', 'Cookie', 'cookie', 'Referer', 'referer', 'ProtocolVersion', 'protocolversion', 'Host', 'host', 'HttpSubStatus', 'httpsubstatus'].include?(value) - fail("Invalid value #{value}. Valid values are Date, Time, ClientIP, UserName, SiteName, ComputerName, ServerIP, Method, UriStem, UriQuery, HttpStatus, Win32Status, BytesSent, BytesRecv, TimeTaken, ServerPort, UserAgent, Cookie, Referer, ProtocolVersion, Host, HttpSubStatus") - end - end - end - munge do |value| - Array(value) - end - end - - # Name: LogPeriod - # Type: string - # IsMandatory: False - # Values: ["Hourly", "Daily", "Weekly", "Monthly", "MaxSize"] - newparam(:dsc_logperiod) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogPeriod - How often the log file should rollover Valid values are Hourly, Daily, Weekly, Monthly, MaxSize." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Hourly', 'hourly', 'Daily', 'daily', 'Weekly', 'weekly', 'Monthly', 'monthly', 'MaxSize', 'maxsize'].include?(value) - fail("Invalid value '#{value}'. Valid values are Hourly, Daily, Weekly, Monthly, MaxSize") - end - end - end - - # Name: LogTruncateSize - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_logtruncatesize) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogTruncateSize - How large the file should be before it is truncated" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: LoglocalTimeRollover - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_loglocaltimerollover) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "LoglocalTimeRollover - Use the localtime for file naming and rollover" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: LogFormat - # Type: string - # IsMandatory: False - # Values: ["IIS", "W3C", "NCSA"] - newparam(:dsc_logformat) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogFormat - Format of the Logfiles. Only W3C supports LogFlags Valid values are IIS, W3C, NCSA." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['IIS', 'iis', 'W3C', 'w3c', 'NCSA', 'ncsa'].include?(value) - fail("Invalid value '#{value}'. Valid values are IIS, W3C, NCSA") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xwebsite).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xwebsitedefaults.rb b/lib/puppet/type/dsc_xwebsitedefaults.rb deleted file mode 100644 index 7b58932b..00000000 --- a/lib/puppet/type/dsc_xwebsitedefaults.rb +++ /dev/null @@ -1,169 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xwebsitedefaults) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xWebSiteDefaults resource type. - Automatically generated from - 'xWebAdministration/DSCResources/MSFT_xWebSiteDefaults/MSFT_xWebSiteDefaults.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_applyto is a required attribute') if self[:dsc_applyto].nil? - end - - def dscmeta_resource_friendly_name; 'xWebSiteDefaults' end - def dscmeta_resource_name; 'MSFT_xWebSiteDefaults' end - def dscmeta_module_name; 'xWebAdministration' end - def dscmeta_module_version; '1.18.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: ApplyTo - # Type: string - # IsMandatory: True - # Values: ["Machine"] - newparam(:dsc_applyto) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ApplyTo - Dummy value because we need a key, always 'Machine' Valid values are Machine." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Machine', 'machine'].include?(value) - fail("Invalid value '#{value}'. Valid values are Machine") - end - end - end - - # Name: LogFormat - # Type: string - # IsMandatory: False - # Values: ["W3C", "IIS", "NCSA", "Custom"] - newparam(:dsc_logformat) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogFormat - sites/siteDefaults/logFile/logFormat Valid values are W3C, IIS, NCSA, Custom." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['W3C', 'w3c', 'IIS', 'iis', 'NCSA', 'ncsa', 'Custom', 'custom'].include?(value) - fail("Invalid value '#{value}'. Valid values are W3C, IIS, NCSA, Custom") - end - end - end - - # Name: LogDirectory - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_logdirectory) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogDirectory - sites/siteDefaults/logFile/directory" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: TraceLogDirectory - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_tracelogdirectory) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TraceLogDirectory - sites/siteDefaults/traceFailedRequestsLogging/directory" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DefaultApplicationPool - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_defaultapplicationpool) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DefaultApplicationPool - sites/applicationDefaults/applicationPool" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AllowSubDirConfig - # Type: string - # IsMandatory: False - # Values: ["true", "false"] - newparam(:dsc_allowsubdirconfig) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AllowSubDirConfig - sites/virtualDirectoryDefaults/allowSubDirConfig Valid values are true, false." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['true', 'true', 'false', 'false'].include?(value) - fail("Invalid value '#{value}'. Valid values are true, false") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xwebsitedefaults).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xwebvirtualdirectory.rb b/lib/puppet/type/dsc_xwebvirtualdirectory.rb deleted file mode 100644 index 82d19694..00000000 --- a/lib/puppet/type/dsc_xwebvirtualdirectory.rb +++ /dev/null @@ -1,154 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xwebvirtualdirectory) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xWebVirtualDirectory resource type. - Automatically generated from - 'xWebAdministration/DSCResources/MSFT_xWebVirtualDirectory/MSFT_xWebVirtualDirectory.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_website is a required attribute') if self[:dsc_website].nil? - fail('dsc_webapplication is a required attribute') if self[:dsc_webapplication].nil? - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xWebVirtualDirectory' end - def dscmeta_resource_name; 'MSFT_xWebVirtualDirectory' end - def dscmeta_module_name; 'xWebAdministration' end - def dscmeta_module_version; '1.18.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Website - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_website) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Website - Name of website with which Web Application is associated" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: WebApplication - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_webapplication) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WebApplication - Web application name for the virtual directory" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Name of virtual directory" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: PhysicalPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_physicalpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "PhysicalPath - Physical path for the virtual directory" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Whether virtual directory should be present or absent Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xwebvirtualdirectory).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xwefcollector.rb b/lib/puppet/type/dsc_xwefcollector.rb deleted file mode 100644 index b8574a43..00000000 --- a/lib/puppet/type/dsc_xwefcollector.rb +++ /dev/null @@ -1,105 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xwefcollector) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xWEFCollector resource type. - Automatically generated from - 'xWindowsEventForwarding/DSCResources/MSFT_xWEFCollector/MSFT_xWEFCollector.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xWEFCollector' end - def dscmeta_resource_name; 'MSFT_xWEFCollector' end - def dscmeta_module_name; 'xWindowsEventForwarding' end - def dscmeta_module_version; '1.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Determines whether the Collector service should be enabled or disabled Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - Provide a unique name for the setting" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xwefcollector).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xwefsubscription.rb b/lib/puppet/type/dsc_xwefsubscription.rb deleted file mode 100644 index 77275873..00000000 --- a/lib/puppet/type/dsc_xwefsubscription.rb +++ /dev/null @@ -1,411 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xwefsubscription) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xWEFSubscription resource type. - Automatically generated from - 'xWindowsEventForwarding/DSCResources/MSFT_xWEFSubscription/MSFT_xWEFSubscription.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_subscriptionid is a required attribute') if self[:dsc_subscriptionid].nil? - end - - def dscmeta_resource_friendly_name; 'xWEFSubscription' end - def dscmeta_resource_name; 'MSFT_xWEFSubscription' end - def dscmeta_module_name; 'xWindowsEventForwarding' end - def dscmeta_module_version; '1.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: SubscriptionID - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_subscriptionid) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SubscriptionID - Name of the Subscription" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Determines whether to validate or remove the scubscription Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: SubscriptionType - # Type: string - # IsMandatory: False - # Values: ["CollectorInitiated", "SourceInitiated"] - newparam(:dsc_subscriptiontype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SubscriptionType - Type of Subscription to create Valid values are CollectorInitiated, SourceInitiated." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['CollectorInitiated', 'collectorinitiated', 'SourceInitiated', 'sourceinitiated'].include?(value) - fail("Invalid value '#{value}'. Valid values are CollectorInitiated, SourceInitiated") - end - end - end - - # Name: Description - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_description) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Description - Description of the Collector subscription" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Enabled - # Type: string - # IsMandatory: False - # Values: ["true", "false"] - newparam(:dsc_enabled) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Enabled - Sets whether the subscription will be enabled, default true Valid values are true, false." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['true', 'true', 'false', 'false'].include?(value) - fail("Invalid value '#{value}'. Valid values are true, false") - end - end - end - - # Name: DeliveryMode - # Type: string - # IsMandatory: False - # Values: ["Push", "Pull"] - newparam(:dsc_deliverymode) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DeliveryMode - Configures whether the collector will pull events from source nodes or if the source nodes will push events to the collector, default push Valid values are Push, Pull." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Push', 'push', 'Pull', 'pull'].include?(value) - fail("Invalid value '#{value}'. Valid values are Push, Pull") - end - end - end - - # Name: MaxItems - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_maxitems) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "MaxItems - The number of events that can occur on the source before they are submitted to the collector, default 1" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: MaxLatencyTime - # Type: uint64 - # IsMandatory: False - # Values: None - newparam(:dsc_maxlatencytime) do - def mof_type; 'uint64' end - def mof_is_embedded?; false end - desc "MaxLatencyTime - The maximum amount of time that can pass before events are submitted to the collector, default 20000" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: HeartBeatInterval - # Type: uint64 - # IsMandatory: False - # Values: None - newparam(:dsc_heartbeatinterval) do - def mof_type; 'uint64' end - def mof_is_embedded?; false end - desc "HeartBeatInterval - Frequency to verify connectivity, default 20000" - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ReadExistingEvents - # Type: string - # IsMandatory: False - # Values: ["true", "false"] - newparam(:dsc_readexistingevents) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ReadExistingEvents - Should the collector read existing or only new events, default false Valid values are true, false." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['true', 'true', 'false', 'false'].include?(value) - fail("Invalid value '#{value}'. Valid values are true, false") - end - end - end - - # Name: TransportName - # Type: string - # IsMandatory: False - # Values: ["HTTP", "HTTPS"] - newparam(:dsc_transportname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TransportName - Determines whether to require SSL, default HTTP Valid values are HTTP, HTTPS." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['HTTP', 'http', 'HTTPS', 'https'].include?(value) - fail("Invalid value '#{value}'. Valid values are HTTP, HTTPS") - end - end - end - - # Name: TransportPort - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_transportport) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "TransportPort - Set the port number that WinRM should use to make a connection, default 5985" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: ContentFormat - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_contentformat) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "ContentFormat - Format that event logs will be submitted in, default RenderedText" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Locale - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_locale) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Locale - Sets the subscription Locale, default en-US" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: LogFile - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_logfile) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogFile - Sets the event log that the collected events will be written to, default ForwardedEvents" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CredentialsType - # Type: string - # IsMandatory: False - # Values: ["Default", "Basic", "Negotiate", "Digest"] - newparam(:dsc_credentialstype) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "CredentialsType - Sets the credential type used for authenticating to WinRM, default Default Valid values are Default, Basic, Negotiate, Digest." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Default', 'default', 'Basic', 'basic', 'Negotiate', 'negotiate', 'Digest', 'digest'].include?(value) - fail("Invalid value '#{value}'. Valid values are Default, Basic, Negotiate, Digest") - end - end - end - - # Name: AllowedSourceNonDomainComputers - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_allowedsourcenondomaincomputers, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "AllowedSourceNonDomainComputers - This parameter has not been fully implemented, only required for source initiated scenarios, provide XML to set IssuerCAList, AllowedSubjectList, or DeniedSubjectList if this will be used, default empty string" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: AllowedSourceDomainComputers - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_allowedsourcedomaincomputers) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AllowedSourceDomainComputers - In Source Initiated scenario this SDDL determines who can push events, default O:NSG:NSD:(A;;GA;;;DC)(A;;GA;;;NS) which equates to Domain Computers and Network Service" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Query - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_query, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Query - Expects an array of hashtables that set which events should be collected, default is all application and system logs" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: Address - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_address, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Address - Expects an array of source node FQDNs, default source.wef.test to prevent errors when only staging test subscription" - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xwefsubscription).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xwindowsfeature.rb b/lib/puppet/type/dsc_xwindowsfeature.rb deleted file mode 100644 index d276b166..00000000 --- a/lib/puppet/type/dsc_xwindowsfeature.rb +++ /dev/null @@ -1,167 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xwindowsfeature) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xWindowsFeature resource type. - Automatically generated from - 'xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsFeature/MSFT_xWindowsFeature.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xWindowsFeature' end - def dscmeta_resource_name; 'MSFT_xWindowsFeature' end - def dscmeta_module_name; 'xPSDesiredStateConfiguration' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the role or feature to install or uninstall." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies whether the role or feature should be installed or uninstalled. To install the feature, set this property to Present. To uninstall the feature, set the property to Absent. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: IncludeAllSubFeature - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_includeallsubfeature) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "IncludeAllSubFeature - Specifies whether the subfeatures of the main feature should also be installed." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: LogPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_logpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogPath - The path to the log file to log this operation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential - A credential, if needed, to install or uninstall the role or feature." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: DisplayName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_displayname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DisplayName - The display name of the retrieved role or feature." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xwindowsfeature).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xwindowsoptionalfeature.rb b/lib/puppet/type/dsc_xwindowsoptionalfeature.rb deleted file mode 100644 index 4b60d484..00000000 --- a/lib/puppet/type/dsc_xwindowsoptionalfeature.rb +++ /dev/null @@ -1,218 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xwindowsoptionalfeature) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xWindowsOptionalFeature resource type. - Automatically generated from - 'xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsOptionalFeature/MSFT_xWindowsOptionalFeature.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xWindowsOptionalFeature' end - def dscmeta_resource_name; 'MSFT_xWindowsOptionalFeature' end - def dscmeta_module_name; 'xPSDesiredStateConfiguration' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the feature to enable or disable." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies whether the feature should be enabled or disabled. To enable the feature, set this property to Present. To disable the feature, set the property to Absent. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: RemoveFilesOnDisable - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_removefilesondisable) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RemoveFilesOnDisable - Specifies that all files associated with the feature should be removed if the feature is being disabled." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: NoWindowsUpdateCheck - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_nowindowsupdatecheck) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "NoWindowsUpdateCheck - Specifies whether or not DISM contacts Windows Update (WU) when searching for the source files to enable the feature. If $true, DISM will not contact WU." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: LogLevel - # Type: string - # IsMandatory: False - # Values: ["ErrorsOnly", "ErrorsAndWarning", "ErrorsAndWarningAndInformation"] - newparam(:dsc_loglevel) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogLevel - The maximum output level to show in the log. Accepted values are: ErrorsOnly (only errors are logged), ErrorsAndWarning (errors and warnings are logged), and ErrorsAndWarningAndInformation (errors, warnings, and debug information are logged). Valid values are ErrorsOnly, ErrorsAndWarning, ErrorsAndWarningAndInformation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['ErrorsOnly', 'errorsonly', 'ErrorsAndWarning', 'errorsandwarning', 'ErrorsAndWarningAndInformation', 'errorsandwarningandinformation'].include?(value) - fail("Invalid value '#{value}'. Valid values are ErrorsOnly, ErrorsAndWarning, ErrorsAndWarningAndInformation") - end - end - end - - # Name: LogPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_logpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogPath - The path to the log file to log this operation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: CustomProperties - # Type: string[] - # IsMandatory: False - # Values: None - newparam(:dsc_customproperties, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "CustomProperties - The custom properties retrieved from the Windows optional feature as an array of strings." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - end - munge do |value| - Array(value) - end - end - - # Name: Description - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_description) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Description - The description retrieved from the Windows optional feature." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: DisplayName - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_displayname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "DisplayName - The display name retrieved from the Windows optional feature." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xwindowsoptionalfeature).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xwindowspackagecab.rb b/lib/puppet/type/dsc_xwindowspackagecab.rb deleted file mode 100644 index 8e5fef61..00000000 --- a/lib/puppet/type/dsc_xwindowspackagecab.rb +++ /dev/null @@ -1,135 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xwindowspackagecab) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xWindowsPackageCab resource type. - Automatically generated from - 'xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsPackageCab/MSFT_xWindowsPackageCab.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_name is a required attribute') if self[:dsc_name].nil? - end - - def dscmeta_resource_friendly_name; 'xWindowsPackageCab' end - def dscmeta_resource_name; 'MSFT_xWindowsPackageCab' end - def dscmeta_module_name; 'xPSDesiredStateConfiguration' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Name - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_name) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Name - The name of the package to install or uninstall." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Specifies whether the package should be installed or uninstalled. To install the package, set this property to Present. To uninstall the package, set the property to Absent. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: SourcePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_sourcepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SourcePath - The path to the cab file to install or uninstall the package from." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: LogPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_logpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogPath - The path to a file to log the operation to." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xwindowspackagecab).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xwindowsprocess.rb b/lib/puppet/type/dsc_xwindowsprocess.rb deleted file mode 100644 index 451e8fd8..00000000 --- a/lib/puppet/type/dsc_xwindowsprocess.rb +++ /dev/null @@ -1,306 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xwindowsprocess) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xWindowsProcess resource type. - Automatically generated from - 'xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsProcess/MSFT_xWindowsProcess.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_path is a required attribute') if self[:dsc_path].nil? - fail('dsc_arguments is a required attribute') if self[:dsc_arguments].nil? - end - - def dscmeta_resource_friendly_name; 'xWindowsProcess' end - def dscmeta_resource_name; 'MSFT_xWindowsProcess' end - def dscmeta_module_name; 'xPSDesiredStateConfiguration' end - def dscmeta_module_version; '7.0.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Path - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_path) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Path - The full path or file name to the process executable to start or stop." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Arguments - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_arguments) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Arguments - A string of arguments to pass to the process executable. Pass in an empty string if no arguments are needed." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Credential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_credential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "Credential - The credential to run the process under." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Indicates whether the process is present (running) or absent (not running). Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - # Name: StandardOutputPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_standardoutputpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "StandardOutputPath - The path to write the standard output stream to." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: StandardErrorPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_standarderrorpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "StandardErrorPath - The path to write the standard error stream to." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: StandardInputPath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_standardinputpath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "StandardInputPath - The path to receive standard input from." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: WorkingDirectory - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_workingdirectory) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "WorkingDirectory - The directory to run the processes under." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: PagedMemorySize - # Type: uint64 - # IsMandatory: False - # Values: None - newparam(:dsc_pagedmemorysize) do - def mof_type; 'uint64' end - def mof_is_embedded?; false end - desc "PagedMemorySize - The amount of paged memory, in bytes, allocated for the process." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: NonPagedMemorySize - # Type: uint64 - # IsMandatory: False - # Values: None - newparam(:dsc_nonpagedmemorysize) do - def mof_type; 'uint64' end - def mof_is_embedded?; false end - desc "NonPagedMemorySize - The amount of nonpaged memory, in bytes, allocated for the process." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: VirtualMemorySize - # Type: uint64 - # IsMandatory: False - # Values: None - newparam(:dsc_virtualmemorysize) do - def mof_type; 'uint64' end - def mof_is_embedded?; false end - desc "VirtualMemorySize - The amount of virtual memory, in bytes, allocated for the process." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: HandleCount - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_handlecount) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "HandleCount - The number of handles opened by the process." - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ProcessId - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_processid) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "ProcessId - The unique identifier of the process." - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: ProcessCount - # Type: sint32 - # IsMandatory: False - # Values: None - newparam(:dsc_processcount) do - def mof_type; 'sint32' end - def mof_is_embedded?; false end - desc "ProcessCount - The number of instances of the given process that are currently running." - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xwindowsprocess).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xwindowsupdateagent.rb b/lib/puppet/type/dsc_xwindowsupdateagent.rb deleted file mode 100644 index 1da4a79c..00000000 --- a/lib/puppet/type/dsc_xwindowsupdateagent.rb +++ /dev/null @@ -1,217 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xwindowsupdateagent) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xWindowsUpdateAgent resource type. - Automatically generated from - 'xWindowsUpdate/DscResources/MSFT_xWindowsUpdateAgent/MSFT_xWindowsUpdateAgent.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_issingleinstance is a required attribute') if self[:dsc_issingleinstance].nil? - end - - def dscmeta_resource_friendly_name; 'xWindowsUpdateAgent' end - def dscmeta_resource_name; 'MSFT_xWindowsUpdateAgent' end - def dscmeta_module_name; 'xWindowsUpdate' end - def dscmeta_module_version; '2.7.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: IsSingleInstance - # Type: string - # IsMandatory: True - # Values: ["Yes"] - newparam(:dsc_issingleinstance) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes' Valid values are Yes." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Yes', 'yes'].include?(value) - fail("Invalid value '#{value}'. Valid values are Yes") - end - end - end - - # Name: Category - # Type: string[] - # IsMandatory: False - # Values: ["Security", "Important", "Optional"] - newparam(:dsc_category, :array_matching => :all) do - def mof_type; 'string[]' end - def mof_is_embedded?; false end - desc "Category - Indicates if the resource should ensure all Windows Updates are installed or if Automatic updates should be disabled. Valid values are Security, Important, Optional." - validate do |value| - unless value.kind_of?(Array) || value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string or an array of strings") - end - if value.kind_of?(Array) - unless (['Security', 'security', 'Important', 'important', 'Optional', 'optional'] & value).count == value.count - fail("Invalid value #{value}. Valid values are Security, Important, Optional") - end - end - if value.kind_of?(String) - unless ['Security', 'security', 'Important', 'important', 'Optional', 'optional'].include?(value) - fail("Invalid value #{value}. Valid values are Security, Important, Optional") - end - end - end - munge do |value| - Array(value) - end - end - - # Name: Notifications - # Type: string - # IsMandatory: False - # Values: ["Disabled", "ScheduledInstallation"] - newparam(:dsc_notifications) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Notifications - Indicates if Windows update agent should notify about updates, see:https://msdn.microsoft.com/en-us/library/windows/desktop/aa385806%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396. Valid values are Disabled, ScheduledInstallation." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Disabled', 'disabled', 'ScheduledInstallation', 'scheduledinstallation'].include?(value) - fail("Invalid value '#{value}'. Valid values are Disabled, ScheduledInstallation") - end - end - end - - # Name: Source - # Type: string - # IsMandatory: False - # Values: ["WindowsUpdate", "MicrosoftUpdate", "WSUS"] - newparam(:dsc_source) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Source - Indicates which source service Windows update agent should use. Note: WSUS is not implemented in this resource. Valid values are WindowsUpdate, MicrosoftUpdate, WSUS." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['WindowsUpdate', 'windowsupdate', 'MicrosoftUpdate', 'microsoftupdate', 'WSUS', 'wsus'].include?(value) - fail("Invalid value '#{value}'. Valid values are WindowsUpdate, MicrosoftUpdate, WSUS") - end - end - end - - # Name: UpdateNow - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_updatenow) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "UpdateNow - Indicates if the resource should trigger an update during consistency." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: AutomaticUpdatesNotificationSetting - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_automaticupdatesnotificationsetting) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AutomaticUpdatesNotificationSetting - Automatic Updates Notification Setting" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: TotalUpdatesNotInstalled - # Type: uint32 - # IsMandatory: False - # Values: None - newparam(:dsc_totalupdatesnotinstalled) do - def mof_type; 'uint32' end - def mof_is_embedded?; false end - desc "TotalUpdatesNotInstalled - Count of updates not installed. Only returned if UpdateNow is specified." - validate do |value| - unless (value.kind_of?(Numeric) && value >= 0) || (value.to_i.to_s == value && value.to_i >= 0) - fail("Invalid value #{value}. Should be a unsigned Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: RebootRequired - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_rebootrequired) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "RebootRequired - Indicates if Wua Requires a reboot. Only returned if UpdateNow is specified." - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xwindowsupdateagent).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xwineventlog.rb b/lib/puppet/type/dsc_xwineventlog.rb deleted file mode 100644 index 65d87c2b..00000000 --- a/lib/puppet/type/dsc_xwineventlog.rb +++ /dev/null @@ -1,167 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xwineventlog) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xWinEventLog resource type. - Automatically generated from - 'xWinEventLog/DSCResources/MSFT_xWinEventLog/MSFT_xWinEventLog.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_logname is a required attribute') if self[:dsc_logname].nil? - end - - def dscmeta_resource_friendly_name; 'xWinEventLog' end - def dscmeta_resource_name; 'MSFT_xWinEventLog' end - def dscmeta_module_name; 'xWinEventLog' end - def dscmeta_module_version; '1.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: LogName - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_logname) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogName - Name of the event log" - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: MaximumSizeInBytes - # Type: sint64 - # IsMandatory: False - # Values: None - newparam(:dsc_maximumsizeinbytes) do - def mof_type; 'sint64' end - def mof_is_embedded?; false end - desc "MaximumSizeInBytes - sizethat the event log file is allowed to be When the file reaches this maximum size it is considered full" - validate do |value| - unless value.kind_of?(Numeric) || value.to_i.to_s == value - fail("Invalid value #{value}. Should be a signed Integer") - end - end - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_integer(value) - end - end - - # Name: IsEnabled - # Type: boolean - # IsMandatory: False - # Values: None - newparam(:dsc_isenabled) do - def mof_type; 'boolean' end - def mof_is_embedded?; false end - desc "IsEnabled" - validate do |value| - end - newvalues(true, false) - munge do |value| - PuppetX::Dsc::TypeHelpers.munge_boolean(value.to_s) - end - end - - # Name: LogMode - # Type: string - # IsMandatory: False - # Values: ["AutoBackup", "Circular", "Retain"] - newparam(:dsc_logmode) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogMode - Valid values are AutoBackup, Circular, Retain." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['AutoBackup', 'autobackup', 'Circular', 'circular', 'Retain', 'retain'].include?(value) - fail("Invalid value '#{value}'. Valid values are AutoBackup, Circular, Retain") - end - end - end - - # Name: SecurityDescriptor - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_securitydescriptor) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "SecurityDescriptor" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: LogFilePath - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_logfilepath) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "LogFilePath" - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xwineventlog).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet/type/dsc_xwordpresssite.rb b/lib/puppet/type/dsc_xwordpresssite.rb deleted file mode 100644 index f385e210..00000000 --- a/lib/puppet/type/dsc_xwordpresssite.rb +++ /dev/null @@ -1,151 +0,0 @@ -require 'pathname' - -Puppet::Type.newtype(:dsc_xwordpresssite) do - require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc' - require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers' - - - @doc = %q{ - The DSC xWordPressSite resource type. - Automatically generated from - 'xWordPress/DscResources/MSFT_xWordPressSite/MSFT_xWordPressSite.schema.mof' - - To learn more about PowerShell Desired State Configuration, please - visit https://technet.microsoft.com/en-us/library/dn249912.aspx. - - For more information about built-in DSC Resources, please visit - https://technet.microsoft.com/en-us/library/dn249921.aspx. - - For more information about xDsc Resources, please visit - https://github.com/PowerShell/DscResources. - } - - validate do - fail('dsc_uri is a required attribute') if self[:dsc_uri].nil? - end - - def dscmeta_resource_friendly_name; 'xWordPressSite' end - def dscmeta_resource_name; 'MSFT_xWordPressSite' end - def dscmeta_module_name; 'xWordPress' end - def dscmeta_module_version; '1.1.0.0' end - - newparam(:name, :namevar => true ) do - end - - ensurable do - newvalue(:exists?) { provider.exists? } - newvalue(:present) { provider.create } - newvalue(:absent) { provider.destroy } - defaultto { :present } - end - - # Name: PsDscRunAsCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_psdscrunascredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "PsDscRunAsCredential" - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("Credential", value) - end - end - - # Name: Uri - # Type: string - # IsMandatory: True - # Values: None - newparam(:dsc_uri) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Uri - The WordPress Site URI." - isrequired - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Title - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_title) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Title - The WordPress Site Default page title." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: AdministratorCredential - # Type: MSFT_Credential - # IsMandatory: False - # Values: None - newparam(:dsc_administratorcredential) do - def mof_type; 'MSFT_Credential' end - def mof_is_embedded?; true end - desc "AdministratorCredential - The username and password of the WordPress administrator to create when creating the site." - validate do |value| - unless value.kind_of?(Hash) - fail("Invalid value '#{value}'. Should be a hash") - end - PuppetX::Dsc::TypeHelpers.validate_MSFT_Credential("AdministratorCredential", value) - end - end - - # Name: AdministratorEmail - # Type: string - # IsMandatory: False - # Values: None - newparam(:dsc_administratoremail) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "AdministratorEmail - The email address of the WordPress administrator to create." - validate do |value| - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - end - end - - # Name: Ensure - # Type: string - # IsMandatory: False - # Values: ["Present", "Absent"] - newparam(:dsc_ensure) do - def mof_type; 'string' end - def mof_is_embedded?; false end - desc "Ensure - Should the module be present or absent. Valid values are Present, Absent." - validate do |value| - resource[:ensure] = value.downcase - unless value.kind_of?(String) - fail("Invalid value '#{value}'. Should be a string") - end - unless ['Present', 'present', 'Absent', 'absent'].include?(value) - fail("Invalid value '#{value}'. Valid values are Present, Absent") - end - end - end - - - def builddepends - pending_relations = super() - PuppetX::Dsc::TypeHelpers.ensure_reboot_relationship(self, pending_relations) - end -end - -Puppet::Type.type(:dsc_xwordpresssite).provide :powershell, :parent => Puppet::Type.type(:base_dsc).provider(:powershell) do - confine :true => (Gem::Version.new(Facter.value(:powershell_version)) >= Gem::Version.new('5.0.10586.117')) - defaultfor :operatingsystem => :windows - - mk_resource_methods -end diff --git a/lib/puppet_x/dsc_resources/AuditPolicyDsc/AuditPolicyDsc.psd1 b/lib/puppet_x/dsc_resources/AuditPolicyDsc/AuditPolicyDsc.psd1 deleted file mode 100644 index 7ffd3a74..00000000 --- a/lib/puppet_x/dsc_resources/AuditPolicyDsc/AuditPolicyDsc.psd1 +++ /dev/null @@ -1,122 +0,0 @@ -# -# Module manifest for module 'AuditPolicyDsc' -# -# Generated by: Adam Haynes -# -# Generated on: 12/17/2015 -# - -@{ - -# Script module or binary module file associated with this manifest. -# RootModule = '' - -# Version number of this module. -ModuleVersion = '1.1.0.0' - -# ID used to uniquely identify this module -GUID = '644501e3-ebc7-451e-9155-366a4f8d4a9a' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2016 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'The AuditPolicyDsc module allows you to configure and manage the advanced audit policy on all currently supported versions of Windows.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Name of the Windows PowerShell host required by this module -# PowerShellHostName = '' - -# Minimum version of the Windows PowerShell host required by this module -# PowerShellHostVersion = '' - -# Minimum version of Microsoft .NET Framework required by this module -# DotNetFrameworkVersion = '' - -# Minimum version of the common language runtime (CLR) required by this module -# CLRVersion = '' - -# Processor architecture (None, X86, Amd64) required by this module -# ProcessorArchitecture = '' - -# Modules that must be imported into the global environment prior to importing this module -# RequiredModules = @() - -# Assemblies that must be loaded prior to importing this module -# RequiredAssemblies = @() - -# Script files (.ps1) that are run in the caller's environment prior to importing this module. -# ScriptsToProcess = @() - -# Type files (.ps1xml) to be loaded when importing this module -# TypesToProcess = @() - -# Format files (.ps1xml) to be loaded when importing this module -# FormatsToProcess = @() - -# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess -# NestedModules = @() - -# Functions to export from this module -# FunctionsToExport = '*' - -# Cmdlets to export from this module -# CmdletsToExport = '*' - -# Variables to export from this module -# VariablesToExport = '*' - -# Aliases to export from this module -# AliasesToExport = '*' - -# DSC resources to export from this module -# DscResourcesToExport = @() - -# List of all modules packaged with this module -# ModuleList = @() - -# List of all files packaged with this module -# FileList = @() - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @( 'DSC','DesiredStateConfiguration','DSCResourceKit','DSCResource','AuditPolicy' ) - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/AuditPolicyDsc/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/AuditPolicyDsc' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - ReleaseNotes = '* Added the AuditPolicyCsv resource. - -' - - } # End of PSData hashtable - -} # End of PrivateData hashtable - -# HelpInfo URI of this module -# HelpInfoURI = '' - -# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. -# DefaultCommandPrefix = '' - -} - diff --git a/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/AuditPolicyResourceHelper/AuditPolicyResourceHelper.psm1 b/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/AuditPolicyResourceHelper/AuditPolicyResourceHelper.psm1 deleted file mode 100644 index c8d5bca5..00000000 --- a/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/AuditPolicyResourceHelper/AuditPolicyResourceHelper.psm1 +++ /dev/null @@ -1,224 +0,0 @@ -#Requires -Version 4.0 - -<# - This PS module contains functions for Desired State Configuration (DSC) AuditPolicyDsc provider. - It enables querying, creation, removal and update of Windows advanced audit policies through - Get, Set, and Test operations on DSC managed nodes. -#> - -<# - .SYNOPSIS - Retrieves the localized string data based on the machine's culture. - Falls back to en-US strings if the machine's culture is not supported. - - .PARAMETER ResourceName - The name of the resource as it appears before '.strings.psd1' of the localized string file. - For example: - AuditPolicySubcategory: MSFT_AuditPolicySubcategory - AuditPolicyOption: MSFT_AuditPolicyOption -#> -function Get-LocalizedData -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true, ParameterSetName = 'resource')] - [ValidateNotNullOrEmpty()] - [String] - $ResourceName, - - [Parameter(Mandatory = $true, ParameterSetName = 'helper')] - [ValidateNotNullOrEmpty()] - [String] - $HelperName - ) - - # With the helper module just update the name and path variables as if it were a resource. - if ($PSCmdlet.ParameterSetName -eq 'helper') - { - $resourceDirectory = $PSScriptRoot - $ResourceName = $HelperName - } - else - { - # Step up one additional level to build the correct path to the resource culture. - $resourceDirectory = Join-Path -Path ( Split-Path $PSScriptRoot -Parent ) ` - -ChildPath $ResourceName - } - - $localizedStringFileLocation = Join-Path -Path $resourceDirectory -ChildPath $PSUICulture - - if (-not (Test-Path -Path $localizedStringFileLocation)) - { - # Fallback to en-US - $localizedStringFileLocation = Join-Path -Path $resourceDirectory -ChildPath 'en-US' - } - - Import-LocalizedData ` - -BindingVariable 'localizedData' ` - -FileName "$ResourceName.strings.psd1" ` - -BaseDirectory $localizedStringFileLocation - - return $localizedData -} - -<# - .SYNOPSIS - Invoke-AuditPol is a private function that wraps auditpol.exe providing a - centralized function to manage access to and the output of auditpol.exe. - .DESCRIPTION - The function will accept a string to pass to auditpol.exe for execution. Any 'get' or - 'set' opertions can be passed to the central wrapper to execute. All of the - nuances of auditpol.exe can be further broken out into specalized functions that - call Invoke-AuditPol. - - Since the call operator is being used to run auditpol, the input is restricted to only execute - against auditpol.exe. Any input that is an invalid flag or parameter in - auditpol.exe will return an error to prevent abuse of the call. - The call operator will not parse the parameters, so they are split in the function. - .PARAMETER Command - The action that audtipol should take on the subcommand. - .PARAMETER SubCommand - The subcommand to execute. - .OUTPUTS - The raw string output of auditpol.exe with the /r switch to return a CSV string. - .EXAMPLE - Invoke-AuditPol -Command 'Get' -SubCommand 'Subcategory:Logon' -#> -function Invoke-AuditPol -{ - [OutputType([System.String])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Get', 'Set', 'List','Restore','Backup')] - [System.String] - $Command, - - [Parameter(Mandatory = $true)] - [System.String[]] - $SubCommand - ) - - # Localized messages for Write-Verbose statements in this resource - $localizedData = Get-LocalizedData -HelperName 'AuditPolicyResourceHelper' - <# - The raw auditpol data with the /r switch is a 3 line CSV - 0 - header row - 1 - blank row - 2 - the data row we are interested in - #> - - # set the base commands to execute - if ( $Command -eq 'Get') - { - $commandString = @("/$Command","/$SubCommand","/r" ) - } - else - { - # The set subcommand comes in an array of the subcategory and flag - $commandString = @("/$Command","/$($SubCommand[0])",$SubCommand[1] ) - } - - Write-Debug -Message ( $localizedData.ExecuteAuditpolCommand -f $commandString ) - - try - { - # Use the call operator to process the auditpol command - $auditPolicyCommandResult = & "auditpol.exe" $commandString 2>&1 - - # auditpol does not throw exceptions, so test the results and throw if needed - if ( $LASTEXITCODE -ne 0 ) - { - throw New-Object System.ArgumentException - } - - if ($Command -notmatch "Restore|Backup") - { - return $auditPolicyCommandResult - } - } - catch [System.Management.Automation.CommandNotFoundException] - { - # Catch error if the auditpol command is not found on the system - Write-Error -Message $localizedData.AuditpolNotFound - } - catch [System.ArgumentException] - { - # Catch the error thrown if the lastexitcode is not 0 - [String] $errorString = $error[0].Exception - $errorString = $errorString + "`$LASTEXITCODE = $LASTEXITCODE;" - $errorString = $errorString + " Command = auditpol $commandString" - - Write-Error -Message $errorString - } - catch - { - # Catch any other errors - Write-Error -Message ( $localizedData.UnknownError -f $error[0] ) - } -} - -<# - .SYNOPSIS - Returns the list of valid Subcategories. - .DESCRIPTION - This funciton will check if the list of valid subcategories has already been created. - If the list exists it will simply return it. If it doe not exists, it will generate - it and return it. -#> -function Get-ValidSubcategoryList -{ - [OutputType([String[]])] - [CmdletBinding()] - param () - - if ($null -eq $script:validSubcategoryList) - { - $script:validSubcategoryList = @() - - # Populating $validSubcategoryList uses Invoke-AuditPol and needs to follow the definition. - Invoke-AuditPol -Command List -SubCommand "Subcategory:*" | - Where-Object { $_ -notlike 'Category/Subcategory*' } | - ForEach-Object { - # The categories do not have any space in front of them, but the subcategories do. - if ( $_ -like " *" ) - { - $script:validSubcategoryList += $_.trim() - } - } - } - - return $script:validSubcategoryList -} - -<# - .SYNOPSIS - Verifies that the Subcategory is valid. - .PARAMETER Name - The name of the Subcategory to validate. -#> -function Test-ValidSubcategory -{ - [OutputType([Boolean])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [String] - $Name - ) - - if ( ( Get-ValidSubcategoryList ) -icontains $Name ) - { - return $true - } - else - { - return $false - } -} - -Export-ModuleMember -Function @( 'Invoke-AuditPol', 'Get-LocalizedData', - 'Test-ValidSubcategory' ) diff --git a/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/AuditPolicyResourceHelper/en-US/AuditPolicyResourceHelper.strings.psd1 b/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/AuditPolicyResourceHelper/en-US/AuditPolicyResourceHelper.strings.psd1 deleted file mode 100644 index 591d5bf2..00000000 --- a/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/AuditPolicyResourceHelper/en-US/AuditPolicyResourceHelper.strings.psd1 +++ /dev/null @@ -1,8 +0,0 @@ -ConvertFrom-StringData -StringData @' - AuditpolNotFound = (ERROR) auditpol.exe was not found on the system - RequiredPrivilegeMissing = (ERROR) A required privilege is not held by the client - IncorrectParameter = (ERROR) The parameter is incorrect - UnknownError = (ERROR) An unknown error has occured: {0} - ExecuteAuditpolCommand = Executing 'auditpol.exe {0}' -'@ - diff --git a/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicyCsv/MSFT_AuditPolicyCsv.psm1 b/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicyCsv/MSFT_AuditPolicyCsv.psm1 deleted file mode 100644 index 9e07d095..00000000 --- a/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicyCsv/MSFT_AuditPolicyCsv.psm1 +++ /dev/null @@ -1,256 +0,0 @@ - -Import-Module -Name (Join-Path -Path ( Join-Path -Path ( Split-Path $PSScriptRoot -Parent ) ` - -ChildPath 'AuditPolicyResourceHelper' ) ` - -ChildPath 'AuditPolicyResourceHelper.psm1') - -# Localized messages for Write-Verbose statements in this resource -$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_AuditPolicyCsv' - -<# - .SYNOPSIS - Gets the current audit policy for the node. - .PARAMETER CsvPath - This parameter is ignored in the Get operation, but does return the path to the - backup of the current audit policy settings. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [String] - $IsSingleInstance, - - [parameter(Mandatory = $true)] - [System.String] - $CsvPath - ) - - [string] $tempFile = ([system.IO.Path]::GetTempFileName()).Replace('.tmp','.csv') - - try - { - Write-Verbose -Message ($localizedData.BackupFilePath -f $tempFile) - Invoke-SecurityCmdlet -Action "Export" -CsvPath $tempFile - } - catch - { - Write-Verbose -Message ($localizedData.ExportFailed -f $tempFile) - } - - return @{ - CsvPath = $tempFile - IsSingleInstance = 'Yes' - } -} - -<# - .SYNOPSIS - Sets the current audit policy for the node. - .PARAMETER CsvPath - Specifies the path to desired audit policy settings to apply to the node. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [String] - $IsSingleInstance, - - [parameter(Mandatory = $true)] - [System.String] - $CsvPath - ) - - if (Test-Path -Path $CsvPath) - { - try - { - Invoke-SecurityCmdlet -Action "Import" -CsvPath $CsvPath | Out-Null - Write-Verbose -Message ($localizedData.ImportSucceeded -f $CsvPath) - } - catch - { - Write-Verbose -Message ($localizedData.ImportFailed -f $CsvPath) - } - } - else - { - Write-Verbose -Message ($localizedData.FileNotFound -f $CsvPath) - } -} - -<# - .SYNOPSIS - Tests the current audit policy against the desired policy. - .PARAMETER CsvPath - Specifies the path to desired audit policy settings to test against the node. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [String] - $IsSingleInstance, - - [parameter(Mandatory = $true)] - [System.String] - $CsvPath - ) - - if (Test-Path -Path $CsvPath) - { - # The CsvPath in Get-TargetResource is ignored and a temp file is returned for comparison. - $currentAuditPolicyBackupPath = (Get-TargetResource -CsvPath $CsvPath ` - -IsSingleInstance $IsSingleInstance).CsvPath - - $currentAuditPolicy = Import-Csv -Path $currentAuditPolicyBackupPath | - Select-Object -Property Subcategory, @{ - 'Name' = 'Value'; - 'Expression' = {$_.'Setting Value'} - } - - $desiredAuditPolicy = Import-Csv -Path $CsvPath | - Select-Object -Property Subcategory, @{ - 'Name' = 'Value'; - 'Expression' = {$_.'Setting Value'} - } - - # Assume the node is in the desired state until proven false. - $inDesiredState = $true - - foreach ($desiredAuditPolicySetting in $desiredAuditPolicy) - { - # Get the current setting name that mathches the desired setting name - $currentAuditPolicySetting = $currentAuditPolicy.Where({ - $_.Subcategory -eq $desiredAuditPolicySetting.Subcategory - }) - - # If the current and desired setting do not match, set the flag to $false - if ($desiredAuditPolicySetting.Value -ne $currentAuditPolicySetting.Value) - { - Write-Verbose -Message ($localizedData.testCsvFailed -f - $desiredAuditPolicySetting.Subcategory) - - $inDesiredState = $false - } - else - { - Write-Verbose -Message ($localizedData.testCsvSucceed -f - $desiredAuditPolicySetting.Subcategory) - } - } - - # Cleanup the temp file, since it is no longer needed. - Remove-BackupFile -CsvPath $currentAuditPolicyBackupPath -Verbose - - return $inDesiredState - } - else - { - Write-Verbose -Message ($localizedData.FileNotFound -f $CsvPath) - return $false - } -} - -<# - .SYNOPSIS - Helper function to use SecurityCmdlet modules if present. If not, go through AuditPol.exe. - .PARAMETER Action - The action to take, either Import or Export. Import will clear existing policy before writing. - .PARAMETER CsvPath - The path to a CSV file to either create or import. - .EXAMPLE - Invoke-SecurityCmdlet -Action Import -CsvPath .\test.csv -#> -function Invoke-SecurityCmdlet -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet('Import','Export')] - [System.String] - $Action, - - [Parameter(Mandatory = $true)] - [System.String] - $CsvPath - ) - - # Use the security cmdlets if present. If not, use Invoke-AuditPol to call auditpol.exe. - if ($null -eq (Get-Module -ListAvailable -Name "SecurityCmdlets")) - { - Write-Verbose -Message ($localizedData.CmdletsNotFound) - - if ($Action -ieq "Import") - { - Invoke-AuditPol -Command Restore -SubCommand "file:$CsvPath" - } - else - { - # No force option on Backup, manually check for file and delete it so we can write back again - if (Test-Path -Path $CsvPath) - { - Remove-Item -Path $CsvPath -Force - } - - Invoke-AuditPol -Command Backup -SubCommand "file:$CsvPath" - } - } - else - { - Import-Module -Name SecurityCmdlets - - if ($Action -ieq "Import") - { - Restore-AuditPolicy -Path $CsvPath | Out-Null - } - elseif ($Action -ieq "Export") - { - # No force option on Backup, manually check for file and delete it so we can write back again - if (Test-Path -Path $CsvPath) - { - Remove-Item -Path $CsvPath -Force - } - Backup-AuditPolicy -Path $CsvPath | Out-Null - } - } -} - -<# - .SYNOPSIS - Removes the temporary file that is created by the Get\Test functions. - .PARAMETER CsvPath - Specifies the path of the temp file to remove. -#> -function Remove-BackupFile -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $CsvPath - ) - - try - { - Remove-Item -Path $CsvPath - Write-Verbose -Message ($localizedData.RemoveFile -f $CsvPath) - } - catch - { - Write-Error $error[0] - } -} diff --git a/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicyCsv/MSFT_AuditPolicyCsv.schema.mof b/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicyCsv/MSFT_AuditPolicyCsv.schema.mof deleted file mode 100644 index e0a63b54..00000000 --- a/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicyCsv/MSFT_AuditPolicyCsv.schema.mof +++ /dev/null @@ -1,6 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("AuditPolicyCsv")] -class MSFT_AuditPolicyCsv : OMI_BaseResource -{ - [Key, Description("Specifies the resource is a single instance, the value must be 'Yes'"), ValueMap{"Yes"}, Values{"Yes"}] String IsSingleInstance; - [Required, Description("Path to a CSV backup of Auditing settings")] String CsvPath; -}; diff --git a/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicyCsv/en-US/MSFT_AuditPolicyCsv.strings.psd1 b/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicyCsv/en-US/MSFT_AuditPolicyCsv.strings.psd1 deleted file mode 100644 index 9cf08dc1..00000000 --- a/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicyCsv/en-US/MSFT_AuditPolicyCsv.strings.psd1 +++ /dev/null @@ -1,12 +0,0 @@ -ConvertFrom-StringData -StringData @' - BackupFilePath = Exporting to {0} - ExportFailed = Failed export to {0} - ImportFailed = Failed import of {0} - ExportSucceeded = Succeeded export to {0} - ImportSucceeded = Succeeded import of {0} - testCsvFailed = {0} not in desired state - testCsvSucceed = {0} in desired state - FileNotFound = {0} not found - RemoveFile = Removing {0} - CmdletsNotFound = Security cmdlets not found, switching to auditpol.exe -'@ diff --git a/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicyOption/MSFT_AuditPolicyOption.psm1 b/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicyOption/MSFT_AuditPolicyOption.psm1 deleted file mode 100644 index 4a8c7f8a..00000000 --- a/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicyOption/MSFT_AuditPolicyOption.psm1 +++ /dev/null @@ -1,205 +0,0 @@ - -Import-Module -Name (Join-Path -Path ( Split-Path $PSScriptRoot -Parent ) ` - -ChildPath 'AuditPolicyResourceHelper\AuditPolicyResourceHelper.psm1') ` - -Force - -# Localized messages for Write-Verbose statements in this resource -$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_AuditPolicyOption' - -<# - .SYNOPSIS - Gets the value of the audit policy option. - .PARAMETER Name - Specifies the option to get. - .PARAMETER Value - Not used in Get-TargetResource. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('CrashOnAuditFail', 'FullPrivilegeAuditing', 'AuditBaseObjects', - 'AuditBaseDirectories')] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [ValidateSet('Enabled', 'Disabled')] - [System.String] - $Value - ) - - # Get the option's current value - $optionValue = Get-AuditOption -Name $Name - - Write-Verbose -Message ( $localizedData.GetAuditpolOptionSucceed -f $Name ) - - return @{ - Name = $Name - Value = $optionValue - } -} - -<# - .SYNOPSIS - Sets the value of the audit policy option. - .PARAMETER Name - Specifies the option to set. - .PARAMETER Value - Specifies the value to set the option to. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('CrashOnAuditFail', 'FullPrivilegeAuditing', 'AuditBaseObjects', - 'AuditBaseDirectories')] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [ValidateSet('Enabled', 'Disabled')] - [System.String] - $Value - ) - - try - { - Set-AuditOption -Name $Name -Value $Value - Write-Verbose -Message ( $localizedData.SetAuditpolOptionSucceed -f $Name, $Value ) - } - catch - { - Write-Verbose -Message ( $localizedData.SetAuditpolOptionFailed -f $Name, $Value ) - } -} - -<# - .SYNOPSIS - Tests that the audit policy option is in the desired state - .PARAMETER Name - Specifies the option to test. - .PARAMETER Value - Specifies the value to test against the option. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('CrashOnAuditFail', 'FullPrivilegeAuditing', 'AuditBaseObjects', - 'AuditBaseDirectories')] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [ValidateSet('Enabled', 'Disabled')] - [System.String] - $Value - ) - - if ( ( Get-AuditOption -Name $Name ) -eq $Value ) - { - Write-Verbose -Message ( $localizedData.TestAuditpolOptionCorrect -f $Name, $value ) - return $true - } - else - { - Write-Verbose -Message ( $localizedData.TestAuditpolOptionIncorrect -f $Name, $value ) - return $false - } -} - -#--------------------------------------------------------------------------------------------------- -# Support functions to handle auditpol I/O - -<# - .SYNOPSIS - Gets the audit policy option state. - .DESCRIPTION - Ths is one of the public functions that calls into Get-AuditOptionCommand. - This function enforces parameters that will be passed through to the - Get-AuditOptionCommand function and aligns to a specifc parameterset. - .PARAMETER Option - The name of an audit option. - .OUTPUTS - A string that is the state of the option (Enabled|Disables). -#> -function Get-AuditOption -{ - [CmdletBinding()] - [OutputType([System.String])] - param - ( - [Parameter(Mandatory=$true)] - [System.String] - $Name - ) - <# - When PowerShell cmdlets are released for individual audit policy settings a condition - will be placed here to use native PowerShell cmdlets to set the option details. - #> - # get the auditpol raw csv output - $returnCsv = Invoke-AuditPol -Command "Get" -SubCommand "Option:$Name" - - # split the details into an array - $optionDetails = ( $returnCsv[2] ) -Split ',' - - # return the option value - return $optionDetails[4] -} - -<# - .SYNOPSIS - Sets an audit policy option to enabled or disabled. - .DESCRIPTION - This public function calls Set-AuditOptionCommand and enforces parameters - that will be passed to Set-AuditOptionCommand and aligns to a specifc parameterset. - .PARAMETER Name - The specific option to set. - .PARAMETER Value - The value to set the provided option to. -#> -function Set-AuditOption -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - [Parameter(Mandatory=$true)] - [System.String] - $Name, - - [Parameter(Mandatory=$true)] - [System.String] - $Value - ) - - <# - When PowerShell cmdlets are released for individual audit policy settings a condition - will be placed here to use native PowerShell cmdlets to set the option details. - #> - if ( $pscmdlet.ShouldProcess( "$Name","Set $Value" ) ) - { - <# - The output text of auditpol is in simple past tense, but the input is in simple - present tense, so the hashtable converts the input accordingly. - #> - $pastToPresentValues = @{ - 'Enabled' = 'enable' - 'Disabled' = 'disable' - } - - [String[]] $subCommand = @( "Option:$Name", "/value:$($pastToPresentValues[$value])" ) - - Invoke-AuditPol -Command 'Set' -SubCommand $subCommand | Out-Null - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicyOption/MSFT_AuditPolicyOption.schema.mof b/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicyOption/MSFT_AuditPolicyOption.schema.mof deleted file mode 100644 index 1bc5308d..00000000 --- a/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicyOption/MSFT_AuditPolicyOption.schema.mof +++ /dev/null @@ -1,7 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("AuditPolicyOption")] -class MSFT_AuditPolicyOption : OMI_BaseResource -{ - [Key, Description("The name of the audit policy option to set."), ValueMap{"CrashOnAuditFail","FullPrivilegeAuditing","AuditBaseObjects","AuditBaseDirectories"}, Values{"CrashOnAuditFail","FullPrivilegeAuditing","AuditBaseObjects","AuditBaseDirectories"}] String Name; - [Key, Description("The value to set the audit policy option to."), ValueMap{"Enabled","Disabled"}, Values{"Enabled","Disabled"}] String Value; -}; diff --git a/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicyOption/en-US/MSFT_AuditPolicyOption.strings.psd1 b/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicyOption/en-US/MSFT_AuditPolicyOption.strings.psd1 deleted file mode 100644 index 9d0ab522..00000000 --- a/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicyOption/en-US/MSFT_AuditPolicyOption.strings.psd1 +++ /dev/null @@ -1,9 +0,0 @@ -ConvertFrom-StringData -StringData @' - GetAuditpolOptionSucceed = (GET) '{0}' - GetAuditpolOptionFailed = (ERROR) getting '{0}' - SetAuditpolOptionSucceed = (SET) '{0}' to '{1}' - SetAuditpolOptionFailed = (ERROR) setting '{0}' to value '{1}' - TestAuditpolOptionCorrect = '{0}' is '{1}' - TestAuditpolOptionIncorrect = '{0}' is NOT '{1}' -'@ - diff --git a/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicySubcategory/MSFT_AuditPolicySubcategory.psm1 b/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicySubcategory/MSFT_AuditPolicySubcategory.psm1 deleted file mode 100644 index f9320374..00000000 --- a/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicySubcategory/MSFT_AuditPolicySubcategory.psm1 +++ /dev/null @@ -1,286 +0,0 @@ - -Import-Module -Name (Join-Path -Path ( Split-Path $PSScriptRoot -Parent ) ` - -ChildPath 'AuditPolicyResourceHelper\AuditPolicyResourceHelper.psm1') ` - -Force - -# Localized messages for Write-Verbose statements in this resource -$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_AuditPolicySubcategory' - -<# - .SYNOPSIS - Returns the current audit flag for the given subcategory. - .PARAMETER Name - Specifies the subcategory to retrieve. - .PARAMETER AuditFlag - Specifies the audit flag to retrieve. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [ValidateSet('Success', 'Failure')] - [System.String] - $AuditFlag - ) - - try - { - $currentAuditFlag = Get-AuditSubCategory -Name $Name - Write-Verbose -Message ( $localizedData.GetAuditpolSubcategorySucceed -f $Name, $AuditFlag ) - } - catch - { - Write-Verbose -Message ( $localizedData.GetAuditPolSubcategoryFailed -f $Name, $AuditFlag ) - } - - <# - The auditType property returned from Get-AuditSubCategory can be 'None','Success', - 'Failure', or 'Success and Failure'. Using the match operator will return the correct - state if both are set. - #> - if ( $currentAuditFlag -match $AuditFlag ) - { - $currentAuditFlag = $AuditFlag - $ensure = 'Present' - } - else - { - $ensure = 'Absent' - } - - return @{ - Name = $Name - AuditFlag = $currentAuditFlag - Ensure = $ensure - } -} - -<# - .SYNOPSIS - Sets the audit flag for the given subcategory. - .PARAMETER Name - Specifies the subcategory to set. - .PARAMETER AuditFlag - Specifies the audit flag to set. - .PARAMETER Ensure - Specifies the state of the audit flag provided. By default this is set to Present. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [ValidateSet('Success', 'Failure')] - [System.String] - $AuditFlag, - - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure = 'Present' - ) - - if ( -Not ( Test-ValidSubcategory -Name $Name ) ) - { - Throw ( $localizedData.InvalidSubcategory -f $Name ) - } - - try - { - Set-AuditSubcategory -Name $Name -AuditFlag $AuditFlag -Ensure $Ensure - Write-Verbose -Message ( $localizedData.SetAuditpolSubcategorySucceed ` - -f $Name, $AuditFlag, $Ensure ) - } - catch - { - Write-Verbose -Message ( $localizedData.SetAuditpolSubcategoryFailed ` - -f $Name, $AuditFlag, $Ensure ) - } -} - -<# - .SYNOPSIS - Tests the audit flag state for the given subcategory. - .PARAMETER Name - Specifies the subcategory to test. - .PARAMETER AuditFlag - Specifies the audit flag to test. - .PARAMETER Ensure - Specifies the state of the audit flag should be in. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [ValidateSet('Success', 'Failure')] - [System.String] - $AuditFlag, - - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure - ) - - [System.Boolean] $isInDesiredState = $false - - if ( -Not ( Test-ValidSubcategory -Name $Name ) ) - { - Throw ( $localizedData.InvalidSubcategory -f $Name ) - } - - try - { - [String] $currentAuditFlag = Get-AuditSubCategory -Name $Name - Write-Verbose -Message ( $localizedData.GetAuditpolSubcategorySucceed -f $Name, $AuditFlag ) - } - catch - { - Write-Verbose -Message ( $localizedData.GetAuditPolSubcategoryFailed -f $Name, $AuditFlag ) - } - - # If the setting should be present look for a match, otherwise look for a notmatch - if ( $Ensure -eq 'Present' ) - { - $isInDesiredState = $currentAuditFlag -match $AuditFlag - } - else - { - $isInDesiredState = $currentAuditFlag -notmatch $AuditFlag - } - - <# - The audit type can be true in either a match or non-match state. If the audit type - matches the ensure property return the setting correct message, else return the - setting incorrect message - #> - if ( $isInDesiredState ) - { - Write-Verbose -Message ( $localizedData.TestAuditpolSubcategoryCorrect ` - -f $Name, $AuditFlag, $Ensure ) - } - else - { - Write-Verbose -Message ( $localizedData.TestAuditpolSubcategoryIncorrect ` - -f $Name, $AuditFlag, $Ensure ) - } - - $isInDesiredState -} - -#--------------------------------------------------------------------------------------------------- -# Support functions to handle auditpol I/O - -<# - .SYNOPSIS - Gets the audit flag state for a specifc subcategory. - .DESCRIPTION - This function enforces parameters that will be passed to Invoke-Auditpol. - .PARAMETER Name - The name of the subcategory to get the audit flags from. - .OUTPUTS - A string with the flags that are set for the specificed subcategory - .EXAMPLE - Get-AuditSubCategory -Name 'Logon' -#> -function Get-AuditSubCategory -{ - [CmdletBinding()] - [OutputType([System.String])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Name - ) - <# - When PowerShell cmdlets are released for individual audit policy settings a condition - will be placed here to use native PowerShell cmdlets to set the option details. - #> - # get the auditpol raw csv output - $returnCsv = Invoke-AuditPol -Command 'Get' -SubCommand "Subcategory:""$Name""" - - # split the details into an array - $subcategoryFlags = ( $returnCsv[2] ) -Split ',' - - # remove the spaces from 'Success and Failure' to prevent any wierd string problems later - return $subcategoryFlags[4] -replace ' ','' -} - -<# - .SYNOPSIS - Sets the audit flag state for a specifc subcategory. - .DESCRIPTION - Calls the private function to execute a set operation on the given subcategory - .PARAMETER Name - The name of the audit subcategory to set - .PARAMETER AuditFlag - The specifc flag to set (Success|Failure) - .PARAMETER Ensure - The action to take on the flag - .EXAMPLE - Set-AuditSubcategory -Name 'Logon' -AuditFlag 'Success' -Ensure 'Present' -#> -function Set-AuditSubcategory -{ - [CmdletBinding( SupportsShouldProcess=$true )] - param - ( - [Parameter( Mandatory = $true )] - [System.String] - $Name, - - [Parameter( Mandatory = $true )] - [ValidateSet( 'Success','Failure' )] - [System.String] - $AuditFlag, - - [Parameter( Mandatory = $true )] - [System.String] - $Ensure - ) - - <# - When PowerShell cmdlets are released for individual audit policy settings a condition - will be placed here to use native PowerShell cmdlets to set the option details. - #> - if ( $pscmdlet.ShouldProcess( "$Name","Set AuditFlag '$AuditFlag'" ) ) - { - # translate $ensure=present to enable and $ensure=absent to disable - $auditState = @{ - 'Present' = 'enable' - 'Absent' = 'disable' - } - - # Create the line needed for auditpol to set the category flag - if ( $AuditFlag -eq 'Success' ) - { - [String[]] $subcommand = @( "Subcategory:""$Name""", "/success:$($auditState[$Ensure])" ) - } - else - { - [String[]] $subcommand = @( "Subcategory:""$Name""", "/failure:$($auditState[$Ensure])" ) - } - - Invoke-AuditPol -Command 'Set' -subCommand $subcommand | Out-Null - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicySubcategory/MSFT_AuditPolicySubcategory.schema.mof b/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicySubcategory/MSFT_AuditPolicySubcategory.schema.mof deleted file mode 100644 index 1fd8023c..00000000 --- a/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicySubcategory/MSFT_AuditPolicySubcategory.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("AuditPolicySubcategory")] -class MSFT_AuditPolicySubcategory : OMI_BaseResource -{ - [Key, Description("The name of the Subcategory to be configured.")] String Name; - [Key, Description("The audit flag to be configured."), ValueMap{"Success","Failure"}, Values{"Success","Failure"}] String AuditFlag; - [Write, Description("Specifies whether the flag should be enabled or disabled. To enable the flag, set this property to Present. To disable the flag, set this property to Absent."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; -}; - diff --git a/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicySubcategory/en-US/MSFT_AuditPolicySubcategory.strings.psd1 b/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicySubcategory/en-US/MSFT_AuditPolicySubcategory.strings.psd1 deleted file mode 100644 index fa02dc21..00000000 --- a/lib/puppet_x/dsc_resources/AuditPolicyDsc/DSCResources/MSFT_AuditPolicySubcategory/en-US/MSFT_AuditPolicySubcategory.strings.psd1 +++ /dev/null @@ -1,10 +0,0 @@ -ConvertFrom-StringData -StringData @' - InvalidSubcategory = {0} is not a valid Subcategory - GetAuditpolSubcategorySucceed = (GET) '{0}':'{1}' - GetAuditPolSubcategoryFailed = (ERROR) getting '{0}':'{1}' - SetAuditpolSubcategorySucceed = (SET) '{0}' audit '{1}' to '{2}' - SetAuditpolSubcategoryFailed = (ERROR) setting '{0}' audit '{1}' to '{2}' - TestAuditpolSubcategoryCorrect = '{0}':'{1}' is '{2}' - TestAuditpolSubcategoryIncorrect = '{0}':'{1}' is NOT '{2}' -'@ - diff --git a/lib/puppet_x/dsc_resources/AuditPolicyDsc/LICENSE b/lib/puppet_x/dsc_resources/AuditPolicyDsc/LICENSE deleted file mode 100644 index fbcfe007..00000000 --- a/lib/puppet_x/dsc_resources/AuditPolicyDsc/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/lib/puppet_x/dsc_resources/OfficeOnlineServerDsc/DSCResources/MSFT_OfficeOnlineServerFarm/MSFT_OfficeOnlineServerFarm.psm1 b/lib/puppet_x/dsc_resources/OfficeOnlineServerDsc/DSCResources/MSFT_OfficeOnlineServerFarm/MSFT_OfficeOnlineServerFarm.psm1 deleted file mode 100644 index 1f5638df..00000000 --- a/lib/puppet_x/dsc_resources/OfficeOnlineServerDsc/DSCResources/MSFT_OfficeOnlineServerFarm/MSFT_OfficeOnlineServerFarm.psm1 +++ /dev/null @@ -1,702 +0,0 @@ -$script:v16onlyParams = @("AllowOutboundHttp", "S2SCertificateName", "OnlinePictureEnabled", ` - "OnlineVideoEnabled", "OfficeAddinEnabled", ` - "ExcelUseEffectiveUserName", "ExcelUdfsAllowed", ` - "ExcelMemoryCacheThreshold", "ExcelUnusedObjectAgeMax", ` - "ExcelCachingUnusedFiles", "ExcelAbortOnRefreshOnOpenFail", ` - "ExcelAutomaticVolatileFunctionCacheLifeTime", ` - "ExcelConcurrentDataRequestsPerSessionMax", ` - "ExcelDefaultWorkbookCalcMode", "ExcelRestExternalDataEnabled", ` - "ExcelChartAndImageSizeMax") - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [System.Boolean] - $AllowCEIP, - - [System.Boolean] - $AllowHttp, - - [System.Boolean] - $AllowHttpSecureStoreConnections, - - [System.String] - $CacheLocation, - - [System.Int32] - $CacheSizeInGB, - - [System.String] - $CertificateName, - - [System.Boolean] - $ClipartEnabled, - - [System.Int32] - $DocumentInfoCacheSize, - - [System.Boolean] - $EditingEnabled, - - [System.Boolean] - $ExcelAllowExternalData, - - [System.Int32] - $ExcelConnectionLifetime, - - [System.Int32] - $ExcelExternalDataCacheLifetime, - - [System.Int32] - $ExcelPrivateBytesMax, - - [System.Int32] - $ExcelRequestDurationMax, - - [System.Int32] - $ExcelSessionTimeout, - - [System.Boolean] - $ExcelUdfsAllowed, - - [System.Boolean] - $ExcelWarnOnDataRefresh, - - [System.Int32] - $ExcelWorkbookSizeMax, - - [System.Int32] - $ExcelMemoryCacheThreshold, - - [System.Int32] - $ExcelUnusedObjectAgeMax, - - [System.Boolean] - $ExcelCachingUnusedFiles, - - [System.Boolean] - $ExcelAbortOnRefreshOnOpenFail, - - [System.Int32] - $ExcelAutomaticVolatileFunctionCacheLifetime, - - [System.Int32] - $ExcelConcurrentDataRequestsPerSessionMax, - - [System.String] - $ExcelDefaultWorkbookCalcMode, - - [System.Boolean] - $ExcelRestExternalDataEnabled, - - [System.Int32] - $ExcelChartAndImageSizeMax, - - [System.String] - $ExternalURL, - - [System.String] - $FarmOU, - - [parameter(Mandatory = $true)] - [System.String] - $InternalURL, - - [System.String] - $LogLocation, - - [System.Int32] - $LogRetentionInDays, - - [System.String] - $LogVerbosity, - - [System.Int32] - $MaxMemoryCacheSizeInMB, - - [System.Int32] - $MaxTranslationCharacterCount, - - [System.Boolean] - $OpenFromUncEnabled, - - [System.Boolean] - $OpenFromUrlEnabled, - - [System.Boolean] - $OpenFromUrlThrottlingEnabled, - - [System.String] - $Proxy, - - [System.Int32] - $RecycleActiveProcessCount, - - [System.String] - $RenderingLocalCacheLocation, - - [System.Boolean] - $SSLOffloaded, - - [System.Boolean] - $TranslationEnabled, - - [System.String] - $TranslationServiceAddress, - - [System.String] - $TranslationServiceAppId, - - [System.Boolean] - $AllowOutboundHttp, - - [System.Boolean] - $ExcelUseEffectiveUserName, - - [System.String] - $S2SCertificateName, - - [System.Boolean] - $RemovePersonalInformationFromLogs, - - [System.Boolean] - $PicturePasteDisabled - ) - - Test-OosDscV16Support -Parameters $PSBoundParameters - - try - { - $officeWebAppsFarm = Get-OfficeWebAppsFarm -ErrorAction Stop - } - catch - { - Write-Verbose -Message $_ - } - - $returnValue = @{ - AllowCEIP = $officeWebAppsFarm.AllowCEIP - AllowHttp = $officeWebAppsFarm.AllowHTTP - AllowHttpSecureStoreConnections = $officeWebAppsFarm.AllowHttpSecureStoreConnections - CacheLocation = $officeWebAppsFarm.CacheLocation - CacheSizeInGB = $officeWebAppsFarm.CacheSizeInGB - CertificateName = $officeWebAppsFarm.CertificateName - ClipartEnabled = $officeWebAppsFarm.ClipartEnabled - DocumentInfoCacheSize = $officeWebAppsFarm.DocumentInfoCacheSize - EditingEnabled = $officeWebAppsFarm.EditingEnabled - ExcelAllowExternalData = $officeWebAppsFarm.ExcelAllowExternalData - ExcelConnectionLifetime = $officeWebAppsFarm.ExcelConnectionLifetime - ExcelExternalDataCacheLifetime = $officeWebAppsFarm.ExcelExternalDataCacheLifetime - ExcelPrivateBytesMax = $officeWebAppsFarm.ExcelPrivateBytesMax - ExcelRequestDurationMax = $officeWebAppsFarm.ExcelRequestDurationMax - ExcelSessionTimeout = $officeWebAppsFarm.ExcelSessionTimeout - ExcelUdfsAllowed = $officeWebAppsFarm.ExcelUdfsAllowed - ExcelWarnOnDataRefresh = $officeWebAppsFarm.ExcelWarnOnDataRefresh - ExcelWorkbookSizeMax = $officeWebAppsFarm.ExcelWorkbookSizeMax - ExcelMemoryCacheThreshold = $officeWebAppsFarm.ExcelMemoryCacheThreshold - ExcelUnusedObjectAgeMax = $officeWebAppsFarm.ExcelUnusedObjectAgeMax - ExcelCachingUnusedFiles = $officeWebAppsFarm.ExcelCachingUnusedFiles - ExcelAbortOnRefreshOnOpenFail = $officeWebAppsFarm.ExcelAbortOnRefreshOnOpenFail - ExcelAutomaticVolatileFunctionCacheLifetime = $officeWebAppsFarm.ExcelAutomaticVolatileFunctionCacheLifeTime - ExcelConcurrentDataRequestsPerSessionMax = $officeWebAppsFarm.ExcelConcurrentDataRequestsPerSessionMax - ExcelDefaultWorkbookCalcMode = $officeWebAppsFarm.ExcelDefaultWorkbookCalcMode - ExcelRestExternalDataEnabled = $officeWebAppsFarm.ExcelRestExternalDataEnabled - ExcelChartAndImageSizeMax = $officeWebAppsFarm.ExcelChartAndImageSizeMax - ExternalURL = $officeWebAppsFarm.ExternalURL - FarmOU = $officeWebAppsFarm.FarmOU - InternalURL = $officeWebAppsFarm.InternalURL - LogLocation = $officeWebAppsFarm.LogLocation - LogRetentionInDays = $officeWebAppsFarm.LogRetentionInDays - LogVerbosity = $officeWebAppsFarm.LogVerbosity - MaxMemoryCacheSizeInMB = $officeWebAppsFarm.MaxMemoryCacheSizeInMB - MaxTranslationCharacterCount = $officeWebAppsFarm.MaxTranslationCharacterCount - OpenFromUncEnabled = $officeWebAppsFarm.OpenFromUncEnabled - OpenFromUrlEnabled = $officeWebAppsFarm.OpenFromUrlEnabled - OpenFromUrlThrottlingEnabled = $officeWebAppsFarm.OpenFromUrlThrottlingEnabled - PicturePasteDisabled = $officeWebAppsFarm.PicturePasteDisabled - Proxy = $officeWebAppsFarm.Proxy - RecycleActiveProcessCount = $officeWebAppsFarm.RecycleActiveProcessCount - RenderingLocalCacheLocation = $officeWebAppsFarm.RenderingLocalCacheLocation - SSLOffloaded = $officeWebAppsFarm.SSLOffloaded - TranslationEnabled = $officeWebAppsFarm.TranslationEnabled - TranslationServiceAddress = $officeWebAppsFarm.TranslationServiceAddress - TranslationServiceAppId = $officeWebAppsFarm.TranslationServiceAppId - RemovePersonalInformationFromLogs = $officeWebAppsFarm.RemovePersonalInformationFromLogs - ExcelUseEffectiveUserName = $officeWebAppsFarm.ExcelUseEffectiveUserName - AllowOutboundHttp = $officeWebAppsFarm.AllowOutboundHttp - S2SCertificateName = $officeWebAppsFarm.S2SCertificateName - } - - return $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [System.Boolean] - $AllowCEIP, - - [System.Boolean] - $AllowHttp, - - [System.Boolean] - $AllowHttpSecureStoreConnections, - - [System.String] - $CacheLocation, - - [System.Int32] - $CacheSizeInGB, - - [System.String] - $CertificateName, - - [System.Boolean] - $ClipartEnabled, - - [System.Int32] - $DocumentInfoCacheSize, - - [System.Boolean] - $EditingEnabled, - - [System.Boolean] - $ExcelAllowExternalData, - - [System.Int32] - $ExcelConnectionLifetime, - - [System.Int32] - $ExcelExternalDataCacheLifetime, - - [System.Int32] - $ExcelPrivateBytesMax, - - [System.Int32] - $ExcelRequestDurationMax, - - [System.Int32] - $ExcelSessionTimeout, - - [System.Boolean] - $ExcelUdfsAllowed, - - [System.Boolean] - $ExcelWarnOnDataRefresh, - - [System.Int32] - $ExcelWorkbookSizeMax, - - [System.Int32] - $ExcelMemoryCacheThreshold, - - [System.Int32] - $ExcelUnusedObjectAgeMax, - - [System.Boolean] - $ExcelCachingUnusedFiles, - - [System.Boolean] - $ExcelAbortOnRefreshOnOpenFail, - - [System.Int32] - $ExcelAutomaticVolatileFunctionCacheLifetime, - - [System.Int32] - $ExcelConcurrentDataRequestsPerSessionMax, - - [System.String] - $ExcelDefaultWorkbookCalcMode, - - [System.Boolean] - $ExcelRestExternalDataEnabled, - - [System.Int32] - $ExcelChartAndImageSizeMax, - - [System.String] - $ExternalURL, - - [System.String] - $FarmOU, - - [parameter(Mandatory = $true)] - [System.String] - $InternalURL, - - [System.String] - $LogLocation, - - [System.Int32] - $LogRetentionInDays, - - [System.String] - $LogVerbosity, - - [System.Int32] - $MaxMemoryCacheSizeInMB, - - [System.Int32] - $MaxTranslationCharacterCount, - - [System.Boolean] - $OpenFromUncEnabled, - - [System.Boolean] - $OpenFromUrlEnabled, - - [System.Boolean] - $OpenFromUrlThrottlingEnabled, - - [System.String] - $Proxy, - - [System.Int32] - $RecycleActiveProcessCount, - - [System.String] - $RenderingLocalCacheLocation, - - [System.Boolean] - $SSLOffloaded, - - [System.Boolean] - $TranslationEnabled, - - [System.String] - $TranslationServiceAddress, - - [System.String] - $TranslationServiceAppId, - - [System.Boolean] - $AllowOutboundHttp, - - [System.Boolean] - $ExcelUseEffectiveUserName, - - [System.String] - $S2SCertificateName, - - [System.Boolean] - $RemovePersonalInformationFromLogs, - - [System.Boolean] - $PicturePasteDisabled - ) - - Test-OosDscV16Support -Parameters $PSBoundParameters - - try - { - $officeWebAppsFarm = Get-OfficeWebAppsFarm -ErrorAction Stop - } - catch - { - Write-Verbose -Message $_ - } - - if(-not $officeWebAppsFarm) - { - Write-Verbose "Installing new WebAppsFarm" - New-OfficeWebAppsFarm @PSBoundParameters -Force - } - else - { - Write-Verbose "WebAppsFarm found setting parameters on farm" - Set-OfficeWebAppsFarm @PSBoundParameters -Force - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [System.Boolean] - $AllowCEIP, - - [System.Boolean] - $AllowHttp, - - [System.Boolean] - $AllowHttpSecureStoreConnections, - - [System.String] - $CacheLocation, - - [System.Int32] - $CacheSizeInGB, - - [System.String] - $CertificateName, - - [System.Boolean] - $ClipartEnabled, - - [System.Int32] - $DocumentInfoCacheSize, - - [System.Boolean] - $EditingEnabled, - - [System.Boolean] - $ExcelAllowExternalData, - - [System.Int32] - $ExcelConnectionLifetime, - - [System.Int32] - $ExcelExternalDataCacheLifetime, - - [System.Int32] - $ExcelPrivateBytesMax, - - [System.Int32] - $ExcelRequestDurationMax, - - [System.Int32] - $ExcelSessionTimeout, - - [System.Boolean] - $ExcelUdfsAllowed, - - [System.Boolean] - $ExcelWarnOnDataRefresh, - - [System.Int32] - $ExcelWorkbookSizeMax, - - [System.Int32] - $ExcelMemoryCacheThreshold, - - [System.Int32] - $ExcelUnusedObjectAgeMax, - - [System.Boolean] - $ExcelCachingUnusedFiles, - - [System.Boolean] - $ExcelAbortOnRefreshOnOpenFail, - - [System.Int32] - $ExcelAutomaticVolatileFunctionCacheLifetime, - - [System.Int32] - $ExcelConcurrentDataRequestsPerSessionMax, - - [System.String] - $ExcelDefaultWorkbookCalcMode, - - [System.Boolean] - $ExcelRestExternalDataEnabled, - - [System.Int32] - $ExcelChartAndImageSizeMax, - - [System.String] - $ExternalURL, - - [System.String] - $FarmOU, - - [parameter(Mandatory = $true)] - [System.String] - $InternalURL, - - [System.String] - $LogLocation, - - [System.Int32] - $LogRetentionInDays, - - [System.String] - $LogVerbosity, - - [System.Int32] - $MaxMemoryCacheSizeInMB, - - [System.Int32] - $MaxTranslationCharacterCount, - - [System.Boolean] - $OpenFromUncEnabled, - - [System.Boolean] - $OpenFromUrlEnabled, - - [System.Boolean] - $OpenFromUrlThrottlingEnabled, - - [System.String] - $Proxy, - - [System.Int32] - $RecycleActiveProcessCount, - - [System.String] - $RenderingLocalCacheLocation, - - [System.Boolean] - $SSLOffloaded, - - [System.Boolean] - $TranslationEnabled, - - [System.String] - $TranslationServiceAddress, - - [System.String] - $TranslationServiceAppId, - - [System.Boolean] - $AllowOutboundHttp, - - [System.Boolean] - $ExcelUseEffectiveUserName, - - [System.String] - $S2SCertificateName, - - [System.Boolean] - $RemovePersonalInformationFromLogs, - - [System.Boolean] - $PicturePasteDisabled - ) - - Test-OosDscV16Support -Parameters $PSBoundParameters - - try - { - $officeWebAppsFarm = Get-OfficeWebAppsFarm -ErrorAction Stop - } - catch - { - Write-Verbose -Message $_ - return $false - } - - if($PSBoundParameters.ContainsKey('FarmOU')) - { - if ((Test-OosDscFarmOu -ExistingOU $officeWebAppsFarm.FarmOU -DesiredOU $FarmOU) -ne $true) - { - Write-Verbose -Message ("FarmOU not in a desired state. " + ` - "Expected: '$($PSBoundParameters['FarmOU'])'. " + ` - "Actual: '$($officeWebAppsFarm.FarmOU)'.") - return $false - } - } - - $currentValues = Get-TargetResource @PSBoundParameters - - if ($InternalURL.EndsWith('/') -eq $false) - { - $InternalURL += "/" - } - if ($ExternalURL.EndsWith('/') -eq $false) - { - $ExternalURL += "/" - } - if ($Proxy.EndsWith('/') -eq $false) - { - $Proxy += "/" - } - return Test-OosDscParameterState -CurrentValues $currentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @( - "InternalURL", - "ExternalURL", - "Proxy", - "AllowHTTP", - "AllowOutboundHttp", - "SSLOffloaded", - "CertificateName", - "S2SCertificateName", - "EditingEnabled", - "LogLocation", - "LogRetentionInDays", - "LogVerbosity", - "CacheLocation", - "MaxMemoryCacheSizeInMB", - "DocumentInfoCacheSize", - "CacheSizeInGB", - "ClipartEnabled", - "TranslationEnabled", - "MaxTranslationCharacterCount", - "TranslationServiceAppId", - "TranslationServiceAddress", - "RenderingLocalCacheLocation", - "RecycleActiveProcessCount", - "AllowCEIP", - "ExcelRequestDurationMax", - "ExcelSessionTimeout", - "ExcelWorkbookSizeMax", - "ExcelPrivateBytesMax", - "ExcelConnectionLifetime", - "ExcelExternalDataCacheLifetime", - "ExcelAllowExternalData", - "ExcelUseEffectiveUserName", - "ExcelWarnOnDataRefresh", - "ExcelUdfsAllowed", - "ExcelMemoryCacheThreshold", - "ExcelUnusedObjectAgeMax", - "ExcelCachingUnusedFiles", - "ExcelAbortOnRefreshOnOpenFail", - "ExcelAutomaticVolatileFunctionCacheLifeTime", - "ExcelConcurrentDataRequestsPerSessionMax", - "ExcelDefaultWorkbookCalcMode", - "ExcelRestExternalDataEnabled", - "ExcelChartAndImageSizeMax", - "OpenFromUrlEnabled", - "OpenFromUncEnabled", - "OpenFromUrlThrottlingEnabled", - "PicturePasteDisabled", - "RemovePersonalInformationFromLogs", - "AllowHttpSecureStoreConnections" - ) -} - -function Test-OosDscV16Support -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param( - [Parameter(Mandatory=$true)] - [Object] - $Parameters - ) - - $version = Get-OosDscInstalledProductVersion - switch ($version.Major) { - 15 { - Write-Verbose -Message "Office Web Apps 2013 install detected. Checking parameter use." - foreach($param in $script:v16onlyParams) - { - if ($Parameters.ContainsKey($param) -eq $true) - { - throw "The parameter '$param' is not supported on Office Web Apps Server 2013" - } - } - } - 16 { - Write-Verbose -Message ("Office Online Server 2016 install detected. All " + ` - "parameters are enabled") - } - Default { - throw ("This module only supports Office Web Apps 2013 (v15) and Office " + ` - "Online Server 2016 (v16). Detected version was $($version.Major)") - } - } -} - -Export-ModuleMember -Function *-TargetResource - diff --git a/lib/puppet_x/dsc_resources/OfficeOnlineServerDsc/DSCResources/MSFT_OfficeOnlineServerFarm/MSFT_OfficeOnlineServerFarm.schema.mof b/lib/puppet_x/dsc_resources/OfficeOnlineServerDsc/DSCResources/MSFT_OfficeOnlineServerFarm/MSFT_OfficeOnlineServerFarm.schema.mof deleted file mode 100644 index ed1e5f3d..00000000 --- a/lib/puppet_x/dsc_resources/OfficeOnlineServerDsc/DSCResources/MSFT_OfficeOnlineServerFarm/MSFT_OfficeOnlineServerFarm.schema.mof +++ /dev/null @@ -1,56 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("OfficeOnlineServerFarm")] -class MSFT_OfficeOnlineServerFarm : OMI_BaseResource -{ - [Write, Description("Enables Customer Experience Improvement Program (CEIP) reporting on all servers in the Office Web Apps Server farm")] Boolean AllowCEIP; - [Write, Description("Indicates that IIS sites should be provisioned on port 80 for HTTP access. Use AllowHTTP only in environments where all computers require IPSEC (full encryption) or in test environments that do not contain sensitive files.")] Boolean AllowHttp; - [Write, Description("Indicates that secure store connections can be made by using non-SSL connections (such as HTTP). The default is False.")] Boolean AllowHttpSecureStoreConnections; - [Write, Description("Specifies the location of the global disk cache that is used to store rendered image files.")] String CacheLocation; - [Write, Description("Specifies the maximum size of the global disk cache in gigabytes.")] Sint32 CacheSizeInGB; - [Write, Description("Specifies the friendly name of the certificate that Office Web Apps Server uses to create HTTPS bindings.")] String CertificateName; - [Write, Description("Enables support for inserting clip art from Office.com into Office documents. This feature requires server-to-web communication, configured either directly or by using a proxy that you specify by using the Proxy parameter.")] Boolean ClipartEnabled; - [Write, Description("Specifies the maximum number of document conversion records that are stored in a memory cache.")] Sint32 DocumentInfoCacheSize; - [Write, Description("Enables support for editing in the browser. The default is False. Only set to True if you have the appropriate licensing to use the editing functionality.")] Boolean EditingEnabled; - [Write, Description("Enables the refresh of supported external data in Excel Web App workbooks where workbooks contain connections to external data. The default is True.")] Boolean ExcelAllowExternalData; - [Write, Description("Specifies the duration, in seconds, of external data connections for Excel Web App. The default is 1800 seconds.")] Sint32 ExcelConnectionLifetime; - [Write, Description("Specifes the duration, in seconds, of the external data cache lifetime in Excel Web App. The default is 300 seconds.")] Sint32 ExcelExternalDataCacheLifetime; - [Write, Description("Specifies the maximum private bytes, in megabytes, used by Excel Web App. When set to -1, the maximum private bytes use 50 percent of physical memory on the computer.")] Sint32 ExcelPrivateBytesMax; - [Write, Description("Specifies the maximum duration, in seconds, for a single request in a session. After this time elapses, the request times out.")] Sint32 ExcelRequestDurationMax; - [Write, Description("Specifies the time, in seconds, that a session remains active in Excel Web App when there is no user activity.")] Sint32 ExcelSessionTimeout; - [Write, Description("Activates user-defined functions for use with Web Excel.")] Boolean ExcelUdfsAllowed; - [Write, Description("Turns off or on the warning dialog displayed when data refreshes in Excel Web App.")] Boolean ExcelWarnOnDataRefresh; - [Write, Description("Specifies the maximum size, in megabytes, of a workbook that can be loaded.")] Sint32 ExcelWorkbookSizeMax; - [Write, Description("The percentage of the Maximum Private Bytes that can be allocated to inactive objects. When the memory cache threshold is exceeded, cached objects that are not currently in use are released.")] Sint32 ExcelMemoryCacheThreshold; - [Write, Description("The maximum time (in minutes) that inactive objects remain in the memory cache. Inactive objects are objects that are not used in a session.")] Sint32 ExcelUnusedObjectAgeMax; - [Write, Description("Enable caching of files that are no longer in use by Web Excel sessions.")] Boolean ExcelCachingUnusedFiles; - [Write, Description("Specifies that the loading of a Web Excel file automatically fails if an automatic data refresh operation fails when the file is opened.")] Boolean ExcelAbortOnRefreshOnOpenFail; - [Write, Description("Specifies the maximum time, in seconds, that a computed value for a volatile function is cached for automatic recalculations.")] Sint32 ExcelAutomaticVolatileFunctionCacheLifetime; - [Write, Description("Specifies the maximum number of concurrent external data requests allowed in each session. If a session must issue more than this number of requests, additional requests must be queued. The scope of this setting is the logical server.")] Sint32 ExcelConcurrentDataRequestsPerSessionMax; - [Write, Description("Specifies the calculation mode of workbooks. Settings other than File override the workbook settings.")] String ExcelDefaultWorkbookCalcMode; - [Write, Description("Specifies whether requests from the Representational State Transfer (REST) Application Programming Interface (API) are permitted to refresh external data connections.")] Boolean ExcelRestExternalDataEnabled; - [Write, Description("Specifies the maximum size, in megabytes, of a chart or image that can be opened.")] Sint32 ExcelChartAndImageSizeMax; - [Write, Description("Specifies the URL root that clients use to access the Office Web Apps Server farm from the Internet. In the case of a load-balanced, multiserver Office Web Apps Server farm, the external URL is bound to the IP address of the external-facing load balancer.")] String ExternalURL; - [Write, Description("Specifies the name of the Active Directory organizational unit (OU) that servers must be a member of to join the Office Web Apps Server farm. Use this parameter to prevent unauthorized servers (that is, servers that are not in the OU) from joining an Office Web Apps Server farm.")] String FarmOU; - [Key, Description("Specifies the URL root that clients use to access the Office Web Apps Server farm from the intranet.")] String InternalURL; - [Write, Description("Specifies the location on the local computer where activity logs are stored.")] String LogLocation; - [Write, Description("Specifies the number of days that log entries are stored. Log entries older than the configured date are trimmed.")] Sint32 LogRetentionInDays; - [Write, Description("Specifies how much information is stored in the trace log files.")] String LogVerbosity; - [Write, Description("Specifies, in megabytes, the maximum amount of memory that the rendering cache can use.")] Sint32 MaxMemoryCacheSizeInMB; - [Write, Description("Specifies the maximum amount of characters a document can have in order to be translated.")] Sint32 MaxTranslationCharacterCount; - [Write, Description("Turns on or off the ability to use Online Viewers to view Office files from a UNC path.")] Boolean OpenFromUncEnabled; - [Write, Description("Turns on or off the ability to use Online Viewers to view Office files from a URL or UNC path.")] Boolean OpenFromUrlEnabled; - [Write, Description("Throttles the number of open from URL requests from any given server in a time period. The default throttling values, which are not configurable, make sure that an Office Web Apps Server farm will not overwhelm a single server with requests for content to be viewed in the Online Viewers.")] Boolean OpenFromUrlThrottlingEnabled; - [Write, Description("Specifies the URL of the proxy server that is configured to allow HTTP requests to external sites. Typically configured in conjunction with the ClipartEnabled and TranslationEnabled parameters.")] String Proxy; - [Write, Description("Specifies the number of files that a single Word or PowerPoint process can render before the process is recycled.")] Sint32 RecycleActiveProcessCount; - [Write, Description("Specifies the location of the temporary cache for use by the Word and PowerPoint Viewing Services.")] String RenderingLocalCacheLocation; - [Write, Description("Indicates to the servers in the Office Web Apps Server farm that SSL is offloaded to the load balancer. When SSLOffloaded is enabled, web applications are bound to port 80 (HTTP) on the local server. However, HTML that references other resources, such as CSS or images, uses HTTPS URLs for those references.")] Boolean SSLOffloaded; - [Write, Description("Enables support for automatic document translation using Microsoft Translator, an online service that translates text between languages. The translated file is shown in the Word Web App. Because Microsoft Translator is an online service, you must enable server-to-web communication directly or by using a proxy that you specify by using the Proxy parameter.")] Boolean TranslationEnabled; - [Write, Description("Specifies the URL of the translation server that translation requests are sent to. The default is the Microsoft Translator online service. Typically you will not use this parameter unless you must change translation services.")] String TranslationServiceAddress; - [Write, Description("Specifies the application ID for the translation service. The default is the public application ID for Office Web Apps. Typically you will not use this parameter unless you have negotiated with Microsoft Translator for additional services and they have provided you with a private application ID.")] String TranslationServiceAppId; - [Write] Boolean AllowOutboundHttp; - [Write] Boolean ExcelUseEffectiveUserName; - [Write] String S2SCertificateName; - [Write] Boolean RemovePersonalInformationFromLogs; - [Write] Boolean PicturePasteDisabled; -}; - diff --git a/lib/puppet_x/dsc_resources/OfficeOnlineServerDsc/DSCResources/MSFT_OfficeOnlineServerInstall/MSFT_OfficeOnlineServerInstall.psm1 b/lib/puppet_x/dsc_resources/OfficeOnlineServerDsc/DSCResources/MSFT_OfficeOnlineServerInstall/MSFT_OfficeOnlineServerInstall.psm1 deleted file mode 100644 index 3319ff7a..00000000 --- a/lib/puppet_x/dsc_resources/OfficeOnlineServerDsc/DSCResources/MSFT_OfficeOnlineServerInstall/MSFT_OfficeOnlineServerInstall.psm1 +++ /dev/null @@ -1,113 +0,0 @@ -$Script:UninstallPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" -$script:InstallKeyPattern = "Office1(5)|(6).WacServer" - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - [ValidateSet("Present", "Absent")] - $Ensure, - - [parameter(Mandatory = $true)] - [System.String] - $Path - ) - - if ($Ensure -eq "Absent") - { - throw "Uninstallation is not supported by OfficeOnlineServer Dsc" - } - - Write-Verbose -Message "Getting details of installation of Office Online Server" - - $matchPath = "HKEY_LOCAL_MACHINE\\$($Script:UninstallPath.Replace('\','\\'))" + ` - "\\$script:InstallKeyPattern" - $wacPath = Get-ChildItem -Path "HKLM:\$Script:UninstallPath" | Where-Object -FilterScript { - $_.Name -match $matchPath - } - - $localEnsure = "Absent" - if($null -ne $wacPath) - { - $localEnsure = "Present" - } - - return @{ - Ensure = $localEnsure - Path = $Path - } -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - [ValidateSet("Present", "Absent")] - $Ensure, - - [parameter(Mandatory = $true)] - [System.String] - $Path - ) - - if ($Ensure -eq "Absent") - { - throw "Uninstallation is not supported by OfficeOnlineServer Dsc" - } - - Write-Verbose -Message "Starting installation of Office Online Server" - - $installer = Start-Process -FilePath $Path ` - -ArgumentList '/config .\files\setupsilent\config.xml' ` - -Wait ` - -PassThru - - switch ($installer.ExitCode) { - 0 { - Write-Verbose -Message "Installation of Office Online Server succeeded." - } - Default { - throw ("Office Online Server installation failed. Exit code " + ` - "'$($installer.ExitCode)' was returned. Check " + ` - "$($env:TEMP)\Wac Server Setup.log for further information") - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - [ValidateSet("Present", "Absent")] - $Ensure, - - [parameter(Mandatory = $true)] - [System.String] - $Path - ) - - if ($Ensure -eq "Absent") - { - throw "Uninstallation is not supported by OfficeOnlineServer Dsc" - } - - Write-Verbose -Message "Testing for installation of Office Online Server" - $result = Get-TargetResource @PSBoundParameters - - return ($result.Ensure -eq $Ensure) -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/OfficeOnlineServerDsc/DSCResources/MSFT_OfficeOnlineServerInstall/MSFT_OfficeOnlineServerInstall.schema.mof b/lib/puppet_x/dsc_resources/OfficeOnlineServerDsc/DSCResources/MSFT_OfficeOnlineServerInstall/MSFT_OfficeOnlineServerInstall.schema.mof deleted file mode 100644 index 26377623..00000000 --- a/lib/puppet_x/dsc_resources/OfficeOnlineServerDsc/DSCResources/MSFT_OfficeOnlineServerInstall/MSFT_OfficeOnlineServerInstall.schema.mof +++ /dev/null @@ -1,7 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("OfficeOnlineServerInstall")] -class MSFT_OfficeOnlineServerInstall : OMI_BaseResource -{ - [Key, Description("Set to 'present' to specificy that the product should be installed."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Required, Description("Path to setup.exe")] String Path; -}; diff --git a/lib/puppet_x/dsc_resources/OfficeOnlineServerDsc/DSCResources/MSFT_OfficeOnlineServerMachine/MSFT_OfficeOnlineServerMachine.psm1 b/lib/puppet_x/dsc_resources/OfficeOnlineServerDsc/DSCResources/MSFT_OfficeOnlineServerMachine/MSFT_OfficeOnlineServerMachine.psm1 deleted file mode 100644 index 91543055..00000000 --- a/lib/puppet_x/dsc_resources/OfficeOnlineServerDsc/DSCResources/MSFT_OfficeOnlineServerMachine/MSFT_OfficeOnlineServerMachine.psm1 +++ /dev/null @@ -1,193 +0,0 @@ -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData -StringData @' -NotApartOfAFarm = It does not appear that this machine is part of an Office Online Server/Office Web Apps farm. -ChangingAppMachineConfig = Changing App Maching Configuration. -SetAppMachine = The Office Web App Machine has been Set. -RemoveAppMachine = The Office Web App Machine has been removed. -FailedRemove = Failed to remove the Web App Machine. -'@ -} - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [System.String[]] - $Roles, - - [parameter(Mandatory = $true)] - [System.String] - $MachineToJoin - ) - - - Import-Module -Name OfficeWebApps -ErrorAction Stop - - $officeWebAppsMachine = $null - - try - { - $officeWebAppsMachine = Get-OfficeWebAppsMachine - } - catch - { - # catch when not a part of the farm and redirect output to returned hash table - $notInFarmError = "It does not appear that this machine is part of an " + ` - "(Office Online)|(Office Web Apps) Server farm\." - if($_.toString() -match $notInFarmError) - { - Write-Verbose -Message $LocalizedData.NotApartOfAFarm - } - else - { - throw - } - } - - if ($null -eq $officeWebAppsMachine) - { - $returnValue = @{ - Ensure = "Absent" - Roles = $null - MachineToJoin = $null - } - } - else - { - $returnValue = @{ - Ensure = "Present" - Roles = [System.String[]]$officeWebAppsMachine.Roles - MachineToJoin = [System.String]$officeWebAppsMachine.MasterMachineName - } - } - - return $returnValue -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [System.String[]] - $Roles, - - [parameter(Mandatory = $true)] - [System.String] - $MachineToJoin - ) - - Write-Verbose -Message "Updating settings for local Office Online Server" - Import-Module -Name OfficeWebApps -ErrorAction Stop - - if ($Ensure -eq "Absent") - { - Remove-OfficeWebAppsMachine - - Write-Verbose -Message $LocalizedData.RemoveAppMachine - } - else - { - # Due to issues with Set-OfficeWebAppsMachine not changing machine roles, - # always remove the machine and re-add. - - try - { - Remove-OfficeWebAppsMachine -ErrorAction Stop - } - catch - { - Write-Verbose -Message $LocalizedData.FailedRemove - } - - if ($null -eq $Roles) - { - $Roles = @("All") - } - - New-OfficeWebAppsMachine -MachineToJoin $MachineToJoin -Roles $Roles - - Write-Verbose -Message $LocalizedData.SetAppMachine - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [System.String[]] - $Roles, - - [parameter(Mandatory = $true)] - [System.String] - $MachineToJoin - ) - - Write-Verbose -Message "Testing settings for local Office Online Server" - $results = Get-TargetResource -MachineToJoin $MachineToJoin - - if ($null -eq $Roles) - { - $Roles = @("All") - } - - if ($null -eq $results.Roles) - { - $roleCompare = $null - } - else - { - $roleCompare = Compare-Object -ReferenceObject $results.Roles -DifferenceObject $Roles - } - - if ($MachineToJoin.Contains(".") -eq $true) - { - $fqdn = $MachineToJoin - $computer = $MachineToJoin.Substring(0, $MachineToJoin.IndexOf(".")) - } - else - { - $domain = (Get-CimInstance -ClassName Win32_ComputerSystem).Domain - $fqdn = "$MachineToJoin.$domain" - $computer = $MachineToJoin - } - - if (($results.Ensure -eq "Present") ` - -and ($Ensure -eq "Present") ` - -and (($results.MachineToJoin -eq $fqdn) -or ($results.MachineToJoin -eq $computer)) ` - -and ( $null -eq $roleCompare)) - { - # If present and all value match return true - return $true - } - elseif(($results.Ensure -eq "Absent") -and ($Ensure -eq "Absent")) - { - # if absent no need to check all values - return $true - } - else - { - return $false - } -} - -Export-ModuleMember -Function *-TargetResource - diff --git a/lib/puppet_x/dsc_resources/OfficeOnlineServerDsc/DSCResources/MSFT_OfficeOnlineServerMachine/MSFT_OfficeOnlineServerMachine.schema.mof b/lib/puppet_x/dsc_resources/OfficeOnlineServerDsc/DSCResources/MSFT_OfficeOnlineServerMachine/MSFT_OfficeOnlineServerMachine.schema.mof deleted file mode 100644 index c432caf2..00000000 --- a/lib/puppet_x/dsc_resources/OfficeOnlineServerDsc/DSCResources/MSFT_OfficeOnlineServerMachine/MSFT_OfficeOnlineServerMachine.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("OfficeOnlineServerMachine")] -class MSFT_OfficeOnlineServerMachine : OMI_BaseResource -{ - [Write, Description("Ensure Present or Absent"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, Description("Specifies one or more server roles, separated by commas, to assign to the new server. If no roles are specified, then the server is assigned all roles.")] String Roles[]; - [Key, Description("Specifies the name of any server that is already a member of the Office Web Apps Server farm.")] String MachineToJoin; -}; - diff --git a/lib/puppet_x/dsc_resources/OfficeOnlineServerDsc/Modules/OfficeOnlineServerDsc.Util/OfficeOnlineServerDsc.Util.psm1 b/lib/puppet_x/dsc_resources/OfficeOnlineServerDsc/Modules/OfficeOnlineServerDsc.Util/OfficeOnlineServerDsc.Util.psm1 deleted file mode 100644 index 87df7c96..00000000 --- a/lib/puppet_x/dsc_resources/OfficeOnlineServerDsc/Modules/OfficeOnlineServerDsc.Util/OfficeOnlineServerDsc.Util.psm1 +++ /dev/null @@ -1,245 +0,0 @@ -<# -.SYNOPSIS - -This cmdlet determines the version number of Office Web Apps that is installed locally - -#> -function Get-OosDscInstalledProductVersion -{ - [CmdletBinding()] - [OutputType([Version])] - param() - - return Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | ` - Select-Object DisplayName, DisplayVersion | ` - Where-Object { - $_.DisplayName -eq "Microsoft Office Web Apps Server 2013" -or ` - $_.DisplayName -eq "Microsoft Office Online Server" - } | ForEach-Object -Process { - return [Version]::Parse($_.DisplayVersion) - } | Select-Object -First 1 -} - - -<# -.SYNOPSIS - -This cmdlet determines if the OU of the farm matches the OU of the current deployment - -.PARAMETER DesiredOU - -The name of the OU that the farm should be in - -.PARAMETER ExistingOU - -The name of the OU that the farm currently is in - -#> -function Test-OosDscFarmOu -{ - [cmdletbinding()] - param - ( - [parameter(Mandatory = $true)] - [string] - $DesiredOU, - - [parameter(Mandatory = $true)] - [object] - $ExistingOU - ) - - $adsi = [adsisearcher]'(objectCategory=organizationalUnit)' - $adsi.Filter = "name=$DesiredOU" - $ou = $adsi.FindAll() - if($ou.path){ - $searchRoot = "," + $adsi.SearchRoot.Path -replace 'LDAP://' - $ldapResult = $ou.path -replace $searchRoot - Write-Verbose -Message "LDAP search result: $ldapResult" - Write-Verbose "Current Farm OU: $ExistingOU" - return ($ldapResult -contains $ExistingOU) - } - else - { - throw "$DesiredOU not found" - } -} - -<# -.SYNOPSIS - -This method is used to compare current and desired values for any DSC resource - -.PARAMETER CurrentValues - -This is hashtable of the current values that are applied to the resource - -.PARAMETER DesiredValues - -This is a PSBoundParametersDictionary of the desired values for the resource - -.PARAMETER ValuesToCheck - -This is a list of which properties in the desired values list should be checkked. -If this is empty then all values in DesiredValues are checked. - -#> -function Test-OosDscParameterState() { - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true, Position=1)] - [HashTable] - $CurrentValues, - - [parameter(Mandatory = $true, Position=2)] - [Object] - $DesiredValues, - - [parameter(Mandatory = $false, Position=3)] - [Array] - $ValuesToCheck - ) - - $returnValue = $true - - if (($DesiredValues.GetType().Name -ne "HashTable") ` - -and ($DesiredValues.GetType().Name -ne "CimInstance") ` - -and ($DesiredValues.GetType().Name -ne "PSBoundParametersDictionary")) - { - throw ("Property 'DesiredValues' in Test-SPDscParameterState must be either a " + ` - "Hashtable or CimInstance. Type detected was $($DesiredValues.GetType().Name)") - } - - if (($DesiredValues.GetType().Name -eq "CimInstance") -and ($null -eq $ValuesToCheck)) - { - throw ("If 'DesiredValues' is a Hashtable then property 'ValuesToCheck' must contain " + ` - "a value") - } - - if (($null -eq $ValuesToCheck) -or ($ValuesToCheck.Count -lt 1)) - { - $KeyList = $DesiredValues.Keys - } - else - { - $KeyList = $ValuesToCheck - } - - $KeyList | ForEach-Object -Process { - if ($_ -ne "Verbose") - { - if (($CurrentValues.ContainsKey($_) -eq $false) ` - -or ($CurrentValues.$_ -ne $DesiredValues.$_) ` - -or (($DesiredValues.ContainsKey($_) -eq $true) -and ($DesiredValues.$_.GetType().IsArray))) - { - if ($DesiredValues.GetType().Name -eq "HashTable" -or ` - $DesiredValues.GetType().Name -eq "PSBoundParametersDictionary") - { - $CheckDesiredValue = $DesiredValues.ContainsKey($_) - } - else - { - $CheckDesiredValue = Test-SPDSCObjectHasProperty $DesiredValues $_ - } - - if ($CheckDesiredValue) - { - $desiredType = $DesiredValues.$_.GetType() - $fieldName = $_ - if ($desiredType.IsArray -eq $true) - { - if (($CurrentValues.ContainsKey($fieldName) -eq $false) ` - -or ($null -eq $CurrentValues.$fieldName)) - { - Write-Verbose -Message ("Expected to find an array value for " + ` - "property $fieldName in the current " + ` - "values, but it was either not present or " + ` - "was null. This has caused the test method " + ` - "to return false.") - $returnValue = $false - } - else - { - $arrayCompare = Compare-Object -ReferenceObject $CurrentValues.$fieldName ` - -DifferenceObject $DesiredValues.$fieldName - if ($null -ne $arrayCompare) - { - Write-Verbose -Message ("Found an array for property $fieldName " + ` - "in the current values, but this array " + ` - "does not match the desired state. " + ` - "Details of the changes are below.") - $arrayCompare | ForEach-Object -Process { - Write-Verbose -Message "$($_.InputObject) - $($_.SideIndicator)" - } - $returnValue = $false - } - } - } - else - { - switch ($desiredType.Name) - { - "String" { - if ([string]::IsNullOrEmpty($CurrentValues.$fieldName) ` - -and [string]::IsNullOrEmpty($DesiredValues.$fieldName)) - {} - else - { - Write-Verbose -Message ("String value for property " + ` - "$fieldName does not match. " + ` - "Current state is " + ` - "'$($CurrentValues.$fieldName)' " + ` - "and desired state is " + ` - "'$($DesiredValues.$fieldName)'") - $returnValue = $false - } - } - "Int32" { - if (($DesiredValues.$fieldName -eq 0) ` - -and ($null -eq $CurrentValues.$fieldName)) - {} - else - { - Write-Verbose -Message ("Int32 value for property " + ` - "$fieldName does not match. " + ` - "Current state is " + ` - "'$($CurrentValues.$fieldName)' " + ` - "and desired state is " + ` - "'$($DesiredValues.$fieldName)'") - $returnValue = $false - } - } - "Int16" { - if (($DesiredValues.$fieldName -eq 0) ` - -and ($null -eq $CurrentValues.$fieldName)) - {} - else - { - Write-Verbose -Message ("Int16 value for property " + ` - "$fieldName does not match. " + ` - "Current state is " + ` - "'$($CurrentValues.$fieldName)' " + ` - "and desired state is " + ` - "'$($DesiredValues.$fieldName)'") - $returnValue = $false - } - } - default { - Write-Verbose -Message ("Unable to compare property $fieldName " + ` - "as the type ($($desiredType.Name)) is " + ` - "not handled by the " + ` - "Test-SPDscParameterState cmdlet") - $returnValue = $false - } - } - } - } - } - } - } - return $returnValue -} - -Export-ModuleMember -Function * diff --git a/lib/puppet_x/dsc_resources/OfficeOnlineServerDsc/OfficeOnlineServerDsc.psd1 b/lib/puppet_x/dsc_resources/OfficeOnlineServerDsc/OfficeOnlineServerDsc.psd1 deleted file mode 100644 index c309f366..00000000 --- a/lib/puppet_x/dsc_resources/OfficeOnlineServerDsc/OfficeOnlineServerDsc.psd1 +++ /dev/null @@ -1,125 +0,0 @@ -# -# Module manifest for module 'OfficeOnlineServerDsc' -# -# Generated by: Jason Walker -# -# Generated on: 2/3/2016 -# - -@{ - -# Script module or binary module file associated with this manifest. -# RootModule = '' - -# Version number of this module. -ModuleVersion = '1.0.0.0' - -# ID used to uniquely identify this module -GUID = '7514bb93-d3e4-40b2-98e7-3404e9674c1c' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2016 Microsoft. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'The OfficeOnlineServerDsc module provides the ability to install Office Online Server (formerly known as Office Web App Server).' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Name of the Windows PowerShell host required by this module -# PowerShellHostName = '' - -# Minimum version of the Windows PowerShell host required by this module -# PowerShellHostVersion = '' - -# Minimum version of Microsoft .NET Framework required by this module -# DotNetFrameworkVersion = '' - -# Minimum version of the common language runtime (CLR) required by this module -# CLRVersion = '' - -# Processor architecture (None, X86, Amd64) required by this module -# ProcessorArchitecture = '' - -# Modules that must be imported into the global environment prior to importing this module -# RequiredModules = @() - -# Assemblies that must be loaded prior to importing this module -# RequiredAssemblies = @() - -# Script files (.ps1) that are run in the caller's environment prior to importing this module. -# ScriptsToProcess = @() - -# Type files (.ps1xml) to be loaded when importing this module -# TypesToProcess = @() - -# Format files (.ps1xml) to be loaded when importing this module -# FormatsToProcess = @() - -# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess -NestedModules = @("modules\OfficeOnlineServerDsc.Util\OfficeOnlineServerDsc.Util.psm1") - -# Functions to export from this module -# FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = @('Get-OosDscInstalledProductVersion', - 'Test-OosDscFarmOu', - 'Test-OosDscParameterState') - -# Variables to export from this module -# VariablesToExport = '*' - -# Aliases to export from this module -# AliasesToExport = '*' - -# List of all modules packaged with this module -# ModuleList = @() - -# List of all files packaged with this module -# FileList = @() - -# Private data to pass to the module specified in RootModule/ModuleToProcess -# PrivateData = '' - -# HelpInfo URI of this module -# HelpInfoURI = '' - -# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. -# DefaultCommandPrefix = '' - -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/OfficeOnlineServerDsc/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/OfficeOnlineServerDsc' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - ReleaseNotes = '* Added documentation to the module to finalise for release -* Renamed resources to shorten names before release - * "OfficeOnlineServerWebAppsFarm" becomes "OfficeOnlineServerFarm" - * "OfficeOnlineServerWebAppsMachine" becomes "OfficeOnlineServerMachine" -' - - } # End of PSData hashtable - -} # End of PrivateData hashtable - -} - diff --git a/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_SecuritySetting/MSFT_SecuritySetting.psm1 b/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_SecuritySetting/MSFT_SecuritySetting.psm1 deleted file mode 100644 index 60b29b2b..00000000 --- a/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_SecuritySetting/MSFT_SecuritySetting.psm1 +++ /dev/null @@ -1,465 +0,0 @@ -Import-Module -Name (Join-Path -Path ( Split-Path $PSScriptRoot -Parent ) ` - -ChildPath 'SecurityPolicyResourceHelper\SecurityPolicyResourceHelper.psm1') ` - -Force - -$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_SecuritySetting' - -$headerSettings = @{ - MinimumPasswordAge = "System Access" - MaximumPasswordAge = "System Access" - MinimumPasswordLength = "System Access" - PasswordComplexity = "System Access" - PasswordHistorySize = "System Access" - LockoutBadCount = "System Access" - ForceLogoffWhenHourExpire = "System Access" - NewAdministratorName = "System Access" - NewGuestName = "System Access" - ClearTextPassword = "System Access" - LSAAnonymousNameLookup = "System Access" - EnableAdminAccount = "System Access" - EnableGuestAccount = "System Access" - ResetLockoutCount = "System Access" - LockoutDuration = "System Access" - MaxServiceAge = "Keberos Policy" - MaxTicketAge = "Kerberos Policy" - MaxRenewAge = "Kerberos Policy" - MaxClockSkew = "Kerberos Policy" - TicketValidateClient = "Kerberos Policy" -} - -function Get-IniContent -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] - [System.String] - $Path - ) - - $ini = @{} - switch -regex -file $Path - { - "^\[(.+)\]" # Section - { - $section = $matches[1] - $ini[$section] = @{} - $CommentCount = 0 - } - "^(;.*)$" # Comment - { - $value = $matches[1] - $CommentCount = $CommentCount + 1 - $name = "Comment" + $CommentCount - $ini[$section][$name] = $value.Trim() - continue - } - "(.+ )\s*=(.*)" # Key - { - $name,$value = $matches[1..2] - $ini[$section][$name.Trim()] = $value.Trim() - # Need to replace double quotes with `" - continue - } - "\`"(.*)`",(.*)$" - { - $name, $value = $matches[1..2] - $ini[$section][$name.Trim()] = $value.Trim() - continue - } - } - return $ini -} - -function Get-SecuritySettings -{ - [CmdletBinding()] - param() - - $file = Join-Path -Path $env:SystemRoot -ChildPath "\security\database\temppol.inf" - Write-Verbose -Message ($script:localizedData.CreatingTmpFile -f $file) - - $PowerShellProcess = new-object System.Diagnostics.Process - $PowerShellProcess.StartInfo.Filename = "secedit.exe" - $PowerShellProcess.StartInfo.Arguments = " /export /cfg $file /areas securitypolicy" - $PowerShellProcess.StartInfo.RedirectStandardOutput = $True - $PowerShellProcess.StartInfo.UseShellExecute = $false - $PowerShellProcess.Start() | Out-Null - $PowerShellProcess.WaitForExit('10') | Out-Null - [System.String] $process = $PowerShellProcess.StandardOutput.ReadToEnd(); - - $ini = Get-IniContent -Path $file - Remove-Item $file -Force - return $ini -} - -function Set-SecuritySettings -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [string] - $secDB, - - [Parameter(Mandatory = $true)] - [string] - $tmpFile - ) - - $PowerShellProcess = new-object System.Diagnostics.Process - $PowerShellProcess.StartInfo.Filename = "secedit.exe" - $PowerShellProcess.StartInfo.Arguments = " /configure /db $secDB /cfg $tmpfile /overwrite /quiet" - $PowerShellProcess.StartInfo.RedirectStandardOutput = $True - $PowerShellProcess.StartInfo.UseShellExecute = $false - $PowerShellProcess.Start() | Out-Null - $PowerShellProcess.WaitForExit('10') | Out-Null - [System.String] $process = $PowerShellProcess.StandardOutput.ReadToEnd(); -} - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet("MinimumPasswordAge","MaximumPasswordAge","MinimumPasswordLength","PasswordComplexity","PasswordHistorySize","LockoutBadCount","ForceLogoffWhenHourExpire","NewAdministratorName","NewGuestName","ClearTextPassword","LSAAnonymousNameLookup","EnableAdminAccount","EnableGuestAccount","ResetLockoutCount","LockoutDuration","MaxServiceAge","MaxTicketAge","MaxRenewAge","MaxClockSkew","TicketValidateClient")] - [System.String] - $Name - ) - - $ini = Get-SecuritySettings - - $returnHash = @{} - $values = "MinimumPasswordAge","MaximumPasswordAge","MinimumPasswordLength","PasswordComplexity","PasswordHistorySize","LockoutBadCount","ForceLogoffWhenHourExpire","NewAdministratorName","NewGuestName","ClearTextPassword","LSAAnonymousNameLookup","EnableAdminAccount","EnableGuestAccount","ResetLockoutCount","LockoutDuration","MaxServiceAge","MaxTicketAge","MaxRenewAge","MaxClockSkew","TicketValidateClient" - foreach ($value in $values) - { - $returnHash.$value = $ini[$headerSettings[$value]].$value - } - - $returnHash.Name = $Name - - return $returnHash -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter()] - [ValidateRange(-1, 999)] - [System.Int16] - $MinimumPasswordAge, - - [Parameter()] - [ValidateRange(0,999)] - [System.UInt16] - $MaximumPasswordAge, - - [Parameter()] - [System.UInt16] - $MinimumPasswordLength, - - [Parameter()] - [System.UInt16] - $PasswordComplexity, - - [Parameter()] - [System.UInt16] - $PasswordHistorySize, - - [Parameter()] - [System.UInt16] - $LockoutBadCount, - - [Parameter()] - [System.UInt16] - $ForceLogoffWhenHourExpire, - - [Parameter()] - [System.String] - $NewAdministratorName, - - [Parameter()] - [System.String] - $NewGuestName, - - [Parameter()] - [System.UInt16] - $ClearTextPassword, - - [Parameter()] - [System.UInt16] - $LSAAnonymousNameLookup, - - [Parameter()] - [System.UInt16] - $EnableAdminAccount, - - [Parameter()] - [System.UInt16] - $EnableGuestAccount, - - [Parameter()] - [System.Int16] - $ResetLockoutCount, - - [Parameter()] - [ValidateRange(-1, 99999)] - [ValidateScript({$_ -ne 0})] - [System.Int16] - $LockoutDuration, - - [Parameter()] - [ValidateScript({$_ -ge 10})] - [System.UInt16] - $MaxServiceAge, - - [Parameter()] - [ValidateRange(0,99999)] - [System.UInt16] - $MaxTicketAge, - - [Parameter()] - [ValidateRange(0,99999)] - [System.UInt16] - $MaxRenewAge, - - [Parameter()] - [ValidateRange(0,99999)] - [System.UInt16] - $MaxClockSkew, - - [Parameter()] - [System.UInt16] - $TicketValidateClient, - - [Parameter()] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [Parameter(Mandatory = $true)] - [ValidateSet("MinimumPasswordAge","MaximumPasswordAge","MinimumPasswordLength","PasswordComplexity","PasswordHistorySize","LockoutBadCount","ForceLogoffWhenHourExpire","NewAdministratorName","NewGuestName","ClearTextPassword","LSAAnonymousNameLookup","EnableAdminAccount","EnableGuestAccount","ResetLockoutCount","LockoutDuration","MaxServiceAge","MaxTicketAge","MaxRenewAge","MaxClockSkew","TicketValidateClient")] - [System.String] - $Name - ) - - if (@($PSBoundParameters.Keys.Where({$_ -notin "Name", "Ensure"})).Count -eq 0) - { - Write-Error $script:localizedData.NoValuesSpecified - } - - # Find out what sections we are setting. - $PSBoundParameters.Remove("Ensure") - $PSBoundParameters.Remove("Name") - $headers = ($PSBoundParameters.GetEnumerator() | ForEach-Object { $headerSettings[$_.Key] } | Group-Object).Name - - $ini = Get-SecuritySettings - $tmpFile = Join-Path -Path $env:SystemRoot -ChildPath "\security\database\temppol.inf" - $newSecDB = Join-Path -Path $env:SystemRoot -ChildPath "\security\database\tmpsecedit.sdb" - - Write-Verbose -Message ($script:localizedData.CreatingTmpFile -f $tmpFile) - Write-Verbose -Message ($script:localizedData.CreatingTmpFile -f $newSecDB) - - foreach ($header in $headers) - { - foreach ($keyPair in $PSBoundParameters.GetEnumerator()) - { - try - { - $ini[$header][$keyPair.Key] = $keyPair.Value - } - catch - { - Write-Error $script:localizedData.FailureSettingKey -f $keyPair.Key, $keyPair.Value - continue - } - } - } - - if (Test-Path $tmpFile) - { - Remove-Item $tmpFile -Force - } - - "[Unicode]" | Out-File $tmpfile - "Unicode=yes" | Out-File $tmpfile -Append - foreach ($headers in $headers) - { - "[$header]" | Out-File $tmpfile -Append - - foreach ($keyPair in $ini[$header].GetEnumerator()) - { - $Value = 1 - if ([System.Int32]::TryParse($keyPair.value, [ref]$Value)) - { - "$($keyPair.Name) = $Value" | Out-File $tmpFile -Append - } - else - { - "$($keyPair.Name) = `"$($keyPair.Value)`"" | Out-File $tmpFile -Append - } - } - } - - "[Version]" | Out-File $tmpfile -Append - "signature=`"`$CHICAGO`$`"" | Out-File $tmpfile -Append - "Revision=1" | Out-File $tmpfile -Append - - Set-SecuritySettings -secDB $newSecDB -tmpFile $tmpFile - - Remove-Item $tmpfile -Force -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter()] - [ValidateRange(-1, 999)] - [System.Int16] - $MinimumPasswordAge, - - [Parameter()] - [ValidateRange(0,999)] - [System.UInt16] - $MaximumPasswordAge, - - [Parameter()] - [System.UInt16] - $MinimumPasswordLength, - - [Parameter()] - [System.UInt16] - $PasswordComplexity, - - [Parameter()] - [System.UInt16] - $PasswordHistorySize, - - [Parameter()] - [System.UInt16] - $LockoutBadCount, - - [Parameter()] - [System.UInt16] - $ForceLogoffWhenHourExpire, - - [Parameter()] - [System.String] - $NewAdministratorName, - - [Parameter()] - [System.String] - $NewGuestName, - - [Parameter()] - [System.UInt16] - $ClearTextPassword, - - [Parameter()] - [System.UInt16] - $LSAAnonymousNameLookup, - - [Parameter()] - [System.UInt16] - $EnableAdminAccount, - - [Parameter()] - [System.UInt16] - $EnableGuestAccount, - - [Parameter()] - [System.Int16] - $ResetLockoutCount, - - [Parameter()] - [ValidateRange(-1, 99999)] - [ValidateScript({$_ -ne 0})] - [System.Int16] - $LockoutDuration, - - [Parameter()] - [ValidateScript({$_ -ge 10})] - [System.UInt16] - $MaxServiceAge, - - [Parameter()] - [ValidateRange(0,99999)] - [System.UInt16] - $MaxTicketAge, - - [Parameter()] - [ValidateRange(0,99999)] - [System.UInt16] - $MaxRenewAge, - - [Parameter()] - [ValidateRange(0,99999)] - [System.UInt16] - $MaxClockSkew, - - [Parameter()] - [System.UInt16] - $TicketValidateClient, - - [Parameter()] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [Parameter(Mandatory = $true)] - [ValidateSet("MinimumPasswordAge","MaximumPasswordAge","MinimumPasswordLength","PasswordComplexity","PasswordHistorySize","LockoutBadCount","ForceLogoffWhenHourExpire","NewAdministratorName","NewGuestName","ClearTextPassword","LSAAnonymousNameLookup","EnableAdminAccount","EnableGuestAccount","ResetLockoutCount","LockoutDuration","MaxServiceAge","MaxTicketAge","MaxRenewAge","MaxClockSkew","TicketValidateClient")] - [System.String] - $Name - ) - - if (@($PSBoundParameters.Keys.Where({$_ -notin "Name", "Ensure"})).Count -eq 0) - { - Write-Error $script:localizedData.NoValuesSpecified - return $false - } - - # Find out what sections we are setting. - $PSBoundParameters.Remove("Ensure") | Out-Null - $PSBoundParameters.Remove("Name") | Out-Null - $headers = ($PSBoundParameters.GetEnumerator() | ForEach-Object { $headerSettings[$_.Key] } | Group-Object).Name - - $ini = Get-SecuritySettings - - $returnValue = $true - foreach ($header in $headers) - { - foreach ($keyPair in ($PSBoundParameters.GetEnumerator() | Where-Object {$headerSettings[$_.Key] -eq $header})) - { - if ($ini.ContainsKey($header)) - { - if ($ini[$header][$keyPair.Key] -eq $keyPair.Value) - { - Write-Verbose -Message ($script:localizedData.TestSuccess -f $keyPair.Key, $keyPair.Value) - } - else - { - Write-Verbose -Message ($script:localizedData.TestFailure -f $keyPair.Key, $keyPair.Value) - $returnValue = $false - } - } - else - { - Write-Verbose -Message ($script:localizedData.SectionError -f $header) - $returnValue = $false - } - } - } - - return $returnValue -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_SecuritySetting/MSFT_SecuritySetting.schema.mof b/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_SecuritySetting/MSFT_SecuritySetting.schema.mof deleted file mode 100644 index b4add458..00000000 --- a/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_SecuritySetting/MSFT_SecuritySetting.schema.mof +++ /dev/null @@ -1,26 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SecuritySetting")] -class MSFT_SecuritySetting : OMI_BaseResource -{ - [Key, Description("This is just here to avoid conflicts"), ValueMap{"MinimumPasswordAge","MaximumPasswordAge","MinimumPasswordLength","PasswordComplexity","PasswordHistorySize","LockoutBadCount","ForceLogoffWhenHourExpire","NewAdministratorName","NewGuestName","ClearTextPassword","LSAAnonymousNameLookup","EnableAdminAccount","EnableGuestAccount","ResetLockoutCount","LockoutDuration","MaxServiceAge","MaxTicketAge","MaxRenewAge","MaxClockSkew","TicketValidateClient"}, Values{"MinimumPasswordAge","MaximumPasswordAge","MinimumPasswordLength","PasswordComplexity","PasswordHistorySize","LockoutBadCount","ForceLogoffWhenHourExpire","NewAdministratorName","NewGuestName","ClearTextPassword","LSAAnonymousNameLookup","EnableAdminAccount","EnableGuestAccount","ResetLockoutCount","LockoutDuration","MaxServiceAge","MaxTicketAge","MaxRenewAge","MaxClockSkew","TicketValidateClient"}] String Name; - [Write, Description("Desired state of resource."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write] SInt16 MinimumPasswordAge; - [Write] UInt16 MaximumPasswordAge; - [Write] UInt16 MinimumPasswordLength; - [Write] Uint16 PasswordComplexity; - [Write] UInt16 PasswordHistorySize; - [Write] UInt16 LockoutBadCount; - [Write] Uint16 ForceLogoffWhenHourExpire; - [Write] String NewAdministratorName; - [Write] String NewGuestName; - [Write] Uint16 ClearTextPassword; - [Write] Uint16 LSAAnonymousNameLookup; - [Write] Uint16 EnableAdminAccount; - [Write] Uint16 EnableGuestAccount; - [Write] SInt16 ResetLockoutCount; - [Write] SInt16 LockoutDuration; - [Write] UInt16 MaxServiceAge; - [Write] Uint16 MaxTicketAge; - [Write] Uint16 MaxRenewAge; - [Write] Uint16 MaxClockSkew; - [Write] Uint16 TicketValidateClient; -}; diff --git a/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_SecuritySetting/en-US/MSFT_SecuritySetting.strings.psd1 b/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_SecuritySetting/en-US/MSFT_SecuritySetting.strings.psd1 deleted file mode 100644 index 2e135ebb..00000000 --- a/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_SecuritySetting/en-US/MSFT_SecuritySetting.strings.psd1 +++ /dev/null @@ -1,8 +0,0 @@ -ConvertFrom-StringData @' - CreatingTmpFile = Creating Temp file at path: {0} - TestSuccess = Tested {0} expecting {1}: SUCCESS! - TestFail = Tested {0} expecting {1}: FAILURE! - SectionError = Could not find section: {0} - NoValuesSpecified = No Values Specified! - FailureSettingKey = Unable to set {0} to {1}" -'@ diff --git a/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_SecurityTemplate/MSFT_SecurityTemplate.psm1 b/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_SecurityTemplate/MSFT_SecurityTemplate.psm1 deleted file mode 100644 index 2a23dfeb..00000000 --- a/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_SecurityTemplate/MSFT_SecurityTemplate.psm1 +++ /dev/null @@ -1,221 +0,0 @@ - -Import-Module -Name (Join-Path -Path ( Split-Path $PSScriptRoot -Parent ) ` - -ChildPath 'SecurityPolicyResourceHelper\SecurityPolicyResourceHelper.psm1') ` - -Force - -$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_SecurityTemplate' - -<# - .SYNOPSIS - Gets the path of the current policy template. - .PARAMETER Path - Not used in Get-TargetResource. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [String] - $IsSingleInstance, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Path - ) - - $securityCmdlets = Get-Module -Name SecurityCmdlets -ListAvailable - $currentUserRightsInf = ([System.IO.Path]::GetTempFileName()).Replace('tmp','inf') - - if ($securityCmdlets) - { - Backup-SecurityPolicy -Path $currentUserRightsInf - $templateFileName = Format-SecurityPolicyFile -Path $currentUserRightsInf - } - else - { - Get-SecurityTemplate -Path $currentUserRightsInf | Out-Null - $templateFileName = $currentUserRightsInf - } - - $returnValue = @{ - Path = [System.String]$templateFileName - IsSingleInstance = 'Yes' - } - - $returnValue -} - -<# - .SYNOPSIS - Gets the path of the desired policy template. - .PARAMETER Path - Specifies the path to the policy template. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [String] - $IsSingleInstance, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Path - ) - - $securityCmdlets = Get-Module -Name SecurityCmdlets -ListAvailable - - if ($securityCmdlets) - { - Restore-SecurityPolicy -Path $Path - } - else - { - $secEditOutput = "$env:TEMP\Secedit-OutPut.txt" - - Invoke-Secedit -UserRightsToAddInf $Path -SecEditOutput $seceditOutput - } - # Verify secedit command was successful - $testSuccuess = Test-TargetResource @PSBoundParameters - - if ($testSuccuess -eq $true) - { - Write-Verbose -Message ($script:localizedData.TaskSuccess) - } - else - { - Write-Error -Message ($script:localizedData.TaskFail) - } -} - -<# - .SYNOPSIS - Gets the path of the desired policy template. - .PARAMETER Path - Specifies the path to the policy template. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [String] - $IsSingleInstance, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Path - ) - - $securityCmdlets = Get-Module -Name SecurityCmdlets -ListAvailable - $currentUserRightsInf = ([System.IO.Path]::GetTempFileName()).Replace('tmp','inf') - $fileExists = Test-Path -Path $Path - - if ($fileExists -eq $false) - { - throw ($script:localizedData.PathNotFound) -f $Path - } - - if ($securityCmdlets) - { - Backup-SecurityPolicy -Path $currentUserRightsInf - } - else - { - Get-SecurityTemplate -Path $currentUserRightsInf | Out-Null - } - - $desiredPolicies = (Get-UserRightsAssignment -FilePath $Path).'Privilege Rights' - $currentPolicies = (Get-UserRightsAssignment -FilePath $currentUserRightsInf).'Privilege Rights' - - $policyNames = $desiredPolicies.keys - - foreach ($policy in $policyNames) - { - $policiesMatch = $false - - if ($null -eq $currentPolicies[$policy] -or $null -eq $desiredPolicies[$policy]) - { - $policiesMatch = [String]::IsNullOrEmpty($currentPolicies[$policy]) -and [String]::IsNullOrEmpty($desiredPolicies[$policy]) - } - else - { - $policiesMatch = $null -eq ( Compare-Object -ReferenceObject ($currentPolicies[$policy]).Trim() -DifferenceObject ($desiredPolicies[$policy]).Trim() ) - } - - if(-not $policiesMatch) - { - Write-Verbose -Message ($script:localizedData.NotDesiredState -f $Policy) - return $false - } - } - - # If the code made it this far all policies must be in a desired state - return $true -} - -<# - .SYNOPSIS - Removes the other security areas from policy template file so only settings for user rights assignments are returned. - .PARAMETER Path - Specifies the path to the template file to be parsed. -#> -function Format-SecurityPolicyFile -{ - [OutputType([String])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Path - ) - - $outputPath = ([System.IO.Path]::GetTempFileName()).Replace('tmp','inf') - $content = Get-Content -Path $Path - - $privilegeRightsMatch = Select-String -Path $Path -Pattern "[Privilege Rights]" -SimpleMatch - $endOfFileMatch = Select-String -Path $Path -Pattern "Revision=1" -SimpleMatch - - $startOfFile = $privilegeRightIndex.LineNumber -1 - $endOfFile = $endOfFileMatch.LineNumber - - $content[$startOfFile..$endOfFile] | Out-File -FilePath $outputPath - - $outputPath -} - -<# - .SYNOPSIS - Invokes secedit.exe to create an INF file of the current policies. - .PARAMETER Path - The path to the export INF file that will be created. -#> -function Get-SecurityTemplate -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Path - ) - - secedit.exe /export /cfg $Path /areas "USER_Rights" -} - -Export-ModuleMember -Function *-TargetResource - diff --git a/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_SecurityTemplate/MSFT_SecurityTemplate.schema.mof b/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_SecurityTemplate/MSFT_SecurityTemplate.schema.mof deleted file mode 100644 index bbf03b5f..00000000 --- a/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_SecurityTemplate/MSFT_SecurityTemplate.schema.mof +++ /dev/null @@ -1,8 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("SecurityTemplate")] -class MSFT_SecurityTemplate : OMI_BaseResource -{ - [Key, Description("Specifies the resource is a single instance, the value must be 'Yes'"), ValueMap{"Yes"}, Values{"Yes"}] String IsSingleInstance; - [Required, Description("The path to the desired security policy template (.inf)")] String Path; -}; - diff --git a/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_SecurityTemplate/en-US/MSFT_SecurityTemplate.strings.psd1 b/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_SecurityTemplate/en-US/MSFT_SecurityTemplate.strings.psd1 deleted file mode 100644 index f48dc3d4..00000000 --- a/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_SecurityTemplate/en-US/MSFT_SecurityTemplate.strings.psd1 +++ /dev/null @@ -1,6 +0,0 @@ -ConvertFrom-StringData @' - TaskSuccess = Task successfully completed - TaskFail = Task did not complete successfully - NotDesiredState = Policy: {0} not in a desired state. - PathNotFound = {0} not found. -'@ diff --git a/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_UserRightsAssignment/MSFT_UserRightsAssignment.psm1 b/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_UserRightsAssignment/MSFT_UserRightsAssignment.psm1 deleted file mode 100644 index 9a2ac882..00000000 --- a/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_UserRightsAssignment/MSFT_UserRightsAssignment.psm1 +++ /dev/null @@ -1,600 +0,0 @@ - -Import-Module -Name (Join-Path -Path ( Split-Path $PSScriptRoot -Parent ) ` - -ChildPath 'SecurityPolicyResourceHelper\SecurityPolicyResourceHelper.psm1') ` - -Force - -$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_UserRightsAssignment' - -<# - .SYNOPSIS - Gets the current identities assigned to a user rights assignment. - .PARAMETER Policy - Specifies the policy to configure. - .PARAMETER Identity - Specifies the identity to add to a user rights assignment. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet( - "Create_a_token_object", - "Access_this_computer_from_the_network", - "Change_the_system_time", - "Deny_log_on_as_a_batch_job", - "Deny_log_on_through_Remote_Desktop_Services", - "Create_global_objects", - "Remove_computer_from_docking_station", - "Deny_access_to_this_computer_from_the_network", - "Act_as_part_of_the_operating_system", - "Modify_firmware_environment_values", - "Deny_log_on_locally", - "Access_Credential_Manager_as_a_trusted_caller", - "Restore_files_and_directories", - "Change_the_time_zone", - "Replace_a_process_level_token", - "Manage_auditing_and_security_log", - "Create_symbolic_links", - "Modify_an_object_label", - "Enable_computer_and_user_accounts_to_be_trusted_for_delegation", - "Generate_security_audits", - "Increase_a_process_working_set", - "Take_ownership_of_files_or_other_objects", - "Bypass_traverse_checking", - "Log_on_as_a_service", - "Shut_down_the_system", - "Lock_pages_in_memory", - "Impersonate_a_client_after_authentication", - "Profile_system_performance", - "Debug_programs", - "Profile_single_process", - "Allow_log_on_through_Remote_Desktop_Services", - "Allow_log_on_locally", - "Increase_scheduling_priority", - "Synchronize_directory_service_data", - "Add_workstations_to_domain", - "Adjust_memory_quotas_for_a_process", - "Obtain_an_impersonation_token_for_another_user_in_the_same_session", - "Perform_volume_maintenance_tasks", - "Load_and_unload_device_drivers", - "Force_shutdown_from_a_remote_system", - "Back_up_files_and_directories", - "Create_a_pagefile", - "Deny_log_on_as_a_service", - "Log_on_as_a_batch_job", - "Create_permanent_shared_objects" - )] - [System.String] - $Policy, - - [Parameter(Mandatory = $true)] - [AllowEmptyCollection()] - [AllowEmptyString()] - [System.String[]] - $Identity, - - [Parameter()] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Boolean] - $Force - ) - - $userRightPolicy = Get-UserRightPolicy -Name $Policy - - Write-Verbose -Message "Policy: $($userRightPolicy.FriendlyName). Identity: $($userRightPolicy.Identity)" - - return @{ - Policy = $userRightPolicy.FriendlyName - Identity = $userRightPolicy.Identity - } -} - -<# - .SYNOPSIS - Gets the current identities assigned to a user rights assignment. - .PARAMETER Policy - Specifies the policy to configure. - .PARAMETER Identity - Specifies the identity to add to a user rights assignment. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet( - "Create_a_token_object", - "Access_this_computer_from_the_network", - "Change_the_system_time", - "Deny_log_on_as_a_batch_job", - "Deny_log_on_through_Remote_Desktop_Services", - "Create_global_objects", - "Remove_computer_from_docking_station", - "Deny_access_to_this_computer_from_the_network", - "Act_as_part_of_the_operating_system", - "Modify_firmware_environment_values", - "Deny_log_on_locally", - "Access_Credential_Manager_as_a_trusted_caller", - "Restore_files_and_directories", - "Change_the_time_zone", - "Replace_a_process_level_token", - "Manage_auditing_and_security_log", - "Create_symbolic_links", - "Modify_an_object_label", - "Enable_computer_and_user_accounts_to_be_trusted_for_delegation", - "Generate_security_audits", - "Increase_a_process_working_set", - "Take_ownership_of_files_or_other_objects", - "Bypass_traverse_checking", - "Log_on_as_a_service", - "Shut_down_the_system", - "Lock_pages_in_memory", - "Impersonate_a_client_after_authentication", - "Profile_system_performance", - "Debug_programs", - "Profile_single_process", - "Allow_log_on_through_Remote_Desktop_Services", - "Allow_log_on_locally", - "Increase_scheduling_priority", - "Synchronize_directory_service_data", - "Add_workstations_to_domain", - "Adjust_memory_quotas_for_a_process", - "Obtain_an_impersonation_token_for_another_user_in_the_same_session", - "Perform_volume_maintenance_tasks", - "Load_and_unload_device_drivers", - "Force_shutdown_from_a_remote_system", - "Back_up_files_and_directories", - "Create_a_pagefile", - "Deny_log_on_as_a_service", - "Log_on_as_a_batch_job", - "Create_permanent_shared_objects" - )] - [System.String] - $Policy, - - [Parameter(Mandatory = $true)] - [AllowEmptyCollection()] - [AllowEmptyString()] - [System.String[]] - $Identity, - - [Parameter()] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Boolean] - $Force = $false - ) - - $userRightConstant = Get-UserRightConstant -Policy $Policy - - $script:seceditOutput = "$env:TEMP\Secedit-OutPut.txt" - $userRightsToAddInf = "$env:TEMP\userRightsToAdd.inf" - $idsToAdd = $Identity -join "," - - if ($null -eq $Identity) - { - Write-Verbose -Message ($script:localizedData.IdentityIsNullRemovingAll -f $Policy) - $idsToAdd = $null - } - else - { - $currentRights = Get-TargetResource -Policy $Policy -Identity $Identity - - $accounts = @() - switch ($Identity) - { - "[Local Account]" { $accounts += (Get-CimInstance win32_useraccount -Filter "LocalAccount='True'").SID } - "[Local Account|Administrator]" - { - $administratorsGroup = Get-CimInstance -class win32_group -filter "SID='S-1-5-32-544'" - $groupUsers = Get-CimInstance -query "select * from win32_groupuser where GroupComponent = `"Win32_Group.Domain='$($env:COMPUTERNAME)'`,Name='$($administratorsGroup.name)'`"" - [array]$usersList = $groupUsers.partcomponent | ForEach-Object { (($_ -replace '.*Win32_UserAccount.Domain="', "") -replace '",Name="', "\") -replace '"', '' } - $users += $usersList | Where-Object {$_ -match $env:COMPUTERNAME} - $accounts += $users | ForEach-Object {(Get-CimInstance win32_useraccount -Filter "Caption='$($_.Replace("\", "\\"))'").SID} - } - Default { $accounts += $_} - } - - if ($Ensure -eq "Present") - { - if (!$Force) - { - foreach ($id in $currentRights.Identity) - { - if ($id -notin $accounts) - { - $accounts += $id - } - } - } - } - else - { - $accounts = $accounts | Where-Object {$_ -notin $currentRights.Identity} - } - - $idsToAdd = $accounts -join "," - - Write-Verbose -Message ($script:localizedData.GrantingPolicyRightsToIds -f $Policy, $idsToAdd) - } - - Out-UserRightsInf -InfPolicy $userRightConstant -UserList $idsToAdd -FilePath $userRightsToAddInf - Write-Debug -Message ($script:localizedData.EchoDebugInf -f $userRightsToAddInf) - - Write-Verbose "Attempting to Set ($($idstoAdd -join ",")) for Policy $($Policy))" - Invoke-Secedit -UserRightsToAddInf $userRightsToAddInf -SecEditOutput $seceditOutput - - # Verify secedit command was successful - - if ( Test-TargetResource -Identity $Identity -Policy $Policy -Ensure $Ensure ) - { - Write-Verbose -Message ($script:localizedData.TaskSuccess) - Write-Verbose "$(($idsToAdd -join ",")) successfully given Rights ($Policy)" - } - else - { - $seceditResult = Get-Content -Path $script:seceditOutput - Write-Verbose -Message ($script:localizedData.TaskFail) - throw "$($script:localizedData.TaskFail) $($seceditResult[-1])" - } -} - -<# - .SYNOPSIS - Gets the current identities assigned to a user rights assignment. - .PARAMETER Policy - Specifies the policy to configure. - .PARAMETER Identity - Specifies the identity to add to a user rights assignment. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet( - "Create_a_token_object", - "Access_this_computer_from_the_network", - "Change_the_system_time", - "Deny_log_on_as_a_batch_job", - "Deny_log_on_through_Remote_Desktop_Services", - "Create_global_objects", - "Remove_computer_from_docking_station", - "Deny_access_to_this_computer_from_the_network", - "Act_as_part_of_the_operating_system", - "Modify_firmware_environment_values", - "Deny_log_on_locally", - "Access_Credential_Manager_as_a_trusted_caller", - "Restore_files_and_directories", - "Change_the_time_zone", - "Replace_a_process_level_token", - "Manage_auditing_and_security_log", - "Create_symbolic_links", - "Modify_an_object_label", - "Enable_computer_and_user_accounts_to_be_trusted_for_delegation", - "Generate_security_audits", - "Increase_a_process_working_set", - "Take_ownership_of_files_or_other_objects", - "Bypass_traverse_checking", - "Log_on_as_a_service", - "Shut_down_the_system", - "Lock_pages_in_memory", - "Impersonate_a_client_after_authentication", - "Profile_system_performance", - "Debug_programs", - "Profile_single_process", - "Allow_log_on_through_Remote_Desktop_Services", - "Allow_log_on_locally", - "Increase_scheduling_priority", - "Synchronize_directory_service_data", - "Add_workstations_to_domain", - "Adjust_memory_quotas_for_a_process", - "Obtain_an_impersonation_token_for_another_user_in_the_same_session", - "Perform_volume_maintenance_tasks", - "Load_and_unload_device_drivers", - "Force_shutdown_from_a_remote_system", - "Back_up_files_and_directories", - "Create_a_pagefile", - "Deny_log_on_as_a_service", - "Log_on_as_a_batch_job", - "Create_permanent_shared_objects" - )] - [System.String] - $Policy, - - [Parameter(Mandatory = $true)] - [AllowEmptyCollection()] - [AllowEmptyString()] - [System.String[]] - $Identity, - - [Parameter()] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Boolean] - $Force - ) - - $currentUserRights = Get-UserRightPolicy -Name $Policy - - if ( Test-IdentityIsNull -Identity $Identity ) - { - Write-Verbose -Message ($script:localizedData.TestIdentityIsPresentOnPolicy -f "NULL", $Policy) - - if ( $null -eq $currentUserRights.Identity ) - { - Write-Verbose -Message ($script:localizedData.NoIdentitiesFoundOnPolicy -f $Policy) - return $true - } - else - { - Write-Verbose -Message ($script:localizedData.IdentityFoundExpectedNull -f $Policy) - return $false - } - } - - Write-Verbose -Message ($script:localizedData.TestIdentityIsPresentOnPolicy -f $($Identity -join ","), $Policy) - - $accounts = @() - switch ($Identity) - { - "[Local Account]" { $accounts += (Get-CimInstance Win32_UserAccount -Filter "LocalAccount='True'").SID } - "[Local Account|Administrator]" - { - $administratorsGroup = Get-CimInstance -class Win32_Group -filter "SID='S-1-5-32-544'" - $groupUsers = Get-CimInstance -Query "select * from win32_groupuser where GroupComponent = `"Win32_Group.Domain='$($env:COMPUTERNAME)'`,Name='$($administratorsGroup.name)'`"" - [array]$usersList = $groupUsers.partcomponent | ForEach-Object { (($_ -replace '.*Win32_UserAccount.Domain="', "") -replace '",Name="', "\") -replace '"', '' } - $users += $usersList | Where-Object {$_ -match $env:COMPUTERNAME} - $accounts += $users | ForEach-Object {(Get-CimInstance Win32_UserAccount -Filter "Caption='$($_.Replace("\", "\\"))'").SID} - } - Default - { - # To test for identities we have to do a dump of the security database the dump does not specify the - # computerName on local accounts. So we need to test for that scenario. - if ( $_ -match '\\' -and $_ -notmatch 'Builtin') - { - if ( Test-IsLocalAccount -Identity $_ ) - { - $accounts += ( $_ -split '\\' )[-1] - } - else - { - $accounts += ConvertTo-LocalFriendlyName $_ - } - } - elseif( ($_ -match 'Builtin\\') -or ($_ -match 'NT Authority\\') -or ($_ -match 'NT Service\\') -or ($_ -match 'Window Manager\\') ) - { - $accounts += $_ - } - else - { - $accounts += ConvertTo-LocalFriendlyName $(($_) -replace '\*') - } - } - } - - if ($Ensure -eq "Present") - { - $usersWithoutRight = $accounts | Where-Object { $_ -notin $currentUserRights.Identity } - if ($usersWithoutRight) - { - Write-Verbose "$($usersWithoutRight -join ",") do not have Privilege ($Policy)" - return $false - } - - if ($Force) - { - $effectiveUsers = $currentUserRights.Identity | Where-Object {$_ -notin $accounts} - if ($effectiveUsers.Count -gt 0) - { - Write-Verbose "$($effectiveUsers -join ",") are extraneous users with Privilege ($Policy)" - return $false - } - } - - $returnValue = $true - } - else - { - $UsersWithRight = $accounts | Where-Object {$_ -in $userRights.Identity} - if ($UsersWithRight.Count -gt 0) - { - Write-Verbose "$($UsersWithRight) should NOT have Privilege ($Policy)" - return $false - } - - $returnValue = $true - } - - # If the code made it this far all identities have the desired user rights - return $returnValue -} - -<# - .SYNOPSIS - Returns an object of the identities assigned to a user rights assignment - .PARAMETER Name - Name of the policy to inspect - .EXAMPLE - Get-UserRightPolicy -Name Create_a_token_object -#> -function Get-UserRightPolicy -{ - [OutputType([PSObject])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet( - "Create_a_token_object", - "Access_this_computer_from_the_network", - "Change_the_system_time", - "Deny_log_on_as_a_batch_job", - "Deny_log_on_through_Remote_Desktop_Services", - "Create_global_objects", - "Remove_computer_from_docking_station", - "Deny_access_to_this_computer_from_the_network", - "Act_as_part_of_the_operating_system", - "Modify_firmware_environment_values", - "Deny_log_on_locally", - "Access_Credential_Manager_as_a_trusted_caller", - "Restore_files_and_directories", - "Change_the_time_zone", - "Replace_a_process_level_token", - "Manage_auditing_and_security_log", - "Create_symbolic_links", - "Modify_an_object_label", - "Enable_computer_and_user_accounts_to_be_trusted_for_delegation", - "Generate_security_audits", - "Increase_a_process_working_set", - "Take_ownership_of_files_or_other_objects", - "Bypass_traverse_checking", - "Log_on_as_a_service", - "Shut_down_the_system", - "Lock_pages_in_memory", - "Impersonate_a_client_after_authentication", - "Profile_system_performance", - "Debug_programs", - "Profile_single_process", - "Allow_log_on_through_Remote_Desktop_Services", - "Allow_log_on_locally", - "Increase_scheduling_priority", - "Synchronize_directory_service_data", - "Add_workstations_to_domain", - "Adjust_memory_quotas_for_a_process", - "Obtain_an_impersonation_token_for_another_user_in_the_same_session", - "Perform_volume_maintenance_tasks", - "Load_and_unload_device_drivers", - "Force_shutdown_from_a_remote_system", - "Back_up_files_and_directories", - "Create_a_pagefile", - "Deny_log_on_as_a_service", - "Log_on_as_a_batch_job", - "Create_permanent_shared_objects" - )] - [System.String] - $Name - ) - - $userRightConstant = Get-UserRightConstant -Policy $Name - - $userRights = Get-SecurityPolicy -Area 'USER_RIGHTS' - - [PSObject]@{ - Constant = $userRightConstant - FriendlyName = $Name - Identity = $userRights[$userRightConstant] - } -} - -<# - .SYNOPSIS - Converts policy names that match the GUI to the abbreviated names used by secedit.exe - .PARAMETER Policy - Name of the policy to get friendly name for. -#> -function Get-UserRightConstant -{ - [OutputType([string])] - [CmdletBinding()] - Param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Policy - ) - - $friendlyNames = Get-Content -Path $PSScriptRoot\UserRightsFriendlyNameConversions.psd1 -Raw | - ConvertFrom-StringData - - $friendlyNames[$Policy] -} - -<# - .SYNOPSIS - Creates Inf with desired configuration for a user rights assignment that is passed to secedit.exe - .PARAMETER InfPolicy - Name of user rights assignment policy - .PARAMETER UserList - List of users to be added to policy - .PARAMETER FilePath - Path to where the Inf will be created - .EXAMPLE - Out-UserRightsInf -InfPolicy SeTrustedCredManAccessPrivilege -UserList Contoso\User1 -FilePath C:\Scratch\Secedit.Inf -#> -function Out-UserRightsInf -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $InfPolicy, - - [Parameter(Mandatory = $true)] - [AllowEmptyString()] - [AllowNull()] - [System.String] - $UserList, - - [Parameter(Mandatory = $true)] - [System.String] - $FilePath - ) - - $infTemplate =@" -[Unicode] -Unicode=yes -[Privilege Rights] -$InfPolicy = $UserList -[Version] -signature="`$CHICAGO`$" -Revision=1 -"@ - - $null = Out-File -InputObject $infTemplate -FilePath $FilePath -Encoding unicode -} -<# - .SYNOPSIS - Test if an account is a local account - .PARAMETER Identity - The identity of the user or group to be added or removed from the user rights assignment -#> -function Test-IsLocalAccount -{ - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Identity - ) - - $localAccounts = Get-CimInstance Win32_UserAccount -Filter "LocalAccount='True'" - - if ( $localAccounts.Caption -contains $Identity ) - { - return $true - } - else - { - return $false - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_UserRightsAssignment/MSFT_UserRightsAssignment.schema.mof b/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_UserRightsAssignment/MSFT_UserRightsAssignment.schema.mof deleted file mode 100644 index 47b5abfb..00000000 --- a/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_UserRightsAssignment/MSFT_UserRightsAssignment.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("UserRightsAssignment")] -class MSFT_UserRightsAssignment : OMI_BaseResource -{ - [Key, Description("The policy name of the user rights assignment to be configured."), ValueMap{"Create_a_token_object","Access_this_computer_from_the_network","Change_the_system_time","Deny_log_on_as_a_batch_job","Deny_log_on_through_Remote_Desktop_Services","Create_global_objects","Remove_computer_from_docking_station","Deny_access_to_this_computer_from_the_network","Act_as_part_of_the_operating_system","Modify_firmware_environment_values","Deny_log_on_locally","Access_Credential_Manager_as_a_trusted_caller","Restore_files_and_directories","Change_the_time_zone","Replace_a_process_level_token","Manage_auditing_and_security_log","Create_symbolic_links","Modify_an_object_label","Enable_computer_and_user_accounts_to_be_trusted_for_delegation","Generate_security_audits","Increase_a_process_working_set","Take_ownership_of_files_or_other_objects","Bypass_traverse_checking","Log_on_as_a_service","Shut_down_the_system","Lock_pages_in_memory","Impersonate_a_client_after_authentication","Profile_system_performance","Debug_programs","Profile_single_process","Allow_log_on_through_Remote_Desktop_Services","Allow_log_on_locally","Increase_scheduling_priority","Synchronize_directory_service_data","Add_workstations_to_domain","Adjust_memory_quotas_for_a_process","Obtain_an_impersonation_token_for_another_user_in_the_same_session","Perform_volume_maintenance_tasks","Load_and_unload_device_drivers","Force_shutdown_from_a_remote_system","Back_up_files_and_directories","Create_a_pagefile","Deny_log_on_as_a_service","Log_on_as_a_batch_job","Create_permanent_shared_objects"}, Values{"Create_a_token_object","Access_this_computer_from_the_network","Change_the_system_time","Deny_log_on_as_a_batch_job","Deny_log_on_through_Remote_Desktop_Services","Create_global_objects","Remove_computer_from_docking_station","Deny_access_to_this_computer_from_the_network","Act_as_part_of_the_operating_system","Modify_firmware_environment_values","Deny_log_on_locally","Access_Credential_Manager_as_a_trusted_caller","Restore_files_and_directories","Change_the_time_zone","Replace_a_process_level_token","Manage_auditing_and_security_log","Create_symbolic_links","Modify_an_object_label","Enable_computer_and_user_accounts_to_be_trusted_for_delegation","Generate_security_audits","Increase_a_process_working_set","Take_ownership_of_files_or_other_objects","Bypass_traverse_checking","Log_on_as_a_service","Shut_down_the_system","Lock_pages_in_memory","Impersonate_a_client_after_authentication","Profile_system_performance","Debug_programs","Profile_single_process","Allow_log_on_through_Remote_Desktop_Services","Allow_log_on_locally","Increase_scheduling_priority","Synchronize_directory_service_data","Add_workstations_to_domain","Adjust_memory_quotas_for_a_process","Obtain_an_impersonation_token_for_another_user_in_the_same_session","Perform_volume_maintenance_tasks","Load_and_unload_device_drivers","Force_shutdown_from_a_remote_system","Back_up_files_and_directories","Create_a_pagefile","Deny_log_on_as_a_service","Log_on_as_a_batch_job","Create_permanent_shared_objects"}] String Policy; - [Required, Description("The identity of the user or group to be added or removed from the user rights assignment.")] String Identity[]; - [Write, Description("Specifies whether to Force the change")] Boolean Force; - [Write, Description("Desired state of resource."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; -}; diff --git a/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_UserRightsAssignment/UserRightsFriendlyNameConversions.psd1 b/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_UserRightsAssignment/UserRightsFriendlyNameConversions.psd1 deleted file mode 100644 index 28618e20..00000000 --- a/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_UserRightsAssignment/UserRightsFriendlyNameConversions.psd1 +++ /dev/null @@ -1,45 +0,0 @@ -Access_Credential_Manager_as_a_trusted_caller = SeTrustedCredManAccessPrivilege -Access_this_computer_from_the_network = SeNetworkLogonRight -Act_as_part_of_the_operating_system = SeTcbPrivilege -Add_workstations_to_domain = SeMachineAccountPrivilege -Adjust_memory_quotas_for_a_process = SeIncreaseQuotaPrivilege -Allow_log_on_locally = SeInteractiveLogonRight -Allow_log_on_through_Remote_Desktop_Services = SeRemoteInteractiveLogonRight -Back_up_files_and_directories = SeBackupPrivilege -Bypass_traverse_checking = SeChangeNotifyPrivilege -Change_the_system_time = SeSystemtimePrivilege -Change_the_time_zone = SeTimeZonePrivilege -Create_a_pagefile = SeCreatePagefilePrivilege -Create_a_token_object = SeCreateTokenPrivilege -Create_global_objects = SeCreateGlobalPrivilege -Create_permanent_shared_objects = SeCreatePermanentPrivilege -Create_symbolic_links = SeCreateSymbolicLinkPrivilege -Debug_programs = SeDebugPrivilege -Deny_access_to_this_computer_from_the_network = SeDenyNetworkLogonRight -Deny_log_on_as_a_batch_job = SeDenyBatchLogonRight -Deny_log_on_as_a_service = SeDenyServiceLogonRight -Deny_log_on_locally = SeDenyInteractiveLogonRight -Deny_log_on_through_Remote_Desktop_Services = SeDenyRemoteInteractiveLogonRight -Enable_computer_and_user_accounts_to_be_trusted_for_delegation = SeEnableDelegationPrivilege -Force_shutdown_from_a_remote_system = SeRemoteShutdownPrivilege -Generate_security_audits = SeAuditPrivilege -Impersonate_a_client_after_authentication = SeImpersonatePrivilege -Increase_a_process_working_set = SeIncreaseWorkingSetPrivilege -Increase_scheduling_priority = SeIncreaseBasePriorityPrivilege -Load_and_unload_device_drivers = SeLoadDriverPrivilege -Lock_pages_in_memory = SeLockMemoryPrivilege -Log_on_as_a_batch_job = SeBatchLogonRight -Log_on_as_a_service = SeServiceLogonRight -Manage_auditing_and_security_log = SeSecurityPrivilege -Modify_an_object_label = SeRelabelPrivilege -Modify_firmware_environment_values = SeSystemEnvironmentPrivilege -Obtain_an_impersonation_token_for_another_user_in_the_same_session = SeDelegateSessionUserImpersonatePrivilege -Perform_volume_maintenance_tasks = SeManageVolumePrivilege -Profile_single_process = SeProfileSingleProcessPrivilege -Profile_system_performance = SeSystemProfilePrivilege -Remove_computer_from_docking_station = SeUndockPrivilege -Replace_a_process_level_token = SeAssignPrimaryTokenPrivilege -Restore_files_and_directories = SeRestorePrivilege -Shut_down_the_system = SeShutdownPrivilege -Synchronize_directory_service_data = SeSyncAgentPrivilege -Take_ownership_of_files_or_other_objects = SeTakeOwnershipPrivilege diff --git a/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_UserRightsAssignment/en-US/MSFT_UserRightsAssignment.strings.psd1 b/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_UserRightsAssignment/en-US/MSFT_UserRightsAssignment.strings.psd1 deleted file mode 100644 index 23e901e8..00000000 --- a/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/MSFT_UserRightsAssignment/en-US/MSFT_UserRightsAssignment.strings.psd1 +++ /dev/null @@ -1,13 +0,0 @@ -ConvertFrom-StringData @' - IdentityIsNullRemovingAll = Identity is NULL. Removing all Identities from {0} - GrantingPolicyRightsToIds = Granting {0} rights to {1} - TaskSuccess = Task successfully completed - TaskFail = Task did not complete successfully - TestIdentityIsPresentOnPolicy = Testing {0} is present on policy {1} - NoIdentitiesFoundOnPolicy = No identities found on {0} - IdNotFoundOnPolicy = {0} not found on {1} - ErrorCantTranslateSID = Error processing {0}. Error message: {1} - EchoDebugInf = Temp inf {0} - IdentityFoundExpectedNull = Identity found on {0}. Expected NULL - IdentityNotSpecified = An Identity must be sepcified even if it is NULL -'@ diff --git a/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/SecurityPolicyResourceHelper/SecurityPolicyResourceHelper.psm1 b/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/SecurityPolicyResourceHelper/SecurityPolicyResourceHelper.psm1 deleted file mode 100644 index 86302c66..00000000 --- a/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/SecurityPolicyResourceHelper/SecurityPolicyResourceHelper.psm1 +++ /dev/null @@ -1,322 +0,0 @@ - -<# - .SYNOPSIS - Retrieves the localized string data based on the machine's culture. - Falls back to en-US strings if the machine's culture is not supported. - - .PARAMETER ResourceName - The name of the resource as it appears before '.strings.psd1' of the localized string file. - For example: - AuditPolicySubcategory: MSFT_AuditPolicySubcategory - AuditPolicyOption: MSFT_AuditPolicyOption -#> -function Get-LocalizedData -{ - [OutputType([String])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true, ParameterSetName = 'resource')] - [ValidateNotNullOrEmpty()] - [String] - $ResourceName, - - [Parameter(Mandatory = $true, ParameterSetName = 'helper')] - [ValidateNotNullOrEmpty()] - [String] - $HelperName - ) - - # With the helper module just update the name and path variables as if it were a resource. - if ($PSCmdlet.ParameterSetName -eq 'helper') - { - $resourceDirectory = $PSScriptRoot - $ResourceName = $HelperName - } - else - { - # Step up one additional level to build the correct path to the resource culture. - $resourceDirectory = Join-Path -Path ( Split-Path $PSScriptRoot -Parent ) ` - -ChildPath $ResourceName - } - - $localizedStringFileLocation = Join-Path -Path $resourceDirectory -ChildPath $PSUICulture - - if (-not (Test-Path -Path $localizedStringFileLocation)) - { - # Fallback to en-US - - $localizedStringFileLocation = Join-Path -Path $resourceDirectory -ChildPath 'en-US' - } - - Import-LocalizedData ` - -BindingVariable 'localizedData' ` - -FileName "$ResourceName.strings.psd1" ` - -BaseDirectory $localizedStringFileLocation - - return $localizedData -} - -<# - .SYNOPSIS - Wrapper around secedit.exe used to make changes - .PARAMETER UserRightsToAddInf - Path to an INF file with desired user rights assignment policy configuration - .PARAMETER SeceditOutput - Path to secedit log file output - .EXAMPLE - Invoke-Secedit -UserRightsToAddInf C:\secedit.inf -SeceditOutput C:\seceditLog.txt -#> -function Invoke-Secedit -{ - [OutputType([void])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $UserRightsToAddInf, - - [Parameter(Mandatory = $true)] - [System.String] - $SeceditOutput, - - [Parameter()] - [System.Management.Automation.SwitchParameter] - $OverWrite - ) - - $script:localizedData = Get-LocalizedData -HelperName 'SecurityPolicyResourceHelper' - - $tempDB = "$env:TEMP\DscSecedit.sdb" - $arguments = "/configure /db $tempDB /cfg $userRightsToAddInf" - - if ($OverWrite) - { - $arguments = $arguments + " /overwrite /quiet" - } - - Start-Process -FilePath secedit.exe -ArgumentList $arguments -RedirectStandardOutput $seceditOutput -NoNewWindow -Wait -} - -function Get-SecurityPolicy -{ - [OutputType([Hashtable])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet("SECURITYPOLICY","GROUP_MGMT","USER_RIGHTS","REGKEYS","FILESTORE","SERVICES")] - [System.String] - $Area - ) - - $currentSecurityPolicyFilePath = Join-Path -Path $env:temp -ChildPath 'SecurityPolicy.inf' - Write-Debug -Message ($localizedData.EchoDebugInf -f $currentSecurityPolicyFilePath) - - secedit.exe /export /cfg $currentSecurityPolicyFilePath /areas $Area | Out-Null - - $policyConfiguration = @{} - switch -regex -file $currentSecurityPolicyFilePath - { - "^\[(.+)\]" # Section - { - $section = $matches[1] - $policyConfiguration[$section] = @{} - $CommentCount = 0 - } - "^(;.*)$" # Comment - { - $value = $matches[1] - $commentCount = $commentCount + 1 - $name = "Comment" + $commentCount - $policyConfiguration[$section][$name] = $value - } - "(.+?)\s*=(.*)" # Key - { - $name,$value = $matches[1..2] -replace "\*" - $policyConfiguration[$section][$name] = @(ConvertTo-LocalFriendlyName $($value -split ',')) - } - } - - Switch($Area) - { - "USER_RIGHTS" - { - $returnValue = $policyConfiguration.'Privilege Rights' - continue - } - } - - # Cleanup the temp file - Remove-Item -Path $currentSecurityPolicyFilePath - - return $returnValue -} - -<# - .SYNOPSIS - Parses an INF file produced by 'secedit.exe /export' and returns an object of identites assigned to a user rights assignment policy - .PARAMETER FilePath - Path to an INF file - .EXAMPLE - Get-UserRightsAssignment -FilePath C:\seceditOutput.inf -#> -function Get-UserRightsAssignment -{ - [OutputType([Hashtable])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $FilePath - ) - - $policyConfiguration = @{} - switch -regex -file $FilePath - { - "^\[(.+)\]" # Section - { - $section = $matches[1] - $policyConfiguration[$section] = @{} - $CommentCount = 0 - } - "^(;.*)$" # Comment - { - $value = $matches[1] - $commentCount = $commentCount + 1 - $name = "Comment" + $commentCount - $policyConfiguration[$section][$name] = $value - } - "(.+?)\s*=(.*)" # Key - { - $name,$value = $matches[1..2] -replace "\*" - $policyConfiguration[$section][$name] = @(ConvertTo-LocalFriendlyName $($value -split ',')) - } - } - return $policyConfiguration -} - -<# - .SYNOPSIS - Converts SID to a friendly name - .PARAMETER SID - SID of an identity being converted - .EXAMPLE - ConvertTo-LocalFriendlyName -SID 'S-1-5-21-3623811015-3361044348-30300820-1013' -#> -function ConvertTo-LocalFriendlyName -{ - [OutputType([String[]])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.String[]] - $SID - ) - - $localizedData = Get-LocalizedData -HelperName 'SecurityPolicyResourceHelper' - - $friendlyNames = [String[]]@() - - foreach ($id in $SID) - { - $id = $id.Trim() - - Write-Verbose "Received Identity ($id)" - if ($null -ne $id -and $id -match '^(S-[0-9-]{3,})') - { - try - { - Write-Verbose -Message ($localizedData:TranslateID -f $id) - $securityIdentifier = [System.Security.Principal.SecurityIdentifier]($id) - $user = $securityIdentifier.Translate([System.Security.Principal.NTAccount]) - $friendlyNames += $user.value - Write-Verbose -Message ($localizedData:IdTranslatesTo -f $id,$user.Value) - } - catch - { - Write-Warning -Message ($localizedData.ErrorCantTranslateSID -f $id, $($_.Exception.Message) ) - } - } - elseIf ( ( Get-DomainRole ) -eq 'DomainController') - { - $friendlyNames += "$($env:USERDOMAIN + '\' + $($id))" - } - elseIf ($id -notmatch '^S-') - { - $friendlyNames += "$($id)" - } - } - - return $friendlyNames -} - -<# - .SYNOPSIS - Converts int value from the Win32_ComputerSystem class into its text equivalent -#> -function Get-DomainRole -{ - [OutputType([String])] - [CmdletBinding()] - param() - - $domainRoleInt = (Get-CimInstance -ClassName Win32_ComputerSystem).DomainRole - - if ($domainRoleInt -eq 0) - { - $domainRole = 'StandaloneWorkstation' - } - elseif($domainRoleInt -eq 1) - { - $domainRole = 'MemberWorkstation' - } - elseif($domainRoleInt -eq 2) - { - $domainRole = 'StandaloneServer' - } - elseif($domainRoleInt -eq 3) - { - $domainRole = 'MemberServer' - } - else - { - $domainRole = 'DomainController' - } - - return $domainRole -} - - -<# - .SYNOPSIS - Tests if the provided Identity is null - .PARAMETER Identity - The identity string to test -#> -function Test-IdentityIsNull -{ - [OutputType([bool])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [AllowEmptyCollection()] - [AllowEmptyString()] - [AllowNull()] - [System.String[]] - $Identity - ) - - if ( $null -eq $Identity -or [System.String]::IsNullOrWhiteSpace($Identity) ) - { - return $true - } - else - { - return $false - } -} diff --git a/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/SecurityPolicyResourceHelper/en-US/SecurityPolicyResourceHelper.strings.psd1 b/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/SecurityPolicyResourceHelper/en-US/SecurityPolicyResourceHelper.strings.psd1 deleted file mode 100644 index 481ad542..00000000 --- a/lib/puppet_x/dsc_resources/SecurityPolicyDsc/DSCResources/SecurityPolicyResourceHelper/en-US/SecurityPolicyResourceHelper.strings.psd1 +++ /dev/null @@ -1,6 +0,0 @@ -ConvertFrom-StringData @' - EchoDebugInf = Temp inf {0} - ErrorCantTranslateSID = Error processing {0}. Error message: {1} - TranslateID = Translating Identity ({0}) - IdTranslatesTo = Identity ({0}) is equal to $({1})" -'@ diff --git a/lib/puppet_x/dsc_resources/SecurityPolicyDsc/LICENSE b/lib/puppet_x/dsc_resources/SecurityPolicyDsc/LICENSE deleted file mode 100644 index 9f66f02b..00000000 --- a/lib/puppet_x/dsc_resources/SecurityPolicyDsc/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Microsoft Corporation - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/lib/puppet_x/dsc_resources/SecurityPolicyDsc/SecurityPolicyDsc.psd1 b/lib/puppet_x/dsc_resources/SecurityPolicyDsc/SecurityPolicyDsc.psd1 deleted file mode 100644 index 779c8d3a..00000000 --- a/lib/puppet_x/dsc_resources/SecurityPolicyDsc/SecurityPolicyDsc.psd1 +++ /dev/null @@ -1,63 +0,0 @@ -# -# Module manifest for module 'SecurityPolicyDsc' -# -# Generated by: Jason Walker -# -# Generated on: 12/29/2015 -# - -@{ - -# Version number of this module. -ModuleVersion = '1.5.0.0' - -# ID used to uniquely identify this module -GUID = 'e2b73194-69ef-4fa6-b949-9f62ebe04989' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2016 Microsoft. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'This module is a wrapper around secedit.exe which provides the ability to configure user rights assignments' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource', 'Secedit','SecurityPolicyDsc') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/SecurityPolicyDsc/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/SecurityPolicyDsc' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - ReleaseNotes = '* Refactored user rights assignment to read and test easier. - -' - - } # End of PSData hashtable - -} # End of PrivateData hashtable - -} - - - - - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAccessServiceApp/MSFT_SPAccessServiceApp.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAccessServiceApp/MSFT_SPAccessServiceApp.psm1 deleted file mode 100644 index 00e023f1..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAccessServiceApp/MSFT_SPAccessServiceApp.psm1 +++ /dev/null @@ -1,194 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting Access Services service app '$Name'" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue - $nullReturn = @{ - Name = $params.Name - ApplicationPool = $params.ApplicationPool - DatabaseServer = $params.DatabaseServer - Ensure = "Absent" - InstallAccount = $params.InstallAccount - } - if ($null -eq $serviceApps) - { - return $nullReturn - } - $serviceApp = $serviceApps | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Access.Services.MossHost.AccessServicesWebServiceApplication" - } - - if ($null -eq $serviceApp) - { - return $nullReturn - } - else - { - ### Find database server name - $context = [Microsoft.SharePoint.SPServiceContext]::GetContext($serviceApp.ServiceApplicationProxyGroup, [Microsoft.SharePoint.SPSiteSubscriptionIdentifier]::Default) - $dbserver = (Get-SPAccessServicesDatabaseServer $context).ServerName - return @{ - Name = $serviceApp.DisplayName - DatabaseServer = $dbserver - ApplicationPool = $serviceApp.ApplicationPool.Name - Ensure = "Present" - } - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting Access Services service app '$Name'" - - $result = Get-TargetResource @PSBoundParameters - - if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") - { - Write-Verbose -Message "Creating Access Services Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - - $params = $args[0] - - $app = New-SPAccessServicesApplication -Name $params.Name ` - -ApplicationPool $params.ApplicationPool ` - -Default ` - -DatabaseServer $params.DatabaseServer - - $app | New-SPAccessServicesApplicationProxy | Out-Null - } - } - if ($Ensure -eq "Absent") - { - Write-Verbose -Message "Removing Access Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - - $params = $args[0] - - $app = Get-SPServiceApplication -Name $params.Name | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Access.Services.MossHost.AccessServicesWebServiceApplication" - } - - $proxies = Get-SPServiceApplicationProxy - foreach($proxyInstance in $proxies) - { - if($app.IsConnected($proxyInstance)) - { - $proxyInstance.Delete() - } - } - - Remove-SPServiceApplication -Identity $app -Confirm:$false - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing for Access Service Application '$Name'" - - $PSBoundParameters.Ensure = $Ensure - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($CurrentValues.DatabaseServer -ne $DatabaseServer) - { - Write-Verbose -Message ("Specified database server does not match the actual " + ` - "database server. This resource cannot move the database " + ` - "to a different SQL instance.") - return $false - } - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAccessServiceApp/MSFT_SPAccessServiceApp.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAccessServiceApp/MSFT_SPAccessServiceApp.schema.mof deleted file mode 100644 index 0539bc63..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAccessServiceApp/MSFT_SPAccessServiceApp.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPAccessServiceApp")] -class MSFT_SPAccessServiceApp : OMI_BaseResource -{ - [Key, Description("The name of the service application")] string Name; - [Required, Description("The name of the application pool to run the service app in")] string ApplicationPool; - [Required, Description("The name of the database server to host Access Services databases")] string DatabaseServer; - [Write, Description("Present ensures service app exists, absent ensures it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAccessServices2010/MSFT_SPAccessServices2010.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAccessServices2010/MSFT_SPAccessServices2010.psm1 deleted file mode 100644 index 286f9ddd..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAccessServices2010/MSFT_SPAccessServices2010.psm1 +++ /dev/null @@ -1,185 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting Access 2010 Service app '$Name'" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - $serviceApps = Get-SPServiceApplication -Name $params.Name ` - -ErrorAction SilentlyContinue - $nullReturn = @{ - Name = $params.Name - ApplicationPool = $params.ApplicationPool - Ensure = "Absent" - } - if($null -eq $serviceApps) - { - return $nullReturn - } - - $serviceApp = $serviceApps | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Access.Server.MossHost.AccessServerWebServiceApplication" - } - - if($null -eq $serviceApp) - { - return $nullReturn - } - else - { - return @{ - Name = $serviceApp.DisplayName - ApplicationPool = $serviceApp.ApplicationPool.Name - Ensure = "Present" - InstallAccount = $params.InstallAccount - } - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting Access 2010 Services app '$Name'" - $result = Get-TargetResource @PSBoundParameters - - if($result.Ensure -eq "Absent" -and $Ensure -eq "Present") - { - Write-Verbose "Creating Access 2010 Service Application '$Name'" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - $accessApp = New-SPAccessServiceApplication -Name $params.Name ` - -ApplicationPool $params.ApplicationPool - } - } - if($result.Ensure -eq "Present" -and $Ensure -eq "Present") - { - Write-Verbose "Updating Access 2010 service application '$Name'" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - $apps = Get-SPServiceApplication -Name $params.Name ` - -ErrorAction SilentlyContinue - if($null -ne $apps) - { - $app = $apps | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Access.Server.MossHost.AccessServerWebServiceApplication" - } - if($null -ne $app) - { - $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool - if($null -ne $appPool) - { - $app.ApplicationPool = $appPool - $app.Update() - return; - } - } - } - - $accessApp = New-SPAccessServiceApplication -Name $params.Name ` - -ApplicationPool $params.ApplicationPool - } - } - if($Ensure -eq "Absent") - { - Write-Verbose "Removing Access 2010 service application '$Name'" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $apps = Get-SPServiceApplication -Name $params.Name ` - -ErrorAction SilentlyContinue - if($null -eq $apps) - { - return - } - - $app = $apps | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Access.Server.MossHost.AccessServerWebServiceApplication" - } - - if($null -ne $app) - { - Remove-SPServiceApplication -Identity $app -Confirm:$false - } - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [System.Management.Automation.PSCredential] - $InstallAccount - ) - Write-Verbose -Message "Testing Access 2010 service app '$Name'" - - $PSBoundParameters.Ensure = $Ensure - $CurrentValues = Get-TargetResource @PSBoundParameters - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Name", "ApplicationPool", "Ensure") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAccessServices2010/MSFT_SPAccessServices2010.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAccessServices2010/MSFT_SPAccessServices2010.schema.mof deleted file mode 100644 index 9d5e21e6..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAccessServices2010/MSFT_SPAccessServices2010.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("SPAccessServices2010")] -class MSFT_SPAccessServices2010 : OMI_BaseResource -{ - [Key, Description("The name of the service application")] String Name; - [Required, Description("The name of the application pool to run the service app in")] String ApplicationPool; - [Write, Description("Present ensures service app exists, absent ensures it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, EmbeddedInstance("MSFT_Credential"), Description("POWERSHELL 4 ONLY: The account to run thsi resource as, use PsDscRunAsCredential if using PowerShell 5")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAlternateUrl/MSFT_SPAlternateUrl.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAlternateUrl/MSFT_SPAlternateUrl.psm1 deleted file mode 100644 index fb69fa0b..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAlternateUrl/MSFT_SPAlternateUrl.psm1 +++ /dev/null @@ -1,192 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $true)] - [ValidateSet("Default","Intranet","Extranet","Custom","Internet")] - [System.String] - $Zone, - - [parameter(Mandatory = $false)] - [System.String] - $Url, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting Alternate URL for $Zone in $WebAppUrl" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $aam = Get-SPAlternateURL -WebApplication $params.WebAppUrl ` - -Zone $params.Zone ` - -ErrorAction SilentlyContinue | Select-Object -First 1 - $url = $null - $Ensure = "Absent" - - if (($null -eq $aam) -and ($params.Zone -eq "Default")) - { - # The default zone URL will change the URL of the web app, so assuming it has been applied - # correctly then the first call there will fail as the WebAppUrl parameter will no longer - # be the URL of the web app. So the assumption is that if a matching default entry with - # the new public URL is found then it can be returned and will pass a test. - $aam = Get-SPAlternateURL -Zone $params.Zone | Where-Object -FilterScript { - $_.PublicUrl -eq $params.Url - } | Select-Object -First 1 - } - - if ($null -ne $aam) { - $url = $aam.PublicUrl - $Ensure = "Present" - } - - return @{ - WebAppUrl = $params.WebAppUrl - Zone = $params.Zone - Url = $url - Ensure = $Ensure - InstallAccount = $params.InstallAccount - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $true)] - [ValidateSet("Default","Intranet","Extranet","Custom","Internet")] - [System.String] - $Zone, - - [parameter(Mandatory = $false)] - [System.String] - $Url, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - - ) - - Write-Verbose -Message "Setting Alternate URL for $Zone in $WebAppUrl" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($Ensure -eq "Present") - { - if ([string]::IsNullOrEmpty($Url)) - { - throw "URL must be specified when ensure is set to present" - } - - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments ($PSBoundParameters, $CurrentValues) ` - -ScriptBlock { - $params = $args[0] - $CurrentValues = $args[1] - - if ([string]::IsNullOrEmpty($CurrentValues.Url)) - { - New-SPAlternateURL -WebApplication $params.WebAppUrl ` - -Url $params.Url ` - -Zone $params.Zone - } - else - { - Get-SPAlternateURL -WebApplication $params.WebAppUrl ` - -Zone $params.Zone | Set-SPAlternateURL -Url $params.Url - } - } - } - else - { - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - Get-SPAlternateURL -WebApplication $params.WebAppUrl ` - -Zone $params.Zone | Remove-SPAlternateURL -Confirm:$false - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $true)] - [ValidateSet("Default","Intranet","Extranet","Custom","Internet")] - [System.String] - $Zone, - - [parameter(Mandatory = $false)] - [System.String] - $Url, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - - ) - - Write-Verbose -Message "Testing Alternate URL for $Zone in $WebAppUrl" - - $PSBoundParameters.Ensure = $Ensure - - if ([string]::IsNullOrEmpty($Url) -and $Ensure -eq "Present") - { - throw "URL must be specified when ensure is set to present" - } - - if ($Ensure -eq "Present") - { - return Test-SPDscParameterState -CurrentValues (Get-TargetResource @PSBoundParameters) ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Url", "Ensure") - } - else - { - return Test-SPDscParameterState -CurrentValues (Get-TargetResource @PSBoundParameters) ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") - } -} diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAlternateUrl/MSFT_SPAlternateUrl.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAlternateUrl/MSFT_SPAlternateUrl.schema.mof deleted file mode 100644 index f7fb4f87..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAlternateUrl/MSFT_SPAlternateUrl.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPAlternateUrl")] -class MSFT_SPAlternateUrl : OMI_BaseResource -{ - [Key, Description("The URL of the web application to apply the alternate URL to")] String WebAppUrl; - [Key, Description("The Zone to use for the alternate URL"), ValueMap{"Default","Intranet","Extranet","Custom","Internet"}, Values{"Default","Intranet","Extranet","Custom","Internet"}] String Zone; - [Write, Description("The new alternate URL")] String Url; - [Write, Description("Present ensures the URL is set for this zone on this web app, Absent ensures it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAntivirusSettings/MSFT_SPAntivirusSettings.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAntivirusSettings/MSFT_SPAntivirusSettings.psm1 deleted file mode 100644 index 5d522b19..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAntivirusSettings/MSFT_SPAntivirusSettings.psm1 +++ /dev/null @@ -1,206 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.Boolean] - $ScanOnDownload, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ScanOnUpload, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowDownloadInfected, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AttemptToClean, - - [parameter(Mandatory = $false)] - [System.UInt16] - $TimeoutDuration, - - [parameter(Mandatory = $false)] - [System.UInt16] - $NumberOfThreads, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting antivirus configuration settings" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - try - { - $spFarm = Get-SPFarm - } - catch - { - Write-Verbose -Message ("No local SharePoint farm was detected. Antivirus " + ` - "settings will not be applied") - return @{ - # Set the antivirus settings - AllowDownloadInfected = $false - ScanOnDownload = $false - ScanOnUpload = $false - AttemptToClean = $false - NumberOfThreads = 0 - TimeoutDuration = 0 - InstallAccount = $params.InstallAccount - } - } - - # Get a reference to the Administration WebService - $admService = Get-SPDSCContentService - - return @{ - # Set the antivirus settings - AllowDownloadInfected = $admService.AntivirusSettings.AllowDownload - ScanOnDownload = $admService.AntivirusSettings.DownloadScanEnabled - ScanOnUpload = $admService.AntivirusSettings.UploadScanEnabled - AttemptToClean = $admService.AntivirusSettings.CleaningEnabled - NumberOfThreads = $admService.AntivirusSettings.NumberOfThreads - TimeoutDuration = $admService.AntivirusSettings.Timeout.TotalSeconds - InstallAccount = $params.InstallAccount - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.Boolean] - $ScanOnDownload, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ScanOnUpload, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowDownloadInfected, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AttemptToClean, - - [parameter(Mandatory = $false)] - [System.UInt16] - $TimeoutDuration, - - [parameter(Mandatory = $false)] - [System.UInt16] - $NumberOfThreads, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting antivirus configuration settings" - - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - try - { - $spFarm = Get-SPFarm - } - catch - { - throw "No local SharePoint farm was detected. Antivirus settings will not be applied" - return - } - - Write-Verbose -Message "Start update" - $admService = Get-SPDSCContentService - - # Set the antivirus settings - if ($params.ContainsKey("AllowDownloadInfected")) - { - Write-Verbose -Message "Setting Allow Download" - $admService.AntivirusSettings.AllowDownload = $params.AllowDownloadInfected - } - if ($params.ContainsKey("ScanOnDownload")) - { - $admService.AntivirusSettings.DownloadScanEnabled = $params.ScanOnDownload - } - if ($params.ContainsKey("ScanOnUpload")) - { - $admService.AntivirusSettings.UploadScanEnabled = $params.ScanOnUpload - } - if ($params.ContainsKey("AttemptToClean")) - { - $admService.AntivirusSettings.CleaningEnabled = $params.AttemptToClean - } - if ($params.ContainsKey("NumberOfThreads")) - { - $admService.AntivirusSettings.NumberOfThreads = $params.NumberOfThreads - } - if ($params.ContainsKey("TimeoutDuration")) - { - $timespan = New-TimeSpan -Seconds $params.TimeoutDuration - $admService.AntivirusSettings.Timeout = $timespan - } - $admService.Update() - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.Boolean] - $ScanOnDownload, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ScanOnUpload, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowDownloadInfected, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AttemptToClean, - - [parameter(Mandatory = $false)] - [System.UInt16] - $TimeoutDuration, - - [parameter(Mandatory = $false)] - [System.UInt16] - $NumberOfThreads, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing antivirus configuration settings" - - return Test-SPDscParameterState -CurrentValues (Get-TargetResource @PSBoundParameters) ` - -DesiredValues $PSBoundParameters -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAntivirusSettings/MSFT_SPAntivirusSettings.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAntivirusSettings/MSFT_SPAntivirusSettings.schema.mof deleted file mode 100644 index 46e3b4aa..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAntivirusSettings/MSFT_SPAntivirusSettings.schema.mof +++ /dev/null @@ -1,12 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPAntivirusSettings")] -class MSFT_SPAntivirusSettings : OMI_BaseResource -{ - [Key, Description("Should documents be scanned before being downloaded")] Boolean ScanOnDownload; - [Write, Description("Should documents be scanned on upload")] Boolean ScanOnUpload; - [Write, Description("Should documents that are infected be allowed to be downloaded")] Boolean AllowDownloadInfected; - [Write, Description("Should infected documents be handed to the AV engine to attempt cleaning")] Boolean AttemptToClean; - [Write, Description("What is the timeout for an AV scan in seconds")] Uint16 TimeoutDuration; - [Write, Description("How many concurrent threads should the AV engine be able to run on a server")] Uint16 NumberOfThreads; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAppCatalog/MSFT_SPAppCatalog.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAppCatalog/MSFT_SPAppCatalog.psm1 deleted file mode 100644 index 442dbb7b..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAppCatalog/MSFT_SPAppCatalog.psm1 +++ /dev/null @@ -1,105 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $SiteUrl, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting app catalog status of $SiteUrl" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $site = Get-SPSite $params.SiteUrl -ErrorAction SilentlyContinue - $nullreturn = @{ - SiteUrl = $null - InstallAccount = $params.InstallAccount - } - if ($null -eq $site) - { - return $nullreturn - } - $wa = $site.WebApplication - $feature = $wa.Features.Item([Guid]::Parse("f8bea737-255e-4758-ab82-e34bb46f5828")) - if($null -eq $feature) - { - return $nullreturn - } - if ($site.ID -ne $feature.Properties["__AppCatSiteId"].Value) - { - return $nullreturn - } - return @{ - SiteUrl = $site.Url - InstallAccount = $params.InstallAccount - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $SiteUrl, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting app catalog status of $SiteUrl" - - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - try - { - Update-SPAppCatalogConfiguration -Site $params.SiteUrl -Confirm:$false - } - catch [System.UnauthorizedAccessException] - { - throw ("This resource must be run as the farm account (not a setup account). " + ` - "Please ensure either the PsDscRunAsCredential or InstallAccount " + ` - "credentials are set to the farm account and run this resource again") - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $SiteUrl, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing app catalog status of $SiteUrl" - - return Test-SPDscParameterState -CurrentValues (Get-TargetResource @PSBoundParameters) ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("SiteUrl") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAppCatalog/MSFT_SPAppCatalog.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAppCatalog/MSFT_SPAppCatalog.schema.mof deleted file mode 100644 index 8e7fb9af..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAppCatalog/MSFT_SPAppCatalog.schema.mof +++ /dev/null @@ -1,6 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPAppCatalog")] -class MSFT_SPAppCatalog : OMI_BaseResource -{ - [Key, Description("The URL of the site collection that will be the app catalog for the web app that it is in")] string SiteUrl; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAppDomain/MSFT_SPAppDomain.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAppDomain/MSFT_SPAppDomain.psm1 deleted file mode 100644 index f1f2ea2d..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAppDomain/MSFT_SPAppDomain.psm1 +++ /dev/null @@ -1,94 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $AppDomain, - - [parameter(Mandatory = $true)] - [System.String] - $Prefix, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting app domain settings" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - $appDomain = Get-SPAppDomain - $prefix = Get-SPAppSiteSubscriptionName -ErrorAction Continue - - return @{ - AppDomain = $appDomain - Prefix= $prefix - InstallAccount = $params.InstallAccount - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $AppDomain, - - [parameter(Mandatory = $true)] - [System.String] - $Prefix, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting app domain settings" - - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - Set-SPAppDomain $params.AppDomain - Set-SPAppSiteSubscriptionName -Name $params.Prefix -Confirm:$false - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $AppDomain, - - [parameter(Mandatory = $true)] - [System.String] - $Prefix, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting app domain settings" - - return Test-SPDscParameterState -CurrentValues (Get-TargetResource @PSBoundParameters) ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("AppDomain", "Prefix") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAppDomain/MSFT_SPAppDomain.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAppDomain/MSFT_SPAppDomain.schema.mof deleted file mode 100644 index d24a57c9..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAppDomain/MSFT_SPAppDomain.schema.mof +++ /dev/null @@ -1,8 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPAppDomain")] -class MSFT_SPAppDomain : OMI_BaseResource -{ - [Key, Description("The domain name for apps to use in this farm")] string AppDomain; - [Required, Description("The prefix to go on to app URLs")] string Prefix; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; - -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAppManagementServiceApp/MSFT_SPAppManagementServiceApp.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAppManagementServiceApp/MSFT_SPAppManagementServiceApp.psm1 deleted file mode 100644 index 8df5e0a3..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAppManagementServiceApp/MSFT_SPAppManagementServiceApp.psm1 +++ /dev/null @@ -1,262 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $ProxyName, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting App management service app '$Name'" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue - $nullReturn = @{ - Name = $params.Name - ApplicationPool = $params.ApplicationPool - Ensure = "Absent" - InstallAccount = $params.InstallAccount - } - if ($null -eq $serviceApps) { - return $nullReturn - } - $serviceApp = $serviceApps | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.SharePoint.AppManagement.AppManagementServiceApplication" - } - - if ($null -eq $serviceApp) - { - return $nullReturn - } - else - { - $serviceAppProxies = Get-SPServiceApplicationProxy -ErrorAction SilentlyContinue - if ($null -ne $serviceAppProxies) - { - $serviceAppProxy = $serviceAppProxies | Where-Object -FilterScript { - $serviceApp.IsConnected($_) - } - if ($null -ne $serviceAppProxy) - { - $proxyName = $serviceAppProxy.Name - } - } - return @{ - Name = $serviceApp.DisplayName - ProxyName = $proxyName - ApplicationPool = $serviceApp.ApplicationPool.Name - DatabaseName = $serviceApp.Databases.Name - DatabaseServer = $serviceApp.Databases.Server.Name - Ensure = "Present" - InstallAccount = $params.InstallAccount - } - } - } - return $result -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $ProxyName, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting App management service app '$Name'" - - $result = Get-TargetResource @PSBoundParameters - - if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") - { - # The service app doesn't exist but should - - Write-Verbose -Message "Creating App management Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $newParams = @{ - Name = $params.Name - ApplicationPool = $params.ApplicationPool - } - if ($params.ContainsKey("DatabaseName") -eq $true) - { - $newParams.Add("DatabaseName", $params.DatabaseName) - } - if ($params.ContainsKey("DatabaseServer") -eq $true) - { - $newParams.Add("DatabaseServer", $params.DatabaseServer) - } - - $appService = New-SPAppManagementServiceApplication @newParams - if ($null -eq $params.ProxyName) - { - $pName = "$($params.Name) Proxy" - } - else - { - $pName = $params.ProxyName - } - New-SPAppManagementServiceApplicationProxy -Name $pName ` - -UseDefaultProxyGroup ` - -ServiceApplication $appService ` - -ErrorAction Stop | Out-Null - } - } - - if ($result.Ensure -eq "Present" -and $Ensure -eq "Present") - { - # The service app exists but has the wrong application pool - - if ($ApplicationPool -ne $result.ApplicationPool) - { - Write-Verbose -Message "Updating App management Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool - - $app = Get-SPServiceApplication -Name $params.Name | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.SharePoint.AppManagement.AppManagementServiceApplication" - } - $app.ApplicationPool = $appPool - $app.Update() - } - } - } - - if ($Ensure -eq "Absent") - { - # The service app should not exit - Write-Verbose -Message "Removing App management Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $app = Get-SPServiceApplication -Name $params.Name | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.SharePoint.AppManagement.AppManagementServiceApplication" - } - - $proxies = Get-SPServiceApplicationProxy - foreach($proxyInstance in $proxies) - { - if($app.IsConnected($proxyInstance)) - { - $proxyInstance.Delete() - } - } - - Remove-SPServiceApplication -Identity $app -Confirm:$false - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $ProxyName, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing App management service app '$Name'" - - $PSBoundParameters.Ensure = $Ensure - - return Test-SPDscParameterState -CurrentValues (Get-TargetResource @PSBoundParameters) ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ApplicationPool", "Ensure") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAppManagementServiceApp/MSFT_SPAppManagementServiceApp.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAppManagementServiceApp/MSFT_SPAppManagementServiceApp.schema.mof deleted file mode 100644 index 6ab9a697..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAppManagementServiceApp/MSFT_SPAppManagementServiceApp.schema.mof +++ /dev/null @@ -1,12 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPAppManagementServiceApp")] -class MSFT_SPAppManagementServiceApp : OMI_BaseResource -{ - [Key, Description("The name of the app management service application")] string Name; - [Write, Description("The proxy name, if not specified will be /Name of service app/ Proxy")] string ProxyName; - [Required, Description("The app pool that should be used to run the service app")] String ApplicationPool; - [Write, Description("The name of the database for the service application")] string DatabaseName; - [Write, Description("The name of the server for the database")] String DatabaseServer; - [Write, Description("Present ensures service app exists, absent ensures it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAppStoreSettings/MSFT_SPAppStoreSettings.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAppStoreSettings/MSFT_SPAppStoreSettings.psm1 deleted file mode 100644 index bb0d08d4..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAppStoreSettings/MSFT_SPAppStoreSettings.psm1 +++ /dev/null @@ -1,167 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowAppPurchases, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowAppsForOffice, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting app store settings of $WebAppUrl" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $nullreturn = @{ - WebAppUrl = $null - InstallAccount = $params.InstallAccount - } - - $wa = Get-SPWebApplication -Identity $params.WebAppUrl -ErrorAction SilentlyContinue - if ($null -eq $wa) - { - return $nullreturn - } - - $currentAAP = (Get-SPAppAcquisitionConfiguration -WebApplication $params.WebAppUrl).Enabled - $AllowAppPurchases = [System.Convert]::ToBoolean($currentAAP) - $currentAAFO = (Get-SPOfficeStoreAppsDefaultActivation -WebApplication $params.WebAppUrl).Enable - $AllowAppsForOffice = [System.Convert]::ToBoolean($currentAAFO) - - return @{ - WebAppUrl = $params.WebAppUrl - AllowAppPurchases = $AllowAppPurchases - AllowAppsForOffice = $AllowAppsForOffice - InstallAccount = $params.InstallAccount - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowAppPurchases, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowAppsForOffice, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting app store settings of $WebAppUrl" - - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $wa = Get-SPWebApplication -Identity $params.WebAppUrl -ErrorAction SilentlyContinue - if ($null -eq $wa) - { - throw ("Specified web application does not exist.") - } - - if ($params.ContainsKey("AllowAppPurchases")) - { - $current = (Get-SPAppAcquisitionConfiguration -WebApplication $params.WebAppUrl).Enabled - $AllowAppPurchases = [System.Convert]::ToBoolean($current) - if ($AllowAppPurchases -ne $params.AllowAppPurchases) - { - Set-SPAppAcquisitionConfiguration -WebApplication $params.WebAppUrl ` - -Enable $params.AllowAppPurchases - } - } - - if ($params.ContainsKey("AllowAppsForOffice")) - { - $current = (Get-SPOfficeStoreAppsDefaultActivation -WebApplication $params.WebAppUrl).Enable - $AllowAppsForOffice = [System.Convert]::ToBoolean($current) - if ($AllowAppsForOffice -ne $params.AllowAppsForOffice) - { - Set-SPOfficeStoreAppsDefaultActivation -WebApplication $params.WebAppUrl ` - -Enable $params.AllowAppsForOffice - } - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowAppPurchases, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowAppsForOffice, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing app store settings of $WebAppUrl" - - $currentValues = Get-TargetResource @PSBoundParameters - - if ($null -eq $currentValues.WebAppUrl) { - Write-Verbose -Message "Specified web application does not exist." - return $false - } - - if ($PSBoundParameters.ContainsKey("AllowAppPurchases")) - { - if ($AllowAppPurchases -ne $currentValues.AllowAppPurchases) - { - return $false - } - } - - if ($PSBoundParameters.ContainsKey("AllowAppsForOffice")) - { - if ($AllowAppsForOffice -ne $currentValues.AllowAppsForOffice) - { - return $false - } - } - - return $true -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAppStoreSettings/MSFT_SPAppStoreSettings.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAppStoreSettings/MSFT_SPAppStoreSettings.schema.mof deleted file mode 100644 index 90b3455c..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPAppStoreSettings/MSFT_SPAppStoreSettings.schema.mof +++ /dev/null @@ -1,8 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPAppStoreSettings")] -class MSFT_SPAppStoreSettings : OMI_BaseResource -{ - [Key, Description("The URL of the web application")] string WebAppUrl; - [Write, Description("Specifies if App Purchases from the SharePoint Store are allowed")] Boolean AllowAppPurchases; - [Write, Description("Specifies if App Purchases for Office applications are allowed")] Boolean AllowAppsForOffice; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPBCSServiceApp/MSFT_SPBCSServiceApp.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPBCSServiceApp/MSFT_SPBCSServiceApp.psm1 deleted file mode 100644 index 27e034e2..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPBCSServiceApp/MSFT_SPBCSServiceApp.psm1 +++ /dev/null @@ -1,220 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting BCS service app '$Name'" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue - $nullReturn = @{ - Name = $params.Name - ApplicationPool = $params.ApplicationPool - DatabaseName = $null - DatabaseServer = $null - Ensure = "Absent" - InstallAccount = $params.InstallAccount - } - if ($null -eq $serviceApps) - { - return $nullReturn - } - $serviceApp = $serviceApps | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.SharePoint.BusinessData.SharedService.BdcServiceApplication" - } - - if ($null -eq $serviceApp) - { - return $nullReturn - } - else - { - $returnVal = @{ - Name = $serviceApp.DisplayName - ApplicationPool = $serviceApp.ApplicationPool.Name - DatabaseName = $serviceApp.Database.Name - DatabaseServer = $serviceApp.Database.Server.Name - Ensure = "Present" - InstallAccount = $params.InstallAccount - } - return $returnVal - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting BCS service app '$Name'" - - $result = Get-TargetResource @PSBoundParameters - - if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") - { - # The service app doesn't exist but should - - Write-Verbose -Message "Creating BCS Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - New-SPBusinessDataCatalogServiceApplication -Name $params.Name ` - -ApplicationPool $params.ApplicationPool ` - -DatabaseName $params.DatabaseName ` - -DatabaseServer $params.DatabaseServer - } - } - - if ($result.Ensure -eq "Present" -and $Ensure -eq "Present") - { - # The service app exists but has the wrong application pool - - if ($ApplicationPool -ne $result.ApplicationPool) - { - Write-Verbose -Message "Updating BCS Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool - - Get-SPServiceApplication -Name $params.Name ` - | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.SharePoint.BusinessData.SharedService.BdcServiceApplication" - } ` - | Set-SPBusinessDataCatalogServiceApplication -ApplicationPool $appPool - } - } - } - - if ($Ensure -eq "Absent") - { - # The service app should not exit - Write-Verbose -Message "Removing BCS Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $app = Get-SPServiceApplication -Name $params.Name | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.SharePoint.BusinessData.SharedService.BdcServiceApplication" - } - - $proxies = Get-SPServiceApplicationProxy - foreach($proxyInstance in $proxies) - { - if($app.IsConnected($proxyInstance)) - { - $proxyInstance.Delete() - } - } - - Remove-SPServiceApplication -Identity $app -Confirm:$false - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing BCS service app '$Name'" - - $PSBoundParameters.Ensure = $Ensure - - return Test-SPDscParameterState -CurrentValues (Get-TargetResource @PSBoundParameters) ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ApplicationPool", "Ensure") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPBCSServiceApp/MSFT_SPBCSServiceApp.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPBCSServiceApp/MSFT_SPBCSServiceApp.schema.mof deleted file mode 100644 index 3946dcc9..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPBCSServiceApp/MSFT_SPBCSServiceApp.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPBCSServiceApp")] -class MSFT_SPBCSServiceApp : OMI_BaseResource -{ - [Key, Description("The name of the BCS service app")] string Name; - [Required, Description("The application pool it should run in")] String ApplicationPool; - [Write, Description("Name of the database to create for the service app")] string DatabaseName; - [Write, Description("Name of the database server to host the database on")] String DatabaseServer; - [Write, Description("Present ensures service app exists, absent ensures it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPBlobCacheSettings/MSFT_SPBlobCacheSettings.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPBlobCacheSettings/MSFT_SPBlobCacheSettings.psm1 deleted file mode 100644 index 08f4fc80..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPBlobCacheSettings/MSFT_SPBlobCacheSettings.psm1 +++ /dev/null @@ -1,384 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $true)] - [ValidateSet("Default", "Intranet", "Internet", "Custom", "Extranet")] - [System.String] - $Zone, - - [parameter(Mandatory = $true)] - [System.Boolean] - $EnableCache, - - [parameter(Mandatory = $false)] - [System.String] - $Location, - - [parameter(Mandatory = $false)] - [System.UInt16] - $MaxSizeInGB, - - [parameter(Mandatory = $false)] - [System.UInt32] - $MaxAgeInSeconds, - - [parameter(Mandatory = $false)] - [System.String] - $FileTypes, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting blob cache settings for $WebAppUrl" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $webappsi = Get-SPServiceInstance -Server $env:COMPUTERNAME ` - -ErrorAction SilentlyContinue ` - | Where-Object -FilterScript { - $_.TypeName -eq "Microsoft SharePoint Foundation Web Application" - } - - if ($null -eq $webappsi) - { - Write-Verbose -Message "Server isn't running the Web Application role" - return @{ - WebAppUrl = $null - Zone = $null - EnableCache = $false - Location = $null - MaxSizeInGB = $null - MaxAgeInSeconds = $null - FileTypes = $null - InstallAccount = $params.InstallAccount - } - } - - $wa = Get-SPWebApplication -Identity $params.WebAppUrl ` - -ErrorAction SilentlyContinue - - if ($null -eq $wa) - { - Write-Verbose -Message "Specified web application was not found." - return @{ - WebAppUrl = $null - Zone = $null - EnableCache = $false - Location = $null - MaxSizeInGB = $null - MaxAgeInSeconds = $null - FileTypes = $null - InstallAccount = $params.InstallAccount - } - } - - $zone = [Microsoft.SharePoint.Administration.SPUrlZone]::$($params.Zone) - - $sitePath = $wa.IisSettings[$zone].Path - $webconfiglocation = Join-Path $sitePath "web.config" - - [xml]$webConfig = Get-Content -Path $webConfigLocation - - if ($webconfig.configuration.SharePoint.BlobCache.enabled -eq "true") - { - $cacheEnabled = $true - } - else - { - $cacheEnabled = $false - } - - try - { - $maxsize = [Convert]::ToUInt16($webconfig.configuration.SharePoint.BlobCache.maxSize) - } - catch [FormatException] - { - $maxsize = 0 - } - catch - { - throw "Error: $($_.Exception.Message)" - } - - try - { - $maxage = [Convert]::ToUInt32($webconfig.configuration.SharePoint.BlobCache."max-age") - } - catch [FormatException] - { - $maxage = 0 - } - catch - { - throw "Error: $($_.Exception.Message)" - } - - $returnval = @{ - WebAppUrl = $params.WebAppUrl - Zone = $params.Zone - EnableCache = $cacheEnabled - Location = $webconfig.configuration.SharePoint.BlobCache.location - MaxSizeInGB = $maxsize - MaxAgeInSeconds = $maxage - FileTypes = $webconfig.configuration.SharePoint.BlobCache.path - InstallAccount = $params.InstallAccount - } - - return $returnval - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $true)] - [ValidateSet("Default", "Intranet", "Internet", "Custom", "Extranet")] - [System.String] - $Zone, - - [parameter(Mandatory = $true)] - [System.Boolean] - $EnableCache, - - [parameter(Mandatory = $false)] - [System.String] - $Location, - - [parameter(Mandatory = $false)] - [System.UInt16] - $MaxSizeInGB, - - [parameter(Mandatory = $false)] - [System.UInt32] - $MaxAgeInSeconds, - - [parameter(Mandatory = $false)] - [System.String] - $FileTypes, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting blob cache settings for $WebAppUrl" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - $changes = @{} - - if ($PSBoundParameters.ContainsKey("EnableCache")) - { - if ($CurrentValues.EnableCache -ne $EnableCache) - { - $changes.EnableCache = $EnableCache - } - } - - if ($PSBoundParameters.ContainsKey("Location")) - { - if ($CurrentValues.Location -ne $Location) - { - $changes.Location = $Location - } - } - - if ($PSBoundParameters.ContainsKey("MaxSizeInGB")) - { - if ($CurrentValues.MaxSizeInGB -ne $MaxSizeInGB) - { - $changes.MaxSizeInGB = $MaxSizeInGB - } - } - - if ($PSBoundParameters.ContainsKey("MaxAgeInSeconds")) - { - if ($CurrentValues.MaxAgeInSeconds -ne $MaxAgeInSeconds) - { - $changes.MaxAgeInSeconds = $MaxAgeInSeconds - } - } - - if ($PSBoundParameters.ContainsKey("FileTypes")) - { - if ($CurrentValues.FileTypes -ne $FileTypes) - { - $changes.FileTypes = $FileTypes - } - } - - if ($changes.Count -ne 0) - { - ## Perform changes - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $changes) ` - -ScriptBlock { - $params = $args[0] - $changes = $args[1] - - $webappsi = Get-SPServiceInstance -Server $env:COMPUTERNAME ` - -ErrorAction SilentlyContinue ` - | Where-Object -FilterScript { - $_.TypeName -eq "Microsoft SharePoint Foundation Web Application" - } - - if ($null -eq $webappsi) - { - throw "Server isn't running the Web Application role" - } - - $wa = Get-SPWebApplication -Identity $params.WebAppUrl -ErrorAction SilentlyContinue - - if ($null -eq $wa) - { - throw "Specified web application could not be found." - } - - Write-Verbose -Message "Processing changes" - - $zone = [Microsoft.SharePoint.Administration.SPUrlZone]::$($params.Zone) - - $sitePath = $wa.IisSettings[$zone].Path - $timestamp = Get-Date -Format "yyyyMMdd_HHmmss" - $webconfiglocation = Join-Path -Path $sitePath -ChildPath "web.config" - $webconfigbackuplocation = Join-Path -Path $sitePath -ChildPath "web_config-$timestamp.backup" - Copy-Item -Path $webconfiglocation -Destination $webconfigbackuplocation - - [xml]$webConfig = Get-Content -Path $webConfigLocation - - if ($changes.ContainsKey("EnableCache")) - { - $webconfig.configuration.SharePoint.BlobCache.enabled ` - = $changes.EnableCache.ToString() - } - - if ($changes.ContainsKey("Location")) - { - $webconfig.configuration.SharePoint.BlobCache.location ` - = $changes.Location - } - - if ($changes.ContainsKey("MaxSizeInGB")) - { - $webconfig.configuration.SharePoint.BlobCache.maxSize ` - = $changes.MaxSizeInGB.ToString() - } - - if ($changes.ContainsKey("MaxAgeInSeconds")) - { - $webconfig.configuration.SharePoint.BlobCache."max-age" ` - = $changes.MaxAgeInSeconds.ToString() - } - - if ($changes.ContainsKey("FileTypes")) - { - $webconfig.configuration.SharePoint.BlobCache.path ` - = $changes.FileTypes - } - $webconfig.Save($webconfiglocation) - } - } - - ## Check Blob Cache folder - if ($Location) - { - if ( -not (Test-Path -Path $Location)) - { - Write-Verbose "Create Blob Cache Folder $Location" - try - { - New-Item -Path $Location -ItemType Directory | Out-Null - } - catch [DriveNotFoundException] - { - throw "Specified drive does not exist" - } - catch - { - throw "Error creating Blob Cache folder: $($_.Exception.Message)" - } - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $true)] - [ValidateSet("Default", "Intranet", "Internet", "Custom", "Extranet")] - [System.String] - $Zone, - - [parameter(Mandatory = $true)] - [System.Boolean] - $EnableCache, - - [parameter(Mandatory = $false)] - [System.String] - $Location, - - [parameter(Mandatory = $false)] - [System.UInt16] - $MaxSizeInGB, - - [parameter(Mandatory = $false)] - [System.UInt32] - $MaxAgeInSeconds, - - [parameter(Mandatory = $false)] - [System.String] - $FileTypes, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing blob cache settings for $WebAppUrl" - - if ($Location) - { - if ( -not (Test-Path -Path $Location)) - { - Write-Verbose "Blob Cache Folder $Location does not exist" - return $false - } - } - - return Test-SPDscParameterState -CurrentValues (Get-TargetResource @PSBoundParameters) ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("EnableCache", - "Location", - "MaxSizeInGB", - "FileType", - "MaxAgeInSeconds") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPBlobCacheSettings/MSFT_SPBlobCacheSettings.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPBlobCacheSettings/MSFT_SPBlobCacheSettings.schema.mof deleted file mode 100644 index 81ac90cf..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPBlobCacheSettings/MSFT_SPBlobCacheSettings.schema.mof +++ /dev/null @@ -1,14 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPBlobCacheSettings")] -class MSFT_SPBlobCacheSettings : OMI_BaseResource -{ - [Key, Description("The URL of the web application")] string WebAppUrl; - [Key, Description("The zone of the web application for which blob cache has to be configured"), ValueMap{"Default","Intranet","Internet","Custom","Extranet"}, Values{"Default","Intranet","Internet","Custom","Extranet"}] string Zone; - [Required, Description("Specify if the blob cache has to be enabled")] Boolean EnableCache; - [Write, Description("The location where the blob cache has to store its files")] string Location; - [Write, Description("The maximum size (in GB) of disk space the blob cache is allowed to use")] Uint16 MaxSizeInGB; - [Write, Description("The maximum age (in seconds) that a browser caches a blob")] Uint32 MaxAgeInSeconds; - [Write, Description("Specify the file types that must be stored by the blob cache")] string FileTypes; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPCacheAccounts/MSFT_SPCacheAccounts.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPCacheAccounts/MSFT_SPCacheAccounts.psm1 deleted file mode 100644 index 3ade9ccb..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPCacheAccounts/MSFT_SPCacheAccounts.psm1 +++ /dev/null @@ -1,280 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $true)] - [System.String] - $SuperUserAlias, - - [parameter(Mandatory = $true)] - [System.String] - $SuperReaderAlias, - - [parameter(Mandatory = $false)] - [System.Boolean] - $SetWebAppPolicy = $true, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting cache accounts for $WebAppUrl" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - $params = $args[0] - - $wa = Get-SPWebApplication -Identity $params.WebAppUrl -ErrorAction SilentlyContinue - - if ($null -eq $wa) - { - return @{ - WebAppUrl = $params.WebAppUrl - SuperUserAlias = $null - SuperReaderAlias = $null - SetWebAppPolicy = $false - InstallAccount = $params.InstallAccount - } - } - - $returnVal = @{ - InstallAccount = $params.InstallAccount - WebAppUrl = $params.WebAppUrl - } - - $policiesSet = $true - if ($wa.UseClaimsAuthentication -eq $true) - { - if ($wa.Properties.ContainsKey("portalsuperuseraccount")) - { - $claim = New-SPClaimsPrincipal -Identity $wa.Properties["portalsuperuseraccount"] ` - -IdentityType EncodedClaim ` - -ErrorAction SilentlyContinue - if ($null -ne $claim) - { - $returnVal.Add("SuperUserAlias", $claim.Value) - } - else - { - $returnVal.Add("SuperUserAlias", "") - } - } - else - { - $returnVal.Add("SuperUserAlias", "") - } - if ($wa.Properties.ContainsKey("portalsuperreaderaccount")) - { - $claim = New-SPClaimsPrincipal -Identity $wa.Properties["portalsuperreaderaccount"] ` - -IdentityType EncodedClaim ` - -ErrorAction SilentlyContinue - if ($null -ne $claim) - { - $returnVal.Add("SuperReaderAlias", $claim.Value) - } - else - { - $returnVal.Add("SuperReaderAlias", "") - } - } - else - { - $returnVal.Add("SuperReaderAlias", "") - } - if ($wa.Policies.UserName -notcontains ((New-SPClaimsPrincipal -Identity $params.SuperReaderAlias ` - -IdentityType WindowsSamAccountName).ToEncodedString())) - { - $policiesSet = $false - } - - if ($wa.Policies.UserName -notcontains ((New-SPClaimsPrincipal -Identity $params.SuperUserAlias ` - -IdentityType WindowsSamAccountName).ToEncodedString())) - { - $policiesSet = $false - } - } - else - { - if ($wa.Properties.ContainsKey("portalsuperuseraccount")) - { - $returnVal.Add("SuperUserAlias", $wa.Properties["portalsuperuseraccount"]) - } - else - { - $returnVal.Add("SuperUserAlias", "") - } - - if ($wa.Properties.ContainsKey("portalsuperreaderaccount")) - { - $returnVal.Add("SuperReaderAlias", $wa.Properties["portalsuperreaderaccount"]) - } - else - { - $returnVal.Add("SuperReaderAlias", "") - } - - if ($wa.Policies.UserName -notcontains $params.SuperReaderAlias) - { - $policiesSet = $false - } - - if ($wa.Policies.UserName -notcontains $params.SuperUserAlias) - { - $policiesSet = $false - } - } - $returnVal.Add("SetWebAppPolicy", $policiesSet) - - return $returnVal - } - return $result -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $true)] - [System.String] - $SuperUserAlias, - - [parameter(Mandatory = $true)] - [System.String] - $SuperReaderAlias, - - [parameter(Mandatory = $false)] - [System.Boolean] - $SetWebAppPolicy = $true, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount ) - - Write-Verbose -Message "Setting cache accounts for $WebAppUrl" - - $PSBoundParameters.SetWebAppPolicy = $SetWebAppPolicy - - Invoke-SPDSCCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - $params = $args[0] - - $wa = Get-SPWebApplication -Identity $params.WebAppUrl -ErrorAction SilentlyContinue - if ($null -eq $wa) - { - throw [Exception] "The web applications $($params.WebAppUrl) can not be found to set cache accounts" - } - - if ($wa.UseClaimsAuthentication -eq $true) - { - $wa.Properties["portalsuperuseraccount"] = (New-SPClaimsPrincipal -Identity $params.SuperUserAlias ` - -IdentityType WindowsSamAccountName).ToEncodedString() - $wa.Properties["portalsuperreaderaccount"] = (New-SPClaimsPrincipal -Identity $params.SuperReaderAlias ` - -IdentityType WindowsSamAccountName).ToEncodedString() - } - else - { - $wa.Properties["portalsuperuseraccount"] = $params.SuperUserAlias - $wa.Properties["portalsuperreaderaccount"] = $params.SuperReaderAlias - } - - if ($params.SetWebAppPolicy -eq $true) - { - if ($wa.UseClaimsAuthentication -eq $true) - { - $claimsReader = (New-SPClaimsPrincipal -Identity $params.SuperReaderAlias ` - -IdentityType WindowsSamAccountName).ToEncodedString() - if ($wa.Policies.UserName -contains $claimsReader) - { - $wa.Policies.Remove($claimsReader) - } - $policy = $wa.Policies.Add($claimsReader, "Super Reader (Claims)") - $policyRole = $wa.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::FullRead) - $policy.PolicyRoleBindings.Add($policyRole) - - $claimsSuper = (New-SPClaimsPrincipal -Identity $params.SuperUserAlias ` - -IdentityType WindowsSamAccountName).ToEncodedString() - if ($wa.Policies.UserName -contains $claimsSuper) - { - $wa.Policies.Remove($claimsSuper) - } - $policy = $wa.Policies.Add($claimsSuper, "Super User (Claims)") - $policyRole = $wa.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::FullControl) - $policy.PolicyRoleBindings.Add($policyRole) - } - else - { - if ($wa.Policies.UserName -contains $params.SuperReaderAlias) - { - $wa.Policies.Remove($params.SuperReaderAlias) - } - - $readPolicy = $wa.Policies.Add($params.SuperReaderAlias, "Super Reader") - $readPolicyRole = $wa.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::FullRead) - $readPolicy.PolicyRoleBindings.Add($readPolicyRole) - - if ($wa.Policies.UserName -contains $params.SuperUserAlias) - { - $wa.Policies.Remove($params.SuperUserAlias) - } - $policy = $wa.Policies.Add($params.SuperUserAlias, "Super User") - $policyRole = $wa.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::FullControl) - $policy.PolicyRoleBindings.Add($policyRole) - } - } - - $wa.Update() - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $true)] - [System.String] - $SuperUserAlias, - - [parameter(Mandatory = $true)] - [System.String] - $SuperReaderAlias, - - [parameter(Mandatory = $false)] - [System.Boolean] - $SetWebAppPolicy = $true, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount ) - - Write-Verbose -Message "Testing cache accounts for $WebAppUrl" - - $PSBoundParameters.SetWebAppPolicy = $SetWebAppPolicy - - $CurrentValues = Get-TargetResource @PSBoundParameters - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("SuperUserAlias", ` - "SuperReaderAlias", ` - "SetWebAppPolicy") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPCacheAccounts/MSFT_SPCacheAccounts.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPCacheAccounts/MSFT_SPCacheAccounts.schema.mof deleted file mode 100644 index c7583997..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPCacheAccounts/MSFT_SPCacheAccounts.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPCacheAccounts")] -class MSFT_SPCacheAccounts : OMI_BaseResource -{ - [Key, Description("The URL of the web application to set the accounts for")] string WebAppUrl; - [Required, Description("The account name for the super user")] string SuperUserAlias; - [Required, Description("The account name for the super reader")] string SuperReaderAlias; - [Write, Description("Should the web app policy be set for these accounts?")] boolean SetWebAppPolicy; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPConfigWizard/MSFT_SPConfigWizard.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPConfigWizard/MSFT_SPConfigWizard.psm1 deleted file mode 100644 index 53937652..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPConfigWizard/MSFT_SPConfigWizard.psm1 +++ /dev/null @@ -1,248 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [parameter(Mandatory = $false)] - [ValidateSet("mon","tue","wed","thu","fri","sat","sun")] - [System.String[]] - $DatabaseUpgradeDays, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseUpgradeTime, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting status of Configuration Wizard" - - # Check which version of SharePoint is installed - if ((Get-SPDSCInstalledProductVersion).FileMajorPart -eq 15) - { - $wssRegKey ="hklm:SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\15.0\WSS" - } - else - { - $wssRegKey ="hklm:SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\16.0\WSS" - } - - # Read LanguagePackInstalled and SetupType registry keys - $languagePackInstalled = Get-SPDSCRegistryKey -Key $wssRegKey -Value "LanguagePackInstalled" - $setupType = Get-SPDSCRegistryKey -Key $wssRegKey -Value "SetupType" - - # Determine if LanguagePackInstalled=1 or SetupType=B2B_Upgrade. - # If so, the Config Wizard is required - if (($languagePackInstalled -eq 1) -or ($setupType -eq "B2B_UPGRADE")) - { - return @{ - Ensure = "Absent" - DatabaseUpgradeDays = $DatabaseUpgradeDays - DatabaseUpgradeTime = $DatabaseUpgradeTime - } - } - else - { - return @{ - Ensure = "Present" - DatabaseUpgradeDays = $DatabaseUpgradeDays - DatabaseUpgradeTime = $DatabaseUpgradeTime - } - } -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [parameter(Mandatory = $false)] - [ValidateSet("mon","tue","wed","thu","fri","sat","sun")] - [System.String[]] - $DatabaseUpgradeDays, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseUpgradeTime, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting status of Configuration Wizard" - - $now = Get-Date - if ($DatabaseUpgradeDays) - { - # DatabaseUpgradeDays parameter exists, check if current day is specified - $currentDayOfWeek = $now.DayOfWeek.ToString().ToLower().Substring(0,3) - - if ($DatabaseUpgradeDays -contains $currentDayOfWeek) - { - Write-Verbose -Message ("Current day is present in the parameter DatabaseUpgradeDays. " + ` - "Configuration wizard can be run today.") - } - else - { - Write-Verbose -Message ("Current day is not present in the parameter DatabaseUpgradeDays, " + ` - "skipping the Configuration Wizard") - return - } - } - else - { - Write-Verbose -Message ("No DatabaseUpgradeDays specified, Configuration Wizard can be " + ` - "ran on any day.") - } - - # Check if DatabaseUpdateTime parameter exists - if ($DatabaseUpgradeTime) - { - # Check if current time is inside of time window - $upgradeTimes = $DatabaseUpgradeTime.Split(" ") - $starttime = 0 - $endtime = 0 - - if ($upgradeTimes.Count -ne 3) - { - throw "Time window incorrectly formatted." - } - else - { - if ([datetime]::TryParse($upgradeTimes[0],[ref]$starttime) -ne $true) - { - throw "Error converting start time" - } - - if ([datetime]::TryParse($upgradeTimes[2],[ref]$endtime) -ne $true) - { - throw "Error converting end time" - } - - if ($starttime -gt $endtime) - { - throw "Error: Start time cannot be larger than end time" - } - } - - if (($starttime -lt $now) -and ($endtime -gt $now)) - { - Write-Verbose -Message ("Current time is inside of the window specified in " + ` - "DatabaseUpgradeTime. Starting wizard") - } - else - { - Write-Verbose -Message ("Current time is outside of the window specified in " + ` - "DatabaseUpgradeTime, skipping the Configuration Wizard") - return - } - } - else - { - Write-Verbose -Message ("No DatabaseUpgradeTime specified, Configuration Wizard can be " + ` - "ran at any time. Starting wizard.") - } - - if ($Ensure -eq $false) - { - Write-Verbose -Message ("Ensure is set to Absent, so running the Configuration " + ` - "Wizard is not required") - return - } - - # Check which version of SharePoint is installed - if ((Get-SPDSCInstalledProductVersion).FileMajorPart -eq 15) - { - $binaryDir = Join-Path $env:CommonProgramFiles "Microsoft Shared\Web Server Extensions\15\BIN" - } - else - { - $binaryDir = Join-Path $env:CommonProgramFiles "Microsoft Shared\Web Server Extensions\16\BIN" - } - $psconfigExe = Join-Path -Path $binaryDir -ChildPath "psconfig.exe" - - # Start wizard - Write-Verbose -Message "Starting Configuration Wizard" - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $psconfigExe ` - -ScriptBlock { - $psconfigExe = $args[0] - $psconfig = Start-Process -FilePath $psconfigExe ` - -ArgumentList "-cmd upgrade -inplace b2b -wait -force" ` - -Wait ` - -PassThru - - return $psconfig.ExitCode - } - - # Error codes: https://aka.ms/installerrorcodes - switch ($result) - { - 0 { - Write-Verbose -Message "SharePoint Post Setup Configuration Wizard ran successfully" - } - Default { - throw ("SharePoint Post Setup Configuration Wizard failed, " + ` - "exit code was $($setup.ExitCode). Error codes can be found at " + ` - "https://aka.ms/installerrorcodes") - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [parameter(Mandatory = $false)] - [ValidateSet("mon","tue","wed","thu","fri","sat","sun")] - [System.String[]] - $DatabaseUpgradeDays, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseUpgradeTime, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing status of Configuration Wizard" - - if ($Ensure -eq "Absent") - { - Write-Verbose -Message ("Ensure is set to Absent, so running the Configuration Wizard " + ` - "is not required") - return $true - } - - $currentValues = Get-TargetResource @PSBoundParameters - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPConfigWizard/MSFT_SPConfigWizard.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPConfigWizard/MSFT_SPConfigWizard.schema.mof deleted file mode 100644 index c93913ce..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPConfigWizard/MSFT_SPConfigWizard.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPConfigWizard")] -class MSFT_SPConfigWizard : OMI_BaseResource -{ - [Key, Description("Present to install SharePoint. Absent is currently not supported"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("Specify on which dates running the Configuration Wizard is allowed"), ValueMap{"mon","tue","wed","thu","fri","sat","sun"}, Values{"mon","tue","wed","thu","fri","sat","sun"}] String DatabaseUpgradeDays[]; - [Write, Description("Specify in which time frame running the Configuration Wizard is allowed")] String DatabaseUpgradeTime; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPContentDatabase/MSFT_SPContentDatabase.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPContentDatabase/MSFT_SPContentDatabase.psm1 deleted file mode 100644 index cda6fa9a..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPContentDatabase/MSFT_SPContentDatabase.psm1 +++ /dev/null @@ -1,401 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $false)] - [System.Boolean] - $Enabled, - - [parameter(Mandatory = $false)] - [System.UInt16] - $WarningSiteCount, - - [parameter(Mandatory = $false)] - [System.UInt16] - $MaximumSiteCount, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting content database configuration settings" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $cdb = Get-SPDatabase | Where-Object -FilterScript { - $_.Type -eq "Content Database" -and $_.Name -eq $params.Name - } - - if ($null -eq $cdb) - { - # Database does not exist - return @{ - Name = $params.Name - DatabaseServer = $params.DatabaseServer - WebAppUrl = $params.WebAppUrl - Enabled = $params.Enabled - WarningSiteCount = $params.WarningSiteCount - MaximumSiteCount = $params.MaximumSiteCount - Ensure = "Absent" - InstallAccount = $params.InstallAccount - } - } - else - { - # Database exists - if ($cdb.Status -eq "Online") - { - $cdbenabled = $true - } - else - { - $cdbenabled = $false - } - - $returnVal = @{ - Name = $params.Name - DatabaseServer = $cdb.Server - WebAppUrl = $cdb.WebApplication.Url.Trim("/") - Enabled = $cdbenabled - WarningSiteCount = $cdb.WarningSiteCount - MaximumSiteCount = $cdb.MaximumSiteCount - Ensure = "Present" - InstallAccount = $params.InstallAccount - } - return $returnVal - } - } - - return $result -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $false)] - [System.Boolean] - $Enabled, - - [parameter(Mandatory = $false)] - [System.UInt16] - $WarningSiteCount, - - [parameter(Mandatory = $false)] - [System.UInt16] - $MaximumSiteCount, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting content database configuration settings" - - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - # Use Get-SPDatabase instead of Get-SPContentDatabase because the Get-SPContentDatabase - # does not return disabled databases. - $cdb = Get-SPDatabase | Where-Object -FilterScript { - $_.Type -eq "Content Database" -and $_.Name -eq $params.Name - } - - if ($params.Ensure -eq "Present") - { - # Check if specified web application exists and throw exception when - # this is not the case - $webapp = Get-SPWebApplication | Where-Object -FilterScript { - $_.Url.Trim("/") -eq $params.WebAppUrl.Trim("/") - } - - if ($null -eq $webapp) - { - throw "Specified web application does not exist." - } - - # Check if database exists - if ($null -ne $cdb) - { - if ($cdb.Server -ne $params.DatabaseServer) - { - throw ("Specified database server does not match the actual database " + ` - "server. This resource cannot move the database to a different " + ` - "SQL instance.") - } - - # Check and change attached web application. - # Dismount and mount to correct web application - if ($params.WebAppUrl.Trim("/") -ne $cdb.WebApplication.Url.Trim("/")) - { - Dismount-SPContentDatabase $params.Name -Confirm:$false - - $newParams= @{} - foreach ($param in $params.GetEnumerator()) - { - $skipParams = @("Enabled", "Ensure", "InstallAccount", "MaximumSiteCount", "WebAppUrl") - - if ($skipParams -notcontains $param.Key) - { - $newParams.$($param.Key) = $param.Value - } - - if ($param.Key -eq "MaximumSiteCount") - { - $newParams.MaxSiteCount = $param.Value - } - - if ($param.Key -eq "WebAppUrl") - { - $newParams.WebApplication = $param.Value - } - } - - try - { - $cdb = Mount-SPContentDatabase @newParams -ErrorAction Stop - } - catch - { - throw ("Error occurred while mounting content database. " + ` - "Content database is not mounted. " + ` - "Error details: $($_.Exception.Message)") - } - - if ($cdb.Status -eq "Online") - { - $cdbenabled = $true - } - else - { - $cdbenabled = $false - } - - if ($params.Enabled -ne $cdbenabled) - { - switch ($params.Enabled) - { - $true - { - $cdb.Status = [Microsoft.SharePoint.Administration.SPObjectStatus]::Online - } - $false - { - $cdb.Status = [Microsoft.SharePoint.Administration.SPObjectStatus]::Disabled - } - } - } - } - - # Check and change database status - if ($cdb.Status -eq "Online") - { - $cdbenabled = $true - } - else - { - $cdbenabled = $false - } - - if ($params.ContainsKey("Enabled") -and $params.Enabled -ne $cdbenabled) - { - switch ($params.Enabled) - { - $true - { - $cdb.Status = [Microsoft.SharePoint.Administration.SPObjectStatus]::Online - } - $false - { - $cdb.Status = [Microsoft.SharePoint.Administration.SPObjectStatus]::Disabled - } - } - } - - # Check and change site count settings - if ($null -ne $params.WarningSiteCount -and $params.WarningSiteCount -ne $cdb.WarningSiteCount) - { - $cdb.WarningSiteCount = $params.WarningSiteCount - } - - if ($params.MaximumSiteCount -and $params.MaximumSiteCount -ne $cdb.MaximumSiteCount) - { - $cdb.MaximumSiteCount = $params.MaximumSiteCount - } - } - else - { - # Database does not exist, but should. Create/mount database - $newParams= @{} - foreach ($param in $params.GetEnumerator()) - { - $skipParams = @("Enabled", "Ensure", "InstallAccount", "MaximumSiteCount", "WebAppUrl") - - if ($skipParams -notcontains $param.Key) - { - $newParams.$($param.Key) = $param.Value - } - - if ($param.Key -eq "MaximumSiteCount") - { - $newParams.MaxSiteCount = $param.Value - } - - if ($param.Key -eq "WebAppUrl") - { - $newParams.WebApplication = $param.Value - } - } - - try - { - $cdb = Mount-SPContentDatabase @newParams -ErrorAction Stop - } - catch - { - throw ("Error occurred while mounting content database. " + ` - "Content database is not mounted. " + ` - "Error details: $($_.Exception.Message)") - } - - if ($cdb.Status -eq "Online") - { - $cdbenabled = $true - } - else - { - $cdbenabled = $false - } - - if ($params.Enabled -ne $cdbenabled) - { - switch ($params.Enabled) - { - $true - { - $cdb.Status = [Microsoft.SharePoint.Administration.SPObjectStatus]::Online - } - $false - { - $cdb.Status = [Microsoft.SharePoint.Administration.SPObjectStatus]::Disabled - } - } - } - } - $cdb.Update() - } - else - { - if ($null -ne $cdb) - { - # Database exists, but shouldn't. Dismount database - Dismount-SPContentDatabase $params.Name -Confirm:$false - } - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $false)] - [System.Boolean] - $Enabled, - - [parameter(Mandatory = $false)] - [System.UInt16] - $WarningSiteCount, - - [parameter(Mandatory = $false)] - [System.UInt16] - $MaximumSiteCount, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing content database configuration settings" - - $PSBoundParameters.Ensure = $Ensure - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($CurrentValues.DatabaseServer -ne $DatabaseServer) - { - Write-Verbose -Message ("Specified database server does not match the actual " + ` - "database server. This resource cannot move the database " + ` - "to a different SQL instance.") - return $false - } - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPContentDatabase/MSFT_SPContentDatabase.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPContentDatabase/MSFT_SPContentDatabase.schema.mof deleted file mode 100644 index 80fcc632..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPContentDatabase/MSFT_SPContentDatabase.schema.mof +++ /dev/null @@ -1,13 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPContentDatabase")] -class MSFT_SPContentDatabase : OMI_BaseResource -{ - [Key, Description("Specifies the name of the content database")] String Name; - [Write, Description("The name of the database server to host the content DB")] string DatabaseServer; - [Required, Description("The URL of the web application")] string WebAppUrl; - [Write, Description("Should the database be enabled")] Boolean Enabled; - [Write, Description("Specify the site collection warning limit for the content database")] Uint16 WarningSiteCount; - [Write, Description("Specify the site collection maximum limit for the content database")] Uint16 MaximumSiteCount; - [Write, Description("Present to create this database, absent to ensure it does not exist"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPCreateFarm/MSFT_SPCreateFarm.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPCreateFarm/MSFT_SPCreateFarm.psm1 deleted file mode 100644 index 6e9d9470..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPCreateFarm/MSFT_SPCreateFarm.psm1 +++ /dev/null @@ -1,395 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $FarmConfigDatabaseName, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $FarmAccount, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $Passphrase, - - [parameter(Mandatory = $true)] - [System.String] - $AdminContentDatabaseName, - - [parameter(Mandatory = $false)] - [System.UInt32] - $CentralAdministrationPort, - - [parameter(Mandatory = $false)] - [System.String] - [ValidateSet("NTLM","Kerberos")] - $CentralAdministrationAuth, - - [parameter(Mandatory = $false)] - [System.String] - [ValidateSet("Application", - "ApplicationWithSearch", - "Custom", - "DistributedCache", - "Search", - "SingleServer", - "SingleServerFarm", - "WebFrontEnd", - "WebFrontEndWithDistributedCache")] - $ServerRole - ) - - Write-Verbose -Message ("WARNING! SPCreateFarm is deprecated and will be removed in " + ` - "SharePointDsc v2.0. Swap to use the new SPFarm resource as " + ` - "an alternative. See http://aka.ms/SPDsc-SPFarm for details.") - - Write-Verbose -Message "Getting local SP Farm settings" - - if (($PSBoundParameters.ContainsKey("ServerRole") -eq $true) ` - -and (Get-SPDSCInstalledProductVersion).FileMajorPart -ne 16) - { - throw [Exception] "Server role is only supported in SharePoint 2016." - } - - if (($PSBoundParameters.ContainsKey("ServerRole") -eq $true) ` - -and (Get-SPDSCInstalledProductVersion).FileMajorPart -eq 16 ` - -and (Get-SPDSCInstalledProductVersion).FileBuildPart -lt 4456 ` - -and ($ServerRole -eq "ApplicationWithSearch" ` - -or $ServerRole -eq "WebFrontEndWithDistributedCache")) - { - throw [Exception] ("ServerRole values of 'ApplicationWithSearch' or " + ` - "'WebFrontEndWithDistributedCache' require the SharePoint 2016 " + ` - "Feature Pack 1 to be installed. See " + ` - "https://support.microsoft.com/en-au/kb/3127940") - } - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $getSPMajorVersion = (Get-SPDSCInstalledProductVersion).FileMajorPart - $cfgDbRegKey = "hklm:SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\$getSPMajorVersion.0\Secure\ConfigDB" - try - { - $configDbDsn = Get-SPDSCRegistryKey -Key $cfgDbRegKey -Value "dsn" - } - catch - { - Write-Verbose -Message "SharePoint registry key cannot be found." - } - $serverIsJoined = $true - - if ($null -eq $configDbDsn) - { - $serverIsJoined = $false - } - elseif (-NOT($configDbDsn.Contains($params.FarmConfigDatabaseName))) - { - $serverIsJoined = $false - } - - try - { - $spFarm = Get-SPFarm - } - catch - { - Write-Verbose -Message "Unable to detect local farm." - } - - if ($null -eq $spFarm) - { - if ($serverIsJoined) - { - throw 'Server already joined to farm but SPFarm not reachable' - } - return $null - } - - $configDb = Get-SPDatabase | Where-Object -FilterScript { - $_.Name -eq $spFarm.Name -and $_.Type -eq "Configuration Database" - } - $centralAdminSite = Get-SPWebApplication -IncludeCentralAdministration ` - | Where-Object -FilterScript { - $_.IsAdministrationWebApplication -eq $true - } - - if ($params.FarmAccount.UserName -eq $spFarm.DefaultServiceAccount.Name) - { - $farmAccount = $params.FarmAccount - } - else - { - $farmAccount = $spFarm.DefaultServiceAccount.Name - } - - $returnValue = @{ - FarmConfigDatabaseName = $spFarm.Name - DatabaseServer = $configDb.Server.Name - FarmAccount = $farmAccount - InstallAccount = $params.InstallAccount - Passphrase = $params.Passphrase.password - AdminContentDatabaseName = $centralAdminSite.ContentDatabases[0].Name - CentralAdministrationPort = (New-Object -TypeName System.Uri $centralAdminSite.Url).Port - CentralAdministrationAuth = $params.CentralAdministrationAuth - } - return $returnValue - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $FarmConfigDatabaseName, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $FarmAccount, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $Passphrase, - - [parameter(Mandatory = $true)] - [System.String] - $AdminContentDatabaseName, - - [parameter(Mandatory = $false)] - [System.UInt32] - $CentralAdministrationPort, - - [parameter(Mandatory = $false)] - [System.String] - [ValidateSet("NTLM","Kerberos")] - $CentralAdministrationAuth, - - [parameter(Mandatory = $false)] - [System.String] - [ValidateSet("Application", - "ApplicationWithSearch", - "Custom", - "DistributedCache", - "Search", - "SingleServer", - "SingleServerFarm", - "WebFrontEnd", - "WebFrontEndWithDistributedCache")] - $ServerRole - ) - - Write-Verbose -Message ("WARNING! SPCreateFarm is deprecated and will be removed in " + ` - "SharePointDsc v2.0. Swap to use the new SPFarm resource as " + ` - "an alternative. See http://aka.ms/SPDsc-SPFarm for details.") - - Write-Verbose -Message "Setting local SP Farm settings" - - if (($PSBoundParameters.ContainsKey("ServerRole") -eq $true) ` - -and (Get-SPDSCInstalledProductVersion).FileMajorPart -ne 16) - { - throw [Exception] "Server role is only supported in SharePoint 2016." - } - - if (($PSBoundParameters.ContainsKey("ServerRole") -eq $true) ` - -and (Get-SPDSCInstalledProductVersion).FileMajorPart -eq 16 ` - -and (Get-SPDSCInstalledProductVersion).FileBuildPart -lt 4456 ` - -and ($ServerRole -eq "ApplicationWithSearch" ` - -or $ServerRole -eq "WebFrontEndWithDistributedCache")) - { - throw [Exception] ("ServerRole values of 'ApplicationWithSearch' or " + ` - "'WebFrontEndWithDistributedCache' require the SharePoint 2016 " + ` - "Feature Pack 1 to be installed. See " + ` - "https://support.microsoft.com/en-au/kb/3127940") - } - - $CurrentValues = Get-TargetResource @PSBoundParameters - if ([string]::IsNullOrEmpty($CurrentValues.FarmConfigDatabaseName) -eq $false) - { - throw ("This server is already connected to a farm " + ` - "($($CurrentValues.FarmConfigDatabaseName)). Please manually remove it " + ` - "to apply this change.") - } - - if (-not $PSBoundParameters.ContainsKey("CentralAdministrationPort")) - { - $PSBoundParameters.Add("CentralAdministrationPort", 9999) - } - if (-not $PSBoundParameters.ContainsKey("CentralAdministrationAuth")) - { - $PSBoundParameters.Add("CentralAdministrationAuth", "NTLM") - } - - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` - -ScriptBlock { - - $params = $args[0] - $scriptRoot = $args[1] - - $modulePath = "..\..\Modules\SharePointDsc.Farm\SPFarm.psm1" - Import-Module -Name (Join-Path -Path $scriptRoot -ChildPath $modulePath -Resolve) - $dbStatus = Get-SPDSCConfigDBStatus -SQLServer $params.DatabaseServer ` - -Database $params.FarmConfigDatabaseName - - while ($dbStatus.Locked -eq $true) - { - Write-Verbose -Message ("[$([DateTime]::Now.ToShortTimeString())] The configuration " + ` - "database is currently being provisioned by a remote " + ` - "server, this server will wait for this to complete") - Start-Sleep -Seconds 30 - $dbStatus = Get-SPDSCConfigDBStatus -SQLServer $params.DatabaseServer ` - -Database $params.FarmConfigDatabaseName - } - - if ($dbStatus.ValidPermissions -eq $false) - { - throw "The current user does not have sufficient permissions to SQL Server" - return - } - - $newFarmArgs = @{ - DatabaseServer = $params.DatabaseServer - DatabaseName = $params.FarmConfigDatabaseName - FarmCredentials = $params.FarmAccount - AdministrationContentDatabaseName = $params.AdminContentDatabaseName - Passphrase = ($params.Passphrase).Password - SkipRegisterAsDistributedCacheHost = $true - } - - switch((Get-SPDSCInstalledProductVersion).FileMajorPart) - { - 15 { - Write-Verbose -Message "Detected Version: SharePoint 2013" - } - 16 { - if ($params.ContainsKey("ServerRole") -eq $true) - { - Write-Verbose -Message ("Detected Version: SharePoint 2016 - " + ` - "configuring server as $($params.ServerRole)") - $newFarmArgs.Add("LocalServerRole", $params.ServerRole) - } - else - { - Write-Verbose -Message ("Detected Version: SharePoint 2016 - no " + ` - "server role provided, configuring server " + ` - "without a specific role") - $newFarmArgs.Add("ServerRoleOptional", $true) - } - } - Default { - throw [Exception] ("An unknown version of SharePoint (Major version $_) was " + ` - "detected. Only versions 15 (SharePoint 2013) or 16 " + ` - "(SharePoint 2016) are supported.") - } - } - - New-SPConfigurationDatabase @newFarmArgs - Install-SPHelpCollection -All - Initialize-SPResourceSecurity - Install-SPService - Install-SPFeature -AllExistingFeatures -Force - New-SPCentralAdministration -Port $params.CentralAdministrationPort ` - -WindowsAuthProvider $params.CentralAdministrationAuth - Install-SPApplicationContent - } | Out-Null -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $FarmConfigDatabaseName, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $FarmAccount, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $Passphrase, - - [parameter(Mandatory = $true)] - [System.String] - $AdminContentDatabaseName, - - [parameter(Mandatory = $false)] - [System.UInt32] - $CentralAdministrationPort, - - [parameter(Mandatory = $false)] - [System.String] - [ValidateSet("NTLM","Kerberos")] - $CentralAdministrationAuth, - - [parameter(Mandatory = $false)] - [System.String] - [ValidateSet("Application", - "ApplicationWithSearch", - "Custom", - "DistributedCache", - "Search", - "SingleServer", - "SingleServerFarm", - "WebFrontEnd", - "WebFrontEndWithDistributedCache")] - $ServerRole - ) - - Write-Verbose -Message "Testing local SP Farm settings" - - if (($PSBoundParameters.ContainsKey("ServerRole") -eq $true) ` - -and (Get-SPDSCInstalledProductVersion).FileMajorPart -ne 16) - { - throw [Exception] "Server role is only supported in SharePoint 2016." - } - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($null -eq $CurrentValues) - { - return $false - } - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("FarmConfigDatabaseName") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPCreateFarm/MSFT_SPCreateFarm.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPCreateFarm/MSFT_SPCreateFarm.schema.mof deleted file mode 100644 index 40339482..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPCreateFarm/MSFT_SPCreateFarm.schema.mof +++ /dev/null @@ -1,13 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPCreateFarm")] -class MSFT_SPCreateFarm : OMI_BaseResource -{ - [Key, Description("Name of the configuration database")] String FarmConfigDatabaseName; - [Key, Description("Server that will host the configuration and admin content databases")] String DatabaseServer; - [Required, Description("The account to use as the main farm account"), EmbeddedInstance("MSFT_Credential")] String FarmAccount; - [Required, Description("The passphrase to use to allow servers to join this farm"), EmbeddedInstance("MSFT_Credential")] String Passphrase; - [Required, Description("The name of the admin content database")] String AdminContentDatabaseName; - [Write, Description("What port will Central Admin be provisioned to - default is 9999")] uint32 CentralAdministrationPort; - [Write, Description("The authentication provider of the CentralAdministration web application"), ValueMap{"NTLM","Kerberos"}, Values{"NTLM","Kerberos"}] String CentralAdministrationAuth; - [Write, Description("SharePoint 2016 only - the MinRole role to enroll this server as"), ValueMap{"Application","ApplicationWithSearch","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","WebFrontEnd","WebFrontEndWithDistributedCache"}, Values{"Application","ApplicationWithSearch","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","WebFrontEnd","WebFrontEndWithDistributedCache"}] string ServerRole; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPDatabaseAAG/MSFT_SPDatabaseAAG.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPDatabaseAAG/MSFT_SPDatabaseAAG.psm1 deleted file mode 100644 index c6ac6f0d..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPDatabaseAAG/MSFT_SPDatabaseAAG.psm1 +++ /dev/null @@ -1,294 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $true)] - [System.String] - $AGName, - - [parameter(Mandatory = $false)] - [System.String] - $FileShare, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting AAG configuration for $DatabaseName" - - # Check if the April 2014 CU has been installed. The cmdlets have been added in this CU - if ((Get-SPDSCInstalledProductVersion).FileMajorPart -eq 15 ` - -and (Get-SPDSCInstalledProductVersion).FileBuildPart -lt 4605) - { - throw [Exception] ("Adding databases to SQL Always-On Availability Groups " + ` - "require the SharePoint 2013 April 2014 CU to be installed. " + ` - "http://support.microsoft.com/kb/2880551") - } - - if ($Ensure -eq "Present") - { - Write-Verbose -Message "Database(s) must be included in AAG $AGName" - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments ($PSBoundParameters) ` - -ScriptBlock { - $params = $args[0] - - $Ensure = "Present" - $databases = Get-SPDatabase | Where-Object -FilterScript { - $_.Name -like $params.DatabaseName - } - - $dbname = $params.DatabaseName - if ($null -ne $databases) - { - foreach ($database in $databases) - { - $ag = $database.AvailabilityGroup - if ($null -ne $ag) - { - if ($ag.Name -ne $params.AGName) - { - $Ensure = "Absent" - } - } - else - { - $Ensure = "Absent" - } - } - } - else - { - Write-Verbose -Message "Specified database(s) not found." - $dbname = "" - } - - return @{ - DatabaseName = $dbname - AGName = $params.AGName - FileShare = $params.FileShare - Ensure = $Ensure - InstallAccount = $params.InstallAccount - } - } - } - else - { - Write-Verbose -Message "Database(s) must not be included in an AAG $AGName" - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $Ensure = "Absent" - $databases = Get-SPDatabase | Where-Object -FilterScript { - $_.Name -like $params.DatabaseName - } - - $dbname = $params.DatabaseName - if ($null -ne $databases) - { - foreach ($database in $databases) - { - $ag = $database.AvailabilityGroup - if ($null -ne $ag) - { - $Ensure = "Present" - } - } - } - else - { - Write-Verbose -Message "Specified database(s) not found." - $dbname = "" - } - - return @{ - DatabaseName = $dbname - AGName = $params.AGName - FileShare = $params.FileShare - Ensure = $Ensure - InstallAccount = $params.InstallAccount - } - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $true)] - [System.String] - $AGName, - - [parameter(Mandatory = $false)] - [System.String] - $FileShare, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting AAG configuration for $DatabaseName" - - # Check if the April 2014 CU has been installed. The cmdlets have been added in this CU - if ((Get-SPDSCInstalledProductVersion).FileMajorPart -eq 15 ` - -and (Get-SPDSCInstalledProductVersion).FileBuildPart -lt 4605) - { - throw [Exception] ("Adding databases to SQL Always-On Availability Groups " + ` - "require the SharePoint 2013 April 2014 CU to be installed. " + ` - "http://support.microsoft.com/kb/2880551") - } - - if ($Ensure -eq "Present") - { - Write-Verbose -Message "Checking AAG settings for $DatabaseName" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments ($PSBoundParameters) ` - -ScriptBlock { - $params = $args[0] - - $databases = Get-SPDatabase | Where-Object -FilterScript { - $_.Name -like $params.DatabaseName - } - - if ($null -ne $databases) - { - foreach ($database in $databases) - { - $ag = $database.AvailabilityGroup - if ($null -ne $ag) - { - if ($ag.Name -ne $params.AGName) - { - # Remove it from the current AAG first - Remove-DatabaseFromAvailabilityGroup -AGName $params.AGName ` - -DatabaseName $database.Name ` - -Force - - # Now add it to the AAG it's meant to be in - $addParams = @{ - AGName = $params.AGName - DatabaseName = $database.Name - } - if ($params.ContainsKey("FileShare")) - { - $addParams.Add("FileShare", $params.FileShare) - } - Add-DatabaseToAvailabilityGroup @addParams - } - } - else - { - Write-Verbose -Message "Adding $DatabaseName to $AGName" - $cmdParams = @{ - AGName = $params.AGName - DatabaseName = $database.Name - } - if ($params.ContainsKey("FileShare")) - { - $cmdParams.Add("FileShare", $params.FileShare) - } - Add-DatabaseToAvailabilityGroup @cmdParams - } - } - } - else - { - throw "Specified database(s) not found." - } - } - } - else - { - Write-Verbose -Message "Removing $DatabaseName from $AGName" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $databases = Get-SPDatabase | Where-Object -FilterScript { - $_.Name -like $params.DatabaseName - } - - if ($null -ne $databases) - { - foreach ($database in $databases) - { - Remove-DatabaseFromAvailabilityGroup -AGName $params.AGName ` - -DatabaseName $database.Name ` - -Force - } - } - else - { - throw "Specified database(s) not found." - } - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $true)] - [System.String] - $AGName, - - [parameter(Mandatory = $false)] - [System.String] - $FileShare, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing AAG configuration for $DatabaseName" - - $PSBoundParameters.Ensure = $Ensure - - $CurrentValues = Get-TargetResource @PSBoundParameters - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure", "DatabaseName") -} - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPDatabaseAAG/MSFT_SPDatabaseAAG.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPDatabaseAAG/MSFT_SPDatabaseAAG.schema.mof deleted file mode 100644 index 48373c97..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPDatabaseAAG/MSFT_SPDatabaseAAG.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPDatabaseAAG")] -class MSFT_SPDatabaseAAG : OMI_BaseResource -{ - [Key, Description("The name of the database to put in the AlwaysOn group")] string DatabaseName; - [Required, Description("Name of the AlwaysOn group on the SQL server - this must already exist")] string AGName; - [Write, Description("The fileshare to use for the SQL backup when adding to the group")] string FileShare; - [Write, Description("Present if the database should be in this AlwaysOn group, or Absent if it should not be in the group"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPDesignerSettings/MSFT_SPDesignerSettings.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPDesignerSettings/MSFT_SPDesignerSettings.psm1 deleted file mode 100644 index aae291bd..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPDesignerSettings/MSFT_SPDesignerSettings.psm1 +++ /dev/null @@ -1,418 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $true)] - [ValidateSet("WebApplication","SiteCollection")] - [System.String] - $SettingsScope, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowSharePointDesigner, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowDetachPagesFromDefinition, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowCustomiseMasterPage, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowManageSiteURLStructure, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowCreateDeclarativeWorkflow, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowSavePublishDeclarativeWorkflow, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowSaveDeclarativeWorkflowAsTemplate, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting SharePoint Designer configuration settings" - - switch ($SettingsScope) - { - "WebApplication" { - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - try - { - $spFarm = Get-SPFarm - } - catch - { - Write-Verbose -Message ("No local SharePoint farm was detected. " + ` - "SharePoint Designer settings will not be applied") - return $null - } - - # Check if web application exists - $webapp = Get-SPWebApplication | Where-Object -FilterScript { - ($_.Url).StartsWith($params.Url) - } - if ($null -eq $webapp) - { - Write-Verbose -Message ("Web application not found. SharePoint Designer " + ` - "settings will not be applied") - return $null - } - else - { - # Get SPD settings for the web application - $spdSettings = Get-SPDesignerSettings $params.Url - - return @{ - # Set the SPD settings - Url = $params.Url - SettingsScope = $params.SettingsScope - AllowSharePointDesigner = $spdSettings.AllowDesigner - AllowDetachPagesFromDefinition = $spdSettings.AllowRevertFromTemplate - AllowCustomiseMasterPage = $spdSettings.AllowMasterPageEditing - AllowManageSiteURLStructure = $spdSettings.ShowURLStructure - AllowCreateDeclarativeWorkflow = ` - $spdSettings.AllowCreateDeclarativeWorkflow - AllowSavePublishDeclarativeWorkflow = ` - $spdSettings.AllowSavePublishDeclarativeWorkflow - AllowSaveDeclarativeWorkflowAsTemplate = ` - $spdSettings.AllowSaveDeclarativeWorkflowAsTemplate - InstallAccount = $params.InstallAccount - } - } - } - } - "SiteCollection" { - if ((Test-SPDSCRunAsCredential -Credential $InstallAccount) -eq $true) - { - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - try - { - $spFarm = Get-SPFarm - } - catch - { - Write-Verbose -Message ("No local SharePoint farm was detected. " + ` - "SharePoint Designer settings will not be applied") - return $null - } - - # Check if site collections exists - $site = Get-SPSite -Identity $params.Url -ErrorAction SilentlyContinue - if ($null -eq $site) - { - Write-Verbose -Message ("Site collection not found. SharePoint " + ` - "Designer settings will not be applied") - return $null - } - else - { - return @{ - # Set the SPD settings - Url = $params.Url - SettingsScope = $params.SettingsScope - AllowSharePointDesigner = $site.AllowDesigner - AllowDetachPagesFromDefinition = $site.AllowRevertFromTemplate - AllowCustomiseMasterPage = $site.AllowMasterPageEditing - AllowManageSiteURLStructure = $site.ShowURLStructure - AllowCreateDeclarativeWorkflow = $site.AllowCreateDeclarativeWorkflow - AllowSavePublishDeclarativeWorkflow = ` - $site.AllowSavePublishDeclarativeWorkflow - AllowSaveDeclarativeWorkflowAsTemplate = ` - $site.AllowSaveDeclarativeWorkflowAsTemplate - InstallAccount = $params.InstallAccount - } - } - } - } - else - { - throw ("A known issue exists that prevents these settings from being managed " + ` - "when InstallAccount is used instead of PsDscRunAsAccount. See " + ` - "http://aka.ms/xSharePointRemoteIssues for details.") - } - } - } - return $result -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $true)] - [ValidateSet("WebApplication","SiteCollection")] - [System.String] - $SettingsScope, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowSharePointDesigner, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowDetachPagesFromDefinition, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowCustomiseMasterPage, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowManageSiteURLStructure, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowCreateDeclarativeWorkflow, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowSavePublishDeclarativeWorkflow, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowSaveDeclarativeWorkflowAsTemplate, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting SharePoint Designer configuration settings" - - switch ($SettingsScope) - { - "WebApplication" { - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - try - { - $spFarm = Get-SPFarm - } - catch - { - throw ("No local SharePoint farm was detected. SharePoint " + ` - "Designer settings will not be applied") - return - } - - Write-Verbose -Message "Start update SPD web application settings" - - # Check if web application exists - $webapp = Get-SPWebApplication | Where-Object -FilterScript { - ($_.Url).StartsWith($params.Url) - } - if ($null -eq $webapp) - { - throw ("Web application not found. SharePoint Designer settings " + ` - "will not be applied") - return - } - else - { - # Set the SharePoint Designer settings - if ($params.ContainsKey("AllowSharePointDesigner")) - { - $webapp.AllowDesigner = $params.AllowSharePointDesigner - } - if ($params.ContainsKey("AllowDetachPagesFromDefinition")) - { - $webapp.AllowRevertFromTemplate = $params.AllowDetachPagesFromDefinition - } - if ($params.ContainsKey("AllowCustomiseMasterPage")) - { - $webapp.AllowMasterPageEditing = $params.AllowCustomiseMasterPage - } - if ($params.ContainsKey("AllowManageSiteURLStructure")) - { - $webapp.ShowURLStructure = $params.AllowManageSiteURLStructure - } - if ($params.ContainsKey("AllowCreateDeclarativeWorkflow")) - { - $webapp.AllowCreateDeclarativeWorkflow = ` - $params.AllowCreateDeclarativeWorkflow - } - if ($params.ContainsKey("AllowSavePublishDeclarativeWorkflow")) - { - $webapp.AllowSavePublishDeclarativeWorkflow = ` - $params.AllowSavePublishDeclarativeWorkflow - } - if ($params.ContainsKey("AllowSaveDeclarativeWorkflowAsTemplate")) - { - $webapp.AllowSaveDeclarativeWorkflowAsTemplate = ` - $params.AllowSaveDeclarativeWorkflowAsTemplate - } - $webapp.Update() - } - } - } - "SiteCollection" { - if ((Test-SPDSCRunAsCredential -Credential $InstallAccount) -eq $true) - { - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - try - { - $spFarm = Get-SPFarm - } - catch - { - throw ("No local SharePoint farm was detected. SharePoint Designer " + ` - "settings will not be applied") - return - } - - Write-Verbose -Message "Start update SPD site collection settings" - - # Check if site collection exists - $site = Get-SPSite -Identity $params.Url -ErrorAction SilentlyContinue - if ($null -eq $site) - { - throw ("Site collection not found. SharePoint Designer settings " + ` - "will not be applied") - return $null - } - else - { - # Set the SharePoint Designer settings - if ($params.ContainsKey("AllowSharePointDesigner")) - { - $site.AllowDesigner = $params.AllowSharePointDesigner - } - if ($params.ContainsKey("AllowDetachPagesFromDefinition")) - { - $site.AllowRevertFromTemplate = $params.AllowDetachPagesFromDefinition - } - if ($params.ContainsKey("AllowCustomiseMasterPage")) - { - $site.AllowMasterPageEditing = $params.AllowCustomiseMasterPage - } - if ($params.ContainsKey("AllowManageSiteURLStructure")) - { - $site.ShowURLStructure = $params.AllowManageSiteURLStructure - } - if ($params.ContainsKey("AllowCreateDeclarativeWorkflow")) - { - $site.AllowCreateDeclarativeWorkflow = ` - $params.AllowCreateDeclarativeWorkflow - } - if ($params.ContainsKey("AllowSavePublishDeclarativeWorkflow")) - { - $site.AllowSavePublishDeclarativeWorkflow = ` - $params.AllowSavePublishDeclarativeWorkflow - } - if ($params.ContainsKey("AllowSaveDeclarativeWorkflowAsTemplate")) - { - $site.AllowSaveDeclarativeWorkflowAsTemplate = ` - $params.AllowSaveDeclarativeWorkflowAsTemplate - } - } - } - } - else - { - throw ("A known issue exists that prevents these settings from being " + ` - "managed when InstallAccount is used instead of PsDscRunAsAccount. " + ` - "See http://aka.ms/xSharePointRemoteIssues for details.") - } - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $true)] - [ValidateSet("WebApplication","SiteCollection")] - [System.String] - $SettingsScope, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowSharePointDesigner, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowDetachPagesFromDefinition, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowCustomiseMasterPage, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowManageSiteURLStructure, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowCreateDeclarativeWorkflow, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowSavePublishDeclarativeWorkflow, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowSaveDeclarativeWorkflowAsTemplate, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing SharePoint Designer configuration settings" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($null -eq $CurrentValues) - { - return $false - } - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPDesignerSettings/MSFT_SPDesignerSettings.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPDesignerSettings/MSFT_SPDesignerSettings.schema.mof deleted file mode 100644 index 1174ff18..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPDesignerSettings/MSFT_SPDesignerSettings.schema.mof +++ /dev/null @@ -1,15 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPDesignerSettings")] -class MSFT_SPDesignerSettings : OMI_BaseResource -{ - [Key, Description("The URL of the web application or site collection to configure")] string Url; - [Required, Description("Define the scope of the configuration - either WebApplication or SiteCollection"), ValueMap{"WebApplication","SiteCollection"}, Values{"WebApplication","SiteCollection"}] string SettingsScope; - [Write, Description("Allow the use of SharePoint Designer")] Boolean AllowSharePointDesigner; - [Write, Description("Allow pages to be un-ghosted by SharePoint Designer")] Boolean AllowDetachPagesFromDefinition; - [Write, Description("Allow masterpages to be changed by SharePoint Designer")] Boolean AllowCustomiseMasterPage; - [Write, Description("Allow site URL structure to be changed by SharePoint Designer")] Boolean AllowManageSiteURLStructure; - [Write, Description("Allow users to create declarative workflows with SharePoint Designer")] Boolean AllowCreateDeclarativeWorkflow; - [Write, Description("Allow users to save and re-publish declarative workflows with SharePoint Designer")] Boolean AllowSavePublishDeclarativeWorkflow; - [Write, Description("Allow users to save declarative workflows as a template from SharePoint Designer")] Boolean AllowSaveDeclarativeWorkflowAsTemplate; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPDiagnosticLoggingSettings/MSFT_SPDiagnosticLoggingSettings.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPDiagnosticLoggingSettings/MSFT_SPDiagnosticLoggingSettings.psm1 deleted file mode 100644 index a4eb386d..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPDiagnosticLoggingSettings/MSFT_SPDiagnosticLoggingSettings.psm1 +++ /dev/null @@ -1,321 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $LogPath, - - [parameter(Mandatory = $true)] - [System.UInt32] - $LogSpaceInGB, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AppAnalyticsAutomaticUploadEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $CustomerExperienceImprovementProgramEnabled, - - [parameter(Mandatory = $false)] - [System.UInt32] - $DaysToKeepLogs, - - [parameter(Mandatory = $false)] - [System.Boolean] - $DownloadErrorReportingUpdatesEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ErrorReportingAutomaticUploadEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ErrorReportingEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $EventLogFloodProtectionEnabled, - - [parameter(Mandatory = $false)] - [System.UInt32] - $EventLogFloodProtectionNotifyInterval, - - [parameter(Mandatory = $false)] - [System.UInt32] - $EventLogFloodProtectionQuietPeriod, - - [parameter(Mandatory = $false)] - [System.UInt32] - $EventLogFloodProtectionThreshold, - - [parameter(Mandatory = $false)] - [System.UInt32] - $EventLogFloodProtectionTriggerPeriod, - - [parameter(Mandatory = $false)] - [System.UInt32] - $LogCutInterval, - - [parameter(Mandatory = $false)] - [System.Boolean] - $LogMaxDiskSpaceUsageEnabled, - - [parameter(Mandatory = $false)] - [System.UInt32] - $ScriptErrorReportingDelay, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ScriptErrorReportingEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ScriptErrorReportingRequireAuth, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting diagnostic configuration settings" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $dc = Get-SPDiagnosticConfig -ErrorAction SilentlyContinue - if ($null -eq $dc) { - return $null - } - - return @{ - AppAnalyticsAutomaticUploadEnabled = $dc.AppAnalyticsAutomaticUploadEnabled - CustomerExperienceImprovementProgramEnabled = ` - $dc.CustomerExperienceImprovementProgramEnabled - ErrorReportingEnabled = $dc.ErrorReportingEnabled - ErrorReportingAutomaticUploadEnabled = $dc.ErrorReportingAutomaticUploadEnabled - DownloadErrorReportingUpdatesEnabled = $dc.DownloadErrorReportingUpdatesEnabled - DaysToKeepLogs = $dc.DaysToKeepLogs - LogMaxDiskSpaceUsageEnabled = $dc.LogMaxDiskSpaceUsageEnabled - LogSpaceInGB = $dc.LogDiskSpaceUsageGB - LogPath = $dc.LogLocation - LogCutInterval = $dc.LogCutInterval - EventLogFloodProtectionEnabled = $dc.EventLogFloodProtectionEnabled - EventLogFloodProtectionThreshold = $dc.EventLogFloodProtectionThreshold - EventLogFloodProtectionTriggerPeriod = $dc.EventLogFloodProtectionTriggerPeriod - EventLogFloodProtectionQuietPeriod = $dc.EventLogFloodProtectionQuietPeriod - EventLogFloodProtectionNotifyInterval = $dc.EventLogFloodProtectionNotifyInterval - ScriptErrorReportingEnabled = $dc.ScriptErrorReportingEnabled - ScriptErrorReportingRequireAuth = $dc.ScriptErrorReportingRequireAuth - ScriptErrorReportingDelay = $dc.ScriptErrorReportingDelay - InstallAccount = $params.InstallAccount - } - } - return $result -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $LogPath, - - [parameter(Mandatory = $true)] - [System.UInt32] - $LogSpaceInGB, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AppAnalyticsAutomaticUploadEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $CustomerExperienceImprovementProgramEnabled, - - [parameter(Mandatory = $false)] - [System.UInt32] - $DaysToKeepLogs, - - [parameter(Mandatory = $false)] - [System.Boolean] - $DownloadErrorReportingUpdatesEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ErrorReportingAutomaticUploadEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ErrorReportingEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $EventLogFloodProtectionEnabled, - - [parameter(Mandatory = $false)] - [System.UInt32] - $EventLogFloodProtectionNotifyInterval, - - [parameter(Mandatory = $false)] - [System.UInt32] - $EventLogFloodProtectionQuietPeriod, - - [parameter(Mandatory = $false)] - [System.UInt32] - $EventLogFloodProtectionThreshold, - - [parameter(Mandatory = $false)] - [System.UInt32] - $EventLogFloodProtectionTriggerPeriod, - - [parameter(Mandatory = $false)] - [System.UInt32] - $LogCutInterval, - - [parameter(Mandatory = $false)] - [System.Boolean] - $LogMaxDiskSpaceUsageEnabled, - - [parameter(Mandatory = $false)] - [System.UInt32] - $ScriptErrorReportingDelay, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ScriptErrorReportingEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ScriptErrorReportingRequireAuth, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting diagnostic configuration settings" - - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - if ($params.ContainsKey("InstallAccount")) - { - $params.Remove("InstallAccount") | Out-Null - } - $params = $params | Rename-SPDSCParamValue -oldName "LogPath" ` - -newName "LogLocation" ` - | Rename-SPDSCParamValue -oldName "LogSpaceInGB" ` - -newName "LogDiskSpaceUsageGB" - - Set-SPDiagnosticConfig @params - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $LogPath, - - [parameter(Mandatory = $true)] - [System.UInt32] - $LogSpaceInGB, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AppAnalyticsAutomaticUploadEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $CustomerExperienceImprovementProgramEnabled, - - [parameter(Mandatory = $false)] - [System.UInt32] - $DaysToKeepLogs, - - [parameter(Mandatory = $false)] - [System.Boolean] - $DownloadErrorReportingUpdatesEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ErrorReportingAutomaticUploadEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ErrorReportingEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $EventLogFloodProtectionEnabled, - - [parameter(Mandatory = $false)] - [System.UInt32] - $EventLogFloodProtectionNotifyInterval, - - [parameter(Mandatory = $false)] - [System.UInt32] - $EventLogFloodProtectionQuietPeriod, - - [parameter(Mandatory = $false)] - [System.UInt32] - $EventLogFloodProtectionThreshold, - - [parameter(Mandatory = $false)] - [System.UInt32] - $EventLogFloodProtectionTriggerPeriod, - - [parameter(Mandatory = $false)] - [System.UInt32] - $LogCutInterval, - - [parameter(Mandatory = $false)] - [System.Boolean] - $LogMaxDiskSpaceUsageEnabled, - - [parameter(Mandatory = $false)] - [System.UInt32] - $ScriptErrorReportingDelay, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ScriptErrorReportingEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ScriptErrorReportingRequireAuth, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing diagnostic configuration settings" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($null -eq $CurrentValues) - { - return $false - } - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPDiagnosticLoggingSettings/MSFT_SPDiagnosticLoggingSettings.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPDiagnosticLoggingSettings/MSFT_SPDiagnosticLoggingSettings.schema.mof deleted file mode 100644 index e2bd4586..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPDiagnosticLoggingSettings/MSFT_SPDiagnosticLoggingSettings.schema.mof +++ /dev/null @@ -1,24 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPDiagnosticLoggingSettings")] -class MSFT_SPDiagnosticLoggingSettings : OMI_BaseResource -{ - [Key, Description("The physical path on each server to store ULS logs")] string LogPath; - [Required, Description("The space in GB that should be used to store ULS logs")] uint32 LogSpaceInGB; - [Write, Description("Should app analytics automatically be uploaded")] boolean AppAnalyticsAutomaticUploadEnabled; - [Write, Description("Should the customer experience program be enabled in this farm")] boolean CustomerExperienceImprovementProgramEnabled; - [Write, Description("How many days should ULS logs be kept for")] uint32 DaysToKeepLogs; - [Write, Description("Should updates to error reporting tools be automatically downloaded")] boolean DownloadErrorReportingUpdatesEnabled; - [Write, Description("Should error reports be automatically uploaded")] boolean ErrorReportingAutomaticUploadEnabled; - [Write, Description("Should reporting of errors be enabled")] boolean ErrorReportingEnabled; - [Write, Description("Protect event logs with Event Log Flood Protection")] boolean EventLogFloodProtectionEnabled; - [Write, Description("What interval should the event logs report a flood event")] uint32 EventLogFloodProtectionNotifyInterval; - [Write, Description("What quiet period should reset the event log flood protection thresholds")] uint32 EventLogFloodProtectionQuietPeriod; - [Write, Description("What is the event log flood protection threshold")] uint32 EventLogFloodProtectionThreshold; - [Write, Description("What is the time period that will trigger event log flood protection")] uint32 EventLogFloodProtectionTriggerPeriod; - [Write, Description("How many minutes of activity will a ULS log file leep in an individual file")] uint32 LogCutInterval; - [Write, Description("Will the maximum disk space setting be enabled")] boolean LogMaxDiskSpaceUsageEnabled; - [Write, Description("What delay will be set before script error reporting is triggered")] uint32 ScriptErrorReportingDelay; - [Write, Description("Is script error reporting enabled in this farm")] boolean ScriptErrorReportingEnabled; - [Write, Description("Require users to be authenticated to allow script errors to be reported")] boolean ScriptErrorReportingRequireAuth; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPDistributedCacheService/MSFT_SPDistributedCacheService.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPDistributedCacheService/MSFT_SPDistributedCacheService.psm1 deleted file mode 100644 index d670c869..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPDistributedCacheService/MSFT_SPDistributedCacheService.psm1 +++ /dev/null @@ -1,405 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.UInt32] - $CacheSizeInMB, - - [parameter(Mandatory = $true)] - [System.String] - $ServiceAccount, - - [parameter(Mandatory = $true)] - [System.Boolean] - $CreateFirewallRules, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.String[]] - $ServerProvisionOrder, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting the cache host information" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - $nullReturnValue = @{ - Name = $params.Name - Ensure = "Absent" - InstallAccount = $params.InstallAccount - } - - try - { - Use-CacheCluster -ErrorAction SilentlyContinue - $cacheHost = Get-CacheHost -ErrorAction SilentlyContinue - - if ($null -eq $cacheHost) - { - return $nullReturnValue - } - $computerName = ([System.Net.Dns]::GetHostByName($env:computerName)).HostName - $cachePort = ($cacheHost | Where-Object -FilterScript { - $_.HostName -eq $computerName - }).PortNo - $cacheHostConfig = Get-AFCacheHostConfiguration -ComputerName $computerName ` - -CachePort $cachePort ` - -ErrorAction SilentlyContinue - - $windowsService = Get-CimInstance -Class Win32_Service -Filter "Name='AppFabricCachingService'" - $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Distributed Cache" ` - -ErrorAction SilentlyContinue - - return @{ - Name = $params.Name - CacheSizeInMB = $cacheHostConfig.Size - ServiceAccount = $windowsService.StartName - CreateFirewallRules = ($null -ne $firewallRule) - Ensure = "Present" - ServerProvisionOrder = $params.ServerProvisionOrder - InstallAccount = $params.InstallAccount - } - } - catch - { - return $nullReturnValue - } - } - return $result -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.UInt32] - $CacheSizeInMB, - - [parameter(Mandatory = $true)] - [System.String] - $ServiceAccount, - - [parameter(Mandatory = $true)] - [System.Boolean] - $CreateFirewallRules, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.String[]] - $ServerProvisionOrder, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting the cache host information" - - $CurrentState = Get-TargetResource @PSBoundParameters - - if ($Ensure -eq "Present") - { - Write-Verbose -Message "Adding the distributed cache to the server" - if ($createFirewallRules -eq $true) - { - Write-Verbose -Message "Create a firewall rule for AppFabric" - Invoke-SPDSCCommand -Credential $InstallAccount -ScriptBlock { - $icmpRuleName = "File and Printer Sharing (Echo Request - ICMPv4-In)" - $icmpFirewallRule = Get-NetFirewallRule -DisplayName $icmpRuleName ` - -ErrorAction SilentlyContinue - if ($null -eq $icmpFirewallRule ) - { - New-NetFirewallRule -Name Allow_Ping -DisplayName $icmpRuleName ` - -Description "Allow ICMPv4 ping" ` - -Protocol ICMPv4 ` - -IcmpType 8 ` - -Enabled True ` - -Profile Any ` - -Action Allow - } - Enable-NetFirewallRule -DisplayName $icmpRuleName - - $spRuleName = "SharePoint Distributed Cache" - $firewallRule = Get-NetFirewallRule -DisplayName $spRuleName ` - -ErrorAction SilentlyContinue - if ($null -eq $firewallRule) - { - New-NetFirewallRule -Name "SPDistCache" ` - -DisplayName $spRuleName ` - -Protocol TCP ` - -LocalPort 22233-22236 ` - -Group "SharePoint" - } - Enable-NetFirewallRule -DisplayName $spRuleName - } - Write-Verbose -Message "Firewall rule added" - } - - Write-Verbose -Message ("Current state is '$($CurrentState.Ensure)' " + ` - "and desired state is '$Ensure'") - - if ($CurrentState.Ensure -ne $Ensure) - { - Write-Verbose -Message "Enabling distributed cache service" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - if ($params.ContainsKey("ServerProvisionOrder")) - { - $serverCount = 0 - $currentServer = $params.ServerProvisionOrder[$serverCount] - - while ($currentServer -ne $env:COMPUTERNAME) - { - $count = 0 - $maxCount = 30 - - # Attempt to see if we can find the service with just the computer - # name, or if we need to use the FQDN - $si = Get-SPServiceInstance -Server $currentServer ` - | Where-Object -FilterScript { - $_.GetType().Name -eq "SPDistributedCacheServiceInstance" - } - - if ($null -eq $si) - { - $domain = (Get-CimInstance -ClassName Win32_ComputerSystem).Domain - $currentServer = "$currentServer.$domain" - } - - Write-Verbose "Waiting for cache on $currentServer" - $serviceCheck = Get-SPServiceInstance -Server $currentServer ` - | Where-Object -FilterScript { - $_.GetType().Name -eq "SPDistributedCacheServiceInstance" -and ` - $_.Status -eq "Online" - } - - while (($count -lt $maxCount) -and ($null -eq $serviceCheck)) { - Write-Verbose -Message ("$([DateTime]::Now.ToShortTimeString()) - " + ` - "Waiting for distributed cache to start " + ` - "on $currentServer (waited $count of " + ` - "$maxCount minutes)") - Start-Sleep -Seconds 60 - $serviceCheck = Get-SPServiceInstance -Server $currentServer ` - | Where-Object -FilterScript { - $_.GetType().Name -eq "SPDistributedCacheServiceInstance" -and ` - $_.Status -eq "Online" - } - $count++ - } - - $serviceCheck = Get-SPServiceInstance -Server $currentServer ` - | Where-Object -FilterScript { - $_.GetType().Name -eq "SPDistributedCacheServiceInstance" ` - -and $_.Status -eq "Online" - } - - if ($null -eq $serviceCheck) - { - Write-Warning -Message ("Server $currentServer is not running " + ` - "distributed cache after waiting 30 " + ` - "minutes. No longer waiting for this " + ` - "server, progressing to next action") - } - - $serverCount++ - - if ($ServerCount -ge $params.ServerProvisionOrder.Length) - { - throw ("The server $($env:COMPUTERNAME) was not found in the " + ` - "array for distributed cache servers") - } - $currentServer = $params.ServerProvisionOrder[$serverCount] - } - } - - - Add-SPDistributedCacheServiceInstance - - Get-SPServiceInstance | Where-Object -FilterScript { - $_.GetType().Name -eq "SPDistributedCacheServiceInstance" - } | Stop-SPServiceInstance -Confirm:$false - - $count = 0 - $maxCount = 30 - - $serviceCheck = Get-SPServiceInstance | Where-Object -FilterScript { - $_.GetType().Name -eq "SPDistributedCacheServiceInstance" -and ` - $_.Status -ne "Disabled" - } - - while (($count -lt $maxCount) -and ($null -ne $serviceCheck)) { - Write-Verbose -Message ("$([DateTime]::Now.ToShortTimeString()) - Waiting " + ` - "for distributed cache to stop on all servers " + ` - "(waited $count of $maxCount minutes)") - Start-Sleep -Seconds 60 - $serviceCheck = Get-SPServiceInstance | Where-Object -FilterScript { - $_.GetType().Name -eq "SPDistributedCacheServiceInstance" -and ` - $_.Status -ne "Disabled" - } - $count++ - } - - Update-SPDistributedCacheSize -CacheSizeInMB $params.CacheSizeInMB - - Get-SPServiceInstance | Where-Object -FilterScript { - $_.GetType().Name -eq "SPDistributedCacheServiceInstance" - } | Start-SPServiceInstance - - $count = 0 - $maxCount = 30 - - $serviceCheck = Get-SPServiceInstance | Where-Object -FilterScript { - $_.GetType().Name -eq "SPDistributedCacheServiceInstance" -and ` - $_.Status -ne "Online" - } - - while (($count -lt $maxCount) -and ($null -ne $serviceCheck)) { - Write-Verbose -Message ("$([DateTime]::Now.ToShortTimeString()) - Waiting " + ` - "for distributed cache to start on all servers " + ` - "(waited $count of $maxCount minutes)") - Start-Sleep -Seconds 60 - $serviceCheck = Get-SPServiceInstance | Where-Object -FilterScript { - $_.GetType().Name -eq "SPDistributedCacheServiceInstance" -and ` - $_.Status -ne "Online" - } - $count++ - } - - $farm = Get-SPFarm - $cacheService = $farm.Services | Where-Object -FilterScript { - $_.Name -eq "AppFabricCachingService" - } - - if ($cacheService.ProcessIdentity.ManagedAccount.Username -ne $params.ServiceAccount) - { - $cacheService.ProcessIdentity.CurrentIdentityType = "SpecificUser" - $account = Get-SPManagedAccount -Identity $params.ServiceAccount - $cacheService.ProcessIdentity.ManagedAccount = $account - $cacheService.ProcessIdentity.Update() - $cacheService.ProcessIdentity.Deploy() - } - } - } - } - else - { - Write-Verbose -Message "Removing distributed cache to the server" - Invoke-SPDSCCommand -Credential $InstallAccount -ScriptBlock { - $serviceInstance = Get-SPServiceInstance -Server $env:computername ` - | Where-Object -FilterScript { - $_.GetType().Name -eq "SPDistributedCacheServiceInstance" - } - - if ($null -eq $serviceInstance) - { - $domain = (Get-CimInstance -ClassName Win32_ComputerSystem).Domain - $currentServer = "$($env:computername).$domain" - $serviceInstance = Get-SPServiceInstance -Server $currentServer ` - | Where-Object -FilterScript { - $_.GetType().Name -eq "SPDistributedCacheServiceInstance" - } - } - if ($null -eq $serviceInstance) - { - throw ("Unable to locate a distributed cache service instance " + ` - "on $($env:computername) to remove") - } - $serviceInstance.Delete() - - Remove-SPDistributedCacheServiceInstance - } - if ($CreateFirewallRules -eq $true) - { - Invoke-SPDSCCommand -Credential $InstallAccount -ScriptBlock { - $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Distribute Cache" ` - -ErrorAction SilentlyContinue - if($null -ne $firewallRule) - { - Write-Verbose -Message "Disabling firewall rules." - Disable-NetFirewallRule -DisplayName "SharePoint Distribute Cache" - } - } - } - Write-Verbose -Message "Distributed cache removed." - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.UInt32] - $CacheSizeInMB, - - [parameter(Mandatory = $true)] - [System.String] - $ServiceAccount, - - [parameter(Mandatory = $true)] - [System.Boolean] - $CreateFirewallRules, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.String[]] - $ServerProvisionOrder, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing the cache host information" - - $PSBoundParameters.Ensure = $Ensure - - $CurrentValues = Get-TargetResource @PSBoundParameters - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure", "CreateFirewallRules") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPDistributedCacheService/MSFT_SPDistributedCacheService.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPDistributedCacheService/MSFT_SPDistributedCacheService.schema.mof deleted file mode 100644 index 58ba7c76..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPDistributedCacheService/MSFT_SPDistributedCacheService.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPDistributedCacheService")] -class MSFT_SPDistributedCacheService : OMI_BaseResource -{ - [Key, Description("A name to assign to this resource - not really used. For example - AppFabricCachingService")] String Name; - [Write, Description("Present to ensure the current server should be running distributed cache, absent to ensure that it isn't running"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Required, Description("How many MB should be used for the cache. The maximum supported is 16384")] UInt32 CacheSizeInMB; - [Required, Description("The name of the service account to run the service as. This should already be registered as a managed account in SharePoint")] String ServiceAccount; - [Write, Description("A list of servers which specifies the order they should provision the cache in to ensure that two servers do not do it at the same time")] String ServerProvisionOrder[]; - [Required, Description("Should the Windows Firewall rules for distributed cache be created?")] Boolean CreateFirewallRules; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPExcelServiceApp/MSFT_SPExcelServiceApp.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPExcelServiceApp/MSFT_SPExcelServiceApp.psm1 deleted file mode 100644 index 808963c3..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPExcelServiceApp/MSFT_SPExcelServiceApp.psm1 +++ /dev/null @@ -1,673 +0,0 @@ -$Script:TrustLocationProperties = @( - "Address", - "LocationType", - "IncludeChildren", - "SessionTimeout", - "ShortSessionTimeout", - "NewWorkbookSessionTimeout", - "RequestDurationMax", - "ChartRenderDurationMax", - "WorkbookSizeMax", - "ChartAndImageSizeMax", - "AutomaticVolatileFunctionCacheLifetime", - "DefaultWorkbookCalcMode", - "ExternalDataAllowed", - "WarnOnDataRefresh", - "DisplayGranularExtDataErrors", - "AbortOnRefreshOnOpenFail", - "PeriodicExtDataCacheLifetime", - "ManualExtDataCacheLifetime", - "ConcurrentDataRequestsPerSessionMax", - "UdfsAllowed", - "Description", - "RESTExternalDataAllowed" -) -$Script:ServiceAppObjectType = "Microsoft.Office.Excel.Server.MossHost.ExcelServerWebServiceApplication" - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [Microsoft.Management.Infrastructure.CimInstance[]] - $TrustedFileLocations, - - [parameter(Mandatory = $false)] - [System.Boolean] - $CachingOfUnusedFilesEnable, - - [parameter(Mandatory = $false)] - [System.Boolean] - $CrossDomainAccessAllowed, - - [parameter(Mandatory = $false)] - [ValidateSet("None","Connection")] - [System.String] - $EncryptedUserConnectionRequired, - - [parameter(Mandatory = $false)] - [System.UInt32] - $ExternalDataConnectionLifetime, - - [parameter(Mandatory = $false)] - [ValidateSet("UseImpersonation","UseFileAccessAccount")] - [System.String] - $FileAccessMethod, - - [parameter(Mandatory = $false)] - [ValidateSet("RoundRobin","Local","WorkbookURL")] - [System.String] - $LoadBalancingScheme, - - [parameter(Mandatory = $false)] - [System.UInt32] - $MemoryCacheThreshold, - - [parameter(Mandatory = $false)] - [System.UInt32] - $PrivateBytesMax, - - [parameter(Mandatory = $false)] - [System.UInt32] - $SessionsPerUserMax, - - [parameter(Mandatory = $false)] - [System.UInt32] - $SiteCollectionAnonymousSessionsMax, - - [parameter(Mandatory = $false)] - [System.Boolean] - $TerminateProcessOnAccessViolation, - - [parameter(Mandatory = $false)] - [System.UInt32] - $ThrottleAccessViolationsPerSiteCollection, - - [parameter(Mandatory = $false)] - [System.String] - $UnattendedAccountApplicationId, - - [parameter(Mandatory = $false)] - [System.UInt32] - $UnusedObjectAgeMax, - - [parameter(Mandatory = $false)] - [System.String] - $WorkbookCache, - - [parameter(Mandatory = $false)] - [System.UInt32] - $WorkbookCacheSizeMax, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting Excel Services Application '$Name'" - - if ((Get-SPDSCInstalledProductVersion).FileMajorPart -ne 15) - { - throw [Exception] ("Only SharePoint 2013 is supported to deploy Excel Services " + ` - "service applications via DSC, as SharePoint 2016 deprecated " + ` - "this service. See " + ` - "https://technet.microsoft.com/en-us/library/mt346112(v=office.16).aspx " + ` - "for more info.") - } - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $Script:ServiceAppObjectType) ` - -ScriptBlock { - $params = $args[0] - $serviceAppObjectType = $args[1] - - $serviceApps = Get-SPServiceApplication -Name $params.Name ` - -ErrorAction SilentlyContinue - $nullReturn = @{ - Name = $params.Name - ApplicationPool = $params.ApplicationPool - Ensure = "Absent" - InstallAccount = $params.InstallAccount - } - if ($null -eq $serviceApps) - { - return $nullReturn - } - $serviceApp = $serviceApps | Where-Object -FilterScript { - $_.GetType().FullName -eq $serviceAppObjectType - } - - if ($null -eq $serviceApp) - { - return $nullReturn - } - else - { - $fileLocations = Get-SPExcelFileLocation -ExcelServiceApplication $serviceApp - $fileLocationsToReturn = @() - $fileLocations | ForEach-Object -Process { - $fileLocationsToReturn += @{ - Address = $_.Address - LocationType = $_.LocationType - IncludeChildren = [Convert]::ToBoolean($_.IncludeChildren) - SessionTimeout = $_.SessionTimeout - ShortSessionTimeout = $_.ShortSessionTimeout - NewWorkbookSessionTimeout = $_.NewWorkbookSessionTimeout - RequestDurationMax = $_.RequestDurationMax - ChartRenderDurationMax = $_.ChartRenderDurationMax - WorkbookSizeMax = $_.WorkbookSizeMax - ChartAndImageSizeMax = $_.ChartAndImageSizeMax - AutomaticVolatileFunctionCacheLifetime = $_.AutomaticVolatileFunctionCacheLifetime - DefaultWorkbookCalcMode = $_.DefaultWorkbookCalcMode - ExternalDataAllowed = $_.ExternalDataAllowed - WarnOnDataRefresh = [Convert]::ToBoolean($_.WarnOnDataRefresh) - DisplayGranularExtDataErrors = [Convert]::ToBoolean($_.DisplayGranularExtDataErrors) - AbortOnRefreshOnOpenFail = [Convert]::ToBoolean($_.AbortOnRefreshOnOpenFail) - PeriodicExtDataCacheLifetime = $_.PeriodicExtDataCacheLifetime - ManualExtDataCacheLifetime = $_.ManualExtDataCacheLifetime - ConcurrentDataRequestsPerSessionMax = $_.ConcurrentDataRequestsPerSessionMax - UdfsAllowed = [Convert]::ToBoolean($_.UdfsAllowed) - Description = $_.Description - RESTExternalDataAllowed = [Convert]::ToBoolean($_.RESTExternalDataAllowed) - } - } - - $returnVal = @{ - Name = $serviceApp.DisplayName - ApplicationPool = $serviceApp.ApplicationPool.Name - Ensure = "Present" - TrustedFileLocations = $fileLocationsToReturn - CachingOfUnusedFilesEnable = $serviceApp.CachingOfUnusedFilesEnable - CrossDomainAccessAllowed = $serviceApp.CrossDomainAccessAllowed - EncryptedUserConnectionRequired = $serviceApp.EncryptedUserConnectionRequired - ExternalDataConnectionLifetime = $serviceApp.ExternalDataConnectionLifetime - FileAccessMethod = $serviceApp.FileAccessMethod - LoadBalancingScheme = $serviceApp.LoadBalancingScheme - MemoryCacheThreshold = $serviceApp.MemoryCacheThreshold - PrivateBytesMax = $serviceApp.PrivateBytesMax - SessionsPerUserMax = $serviceApp.SessionsPerUserMax - SiteCollectionAnonymousSessionsMax = $serviceApp.SiteCollectionAnonymousSessionsMax - TerminateProcessOnAccessViolation = $serviceApp.TerminateProcessOnAccessViolation - ThrottleAccessViolationsPerSiteCollection = $serviceApp.ThrottleAccessViolationsPerSiteCollection - UnattendedAccountApplicationId = $serviceApp.UnattendedAccountApplicationId - UnusedObjectAgeMax = $serviceApp.UnusedObjectAgeMax - WorkbookCache = $serviceApp.WorkbookCache - WorkbookCacheSizeMax = $serviceApp.WorkbookCacheSizeMax - InstallAccount = $params.InstallAccount - } - return $returnVal - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [Microsoft.Management.Infrastructure.CimInstance[]] - $TrustedFileLocations, - - [parameter(Mandatory = $false)] - [System.Boolean] - $CachingOfUnusedFilesEnable, - - [parameter(Mandatory = $false)] - [System.Boolean] - $CrossDomainAccessAllowed, - - [parameter(Mandatory = $false)] - [ValidateSet("None","Connection")] - [System.String] - $EncryptedUserConnectionRequired, - - [parameter(Mandatory = $false)] - [System.UInt32] - $ExternalDataConnectionLifetime, - - [parameter(Mandatory = $false)] - [ValidateSet("UseImpersonation","UseFileAccessAccount")] - [System.String] - $FileAccessMethod, - - [parameter(Mandatory = $false)] - [ValidateSet("RoundRobin","Local","WorkbookURL")] - [System.String] - $LoadBalancingScheme, - - [parameter(Mandatory = $false)] - [System.UInt32] - $MemoryCacheThreshold, - - [parameter(Mandatory = $false)] - [System.UInt32] - $PrivateBytesMax, - - [parameter(Mandatory = $false)] - [System.UInt32] - $SessionsPerUserMax, - - [parameter(Mandatory = $false)] - [System.UInt32] - $SiteCollectionAnonymousSessionsMax, - - [parameter(Mandatory = $false)] - [System.Boolean] - $TerminateProcessOnAccessViolation, - - [parameter(Mandatory = $false)] - [System.UInt32] - $ThrottleAccessViolationsPerSiteCollection, - - [parameter(Mandatory = $false)] - [System.String] - $UnattendedAccountApplicationId, - - [parameter(Mandatory = $false)] - [System.UInt32] - $UnusedObjectAgeMax, - - [parameter(Mandatory = $false)] - [System.String] - $WorkbookCache, - - [parameter(Mandatory = $false)] - [System.UInt32] - $WorkbookCacheSizeMax, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting Excel Services Application '$Name'" - - if ((Get-SPDSCInstalledProductVersion).FileMajorPart -ne 15) - { - throw [Exception] ("Only SharePoint 2013 is supported to deploy Excel Services " + ` - "service applications via DSC, as SharePoint 2016 deprecated " + ` - "this service. See " + ` - "https://technet.microsoft.com/en-us/library/mt346112(v=office.16).aspx " + ` - "for more info.") - } - $result = Get-TargetResource @PSBoundParameters - - if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") - { - Write-Verbose -Message "Creating Excel Services Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - New-SPExcelServiceApplication -Name $params.Name ` - -ApplicationPool $params.ApplicationPool ` - -Default - } - } - - if ($Ensure -eq "Present") - { - Write-Verbose -Message "Updating settings for Excel Services Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $params.Add("Identity", $params.Name) - - # Remove parameters that do not belong on the set method - @("InstallAccount", "Ensure", "TrustedFileLocations", "Name", "ApplicationPool") | - ForEach-Object -Process { - if ($params.ContainsKey($_) -eq $true) - { - $params.Remove($_) | Out-Null - } - } - - Set-SPExcelServiceApplication @params - } - - - # Update trusted locations - if ($null -ne $TrustedFileLocations) - { - $TrustedFileLocations | ForEach-Object -Process { - $desiredLocation = $_ - $matchingCurrentValue = $result.TrustedFileLocations | Where-Object -FilterScript { - $_.Address -eq $desiredLocation.Address - } - if ($null -eq $matchingCurrentValue) - { - Write-Verbose -Message "Adding trusted location '$($desiredLocation.Address)' to service app" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $desiredLocation, $Script:TrustLocationProperties, $Script:ServiceAppObjectType) ` - -ScriptBlock { - $params = $args[0] - $desiredLocation = $args[1] - $trustLocationProperties = $args[2] - $serviceAppObjectType = $args[3] - - $newArgs = @{} - $trustLocationProperties | ForEach-Object -Process { - if ($null -ne $desiredLocation.$_) - { - $newArgs.Add($_, $desiredLocation.$_) - } - } - $serviceApp = Get-SPServiceApplication -Name $params.Name | Where-Object -FilterScript { - $_.GetType().FullName -eq $serviceAppObjectType - } - $newArgs.Add("ExcelServiceApplication", $serviceApp) - - New-SPExcelFileLocation @newArgs - } - } - else - { - Write-Verbose -Message "Updating trusted location '$($desiredLocation.Address)' in service app" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $desiredLocation, $Script:TrustLocationProperties, $Script:ServiceAppObjectType) ` - -ScriptBlock { - $params = $args[0] - $desiredLocation = $args[1] - $trustLocationProperties = $args[2] - $serviceAppObjectType = $args[3] - - $updateArgs = @{} - $trustLocationProperties | ForEach-Object -Process { - if ($null -ne $desiredLocation.$_) - { - $updateArgs.Add($_, $desiredLocation.$_) - } - } - $serviceApp = Get-SPServiceApplication -Name $params.Name | Where-Object -FilterScript { - $_.GetType().FullName -eq $serviceAppObjectType - } - $updateArgs.Add("Identity", $desiredLocation.Address) - $updateArgs.Add("ExcelServiceApplication", $serviceApp) - - Set-SPExcelFileLocation @updateArgs - } - } - } - - # Remove unlisted trusted locations - $result.TrustedFileLocations | ForEach-Object -Process { - $currentLocation = $_ - $matchingDesiredValue = $TrustedFileLocations | Where-Object -FilterScript { - $_.Address -eq $currentLocation.Address - } - if ($null -eq $matchingDesiredValue) - { - Write-Verbose -Message "Removing trusted location '$($currentLocation.Address)' from service app" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments @($Name, $currentLocation) ` - -ScriptBlock { - $name = $args[0] - $currentLocation = $args[1] - - Remove-SPExcelFileLocation -ExcelServiceApplication $name -Identity $currentLocation.Address -Confirm:$false - } - } - } - } - } - - if ($Ensure -eq "Absent") - { - Write-Verbose -Message "Removing Excel Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $Script:ServiceAppObjectType) ` - -ScriptBlock { - $params = $args[0] - $serviceAppObjectType = $args[1] - - $serviceApp = Get-SPServiceApplication -Name $params.Name | Where-Object -FilterScript { - $_.GetType().FullName -eq $serviceAppObjectType - } - - $proxies = Get-SPServiceApplicationProxy - foreach($proxyInstance in $proxies) - { - if($serviceApp.IsConnected($proxyInstance)) - { - $proxyInstance.Delete() - } - } - - Remove-SPServiceApplication -Identity $serviceApp -Confirm:$false - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [Microsoft.Management.Infrastructure.CimInstance[]] - $TrustedFileLocations, - - [parameter(Mandatory = $false)] - [System.Boolean] - $CachingOfUnusedFilesEnable, - - [parameter(Mandatory = $false)] - [System.Boolean] - $CrossDomainAccessAllowed, - - [parameter(Mandatory = $false)] - [ValidateSet("None","Connection")] - [System.String] - $EncryptedUserConnectionRequired, - - [parameter(Mandatory = $false)] - [System.UInt32] - $ExternalDataConnectionLifetime, - - [parameter(Mandatory = $false)] - [ValidateSet("UseImpersonation","UseFileAccessAccount")] - [System.String] - $FileAccessMethod, - - [parameter(Mandatory = $false)] - [ValidateSet("RoundRobin","Local","WorkbookURL")] - [System.String] - $LoadBalancingScheme, - - [parameter(Mandatory = $false)] - [System.UInt32] - $MemoryCacheThreshold, - - [parameter(Mandatory = $false)] - [System.UInt32] - $PrivateBytesMax, - - [parameter(Mandatory = $false)] - [System.UInt32] - $SessionsPerUserMax, - - [parameter(Mandatory = $false)] - [System.UInt32] - $SiteCollectionAnonymousSessionsMax, - - [parameter(Mandatory = $false)] - [System.Boolean] - $TerminateProcessOnAccessViolation, - - [parameter(Mandatory = $false)] - [System.UInt32] - $ThrottleAccessViolationsPerSiteCollection, - - [parameter(Mandatory = $false)] - [System.String] - $UnattendedAccountApplicationId, - - [parameter(Mandatory = $false)] - [System.UInt32] - $UnusedObjectAgeMax, - - [parameter(Mandatory = $false)] - [System.String] - $WorkbookCache, - - [parameter(Mandatory = $false)] - [System.UInt32] - $WorkbookCacheSizeMax, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing Excel Services Application '$Name'" - - $PSBoundParameters.Ensure = $Ensure - - if ((Get-SPDSCInstalledProductVersion).FileMajorPart -ne 15) - { - throw [Exception] ("Only SharePoint 2013 is supported to deploy Excel Services " + ` - "service applications via DSC, as SharePoint 2016 deprecated " + ` - "this service. See " + ` - "https://technet.microsoft.com/en-us/library/mt346112(v=office.16).aspx " + ` - "for more info.") - } - - $CurrentValues = Get-TargetResource @PSBoundParameters - - $mainCheck = Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @( - "Ensure", - "CachingOfUnusedFilesEnable", - "CrossDomainAccessAllowed", - "EncryptedUserConnectionRequired", - "ExternalDataConnectionLifetime", - "FileAccessMethod", - "LoadBalancingScheme", - "MemoryCacheThreshold", - "PrivateBytesMax", - "SessionsPerUserMax", - "SiteCollectionAnonymousSessionsMax", - "TerminateProcessOnAccessViolation", - "ThrottleAccessViolationsPerSiteCollection", - "UnattendedAccountApplicationId", - "UnusedObjectAgeMax", - "WorkbookCache", - "WorkbookCacheSizeMax" - ) - - - if ($Ensure -eq "Present" -and $mainCheck -eq $true -and $null -ne $TrustedFileLocations) - { - # Check that all the desired types are in the current values and match - $locationCheck = $TrustedFileLocations | ForEach-Object -Process { - $desiredLocation = $_ - $matchingCurrentValue = $CurrentValues.TrustedFileLocations | Where-Object -FilterScript { - $_.Address -eq $desiredLocation.Address - } - if ($null -eq $matchingCurrentValue) - { - Write-Verbose -Message ("Trusted file location '$($_.Address)' was not found " + ` - "in the Excel service app. Desired state is false.") - return $false - } - else - { - $Script:TrustLocationProperties | ForEach-Object -Process { - if ($desiredLocation.CimInstanceProperties.Name -contains $_) - { - if ($desiredLocation.$_ -ne $matchingCurrentValue.$_) - { - Write-Verbose -Message ("Trusted file location '$($desiredLocation.Address)' did not match " + ` - "desired property '$_'. Desired value is " + ` - "'$($desiredLocation.$_)' but the current value is " + ` - "'$($matchingCurrentValue.$_)'") - return $false - } - } - } - } - return $true - } - if ($locationCheck -contains $false) - { - return $false - } - - # Check that any other existing trusted locations are in the desired state - $locationCheck = $CurrentValues.TrustedFileLocations | ForEach-Object -Process { - $currentLocation = $_ - $matchingDesiredValue = $TrustedFileLocations | Where-Object -FilterScript { - $_.Address -eq $currentLocation.Address - } - if ($null -eq $matchingDesiredValue) - { - Write-Verbose -Message ("Existing trusted file location '$($_.Address)' was not " + ` - "found in the desired state for this service " + ` - "application. Desired state is false.") - return $false - } - return $true - } - if ($locationCheck -contains $false) - { - return $false - } - - # at this point if no other value has been returned, all desired entires exist and are - # correct, and no existing entries exist that are not in desired state, so return true - return $true - } - else - { - return $mainCheck - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPExcelServiceApp/MSFT_SPExcelServiceApp.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPExcelServiceApp/MSFT_SPExcelServiceApp.schema.mof deleted file mode 100644 index 371736fc..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPExcelServiceApp/MSFT_SPExcelServiceApp.schema.mof +++ /dev/null @@ -1,50 +0,0 @@ -[ClassVersion("1.0.0.0")] -Class MSFT_SPExcelFileLocation -{ - [Key, Description("The address of the file location")] String Address; - [Required, Description("The type of the trusted file location"), ValueMap{"SharePoint","UNC", "HTTP"}, Values{"SharePoint","UNC", "HTTP"}] String LocationType; - [Write, Description("Specifies that the loading of a Excel Services Application file automatically fails if an automatic data refresh operation fails when the file is opened.")] Boolean AbortOnRefreshOnOpenFail; - [Write, Description("Specifies the maximum time, in seconds, that a computed value for a volatile function is cached for automatic recalculations.")] Uint32 AutomaticVolatileFunctionCacheLifetime; - [Write, Description("Specifies the maximum size, in megabytes, of a chart or image that can be opened.")] Uint32 ChartAndImageSizeMax; - [Write, Description("Specifies the maximum number of concurrent external data requests allowed in each session.")] Uint32 ConcurrentDataRequestsPerSessionMax; - [Write, Description("Specifies the calculation mode of workbooks."), ValueMap{"File","Manual", "Auto", "AutoDataTables"}, Values{"File","Manual", "Auto", "AutoDataTables"}] String DefaultWorkbookCalcMode; - [Write, Description("Specifies a friendly description for the new file location.")] String Description; - [Write, Description("Displays granular error messages for external data failures for files in this location.")] Boolean DisplayGranularExtDataErrors; - [Write, Description("Specifies the type of external data access allowed for workbooks."), ValueMap{"None","Dcl", "DclandEmbedded"}, Values{"None","Dcl", "DclandEmbedded"}] String ExternalDataAllowed; - [Write, Description("Indicates that subordinate URLs, directories and libraries are trusted.")] Boolean IncludeChildren; - [Write, Description("Specifies the time, in seconds, that Excel Services Application waits before it re-issues a manual, or user-initiated, external data request.")] Uint32 ManualExtDataCacheLifetime; - [Write, Description("Specifies the time, in seconds, that a session for a new, unsaved, workbook remains active on Excel Services Application with no user activity.")] Uint32 NewWorkbookSessionTimeout; - [Write, Description("Specifies the time, in seconds, that Excel Services Application waits before it re-issues an on-open or periodic (that is, automatic) external data request.")] Uint32 PeriodicExtDataCacheLifetime; - [Write, Description("Specifies the maximum duration, in seconds, for a single request in a session.")] Uint32 RequestDurationMax; - [Write, Description("Specifies whether requests from the Representational State Transfer (REST) Application Programming Interface (API) are permitted to refresh external data connections.")] Boolean RESTExternalDataAllowed; - [Write, Description("Specifies the time, in seconds, that a session remains active on Excel Services Application with no user activity.")] Uint32 SessionTimeout; - [Write, Description("Specifies the time, in seconds, that a user has to make the initial interaction with a spreadsheet.")] Uint32 ShortSessionTimeout; - [Write, Description("Specifies that user-defined functions can be called by workbooks that are loaded from the trusted file location that is specified in Address.")] Boolean UdfsAllowed; - [Write, Description("Specifies that a warning is displayed to the user on the first refresh of data for the workbook.")] Boolean WarnOnDataRefresh; - [Write, Description("Specifies the maximum size, in megabytes, of a workbook that can be loaded.")] Uint32 WorkbookSizeMax; -}; -[ClassVersion("1.0.0.0"), FriendlyName("SPExcelServiceApp")] -class MSFT_SPExcelServiceApp : OMI_BaseResource -{ - [Key, Description("The name of the service application")] string Name; - [Required, Description("The name of the application pool to run the service app in")] string ApplicationPool; - [Write, Description("Trusted file locations for the service app"), EmbeddedInstance("MSFT_SPExcelFileLocation")] string TrustedFileLocations[]; - [Write, Description("Specifies that files that are no longer used by Excel Services Application can remain in the cache for later use.")] Boolean CachingOfUnusedFilesEnable; - [Write, Description("Specifies that trusted workbooks and data connection files can be requested and rendered by Web Parts or pages that reside in other HTTP domains.")] Boolean CrossDomainAccessAllowed; - [Write, Description("Requires that encryption is used between the end-user and the server running Excel Services Application."), ValueMap{"None","Connection"}, Values{"None","Connection"}] String EncryptedUserConnectionRequired; - [Write, Description("Specifies the maximum number of seconds that an external data connection can remain open in the connection pool.")] Uint32 ExternalDataConnectionLifetime; - [Write, Description("Specifies the authentication method that Excel Services Application uses to retrieve files."), ValueMap{"UseImpersonation","UseFileAccessAccount"}, Values{"UseImpersonation","UseFileAccessAccount"}] String FileAccessMethod; - [Write, Description("Specifies the load-balancing schema that is used by the Excel Services Application Web service application to send requests to different back-end Excel Services Application computers."), ValueMap{"RoundRobin","Local","WorkbookURL"}, Values{"RoundRobin","Local","WorkbookURL"}] String LoadBalancingScheme; - [Write, Description("Specifies the percentage of the maximum private bytes that can be allocated to inactive objects.")] Uint32 MemoryCacheThreshold; - [Write, Description("Specifies the maximum private bytes, in megabytes, that are used by Excel Services Application.")] Uint32 PrivateBytesMax; - [Write, Description("Specifies the maximum number of sessions allowed for a user.")] Uint32 SessionsPerUserMax; - [Write, Description("Specifies the maximum number of anonymous sessions allowed per site collection.")] Uint32 SiteCollectionAnonymousSessionsMax; - [Write, Description("Terminates Excel Services Application when an access violation occurs in the process.")] Boolean TerminateProcessOnAccessViolation; - [Write, Description("Specifies that if a workbook causes an access violation error on Excel Services Application, all files originating from that workbook’s site collection are blocked from loading for the specified period (in seconds).")] Uint32 ThrottleAccessViolationsPerSiteCollection; - [Write, Description("Specifies that the application ID that is used to look up the unattended service account credentials from the secure storage service that is specified by the UnattendedAccountSecureServiceAppName parameter.")] String UnattendedAccountApplicationId; - [Write, Description("Specifies the maximum amount of time, in minutes, that objects not currently used in a session are kept in the memory cache.")] Uint32 UnusedObjectAgeMax; - [Write, Description("Specifies the local file system location of the cache that is used to store workbooks that are used by Excel Services Application.")] String WorkbookCache; - [Write, Description("Specifies the maximum allowable size, in megabytes, of an individual session.")] Uint32 WorkbookCacheSizeMax; - [Write, Description("Present ensures service app exists, absent ensures it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.psm1 deleted file mode 100644 index 98115073..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.psm1 +++ /dev/null @@ -1,609 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [parameter(Mandatory = $true)] - [System.String] - $FarmConfigDatabaseName, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $FarmAccount, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $Passphrase, - - [parameter(Mandatory = $true)] - [System.String] - $AdminContentDatabaseName, - - [parameter(Mandatory = $true)] - [System.Boolean] - $RunCentralAdmin, - - [parameter(Mandatory = $false)] - [System.UInt32] - $CentralAdministrationPort, - - [parameter(Mandatory = $false)] - [System.String] - [ValidateSet("NTLM","Kerberos")] - $CentralAdministrationAuth, - - [parameter(Mandatory = $false)] - [System.String] - [ValidateSet("Application", - "ApplicationWithSearch", - "Custom", - "DistributedCache", - "Search", - "SingleServer", - "SingleServerFarm", - "WebFrontEnd", - "WebFrontEndWithDistributedCache")] - $ServerRole - ) - - Write-Verbose -Message "Getting the settings of the current local SharePoint Farm (if any)" - - if ($Ensure -eq "Absent") - { - throw ("SharePointDsc does not support removing a server from a farm, please set the " + ` - "ensure property to 'present'") - } - - $installedVersion = Get-SPDSCInstalledProductVersion - switch ($installedVersion.FileMajorPart) - { - 15 { - Write-Verbose -Message "Detected installation of SharePoint 2013" - } - 16 { - Write-Verbose -Message "Detected installation of SharePoint 2016" - } - default { - throw ("Detected an unsupported major version of SharePoint. SharePointDsc only " + ` - "supports SharePoint 2013 or 2016.") - } - } - - - if (($PSBoundParameters.ContainsKey("ServerRole") -eq $true) ` - -and $installedVersion.FileMajorPart -ne 16) - { - throw [Exception] "Server role is only supported in SharePoint 2016." - } - - if (($PSBoundParameters.ContainsKey("ServerRole") -eq $true) ` - -and $installedVersion.FileMajorPart -eq 16 ` - -and $installedVersion.FileBuildPart -lt 4456 ` - -and ($ServerRole -eq "ApplicationWithSearch" ` - -or $ServerRole -eq "WebFrontEndWithDistributedCache")) - { - throw [Exception] ("ServerRole values of 'ApplicationWithSearch' or " + ` - "'WebFrontEndWithDistributedCache' require the SharePoint 2016 " + ` - "Feature Pack 1 to be installed. See " + ` - "https://support.microsoft.com/en-au/kb/3127940") - } - - - # Determine if a connection to a farm already exists - $majorVersion = $installedVersion.FileMajorPart - $regPath = "hklm:SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\$majorVersion.0\Secure\ConfigDB" - $dsnValue = Get-SPDSCRegistryKey -Key $regPath -Value "dsn" -ErrorAction SilentlyContinue - - if ($null -ne $dsnValue) - { - # This node has already been connected to a farm - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - try - { - $spFarm = Get-SPFarm - } - catch - { - Write-Verbose -Message "Unable to detect local farm." - return $null - } - - if ($null -eq $spFarm) - { - return $null - } - - $configDb = Get-SPDatabase | Where-Object -FilterScript { - $_.Name -eq $spFarm.Name -and $_.Type -eq "Configuration Database" - } - $centralAdminSite = Get-SPWebApplication -IncludeCentralAdministration ` - | Where-Object -FilterScript { - $_.IsAdministrationWebApplication -eq $true - } - - if ($params.FarmAccount.UserName -eq $spFarm.DefaultServiceAccount.Name) - { - $farmAccount = $params.FarmAccount - } - else - { - $farmAccount = $spFarm.DefaultServiceAccount.Name - } - - $centralAdminSite = Get-SPWebApplication -IncludeCentralAdministration ` - | Where-Object -FilterScript { - $_.IsAdministrationWebApplication -eq $true - } - - $centralAdminProvisioned = $false - $ca = Get-SPServiceInstance -Server $env:ComputerName ` - | Where-Object -Filterscript { - $_.TypeName -eq "Central Administration" -and $_.Status -eq "Online" - } - if ($null -ne $ca) - { - $centralAdminProvisioned = $true - } - - $returnValue = @{ - FarmConfigDatabaseName = $spFarm.Name - DatabaseServer = $configDb.Server.Name - FarmAccount = $farmAccount # Need to return this as a credential to match the type expected - InstallAccount = $null - Passphrase = $null - AdminContentDatabaseName = $centralAdminSite.ContentDatabases[0].Name - RunCentralAdmin = $centralAdminProvisioned - CentralAdministrationPort = (New-Object -TypeName System.Uri $centralAdminSite.Url).Port - CentralAdministrationAuth = $params.CentralAdministrationAuth #TODO: Need to return this as the current value - } - return $returnValue - } - - if ($null -eq $result) - { - # The node is currently connected to a farm but was unable to retrieve the values - # of current farm settings, most likely due to connectivity issues with the SQL box - Write-Verbose -Message ("This server appears to be connected to a farm already, " + ` - "but the configuration database is currently unable to be " + ` - "accessed. Values returned from the get method will be " + ` - "incomplete, however the 'Ensure' property should be " + ` - "considered correct") - return @{ - FarmConfigDatabaseName = $null - DatabaseServer = $null - FarmAccount = $null - InstallAccount = $null - Passphrase = $null - AdminContentDatabaseName = $null - RunCentralAdmin = $null - CentralAdministrationPort = $null - CentralAdministrationAuth = $null - Ensure = "Present" - } - } - else - { - $result.Add("Ensure", "Present") - return $result - } - } - else - { - # This node has never been connected to a farm, return the null return object - return @{ - FarmConfigDatabaseName = $null - DatabaseServer = $null - FarmAccount = $null - InstallAccount = $null - Passphrase = $null - AdminContentDatabaseName = $null - RunCentralAdmin = $null - CentralAdministrationPort = $null - CentralAdministrationAuth = $null - Ensure = "Absent" - } - } -} - -function Set-TargetResource -{ - # Supressing the global variable use to allow passing DSC the reboot message - [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidGlobalVars", "")] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [parameter(Mandatory = $true)] - [System.String] - $FarmConfigDatabaseName, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $FarmAccount, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $Passphrase, - - [parameter(Mandatory = $true)] - [System.String] - $AdminContentDatabaseName, - - [parameter(Mandatory = $true)] - [System.Boolean] - $RunCentralAdmin, - - [parameter(Mandatory = $false)] - [System.UInt32] - $CentralAdministrationPort, - - [parameter(Mandatory = $false)] - [System.String] - [ValidateSet("NTLM","Kerberos")] - $CentralAdministrationAuth, - - [parameter(Mandatory = $false)] - [System.String] - [ValidateSet("Application", - "ApplicationWithSearch", - "Custom", - "DistributedCache", - "Search", - "SingleServer", - "SingleServerFarm", - "WebFrontEnd", - "WebFrontEndWithDistributedCache")] - $ServerRole - ) - - Write-Verbose -Message "Setting local SP Farm settings" - - if ($Ensure -eq "Absent") - { - throw ("SharePointDsc does not support removing a server from a farm, please set the " + ` - "ensure property to 'present'") - } - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($CurrentValues.Ensure -eq "Present") - { - throw ("This server is already connected to a farm. " + ` - "Please manually remove it to apply this change.") - } - - - # Set default values to ensure they are passed to Invoke-SPDSCCommand - if (-not $PSBoundParameters.ContainsKey("CentralAdministrationPort")) - { - $PSBoundParameters.Add("CentralAdministrationPort", 9999) - } - if (-not $PSBoundParameters.ContainsKey("CentralAdministrationAuth")) - { - $PSBoundParameters.Add("CentralAdministrationAuth", "NTLM") - } - - $actionResult = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` - -ScriptBlock { - $params = $args[0] - $scriptRoot = $args[1] - - $modulePath = "..\..\Modules\SharePointDsc.Farm\SPFarm.psm1" - Import-Module -Name (Join-Path -Path $scriptRoot -ChildPath $modulePath -Resolve) - $dbStatus = Get-SPDSCConfigDBStatus -SQLServer $params.DatabaseServer ` - -Database $params.FarmConfigDatabaseName - - while ($dbStatus.Locked -eq $true) - { - Write-Verbose -Message ("[$([DateTime]::Now.ToShortTimeString())] The configuration " + ` - "database is currently being provisioned by a remote " + ` - "server, this server will wait for this to complete") - Start-Sleep -Seconds 30 - $dbStatus = Get-SPDSCConfigDBStatus -SQLServer $params.DatabaseServer ` - -Database $params.FarmConfigDatabaseName - } - - if ($dbStatus.ValidPermissions -eq $false) - { - throw "The current user does not have sufficient permissions to SQL Server" - return - } - - $executeArgs = @{ - DatabaseServer = $params.DatabaseServer - DatabaseName = $params.FarmConfigDatabaseName - Passphrase = $params.Passphrase.Password - SkipRegisterAsDistributedCacheHost = $true - } - - switch((Get-SPDSCInstalledProductVersion).FileMajorPart) { - 15 { - Write-Verbose -Message "Detected Version: SharePoint 2013" - } - 16 { - if ($params.ContainsKey("ServerRole") -eq $true) { - Write-Verbose -Message ("Detected Version: SharePoint 2016 - " + ` - "configuring server as $($params.ServerRole)") - $executeArgs.Add("LocalServerRole", $params.ServerRole) - } else { - Write-Verbose -Message ("Detected Version: SharePoint 2016 - no server " + ` - "role provided, configuring server without a " + ` - "specific role") - $executeArgs.Add("ServerRoleOptional", $true) - } - } - Default { - throw [Exception] ("An unknown version of SharePoint (Major version $_) " + ` - "was detected. Only versions 15 (SharePoint 2013) or " + ` - "16 (SharePoint 2016) are supported.") - } - } - - if ($dbStatus.DatabaseExists -eq $true) - { - Write-Verbose -Message ("The SharePoint config database " + ` - "'$($params.FarmConfigDatabaseName)' already exists, so " + ` - "this server will join the farm.") - $createFarm = $false - } - elseif ($dbStatus.DatabaseExists -eq $false -and $params.RunCentralAdmin -eq $false) - { - # Only allow the farm to be created by a server that will run central admin - # to avoid a ghost CA site appearing on this server and causing issues - Write-Verbose -Message ("The SharePoint config database " + ` - "'$($params.FarmConfigDatabaseName)' does not exist, but " + ` - "this server will not be running the central admin " + ` - "website, so it will wait to join the farm rather than " + ` - "create one.") - $createFarm = $false - } - else - { - Write-Verbose -Message ("The SharePoint config database " + ` - "'$($params.FarmConfigDatabaseName)' does not exist, so " + ` - "this server will create the farm.") - $createFarm = $true - } - - $farmAction = "" - if ($createFarm -eq $false) - { - # The database exists, so attempt to join the farm to the server - - - # Remove the server role optional attribute as it is only used when creating - # a new farm - if ($executeArgs.ContainsKey("ServerRoleOptional") -eq $true) - { - $executeArgs.Remove("ServerRoleOptional") - } - - Write-Verbose -Message ("The server will attempt to join the farm now once every " + ` - "60 seconds for the next 15 minutes.") - $loopCount = 0 - $connectedToFarm = $false - $lastException = $null - while ($connectedToFarm -eq $false -and $loopCount -lt 15) - { - try - { - $joinObject = Connect-SPConfigurationDatabase @executeArgs - $connectedToFarm = $true - } - catch - { - $lastException = $_.Exception - Write-Verbose -Message ("$([DateTime]::Now.ToShortTimeString()) - An error " + ` - "occured joining config database " + ` - "'$($params.FarmConfigDatabaseName)' on " + ` - "'$($params.DatabaseServer)'. This resource will " + ` - "wait and retry automatically for up to 15 minutes. " + ` - "(waited $loopCount of 15 minutes)") - $loopCount++ - Start-Sleep -Seconds 60 - } - } - - if ($connectedToFarm -eq $false) - { - Write-Verbose -Message ("Unable to join config database. Throwing exception.") - throw $lastException - return - } - $farmAction = "JoinedFarm" - } - else - { - Add-SPDscConfigDBLock -SQLServer $params.DatabaseServer ` - -Database $params.FarmConfigDatabaseName - - try - { - $executeArgs += @{ - FarmCredentials = $params.FarmAccount - AdministrationContentDatabaseName = $params.AdminContentDatabaseName - } - - New-SPConfigurationDatabase @executeArgs - - $farmAction = "CreatedFarm" - } - finally - { - Remove-SPDscConfigDBLock -SQLServer $params.DatabaseServer ` - -Database $params.FarmConfigDatabaseName - } - } - - # Run common tasks for a new server - Install-SPHelpCollection -All | Out-Null - Initialize-SPResourceSecurity | Out-Null - Install-SPService | Out-Null - Install-SPFeature -AllExistingFeatures -Force | Out-Null - - # Provision central administration - if ($params.RunCentralAdmin -eq $true) - { - $centralAdminSite = Get-SPWebApplication -IncludeCentralAdministration ` - | Where-Object -FilterScript { - $_.IsAdministrationWebApplication -eq $true - } - - - $centralAdminProvisioned = $false - if ((New-Object -TypeName System.Uri $centralAdminSite.Url).Port -eq $params.CentralAdministrationPort) - { - $centralAdminProvisioned = $true - } - - if ($centralAdminProvisioned -eq $false) - { - New-SPCentralAdministration -Port $params.CentralAdministrationPort ` - -WindowsAuthProvider $params.CentralAdministrationAuth - } - else - { - $serviceInstance = Get-SPServiceInstance -Server $env:COMPUTERNAME ` - | Where-Object -FilterScript { - $_.TypeName -eq "Central Administration" - } - if ($null -eq $serviceInstance) - { - $domain = (Get-CimInstance -ClassName Win32_ComputerSystem).Domain - $fqdn = "$($env:COMPUTERNAME).$domain" - $serviceInstance = Get-SPServiceInstance -Server $fqdn ` - | Where-Object -FilterScript { - $_.TypeName -eq "Central Administration" - } - } - if ($null -eq $serviceInstance) - { - throw [Exception] "Unable to locate Central Admin service instance on this server" - } - Start-SPServiceInstance -Identity $serviceInstance - } - } - - Install-SPApplicationContent | Out-Null - - return $farmAction - } - - if ($actionResult -eq "JoinedFarm") - { - Write-Verbose -Message "Starting timer service" - Start-Service -Name sptimerv4 - - Write-Verbose -Message ("Pausing for 5 minutes to allow the timer service to " + ` - "fully provision the server") - Start-Sleep -Seconds 300 - Write-Verbose -Message ("Join farm complete. Restarting computer to allow " + ` - "configuration to continue") - - $global:DSCMachineStatus = 1 - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [parameter(Mandatory = $true)] - [System.String] - $FarmConfigDatabaseName, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $FarmAccount, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $Passphrase, - - [parameter(Mandatory = $true)] - [System.String] - $AdminContentDatabaseName, - - [parameter(Mandatory = $true)] - [System.Boolean] - $RunCentralAdmin, - - [parameter(Mandatory = $false)] - [System.UInt32] - $CentralAdministrationPort, - - [parameter(Mandatory = $false)] - [System.String] - [ValidateSet("NTLM","Kerberos")] - $CentralAdministrationAuth, - - [parameter(Mandatory = $false)] - [System.String] - [ValidateSet("Application", - "ApplicationWithSearch", - "Custom", - "DistributedCache", - "Search", - "SingleServer", - "SingleServerFarm", - "WebFrontEnd", - "WebFrontEndWithDistributedCache")] - $ServerRole - ) - - Write-Verbose -Message "Testing local SP Farm settings" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.schema.mof deleted file mode 100644 index 337fe993..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.schema.mof +++ /dev/null @@ -1,15 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPFarm")] -class MSFT_SPFarm : OMI_BaseResource -{ - [Key, Description("Present to create/join the farm. Absent is currently not supported"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Required, Description("Name of the configuration database")] String FarmConfigDatabaseName; - [Required, Description("Server that will host the configuration and admin content databases")] String DatabaseServer; - [Required, Description("The account to use as the main farm account"), EmbeddedInstance("MSFT_Credential")] String FarmAccount; - [Required, Description("The passphrase to use to allow servers to join this farm"), EmbeddedInstance("MSFT_Credential")] String Passphrase; - [Required, Description("The name of the admin content database")] String AdminContentDatabaseName; - [Required, Description("Should the central admin site run on this specific server?")] Boolean RunCentralAdmin; - [Write, Description("What port will Central Admin be provisioned to - default is 9999")] uint32 CentralAdministrationPort; - [Write, Description("The authentication provider of the CentralAdministration web application"), ValueMap{"NTLM","Kerberos"}, Values{"NTLM","Kerberos"}] String CentralAdministrationAuth; - [Write, Description("SharePoint 2016 only - the MinRole role to enroll this server as"), ValueMap{"Application","ApplicationWithSearch","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","WebFrontEnd","WebFrontEndWithDistributedCache"}, Values{"Application","ApplicationWithSearch","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","WebFrontEnd","WebFrontEndWithDistributedCache"}] string ServerRole; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFarmAdministrators/MSFT_SPFarmAdministrators.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFarmAdministrators/MSFT_SPFarmAdministrators.psm1 deleted file mode 100644 index 57e81b4a..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFarmAdministrators/MSFT_SPFarmAdministrators.psm1 +++ /dev/null @@ -1,372 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String[]] - $Members, - - [parameter(Mandatory = $false)] - [System.String[]] - $MembersToInclude, - - [parameter(Mandatory = $false)] - [System.String[]] - $MembersToExclude, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting Farm Administrators configuration" - - if ($Members -and (($MembersToInclude) -or ($MembersToExclude))) - { - throw ("Cannot use the Members parameter together with the " + ` - "MembersToInclude or MembersToExclude parameters") - } - - if (!$Members -and !$MembersToInclude -and !$MembersToExclude) - { - throw ("At least one of the following parameters must be specified: " + ` - "Members, MembersToInclude, MembersToExclude") - } - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $webApps = Get-SPwebapplication -IncludeCentralAdministration - $caWebapp = $webApps | Where-Object -FilterScript { - $_.IsAdministrationWebApplication - } - - if ($null -eq $caWebapp) - { - Write-Verbose "Unable to locate central administration website" - return $null - } - $caWeb = Get-SPweb($caWebapp.Url) - $farmAdminGroup = $caWeb.AssociatedOwnerGroup - $farmAdministratorsGroup = $caWeb.SiteGroups.GetByName($farmAdminGroup) - return @{ - Name = $params.Name - Members = $farmAdministratorsGroup.users.UserLogin - MembersToInclude = $params.MembersToInclude - MembersToExclude = $params.MembersToExclude - InstallAccount = $params.InstallAccount - } - } - return $result -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String[]] - $Members, - - [parameter(Mandatory = $false)] - [System.String[]] - $MembersToInclude, - - [parameter(Mandatory = $false)] - [System.String[]] - $MembersToExclude, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting Farm Administrators configuration" - - if ($Members -and (($MembersToInclude) -or ($MembersToExclude))) - { - throw ("Cannot use the Members parameter together with the " + ` - "MembersToInclude or MembersToExclude parameters") - } - - if (!$Members -and !$MembersToInclude -and !$MembersToExclude) - { - throw ("At least one of the following parameters must be specified: " + ` - "Members, MembersToInclude, MembersToExclude") - } - - $CurrentValues = Get-TargetResource @PSBoundParameters - if ($null -eq $CurrentValues) { - throw "Unable to locate central administration website" - } - - $changeUsers = @{} - $runChange = $false - - if ($Members) { - Write-Verbose "Processing Members parameter" - - $differences = Compare-Object -ReferenceObject $CurrentValues.Members ` - -DifferenceObject $Members - - if ($null -eq $differences) - { - Write-Verbose "Farm Administrators group matches. No further processing required" - } - else - { - Write-Verbose "Farm Administrators group does not match. Perform corrective action" - $addUsers = @() - $removeUsers = @() - foreach ($difference in $differences) - { - if ($difference.SideIndicator -eq "=>") - { - # Add account - $user = $difference.InputObject - Write-Verbose "Add $user to Add list" - $addUsers += $user - } - elseif ($difference.SideIndicator -eq "<=") - { - # Remove account - $user = $difference.InputObject - Write-Verbose "Add $user to Remove list" - $removeUsers += $user - } - } - - if($addUsers.count -gt 0) - { - Write-Verbose "Adding $($addUsers.Count) users to the Farm Administrators group" - $changeUsers.Add = $addUsers - $runChange = $true - } - - if($removeUsers.count -gt 0) - { - Write-Verbose "Removing $($removeUsers.Count) users from the Farm Administrators group" - $changeUsers.Remove = $removeUsers - $runChange = $true - } - } - } - - if ($MembersToInclude) - { - Write-Verbose "Processing MembersToInclude parameter" - - $addUsers = @() - foreach ($member in $MembersToInclude) - { - if (-not($CurrentValues.Members.Contains($member))) - { - Write-Verbose "$member is not a Farm Administrator. Add user to Add list" - $addUsers += $member - } - else - { - Write-Verbose "$member is already a Farm Administrator. Skipping" - } - } - - if($addUsers.count -gt 0) - { - Write-Verbose "Adding $($addUsers.Count) users to the Farm Administrators group" - $changeUsers.Add = $addUsers - $runChange = $true - } - } - - if ($MembersToExclude) - { - Write-Verbose "Processing MembersToExclude parameter" - - $removeUsers = @() - foreach ($member in $MembersToExclude) - { - if ($CurrentValues.Members.Contains($member)) - { - Write-Verbose "$member is a Farm Administrator. Add user to Remove list" - $removeUsers += $member - } - else - { - Write-Verbose "$member is not a Farm Administrator. Skipping" - } - } - - if($removeUsers.count -gt 0) - { - Write-Verbose "Removing $($removeUsers.Count) users from the Farm Administrators group" - $changeUsers.Remove = $removeUsers - $runChange = $true - } - } - - if ($runChange) - { - Write-Verbose "Apply changes" - Merge-SPDscFarmAdminList $changeUsers - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String[]] - $Members, - - [parameter(Mandatory = $false)] - [System.String[]] - $MembersToInclude, - - [parameter(Mandatory = $false)] - [System.String[]] - $MembersToExclude, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing Farm Administrators configuration" - - if ($Members -and (($MembersToInclude) -or ($MembersToExclude))) - { - throw ("Cannot use the Members parameter together with the " + ` - "MembersToInclude or MembersToExclude parameters") - } - - if (!$Members -and !$MembersToInclude -and !$MembersToExclude) - { - throw ("At least one of the following parameters must be specified: " + ` - "Members, MembersToInclude, MembersToExclude") - } - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($null -eq $CurrentValues) - { - return $false - } - - if ($Members) - { - Write-Verbose "Processing Members parameter" - $differences = Compare-Object -ReferenceObject $CurrentValues.Members ` - -DifferenceObject $Members - - if ($null -eq $differences) - { - Write-Verbose "Farm Administrators group matches" - return $true - } - else - { - Write-Verbose "Farm Administrators group does not match" - return $false - } - } - - $result = $true - if ($MembersToInclude) - { - Write-Verbose "Processing MembersToInclude parameter" - foreach ($member in $MembersToInclude) - { - if (-not($CurrentValues.Members -contains $member)) - { - Write-Verbose "$member is not a Farm Administrator. Set result to false" - $result = $false - } - else - { - Write-Verbose "$member is already a Farm Administrator. Skipping" - } - } - } - - if ($MembersToExclude) - { - Write-Verbose "Processing MembersToExclude parameter" - foreach ($member in $MembersToExclude) - { - if ($CurrentValues.Members -contains $member) - { - Write-Verbose "$member is a Farm Administrator. Set result to false" - $result = $false - } - else - { - Write-Verbose "$member is not a Farm Administrator. Skipping" - } - } - } - - return $result -} - -function Merge-SPDscFarmAdminList -{ - param ( - [Hashtable] - $changeUsers - ) - - $result = Invoke-SPDSCCommand -Credential $InstallAccount -Arguments $changeUsers -ScriptBlock { - $changeUsers = $args[0] - - $webApps = Get-SPwebapplication -IncludeCentralAdministration - $caWebapp = $webApps | Where-Object -FilterScript { - $_.IsAdministrationWebApplication - } - if ($null -eq $caWebapp) { - throw "Unable to locate central administration website" - } - $caWeb = Get-SPweb($caWebapp.Url) - $farmAdminGroup = $caWeb.AssociatedOwnerGroup - - if ($changeUsers.ContainsKey("Add")) - { - foreach ($loginName in $changeUsers.Add) - { - $caWeb.SiteGroups.GetByName($farmAdminGroup).AddUser($loginName,"","","") - } - } - - if ($changeUsers.ContainsKey("Remove")) - { - foreach ($loginName in $changeUsers.Remove) - { - $removeUser = get-spuser $loginName -web $caWebapp.Url - $caWeb.SiteGroups.GetByName($farmAdminGroup).RemoveUser($removeUser) - } - } - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFarmAdministrators/MSFT_SPFarmAdministrators.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFarmAdministrators/MSFT_SPFarmAdministrators.schema.mof deleted file mode 100644 index 6b0650f8..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFarmAdministrators/MSFT_SPFarmAdministrators.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPFarmAdministrators")] -class MSFT_SPFarmAdministrators : OMI_BaseResource -{ - [Key, Description("A generic name for this resource, its value is not important")] String Name; - [Write, Description("A list of members to set the group to. Those not in this list will be removed")] String Members[]; - [Write, Description("A list of members to add. Members not in this list will be left in the group")] String MembersToInclude[]; - [Write, Description("A list of members to remove. Members not in this list will be left in the group")] String MembersToExclude[]; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFarmPropertyBag/MSFT_SPFarmPropertyBag.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFarmPropertyBag/MSFT_SPFarmPropertyBag.psm1 deleted file mode 100644 index a31bda88..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFarmPropertyBag/MSFT_SPFarmPropertyBag.psm1 +++ /dev/null @@ -1,173 +0,0 @@ -function Get-TargetResource() -{ - [CmdletBinding()] - [OutputType([System.Collections.HashTable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Key, - - [Parameter(Mandatory = $false)] - [System.String] - $Value, - - [Parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = 'Present', - - [Parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Looking for SPFarm property '$Name'" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - try - { - $spFarm = Get-SPFarm -ErrorAction SilentlyContinue - } - catch - { - Write-Verbose -Message ("No local SharePoint farm was detected.") - return @{ - Key = $params.Key - Value = $null - Ensure = 'Absent' - } - } - - if ($null -ne $spFarm) - { - if ($spFarm.Properties) - { - if ($spFarm.Properties.Contains($params.Key) -eq $true) - { - $localEnsure = "Present" - $currentValue = $spFarm.Properties[$params.Key] - } - else - { - $localEnsure = "Absent" - $currentValue = $null - } - } - } - else - { - $null = $currentValue - $localEnsure = 'Absent' - } - - return @{ - Key = $params.Key - Value = $currentValue - Ensure = $localEnsure - } - } - return $result -} - -function Set-TargetResource() -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Key, - - [Parameter(Mandatory = $false)] - [System.String] - $Value, - - [Parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = 'Present', - - [Parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting SPFarm property '$Name'" - - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - try - { - $spFarm = Get-SPFarm -ErrorAction SilentlyContinue - } - catch - { - throw "No local SharePoint farm was detected." - return - } - - if ($params.Ensure -eq 'Present') - { - if ($params.Value) - { - Write-Verbose -Message "Adding property '$params.Key'='$params.value' to SPFarm.properties" - $spFarm.Properties[$params.Key] = $params.Value - $spFarm.Update() - } - else - { - Write-Warning -Message 'Ensure = Present, value parameter cannot be null' - } - } - else - { - Write-Verbose -Message "Removing property '$params.Key' from SPFarm.properties" - - $spFarm.Properties.Remove($params.Key) - $spFarm.Update() - } - } -} - -function Test-TargetResource() -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Key, - - [Parameter(Mandatory = $false)] - [System.String] - $Value, - - [Parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = 'Present', - - [Parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing SPFarm property '$Name'" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @('Ensure','Key','Value') -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFarmPropertyBag/MSFT_SPFarmPropertyBag.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFarmPropertyBag/MSFT_SPFarmPropertyBag.schema.mof deleted file mode 100644 index c9e5c824..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFarmPropertyBag/MSFT_SPFarmPropertyBag.schema.mof +++ /dev/null @@ -1,8 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPFarmPropertyBag")] -class MSFT_SPFarmPropertyBag : OMI_BaseResource -{ - [Key, Description("The key of the SPFarm property bag")] string Key; - [Write, Description("Value of the SPfarm property bag")] String Value; - [Write, Description("Set to present to ensure the SPfarm property exists, or absent to ensure it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFarmSolution/MSFT_SPFarmSolution.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFarmSolution/MSFT_SPFarmSolution.psm1 deleted file mode 100644 index 8b10cb97..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFarmSolution/MSFT_SPFarmSolution.psm1 +++ /dev/null @@ -1,458 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $LiteralPath, - - [parameter(Mandatory = $false)] - [System.String[]] - $WebApplications = @(), - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.String] - $Version = "1.0.0.0", - - [parameter(Mandatory = $false)] - [System.Boolean] - $Deployed = $true, - - [parameter(Mandatory = $false)] - [ValidateSet("14","15","All")] - [System.String] - $SolutionLevel, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting farm solution '$Name' settings" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $solution = Get-SPSolution -Identity $params.Name ` - -ErrorAction SilentlyContinue ` - -Verbose:$false - - if ($null -ne $solution) - { - $currentState = "Present" - $deployed = $solution.Deployed - $version = $Solution.Properties["Version"] - $deployedWebApplications = @($solution.DeployedWebApplications ` - | Select-Object -ExpandProperty Url) - } - else - { - $currentState = "Absent" - $deployed = $false - $version = "0.0.0.0" - $deployedWebApplications = @() - } - - return @{ - Name = $params.Name - LiteralPath = $LiteralPath - Deployed = $deployed - Ensure = $currentState - Version = $version - WebApplications = $deployedWebApplications - SolutionLevel = $params.SolutionLevel - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $LiteralPath, - - [parameter(Mandatory = $false)] - [System.String[]] - $WebApplications = @(), - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.String] - $Version = "1.0.0.0", - - [parameter(Mandatory = $false)] - [System.Boolean] - $Deployed = $true, - - [parameter(Mandatory = $false)] - [ValidateSet("14","15","All")] - [System.String] - $SolutionLevel, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting farm solution '$Name' settings" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - $PSBoundParameters.Ensure = $Ensure - $PSBoundParameters.Version = $Version - $PSBoundParameters.Deployed = $Deployed - - if ($Ensure -eq "Present") - { - if ($CurrentValues.Ensure -eq "Absent") - { - Write-Verbose -Message "Upload solution to the farm." - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $runParams = @{} - $runParams.Add("LiteralPath", $params.LiteralPath) - $runParams.Add("Verbose", $false) - - $solution = Add-SPSolution @runParams - - $solution.Properties["Version"] = $params.Version - $solution.Update() - - return $solution - } - - $CurrentValues.Version = $result.Properties["Version"] - } - - if ($CurrentValues.Version -ne $Version) - { - # If the solution is not deployed and the versions do not match we have to - # remove the current solution and add the new one - if (-not $CurrentValues.Deployed) - { - Write-Verbose -Message ("Remove current version " + ` - "('$($CurrentValues.Version)') of solution...") - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $runParams = @{} - $runParams.Add("Identity", $params.Name) - $runParams.Add("Confirm", $false) - $runParams.Add("Verbose", $false) - - Remove-SPSolution $runParams - - $runParams = @{} - $runParams.Add("LiteralPath", $params.LiteralPath) - - $solution = Add-SPSolution @runParams - - $solution.Properties["Version"] = $params.Version - $solution.Update() - - return $solution - } - - $CurrentValues.Version = $result.Properties["Version"] - } - else - { - Write-Verbose -Message ("Update solution from " + ` - "'$($CurrentValues.Version)' to $Version...") - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $solution = Get-SPSolution -Identity $params.Name -Verbose:$false - - $runParams = @{} - $runParams.Add("Identity", $params.Name) - $runParams.Add("LiteralPath", $params.LiteralPath) - $runParams.Add("GACDeployment", $solution.ContainsGlobalAssembly) - $runParams.Add("Confirm", $false) - $runParams.Add("Local", $false) - $runParams.Add("Verbose", $false) - - Update-SPSolution @runParams - - $solution = Get-SPSolution -Identity $params.Name -Verbose:$false - $solution.Properties["Version"] = $params.Version - $solution.Update() - - # Install new features... - Install-SPFeature -AllExistingFeatures -Confirm:$false - } - } - } - - } - else - { - #If ensure is absent we should also retract the solution first - $Deployed = $false - } - - if ($Deployed -ne $CurrentValues.Deployed) - { - Write-Verbose -Message ("The deploy state of $Name is " + ` - "'$($CurrentValues.Deployed)' but should be '$Deployed'.") - if ($CurrentValues.Deployed) - { - # Retract Solution globally - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $runParams = @{} - $runParams.Add("Identity", $params.Name) - $runParams.Add("Confirm", $false) - $runParams.Add("Verbose", $false) - - if ($solution.ContainsWebApplicationResource) - { - if ($null -eq $webApps -or $webApps.Length -eq 0) - { - $runParams.Add("AllWebApplications", $true) - - Uninstall-SPSolution @runParams - } - else - { - foreach ($webApp in $webApps) - { - $runParams["WebApplication"] = $webApp - - Uninstall-SPSolution @runParams - } - } - } - else - { - Uninstall-SPSolution @runParams - } - } - } - else - { - # Deploy solution - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $solution = Get-SPSolution -Identity $params.Name -Verbose:$false - - $runParams = @{ - Identity = $solution - GACDeployment = $solution.ContainsGlobalAssembly - Local = $false - Verbose = $false - } - if ($params.ContainsKey("SolutionLevel") -eq $true) - { - $runParams.Add("CompatibilityLevel", $params.SolutionLevel) - } - - if (!$solution.ContainsWebApplicationResource) - { - Install-SPSolution @runParams - } - else - { - if ($null -eq $webApps -or $webApps.Length -eq 0) - { - $runParams.Add("AllWebApplications", $true) - - Install-SPSolution @runParams - } - else - { - foreach ($webApp in $webApps) - { - $runParams["WebApplication"] = $webApp - - Install-SPSolution @runParams - } - } - } - } - } - } - - Wait-SPDSCSolutionJob -SolutionName $Name -InstallAccount $InstallAccount - - if ($Ensure -eq "Absent") - { - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $runParams = @{ - Identity = $params.Name - Confirm = $false - Verbose = $false - } - - Remove-SPSolution @runParams - - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $LiteralPath, - - [parameter(Mandatory = $false)] - [System.String[]] - $WebApplications = @(), - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.String] - $Version = "1.0.0.0", - - [parameter(Mandatory = $false)] - [System.Boolean] - $Deployed = $true, - - [parameter(Mandatory = $false)] - [ValidateSet("14","15","All")] - [System.String] - $SolutionLevel, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing farm solution '$Name' settings" - - $PSBoundParameters.Ensure = $Ensure - - $CurrentValues = Get-TargetResource @PSBoundParameters - - $valuesToCheck = @("Ensure", "Version", "Deployed") - if ($WebApplications.Count -gt 0) - { - $valuesToCheck += "WebApplications" - } - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck $valuesToCheck -} - -function Wait-SPDSCSolutionJob -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [string] - $SolutionName, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Start-Sleep -Seconds 5 - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments @{ Name = $SolutionName } ` - -ScriptBlock { - $params = $args[0] - - $gc = Start-SPAssignment -Verbose:$false - - $solution = Get-SPSolution -Identity $params.Name -Verbose:$false -AssignmentCollection $gc - - if ($solution.JobExists -eq $true) - { - Write-Verbose -Message "Waiting for solution '$($params.Name)'..." - $loopCount = 0 - while ($solution.JobExists -and $loopCount -lt 600) - { - $solution = Get-SPSolution -Identity $params.Name -Verbose:$false -AssignmentCollection $gc - - Write-Verbose -Message ("$([DateTime]::Now.ToShortTimeString()) - Waiting for a " + ` - "job for solution '$($params.Name)' to complete") - $loopCount++ - Start-Sleep -Seconds 5 - - } - - Write-Verbose -Message "Result: $($solution.LastOperationResult)" - Write-Verbose -Message "Details: $($solution.LastOperationDetails)" - - } - else - { - Write-Verbose -Message "Solution '$($params.Name)' has no job pending." - return @{ - LastOperationResult = "DeploymentSucceeded" - LastOperationDetails = "Solution '$($params.Name)' has no job pending." - } - } - - Stop-SPAssignment $gc -Verbose:$false - - return @{ - LastOperationResult = $solution.LastOperationResult - LastOperationDetails = $solution.LastOperationDetails - } - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFarmSolution/MSFT_SPFarmSolution.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFarmSolution/MSFT_SPFarmSolution.schema.mof deleted file mode 100644 index 4c06cf3a..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFarmSolution/MSFT_SPFarmSolution.schema.mof +++ /dev/null @@ -1,12 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPFarmSolution")] -class MSFT_SPFarmSolution : OMI_BaseResource -{ - [Key, Description("The filename of the WSP package")] string Name; - [Required, Description("The full path to the WSP file")] string LiteralPath; - [Write, Description("A list of the web applications to deploy this to")] string WebApplications[]; - [Write, Description("Present if the WSP should be deployed, or Absent if it should be removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("The version of the package that is being modified")] string Version; - [Write, Description("Should the solution be deployed to the farm, or just installed to the farm")] Boolean Deployed; - [Write, Description("What compatability level should the WSP be deployed as?"), ValueMap{"14","15","All"}, Values{"14","15","All"}] string SolutionLevel; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFeature/MSFT_SPFeature.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFeature/MSFT_SPFeature.psm1 deleted file mode 100644 index 08af712c..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFeature/MSFT_SPFeature.psm1 +++ /dev/null @@ -1,217 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $true)] - [ValidateSet("Farm","WebApplication","Site","Web")] - [System.String] - $FeatureScope, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.String] - $Version - ) - - Write-Verbose -Message "Getting feature $Name at $FeatureScope scope" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $checkParams = @{ - Identity = $params.Name - } - if ($params.FeatureScope -eq "Farm") - { - $checkParams.Add($params.FeatureScope, $true) - } - else - { - $checkParams.Add($params.FeatureScope, $params.Url) - } - $featureAtScope = Get-SPFeature @checkParams -ErrorAction SilentlyContinue - $enabled = ($null -ne $featureAtScope) - if ($enabled -eq $true) - { - $currentState = "Present" - } - else - { - $currentState = "Absent" - } - - return @{ - Name = $params.Name - FeatureScope = $params.FeatureScope - Url = $params.Url - InstallAccount = $params.InstallAccount - Ensure = $currentState - Version = $featureAtScope.Version - } - } - return $result -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $true)] - [ValidateSet("Farm","WebApplication","Site","Web")] - [System.String] - $FeatureScope, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.String] - $Version - ) - - Write-Verbose -Message "Setting feature $Name at $FeatureScope scope" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - $PSBoundParameters.Add("CurrentValues", $CurrentValues) - $PSBoundParameters.Ensure = $Ensure - - if ($Ensure -eq "Present") - { - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - $currentValues = $params["CurrentValues"] - - $runParams = @{ - Identity = $params.Name - } - - if ($params.FeatureScope -ne "Farm") - { - $runParams.Add("Url", $params.Url) - } - - if ($currentValues.Ensure -eq "Present") - { - # Disable the feature first if it already exists. - $runParams.Add("Confirm", $false) - Write-Verbose -Message ("Disable Feature '$($params.Name)' because it is " + ` - "already active at scope '$($params.FeatureScope)'...") - Disable-SPFeature @runParams - } - - Write-Verbose -Message ("Enable Feature '$($params.Name)' at scope " + ` - "'$($params.FeatureScope)'...") - Enable-SPFeature @runParams - } - } - if ($Ensure -eq "Absent") - { - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - - $params = $args[0] - $currentValues = $params["CurrentValues"] - - $runParams = @{ - Identity = $params.Name - } - - if ($params.FeatureScope -ne "Farm") - { - $runParams.Add("Url", $params.Url) - } - - $runParams.Add("Confirm", $false) - Write-Verbose -Message ("Disable Feature '$($params.Name)' because 'Ensure' is " + ` - "'$($params.Ensure)'...") - Disable-SPFeature @runParams - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $true)] - [ValidateSet("Farm","WebApplication","Site","Web")] - [System.String] - $FeatureScope, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.String] - $Version - ) - - Write-Verbose -Message "Testing feature $Name at $FeatureScope scope" - - $PSBoundParameters.Ensure = $Ensure - - $CurrentValues = Get-TargetResource @PSBoundParameters - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure", "Version") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFeature/MSFT_SPFeature.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFeature/MSFT_SPFeature.schema.mof deleted file mode 100644 index fa7f3eb8..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPFeature/MSFT_SPFeature.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPFeature")] -class MSFT_SPFeature : OMI_BaseResource -{ - [Key, Description("The name of the feature")] string Name; - [Required, Description("The scope to change the feature at - Farm, WebApplication, SiteCollection or Site"), ValueMap{"Farm","WebApplication","Site","Web"}, Values{"Farm","WebApplication","Site","Web"}] string FeatureScope; - [Key, Description("The URL to change the feature at")] string Url; - [Write, Description("Present if the feature is to be enabled, Absent if it is to be disabled"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("The version of the feature to check against")] string Version; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPHealthAnalyzerRuleState/MSFT_SPHealthAnalyzerRuleState.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPHealthAnalyzerRuleState/MSFT_SPHealthAnalyzerRuleState.psm1 deleted file mode 100644 index a778f0c1..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPHealthAnalyzerRuleState/MSFT_SPHealthAnalyzerRuleState.psm1 +++ /dev/null @@ -1,274 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.Boolean] - $Enabled, - - [parameter(Mandatory = $false)] - [ValidateSet("All Servers","Any Server")] - [System.String] - $RuleScope, - - [parameter(Mandatory = $false)] - [ValidateSet("Hourly","Daily","Weekly","Monthly","OnDemandOnly")] - [System.String] - $Schedule, - - [parameter(Mandatory = $false)] - [System.Boolean] - $FixAutomatically, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting Health Rule configuration settings" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - try - { - $spFarm = Get-SPFarm - } - catch - { - Write-Verbose -Message ("No local SharePoint farm was detected. Health " + ` - "Analyzer Rule settings will not be applied") - return $null - } - - $caWebapp = Get-SPwebapplication -IncludeCentralAdministration ` - | Where-Object -FilterScript { - $_.IsAdministrationWebApplication - } - - if ($null -eq $caWebapp) - { - Write-Verbose -Message "Unable to locate central administration website" - return $null - } - - # Get CA SPWeb - $caWeb = Get-SPWeb($caWebapp.Url) - $healthRulesList = $caWeb.Lists | Where-Object -FilterScript { - $_.BaseTemplate -eq "HealthRules" - } - - if ($null -ne $healthRulesList) - { - $spQuery = New-Object Microsoft.SharePoint.SPQuery - $querytext = "" + ` - "$($params.Name)" - $spQuery.Query = $querytext - $results = $healthRulesList.GetItems($spQuery) - if ($results.Count -eq 1) - { - $item = $results[0] - - # Additional check for incorrect default value of the schedule for rule - # "One or more app domains for web applications aren't configured correctly." - $ruleschedule = $item["HealthRuleSchedule"] - if ($ruleschedule -eq "On Demand") - { - $ruleschedule = "OnDemandOnly" - } - - return @{ - # Set the Health Analyzer Rule settings - Name = $params.Name - Enabled = $item["HealthRuleCheckEnabled"] - RuleScope = $item["HealthRuleScope"] - Schedule = $ruleschedule - FixAutomatically = $item["HealthRuleAutoRepairEnabled"] - InstallAccount = $params.InstallAccount - } - } - else - { - Write-Verbose -Message ("Unable to find specified Health Analyzer Rule. Make " + ` - "sure any related service applications exists.") - return $null - } - } - else - { - Write-Verbose -Message "Unable to locate Health Analyzer Rules list" - return $null - } - } - return $result -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.Boolean] - $Enabled, - - [parameter(Mandatory = $false)] - [ValidateSet("All Servers","Any Server")] - [System.String] - $RuleScope, - - [parameter(Mandatory = $false)] - [ValidateSet("Hourly","Daily","Weekly","Monthly","OnDemandOnly")] - [System.String] - $Schedule, - - [parameter(Mandatory = $false)] - [System.Boolean] - $FixAutomatically, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting Health Analyzer Rule configuration settings" - - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - try - { - $spFarm = Get-SPFarm - } - catch - { - throw ("No local SharePoint farm was detected. Health Analyzer Rule " + ` - "settings will not be applied") - return - } - - $caWebapp = Get-SPwebapplication -IncludeCentralAdministration ` - | Where-Object -FilterScript { - $_.IsAdministrationWebApplication - } - - if ($null -eq $caWebapp) - { - throw ("No Central Admin web application was found. Health Analyzer Rule " + ` - "settings will not be applied") - return - } - - # Get Central Admin SPWeb - $caWeb = Get-SPWeb($caWebapp.Url) - $healthRulesList = $caWeb.Lists | Where-Object -FilterScript { - $_.BaseTemplate -eq "HealthRules" - } - - if ($null -ne $healthRulesList) - { - $spQuery = New-Object Microsoft.SharePoint.SPQuery - $querytext = "" + ` - "$($params.Name)" - $spQuery.Query = $querytext - $results = $healthRulesList.GetItems($spQuery) - if ($results.Count -eq 1) - { - $item = $results[0] - - $item["HealthRuleCheckEnabled"] = $params.Enabled - if ($params.ContainsKey("RuleScope")) - { - $item["HealthRuleScope"] = $params.RuleScope - } - if ($params.ContainsKey("Schedule")) - { - $item["HealthRuleSchedule"] = $params.Schedule - } - if ($params.ContainsKey("FixAutomatically")) - { - $item["HealthRuleAutoRepairEnabled"] = $params.FixAutomatically - } - - $item.Update() - } - else - { - throw ("Could not find specified Health Analyzer Rule. Health Analyzer Rule " + ` - "settings will not be applied. Make sure any related service " + ` - "applications exists") - return - } - } - else - { - throw ("Could not find Health Analyzer Rules list. Health Analyzer Rule settings " + ` - "will not be applied") - return - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.Boolean] - $Enabled, - - [parameter(Mandatory = $false)] - [ValidateSet("All Servers","Any Server")] - [System.String] - $RuleScope, - - [parameter(Mandatory = $false)] - [ValidateSet("Hourly","Daily","Weekly","Monthly","OnDemandOnly")] - [System.String] - $Schedule, - - [parameter(Mandatory = $false)] - [System.Boolean] - $FixAutomatically, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing Health Analyzer rule configuration settings" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($null -eq $CurrentValues) - { - return $false - } - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPHealthAnalyzerRuleState/MSFT_SPHealthAnalyzerRuleState.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPHealthAnalyzerRuleState/MSFT_SPHealthAnalyzerRuleState.schema.mof deleted file mode 100644 index 2785d80d..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPHealthAnalyzerRuleState/MSFT_SPHealthAnalyzerRuleState.schema.mof +++ /dev/null @@ -1,26 +0,0 @@ -/* - -**Example** - - SPHealthAnalyzerRuleState DisableDiskSpaceRule - { - Name = "Drives are at risk of running out of free space." - Enabled = $true - RuleScope = "All Servers" - Schedule = "Daily" - FixAutomatically = $false - InstallAccount = $InstallAccount - } -*/ - -[ClassVersion("1.0.0.0"), FriendlyName("SPHealthAnalyzerRuleState")] -class MSFT_SPHealthAnalyzerRuleState : OMI_BaseResource -{ - [Key, Description("The name of the rule exactly as it appears in central admin")] String Name; - [Required, Description("Should the rule be enabled?")] Boolean Enabled; - [Write, Description("What is the scope of this rule"), ValueMap{"All Servers","Any Server"}, Values{"All Servers","Any Server"}] String RuleScope; - [Write, Description("How often should the rule check"), ValueMap{"Hourly","Daily","Weekly","Monthly","OnDemandOnly"}, Values{"Hourly","Daily","Weekly","Monthly","OnDemandOnly"}] String Schedule; - [Write, Description("Should the rule fix itself automatically")] Boolean FixAutomatically; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPInstall/MSFT_SPInstall.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPInstall/MSFT_SPInstall.psm1 deleted file mode 100644 index 578c9da9..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPInstall/MSFT_SPInstall.psm1 +++ /dev/null @@ -1,271 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $BinaryDir, - - [parameter(Mandatory = $true)] - [System.String] - $ProductKey, - - [parameter(Mandatory = $false)] - [System.String] - $InstallPath, - - [parameter(Mandatory = $false)] - [System.String] - $DataPath, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present" - ) - - Write-Verbose -Message "Getting install status of SharePoint" - - $x86Path = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" - $installedItemsX86 = Get-ItemProperty -Path $x86Path | Select-Object -Property DisplayName - - $x64Path = "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*" - $installedItemsX64 = Get-ItemProperty -Path $x64Path | Select-Object -Property DisplayName - - $installedItems = $installedItemsX86 + $installedItemsX64 - $installedItems = $installedItems | Select-Object -Property DisplayName -Unique - $spInstall = $installedItems | Where-Object -FilterScript { - $_ -match "Microsoft SharePoint Server (2013|2016)" - } - - if ($spInstall) - { - return @{ - BinaryDir = $BinaryDir - ProductKey = $ProductKey - InstallPath = $InstallPath - DataPath = $DataPath - Ensure = "Present" - } - } - else - { - return @{ - BinaryDir = $BinaryDir - ProductKey = $ProductKey - InstallPath = $InstallPath - DataPath = $DataPath - Ensure = "Absent" - } - } -} - - -function Set-TargetResource -{ - # Supressing the global variable use to allow passing DSC the reboot message - [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidGlobalVars", "")] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $BinaryDir, - - [parameter(Mandatory = $true)] - [System.String] - $ProductKey, - - [parameter(Mandatory = $false)] - [System.String] - $InstallPath, - - [parameter(Mandatory = $false)] - [System.String] - $DataPath, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present" - ) - - Write-Verbose -Message "Setting install status of SharePoint" - - if ($Ensure -eq "Absent") - { - throw [Exception] ("SharePointDsc does not support uninstalling SharePoint or " + ` - "its prerequisites. Please remove this manually.") - return - } - - $InstallerPath = Join-Path $BinaryDir "setup.exe" - $majorVersion = (Get-SPDSCAssemblyVersion -PathToAssembly $InstallerPath) - if ($majorVersion -eq 15) - { - $svrsetupDll = Join-Path -Path $BinaryDir -ChildPath "updates\svrsetup.dll" - $checkDotNet = $true - if (Test-Path -Path $svrsetupDll) - { - $svrsetupDllFileInfo = Get-ItemProperty -Path $svrsetupDll - $fileVersion = $svrsetupDllFileInfo.VersionInfo.FileVersion - if ($fileVersion -ge "15.0.4709.1000") - { - $checkDotNet = $false - } - } - - if ($checkDotNet -eq $true) - { - $ndpKey = "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4" - $dotNet46Installed = $false - if (Test-Path -Path $ndpKey) - { - $dotNetv4Keys = Get-ChildItem -Path $ndpKey - foreach ($dotnetInstance in $dotNetv4Keys) - { - if ($dotnetInstance.GetValue("Release") -ge 390000) - { - $dotNet46Installed = $true - break - } - } - } - - if ($dotNet46Installed -eq $true) - { - throw [Exception] ("A known issue prevents installation of SharePoint 2013 on " + ` - "servers that have .NET 4.6 already installed. See details " + ` - "at https://support.microsoft.com/en-us/kb/3087184") - return - } - } - } - - Write-Verbose -Message "Writing install config file" - - $configPath = "$env:temp\SPInstallConfig.xml" - - $configData = " - - - - - - - - - - - -" - - if ($PSBoundParameters.ContainsKey("InstallPath") -eq $true) - { - $configData += " -" - } - if ($PSBoundParameters.ContainsKey("DataPath") -eq $true) - { - $configData += " -" - } - $configData += " - - - -" - - $configData | Out-File -FilePath $configPath - - Write-Verbose -Message "Beginning installation of SharePoint" - - $setupExe = Join-Path -Path $BinaryDir -ChildPath "setup.exe" - - $setup = Start-Process -FilePath $setupExe ` - -ArgumentList "/config `"$configPath`"" ` - -Wait ` - -PassThru - - switch ($setup.ExitCode) - { - 0 { - Write-Verbose -Message "SharePoint binary installation complete" - $global:DSCMachineStatus = 1 - } - 30066 { - $pr1 = ("HKLM:\Software\Microsoft\Windows\CurrentVersion\" + ` - "Component Based Servicing\RebootPending") - $pr2 = ("HKLM:\Software\Microsoft\Windows\CurrentVersion\" + ` - "WindowsUpdate\Auto Update\RebootRequired") - $pr3 = "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" - if ( ($null -ne (Get-Item $pr1 -ErrorAction SilentlyContinue)) ` - -or ($null -ne (Get-Item $pr2 -ErrorAction SilentlyContinue)) ` - -or ((Get-Item $pr3 | Get-ItemProperty).PendingFileRenameOperations.count -gt 0) ` - ) { - - Write-Verbose -Message ("SPInstall has detected the server has pending " + ` - "a reboot. Flagging to the DSC engine that the " + ` - "server should reboot before continuing.") - $global:DSCMachineStatus = 1 - } else { - throw ("SharePoint installation has failed due to an issue with prerequisites " + ` - "not being installed correctly. Please review the setup logs.") - } - } - Default { - throw "SharePoint install failed, exit code was $($setup.ExitCode)" - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $BinaryDir, - - [parameter(Mandatory = $true)] - [System.String] - $ProductKey, - - [parameter(Mandatory = $false)] - [System.String] - $InstallPath, - - [parameter(Mandatory = $false)] - [System.String] - $DataPath, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present" - ) - - Write-Verbose -Message "Testing install status of SharePoint" - - $PSBoundParameters.Ensure = $Ensure - - if ($Ensure -eq "Absent") - { - throw [Exception] ("SharePointDsc does not support uninstalling SharePoint or " + ` - "its prerequisites. Please remove this manually.") - return - } - - $CurrentValues = Get-TargetResource @PSBoundParameters - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPInstall/MSFT_SPInstall.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPInstall/MSFT_SPInstall.schema.mof deleted file mode 100644 index abecf48c..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPInstall/MSFT_SPInstall.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPInstall")] -class MSFT_SPInstall : OMI_BaseResource -{ - [Key, Description("The directory that contains all of the SharePoint binaries")] String BinaryDir; - [Required, Description("The product key to use during the installation")] String ProductKey; - [Write, Description("The install directory to use in the installation, leave blank to use the setup defaults")] String InstallPath; - [Write, Description("The data directory to use in the installation, leave blank to use the setup defaults")] String DataPath; - [Write, Description("Present to install SharePoint. Absent is currently not supported"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; -}; - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.psm1 deleted file mode 100644 index e0dca300..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.psm1 +++ /dev/null @@ -1,386 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $BinaryDir, - - [parameter(Mandatory = $false)] - [ValidateSet("mon","tue","wed","thu","fri","sat","sun")] - [System.String[]] - $BinaryInstallDays, - - [parameter(Mandatory = $false)] - [System.String] - $BinaryInstallTime, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting install status of SharePoint Language Pack" - - # Check if Binary folder exists - if (-not(Test-Path -Path $BinaryDir)) - { - throw "Specified path cannot be found." - } - - $osrvFolder = Get-ChildItem -Path (Join-Path -Path $BinaryDir ` - -ChildPath "\osmui*.*") - - if ($osrvFolder.Count -ne 1) - { - throw "Unknown folder structure" - } - - $products = Get-SPDscRegProductsInfo - - $englishProducts = @() - foreach ($product in $products) - { - $parsedProduct = $product -split " - " - switch -Regex ($parsedProduct) - { - "Dari" { $languageEN = "Dari"} - "Serbian" { - if ($parsedProduct[1] -match "srpski") - { - $languageEN = "Serbian (Latin)" - } - else - { - $languageEN = "Serbian (Cyrillic)" - } - } - "Chinese" { - $parsedENProduct = $parsedProduct[1] -split "/" - $languageEN = $parsedENProduct[0] - } - "Portuguese" { - if ($parsedProduct[1] -match "\(Brasil\)") - { - $languageEN = "Portuguese (Brasil)" - } - else - { - $languageEN = "Portuguese (Portugal)" - } - } - Default { - $parsedENProduct = $parsedProduct[1] -split "/" - $parsedENProduct = $parsedENProduct[0] -split " " - $languageEN = $parsedENProduct[0] - } - } - $englishProducts += $languageEN - } - - # Extract language from filename - if ($osrvFolder.Name -match "\w*.(\w{2,3}-\w*-?\w*)") - { - $language = $matches[1] - } - else - { - throw "Update does not contain the language code in the correct format." - } - - try - { - $cultureInfo = New-Object -TypeName System.Globalization.CultureInfo ` - -ArgumentList $language - } - catch - { - throw "Error while converting language information: $language" - } - - # try/catch is required for some versions of Windows, other version use the LCID value of 4096 - if ($cultureInfo.LCID -eq 4096) - { - throw "Error while converting language information: $language" - } - - # Extract English name of the language code - $updateLanguage = $cultureInfo.EnglishName - switch ($cultureInfo.EnglishName) - { - "Dari (Afghanistan)" { $languageEnglish = "Dari" } - "Chinese (Simplified, China)" { $languageEnglish = "Chinese (PRC)" } - "Chinese (Traditional, Taiwan)" { $languageEnglish = "Chinese (Taiwan)" } - "Portuguese (Brazil)" { $languageEnglish = "Portuguese (Brasil)" } - "Portuguese (Portugal)" { $languageEnglish = "Portuguese (Portugal)" } - "Serbian (Cyrillic, Serbia)" { $languageEnglish = "Serbian (Cyrillic)" } - "Serbian (Latin, Serbia)" { $languageEnglish = "Serbian (Latin)" } - Default { - if ($cultureInfo.EnglishName -match "(\w*,*\s*\w*) \([^)]*\)") - { - $languageEnglish = $matches[1] - $updateLanguage = $matches[0] - if ($languageEnglish.contains(",")) - { - $languages = $languageEnglish.Split(",") - $languageEnglish = $languages[0] - } - } - } - } - - Write-Verbose -Message "Update is for the $languageEnglish language" - - if ($englishProducts -contains $languageEnglish -eq $true) - { - Write-Verbose -Message "Language Pack $languageEnglish is found" - return @{ - BinaryDir = $BinaryDir - BinaryInstallDays = $BinaryInstallDays - BinaryInstallTime = $BinaryInstallTime - Ensure = "Present" - } - } - else - { - Write-Verbose -Message "Language Pack $languageEnglish is NOT found" - return @{ - BinaryDir = $BinaryDir - BinaryInstallDays = $BinaryInstallDays - BinaryInstallTime = $BinaryInstallTime - Ensure = "Absent" - } - } -} - - -function Set-TargetResource -{ - # Supressing the global variable use to allow passing DSC the reboot message - [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidGlobalVars", "")] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $BinaryDir, - - [parameter(Mandatory = $false)] - [ValidateSet("mon","tue","wed","thu","fri","sat","sun")] - [System.String[]] - $BinaryInstallDays, - - [parameter(Mandatory = $false)] - [System.String] - $BinaryInstallTime, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting install status of SharePoint Language Pack" - - if ($Ensure -eq "Absent") - { - throw [Exception] ("SharePointDsc does not support uninstalling SharePoint " + ` - "Language Packs. Please remove this manually.") - return - } - - # Check if Binary folder exists - if (-not(Test-Path -Path $BinaryDir)) - { - throw "Specified path cannot be found." - } - - $now = Get-Date - if ($BinaryInstallDays) - { - # BinaryInstallDays parameter exists, check if current day is specified - $currentDayOfWeek = $now.DayOfWeek.ToString().ToLower().Substring(0,3) - - if ($BinaryInstallDays -contains $currentDayOfWeek) - { - Write-Verbose -Message ("Current day is present in the parameter BinaryInstallDays. " + ` - "Update can be run today.") - } - else - { - Write-Verbose -Message ("Current day is not present in the parameter BinaryInstallDays, " + ` - "skipping the update") - return - } - } - else - { - Write-Verbose -Message "No BinaryInstallDays specified, Update can be ran on any day." - } - - # Check if BinaryInstallTime parameter exists - if ($BinaryInstallTime) - { - # Check if current time is inside of time window - $upgradeTimes = $BinaryInstallTime.Split(" ") - $starttime = 0 - $endtime = 0 - - if ($upgradeTimes.Count -ne 3) - { - throw "Time window incorrectly formatted." - } - else - { - if ([datetime]::TryParse($upgradeTimes[0],[ref]$starttime) -ne $true) - { - throw "Error converting start time" - } - - if ([datetime]::TryParse($upgradeTimes[2],[ref]$endtime) -ne $true) - { - throw "Error converting end time" - } - - if ($starttime -gt $endtime) - { - throw "Error: Start time cannot be larger than end time" - } - } - - if (($starttime -lt $now) -and ($endtime -gt $now)) - { - Write-Verbose -Message ("Current time is inside of the window specified in " + ` - "BinaryInstallTime. Starting update") - } - else - { - Write-Verbose -Message ("Current time is outside of the window specified in " + ` - "BinaryInstallTime, skipping the update") - return - } - } - else - { - Write-Verbose -Message ("No BinaryInstallTime specified, Update can be ran at " + ` - "any time. Starting update.") - } - - # To prevent an endless loop: Check if an upgrade is required. - if ((Get-SPDSCInstalledProductVersion).FileMajorPart -eq 15) - { - $wssRegKey ="hklm:SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\15.0\WSS" - } - else - { - $wssRegKey ="hklm:SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\16.0\WSS" - } - - Write-Verbose -Message "Writing install config file" - - $configPath = "$env:temp\SPInstallLanguagePackConfig.xml" - - $configData = " - - - - -" - - $configData | Out-File -FilePath $configPath - - Write-Verbose -Message "Beginning installation of the SharePoint Language Pack" - - $setupExe = Join-Path -Path $BinaryDir -ChildPath "setup.exe" - - $setup = Start-Process -FilePath $setupExe ` - -ArgumentList "/config `"$configPath`"" ` - -Wait ` - -PassThru - - switch ($setup.ExitCode) - { - 0 { - Write-Verbose -Message "SharePoint Language Pack binary installation complete" - } - 17022 { - Write-Verbose -Message "SharePoint Language Pack binary installation complete. Reboot required." - $global:DSCMachineStatus = 1 - } - Default { - throw "SharePoint Language Pack install failed, exit code was $($setup.ExitCode)" - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $BinaryDir, - - [parameter(Mandatory = $false)] - [ValidateSet("mon","tue","wed","thu","fri","sat","sun")] - [System.String[]] - $BinaryInstallDays, - - [parameter(Mandatory = $false)] - [System.String] - $BinaryInstallTime, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing install status of SharePoint Language Pack" - - $PSBoundParameters.Ensure = $Ensure - - if ($Ensure -eq "Absent") - { - throw [Exception] ("SharePointDsc does not support uninstalling SharePoint " + ` - "Language Packs. Please remove this manually.") - return - } - - $CurrentValues = Get-TargetResource @PSBoundParameters - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.schema.mof deleted file mode 100644 index aa9bdac4..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPInstallLanguagePack")] -class MSFT_SPInstallLanguagePack : OMI_BaseResource -{ - [Key, Description("The directory that contains all of the SharePoint binaries")] String BinaryDir; - [Write, Description("Specify on which dates the installation is allowed"), ValueMap{"mon","tue","wed","thu","fri","sat","sun"}, Values{"mon","tue","wed","thu","fri","sat","sun"}] String BinaryInstallDays[]; - [Write, Description("Specify in which time frame the installation is allowed")] String BinaryInstallTime; - [Write, Description("Present to install SharePoint. Absent is currently not supported"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPInstallPrereqs/MSFT_SPInstallPrereqs.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPInstallPrereqs/MSFT_SPInstallPrereqs.psm1 deleted file mode 100644 index 06fc9c42..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPInstallPrereqs/MSFT_SPInstallPrereqs.psm1 +++ /dev/null @@ -1,776 +0,0 @@ -$Script:SP2013Features = @("Application-Server", "AS-NET-Framework", - "AS-TCP-Port-Sharing", "AS-Web-Support", "AS-WAS-Support", - "AS-HTTP-Activation", "AS-Named-Pipes", "AS-TCP-Activation","Web-Server", - "Web-WebServer", "Web-Common-Http", "Web-Default-Doc", "Web-Dir-Browsing", - "Web-Http-Errors", "Web-Static-Content", "Web-Http-Redirect", "Web-Health", - "Web-Http-Logging", "Web-Log-Libraries", "Web-Request-Monitor", - "Web-Http-Tracing", "Web-Performance", "Web-Stat-Compression", - "Web-Dyn-Compression", "Web-Security", "Web-Filtering", "Web-Basic-Auth", - "Web-Client-Auth", "Web-Digest-Auth", "Web-Cert-Auth", "Web-IP-Security", - "Web-Url-Auth", "Web-Windows-Auth", "Web-App-Dev", "Web-Net-Ext", - "Web-Net-Ext45", "Web-Asp-Net", "Web-Asp-Net45", "Web-ISAPI-Ext", - "Web-ISAPI-Filter", "Web-Mgmt-Tools", "Web-Mgmt-Console", "Web-Mgmt-Compat", - "Web-Metabase", "Web-Lgcy-Scripting", "Web-WMI", "Web-Scripting-Tools", - "NET-Framework-Features", "NET-Framework-Core", "NET-Framework-45-ASPNET", - "NET-WCF-HTTP-Activation45", "NET-WCF-Pipe-Activation45", - "NET-WCF-TCP-Activation45", "Server-Media-Foundation", - "Windows-Identity-Foundation", "PowerShell-V2", "WAS", "WAS-Process-Model", - "WAS-NET-Environment", "WAS-Config-APIs", "XPS-Viewer") - -$Script:SP2016Win16Features = @("Web-Server", "Web-WebServer", - "Web-Common-Http", "Web-Default-Doc", "Web-Dir-Browsing", - "Web-Http-Errors", "Web-Static-Content", "Web-Health", - "Web-Http-Logging", "Web-Log-Libraries", "Web-Request-Monitor", - "Web-Http-Tracing", "Web-Performance", "Web-Stat-Compression", - "Web-Dyn-Compression", "Web-Security", "Web-Filering", "Web-Basic-Auth", - "Web-Digest-Auth", "Web-Windows-Auth", "Web-App-Dev", "Web-Net-Ext", - "Web-Net-Ext45Web-Asp-Net", "Web-Asp-Net45", "Web-ISAPI-Ext", - "Web-ISAPI-Filter", "Web-Mgmt-Tools", "Web-Mgmt-Console", - "Web-Mgmt-Compat", "Web-Metabase", "Web-Lgcy-Scripting", "Web-WMI", - "NET-Framework-Features", "NET-HTTP-Activation", "NET-Non-HTTP-Activ", - "NET-Framework-45-ASPNET", "NET-WCF-Pipe-Activation45", - "Windows-Identity-Foundation", "WAS", "WAS-Process-Model", - "WAS-NET-Environment", "WAS-Config-APIs", "XPS-Viewer") - -$Script:SP2016Win12r2Features = @("Application-Server", "AS-NET-Framework", - "AS-Web-Support", "Web-Server", "Web-WebServer", "Web-Common-Http", - "Web-Default-Doc", "Web-Dir-Browsing", "Web-Http-Errors", - "Web-Static-Content", "Web-Http-Redirect", "Web-Health", - "Web-Http-Logging", "Web-Log-Libraries", "Web-Request-Monitor", - "Web-Performance", "Web-Stat-Compression", "Web-Dyn-Compression", - "Web-Security", "Web-Filtering", "Web-Basic-Auth", "Web-Client-Auth", - "Web-Digest-Auth", "Web-Cert-Auth", "Web-IP-Security", "Web-Url-Auth", - "Web-Windows-Auth", "Web-App-Dev", "Web-Net-Ext", "Web-Net-Ext45", - "Web-Asp-Net45", "Web-ISAPI-Ext", "Web-ISAPI-Filter", "Web-Mgmt-Tools", - "Web-Mgmt-Console", "Web-Mgmt-Compat", "Web-Metabase", - "Web-Lgcy-Mgmt-Console", "Web-Lgcy-Scripting", "Web-WMI", - "Web-Scripting-Tools", "NET-Framework-Features", "NET-Framework-Core", - "NET-HTTP-Activation", "NET-Non-HTTP-Activ", "NET-Framework-45-ASPNET", - "NET-WCF-HTTP-Activation45", "Windows-Identity-Foundation", - "PowerShell-V2", "WAS", "WAS-Process-Model", "WAS-NET-Environment", - "WAS-Config-APIs") - - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $InstallerPath, - - [parameter(Mandatory = $true)] - [System.Boolean] - $OnlineMode, - - [parameter(Mandatory = $false)] - [System.String] - $SXSpath, - - [parameter(Mandatory = $false)] - [System.String] - $SQLNCli, - - [parameter(Mandatory = $false)] - [System.String] - $PowerShell, - - [parameter(Mandatory = $false)] - [System.String] - $NETFX, - - [parameter(Mandatory = $false)] - [System.String] - $IDFX, - - [parameter(Mandatory = $false)] - [System.String] - $Sync, - - [parameter(Mandatory = $false)] - [System.String] - $AppFabric, - - [parameter(Mandatory = $false)] - [System.String] - $IDFX11, - - [parameter(Mandatory = $false)] - [System.String] - $MSIPCClient, - - [parameter(Mandatory = $false)] - [System.String] - $WCFDataServices, - - [parameter(Mandatory = $false)] - [System.String] - $KB2671763, - - [parameter(Mandatory = $false)] - [System.String] - $WCFDataServices56, - - [parameter(Mandatory = $false)] - [System.String] - $MSVCRT11, - - [parameter(Mandatory = $false)] - [System.String] - $MSVCRT14, - - [parameter(Mandatory = $false)] - [System.String] - $KB3092423, - - [parameter(Mandatory = $false)] - [System.String] - $ODBC, - - [parameter(Mandatory = $false)] - [System.String] - $DotNetFx, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present" - ) - - Write-Verbose -Message "Getting installation status of SharePoint prerequisites" - - $majorVersion = (Get-SPDSCAssemblyVersion -PathToAssembly $InstallerPath) - if ($majorVersion -eq 15) - { - Write-Verbose -Message "Version: SharePoint 2013" - } - if ($majorVersion -eq 16) - { - Write-Verbose -Message "Version: SharePoint 2016" - } - - Write-Verbose -Message "Getting installed windows features" - - $osVersion = Get-SPDscOSVersion - if ($majorVersion -eq 15) - { - $WindowsFeatures = Get-WindowsFeature -Name $Script:SP2013Features - } - if ($majorVersion -eq 16) - { - if ($osVersion.Major -eq 10) - { - # Server 2016 - $WindowsFeatures = Get-WindowsFeature -Name $Script:SP2016Win16Features - } - elseif ($osVersion.Major -eq 6 -and $osVersion.Minor -eq 3) - { - # Server 2012 R2 - $WindowsFeatures = Get-WindowsFeature -Name $Script:SP2016Win12r2Features - } - else - { - throw "SharePoint 2016 only supports Windows Server 2016 or 2012 R2" - } - } - - $windowsFeaturesInstalled = $true - foreach ($feature in $WindowsFeatures) - { - if ($feature.Installed -eq $false) - { - $windowsFeaturesInstalled = $false - Write-Verbose -Message "Windows feature $($feature.Name) is not installed" - } - } - - Write-Verbose -Message "Checking windows packages from the registry" - - $x86Path = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" - $installedItemsX86 = Get-ItemProperty -Path $x86Path | Select-Object -Property DisplayName - - $x64Path = "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*" - $installedItemsX64 = Get-ItemProperty -Path $x64Path | Select-Object -Property DisplayName - - $installedItems = $installedItemsX86 + $installedItemsX64 | Select-Object -Property DisplayName -Unique - - # Common prereqs - $prereqsToTest = @( - [PSObject]@{ - Name = "AppFabric 1.1 for Windows Server" - SearchType = "Equals" - SearchValue = "AppFabric 1.1 for Windows Server" - }, - [PSObject]@{ - Name = "Microsoft CCR and DSS Runtime 2008 R3" - SearchType = "Equals" - SearchValue = "Microsoft CCR and DSS Runtime 2008 R3" - }, - [PSObject]@{ - Name = "Microsoft Identity Extensions" - SearchType = "Equals" - SearchValue = "Microsoft Identity Extensions" - }, - [PSObject]@{ - Name = "Microsoft Sync Framework Runtime v1.0 SP1 (x64)" - SearchType = "Equals" - SearchValue = "Microsoft Sync Framework Runtime v1.0 SP1 (x64)" - }, - [PSObject]@{ - Name = "WCF Data Services 5.6.0 Runtime" - SearchType = "Equals" - SearchValue = "WCF Data Services 5.6.0 Runtime" - } - ) - - #SP2013 prereqs - if ($majorVersion -eq 15) - { - $prereqsToTest += @( - [PSObject]@{ - Name = "Active Directory Rights Management Services Client 2.*" - SearchType = "Like" - SearchValue = "Active Directory Rights Management Services Client 2.*" - }, - [PSObject]@{ - Name = "Microsoft SQL Server Native Client (2008 R2 or 2012)" - SearchType = "Match" - SearchValue = "SQL Server (2008 R2|2012) Native Client" - }, - [PSObject]@{ - Name = "WCF Data Services 5.0 (for OData v3) Primary Components" - SearchType = "Equals" - SearchValue = "WCF Data Services 5.0 (for OData v3) Primary Components" - } - ) - } - - #SP2016 prereqs - if ($majorVersion -eq 16) - { - $prereqsToTest += @( - [PSObject]@{ - Name = "Active Directory Rights Management Services Client 2.1" - SearchType = "Equals" - SearchValue = "Active Directory Rights Management Services Client 2.1" - }, - [PSObject]@{ - Name = "Microsoft SQL Server 2012 Native Client" - SearchType = "Equals" - SearchValue = "Microsoft SQL Server 2012 Native Client" - }, - [PSObject]@{ - Name = "Microsoft ODBC Driver 11 for SQL Server" - SearchType = "Equals" - SearchValue = "Microsoft ODBC Driver 11 for SQL Server" - }, - [PSObject]@{ - Name = "Microsoft Visual C++ 2012 x64 Minimum Runtime - 11.0" - SearchType = "Like" - SearchValue = "Microsoft Visual C++ 2012 x64 Minimum Runtime - 11.0.*" - }, - [PSObject]@{ - Name = "Microsoft Visual C++ 2012 x64 Additional Runtime - 11.0" - SearchType = "Like" - SearchValue = "Microsoft Visual C++ 2012 x64 Additional Runtime - 11.0.*" - }, - [PSObject]@{ - Name = "Microsoft Visual C++ 2015 x64 Minimum Runtime - 14.0" - SearchType = "Like" - SearchValue = "Microsoft Visual C++ 2015 x64 Minimum Runtime - 14.0.*" - }, - [PSObject]@{ - Name = "Microsoft Visual C++ 2015 x64 Additional Runtime - 14.0" - SearchType = "Like" - SearchValue = "Microsoft Visual C++ 2015 x64 Additional Runtime - 14.0.*" - } - ) - } - $prereqsInstalled = Test-SPDscPrereqInstallStatus -InstalledItems $installedItems ` - -PrereqsToCheck $prereqsToTest - - $results = @{ - InstallerPath = $InstallerPath - OnlineMode = $OnlineMode - SXSpath = $SXSpath - SQLNCli = $SQLNCli - PowerShell = $PowerShell - NETFX = $NETFX - IDFX = $IDFX - Sync = $Sync - AppFabric = $AppFabric - IDFX11 = $IDFX11 - MSIPCClient = $MSIPCClient - WCFDataServices = $WCFDataServices - KB2671763 = $KB2671763 - WCFDataServices56 = $WCFDataServices56 - MSVCRT11 = $MSVCRT11 - MSVCRT14 = $MSVCRT14 - KB3092423 = $KB3092423 - ODBC = $ODBC - DotNetFx = $DotNetFx - } - - if ($prereqsInstalled -eq $true -and $windowsFeaturesInstalled -eq $true) - { - $results.Ensure = "Present" - } - else - { - $results.Ensure = "Absent" - } - - return $results -} - -function Set-TargetResource -{ - # Supressing the global variable use to allow passing DSC the reboot message - [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidGlobalVars", "")] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $InstallerPath, - - [parameter(Mandatory = $true)] - [System.Boolean] - $OnlineMode, - - [parameter(Mandatory = $false)] - [System.String] - $SXSpath, - - [parameter(Mandatory = $false)] - [System.String] - $SQLNCli, - - [parameter(Mandatory = $false)] - [System.String] - $PowerShell, - - [parameter(Mandatory = $false)] - [System.String] - $NETFX, - - [parameter(Mandatory = $false)] - [System.String] - $IDFX, - - [parameter(Mandatory = $false)] - [System.String] - $Sync, - - [parameter(Mandatory = $false)] - [System.String] - $AppFabric, - - [parameter(Mandatory = $false)] - [System.String] - $IDFX11, - - [parameter(Mandatory = $false)] - [System.String] - $MSIPCClient, - - [parameter(Mandatory = $false)] - [System.String] - $WCFDataServices, - - [parameter(Mandatory = $false)] - [System.String] - $KB2671763, - - [parameter(Mandatory = $false)] - [System.String] - $WCFDataServices56, - - [parameter(Mandatory = $false)] - [System.String] - $MSVCRT11, - - [parameter(Mandatory = $false)] - [System.String] - $MSVCRT14, - - [parameter(Mandatory = $false)] - [System.String] - $KB3092423, - - [parameter(Mandatory = $false)] - [System.String] - $ODBC, - - [parameter(Mandatory = $false)] - [System.String] - $DotNetFx, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present" - ) - - Write-Verbose -Message "Setting installation status of SharePoint prerequisites" - - if ($Ensure -eq "Absent") - { - throw [Exception] ("SharePointDsc does not support uninstalling SharePoint or its " + ` - "prerequisites. Please remove this manually.") - return - } - - Write-Verbose -Message "Detecting SharePoint version from binaries" - $majorVersion = Get-SPDSCAssemblyVersion -PathToAssembly $InstallerPath - $osVersion = Get-SPDscOSVersion - - if ($majorVersion -eq 15) - { - $BinaryDir = Split-Path -Path $InstallerPath - $svrsetupDll = Join-Path -Path $BinaryDir -ChildPath "updates\svrsetup.dll" - $checkDotNet = $true - if (Test-Path -Path $svrsetupDll) - { - $svrsetupDllFileInfo = Get-ItemProperty -Path $svrsetupDll - $fileVersion = $svrsetupDllFileInfo.VersionInfo.FileVersion - if ($fileVersion -ge "15.0.4709.1000") - { - $checkDotNet = $false - } - } - - if ($checkDotNet -eq $true) - { - $ndpKey = "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4" - $dotNet46Installed = $false - if (Test-Path -Path $ndpKey) - { - $dotNetv4Keys = Get-ChildItem -Path $ndpKey - foreach ($dotnetInstance in $dotNetv4Keys) - { - if ($dotnetInstance.GetValue("Release") -ge 390000) - { - $dotNet46Installed = $true - break - } - } - } - - if ($dotNet46Installed -eq $true) - { - throw [Exception] ("A known issue prevents installation of SharePoint 2013 on " + ` - "servers that have .NET 4.6 already installed. See details " + ` - "at https://support.microsoft.com/en-us/kb/3087184") - return - } - } - - Write-Verbose -Message "Version: SharePoint 2013" - $requiredParams = @("SQLNCli","PowerShell","NETFX","IDFX","Sync","AppFabric","IDFX11", - "MSIPCClient","WCFDataServices","KB2671763","WCFDataServices56") - $WindowsFeatures = Get-WindowsFeature -Name $Script:SP2013Features - } - - if ($majorVersion -eq 16) - { - Write-Verbose -Message "Version: SharePoint 2016" - $requiredParams = @("SQLNCli","Sync","AppFabric","IDFX11","MSIPCClient","KB3092423", - "WCFDataServices56","DotNetFx","MSVCRT11","MSVCRT14","ODBC") - if ($osVersion.Major -eq 10) - { - # Server 2016 - $WindowsFeatures = Get-WindowsFeature -Name $Script:SP2016Win16Features - } - elseif ($osVersion.Major -eq 6 -and $osVersion.Minor -eq 3) - { - # Server 2012 R2 - $WindowsFeatures = Get-WindowsFeature -Name $Script:SP2016Win12r2Features - } - else - { - throw "SharePoint 2016 only supports Windows Server 2016 or 2012 R2" - } - } - - # SXSstore for feature install specified, we will manually install features from the - # store, rather then relying on the prereq installer to download them - if ($SXSpath) { - Write-Verbose -Message "Getting installed windows features" - foreach ($feature in $WindowsFeatures) - { - if ($feature.Installed -ne $true) - { - Write-Verbose "Installing $($feature.name)" - $installResult = Install-WindowsFeature -Name $feature.Name -Source $SXSpath - if ($installResult.restartneeded -eq "yes") - { - $global:DSCMachineStatus = 1 - } - if ($installResult.Success -ne $true) - { - throw "Error installing $($feature.name)" - } - } - } - - # see if we need to reboot after feature install - if ($global:DSCMachineStatus -eq 1) - { - return - } - } - - $prereqArgs = "/unattended" - if ($OnlineMode -eq $false) - { - $requiredParams | ForEach-Object -Process { - if (($PSBoundParameters.ContainsKey($_) -eq $true ` - -and [string]::IsNullOrEmpty($PSBoundParameters.$_)) ` - -or (-not $PSBoundParameters.ContainsKey($_))) - { - throw "In offline mode for version $majorVersion parameter $_ is required" - } - if ((Test-Path $PSBoundParameters.$_) -eq $false) - { - throw ("The $_ parameter has been passed but the file cannot be found at the " + ` - "path supplied: `"$($PSBoundParameters.$_)`"") - } - } - $requiredParams | ForEach-Object -Process { - $prereqArgs += " /$_`:`"$($PSBoundParameters.$_)`"" - } - } - - Write-Verbose -Message "Calling the SharePoint Pre-req installer" - Write-Verbose -Message "Args for prereq installer are: $prereqArgs" - $process = Start-Process -FilePath $InstallerPath -ArgumentList $prereqArgs -Wait -PassThru - - switch ($process.ExitCode) - { - 0 - { - Write-Verbose -Message "Prerequisite installer completed successfully." - } - 1 - { - throw "Another instance of the prerequisite installer is already running" - } - 2 - { - throw "Invalid command line parameters passed to the prerequisite installer" - } - 1001 - { - Write-Verbose -Message ("A pending restart is blocking the prerequisite " + ` - "installer from running. Scheduling a reboot.") - $global:DSCMachineStatus = 1 - } - 3010 - { - Write-Verbose -Message ("The prerequisite installer has run correctly and needs " + ` - "to reboot the machine before continuing.") - $global:DSCMachineStatus = 1 - } - default - { - throw ("The prerequisite installer ran with the following unknown " + ` - "exit code $($process.ExitCode)") - } - } - - $rebootKey1 = "HKLM:\Software\Microsoft\Windows\CurrentVersion\" + ` - "Component Based Servicing\RebootPending" - $rebootTest1 = Get-Item -Path $rebootKey1 -ErrorAction SilentlyContinue - - $rebootKey2 = "HKLM:\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\" + ` - "Auto Update\RebootRequired" - $rebootTest2 = Get-Item -Path $rebootKey2 -ErrorAction SilentlyContinue - - $sessionManagerKey = "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" - $sessionManager = Get-Item -Path $sessionManagerKey | Get-ItemProperty - $pendingFileRenames = $sessionManager.PendingFileRenameOperations.Count - - if (($null -ne $rebootTest1) -or ($null -ne $rebootTest2) -or ($pendingFileRenames -gt 0)) - { - Write-Verbose -Message ("SPInstallPrereqs has detected the server has pending a " + ` - "reboot. Flagging to the DSC engine that the server should " + ` - "reboot before continuing.") - $global:DSCMachineStatus = 1 - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $InstallerPath, - - [parameter(Mandatory = $true)] - [System.Boolean] - $OnlineMode, - - [parameter(Mandatory = $false)] - [System.String] - $SXSpath, - - [parameter(Mandatory = $false)] - [System.String] - $SQLNCli, - - [parameter(Mandatory = $false)] - [System.String] - $PowerShell, - - [parameter(Mandatory = $false)] - [System.String] - $NETFX, - - [parameter(Mandatory = $false)] - [System.String] - $IDFX, - - [parameter(Mandatory = $false)] - [System.String] - $Sync, - - [parameter(Mandatory = $false)] - [System.String] - $AppFabric, - - [parameter(Mandatory = $false)] - [System.String] - $IDFX11, - - [parameter(Mandatory = $false)] - [System.String] - $MSIPCClient, - - [parameter(Mandatory = $false)] - [System.String] - $WCFDataServices, - - [parameter(Mandatory = $false)] - [System.String] - $KB2671763, - - [parameter(Mandatory = $false)] - [System.String] - $WCFDataServices56, - - [parameter(Mandatory = $false)] - [System.String] - $MSVCRT11, - - [parameter(Mandatory = $false)] - [System.String] - $MSVCRT14, - - [parameter(Mandatory = $false)] - [System.String] - $KB3092423, - - [parameter(Mandatory = $false)] - [System.String] - $ODBC, - - [parameter(Mandatory = $false)] - [System.String] - $DotNetFx, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present" - ) - - Write-Verbose -Message "Testing installation status of SharePoint prerequisites" - - $PSBoundParameters.Ensure = $Ensure - - if ($Ensure -eq "Absent") - { - throw [Exception] ("SharePointDsc does not support uninstalling SharePoint or its " + ` - "prerequisites. Please remove this manually.") - return - } - - $CurrentValues = Get-TargetResource @PSBoundParameters - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters -ValuesToCheck @("Ensure") -} - -function Test-SPDscPrereqInstallStatus -{ - param - ( - [Parameter(Mandatory = $false)] - [Object] - $InstalledItems, - - [Parameter(Mandatory = $true)] - [psobject[]] - $PrereqsToCheck - ) - - if ($null -eq $InstalledItems) { - return $false - } - - $itemsInstalled = $true - $PrereqsToCheck | ForEach-Object -Process { - $itemToCheck = $_ - switch ($itemToCheck.SearchType) - { - "Equals" - { - if ($null -eq ($InstalledItems | Where-Object -FilterScript { - $null -ne $_.DisplayName -and $_.DisplayName.Trim() -eq $itemToCheck.SearchValue - })) - { - $itemsInstalled = $false - Write-Verbose -Message ("Prerequisite $($itemToCheck.Name) was not found " + ` - "on this system") - } - } - "Match" - { - if ($null -eq ($InstalledItems | Where-Object -FilterScript { - $null -ne $_.DisplayName -and $_.DisplayName.Trim() -match $itemToCheck.SearchValue - })) - { - $itemsInstalled = $false - Write-Verbose -Message ("Prerequisite $($itemToCheck.Name) was not found " + ` - "on this system") - } - } - "Like" - { - if ($null -eq ($InstalledItems | Where-Object -FilterScript { - $null -ne $_.DisplayName -and $_.DisplayName.Trim() -like $itemToCheck.SearchValue - })) - { - $itemsInstalled = $false - Write-Verbose -Message ("Prerequisite $($itemToCheck.Name) was not found " + ` - "on this system") - } - } - Default - { - throw ("Unable to search for a prereq with mode '$($itemToCheck.SearchType)'. " + ` - "please use either 'Equals', 'Like' or 'Match'") - } - } - } - return $itemsInstalled -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPInstallPrereqs/MSFT_SPInstallPrereqs.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPInstallPrereqs/MSFT_SPInstallPrereqs.schema.mof deleted file mode 100644 index fe94c744..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPInstallPrereqs/MSFT_SPInstallPrereqs.schema.mof +++ /dev/null @@ -1,24 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPInstallPrereqs")] -class MSFT_SPInstallPrereqs : OMI_BaseResource -{ - [Key, Description("The full path to prerequisiteinstaller.exe")] String InstallerPath; - [Required, Description("Should the installer download prerequisites from the internet or not")] Boolean OnlineMode; - [Write, Description("The path to the Windows Server Operating System SXS source files, for use in closed environments without access to Windows Update")] String SXSpath; - [Write, Description("The path to the installer for this prerequisite")] String SQLNCli; - [Write, Description("The path to the installer for this prerequisite")] String PowerShell; - [Write, Description("The path to the installer for this prerequisite")] String NETFX; - [Write, Description("The path to the installer for this prerequisite")] String IDFX; - [Write, Description("The path to the installer for this prerequisite")] String Sync; - [Write, Description("The path to the installer for this prerequisite")] String AppFabric; - [Write, Description("The path to the installer for this prerequisite")] String IDFX11; - [Write, Description("The path to the installer for this prerequisite")] String MSIPCClient; - [Write, Description("The path to the installer for this prerequisite")] String WCFDataServices; - [Write, Description("The path to the installer for this prerequisite")] String KB2671763; - [Write, Description("The path to the installer for this prerequisite")] String WCFDataServices56; - [Write, Description("The path to the installer for this prerequisite")] String MSVCRT11; - [Write, Description("The path to the installer for this prerequisite")] String MSVCRT14; - [Write, Description("The path to the installer for this prerequisite")] String KB3092423; - [Write, Description("The path to the installer for this prerequisite")] String ODBC; - [Write, Description("The path to the installer for this prerequisite")] String DotNetFx; - [Write, Description("Present to install the prerequisites. Absent is currently not supported"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPIrmSettings/MSFT_SPIrmSettings.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPIrmSettings/MSFT_SPIrmSettings.psm1 deleted file mode 100644 index 80d6a678..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPIrmSettings/MSFT_SPIrmSettings.psm1 +++ /dev/null @@ -1,178 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - [ValidateSet("Present","Absent")] - $Ensure, - - [parameter(Mandatory = $false)] - [System.Boolean] - $UseADRMS, - - [parameter(Mandatory = $false)] - [System.String] - $RMSserver, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose "Getting SharePoint IRM Settings" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - try - { - $spFarm = Get-SPFarm - } - catch - { - Write-Verbose -Message ("No local SharePoint farm was detected. IRM settings " + ` - "will not be applied") - return @{ - Ensure = "Absent" - UseADRMS = $UseADRMS - RMSserver = $RMSserver - } - } - - # Get a reference to the Administration WebService - $admService = Get-SPDSCContentService - - if ($admService.IrmSettings.IrmRMSEnabled) - { - $Ensure = "Present" - } - else - { - $Ensure = "Absent" - } - - return @{ - Ensure = $Ensure - UseADRMS = $admService.IrmSettings.IrmRMSUseAD - RMSserver = $admService.IrmSettings.IrmRMSCertServer - } - } - return $Result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - [ValidateSet("Present","Absent")] - $Ensure, - - [parameter(Mandatory = $false)] - [System.Boolean] - $UseADRMS, - - [parameter(Mandatory = $false)] - [System.String] - $RMSserver, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose "Setting SharePoint IRM Settings" - - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - try - { - $spFarm = Get-SPFarm - } - catch - { - throw "No local SharePoint farm was detected. IRM settings will not be applied" - return - } - - $admService = Get-SPDSCContentService - - if ($params.UseADRMS -and ($null -ne $params.RMSserver)) - { - throw "Cannot specify both an RMSserver and set UseADRMS to True" - } - - if ($params.UseADRMS -ne $true) - { - $params.UseADRMS = $false - } - - if ($params.Ensure -eq "Present") - { - $admService.IrmSettings.IrmRMSEnabled = $true - $admService.IrmSettings.IrmRMSUseAD = $params.UseADRMS - $admService.IrmSettings.IrmRMSCertServer = $params.RMSserver - } - else - { - $admService.IrmSettings.IrmRMSEnabled = $false - $admService.IrmSettings.IrmRMSUseAD = $false - $admService.IrmSettings.IrmRMSCertServer = $null - } - $admService.Update() - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - [ValidateSet("Present","Absent")] - $Ensure, - - [parameter(Mandatory = $false)] - [System.Boolean] - $UseADRMS, - - [parameter(Mandatory = $false)] - [System.String] - $RMSserver, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose "Testing SharePoint IRM settings" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($null -eq $CurrentValues) - { - return $false - } - - if ($UseADRMS -ne $true) - { - $PSBoundParameters.UseADRMS = $false - } - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPIrmSettings/MSFT_SPIrmSettings.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPIrmSettings/MSFT_SPIrmSettings.schema.mof deleted file mode 100644 index 658713eb..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPIrmSettings/MSFT_SPIrmSettings.schema.mof +++ /dev/null @@ -1,8 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPIrmSettings")] -class MSFT_SPIrmSettings : OMI_BaseResource -{ - [Key, Description("Enable or Disable IRM on this farm"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, Description("Use the RMS server published in this farm's Active Directory")] Boolean UseADRMS; - [Write, Description("Use the specified RMS server, must provide in URL format")] String RMSserver; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPJoinFarm/MSFT_SPJoinFarm.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPJoinFarm/MSFT_SPJoinFarm.psm1 deleted file mode 100644 index 75ce0fda..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPJoinFarm/MSFT_SPJoinFarm.psm1 +++ /dev/null @@ -1,332 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $FarmConfigDatabaseName, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $Passphrase, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $false)] - [System.String] - [ValidateSet("Application", - "ApplicationWithSearch", - "Custom", - "DistributedCache", - "Search", - "SingleServer", - "SingleServerFarm", - "WebFrontEnd", - "WebFrontEndWithDistributedCache")] - $ServerRole - ) - - Write-Verbose -Message ("WARNING! SPCreateFarm is deprecated and will be removed in " + ` - "SharePointDsc v2.0. Swap to use the new SPFarm resource as " + ` - "an alternative. See http://aka.ms/SPDsc-SPFarm for details.") - - Write-Verbose -Message "Getting local farm presence" - - if (($PSBoundParameters.ContainsKey("ServerRole") -eq $true) ` - -and (Get-SPDSCInstalledProductVersion).FileMajorPart -ne 16) - { - throw [Exception] "Server role is only supported in SharePoint 2016." - } - - if (($PSBoundParameters.ContainsKey("ServerRole") -eq $true) ` - -and (Get-SPDSCInstalledProductVersion).FileMajorPart -eq 16 ` - -and (Get-SPDSCInstalledProductVersion).FileBuildPart -lt 4456 ` - -and ($ServerRole -eq "ApplicationWithSearch" ` - -or $ServerRole -eq "WebFrontEndWithDistributedCache")) - { - throw [Exception] ("ServerRole values of 'ApplicationWithSearch' or " + ` - "'WebFrontEndWithDistributedCache' require the SharePoint 2016 " + ` - "Feature Pack 1 to be installed. See " + ` - "https://support.microsoft.com/en-au/kb/3127940") - } - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $getSPMajorVersion = (Get-SPDSCInstalledProductVersion).FileMajorPart - $cfgDbRegKey = "hklm:SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\$getSPMajorVersion.0\Secure\ConfigDB" - try - { - $configDbDsn = Get-SPDSCRegistryKey -Key $cfgDbRegKey -Value "dsn" - } - catch - { - Write-Verbose -Message "SharePoint registry key cannot be found." - } - $serverIsJoined = $true - - if ($null -eq $configDbDsn) - { - $serverIsJoined = $false - } - elseif (-NOT($configDbDsn.Contains($params.FarmConfigDatabaseName))) - { - $serverIsJoined = $false - } - - try - { - $spFarm = Get-SPFarm - } - catch - { - Write-Verbose -Message "Unable to detect local farm." - if ($serverIsJoined) - { - throw 'Server already joined to farm but SPFarm not reachable' - } - } - - if ($null -eq $spFarm) - { - return @{ - FarmConfigDatabaseName = "" - DatabaseServer = "" - InstallAccount = "" - Passphrase = "" - } - } - - $configDb = Get-SPDatabase | Where-Object -FilterScript { - $_.Name -eq $spFarm.Name -and $_.Type -eq "Configuration Database" - } - - return @{ - FarmConfigDatabaseName = $spFarm.Name - DatabaseServer = $configDb.Server.Name - InstallAccount = $params.InstallAccount - Passphrase = $params.Passphrase.password - } - } - return $result -} - -function Set-TargetResource -{ - # Supressing the global variable use to allow passing DSC the reboot message - [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidGlobalVars", "")] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $FarmConfigDatabaseName, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $Passphrase, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $false)] - [System.String] - [ValidateSet("Application", - "ApplicationWithSearch", - "Custom", - "DistributedCache", - "Search", - "SingleServer", - "SingleServerFarm", - "WebFrontEnd", - "WebFrontEndWithDistributedCache")] - $ServerRole - ) - - Write-Verbose -Message ("WARNING! SPCreateFarm is deprecated and will be removed in " + ` - "SharePointDsc v2.0. Swap to use the new SPFarm resource as " + ` - "an alternative. See http://aka.ms/SPDsc-SPFarm for details.") - - Write-Verbose -Message "Setting local farm" - - if (($PSBoundParameters.ContainsKey("ServerRole") -eq $true) ` - -and (Get-SPDSCInstalledProductVersion).FileMajorPart -ne 16) - { - throw [Exception] "Server role is only supported in SharePoint 2016." - } - - if (($PSBoundParameters.ContainsKey("ServerRole") -eq $true) ` - -and (Get-SPDSCInstalledProductVersion).FileMajorPart -eq 16 ` - -and (Get-SPDSCInstalledProductVersion).FileBuildPart -lt 4456 ` - -and ($ServerRole -eq "ApplicationWithSearch" ` - -or $ServerRole -eq "WebFrontEndWithDistributedCache")) - { - throw [Exception] ("ServerRole values of 'ApplicationWithSearch' or " + ` - "'WebFrontEndWithDistributedCache' require the SharePoint 2016 " + ` - "Feature Pack 1 to be installed. See " + ` - "https://support.microsoft.com/en-au/kb/3127940") - } - - $CurrentValues = Get-TargetResource @PSBoundParameters - if ([string]::IsNullOrEmpty($CurrentValues.FarmConfigDatabaseName) -eq $false) - { - throw ("This server is already connected to a farm " + ` - "($($CurrentValues.FarmConfigDatabaseName)). Please manually remove it " + ` - "to apply this change.") - } - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` - -ScriptBlock { - - $params = $args[0] - $scriptRoot = $args[1] - - $modulePath = "..\..\Modules\SharePointDsc.Farm\SPFarm.psm1" - Import-Module -Name (Join-Path -Path $scriptRoot -ChildPath $modulePath -Resolve) - $dbStatus = Get-SPDSCConfigDBStatus -SQLServer $params.DatabaseServer ` - -Database $params.FarmConfigDatabaseName - - while ($dbStatus.Locked -eq $true) - { - Write-Verbose -Message ("[$([DateTime]::Now.ToShortTimeString())] The configuration " + ` - "database is currently being provisioned by a remote " + ` - "server, this server will wait for this to complete") - Start-Sleep -Seconds 30 - $dbStatus = Get-SPDSCConfigDBStatus -SQLServer $params.DatabaseServer ` - -Database $params.FarmConfigDatabaseName - } - - if ($dbStatus.ValidPermissions -eq $false) - { - throw "The current user does not have sufficient permissions to SQL Server" - return - } - - try { - $joinFarmArgs = @{ - DatabaseServer = $params.DatabaseServer - DatabaseName = $params.FarmConfigDatabaseName - Passphrase = $params.Passphrase.password - SkipRegisterAsDistributedCacheHost = $true - } - - switch((Get-SPDSCInstalledProductVersion).FileMajorPart) { - 15 { - Write-Verbose -Message "Detected Version: SharePoint 2013" - } - 16 { - if ($params.ContainsKey("ServerRole") -eq $true) { - Write-Verbose -Message ("Detected Version: SharePoint 2016 - " + ` - "configuring server as $($params.ServerRole)") - $joinFarmArgs.Add("LocalServerRole", $params.ServerRole) - } else { - Write-Verbose -Message ("Detected Version: SharePoint 2016 - no server " + ` - "role provided, configuring server without a " + ` - "specific role") - } - } - Default { - throw [Exception] ("An unknown version of SharePoint (Major version $_) " + ` - "was detected. Only versions 15 (SharePoint 2013) or " + ` - "16 (SharePoint 2016) are supported.") - } - } - - Connect-SPConfigurationDatabase @joinFarmArgs - Install-SPHelpCollection -All - Initialize-SPResourceSecurity - Install-SPService - Install-SPFeature -AllExistingFeatures -Force | out-null - Install-SPApplicationContent - } - catch [System.Exception] { - return $_ - } - } - - if ($null -ne $result) - { - Write-Verbose -Message "An error occured joining the farm" - throw $_ - } - - Write-Verbose -Message "Starting timer service" - Start-Service -Name sptimerv4 - - Write-Verbose -Message ("Pausing for 5 minutes to allow the timer service to " + ` - "fully provision the server") - Start-Sleep -Seconds 300 - Write-Verbose -Message ("Join farm complete. Restarting computer to allow " + ` - "configuration to continue") - - $global:DSCMachineStatus = 1 -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $FarmConfigDatabaseName, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $Passphrase, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $false)] - [System.String] - [ValidateSet("Application", - "ApplicationWithSearch", - "Custom", - "DistributedCache", - "Search", - "SingleServer", - "SingleServerFarm", - "WebFrontEnd", - "WebFrontEndWithDistributedCache")] - $ServerRole - ) - - Write-Verbose -Message "Testing for local farm presence" - - if (($PSBoundParameters.ContainsKey("ServerRole") -eq $true) ` - -and (Get-SPDSCInstalledProductVersion).FileMajorPart -ne 16) - { - throw [Exception] "Server role is only supported in SharePoint 2016." - } - - $CurrentValues = Get-TargetResource @PSBoundParameters - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("FarmConfigDatabaseName") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPJoinFarm/MSFT_SPJoinFarm.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPJoinFarm/MSFT_SPJoinFarm.schema.mof deleted file mode 100644 index 50203148..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPJoinFarm/MSFT_SPJoinFarm.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPJoinFarm")] -class MSFT_SPJoinFarm : OMI_BaseResource -{ - [Key, Description("The name of the config database to connect to")] string FarmConfigDatabaseName; - [Key, Description("The server that hosts the config database")] string DatabaseServer; - [Required, Description("The passphrase that should be used to join the farm") , EmbeddedInstance("MSFT_Credential")] string Passphrase; - [Write, Description("SharePoint 2016 only - the MinRole role to enroll this server as"), ValueMap{"Application","ApplicationWithSearch","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","WebFrontEnd","WebFrontEndWithDistributedCache"}, Values{"Application","ApplicationWithSearch","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","WebFrontEnd","WebFrontEndWithDistributedCache"}] string ServerRole; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPMachineTranslationServiceApp/MSFT_SPMachineTranslationServiceApp.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPMachineTranslationServiceApp/MSFT_SPMachineTranslationServiceApp.psm1 deleted file mode 100644 index a24ed5e9..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPMachineTranslationServiceApp/MSFT_SPMachineTranslationServiceApp.psm1 +++ /dev/null @@ -1,209 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [System.Management.Automation.PSCredential] - $InstallAccount - ) - Write-Verbose -Message "Getting Machine Translation Service Application '$Name'" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue - - $nullReturn = @{ - Name = $params.Name - DatabaseName = $params.DatabaseName - DatabaseServer = $params.DatabaseServer - ApplicationPool = $params.ApplicationPool - Ensure = "Absent" - } - - if($null -eq $serviceApps) - { - return $nullReturn - } - - $serviceApp = $serviceApps | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.TranslationServices.TranslationServiceApplication" - } - - if($null -eq $serviceApp) - { - return $nullReturn - } - else { - return @{ - Name = $params.Name - DatabaseName = $($serviceApp.Database.Name) - DatabaseServer = $($serviceApp.Database.Server.Name) - ApplicationPool = $($serviceApp.ApplicationPool.Name) - Ensure = "Present" - } - } - - } - - return $result -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose "Setting Machine Translation Service Application." - $CurrentValues = Get-TargetResource @PSBoundParameters - - if($CurrentValues.Ensure -eq "Present" -and $Ensure -eq "Present") - { - Write-Verbose "Resetting Machine Translation Service Application." - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - $serviceApps = Get-SPServiceApplication -Identity $params.Name - - $serviceApp = $serviceApps | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.TranslationServices.TranslationServiceApplication" - } - - $serviceApp | Set-SPTranslationServiceApplication -ApplicationPool $params.ApplicationPool ` - -DatabaseName $params.DatabaseName ` - -DatabaseServer $params.DatabaseServer - } - } - if($CurrentValues.Ensure -eq "Absent" -and $Ensure -eq "Present") - { - Write-Verbose "Creating Machine Translation Service Application." - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - New-SPTranslationServiceApplication -Name $params.Name ` - -DatabaseName $params.DatabaseName ` - -DatabaseServer $params.DatabaseServer ` - -ApplicationPool $params.ApplicationPool - } - } - if($Ensure -eq "Absent") - { - Write-Verbose "Removing Machine Translation Service Application." - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $serviceApps = Get-SPServiceApplication -Identity $params.Name - $serviceApp = $serviceApps | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.TranslationServices.TranslationServiceApplication" - } - $serviceApp | Remove-SPServiceApplication - - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose "Test Machine Translation Service Application." - - $PSBoundParameters.Ensure = $Ensure - - $CurrentValues = Get-TargetResource @PSBoundParameters - - $params = $PSBoundParameters - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Name","ApplicationPool", - "DatabaseName","DatabaseServer", - "Ensure") - -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPMachineTranslationServiceApp/MSFT_SPMachineTranslationServiceApp.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPMachineTranslationServiceApp/MSFT_SPMachineTranslationServiceApp.schema.mof deleted file mode 100644 index 35141dc8..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPMachineTranslationServiceApp/MSFT_SPMachineTranslationServiceApp.schema.mof +++ /dev/null @@ -1,12 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("SPMachineTranslationServiceApp")] -class MSFT_SPMachineTranslationServiceApp : OMI_BaseResource -{ - [Key, Description("Specifies the name of the service application.")] String Name; - [Required, Description("Specifies the name of the database for the service application.")] String DatabaseName; - [Required, Description("Specifies the name of the database server for the service application.")] String DatabaseServer; - [Required, Description("Specifies the application pool to use with the service application.")] String ApplicationPool; - [Write, Description("Present ensures service app exists, absent ensures it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, EmbeddedInstance("MSFT_Credential"), Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5")] String InstallAccount; -}; - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPManagedAccount/MSFT_SPManagedAccount.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPManagedAccount/MSFT_SPManagedAccount.psm1 deleted file mode 100644 index 8c23da60..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPManagedAccount/MSFT_SPManagedAccount.psm1 +++ /dev/null @@ -1,219 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $Account, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $false)] - [System.UInt32] - $EmailNotification, - - [parameter(Mandatory = $false)] - [System.UInt32] - $PreExpireDays, - - [parameter(Mandatory = $false)] - [System.String] - $Schedule, - - [parameter(Mandatory = $true)] - [System.String] - $AccountName - ) - - Write-Verbose -Message "Getting managed account $AccountName" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $ma = Get-SPManagedAccount -Identity $params.AccountName ` - -ErrorAction SilentlyContinue - if ($null -eq $ma) - { - return @{ - AccountName = $params.AccountName - Account = $params.Account - Ensure = "Absent" - InstallAccount = $params.InstallAccount - } - } - $schedule = $null - if ($null -ne $ma.ChangeSchedule) - { - $schedule = $ma.ChangeSchedule.ToString() - } - return @{ - AccountName = $ma.Username - EmailNotification = $ma.DaysBeforeChangeToEmail - PreExpireDays = $ma.DaysBeforeExpiryToChange - Schedule = $schedule - Account = $params.Account - Ensure = "Present" - InstallAccount = $params.InstallAccount - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $Account, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $false)] - [System.UInt32] - $EmailNotification, - - [parameter(Mandatory = $false)] - [System.UInt32] - $PreExpireDays, - - [parameter(Mandatory = $false)] - [System.String] - $Schedule, - - [parameter(Mandatory = $true)] - [System.String] - $AccountName - ) - - Write-Verbose -Message "Setting managed account $AccountName" - - if ($Ensure -eq "Present" -and $null -eq $Account) - { - throw ("You must specify the 'Account' property as a PSCredential to create a " + ` - "managed account") - return - } - - $currentValues = Get-TargetResource @PSBoundParameters - if ($currentValues.Ensure -eq "Absent" -and $Ensure -eq "Present") - { - Write-Verbose -Message ("Managed account does not exist but should, creating " + ` - "the managed account") - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - New-SPManagedAccount -Credential $params.Account - } - } - - if ($Ensure -eq "Present") - { - Write-Verbose -Message "Updating settings for managed account" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $updateParams = @{ - Identity = $params.Account.UserName - } - if ($params.ContainsKey("EmailNotification")) - { - $updateParams.Add("EmailNotification", $params.EmailNotification) - } - if ($params.ContainsKey("PreExpireDays")) - { - $updateParams.Add("PreExpireDays", $params.PreExpireDays) - } - if ($params.ContainsKey("Schedule")) - { - $updateParams.Add("Schedule", $params.Schedule) - } - Set-SPManagedAccount @updateParams - } - } - else - { - Write-Verbose -Message "Removing managed account" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - Remove-SPManagedAccount -Identity $params.AccountName -Confirm:$false - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $Account, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $false)] - [System.UInt32] - $EmailNotification, - - [parameter(Mandatory = $false)] - [System.UInt32] - $PreExpireDays, - - [parameter(Mandatory = $false)] - [System.String] - $Schedule, - - [parameter(Mandatory = $true)] - [System.String] - $AccountName - ) - - Write-Verbose -Message "Testing managed account $AccountName" - - $PSBoundParameters.Ensure = $Ensure - - $CurrentValues = Get-TargetResource @PSBoundParameters - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("AccountName", - "Schedule", - "PreExpireDays", - "EmailNotification", - "Ensure") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPManagedAccount/MSFT_SPManagedAccount.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPManagedAccount/MSFT_SPManagedAccount.schema.mof deleted file mode 100644 index 881fa8e9..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPManagedAccount/MSFT_SPManagedAccount.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPManagedAccount")] -class MSFT_SPManagedAccount : OMI_BaseResource -{ - [Key, Description("The username of the account")] string AccountName; - [Write, Description("The credential with password of the account"), EmbeddedInstance("MSFT_Credential")] String Account; - [Write, Description("How many days before a password change should an email be sent")] Uint32 EmailNotification; - [Write, Description("How many days before a password expires should it be changed")] Uint32 PreExpireDays; - [Write, Description("What is the schedule for the password reset")] string Schedule; - [Write, Description("Present ensures managed account exists, absent ensures it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceApp/MSFT_SPManagedMetaDataServiceApp.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceApp/MSFT_SPManagedMetaDataServiceApp.psm1 deleted file mode 100644 index e9970d3a..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceApp/MSFT_SPManagedMetaDataServiceApp.psm1 +++ /dev/null @@ -1,449 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $ProxyName, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String[]] - $TermStoreAdministrators, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.String] - $ContentTypeHubUrl, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting managed metadata service application $Name" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $serviceApps = Get-SPServiceApplication -Name $params.Name ` - -ErrorAction SilentlyContinue - $nullReturn = @{ - Name = $params.Name - Ensure = "Absent" - ApplicationPool = $params.ApplicationPool - TermStoreAdministrators = @() - } - if ($null -eq $serviceApps) - { - return $nullReturn - } - $serviceApp = $serviceApps | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.SharePoint.Taxonomy.MetadataWebServiceApplication" - } - - if ($null -eq $serviceApp) - { - return $nullReturn - } - else - { - $serviceAppProxies = Get-SPServiceApplicationProxy -ErrorAction SilentlyContinue - if ($null -ne $serviceAppProxies) - { - $serviceAppProxy = $serviceAppProxies | Where-Object -FilterScript { - $serviceApp.IsConnected($_) - } - if ($null -ne $serviceAppProxy) - { - $proxyName = $serviceAppProxy.Name - } - } - - # Get the ContentTypeHubUrl value - $hubUrl = "" - try - { - $propertyFlags = [System.Reflection.BindingFlags]::Instance ` - -bor [System.Reflection.BindingFlags]::NonPublic - $defaultPartitionId = [Guid]::Parse("0C37852B-34D0-418e-91C6-2AC25AF4BE5B") - - $installedVersion = Get-SPDSCInstalledProductVersion - switch ($installedVersion.FileMajorPart) - { - 15 { - $propData = $serviceApp.GetType().GetMethods($propertyFlags) - $method = $propData | Where-Object -FilterScript { - $_.Name -eq "GetContentTypeSyndicationHubLocal" - } - $hubUrl = $method.Invoke($serviceApp, $defaultPartitionId).AbsoluteUri } - 16 { - $propData = $serviceApp.GetType().GetProperties($propertyFlags) - $dbMapperProp = $propData | Where-Object -FilterScript { - $_.Name -eq "DatabaseMapper" - } - - $dbMapper = $dbMapperProp.GetValue($serviceApp) - - $propData2 = $dbMapper.GetType().GetMethods($propertyFlags) - $cthubMethod = $propData2 | Where-Object -FilterScript { - $_.Name -eq "GetContentTypeSyndicationHubLocal" - } - - $hubUrl = $cthubMethod.Invoke($dbMapper, $defaultPartitionId).AbsoluteUri - } - default { - throw ("Detected an unsupported major version of SharePoint. " + ` - "SharePointDsc only supports SharePoint 2013 or 2016.") - } - } - - if ($hubUrl) - { - $hubUrl = $hubUrl.TrimEnd('/') - } - } - catch [System.Exception] - { - $hubUrl = "" - } - - $centralAdminSite = Get-SPWebApplication -IncludeCentralAdministration ` - | Where-Object -FilterScript { - $_.IsAdministrationWebApplication -eq $true - } - $session = Get-SPTaxonomySession -Site $centralAdminSite.Url - - $currentAdmins = @() - - $session.TermStores[0].TermStoreAdministrators | ForEach-Object -Process { - $name = [string]::Empty - if ($_.IsWindowsAuthenticationMode -eq $true) - { - $name = $_.PrincipalName - } - else - { - $name = (New-SPClaimsPrincipal -Identity $_.PrincipalName -IdentityType EncodedClaim).Value - if ($name -match "^s-1-[0-59]-\d+-\d+-\d+-\d+-\d+") - { - $name = Resolve-SPDscSecurityIdentifier -SID $name - } - } - $currentAdmins += $name - } - - return @{ - Name = $serviceApp.DisplayName - ProxyName = $proxyName - Ensure = "Present" - ApplicationPool = $serviceApp.ApplicationPool.Name - DatabaseName = $serviceApp.Database.Name - DatabaseServer = $serviceApp.Database.Server.Name - TermStoreAdministrators = $currentAdmins - ContentTypeHubUrl = $hubUrl - InstallAccount = $params.InstallAccount - } - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $ProxyName, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String[]] - $TermStoreAdministrators, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.String] - $ContentTypeHubUrl, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting managed metadata service application $Name" - - $result = Get-TargetResource @PSBoundParameters - - if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") - { - Write-Verbose -Message "Creating Managed Metadata Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - if ($params.ContainsKey("Ensure")) - { - $params.Remove("Ensure") | Out-Null - } - if ($params.ContainsKey("InstallAccount")) - { - $params.Remove("InstallAccount") | Out-Null - } - if ($params.ContainsKey("TermStoreAdministrators")) - { - $params.Remove("TermStoreAdministrators") | Out-Null - } - if ($params.ContainsKey("ContentTypeHubUrl")) - { - $params.Add("HubUri", $params.ContentTypeHubUrl) - $params.Remove("ContentTypeHubUrl") - } - if ($params.ContainsKey("ProxyName")) - { - $pName = $params.ProxyName - $params.Remove("ProxyName") | Out-Null - } - if ($null -eq $pName) { - $pName = "$($params.Name) Proxy" - } - - $app = New-SPMetadataServiceApplication @params - if ($null -ne $app) - { - New-SPMetadataServiceApplicationProxy -Name $pName ` - -ServiceApplication $app ` - -DefaultProxyGroup ` - -ContentTypePushdownEnabled ` - -DefaultKeywordTaxonomy ` - -DefaultSiteCollectionTaxonomy - } - } - } - - if ($result.Ensure -eq "Present" -and $Ensure -eq "Present") - { - if ([string]::IsNullOrEmpty($ApplicationPool) -eq $false ` - -and $ApplicationPool -ne $result.ApplicationPool) - { - Write-Verbose -Message "Updating Managed Metadata Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $serviceApp = Get-SPServiceApplication -Name $params.Name ` - | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.SharePoint.Taxonomy.MetadataWebServiceApplication" - } - $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool - Set-SPMetadataServiceApplication -Identity $serviceApp -ApplicationPool $appPool - } - } - - if (($PSBoundParameters.ContainsKey("ContentTypeHubUrl") -eq $true) ` - -and ($ContentTypeHubUrl.TrimEnd('/') -ne $result.ContentTypeHubUrl.TrimEnd('/'))) - { - Write-Verbose -Message "Updating Content type hub for Managed Metadata Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $serviceApp = Get-SPServiceApplication -Name $params.Name ` - | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.SharePoint.Taxonomy.MetadataWebServiceApplication" - } - Set-SPMetadataServiceApplication -Identity $serviceApp -HubUri $params.ContentTypeHubUrl - } - } - } - - if ($Ensure -eq "Present" -and $PSBoundParameters.ContainsKey("TermStoreAdministrators") -eq $true) - { - # Update the term store administrators - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $result) ` - -ScriptBlock { - - Write-Verbose -Message "Setting term store administrators" - $params = $args[0] - $currentValues = $args[1] - - $centralAdminSite = Get-SPWebApplication -IncludeCentralAdministration ` - | Where-Object -FilterScript { - $_.IsAdministrationWebApplication -eq $true - } - $session = Get-SPTaxonomySession -Site $centralAdminSite.Url - $termStore = $session.TermStores[0] - - $changesToMake = Compare-Object -ReferenceObject $currentValues.TermStoreAdministrators ` - -DifferenceObject $params.TermStoreAdministrators - - $changesToMake | ForEach-Object -Process { - $change = $_ - switch($change.SideIndicator) - { - "<=" { - # remove an existing user - if ($termStore.TermStoreAdministrators.PrincipalName -contains $change.InputObject) - { - $termStore.DeleteTermStoreAdministrator($change.InputObject) - } - else - { - $claimsToken = New-SPClaimsPrincipal -Identity $change.InputObject ` - -IdentityType WindowsSamAccountName - $termStore.DeleteTermStoreAdministrator($claimsToken.ToEncodedString()) - } - } - "=>" { - # add a new user - $termStore.AddTermStoreAdministrator($change.InputObject) - } - default { - throw "An unknown side indicator was found." - } - } - } - - $termStore.CommitAll(); - } - } - - if ($Ensure -eq "Absent") - { - # The service app should not exit - Write-Verbose -Message "Removing Managed Metadata Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $serviceApp = Get-SPServiceApplication -Name $params.Name | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.SharePoint.Taxonomy.MetadataWebServiceApplication" - - } - - $proxies = Get-SPServiceApplicationProxy - foreach($proxyInstance in $proxies) - { - if($serviceApp.IsConnected($proxyInstance)) - { - $proxyInstance.Delete() - } - } - - Remove-SPServiceApplication -Identity $serviceApp -Confirm:$false - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $ProxyName, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String[]] - $TermStoreAdministrators, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.String] - $ContentTypeHubUrl, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing managed metadata service application $Name" - - $PSBoundParameters.Ensure = $Ensure - if ($PSBoundParameters.ContainsKey("ContentTypeHubUrl") -eq $true) - { - $PSBoundParameters.ContentTypeHubUrl = $ContentTypeHubUrl.TrimEnd('/') - } - - $CurrentValues = Get-TargetResource @PSBoundParameters - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ApplicationPool", - "ContentTypeHubUrl", - "TermStoreAdministrators", - "Ensure") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceApp/MSFT_SPManagedMetaDataServiceApp.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceApp/MSFT_SPManagedMetaDataServiceApp.schema.mof deleted file mode 100644 index 4bd75d90..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceApp/MSFT_SPManagedMetaDataServiceApp.schema.mof +++ /dev/null @@ -1,13 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPManagedMetaDataServiceApp")] -class MSFT_SPManagedMetaDataServiceApp : OMI_BaseResource -{ - [Key, Description("The name of the managed metadata service application")] string Name; - [Write, Description("The proxy name, if not specified will be /Name of service app/ Proxy")] string ProxyName; - [Required, Description("The application pool that the service app will use")] string ApplicationPool; - [Write, Description("The name of the database server which will host the application")] string DatabaseServer; - [Write, Description("The name of the database for the service application")] string DatabaseName; - [Write, Description("A list of the users/groups who are administrators of the term store")] string TermStoreAdministrators[]; - [Write, Description("Present ensures service app exists, absent ensures it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("The URL of the content type hub for this app (only set when the app is provisioned)")] string ContentTypeHubUrl; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPManagedPath/MSFT_SPManagedPath.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPManagedPath/MSFT_SPManagedPath.psm1 deleted file mode 100644 index efc15cbb..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPManagedPath/MSFT_SPManagedPath.psm1 +++ /dev/null @@ -1,207 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $true)] - [System.String] - $RelativeUrl, - - [parameter(Mandatory = $true)] - [System.Boolean] - $Explicit, - - [parameter(Mandatory = $true)] - [System.Boolean] - $HostHeader, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting managed path $RelativeUrl in $WebAppUrl" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $getParams = @{ - Identity = $params.RelativeUrl - } - if ($params.HostHeader) - { - $getParams.Add("HostHeader", $true) - } - else - { - $getParams.Add("WebApplication", $params.WebAppUrl) - } - $path = Get-SPManagedPath @getParams -ErrorAction SilentlyContinue - if ($null -eq $path) - { - return @{ - WebAppUrl = $params.WebAppUrl - RelativeUrl = $params.RelativeUrl - Explicit = $params.Explicit - HostHeader = $params.HostHeader - InstallAccount = $params.InstallAccount - Ensure = "Absent" - } - } - - return @{ - RelativeUrl = $path.Name - Explicit = ($path.Type -eq "ExplicitInclusion") - WebAppUrl = $params.WebAppUrl - HostHeader = $params.HostHeader - InstallAccount = $params.InstallAccount - Ensure = "Present" - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $true)] - [System.String] - $RelativeUrl, - - [parameter(Mandatory = $true)] - [System.Boolean] - $Explicit, - - [parameter(Mandatory = $true)] - [System.Boolean] - $HostHeader, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting managed path $RelativeUrl in $WebAppUrl" - - $CurrentResults = Get-TargetResource @PSBoundParameters - - if ($CurrentResults.Ensure -eq "Absent" -and $Ensure -eq "Present") - { - Write-Verbose -Message "Creating the managed path $RelativeUrl in $WebAppUrl" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $newParams = @{ - RelativeURL = $params.RelativeUrl - Explicit = $params.Explicit - } - if ($params.HostHeader) - { - $newParams.Add("HostHeader", $params.HostHeader) - } - else - { - $newParams.Add("WebApplication", $params.WebAppUrl) - } - New-SPManagedPath @newParams - } - } - - if ($Ensure -eq "Absent") - { - Write-Verbose -Message "Removing the managed path $RelativeUrl from $WebAppUrl" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $removeParams = @{ - Identity = $params.RelativeUrl - } - if ($params.HostHeader) - { - $removeParams.Add("HostHeader", $params.HostHeader) - } - else - { - $removeParams.Add("WebApplication", $params.WebAppUrl) - } - - Remove-SPManagedPath @removeParams -Confirm:$false - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $true)] - [System.String] - $RelativeUrl, - - [parameter(Mandatory = $true)] - [System.Boolean] - $Explicit, - - [parameter(Mandatory = $true)] - [System.Boolean] - $HostHeader, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing managed path $RelativeUrl in $WebAppUrl" - - $PSBoundParameters.Ensure = $Ensure - - $CurrentValues = Get-TargetResource @PSBoundParameters - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("WebAppUrl", - "RelativeUrl", - "Explicit", - "HostHeader", - "Ensure") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPManagedPath/MSFT_SPManagedPath.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPManagedPath/MSFT_SPManagedPath.schema.mof deleted file mode 100644 index 8964ea01..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPManagedPath/MSFT_SPManagedPath.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPManagedPath")] -class MSFT_SPManagedPath : OMI_BaseResource -{ - [Key, Description("The URL of the web application to apply the managed path to - this is ignored for host header web applications")] string WebAppUrl; - [Key, Description("The relative URL of the managed path")] string RelativeUrl; - [Required, Description("Should the host header be explicit? If false then it is a wildcard")] boolean Explicit; - [Required, Description("Is this a host header web application?")] boolean HostHeader; - [Write, Description("Present ensures managed path exists, absent ensures it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerBinding/MSFT_SPOfficeOnlineServerBinding.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerBinding/MSFT_SPOfficeOnlineServerBinding.psm1 deleted file mode 100644 index 6ee071c2..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerBinding/MSFT_SPOfficeOnlineServerBinding.psm1 +++ /dev/null @@ -1,174 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Internal-HTTP","Internal-HTTPS","External-HTTP","External-HTTPS")] - [System.String] - $Zone, - - [parameter(Mandatory = $true)] - [System.String] - $DnsName, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting Office Online Server details for '$Zone' zone" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $currentZone = Get-SPWOPIZone - $bindings = Get-SPWOPIBinding -WOPIZone $currentZone - - if ($null -eq $bindings) - { - return @{ - Zone = $currentZone - DnsName = $null - Ensure = "Absent" - InstallAccount = $params.InstallAccount - } - } - else - { - return @{ - Zone = $currentZone - DnsName = ($bindings | Select-Object -First 1).ServerName - Ensure = "Present" - InstallAccount = $params.InstallAccount - } - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Internal-HTTP","Internal-HTTPS","External-HTTP","External-HTTPS")] - [System.String] - $Zone, - - [parameter(Mandatory = $true)] - [System.String] - $DnsName, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting Office Online Server details for '$Zone' zone" - - $CurrentResults = Get-TargetResource @PSBoundParameters - - if ($Ensure -eq "Present") - { - if ($DnsName -ne $CurrentResults.DnsName -or $Zone -ne $CurrentResults.Zone) - { - if ([String]::IsNullOrEmpty($CurrentResults.DnsName) -eq $false ` - -or $Zone -ne $CurrentResults.Zone) - { - Write-Verbose -Message ("Removing bindings for zone '$Zone' so new bindings " + ` - "can be added") - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - Get-SPWOPIBinding -WOPIZone $params.Zone | Remove-SPWOPIBinding -Confirm:$false - } - } - Write-Verbose -Message "Creating new bindings for '$DnsName' and setting zone to '$Zone'" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $newParams = @{ - ServerName = $params.DnsName - } - if ($params.Zone.ToLower().EndsWith("http") -eq $true) - { - $newParams.Add("AllowHTTP", $true) - } - New-SPWOPIBinding @newParams - Set-SPWOPIZone -zone $params.Zone - } - } - } - - if ($Ensure -eq "Absent") - { - Write-Verbose -Message "Removing bindings for zone '$Zone'" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - Get-SPWOPIBinding -WOPIZone $params.Zone | Remove-SPWOPIBinding -Confirm:$false - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Internal-HTTP","Internal-HTTPS","External-HTTP","External-HTTPS")] - [System.String] - $Zone, - - [parameter(Mandatory = $true)] - [System.String] - $DnsName, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing Office Online Server details for '$Zone' zone" - - $PSBoundParameters.Ensure = $Ensure - - $CurrentValues = Get-TargetResource @PSBoundParameters - - $paramsToCheck = @("Ensure") - if ($Ensure -eq "Present") - { - $paramsToCheck += @("Zone","DnsName") - } - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck $paramsToCheck -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerBinding/MSFT_SPOfficeOnlineServerBinding.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerBinding/MSFT_SPOfficeOnlineServerBinding.schema.mof deleted file mode 100644 index bdf0cc3e..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerBinding/MSFT_SPOfficeOnlineServerBinding.schema.mof +++ /dev/null @@ -1,20 +0,0 @@ -/* - -**Example** - - SPOfficeOnlineServerBinding OosBinding - { - Zone = "internal-https" - DnsName = "webapps.contoso.com" - Ensure = "Present" - PsDscRunAsCredential = $SetupAccount - } -*/ -[ClassVersion("1.0.0.0"), FriendlyName("SPOfficeOnlineServerBinding")] -class MSFT_SPOfficeOnlineServerBinding : OMI_BaseResource -{ - [Key, Description("The zone for this binding"), ValueMap{"Internal-HTTP","Internal-HTTPS","External-HTTP","External-HTTPS"}, Values{"Internal-HTTP","Internal-HTTPS","External-HTTP","External-HTTPS"}] string Zone; - [Required, Description("The DNS name of the server/s that are running Office Web Apps")] string DnsName; - [Write, Description("Present ensures the binding for this zone exists, absent ensures it doesn't"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPOutgoingEmailSettings/MSFT_SPOutgoingEmailSettings.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPOutgoingEmailSettings/MSFT_SPOutgoingEmailSettings.psm1 deleted file mode 100644 index d4a0fc90..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPOutgoingEmailSettings/MSFT_SPOutgoingEmailSettings.psm1 +++ /dev/null @@ -1,255 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $true)] - [System.String] - $SMTPServer, - - [parameter(Mandatory = $true)] - [System.String] - $FromAddress, - - [parameter(Mandatory = $true)] - [System.String] - $ReplyToAddress, - - [parameter(Mandatory = $true)] - [System.String] - $CharacterSet, - - [parameter(Mandatory = $false)] - [System.Boolean] - $UseTLS, - - [parameter(Mandatory = $false)] - [System.UInt32] - $SMTPPort, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting outgoing email settings configuration for $WebAppUrl" - - $installedVersion = Get-SPDSCInstalledProductVersion - if (($PSBoundParameters.ContainsKey("UseTLS") -eq $true) ` - -and $installedVersion.FileMajorPart -ne 16) - { - throw [Exception] "UseTLS is only supported in SharePoint 2016." - } - - if (($PSBoundParameters.ContainsKey("SMTPPort") -eq $true) ` - -and $installedVersion.FileMajorPart -ne 16) - { - throw [Exception] "SMTPPort is only supported in SharePoint 2016." - } - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - $webApp = Get-SPWebApplication -Identity $params.WebAppUrl ` - -IncludeCentralAdministration ` - -ErrorAction SilentlyContinue - - if ($null -eq $webApp) - { - return $null - } - - $mailServer = $null - if ($null -ne $webApp.OutboundMailServiceInstance) - { - $mailServer = $webApp.OutboundMailServiceInstance.Server.Name - } - - return @{ - WebAppUrl = $webApp.Url - SMTPServer= $mailServer - FromAddress= $webApp.OutboundMailSenderAddress - ReplyToAddress= $webApp.OutboundMailReplyToAddress - CharacterSet = $webApp.OutboundMailCodePage - UseTLS = $webApp.OutboundMailEnableSsl - SMTPPort = $webApp.OutboundMailPort - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $true)] - [System.String] - $SMTPServer, - - [parameter(Mandatory = $true)] - [System.String] - $FromAddress, - - [parameter(Mandatory = $true)] - [System.String] - $ReplyToAddress, - - [parameter(Mandatory = $true)] - [System.String] - $CharacterSet, - - [parameter(Mandatory = $false)] - [System.Boolean] - $UseTLS, - - [parameter(Mandatory = $false)] - [System.UInt32] - $SMTPPort, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting outgoing email settings configuration for $WebAppUrl" - - $installedVersion = Get-SPDSCInstalledProductVersion - if (($PSBoundParameters.ContainsKey("UseTLS") -eq $true) ` - -and $installedVersion.FileMajorPart -lt 16) - { - throw [Exception] "UseTLS is only supported in SharePoint 2016." - } - - if (($PSBoundParameters.ContainsKey("SMTPPort") -eq $true) ` - -and $installedVersion.FileMajorPart -lt 16) - { - throw [Exception] "SMTPPort is only supported in SharePoint 2016." - } - - $null = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - $webApp = $null - - Write-Verbose -Message "Retrieving $($params.WebAppUrl) settings" - - $webApp = Get-SPWebApplication $params.WebAppUrl -IncludeCentralAdministration - if ($null -eq $webApp) - { - throw "Web Application $webAppUrl not found" - } - - $installedVersion = Get-SPDSCInstalledProductVersion - switch ($installedVersion.FileMajorPart) - { - 15 { - $webApp.UpdateMailSettings($params.SMTPServer, ` - $params.FromAddress, ` - $params.ReplyToAddress, ` - $params.CharacterSet) - } - 16 { - if ($params.ContainsKey("UseTLS") -eq $false) - { - $UseTLS = $false - } - else - { - $UseTLS = $params.UseTLS - } - - if ($params.ContainsKey("SMTPPort") -eq $false) - { - $SMTPPort = 25 - } - else - { - $SMTPPort = $params.SMTPPort - } - - $webApp.UpdateMailSettings($params.SMTPServer, ` - $params.FromAddress, ` - $params.ReplyToAddress, ` - $params.CharacterSet, ` - $UseTLS, ` - $SMTPPort) - } - default { - throw ("Detected an unsupported major version of SharePoint. SharePointDsc only " + ` - "supports SharePoint 2013 or 2016.") - } - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $true)] - [System.String] - $SMTPServer, - - [parameter(Mandatory = $true)] - [System.String] - $FromAddress, - - [parameter(Mandatory = $true)] - [System.String] - $ReplyToAddress, - - [parameter(Mandatory = $true)] - [System.String] - $CharacterSet, - - [parameter(Mandatory = $false)] - [System.Boolean] - $UseTLS, - - [parameter(Mandatory = $false)] - [System.UInt32] - $SMTPPort, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting outgoing email settings configuration for $WebAppUrl" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($null -eq $CurrentValues) - { - return $false - } - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("SMTPServer", - "FromAddress", - "ReplyToAddress", - "CharacterSet", - "UseTLS", - "SMTPPort") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPOutgoingEmailSettings/MSFT_SPOutgoingEmailSettings.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPOutgoingEmailSettings/MSFT_SPOutgoingEmailSettings.schema.mof deleted file mode 100644 index 8f3c9376..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPOutgoingEmailSettings/MSFT_SPOutgoingEmailSettings.schema.mof +++ /dev/null @@ -1,13 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPOutgoingEmailSettings")] -class MSFT_SPOutgoingEmailSettings : OMI_BaseResource -{ - [key, Description("The URL of the web application. If you want to set the global settings use the Central Admin URL")] string WebAppUrl; - [Required, Description("The SMTP server for outgoing mail")] string SMTPServer; - [Required, Description("The from address to put on messages")] string FromAddress; - [Required, Description("The email address that replies should be directed to")] string ReplyToAddress; - [Required, Description("The character set to use on messages")] string CharacterSet; - [Write, Description("Use TLS when connecting to the SMTP server (SharePoint 2016 only)")] boolean UseTLS; - [Write, Description("The port which is used to connect to the SMTP server (SharePoint 2016 only)")] uint32 SMTPPort; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPPasswordChangeSettings/MSFT_SPPasswordChangeSettings.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPPasswordChangeSettings/MSFT_SPPasswordChangeSettings.psm1 deleted file mode 100644 index 30d625ff..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPPasswordChangeSettings/MSFT_SPPasswordChangeSettings.psm1 +++ /dev/null @@ -1,159 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $MailAddress, - - [parameter(Mandatory = $false)] - [ValidateRange(0,356)] - [System.UInt32] - $DaysBeforeExpiry, - - [parameter(Mandatory = $false)] - [ValidateRange(0,36000)] - [System.UInt32] - $PasswordChangeWaitTimeSeconds, - - [parameter(Mandatory = $false)] - [ValidateRange(0,99)] - [System.UInt32] - $NumberOfRetries, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting farm wide automatic password change settings" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $farm = Get-SPFarm - if ($null -eq $farm ) - { - return $null - } - return @{ - MailAddress = $farm.PasswordChangeEmailAddress - PasswordChangeWaitTimeSeconds= $farm.PasswordChangeGuardTime - NumberOfRetries= $farm.PasswordChangeMaximumTries - DaysBeforeExpiry = $farm.DaysBeforePasswordExpirationToSendEmail - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $MailAddress, - - [parameter(Mandatory = $false)] - [ValidateRange(0,356)] - [System.UInt32] - $DaysBeforeExpiry, - - [parameter(Mandatory = $false)] - [ValidateRange(0,36000)] - [System.UInt32] - $PasswordChangeWaitTimeSeconds, - - [parameter(Mandatory = $false)] - [ValidateRange(0,99)] - [System.UInt32] - $NumberOfRetries, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting farm wide automatic password change settings" - - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - $farm = Get-SPFarm -ErrorAction Continue - - if ($null -eq $farm ) - { - return $null - } - - $farm.PasswordChangeEmailAddress = $params.MailAddress - if ($null -ne $params.PasswordChangeWaitTimeSeconds) - { - $farm.PasswordChangeGuardTime = $params.PasswordChangeWaitTimeSeconds - } - if ($null -ne $params.NumberOfRetries) - { - $farm.PasswordChangeMaximumTries = $params.NumberOfRetries - } - if ($null -ne $params.DaysBeforeExpiry) - { - $farm.DaysBeforePasswordExpirationToSendEmail = $params.DaysBeforeExpiry - } - $farm.Update(); - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $MailAddress, - - [parameter(Mandatory = $false)] - [ValidateRange(0,356)] - [System.UInt32] - $DaysBeforeExpiry, - - [parameter(Mandatory = $false)] - [ValidateRange(0,36000)] - [System.UInt32] - $PasswordChangeWaitTimeSeconds, - - [parameter(Mandatory = $false)] - [ValidateRange(0,99)] - [System.UInt32] - $NumberOfRetries, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing farm wide automatic password change settings" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($null -eq $CurrentValues) - { - return $false - } - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("MailAddress", - "DaysBeforeExpiry", - "PasswordChangeWaitTimeSeconds", - "NumberOfRetries") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPPasswordChangeSettings/MSFT_SPPasswordChangeSettings.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPPasswordChangeSettings/MSFT_SPPasswordChangeSettings.schema.mof deleted file mode 100644 index fad54d4f..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPPasswordChangeSettings/MSFT_SPPasswordChangeSettings.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPPasswordChangeSettings")] -class MSFT_SPPasswordChangeSettings : OMI_BaseResource -{ - [key, Description("The email address to send notifications of password changes to")] string MailAddress; - [Write, Description("The number of days before password expiry to send send emails")] Uint32 DaysBeforeExpiry; - [Write, Description("The duration that a password reset will wait for before it times out")] Uint32 PasswordChangeWaitTimeSeconds; - [Write, Description("How many retries if the password change fails")] Uint32 NumberOfRetries; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPPerformancePointServiceApp/MSFT_SPPerformancePointServiceApp.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPPerformancePointServiceApp/MSFT_SPPerformancePointServiceApp.psm1 deleted file mode 100644 index 4321a492..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPPerformancePointServiceApp/MSFT_SPPerformancePointServiceApp.psm1 +++ /dev/null @@ -1,256 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $ProxyName, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting for PerformancePoint Service Application '$Name'" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue - $nullReturn = @{ - Name = $params.Name - ApplicationPool = $params.ApplicationPool - Ensure = "Absent" - InstallAccount = $params.InstallAccount - } - if ($null -eq $serviceApps) - { - return $nullReturn - } - $serviceApp = $serviceApps | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.PerformancePoint.Scorecards.BIMonitoringServiceApplication" - } - - if ($null -eq $serviceApp) - { - return $nullReturn - } - else - { - $serviceAppProxies = Get-SPServiceApplicationProxy -ErrorAction SilentlyContinue - if ($null -ne $serviceAppProxies) - { - $serviceAppProxy = $serviceAppProxies | Where-Object -FilterScript { - $serviceApp.IsConnected($_) - } - if ($null -ne $serviceAppProxy) - { - $proxyName = $serviceAppProxy.Name - } - } - return @{ - Name = $serviceApp.DisplayName - ProxyName = $proxyName - ApplicationPool = $serviceApp.ApplicationPool.Name - DatabaseName = $serviceApp.Database.Name - DatabaseServer = $serviceApp.Database.Server.Name - Ensure = "Present" - } - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $ProxyName, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting PerformancePoint Service Application '$Name'" - - $result = Get-TargetResource @PSBoundParameters - - if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") - { - Write-Verbose -Message "Creating PerformancePoint Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $newParams = @{ - Name = $params.Name - ApplicationPool = $params.ApplicationPool - } - if ($params.ContainsKey("DatabaseName") -eq $true) - { - $newParams.Add("DatabaseName", $params.DatabaseName) - } - if ($params.ContainsKey("DatabaseServer") -eq $true) - { - $newParams.Add("DatabaseServer", $params.DatabaseServer) - } - - New-SPPerformancePointServiceApplication @newParams - if ($null -eq $params.ProxyName) - { - $pName = "$($params.Name) Proxy" - } - else - { - $pName = $params.ProxyName - } - New-SPPerformancePointServiceApplicationProxy -Name $pName ` - -ServiceApplication $params.Name ` - -Default - } - } - - if ($result.Ensure -eq "Present" -and $Ensure -eq "Present") - { - if ($ApplicationPool -ne $result.ApplicationPool) - { - Write-Verbose -Message "Updating PerformancePoint Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool - - Get-SPServiceApplication -Name $params.Name ` - | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.PerformancePoint.Scorecards.BIMonitoringServiceApplication" - } | Set-SPPerformancePointServiceApplication -ApplicationPool $appPool - } - } - } - if ($Ensure -eq "Absent") - { - Write-Verbose -Message "Removing PerformancePoint Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $app = Get-SPServiceApplication -Name $params.Name | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.PerformancePoint.Scorecards.BIMonitoringServiceApplication" - } - - $proxies = Get-SPServiceApplicationProxy - foreach($proxyInstance in $proxies) - { - if($app.IsConnected($proxyInstance)) - { - $proxyInstance.Delete() - } - } - - Remove-SPServiceApplication -Identity $app -Confirm:$false - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $ProxyName, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing PerformancePoint Service Application '$Name'" - - $PSBoundParameters.Ensure = $Ensure - - $CurrentValues = Get-TargetResource @PSBoundParameters - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ApplicationPool", "Ensure") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPPerformancePointServiceApp/MSFT_SPPerformancePointServiceApp.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPPerformancePointServiceApp/MSFT_SPPerformancePointServiceApp.schema.mof deleted file mode 100644 index 3c0cb179..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPPerformancePointServiceApp/MSFT_SPPerformancePointServiceApp.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPPerformancePointServiceApp")] -class MSFT_SPPerformancePointServiceApp : OMI_BaseResource -{ - [Key, Description("The name of the service application")] string Name; - [Write, Description("The proxy name, if not specified will be /Name of service app/ Proxy")] string ProxyName; - [Required, Description("The name of the application pool to run the service app in")] string ApplicationPool; - [Write, Description("The name of the database for the service app")] string DatabaseName; - [Write, Description("The name of the database server to host the database")] string DatabaseServer; - [Write, Description("Present ensures service app exists, absent ensures it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPPowerPointAutomationServiceApp/MSFT_SPPowerPointAutomationServiceApp.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPPowerPointAutomationServiceApp/MSFT_SPPowerPointAutomationServiceApp.psm1 deleted file mode 100644 index ade4557e..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPPowerPointAutomationServiceApp/MSFT_SPPowerPointAutomationServiceApp.psm1 +++ /dev/null @@ -1,390 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [System.String] - $ProxyName, - - [System.String] - $ApplicationPool, - - [System.UInt32] - $CacheExpirationPeriodInSeconds, - - [System.UInt32] - $MaximumConversionsPerWorker, - - [System.UInt32] - $WorkerKeepAliveTimeoutInSeconds, - - [System.UInt32] - $WorkerProcessCount, - - [System.UInt32] - $WorkerTimeoutInSeconds, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting PowerPoint Automation service app '$Name'" - - if(($ApplicationPool ` - -or $ProxyName ` - -or $CacheExpirationPeriodInSeconds ` - -or $MaximumConversionsPerWorker ` - -or $WorkerKeepAliveTimeoutInSeconds ` - -or $WorkerProcessCount ` - -or $WorkerTimeoutInSeconds) -and ($Ensure -eq "Absent")) - { - throw "You cannot use any of the parameters when Ensure is specified as Absent" - } - if (($Ensure -eq "Present") -and -not $ApplicationPool) - { - throw ("An Application Pool is required to configure the PowerPoint " + ` - "Automation Service Application") - } - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - $serviceApps = Get-SPServiceApplication -Name $params.Name ` - -ErrorAction SilentlyContinue - $nullReturn = @{ - Name = $params.Name - Ensure = "Absent" - ApplicationPool = $params.ApplicationPool - } - - if ($null -eq $serviceApps) - { - return $nullReturn - } - - $serviceApp = $serviceApps | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Server.PowerPoint.Administration.PowerPointConversionServiceApplication" - } - - if ($null -eq $serviceApp) - { - return $nullReturn - } - - $proxyName = "" - $serviceAppProxies = Get-SPServiceApplicationProxy -ErrorAction SilentlyContinue - if ($null -ne $serviceAppProxies) - { - $serviceAppProxy = $serviceAppProxies | Where-Object -FilterScript { - $serviceApp.IsConnected($_) - } - if ($null -ne $serviceAppProxy) - { - $proxyName = $serviceAppProxy.Name - } - } - - $returnVal = @{ - Name = $serviceApp.DisplayName - ProxyName = $proxyName - ApplicationPool = $serviceApp.ApplicationPool.Name - CacheExpirationPeriodInSeconds = $serviceApp.CacheExpirationPeriodInSeconds - MaximumConversionsPerWorker = $serviceApp.MaximumConversionsPerWorker - WorkerKeepAliveTimeoutInSeconds = $serviceApp.WorkerKeepAliveTimeoutInSeconds - WorkerProcessCount = $serviceApp.WorkerProcessCount - WorkerTimeoutInSeconds = $serviceApp.WorkerTimeoutInSeconds - Ensure = "Present" - InstallAccount = $params.InstallAccount - - } - return $returnVal - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [System.String] - $ProxyName, - - [System.String] - $ApplicationPool, - - [System.UInt32] - $CacheExpirationPeriodInSeconds, - - [System.UInt32] - $MaximumConversionsPerWorker, - - [System.UInt32] - $WorkerKeepAliveTimeoutInSeconds, - - [System.UInt32] - $WorkerProcessCount, - - [System.UInt32] - $WorkerTimeoutInSeconds, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting PowerPoint Automation service app '$Name'" - - if(($ApplicationPool ` - -or $ProxyName ` - -or $CacheExpirationPeriodInSeconds ` - -or $MaximumConversionsPerWorker ` - -or $WorkerKeepAliveTimeoutInSeconds ` - -or $WorkerProcessCount ` - -or $WorkerTimeoutInSeconds) -and ($Ensure -eq "Absent")) - { - throw "You cannot use any of the parameters when Ensure is specified as Absent" - } - if (($Ensure -eq "Present") -and -not $ApplicationPool) - { - throw ("An Application Pool is required to configure the PowerPoint " + ` - "Automation Service Application") - } - - $result = Get-TargetResource @PSBoundParameters - if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") - { - Write-Verbose -Message "Creating PowerPoint Automation Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $proxyName = $params.ProxyName - if($null -eq $proxyName) - { - $proxyName = "$($params.Name) Proxy" - } - - $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool - if($appPool) - { - $serviceApp = New-SPPowerPointConversionServiceApplication -Name $params.Name -ApplicationPool $params.ApplicationPool - $serviceAppProxy = New-SPPowerPointConversionServiceApplicationProxy -name $proxyName -ServiceApplication $serviceApp - - if($null -ne $params.CacheExpirationPeriodInSeconds) - { - $serviceApp.CacheExpirationPeriodInSeconds = $params.CacheExpirationPeriodInSeconds - } - if($null -ne $params.MaximumConversionsPerWorker) - { - $serviceApp.MaximumConversionsPerWorker = $params.MaximumConversionsPerWorker - } - if($null -ne $params.WorkerKeepAliveTimeoutInSeconds) - { - $serviceApp.WorkerKeepAliveTimeoutInSeconds = $params.WorkerKeepAliveTimeoutInSeconds - } - if($null -ne $params.WorkerProcessCount) - { - $serviceApp.WorkerProcessCount = $params.WorkerProcessCount - } - if($null -ne $params.WorkerTimeoutInSeconds) - { - $serviceApp.WorkerTimeoutInSeconds = $params.WorkerTimeoutInSeconds - } - $serviceApp.Update(); - } - else - { - throw "Specified application pool does not exist" - } - } - } - if ($result.Ensure -eq "Present" -and $Ensure -eq "Present") - { - Write-Verbose -Message "Updating PowerPoint Automation Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters, $result ` - -ScriptBlock { - $params = $args[0] - $result = $args[1] - - $serviceApps = Get-SPServiceApplication -Name $params.Name ` - -ErrorAction SilentlyContinue - if($null -eq $serviceApps) - { - throw "No Service applications are available in the farm." - } - $serviceApp = $serviceApps ` - | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Server.PowerPoint.Administration.PowerPointConversionServiceApplication" - } - if($null -eq $serviceApp) - { - throw "Unable to find specified service application." - } - if ([string]::IsNullOrEmpty($params.ApplicationPool) -eq $false ` - -and $params.ApplicationPool -ne $result.ApplicationPool) - { - $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool - if($null -eq $appPool) - { - throw "The specified App Pool does not exist" - } - $serviceApp.ApplicationPool = $appPool - } - if([string]::IsNullOrEmpty($params.ProxyName) -eq $false ` - -and $params.ProxyName -ne $result.ProxyName) - { - $proxies = Get-SPServiceApplicationProxy - foreach($proxyInstance in $proxies) - { - if($serviceApp.IsConnected($proxyInstance)) - { - $proxyInstance.Delete() - } - } - $serviceAppProxy = New-SPPowerPointConversionServiceApplicationProxy -Name $params.proxyName -ServiceApplication $serviceApp - } - if($null -ne $params.CacheExpirationPeriodInSeconds) - { - $serviceApp.CacheExpirationPeriodInSeconds = $params.CacheExpirationPeriodInSeconds - } - if($null -ne $params.MaximumConversionsPerWorker) - { - $serviceApp.MaximumConversionsPerWorker = $params.MaximumConversionsPerWorker - } - if($null -ne $params.WorkerKeepAliveTimeoutInSeconds) - { - $serviceApp.WorkerKeepAliveTimeoutInSeconds = $params.WorkerKeepAliveTimeoutInSeconds - } - if($null -ne $params.WorkerProcessCount) - { - $serviceApp.WorkerProcessCount = $params.WorkerProcessCount - } - if($null -ne $params.WorkerTimeoutInSeconds) - { - $serviceApp.WorkerTimeoutInSeconds = $params.WorkerTimeoutInSeconds - } - $serviceApp.Update(); - } - } - if($Ensure -eq "Absent") - { - Write-Verbose -Message "Removing PowerPoint Automation Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - $params = $args[0] - - $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue - if($null -eq $serviceApps) - { - return; - } - $serviceApp = $serviceApps | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Server.PowerPoint.Administration.PowerPointConversionServiceApplication" - } - if ($null -ne $serviceApp) - { - $proxies = Get-SPServiceApplicationProxy - foreach($proxyInstance in $proxies) - { - if($serviceApp.IsConnected($proxyInstance)) - { - $proxyInstance.Delete() - } - } - Remove-SPServiceApplication -Identity $serviceApp -Confirm:$false - } - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [System.String] - $ProxyName, - - [System.String] - $ApplicationPool, - - [System.UInt32] - $CacheExpirationPeriodInSeconds, - - [System.UInt32] - $MaximumConversionsPerWorker, - - [System.UInt32] - $WorkerKeepAliveTimeoutInSeconds, - - [System.UInt32] - $WorkerProcessCount, - - [System.UInt32] - $WorkerTimeoutInSeconds, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing PowerPoint Automation service app '$Name'" - if(($ApplicationPool ` - -or $ProxyName ` - -or $CacheExpirationPeriodInSeconds ` - -or $MaximumConversionsPerWorker ` - -or $WorkerKeepAliveTimeoutInSeconds ` - -or $WorkerProcessCount ` - -or $WorkerTimeoutInSeconds) -and ($Ensure -eq "Absent")) - { - throw "You cannot use any of the parameters when Ensure is specified as Absent" - } - if (($Ensure -eq "Present") -and -not $ApplicationPool) - { - throw ("An Application Pool is required to configure the PowerPoint " + ` - "Automation Service Application") - } - $CurrentValues = Get-TargetResource @PSBoundParameters - - if($Ensure -eq "Absent") - { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") - } - else - { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPPowerPointAutomationServiceApp/MSFT_SPPowerPointAutomationServiceApp.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPPowerPointAutomationServiceApp/MSFT_SPPowerPointAutomationServiceApp.schema.mof deleted file mode 100644 index 275d6d54..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPPowerPointAutomationServiceApp/MSFT_SPPowerPointAutomationServiceApp.schema.mof +++ /dev/null @@ -1,14 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPPowerPointAutomationServiceApp")] -class MSFT_SPPowerPointAutomationServiceApp : OMI_BaseResource -{ - [Key, Description("The name of the service application")] String Name; - [Write, Description("The name of the service application proxy")] String ProxyName; - [Write, Description("The name of the application pool to run the service app in")] String ApplicationPool; - [Write, Description("Specifies the maximum time, in seconds, that items remain in the back-end server cache. The default value is 600 seconds (10 minutes).")] Uint32 CacheExpirationPeriodInSeconds; - [Write, Description("Specifies the maximum number of presentations that a conversion worker process can convert before recycling. The default value is 5.")] Uint32 MaximumConversionsPerWorker; - [Write, Description("Specifies the maximum time, in seconds, that a conversion worker process can be unresponsive before being terminated. The default value is 120 seconds.")] Uint32 WorkerKeepAliveTimeoutInSeconds; - [Write, Description("Specifies the number of active instances of the conversion worker process on each back-end. This value must be less than the Windows Communication Foundation (WCF) connection limit for this computer. The default value is 3.")] Uint32 WorkerProcessCount; - [Write, Description("Specifies the maximum time, in seconds, that a conversion worker process is given for any single conversion. The default is 300 seconds (5 minutes).")] Uint32 WorkerTimeoutInSeconds; - [Write, Description("Ensure the crawl rule is Present or Absent"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, EmbeddedInstance("MSFT_Credential"), Description("POWERSHELL 4 ONLY: The account to run thsi resource as, use PsDscRunAsCredential if using PowerShell 5")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPProductUpdate/MSFT_SPProductUpdate.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPProductUpdate/MSFT_SPProductUpdate.psm1 deleted file mode 100644 index ba57f5d6..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPProductUpdate/MSFT_SPProductUpdate.psm1 +++ /dev/null @@ -1,545 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $SetupFile, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ShutdownServices, - - [parameter(Mandatory = $false)] - [ValidateSet("mon","tue","wed","thu","fri","sat","sun")] - [System.String[]] - $BinaryInstallDays, - - [parameter(Mandatory = $false)] - [System.String] - $BinaryInstallTime, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - if ($Ensure -eq "Absent") - { - throw [Exception] "SharePoint does not support uninstalling updates." - return - } - - Write-Verbose -Message "Getting install status of SP binaries" - - $languagepack = $false - $servicepack = $false - $language = "" - - # Get file information from setup file - if (-not(Test-Path $SetupFile)) - { - throw "Setup file cannot be found." - } - - Write-Verbose -Message "Checking file status of $SetupFile" - $zone = Get-Item -Path $SetupFile -Stream "Zone.Identifier" -EA SilentlyContinue - - if ($null -ne $zone) - { - throw ("Setup file is blocked! Please use Unblock-File to unblock the file " + ` - "before continuing.") - } - - $setupFileInfo = Get-ItemProperty -Path $SetupFile - $fileVersion = $setupFileInfo.VersionInfo.FileVersion - Write-Verbose -Message "Update has version $fileVersion" - - $products = Invoke-SPDSCCommand -Credential $InstallAccount -ScriptBlock { - return Get-SPDscFarmProductsInfo - } - - if ($setupFileInfo.VersionInfo.FileDescription -match "Language Pack") - { - Write-Verbose -Message "Update is a Language Pack Service Pack." - # Retrieve language from file and check version for that language pack. - $languagepack = $true - - # Extract language from filename - if ($setupFileInfo.Name -match "\w*-(\w{2}-\w{2}).exe") - { - $language = $matches[1] - } - else - { - throw "Update does not contain the language code in the correct format." - } - - try - { - $cultureInfo = New-Object -TypeName System.Globalization.CultureInfo -ArgumentList $language - } - catch - { - throw "Error while converting language information: $language" - } - - # try/catch is required for some versions of Windows, other version use the LCID value of 4096 - if ($cultureInfo.LCID -eq 4096) - { - throw "Error while converting language information: $language" - } - - # Extract English name of the language code - if ($cultureInfo.EnglishName -match "(\w*,*\s*\w*) \(\w*\)") - { - $languageEnglish = $matches[1] - if ($languageEnglish.contains(",")) - { - $languages = $languageEnglish.Split(",") - $languageEnglish = $languages[0] - } - } - - # Extract Native name of the language code - if ($cultureInfo.NativeName -match "(\w*,*\s*\w*) \(\w*\)") - { - $languageNative = $matches[1] - if ($languageNative.contains(",")) - { - $languages = $languageNative.Split(",") - $languageNative = $languages[0] - } - } - - # Build language string used in Language Pack names - $languageString = "$languageEnglish/$languageNative" - Write-Verbose -Message "Update is for the $languageEnglish language" - - # Find the product name for the specific language pack - $productName = "" - foreach ($product in $products) - { - if ($product -match $languageString) - { - $productName = $product - } - } - - if ($productName -eq "") - { - throw "Error: Product for language $language is not found." - } - else - { - Write-Verbose -Message "Product found: $productName" - } - $versionInfo = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $productName ` - -ScriptBlock { - $productToCheck = $args[0] - return Get-SPDscFarmVersionInfo -ProductToCheck $productToCheck - } - } - elseif ($setupFileInfo.VersionInfo.FileDescription -match "Service Pack") - { - Write-Verbose -Message "Update is a Service Pack for SharePoint." - # Check SharePoint version information. - $servicepack = $true - $versionInfo = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $productName ` - -ScriptBlock { - $productToCheck = $args[0] - return Get-SPDscFarmVersionInfo -ProductToCheck "Microsoft SharePoint Server 2013" - } - } - else - { - Write-Verbose -Message "Update is a Cumulative Update." - # Cumulative Update is multi-lingual. Check version information of all products. - $versionInfo = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $productName ` - -ScriptBlock { - $productToCheck = $args[0] - return Get-SPDscFarmVersionInfo - } - } - - Write-Verbose -Message "The lowest version of any SharePoint component is $($versionInfo.Lowest)" - if ($versionInfo.Lowest -lt $fileVersion) - { - # Version of SharePoint is lower than the patch version. Patch is not installed. - return @{ - SetupFile = $SetupFile - ShutdownServices = $ShutdownServices - BinaryInstallDays = $BinaryInstallDays - BinaryInstallTime = $BinaryInstallTime - Ensure = "Absent" - } - } - else - { - # Version of SharePoint is equal or greater than the patch version. Patch is installed. - return @{ - SetupFile = $SetupFile - ShutdownServices = $ShutdownServices - BinaryInstallDays = $BinaryInstallDays - BinaryInstallTime = $BinaryInstallTime - Ensure = "Present" - } - } -} - -function Set-TargetResource -{ - # Supressing the global variable use to allow passing DSC the reboot message - [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidGlobalVars", "")] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $SetupFile, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ShutdownServices, - - [parameter(Mandatory = $false)] - [ValidateSet("mon","tue","wed","thu","fri","sat","sun")] - [System.String[]] - $BinaryInstallDays, - - [parameter(Mandatory = $false)] - [System.String] - $BinaryInstallTime, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting install status of SP Update binaries" - - if ($Ensure -eq "Absent") - { - throw [Exception] "SharePoint does not support uninstalling updates." - return - } - - # Check if setup file exists - if (-not(Test-Path $SetupFile)) - { - throw "Setup file cannot be found." - } - - Write-Verbose -Message "Checking file status of $SetupFile" - $zone = Get-Item $SetupFile -Stream "Zone.Identifier" -EA SilentlyContinue - - if ($null -ne $zone) - { - throw ("Setup file is blocked! Please use Unblock-File to unblock the file " + ` - "before continuing.") - } - - $now = Get-Date - if ($BinaryInstallDays) - { - # BinaryInstallDays parameter exists, check if current day is specified - $currentDayOfWeek = $now.DayOfWeek.ToString().ToLower().Substring(0,3) - - if ($BinaryInstallDays -contains $currentDayOfWeek) - { - Write-Verbose -Message ("Current day is present in the parameter BinaryInstallDays. " + ` - "Update can be run today.") - } - else - { - Write-Verbose -Message ("Current day is not present in the parameter BinaryInstallDays, " + ` - "skipping the update") - return - } - } - else - { - Write-Verbose -Message "No BinaryInstallDays specified, Update can be ran on any day." - } - - # Check if BinaryInstallTime parameter exists - if ($BinaryInstallTime) - { - # Check if current time is inside of time window - $upgradeTimes = $BinaryInstallTime.Split(" ") - $starttime = 0 - $endtime = 0 - - if ($upgradeTimes.Count -ne 3) - { - throw "Time window incorrectly formatted." - } - else - { - if ([datetime]::TryParse($upgradeTimes[0],[ref]$starttime) -ne $true) - { - throw "Error converting start time" - } - - if ([datetime]::TryParse($upgradeTimes[2],[ref]$endtime) -ne $true) - { - throw "Error converting end time" - } - - if ($starttime -gt $endtime) - { - throw "Error: Start time cannot be larger than end time" - } - } - - if (($starttime -lt $now) -and ($endtime -gt $now)) - { - Write-Verbose -Message ("Current time is inside of the window specified in " + ` - "BinaryInstallTime. Starting update") - } - else - { - Write-Verbose -Message ("Current time is outside of the window specified in " + ` - "BinaryInstallTime, skipping the update") - return - } - } - else - { - Write-Verbose -Message ("No BinaryInstallTime specified, Update can be ran at " + ` - "any time. Starting update.") - } - - # To prevent an endless loop: Check if an upgrade is required. - if ((Get-SPDSCInstalledProductVersion).FileMajorPart -eq 15) - { - $wssRegKey ="hklm:SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\15.0\WSS" - } - else - { - $wssRegKey ="hklm:SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\16.0\WSS" - } - - # Read LanguagePackInstalled and SetupType registry keys - $languagePackInstalled = Get-SPDSCRegistryKey -Key $wssRegKey -Value "LanguagePackInstalled" - $setupType = Get-SPDSCRegistryKey -Key $wssRegKey -Value "SetupType" - - # Determine if LanguagePackInstalled=1 or SetupType=B2B_Upgrade. - # If so, the Config Wizard is required, so the installation will be skipped. - if (($languagePackInstalled -eq 1) -or ($setupType -eq "B2B_UPGRADE")) - { - Write-Verbose -Message ("An upgrade is pending. " + ` - "To prevent a possible loop, the install will be skipped") - return - } - - if ($ShutdownServices) - { - Write-Verbose -Message "Stopping services to speed up installation process" - - $searchPaused = $false - $osearchStopped = $false - $hostControllerStopped = $false - - if ((Get-SPDSCInstalledProductVersion).FileMajorPart -eq 15) - { - $searchServiceName = "OSearch15" - } - else - { - $searchServiceName = "OSearch16" - } - - $osearchSvc = Get-Service -Name $searchServiceName - $hostControllerSvc = Get-Service -Name "SPSearchHostController" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -ScriptBlock { - $searchPaused = $true - $searchSAs = Get-SPEnterpriseSearchServiceApplication - foreach ($searchSA in $searchSAs) - { - $searchSA.Pause() - } - } - - if($osearchSvc.Status -eq "Running") - { - $osearchStopped = $true - Set-Service -Name $searchServiceName -StartupType Disabled - $osearchSvc.Stop() - } - - if($hostControllerSvc.Status -eq "Running") - { - $hostControllerStopped = $true - Set-Service "SPSearchHostController" -StartupType Disabled - $hostControllerSvc.Stop() - } - - $hostControllerSvc.WaitForStatus('Stopped','00:01:00') - - Write-Verbose -Message "Search Services are stopped" - - Write-Verbose -Message "Stopping other services" - - Set-Service -Name "IISADMIN" -StartupType Disabled - Set-Service -Name "SPTimerV4" -StartupType Disabled - - $iisreset = Start-Process -FilePath "iisreset.exe" ` - -ArgumentList "-stop -noforce" ` - -Wait ` - -PassThru - - $timerSvc = Get-Service -Name "SPTimerV4" - if($timerSvc.Status -eq "Running") - { - $timerSvc.Stop() - } - } - - Write-Verbose -Message "Beginning installation of the SharePoint update" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $SetupFile ` - -ScriptBlock { - $setupFile = $args[0] - - $setup = Start-Process -FilePath $setupFile ` - -ArgumentList "/quiet /passive" ` - -Wait ` - -PassThru - - # Error codes: https://aka.ms/installerrorcodes - switch ($setup.ExitCode) { - 0 - { - Write-Verbose -Message "SharePoint update binary installation complete." - } - 17022 - { - Write-Verbose -Message ("SharePoint update binary installation complete, " + ` - "however a reboot is required.") - $global:DSCMachineStatus = 1 - } - Default - { - throw ("SharePoint update install failed, exit code was $($setup.ExitCode). " + ` - "Error codes can be found at https://aka.ms/installerrorcodes") - } - } - } - - if ($ShutdownServices) - { - Write-Verbose -Message "Restart stopped services" - Set-Service -Name "SPTimerV4" -StartupType Automatic - Set-Service -Name "IISADMIN" -StartupType Automatic - - $timerSvc = Get-Service -Name "SPTimerV4" - $timerSvc.Start() - - $iisreset = Start-Process -FilePath "iisreset.exe" ` - -ArgumentList "-start" ` - -Wait ` - -PassThru - - $osearchSvc = Get-Service -Name $searchServiceName - $hostControllerSvc = Get-Service -Name "SPSearchHostController" - - # Ensuring Search Services were stopped by script before Starting" - if($osearchStopped -eq $true) - { - Set-Service -Name $searchServiceName -StartupType Manual - $osearchSvc.Start() - } - - if($hostControllerStopped -eq $true) - { - Set-Service "SPSearchHostController" -StartupType Automatic - $hostControllerSvc.Start() - } - - # Resuming Search Service Application if paused### - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -ScriptBlock { - if($searchPaused -eq $true) - { - $searchSAs = Get-SPEnterpriseSearchServiceApplication - foreach ($searchSA in $searchSAs) - { - $searchSA.Resume() - } - } - } - - Write-Verbose -Message "Services restarted." - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $SetupFile, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ShutdownServices, - - [parameter(Mandatory = $false)] - [ValidateSet("mon","tue","wed","thu","fri","sat","sun")] - [System.String[]] - $BinaryInstallDays, - - [parameter(Mandatory = $false)] - [System.String] - $BinaryInstallTime, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing install status of SP Update binaries" - - $PSBoundParameters.Ensure = $Ensure - - if ($Ensure -eq "Absent") - { - throw [Exception] "SharePoint does not support uninstalling updates." - return - } - - $CurrentValues = Get-TargetResource @PSBoundParameters - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPProductUpdate/MSFT_SPProductUpdate.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPProductUpdate/MSFT_SPProductUpdate.schema.mof deleted file mode 100644 index 6ef8eb62..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPProductUpdate/MSFT_SPProductUpdate.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPProductUpdate")] -class MSFT_SPProductUpdate : OMI_BaseResource -{ - [Key, Description("The name of the update setup file")] String SetupFile; - [Write, Description("Shutdown SharePoint services to speed up installation")] Boolean ShutdownServices; - [Write, Description("Specify on which dates the installation is allowed"), ValueMap{"mon","tue","wed","thu","fri","sat","sun"}, Values{"mon","tue","wed","thu","fri","sat","sun"}] String BinaryInstallDays[]; - [Write, Description("Specify in which time frame the installation is allowed")] String BinaryInstallTime; - [Write, Description("Present to install SharePoint. Absent is currently not supported"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPPublishServiceApplication/MSFT_SPPublishServiceApplication.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPPublishServiceApplication/MSFT_SPPublishServiceApplication.psm1 deleted file mode 100644 index 0eca1a5c..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPPublishServiceApplication/MSFT_SPPublishServiceApplication.psm1 +++ /dev/null @@ -1,146 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present" - ) - - Write-Verbose -Message "Getting service application publish status '$Name'" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue - - if ($null -eq $serviceApp) - { - Write-Verbose -Message "The service application $Name does not exist" - $sharedEnsure = "Absent" - } - - if ($null -eq $serviceApp.Uri) - { - Write-Verbose -Message ("Only Business Data Connectivity, Machine Translation, Managed Metadata, " + ` - "User Profile, Search, Secure Store are supported to be published via DSC.") - $sharedEnsure = "Absent" - } - else - { - if ($serviceApp.Shared -eq $true) - { - $sharedEnsure = "Present" - } - elseif ($serviceApp.Shared -eq $false) - { - $sharedEnsure = "Absent" - } - } - - return @{ - Name = $params.Name - Ensure = $sharedEnsure - InstallAccount = $params.InstallAccount - } - } - return $result -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present" - ) - - Write-Verbose -Message "Setting service application publish status '$Name'" - - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue - if ($null -eq $serviceApp) - { - throw [Exception] ("The service application $Name does not exist") - } - - if ($null -eq $serviceApp.Uri) - { - throw [Exception] ("Only Business Data Connectivity, Machine Translation, Managed Metadata, " + ` - "User Profile, Search, Secure Store are supported to be published via DSC.") - } - - if ($Ensure -eq "Present") - { - Write-Verbose -Message "Publishing Service Application $Name" - Publish-SPServiceApplication -Identity $serviceApp - } - - if ($Ensure -eq "Absent") - { - Write-Verbose -Message "Unpublishing Service Application $Name" - Unpublish-SPServiceApplication -Identity $serviceApp - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present" - ) - - Write-Verbose -Message "Testing service application '$Name'" - - $currentValues = Get-TargetResource @PSBoundParameters - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Name", "Ensure") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPPublishServiceApplication/MSFT_SPPublishServiceApplication.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPPublishServiceApplication/MSFT_SPPublishServiceApplication.schema.mof deleted file mode 100644 index 791dfe58..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPPublishServiceApplication/MSFT_SPPublishServiceApplication.schema.mof +++ /dev/null @@ -1,7 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPPublishServiceApplication")] -class MSFT_SPPublishServiceApplication : OMI_BaseResource -{ - [Key, Description("The name of the service application to publish")] string Name; - [Write, Description("Present to ensure it runs on this server, or absent to ensure it is stopped"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPQuotaTemplate/MSFT_SPQuotaTemplate.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPQuotaTemplate/MSFT_SPQuotaTemplate.psm1 deleted file mode 100644 index 124e29da..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPQuotaTemplate/MSFT_SPQuotaTemplate.psm1 +++ /dev/null @@ -1,351 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.UInt32] - $StorageMaxInMB, - - [parameter(Mandatory = $false)] - [System.UInt32] - $StorageWarningInMB, - - [parameter(Mandatory = $false)] - [System.UInt32] - $MaximumUsagePointsSolutions, - - [parameter(Mandatory = $false)] - [System.UInt32] - $WarningUsagePointsSolutions, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting Quota Template settings for quota $Name" - - if ($StorageMaxInMB -lt $StorageWarningInMB) - { - Throw "StorageMaxInMB must be equal to or larger than StorageWarningInMB." - } - - if ($MaximumUsagePointsSolutions -lt $WarningUsagePointsSolutions) - { - Throw ("MaximumUsagePointsSolutions must be equal to or larger than " + ` - "WarningUsagePointsSolutions.") - } - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - try - { - $spFarm = Get-SPFarm - } - catch - { - Write-Verbose -Message ("No local SharePoint farm was detected. Quota " + ` - "template settings will not be applied") - return @{ - Name = $params.Name - StorageMaxInMB = 0 - StorageWarningInMB = 0 - MaximumUsagePointsSolutions = 0 - WarningUsagePointsSolutions = 0 - Ensure = "Absent" - InstallAccount = $params.InstallAccount - } - } - - # Get a reference to the Administration WebService - $admService = Get-SPDSCContentService - - $template = $admService.QuotaTemplates[$params.Name] - if ($null -eq $template) - { - return @{ - Name = $params.Name - Ensure = "Absent" - InstallAccount = $params.InstallAccount - } - } - else - { - return @{ - Name = $params.Name - # Convert from bytes to megabytes - StorageMaxInMB = ($template.StorageMaximumLevel / 1MB) - # Convert from bytes to megabytes - StorageWarningInMB = ($template.StorageWarningLevel / 1MB) - MaximumUsagePointsSolutions = $template.UserCodeMaximumLevel - WarningUsagePointsSolutions = $template.UserCodeWarningLevel - Ensure = "Present" - InstallAccount = $params.InstallAccount - } - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.UInt32] - $StorageMaxInMB, - - [parameter(Mandatory = $false)] - [System.UInt32] - $StorageWarningInMB, - - [parameter(Mandatory = $false)] - [System.UInt32] - $MaximumUsagePointsSolutions, - - [parameter(Mandatory = $false)] - [System.UInt32] - $WarningUsagePointsSolutions, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting Quota Template settings for quota $Name" - - if ($StorageMaxInMB -lt $StorageWarningInMB) - { - Throw "StorageMaxInMB must be equal to or larger than StorageWarningInMB." - } - - if ($MaximumUsagePointsSolutions -lt $WarningUsagePointsSolutions) - { - Throw ("MaximumUsagePointsSolutions must be equal to or larger than " + ` - "WarningUsagePointsSolutions.") - } - - switch ($Ensure) - { - "Present" { - Write-Verbose "Ensure is set to Present - Add or update template" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - try - { - $spFarm = Get-SPFarm - } - catch - { - throw ("No local SharePoint farm was detected. Quota " + ` - "template settings will not be applied") - return - } - - Write-Verbose -Message "Start update" - # Get a reference to the Administration WebService - $admService = Get-SPDSCContentService - - $template = $admService.QuotaTemplates[$params.Name] - - if ($null -eq $template) - { - #Template does not exist, create new template - $newTemplate = New-Object Microsoft.SharePoint.Administration.SPQuotaTemplate - $newTemplate.Name = $params.Name - if ($params.ContainsKey("StorageMaxInMB")) - { - $newTemplate.StorageMaximumLevel = ($params.StorageMaxInMB * 1MB) - } - if ($params.ContainsKey("StorageWarningInMB")) - { - $newTemplate.StorageWarningLevel = ($params.StorageWarningInMB * 1MB) - } - if ($params.ContainsKey("MaximumUsagePointsSolutions")) - { - $newTemplate.UserCodeMaximumLevel = $params.MaximumUsagePointsSolutions - } - if ($params.ContainsKey("WarningUsagePointsSolutions")) - { - $newTemplate.UserCodeWarningLevel = $params.WarningUsagePointsSolutions - } - $admService.QuotaTemplates.Add($newTemplate) - $admService.Update() - } - else - { - #Template exists, update settings - if ($params.ContainsKey("StorageMaxInMB")) - { - $template.StorageMaximumLevel = ($params.StorageMaxInMB * 1MB) - } - if ($params.ContainsKey("StorageWarningInMB")) - { - $template.StorageWarningLevel = ($params.StorageWarningInMB * 1MB) - } - if ($params.ContainsKey("MaximumUsagePointsSolutions")) - { - $template.UserCodeMaximumLevel = $params.MaximumUsagePointsSolutions - } - if ($params.ContainsKey("WarningUsagePointsSolutions")) - { - $template.UserCodeWarningLevel = $params.WarningUsagePointsSolutions - } - $admService.Update() - } - } - } - "Absent" { - Write-Verbose "Ensure is set to Absent - Removing template" - - if ($StorageMaxInMB ` - -or $StorageWarningInMB ` - -or $MaximumUsagePointsSolutions ` - -or $WarningUsagePointsSolutions) - { - Throw ("Do not use StorageMaxInMB, StorageWarningInMB, " + ` - "MaximumUsagePointsSolutions or WarningUsagePointsSolutions " + ` - "when Ensure is specified as Absent") - } - - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - try - { - $spFarm = Get-SPFarm - } - catch - { - Write-Verbose -Message ("No local SharePoint farm was detected. Quota " + ` - "template settings will not be applied") - return - } - - Write-Verbose -Message "Start update" - # Get a reference to the Administration WebService - $admService = Get-SPDSCContentService - - # Delete template, function does not throw an error when the template does not - # exist. So safe to call without error handling. - $admService.QuotaTemplates.Delete($params.Name) - } - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.UInt32] - $StorageMaxInMB, - - [parameter(Mandatory = $false)] - [System.UInt32] - $StorageWarningInMB, - - [parameter(Mandatory = $false)] - [System.UInt32] - $MaximumUsagePointsSolutions, - - [parameter(Mandatory = $false)] - [System.UInt32] - $WarningUsagePointsSolutions, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing Quota Template settings for quota $Name" - - if ($StorageMaxInMB -lt $StorageWarningInMB) - { - Throw "StorageMaxInMB must be equal to or larger than StorageWarningInMB." - } - - if ($MaximumUsagePointsSolutions -lt $WarningUsagePointsSolutions) - { - Throw ("MaximumUsagePointsSolutions must be equal to or larger than " + ` - "WarningUsagePointsSolutions.") - } - - switch ($Ensure) - { - "Present" { - $CurrentValues = Get-TargetResource @PSBoundParameters - if ($CurrentValues.Ensure -eq "Absent") - { - return $false - } - return Test-SPDscParameterState -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters - } - "Absent" { - if ($StorageMaxInMB ` - -or $StorageWarningInMB ` - -or $MaximumUsagePointsSolutions ` - -or $WarningUsagePointsSolutions) - { - Throw ("Do not use StorageMaxInMB, StorageWarningInMB, " + ` - "MaximumUsagePointsSolutions or WarningUsagePointsSolutions " + ` - "when Ensure is specified as Absent") - } - - $CurrentValues = Get-TargetResource @PSBoundParameters - if ($CurrentValues.Ensure -eq "Present") - { - # Error occured in Get method or template exists, which is not supposed to be. Return false - return $false - } - else - { - # Template does not exists, which is supposed to be. Return true - return $true - } - } - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPQuotaTemplate/MSFT_SPQuotaTemplate.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPQuotaTemplate/MSFT_SPQuotaTemplate.schema.mof deleted file mode 100644 index 991d4a68..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPQuotaTemplate/MSFT_SPQuotaTemplate.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPQuotaTemplate")] -class MSFT_SPQuotaTemplate : OMI_BaseResource -{ - [Key, Description("The name of the quota template")] string Name; - [Write, Description("The maximum storage for sites of this template in MB")] uint32 StorageMaxInMB; - [Write, Description("The amount of storage for sites of this template that triggers a warning")] uint32 StorageWarningInMB; - [Write, Description("The maximum number of performance points for sandbox solutions for this template")] uint32 MaximumUsagePointsSolutions; - [Write, Description("The warning number of performance points for sandbox solutions for this template")] uint32 WarningUsagePointsSolutions; - [Write, Description("Present to create this template, absent to ensure it does not exist"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPRemoteFarmTrust/MSFT_SPRemoteFarmTrust.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPRemoteFarmTrust/MSFT_SPRemoteFarmTrust.psm1 deleted file mode 100644 index 0cacee9f..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPRemoteFarmTrust/MSFT_SPRemoteFarmTrust.psm1 +++ /dev/null @@ -1,215 +0,0 @@ -function Get-TargetResource() -{ - [CmdletBinding()] - [OutputType([System.Collections.HashTable])] - param( - [Parameter(Mandatory = $true)] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [System.String] - $RemoteWebAppUrl, - - [Parameter(Mandatory = $true)] - [System.String] - $LocalWebAppUrl, - - [Parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] $Ensure = "Present", - - [Parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting remote farm trust '$Name'" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $returnValue = @{ - Name = $params.Name - RemoteWebAppUrl = $params.RemoteWebAppUrl - LocalWebAppUrl = $params.LocalWebAppUrl - Ensure = "Absent" - InstallAccount = $params.InstallAccount - } - - $issuer = Get-SPTrustedSecurityTokenIssuer -Identity $params.Name ` - -ErrorAction SilentlyContinue - if ($null -eq $issuer) - { - return $returnValue - } - $rootAuthority = Get-SPTrustedRootAuthority -Identity $params.Name ` - -ErrorAction SilentlyContinue - if ($null -eq $rootAuthority) - { - return $returnValue - } - $realm = $issuer.NameId.Split("@") - $site = Get-SPSite -Identity $params.LocalWebAppUrl - $serviceContext = Get-SPServiceContext -Site $site - $currentRealm = Get-SPAuthenticationRealm -ServiceContext $serviceContext - - if ($realm[1] -ne $currentRealm) - { - return $returnValue - } - $returnValue.Ensure = "Present" - return $returnValue - } - return $result -} - -function Set-TargetResource() -{ - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [System.String] - $RemoteWebAppUrl, - - [Parameter(Mandatory = $true)] - [System.String] - $LocalWebAppUrl, - - [Parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] $Ensure = "Present", - - [Parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting remote farm trust '$Name'" - - if ($Ensure -eq "Present") - { - Write-Verbose -Message "Adding remote farm trust '$Name'" - - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - $remoteWebApp = $params.RemoteWebAppUrl.TrimEnd('/') - - $issuer = Get-SPTrustedSecurityTokenIssuer -Identity $params.Name ` - -ErrorAction SilentlyContinue - if ($null -eq $issuer) - { - $endpoint = "$remoteWebApp/_layouts/15/metadata/json/1" - $issuer = New-SPTrustedSecurityTokenIssuer -Name $params.Name ` - -IsTrustBroker:$false ` - -MetadataEndpoint $endpoint - } - - $rootAuthority = Get-SPTrustedRootAuthority -Identity $params.Name ` - -ErrorAction SilentlyContinue - if ($null -eq $rootAuthority) - { - $endpoint = "$remoteWebApp/_layouts/15/metadata/json/1/rootcertificate" - New-SPTrustedRootAuthority -Name $params.Name ` - -MetadataEndPoint $endpoint - } - $realm = $issuer.NameId.Split("@") - $site = Get-SPSite -Identity $params.LocalWebAppUrl - $serviceContext = Get-SPServiceContext -Site $site - $currentRealm = Get-SPAuthenticationRealm -ServiceContext $serviceContext ` - -ErrorAction SilentlyContinue - - if ($realm[1] -ne $currentRealm) - { - Set-SPAuthenticationRealm -ServiceContext $serviceContext -Realm $realm[1] - } - - $appPrincipal = Get-SPAppPrincipal -Site $params.LocalWebAppUrl ` - -NameIdentifier $issuer.NameId - - Set-SPAppPrincipalPermission -Site $params.LocalWebAppUrl ` - -AppPrincipal $appPrincipal ` - -Scope SiteCollection ` - -Right FullControl - } - } - - if ($Ensure -eq "Absent") - { - Write-Verbose -Message "Removing remote farm trust '$Name'" - - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - $remoteWebApp = $params.RemoteWebAppUrl.TrimEnd('/') - - $issuer = Get-SPTrustedSecurityTokenIssuer -Identity $params.Name ` - -ErrorAction SilentlyContinue - if ($null -ne $issuer) - { - $appPrincipal = Get-SPAppPrincipal -Site $params.LocalWebAppUrl ` - -NameIdentifier $issuer.NameId - Remove-SPAppPrincipalPermission -Site $params.LocalWebAppUrl ` - -AppPrincipal $appPrincipal ` - -Scope SiteCollection ` - -Confirm:$false - } - - Get-SPTrustedRootAuthority -Identity $params.Name ` - -ErrorAction SilentlyContinue ` - | Remove-SPTrustedRootAuthority -Confirm:$false - if ($null -ne $issuer) - { - $issuer | Remove-SPTrustedSecurityTokenIssuer -Confirm:$false - } - } - } -} - -function Test-TargetResource() -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param( - [Parameter(Mandatory = $true)] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [System.String] - $RemoteWebAppUrl, - - [Parameter(Mandatory = $true)] - [System.String] - $LocalWebAppUrl, - - [Parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] $Ensure = "Present", - - [Parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing remote farm trust '$Name'" - - $PSBoundParameters.Ensure = $Ensure - - $CurrentValues = Get-TargetResource @PSBoundParameters - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPRemoteFarmTrust/MSFT_SPRemoteFarmTrust.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPRemoteFarmTrust/MSFT_SPRemoteFarmTrust.schema.mof deleted file mode 100644 index d5c7ed3b..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPRemoteFarmTrust/MSFT_SPRemoteFarmTrust.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPRemoteFarmTrust")] -class MSFT_SPRemoteFarmTrust : OMI_BaseResource -{ - [Key, Description("A name of the remote farm, used to create token issuer and root authority")] string Name; - [Required, Description("The URL of a web app in the remote farm, must use HTTPS")] string RemoteWebAppUrl; - [Required, Description("The URL of a local web app to connect the remote farm to")] string LocalWebAppUrl; - [Write, Description("Set to present to ensure the trust exists, or absent to ensure it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchAuthoritativePage/MSFT_SPSearchAuthoritativePage.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchAuthoritativePage/MSFT_SPSearchAuthoritativePage.psm1 deleted file mode 100644 index bb81bb92..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchAuthoritativePage/MSFT_SPSearchAuthoritativePage.psm1 +++ /dev/null @@ -1,297 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $ServiceAppName, - - [parameter(Mandatory = $true)] - [System.String] - $Path, - - [ValidateRange(0.0, 2.0)] - [System.Single] - $Level, - - [ValidateSet("Authoratative","Demoted")] - [System.String] - $Action, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting Authoratative Page Setting for '$Path'" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $nullReturn = @{ - ServiceAppName = $params.ServiceAppName - Path = "" - Level = $params.Level - Action = $params.Action - Ensure = "Absent" - InstallAccount = $params.InstallAccount - } - - $serviceApp = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName - if($null -eq $serviceApp) - { - return $nullReturn - } - - $searchObjectLevel = [Microsoft.Office.Server.Search.Administration.SearchObjectLevel]::Ssa - $searchOwner = New-Object -TypeName "Microsoft.Office.Server.Search.Administration.SearchObjectOwner" -ArgumentList $searchObjectLevel - - if($params.Action -eq "Authoratative") - { - - $queryAuthority = Get-SPEnterpriseSearchQueryAuthority -Identity $params.Path ` - -Owner $searchOwner ` - -SearchApplication $serviceApp ` - -ErrorAction SilentlyContinue - if($null -eq $queryAuthority) - { - return $nullReturn - } - else - { - - return @{ - ServiceAppName = $params.ServiceAppName - Path = $params.Path - Level = $queryAuthority.Level - Action = $params.Action - Ensure = "Present" - InstallAccount = $params.InstallAccount - } - } - } - else - { - $queryDemoted = $serviceApp | Get-SPEnterpriseSearchQueryDemoted -Identity $params.Path ` - -Owner $searchOwner ` - -SearchApplication $serviceApp ` - -ErrorAction SilentlyContinue - if($null -eq $queryDemoted) - { - return $nullReturn - } - else - { - return @{ - ServiceAppName = $params.ServiceAppName - Path = $params.Path - Action = $params.Action - Ensure = "Present" - InstallAccount = $params.InstallAccount - } - } - } - - } - return $result - -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $ServiceAppName, - - [parameter(Mandatory = $true)] - [System.String] - $Path, - - [ValidateRange(0.0, 2.0)] - [System.Single] - $Level, - - [ValidateSet("Authoratative","Demoted")] - [System.String] - $Action, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting Authoratative Page Settings for '$Path'" - - $CurrentResults = Get-TargetResource @PSBoundParameters - - if($CurrentResults.Ensure -eq "Absent" -and $Ensure -eq "Present") - { - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $serviceApp = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName - $searchObjectLevel = [Microsoft.Office.Server.Search.Administration.SearchObjectLevel]::Ssa - $searchOwner = New-Object -TypeName "Microsoft.Office.Server.Search.Administration.SearchObjectOwner" -ArgumentList $searchObjectLevel - - if($null -eq $serviceApp) - { - throw "Search Service App was not available." - } - if($params.Action -eq "Authoratative") - { - New-SPEnterpriseSearchQueryAuthority -Url $params.Path ` - -SearchApplication $serviceApp ` - -Owner $searchOwner ` - -Level $params.Level - } - else - { - New-SPEnterpriseSearchQueryDemoted -Url $params.Path -SearchApplication $serviceApp -Owner $searchOwner - } - } - } - if($CurrentResults.Ensure -eq "Present" -and $Ensure -eq "Present") - { - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $serviceApp = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName - $searchObjectLevel = [Microsoft.Office.Server.Search.Administration.SearchObjectLevel]::Ssa - $searchOwner = New-Object -TypeName "Microsoft.Office.Server.Search.Administration.SearchObjectOwner" -ArgumentList $searchObjectLevel - - if($null -eq $serviceApp) - { - throw "Search Service App was not available." - } - - if($params.Action -eq "Authoratative") - { - Set-SPEnterpriseSearchQueryAuthority -Identity $params.ServiceAppName ` - -SearchApplication $ssa ` - -Owner $searchOwner ` - -Level $params.Level - } - } - } - if($Ensure -eq "Absent") - { - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $serviceApp = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName - $searchObjectLevel = [Microsoft.Office.Server.Search.Administration.SearchObjectLevel]::Ssa - $searchOwner = New-Object -TypeName "Microsoft.Office.Server.Search.Administration.SearchObjectOwner" -ArgumentList $searchObjectLevel - - if($null -eq $serviceApp) - { - throw "Search Service App was not available." - } - if($params.Action -eq "Authoratative") - { - Remove-SPEnterpriseSearchQueryAuthority -Identity $params.ServiceAppName ` - -SearchApplication $ssa ` - -Owner $searchOwner ` - -ErrorAction SilentlyContinue - } - else - { - Remove-SPEnterpriseSearchQueryDemoted -Identity $params.ServiceAppName ` - -SearchApplication $ssa ` - -Owner $searchOwner ` - -ErrorAction SilentlyContinue - } - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $ServiceAppName, - - [parameter(Mandatory = $true)] - [System.String] - $Path, - - [ValidateRange(0.0, 2.0)] - [System.Single] - $Level, - - [ValidateSet("Authoratative","Demoted")] - [System.String] - $Action, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing Authoratative Page Settings '$Path'" - - $PSBoundParameters.Ensure = $Ensure - - $CurrentValues = Get-TargetResource @PSBoundParameters - if($Ensure -eq "Present") - { - if($Action -eq "Authoratative") - { - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ServiceAppName", - "Path", - "Level", - "Action", - "Ensure") - } - else - { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ServiceAppName", - "Path", - "Action", - "Ensure") - } - } - else - { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ServiceAppName", - "Action", - "Ensure") - } -} - -Export-ModuleMember -Function *-TargetResource - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchAuthoritativePage/MSFT_SPSearchAuthoritativePage.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchAuthoritativePage/MSFT_SPSearchAuthoritativePage.schema.mof deleted file mode 100644 index 894d1f50..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchAuthoritativePage/MSFT_SPSearchAuthoritativePage.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPSearchAuthoritativePage")] -class MSFT_SPSearchAuthoritativePage : OMI_BaseResource -{ - [Key, Description("Search Service Application Name")] String ServiceAppName; - [Key, Description("Source URI for the authoritative page")] String Path; - [Write, Description("Level of Authoratitive Page, values between 0.0 and 2.0")] Real32 Level; - [Write, Description("The resource will either make the page authoritative or demoted based on this value"), ValueMap{"Authoratative","Demoted"}, Values{"Authoratative","Demoted"}] String Action; - [Write, Description("Ensure the Authoritative is Present or Absent"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, EmbeddedInstance("MSFT_Credential"), Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchContentSource/MSFT_SPSearchContentSource.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchContentSource/MSFT_SPSearchContentSource.psm1 deleted file mode 100644 index 06bc16f2..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchContentSource/MSFT_SPSearchContentSource.psm1 +++ /dev/null @@ -1,780 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ServiceAppName, - - [parameter(Mandatory = $true)] - [ValidateSet("SharePoint","Website","FileShare")] - [System.String] - $ContentSourceType, - - [parameter(Mandatory = $true)] - [System.String[]] - $Addresses, - - [parameter(Mandatory = $true)] - [ValidateSet("CrawlEverything","CrawlFirstOnly","Custom")] - [System.String] - $CrawlSetting, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ContinuousCrawl, - - [parameter(Mandatory = $false)] - [Microsoft.Management.Infrastructure.CimInstance] - $IncrementalSchedule, - - [parameter(Mandatory = $false)] - [Microsoft.Management.Infrastructure.CimInstance] - $FullSchedule, - - [parameter(Mandatory = $false)] - [ValidateSet("Normal","High")] - [System.String] - $Priority, - - [parameter(Mandatory = $false)] - [System.UInt32] - $LimitPageDepth, - - [parameter(Mandatory = $false)] - [System.UInt32] - $LimitServerHops, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Boolean] - $Force, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting Content Source Setting for '$Name'" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` - -ScriptBlock { - $params = $args[0] - $ScriptRoot = $args[1] - - $relativePath = "..\..\Modules\SharePointDsc.Search\SPSearchContentSource.Schedules.psm1" - $modulePath = Join-Path -Path $ScriptRoot ` - -ChildPath $relativePath ` - -Resolve - Import-Module -Name $modulePath - - $source = Get-SPEnterpriseSearchCrawlContentSource -SearchApplication $params.ServiceAppName ` - -Identity $params.Name ` - -ErrorAction SilentlyContinue - if ($null -eq $source) - { - return @{ - Name = $params.Name - ServiceAppName = $params.ServiceAppName - ContentSourceType = $params.ContentSourceType - Ensure = "Absent" - } - } - - switch ($source.Type) - { - "SharePoint" { - $crawlSetting = "CrawlEverything" - if ($source.SharePointCrawlBehavior -eq "CrawlSites") - { - $crawlSetting = "CrawlFirstOnly" - } - - $incrementalSchedule = Get-SPDSCSearchCrawlSchedule ` - -Schedule $source.IncrementalCrawlSchedule - $fullSchedule = Get-SPDSCSearchCrawlSchedule ` - -Schedule $source.FullCrawlSchedule - - $result = @{ - Name = $params.Name - ServiceAppName = $params.ServiceAppName - Ensure = "Present" - ContentSourceType = "SharePoint" - Addresses = $source.StartAddresses.AbsoluteUri - CrawlSetting = $crawlSetting - ContinuousCrawl = $source.EnableContinuousCrawls - IncrementalSchedule = $incrementalSchedule - FullSchedule = $fullSchedule - Priority = $source.CrawlPriority - InstallAccount = $params.InstallAccount - } - } - "Web" { - $crawlSetting = "Custom" - if ($source.MaxPageEnumerationDepth -eq [System.Int32]::MaxValue) - { - $crawlSetting = "CrawlEverything" - } - if ($source.MaxPageEnumerationDepth -eq 0) - { - $crawlSetting = "CrawlFirstOnly" - } - - $incrementalSchedule = Get-SPDSCSearchCrawlSchedule ` - -Schedule $source.IncrementalCrawlSchedule - $fullSchedule = Get-SPDSCSearchCrawlSchedule ` - -Schedule $source.FullCrawlSchedule - - $result = @{ - Name = $params.Name - ServiceAppName = $params.ServiceAppName - Ensure = "Present" - ContentSourceType = "Website" - Addresses = $source.StartAddresses.AbsoluteUri - CrawlSetting = $crawlSetting - IncrementalSchedule = $incrementalSchedule - FullSchedule = $fullSchedule - LimitPageDepth = $source.MaxPageEnumerationDepth - LimitServerHops = $source.MaxSiteEnumerationDepth - Priority = $source.CrawlPriority - } - } - "File" { - $crawlSetting = "CrawlFirstOnly" - if ($source.FollowDirectories -eq $true) - { - $crawlSetting = "CrawlEverything" - } - - $addresses = $source.StartAddresses.AbsoluteUri - $addresses = $addresses.Replace("file:///","\\").Replace("/", "\") - - $incrementalSchedule = Get-SPDSCSearchCrawlSchedule ` - -Schedule $source.IncrementalCrawlSchedule - $fullSchedule = Get-SPDSCSearchCrawlSchedule ` - -Schedule $source.FullCrawlSchedule - - $result = @{ - Name = $params.Name - ServiceAppName = $params.ServiceAppName - Ensure = "Present" - ContentSourceType = "FileShare" - Addresses = $addresses - CrawlSetting = $crawlSetting - IncrementalSchedule = $incrementalSchedule - FullSchedule = $fullSchedule - Priority = $source.CrawlPriority - } - } - Default { - throw ("SharePointDsc does not currently support '$($source.Type)' content " + ` - "sources. Please use only 'SharePoint', 'FileShare' or 'Website'.") - } - } - return $result - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ServiceAppName, - - [parameter(Mandatory = $true)] - [ValidateSet("SharePoint","Website","FileShare")] - [System.String] - $ContentSourceType, - - [parameter(Mandatory = $true)] - [System.String[]] - $Addresses, - - [parameter(Mandatory = $true)] - [ValidateSet("CrawlEverything","CrawlFirstOnly","Custom")] - [System.String] - $CrawlSetting, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ContinuousCrawl, - - [parameter(Mandatory = $false)] - [Microsoft.Management.Infrastructure.CimInstance] - $IncrementalSchedule, - - [parameter(Mandatory = $false)] - [Microsoft.Management.Infrastructure.CimInstance] - $FullSchedule, - - [parameter(Mandatory = $false)] - [ValidateSet("Normal","High")] - [System.String] - $Priority, - - [parameter(Mandatory = $false)] - [System.UInt32] - $LimitPageDepth, - - [parameter(Mandatory = $false)] - [System.UInt32] - $LimitServerHops, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Boolean] - $Force, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting Content Source Setting for '$Name'" - - switch ($ContentSourceType) - { - "SharePoint" { - if ($PSBoundParameters.ContainsKey("LimitPageDepth") -eq $true) - { - throw "Parameter LimitPageDepth is not valid for SharePoint content sources" - } - if ($PSBoundParameters.ContainsKey("LimitServerHops") -eq $true) - { - throw "Parameter LimitServerHops is not valid for SharePoint content sources" - } - if ($ContinuousCrawl -eq $true -and ` - $PSBoundParameters.ContainsKey("IncrementalSchedule") -eq $true) - { - throw ("You can not specify an incremental crawl schedule on a content source " + ` - "that will use continous crawl") - } - if ($CrawlSetting -eq "Custom") - { - throw ("Parameter 'CrawlSetting' can only be set to custom for website content " + ` - "sources") - } - } - "Website" { - if ($PSBoundParameters.ContainsKey("ContinuousCrawl") -eq $true) - { - throw "Parameter ContinuousCrawl is not valid for website content sources" - } - if ($PSBoundParameters.ContainsKey("LimitServerHops") -eq $true) - { - throw "Parameter LimitServerHops is not valid for website content sources" - } - } - "FileShare" { - if ($PSBoundParameters.ContainsKey("LimitPageDepth") -eq $true) - { - throw "Parameter LimitPageDepth is not valid for file share content sources" - } - if ($PSBoundParameters.ContainsKey("LimitServerHops") -eq $true) - { - throw "Parameter LimitServerHops is not valid for file share content sources" - } - if ($CrawlSetting -eq "Custom") - { - throw "Parameter 'CrawlSetting' can only be set to custom for website content sources" - } - } - } - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($ContentSourceType -ne $CurrentValues.ContentSourceType -and $Force -eq $false) - { - throw ("The type of the a search content source can not be changed from " + ` - "'$($CurrentValues.ContentSourceType)' to '$ContentSourceType' without " + ` - "deleting and adding it again. Specify 'Force = `$true' in order to allow " + ` - "DSC to do this, or manually remove the existing content source and re-run " + ` - "the configuration.") - } - - if (($ContentSourceType -ne $CurrentValues.ContentSourceType -and $Force -eq $true) ` - -or ($Ensure -eq "Absent" -and $CurrentValues.Ensure -ne $Ensure)) - { - # Remove the existing content source - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters) ` - -ScriptBlock { - $params = $args[0] - Remove-SPEnterpriseSearchCrawlContentSource -Identity $params.Name ` - -SearchApplication $params.ServiceAppName ` - -Confirm:$false - } - } - - if ($Ensure -eq "Present") - { - # Create the new content source and then apply settings to it - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters) ` - -ScriptBlock { - $params = $args[0] - - $OFS = "," - $startAddresses = "$($params.Addresses)" - - $source = Get-SPEnterpriseSearchCrawlContentSource ` - -SearchApplication $params.ServiceAppName ` - -Identity $params.Name ` - -ErrorAction SilentlyContinue - - if ($null -eq $source) - { - switch ($params.ContentSourceType) { - "SharePoint" { - $newType = "SharePoint" - } - "Website" { - $newType = "Web" - } - "FileShare" { - $newType = "File" - } - } - $source = New-SPEnterpriseSearchCrawlContentSource ` - -SearchApplication $params.ServiceAppName ` - -Type $newType ` - -Name $params.Name ` - -StartAddresses $startAddresses - } - - $allSetArguments = @{ - Identity = $params.Name - SearchApplication = $params.ServiceAppName - Confirm = $false - } - - if ($params.ContentSourceType -eq "SharePoint" -and ` - $source.EnableContinuousCrawls -eq $true) - { - Set-SPEnterpriseSearchCrawlContentSource @allSetArguments ` - -EnableContinuousCrawls $false - Write-Verbose -Message ("Pausing to allow Continuous Crawl to shut down " + ` - "correctly before continuing updating the configuration.") - Start-Sleep -Seconds 300 - } - - if ($source.CrawlStatus -ne "Idle") - { - Write-Verbose -Message ("Content source '$($params.Name)' is not idle, " + ` - "stopping current crawls to allow settings to be updated") - - $source = Get-SPEnterpriseSearchCrawlContentSource ` - -SearchApplication $params.ServiceAppName ` - -Identity $params.Name - - $source.StopCrawl() - $loopCount = 0 - - $sourceToWait = Get-SPEnterpriseSearchCrawlContentSource ` - -SearchApplication $params.ServiceAppName ` - -Identity $params.Name - - while ($sourceToWait.CrawlStatus -ne "Idle" -or $loopCount > 15) - { - $sourceToWait = Get-SPEnterpriseSearchCrawlContentSource ` - -SearchApplication $params.ServiceAppName ` - -Identity $params.Name - - Write-Verbose -Message ("$([DateTime]::Now.ToShortTimeString()) - Waiting " + ` - "for content source '$($params.Name)' to be idle " + ` - "(waited $loopCount of 15 minutes)") - Start-Sleep -Seconds 60 - $loopCount++ - } - } - - $primarySetArgs = @{ - StartAddresses = $startAddresses - } - - if ($params.ContainsKey("ContinuousCrawl") -eq $true) - { - $primarySetArgs.Add("EnableContinuousCrawls", $params.ContinuousCrawl) - } - - if ($params.ContainsKey("Priority") -eq $true) - { - switch ($params.Priority) - { - "High" { - $primarySetArgs.Add("CrawlPriority", "2") - } - "Normal" { - $primarySetArgs.Add("CrawlPriority", "1") - } - } - } - - Set-SPEnterpriseSearchCrawlContentSource @allSetArguments @primarySetArgs - - # Set the incremental search values - if ($params.ContainsKey("IncrementalSchedule") -eq $true -and ` - $null -ne $params.IncrementalSchedule) - { - $incrementalSetArgs = @{ - ScheduleType = "Incremental" - } - switch ($params.IncrementalSchedule.ScheduleType) - { - "None" { - $incrementalSetArgs.Add("RemoveCrawlSchedule", $true) - } - "Daily" { - $incrementalSetArgs.Add("DailyCrawlSchedule", $true) - } - "Weekly" { - $incrementalSetArgs.Add("WeeklyCrawlSchedule", $true) - $propertyTest = Test-SPDSCObjectHasProperty ` - -Object $params.IncrementalSchedule ` - -PropertyName "CrawlScheduleDaysOfWeek" - - if ($propertyTest -eq $true) - { - $OFS = "," - $enumValue = ` - [enum]::Parse([Microsoft.Office.Server.Search.Administration.DaysOfWeek], ` - "$($params.IncrementalSchedule.CrawlScheduleDaysOfWeek)") - - $incrementalSetArgs.Add("CrawlScheduleDaysOfWeek", $enumValue) - } - } - "Monthly" { - $incrementalSetArgs.Add("MonthlyCrawlSchedule", $true) - $propertyTest = Test-SPDSCObjectHasProperty ` - -Object $params.IncrementalSchedule ` - -PropertyName "CrawlScheduleDaysOfMonth" - - if ($propertyTest -eq $true) - { - $incrementalSetArgs.Add("CrawlScheduleDaysOfMonth", ` - $params.IncrementalSchedule.CrawlScheduleDaysOfMonth) - } - - $propertyTest = Test-SPDSCObjectHasProperty ` - -Object $params.IncrementalSchedule ` - -PropertyName "CrawlScheduleMonthsOfYear" - - if ($propertyTest -eq $true) - { - foreach ($month in $params.IncrementalSchedule.CrawlScheduleMonthsOfYear) { - $months += [Microsoft.Office.Server.Search.Administration.MonthsOfYear]::$month - } - $incrementalSetArgs.Add("CrawlScheduleMonthsOfYear", $months) - } - } - } - - $propertyTest = Test-SPDSCObjectHasProperty -Object $params.IncrementalSchedule ` - -PropertyName "CrawlScheduleRepeatDuration" - if ($propertyTest -eq $true) - { - $incrementalSetArgs.Add("CrawlScheduleRepeatDuration", - $params.IncrementalSchedule.CrawlScheduleRepeatDuration) - } - - $propertyTest = Test-SPDSCObjectHasProperty -Object $params.IncrementalSchedule ` - -PropertyName "CrawlScheduleRepeatInterval" - if ($propertyTest -eq $true) - { - $incrementalSetArgs.Add("CrawlScheduleRepeatInterval", - $params.IncrementalSchedule.CrawlScheduleRepeatInterval) - } - - $propertyTest = Test-SPDSCObjectHasProperty -Object $params.IncrementalSchedule ` - -PropertyName "CrawlScheduleRunEveryInterval" - if ($propertyTest -eq $true) { - $incrementalSetArgs.Add("CrawlScheduleRunEveryInterval", - $params.IncrementalSchedule.CrawlScheduleRunEveryInterval) - } - Set-SPEnterpriseSearchCrawlContentSource @allSetArguments @incrementalSetArgs - } - - # Set the full search values - if ($params.ContainsKey("FullSchedule") -eq $true) - { - $fullSetArgs = @{ - ScheduleType = "Full" - } - switch ($params.FullSchedule.ScheduleType) - { - "None" { - $fullSetArgs.Add("RemoveCrawlSchedule", $true) - } - "Daily" { - $fullSetArgs.Add("DailyCrawlSchedule", $true) - } - "Weekly" { - $fullSetArgs.Add("WeeklyCrawlSchedule", $true) - $propertyTest = Test-SPDSCObjectHasProperty -Object $params.FullSchedule ` - -PropertyName "CrawlScheduleDaysOfWeek" - if ($propertyTest -eq $true) - { - foreach ($day in $params.FullSchedule.CrawlScheduleDaysOfWeek) { - $daysOfweek += [Microsoft.Office.Server.Search.Administration.DaysOfWeek]::$day - } - $fullSetArgs.Add("CrawlScheduleDaysOfWeek", $daysOfweek) - } - } - "Monthly" { - $fullSetArgs.Add("MonthlyCrawlSchedule", $true) - $propertyTest = Test-SPDSCObjectHasProperty -Object $params.FullSchedule ` - -PropertyName "CrawlScheduleDaysOfMonth" - if ($propertyTest -eq $true) - { - $fullSetArgs.Add("CrawlScheduleDaysOfMonth", - $params.FullSchedule.CrawlScheduleDaysOfMonth) - } - - $propertyTest = Test-SPDSCObjectHasProperty -Object $params.FullSchedule ` - -PropertyName "CrawlScheduleMonthsOfYear" - if ($propertyTest -eq $true) - { - foreach ($month in $params.FullSchedule.CrawlScheduleMonthsOfYear) { - $months += [Microsoft.Office.Server.Search.Administration.MonthsOfYear]::$month - } - $fullSetArgs.Add("CrawlScheduleMonthsOfYear", $months) - } - } - } - - $propertyTest = Test-SPDSCObjectHasProperty -Object $params.FullSchedule ` - -PropertyName "CrawlScheduleRepeatDuration" - if ($propertyTest -eq $true) - { - $fullSetArgs.Add("CrawlScheduleRepeatDuration", - $params.FullSchedule.CrawlScheduleRepeatDuration) - } - - $propertyTest = Test-SPDSCObjectHasProperty -Object $params.FullSchedule ` - -PropertyName "CrawlScheduleRepeatInterval" - if ($propertyTest -eq $true) - { - $fullSetArgs.Add("CrawlScheduleRepeatInterval", - $params.FullSchedule.CrawlScheduleRepeatInterval) - } - - $propertyTest = Test-SPDSCObjectHasProperty -Object $params.FullSchedule ` - -PropertyName "CrawlScheduleRunEveryInterval" - if ($propertyTest -eq $true) - { - $fullSetArgs.Add("CrawlScheduleRunEveryInterval", - $params.FullSchedule.CrawlScheduleRunEveryInterval) - } - Set-SPEnterpriseSearchCrawlContentSource @allSetArguments @fullSetArgs - } - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ServiceAppName, - - [parameter(Mandatory = $true)] - [ValidateSet("SharePoint","Website","FileShare")] - [System.String] - $ContentSourceType, - - [parameter(Mandatory = $true)] - [System.String[]] - $Addresses, - - [parameter(Mandatory = $true)] - [ValidateSet("CrawlEverything","CrawlFirstOnly","Custom")] - [System.String] - $CrawlSetting, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ContinuousCrawl, - - [parameter(Mandatory = $false)] - [Microsoft.Management.Infrastructure.CimInstance] - $IncrementalSchedule, - - [parameter(Mandatory = $false)] - [Microsoft.Management.Infrastructure.CimInstance] - $FullSchedule, - - [parameter(Mandatory = $false)] - [ValidateSet("Normal","High")] - [System.String] - $Priority, - - [parameter(Mandatory = $false)] - [System.UInt32] - $LimitPageDepth, - - [parameter(Mandatory = $false)] - [System.UInt32] - $LimitServerHops, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Boolean] - $Force, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing Content Source Setting for '$Name'" - - $PSBoundParameters.Ensure = $Ensure - - switch ($ContentSourceType) - { - "SharePoint" { - if ($PSBoundParameters.ContainsKey("LimitPageDepth") -eq $true) - { - throw "Parameter LimitPageDepth is not valid for SharePoint content sources" - } - if ($PSBoundParameters.ContainsKey("LimitServerHops") -eq $true) - { - throw "Parameter LimitServerHops is not valid for SharePoint content sources" - } - if ($ContinuousCrawl -eq $true -and ` - $PSBoundParameters.ContainsKey("IncrementalSchedule") -eq $true) - { - throw ("You can not specify an incremental crawl schedule on a content source " + ` - "that will use continous crawl") - } - if ($CrawlSetting -eq "Custom") - { - throw ("Parameter 'CrawlSetting' can only be set to custom for website content " + ` - "sources") - } - } - "Website" { - if ($PSBoundParameters.ContainsKey("ContinuousCrawl") -eq $true) - { - throw "Parameter ContinuousCrawl is not valid for website content sources" - } - if ($PSBoundParameters.ContainsKey("LimitServerHops") -eq $true) - { - throw "Parameter LimitServerHops is not valid for website content sources" - } - } - "FileShare" { - if ($PSBoundParameters.ContainsKey("LimitPageDepth") -eq $true) - { - throw "Parameter LimitPageDepth is not valid for file share content sources" - } - if ($PSBoundParameters.ContainsKey("LimitServerHops") -eq $true) - { - throw "Parameter LimitServerHops is not valid for file share content sources" - } - if ($CrawlSetting -eq "Custom") - { - throw "Parameter 'CrawlSetting' can only be set to custom for website content sources" - } - } - } - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($Ensure -eq "Absent" -or $CurrentValues.Ensure -eq "Absent") - { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") - } - - $relativePath = "..\..\Modules\SharePointDsc.Search\SPSearchContentSource.Schedules.psm1" - $modulePath = Join-Path -Path $PSScriptRoot ` - -ChildPath $relativePath ` - -Resolve - Import-Module -Name $modulePath - - if (($PSBoundParameters.ContainsKey("IncrementalSchedule") -eq $true) -and ($null -ne $IncrementalSchedule)) - { - $propertyTest = Test-SPDSCSearchCrawlSchedule -CurrentSchedule $CurrentValues.IncrementalSchedule ` - -DesiredSchedule $IncrementalSchedule - if ($propertyTest -eq $false) - { - return $false - } - } - - if (($PSBoundParameters.ContainsKey("FullSchedule") -eq $true) -and ($null -ne $FullSchedule)) - { - $propertyTest = Test-SPDSCSearchCrawlSchedule -CurrentSchedule $CurrentValues.FullSchedule ` - -DesiredSchedule $FullSchedule - if ($propertyTest -eq $false) - { - return $false - } - } - - # Compare the addresses as Uri objects to handle things like trailing /'s on URLs - $currentAddresses = @() - foreach ($address in $CurrentValues.Addresses) - { - $currentAddresses += New-Object -TypeName System.Uri -ArgumentList $address - } - $desiredAddresses = @() - foreach ($address in $Addresses) - { - $desiredAddresses += New-Object -TypeName System.Uri -ArgumentList $address - } - - if ($null -ne (Compare-Object -ReferenceObject $currentAddresses ` - -DifferenceObject $desiredAddresses)) - { - return $false - } - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ContentSourceType", - "CrawlSetting", - "ContinousCrawl", - "Priority", - "LimitPageDepth", - "LimitServerHops", - "Ensure") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchContentSource/MSFT_SPSearchContentSource.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchContentSource/MSFT_SPSearchContentSource.schema.mof deleted file mode 100644 index 03b8db0d..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchContentSource/MSFT_SPSearchContentSource.schema.mof +++ /dev/null @@ -1,31 +0,0 @@ -[ClassVersion("1.0.0")] -Class MSFT_SPSearchCrawlSchedule -{ - [Required, Description("How frequently should this crawl be run"), ValueMap{"None","Daily","Weekly","Monthly"}, Values{"None","Daily","Weekly","Monthly"}] String ScheduleType; - [Write, Description("Monthly crawls only: Which day of the month should the crawl run on")] Uint32 CrawlScheduleDaysOfMonth; - [Write, Description("Weekly crawls only: What days should the crawl be run on"), ValueMap{"Everyday", "Weekdays", "Weekends", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"}, Values{"Everyday", "Weekdays", "Weekends", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"}] String CrawlScheduleDaysOfWeek[]; - [Write, Description("Monthly crawls only: Which months should this crawl be run during"), ValueMap{"AllMonths", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}, Values{"AllMonths", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}] String CrawlScheduleMonthsOfYear[]; - [Write, Description("The hour of the day that the schedule should begin")] Uint32 StartHour; - [Write, Description("The minute of the specified hour that the schedule should begin")] Uint32 StartMinute; - [Write, Description("Specifies the number of times to repeat the crawl within a day")] Uint32 CrawlScheduleRepeatDuration; - [Write, Description("Specifies the number of minutes between crawl repeats on a day")] Uint32 CrawlScheduleRepeatInterval; - [Write, Description("For daily crawls, this is the number of days between crawls. For weekly this is the number of weeks between crawls")] Uint32 CrawlScheduleRunEveryInterval; -}; -[ClassVersion("1.0.0.0"), FriendlyName("SPSearchContentSource")] -class MSFT_SPSearchContentSource : OMI_BaseResource -{ - [Key, Description("The name of the content source")] String Name; - [Key, Description("The name of the search service app that this content source exists within")] String ServiceAppName; - [Required, Description("The type of content source - currently only SharePoint, Website and File Shares are supported"), ValueMap{"SharePoint","Website","FileShare"}, Values{"SharePoint","Website","FileShare"}] String ContentSourceType; - [Required, Description("A list of the addresses this content source includes")] String Addresses[]; - [Required, Description("Should the crawler index everything, just the first site or page, or a custom depth (applies to websites only)"), ValueMap{"CrawlEverything","CrawlFirstOnly","Custom"}, Values{"CrawlEverything","CrawlFirstOnly","Custom"}] String CrawlSetting; - [Write, Description("Should this content source use continuous crawl (SharePoint sites only)")] Boolean ContinuousCrawl; - [Write, Description("What is the incremental schedule for this content source"), EmbeddedInstance("MSFT_SPSearchCrawlSchedule")] String IncrementalSchedule; - [Write, Description("What is the full schedule for this content source"), EmbeddedInstance("MSFT_SPSearchCrawlSchedule")] String FullSchedule; - [Write, Description("What is the priority on this content source"), ValueMap{"Normal","High"}, Values{"Normal","High"}] String Priority; - [Write, Description("How many pages deep should the crawler go (-1 = unlimited, website sources only)")] Uint32 LimitPageDepth; - [Write, Description("How many server hops should the crawler make (-1 = unlimtied, website sources only)")] Uint32 LimitServerHops; - [Write, Description("Present if the source should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("Specify true if DSC is allowed to delete and recreate a content source to apply the correct settings, otherwise false will just report errors if a change can not be applied.")] Boolean Force; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchCrawlMapping/MSFT_SPSearchCrawlMapping.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchCrawlMapping/MSFT_SPSearchCrawlMapping.psm1 deleted file mode 100644 index 4a32d344..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchCrawlMapping/MSFT_SPSearchCrawlMapping.psm1 +++ /dev/null @@ -1,225 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $ServiceAppName, - - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $true)] - [System.String] - $Target, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting Search Crawl Mapping for '$Url'" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - - $params = $args[0] - $searchApp = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName - if($null -eq $searchApp) - { - Write-Verbose -Message "Search Service Application $($params.ServiceAppName) not found" - $returnVal = @{ - ServiceAppName = "" - Url = $params.Url - Target = "" - Ensure = "Absent" - InstallAccount = $params.InstallAccount - } - return $returnVal - } - - $mappings = $searchApp | Get-SPEnterpriseSearchCrawlMapping - - if($null -eq $mappings) - { - Write-Verbose -Message "Search Service Application $($params.ServiceAppName) has no mappings" - $returnVal = @{ - ServiceAppName = $params.ServiceAppName - Url = $params.Url - Target = "" - Ensure = "Absent" - InstallAccount = $params.InstallAccount - } - return $returnVal - } - - $mapping = $mappings | Where-Object -FilterScript { $_.Source -eq "$($params.Url)" } | Select-Object -First 1 - - if($null -eq $mapping) - { - Write-Verbose "Search Service Application $($params.ServiceAppName) has no matching mapping" - $returnVal = @{ - ServiceAppName = $params.ServiceAppName - Url = $params.Url - Target = "" - Ensure = "Absent" - InstallAccount = $params.InstallAccount - } - return $returnVal - } - else - { - Write-Verbose "Search Service Application $($params.ServiceAppName) has a matching mapping" - $returnVal = @{ - ServiceAppName = $params.ServiceAppName - Url = $mapping.Source - Target = $mapping.Target - Ensure = "Present" - InstallAccount = $params.InstallAccount - } - return $returnVal - - } - - } - - return $result - -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $ServiceAppName, - - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $true)] - [System.String] - $Target, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [System.Management.Automation.PSCredential] - $InstallAccount - ) - Write-Verbose -Message "Setting Search Crawl Mapping Rule '$Url'" - $result = Get-TargetResource @PSBoundParameters - - if($result.Ensure -eq "Absent" -and $Ensure -eq "Present") - { - Write-Verbose "Adding the Crawl Mapping '$Url'" - - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $searchApp = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName - if($null -eq $searchApp) - { - throw [Exception] "The Search Service Application does not exist" - } - else - { - New-SPEnterpriseSearchCrawlMapping -SearchApplication $searchApp -Url $params.Url -Target $params.Target - } - } - } - if($result.Ensure -eq "Present" -and $Ensure -eq "Present") - { - Write-Verbose "Updating the Crawl Mapping '$Url'" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $searchApp = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName - $mappings = $searchApp | Get-SPEnterpriseSearchCrawlMapping - $mapping = $mappings | Where-Object -FilterScript { $_.Source -eq $params.Url } | Select-Object -First 1 - $mapping | Remove-SPEnterpriseSearchCrawlMapping - - New-SPEnterpriseSearchCrawlMapping -SearchApplication $searchApp -Url $params.Url -Target $params.Target - } - } - if($result.Ensure -eq "Present" -and $Ensure -eq "Absent") - { - - Write-Verbose "Removing the Crawl Mapping '$Url'" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $searchapp = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName - $mappings = $searchApp | Get-SPEnterpriseSearchCrawlMapping - $mapping = $mappings | Where-Object -FilterScript { $_.Source -eq $params.Url } | Select-Object -First 1 - $mapping | Remove-SPEnterpriseSearchCrawlMapping - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $ServiceAppName, - - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $true)] - [System.String] - $Target, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [System.Management.Automation.PSCredential] - $InstallAccount - ) - Write-Verbose -Message "Testing Search Crawl Mapping for '$Url'" - - $PSBoundParameters.Ensure = $Ensure - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if($Ensure -eq "Present") - { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ServiceAppName","Url","Target","Ensure") - } - else - { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") - } -} - -Export-ModuleMember -Function *-TargetResource - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchCrawlMapping/MSFT_SPSearchCrawlMapping.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchCrawlMapping/MSFT_SPSearchCrawlMapping.schema.mof deleted file mode 100644 index d62f23d8..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchCrawlMapping/MSFT_SPSearchCrawlMapping.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("SPSearchCrawlMapping")] -class MSFT_SPSearchCrawlMapping : OMI_BaseResource -{ - [Key, Description("Search Service Application Name")] String ServiceAppName; - [Key, Description("Source URI for the crawl mapping")] String Url; - [Required, Description("Target URI for the crawl mapping")] String Target; - [Write, Description("Ensure the crawl mapping is Present or Absent"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, EmbeddedInstance("MSFT_Credential"), Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchCrawlRule/MSFT_SPSearchCrawlRule.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchCrawlRule/MSFT_SPSearchCrawlRule.psm1 deleted file mode 100644 index d44e9c96..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchCrawlRule/MSFT_SPSearchCrawlRule.psm1 +++ /dev/null @@ -1,555 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Path, - - [parameter(Mandatory = $true)] - [System.String] - $ServiceAppName, - - [parameter(Mandatory = $false)] - [ValidateSet("DefaultRuleAccess", - "BasicAccountRuleAccess", - "CertificateRuleAccess", - "NTLMAccountRuleAccess", - "FormRuleAccess", - "CookieRuleAccess", - "AnonymousAccess")] - [System.String] - $AuthenticationType, - - [parameter(Mandatory = $false)] - [ValidateSet("InclusionRule","ExclusionRule")] - [System.String] - $RuleType, - - [parameter(Mandatory = $false)] - [ValidateSet("FollowLinksNoPageCrawl", - "CrawlComplexUrls", - "CrawlAsHTTP")] - [System.String[]] - $CrawlConfigurationRules, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $AuthenticationCredentials, - - [parameter(Mandatory = $false)] - [System.String] - $CertificateName, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting Search Crawl Rule '$Path'" - - # AuthenticationType=CertificateName and CertificateRuleAccess parameters not specified - if ($AuthenticationType -eq "CertificateRuleAccess" -and -not $CertificateName) - { - throw ("When AuthenticationType=CertificateRuleAccess, the parameter " + ` - "CertificateName is required") - } - - # AuthenticationType=CertificateName and CertificateRuleAccess parameters not - # specified correctly - if ($AuthenticationType -ne "CertificateRuleAccess" -and $CertificateName) - { - throw "When specifying CertificateName, the AuthenticationType parameter is required" - } - - # AuthenticationType=NTLMAccountRuleAccess and AuthenticationCredentialsparameters - # not specified - if (($AuthenticationType -eq "NTLMAccountRuleAccess" ` - -or $AuthenticationType -eq "BasicAccountRuleAccess") ` - -and -not $AuthenticationCredentials) - { - throw ("When AuthenticationType is NTLMAccountRuleAccess or BasicAccountRuleAccess, " + ` - "the parameter AuthenticationCredentials is required") - } - - # AuthenticationCredentials parameters, but AuthenticationType is not NTLMAccountRuleAccess - # or BasicAccountRuleAccess - if ($AuthenticationCredentials ` - -and $AuthenticationType -ne "NTLMAccountRuleAccess" ` - -and $AuthenticationType -ne "BasicAccountRuleAccess") - { - throw ("When specifying AuthenticationCredentials, the AuthenticationType " + ` - "parameter is required") - } - - # ExclusionRule only with CrawlConfigurationRules=CrawlComplexUrls - if ($RuleType -eq "ExclusionRule" ` - -and ($CrawlConfigurationRules -contains "CrawlAsHTTP" ` - -or $CrawlConfigurationRules -contains "FollowLinksNoPageCrawl")) - { - throw ("When RuleType=ExclusionRule, CrawlConfigurationRules cannot contain " + ` - "the values FollowLinksNoPageCrawl or CrawlAsHTTP") - } - - # ExclusionRule cannot be used with AuthenticationCredentials, CertificateName or - # AuthenticationType parameters - if ($RuleType -eq "ExclusionRule" ` - -and ($AuthenticationCredentials -or $CertificateName -or $AuthenticationType)) - { - throw ("When Type=ExclusionRule, parameters AuthenticationCredentials, " + ` - "CertificateName or AuthenticationType are not allowed") - } - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $serviceApps = Get-SPServiceApplication -Name $params.ServiceAppName ` - -ErrorAction SilentlyContinue - - $nullReturn = @{ - Path = $params.Path - ServiceAppName = $params.ServiceAppName - Ensure = "Absent" - InstallAccount = $params.InstallAccount - } - - if ($null -eq $serviceApps) - { - Write-Verbose -Message "Service Application $($params.ServiceAppName) not found" - return $nullReturn - } - - $serviceApp = $serviceApps | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" - } - - if ($null -eq $serviceApp) - { - Write-Verbose -Message "Service Application $($params.ServiceAppName) not found" - return $nullReturn - } - else - { - $crawlRule = Get-SPEnterpriseSearchCrawlRule ` - -SearchApplication $params.ServiceAppName | Where-Object -FilterScript { - $_.Path -eq $params.Path - } - - if ($null -eq $crawlRule) - { - Write-Verbose -Message "Crawl rule $($params.Path) not found" - return $nullReturn - } - else - { - $crawlConfigurationRules = @() - if ($crawlRule.SuppressIndexing) - { - $crawlConfigurationRules += "FollowLinksNoPageCrawl" - } - if ($crawlRule.FollowComplexUrls) - { - $crawlConfigurationRules += "CrawlComplexUrls" - } - if ($crawlRule.CrawlAsHttp) - { - $crawlConfigurationRules += "CrawlAsHTTP" - } - - switch ($crawlRule.AuthenticationType) - { - {@("BasicAccountRuleAccess", - "NTLMAccountRuleAccess") -contains $_ } { - $returnVal = @{ - Path = $params.Path - ServiceAppName = $params.ServiceAppName - AuthenticationType = $crawlRule.AuthenticationType - RuleType = $crawlRule.Type.ToString() - CrawlConfigurationRules = $crawlConfigurationRules - AuthenticationCredentials = $crawlRule.AccountName - Ensure = "Present" - InstallAccount = $params.InstallAccount - } - } - "CertificateRuleAccess" { - $returnVal = @{ - Path = $params.Path - ServiceAppName = $params.ServiceAppName - AuthenticationType = $crawlRule.AuthenticationType - RuleType = $crawlRule.Type.ToString() - CrawlConfigurationRules = $crawlConfigurationRules - CertificateName = $crawlRule.AccountName - Ensure = "Present" - InstallAccount = $params.InstallAccount - } - } - { @("DefaultRuleAccess", - "FormRuleAccess", - "CookieRuleAccess", - "AnonymousAccess") -contains $_ } { - $returnVal = @{ - Path = $params.Path - ServiceAppName = $params.ServiceAppName - AuthenticationType = $crawlRule.AuthenticationType.ToString() - RuleType = $crawlRule.Type.ToString() - CrawlConfigurationRules = $crawlConfigurationRules - Ensure = "Present" - InstallAccount = $params.InstallAccount - } - } - default { - Path = $params.Path - ServiceAppName = $params.ServiceAppName - AuthenticationType = "Unknown" - RuleType = $crawlRule.Type.ToString() - CrawlConfigurationRules = $crawlConfigurationRules - Ensure = "Present" - InstallAccount = $params.InstallAccount - } - } - return $returnVal - } - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Path, - - [parameter(Mandatory = $true)] - [System.String] - $ServiceAppName, - - [parameter(Mandatory = $false)] - [ValidateSet("DefaultRuleAccess", - "BasicAccountRuleAccess", - "CertificateRuleAccess", - "NTLMAccountRuleAccess", - "FormRuleAccess", - "CookieRuleAccess", - "AnonymousAccess")] - [System.String] - $AuthenticationType, - - [parameter(Mandatory = $false)] - [ValidateSet("InclusionRule","ExclusionRule")] - [System.String] - $RuleType, - - [parameter(Mandatory = $false)] - [ValidateSet("FollowLinksNoPageCrawl", - "CrawlComplexUrls", - "CrawlAsHTTP")] - [System.String[]] - $CrawlConfigurationRules, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $AuthenticationCredentials, - - [parameter(Mandatory = $false)] - [System.String] - $CertificateName, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting Search Crawl Rule '$Path'" - - $result = Get-TargetResource @PSBoundParameters - - # AuthenticationType=CertificateName and CertificateRuleAccess parameters not specified - if ($AuthenticationType -eq "CertificateRuleAccess" -and -not $CertificateName) - { - throw ("When AuthenticationType=CertificateRuleAccess, the parameter " + ` - "CertificateName is required") - } - - # AuthenticationType=CertificateName and CertificateRuleAccess parameters not - # specified correctly - if ($AuthenticationType -ne "CertificateRuleAccess" -and $CertificateName) - { - throw "When specifying CertificateName, the AuthenticationType parameter is required" - } - - # AuthenticationType=NTLMAccountRuleAccess and AuthenticationCredentialsparameters - # not specified - if (($AuthenticationType -eq "NTLMAccountRuleAccess" ` - -or $AuthenticationType -eq "BasicAccountRuleAccess") ` - -and -not $AuthenticationCredentials) - { - throw ("When AuthenticationType is NTLMAccountRuleAccess or BasicAccountRuleAccess, " + ` - "the parameter AuthenticationCredentials is required") - } - - # AuthenticationCredentials parameters, but AuthenticationType is not NTLMAccountRuleAccess - # or BasicAccountRuleAccess - if ($AuthenticationCredentials ` - -and $AuthenticationType -ne "NTLMAccountRuleAccess" ` - -and $AuthenticationType -ne "BasicAccountRuleAccess") - { - throw ("When specifying AuthenticationCredentials, the AuthenticationType " + ` - "parameter is required") - } - - # ExclusionRule only with CrawlConfigurationRules=CrawlComplexUrls - if ($RuleType -eq "ExclusionRule" ` - -and ($CrawlConfigurationRules -contains "CrawlAsHTTP" ` - -or $CrawlConfigurationRules -contains "FollowLinksNoPageCrawl")) - { - throw ("When RuleType=ExclusionRule, CrawlConfigurationRules cannot contain " + ` - "the values FollowLinksNoPageCrawl or CrawlAsHTTP") - } - - # ExclusionRule cannot be used with AuthenticationCredentials, CertificateName or - # AuthenticationType parameters - if ($RuleType -eq "ExclusionRule" ` - -and ($AuthenticationCredentials -or $CertificateName -or $AuthenticationType)) - { - throw ("When Type=ExclusionRule, parameters AuthenticationCredentials, " + ` - "CertificateName or AuthenticationType are not allowed") - } - - if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") - { - Write-Verbose -Message "Creating Crawl Rule $Path" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $newParams = @{ - Path = $params.Path - SearchApplication = $params.ServiceAppName - } - if ($params.ContainsKey("AuthenticationType") -eq $true) - { - $newParams.Add("AuthenticationType", $params.AuthenticationType) - } - if ($params.ContainsKey("RuleType") -eq $true) - { - $newParams.Add("Type", $params.RuleType) - } - if ($params.ContainsKey("CrawlConfigurationRules") -eq $true) - { - if($params.CrawlConfigurationRules -contains "FollowLinksNoPageCrawl") - { - $newParams.Add("SuppressIndexing",1) - } - if($params.CrawlConfigurationRules -contains "CrawlComplexUrls") - { - $newParams.Add("FollowComplexUrls",1) - } - if($params.CrawlConfigurationRules -contains "CrawlAsHTTP") - { - $newParams.Add("CrawlAsHttp",1) - } - } - if ($params.ContainsKey("AuthenticationCredentials") -eq $true) - { - $newParams.Add("AccountName", $params.AuthenticationCredentials.UserName) - $newParams.Add("AccountPassword", $params.AuthenticationCredentials.Password) - } - if ($params.ContainsKey("CertificateName") -eq $true) - { - $newParams.Add("CertificateName", $params.CertificateName) - } - - New-SPEnterpriseSearchCrawlRule @newParams - } - } - if ($result.Ensure -eq "Present" -and $Ensure -eq "Present") - { - Write-Verbose -Message "Updating Crawl Rule $Path" - Invoke-SPDSCCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - $params = $args[0] - - $crawlRule = Get-SPEnterpriseSearchCrawlRule ` - -SearchApplication $params.ServiceAppName | Where-Object -FilterScript { - $_.Path -eq $params.Path - } - - if ($null -ne $crawlRule) - { - $setParams = @{ - Identity = $params.Path - SearchApplication = $params.ServiceAppName - } - if ($params.ContainsKey("AuthenticationType") -eq $true) - { - $setParams.Add("AuthenticationType", $params.AuthenticationType) - } - if ($params.ContainsKey("RuleType") -eq $true) - { - $setParams.Add("Type", $params.RuleType) - } - if ($params.ContainsKey("CrawlConfigurationRules") -eq $true) - { - if($params.CrawlConfigurationRules -contains "FollowLinksNoPageCrawl") - { - $setParams.Add("SuppressIndexing",1) - } - if($params.CrawlConfigurationRules -contains "CrawlComplexUrls") - { - $setParams.Add("FollowComplexUrls",1) - } - if($params.CrawlConfigurationRules -contains "CrawlAsHTTP") - { - $setParams.Add("CrawlAsHttp",1) - } - } - if ($params.ContainsKey("AuthenticationCredentials") -eq $true) - { - $setParams.Add("AccountName", $params.AuthenticationCredentials.UserName) - $setParams.Add("AccountPassword", $params.AuthenticationCredentials.Password) - } - if ($params.ContainsKey("CertificateName") -eq $true) - { - $setParams.Add("AccountName", $params.CertificateName) - } - Set-SPEnterpriseSearchCrawlRule @setParams - } - } - } - - if ($Ensure -eq "Absent") - { - Write-Verbose -Message "Removing Crawl Rule $Path" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - Remove-SPEnterpriseSearchCrawlRule -SearchApplication $params.ServiceAppName ` - -Identity $params.Path ` - -Confirm:$false - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Path, - - [parameter(Mandatory = $true)] - [System.String] - $ServiceAppName, - - [parameter(Mandatory = $false)] - [ValidateSet("DefaultRuleAccess", - "BasicAccountRuleAccess", - "CertificateRuleAccess", - "NTLMAccountRuleAccess", - "FormRuleAccess", - "CookieRuleAccess", - "AnonymousAccess")] - [System.String] - $AuthenticationType, - - [parameter(Mandatory = $false)] - [ValidateSet("InclusionRule","ExclusionRule")] - [System.String] - $RuleType, - - [parameter(Mandatory = $false)] - [ValidateSet("FollowLinksNoPageCrawl", - "CrawlComplexUrls", - "CrawlAsHTTP")] - [System.String[]] - $CrawlConfigurationRules, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $AuthenticationCredentials, - - [parameter(Mandatory = $false)] - [System.String] - $CertificateName, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing Search Crawl Rule '$Path'" - - $PSBoundParameters.Ensure = $Ensure - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($Ensure -eq "Present") - { - if ($CrawlConfigurationRules) - { - if ($CurrentValues.ContainsKey("CrawlConfigurationRules")) - { - $compareObject = Compare-Object ` - -ReferenceObject $CrawlConfigurationRules ` - -DifferenceObject $CurrentValues.CrawlConfigurationRules - if ($null -ne $compareObject) - { - return $false - } - } - else - { - return $false - } - } - - if ($CurrentValues.ContainsKey("AuthenticationCredentials") -and $AuthenticationCredentials) - { - if ($AuthenticationCredentials.UserName -ne $CurrentValues.AuthenticationCredentials) - { - return $false - } - } - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure", - "AuthenticationType", - "RuleType", - "CertificateName") - } else { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchCrawlRule/MSFT_SPSearchCrawlRule.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchCrawlRule/MSFT_SPSearchCrawlRule.schema.mof deleted file mode 100644 index 0df36c22..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchCrawlRule/MSFT_SPSearchCrawlRule.schema.mof +++ /dev/null @@ -1,14 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPSearchCrawlRule")] -class MSFT_SPSearchCrawlRule : OMI_BaseResource -{ - [Key, Description("The name of the search service application")] string Path; - [Required, Description("The name of the search service application")] string ServiceAppName; - [Write, Description("Authentication type used by the crawl rule"), ValueMap{"DefaultRuleAccess","BasicAccountRuleAccess","CertificateRuleAccess","NTLMAccountRuleAccess","FormRuleAccess","CookieRuleAccess","AnonymousAccess"}, Values{"DefaultRuleAccess","BasicAccountRuleAccess","CertificateRuleAccess","NTLMAccountRuleAccess","FormRuleAccess","CookieRuleAccess","AnonymousAccess"}] string AuthenticationType; - [Write, Description("The type of the rule"), ValueMap{"InclusionRule","ExclusionRule"}, Values{"InclusionRule","ExclusionRule"}] string RuleType; - [Write, Description("The configuration options for this rule"), ValueMap{"FollowLinksNoPageCrawl","CrawlComplexUrls","CrawlAsHTTP"}, Values{"FollowLinksNoPageCrawl","CrawlComplexUrls","CrawlAsHTTP"}] string CrawlConfigurationRules[]; - [Write, Description("The credentials used for this crawl rule (used for types BasicAccountRuleAccess and NTLMAccountRuleAccess)"), EmbeddedInstance("MSFT_Credential")] String AuthenticationCredentials; - [Write, Description("The certificate used for this crawl rule (used for type CertificateRuleAccess)")] string CertificateName; - [Write, Description("Present if the crawl rule should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchCrawlerImpactRule/MSFT_SPSearchCrawlerImpactRule.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchCrawlerImpactRule/MSFT_SPSearchCrawlerImpactRule.psm1 deleted file mode 100644 index 22b5586f..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchCrawlerImpactRule/MSFT_SPSearchCrawlerImpactRule.psm1 +++ /dev/null @@ -1,288 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $ServiceAppName, - - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [System.UInt32] - $RequestLimit = 0, - - [System.UInt32] - $WaitTime = 0, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting Crawler Impact Rule Setting for '$Name'" - - if(($RequestLimit -gt 0) -and ($WaitTime -gt 0)) - { - throw "Only one Crawler Impact Rule HitRate argument (RequestLimit, WaitTime) can be specified" - } - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $nullReturn = @{ - - ServiceAppName = $params.ServiceAppName - Name = $params.Name - RequestLimit = $null - WaitTime = $null - Ensure = "Absent" - InstallAccount = $params.InstallAccount - } - - - $serviceApp = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName - if($null -eq $serviceApp) - { - $nullReturn.ServiceAppName = $null - return $nullReturn - } - else - { - $crawlerImpactRule = Get-SPEnterpriseSearchSiteHitRule -Identity $params.Name -SearchService $serviceApp - if($null -eq $crawlerImpactRule) - { - return $nullReturn - } - else - { - if($crawlerImpactRule.Behavior -eq "0") - { - return @{ - ServiceAppName = $params.ServiceAppName - Name = $params.Name - RequestLimit = $crawlerImpactRule.HitRate - WaitTime = 0 - Ensure = "Present" - InstallAccount = $params.InstallAccount - } - } - else - { - return @{ - ServiceAppName = $params.ServiceAppName - Name = $params.Name - RequestLimit = 0 - WaitTime = $crawlerImpactRule.HitRate - Ensure = "Present" - InstallAccount = $params.InstallAccount - } - } - } - } - - - } - - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $ServiceAppName, - - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [System.UInt32] - $RequestLimit = 0, - - [System.UInt32] - $WaitTime = 0, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - - Write-Verbose -Message "Setting Crawler Impact Rule Setting for '$Name'" - - if(($RequestLimit -gt 0) -and ($WaitTime -gt 0)) - { - throw "Only one Crawler Impact Rule HitRate argument (RequestLimit, WaitTime) can be specified" - } - - $result = Get-TargetResource @PSBoundParameters - - if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") - { - Write-Verbose -Message "Creating Crawler Impact Rule $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - $behavior = "0" - $hitRate = 0 - if($null -eq $params.RequestLimit) - { - $behavior = "1" - $hitRate = $params.WaitTime - } - else - { - $behavior = "0" - $hitRate = $params.RequestLimit - } - - $serviceApp = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName - if($null -eq $serviceApp) - { - throw "The Search Service Application does not exist." - } - New-SPEnterpriseSearchSiteHitRule -Name $params.Name ` - -Behavior $behavior ` - -HitRate $hitRate ` - -SearchService $serviceApp - } - } - if ($result.Ensure -eq "Present" -and $Ensure -eq "Present") - { - Write-Verbose -Message "Updating Crawler Impact Rule $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - $behavior = "0" - $hitRate = 0 - if($null -eq $params.RequestLimit) - { - $behavior = "1" - $hitRate = $params.WaitTime - } - else - { - $behavior = "0" - $hitRate = $params.RequestLimit - } - $serviceApp = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName - if($null -eq $serviceApp) - { - throw "The Search Service Application does not exist." - } - - Remove-SPEnterpriseSearchSiteHitRule -Identity $params.Name ` - -SearchService $serviceApp ` - -ErrorAction SilentlyContinue - - New-SPEnterpriseSearchSiteHitRule -Name $params.Name ` - -Behavior $behavior ` - -HitRate $hitRate ` - -SearchService $serviceApp - - } - } - if($Ensure -eq "Absent") - { - Write-Verbose -Message "Removing Crawler Impact Rule $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - $serviceApp = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName - if($null -eq $serviceApp) - { - throw "The Search Service Application does not exist." - } - Remove-SPEnterpriseSearchSiteHitRule -Identity $params.Name ` - -SearchService $serviceApp ` - -ErrorAction SilentlyContinue - } - } - - -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $ServiceAppName, - - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [System.UInt32] - $RequestLimit = 0, - - [System.UInt32] - $WaitTime = 0, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [System.Management.Automation.PSCredential] - $InstallAccount - ) - Write-Verbose -Message "Testing Crawler Impact Rule Setting for '$Name'" - - if(($RequestLimit -gt 0) -and ($WaitTime -gt 0)) - { - throw "Only one Crawler Impact Rule HitRate argument (RequestLimit, WaitTime) can be specified" - } - - $behavior = "" - if($RequestLimit -ne 0) - { - $behavior = "RequestLimit" - } - else - { - $behavior = "WaitTime" - } - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if($Ensure -eq "Present") - { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ServiceAppName", - "Name", - $behavior) - } - else - { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ServiceAppName", - "Name", - "Ensure") - } -} - -Export-ModuleMember -Function *-TargetResource - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchCrawlerImpactRule/MSFT_SPSearchCrawlerImpactRule.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchCrawlerImpactRule/MSFT_SPSearchCrawlerImpactRule.schema.mof deleted file mode 100644 index 5b1062a4..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchCrawlerImpactRule/MSFT_SPSearchCrawlerImpactRule.schema.mof +++ /dev/null @@ -1,13 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("SPSearchCrawlerImpactRule")] -class MSFT_SPSearchCrawlerImpactRule : OMI_BaseResource -{ - [Key, Description("Search Service Application Name")] String ServiceAppName; - [Key, Description("The Site for the crawl impact rule")] String Name; - [Read, Description("The Behavior (RequestLimit or WaitTime) for this crawl impact rule")] String Behavior; - [Write, Description("The RequestLimit setting for the crawl impact rule")] UInt32 RequestLimit; - [Write, Description("The WaitTime setting for the crawl impact rule")] UInt32 WaitTime; - [Write, Description("Ensure the crawl rule is Present or Absent"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, EmbeddedInstance("MSFT_Credential"), Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5")] String InstallAccount; -}; - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchFileType/MSFT_SPSearchFileType.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchFileType/MSFT_SPSearchFileType.psm1 deleted file mode 100644 index 52f1c652..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchFileType/MSFT_SPSearchFileType.psm1 +++ /dev/null @@ -1,343 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $FileType, - - [parameter(Mandatory = $true)] - [System.String] - $ServiceAppName, - - [parameter(Mandatory = $false)] - [System.String] - $Description, - - [parameter(Mandatory = $false)] - [System.String] - $MimeType, - - [parameter(Mandatory = $false)] - [System.Boolean] - $Enabled, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting Search File Type '$FileType'" - - if ($Ensure -eq "Present" -and ` - (-not($PSBoundParameters.ContainsKey("MimeType")) -or ` - -not($PSBoundParameters.ContainsKey("Description")))) - { - Write-Verbose -Message "Ensure is configured as Present, but MimeType and/or Description is missing" - $nullReturn = @{ - FileType = $params.FileType - ServiceAppName = $params.ServiceAppName - Ensure = "Absent" - InstallAccount = $params.InstallAccount - } - return $nullReturn - } - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $serviceApps = Get-SPServiceApplication -Name $params.ServiceAppName ` - -ErrorAction SilentlyContinue - - $nullReturn = @{ - FileType = $params.FileType - ServiceAppName = $params.ServiceAppName - Ensure = "Absent" - InstallAccount = $params.InstallAccount - } - - if ($null -eq $serviceApps) - { - Write-Verbose -Message "Service Application $($params.ServiceAppName) is not found" - return $nullReturn - } - - $serviceApp = $serviceApps | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" - } - - if ($null -eq $serviceApp) - { - Write-Verbose -Message "Service Application $($params.ServiceAppName) is not a search service application" - return $nullReturn - } - else - { - $fileType = Get-SPEnterpriseSearchFileFormat ` - -SearchApplication $params.ServiceAppName | Where-Object -FilterScript { - $_.Identity -eq $params.FileType - } - - if ($null -eq $fileType) - { - Write-Verbose -Message "File Type $($params.FileType) not found" - return $nullReturn - } - else - { - $returnVal = @{ - FileType = $params.FileType - ServiceAppName = $params.ServiceAppName - Description = $fileType.Name - MimeType = $fileType.MimeType - Enabled = $fileType.Enabled - Ensure = "Present" - InstallAccount = $params.InstallAccount - } - - return $returnVal - } - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $FileType, - - [parameter(Mandatory = $true)] - [System.String] - $ServiceAppName, - - [parameter(Mandatory = $false)] - [System.String] - $Description, - - [parameter(Mandatory = $false)] - [System.String] - $MimeType, - - [parameter(Mandatory = $false)] - [System.Boolean] - $Enabled, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting Search File Type '$FileType'" - - if ($Ensure -eq "Present" -and ` - (-not($PSBoundParameters.ContainsKey("MimeType")) -or ` - -not($PSBoundParameters.ContainsKey("Description")))) - { - throw "Ensure is configured as Present, but MimeType and/or Description is missing" - } - - $PSBoundParameters.Ensure = $Ensure - - $result = Get-TargetResource @PSBoundParameters - - Write-Verbose -Message "Checking if Service Application '$ServiceAppName' exists" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $serviceApps = Get-SPServiceApplication -Name $params.ServiceAppName ` - -ErrorAction SilentlyContinue - - if ($null -eq $serviceApps) - { - throw "Service Application $($params.ServiceAppName) is not found" - } - - $serviceApp = $serviceApps | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" - } - - if ($null -eq $serviceApp) - { - throw "Service Application $($params.ServiceAppName) is not a search service application" - } - } - - if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") - { - Write-Verbose -Message "Creating File Type $FileType" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $newParams = @{ - FormatId = $params.FileType - SearchApplication = $params.ServiceAppName - FormatName = $params.Description - MimeType = $params.MimeType - } - - New-SPEnterpriseSearchFileFormat @newParams - - if ($params.ContainsKey("Enabled") -eq $true) - { - $stateParams = @{ - Identity = $params.FileType - SearchApplication = $params.ServiceAppName - Enable = $params.Enabled - } - Set-SPEnterpriseSearchFileFormatState @stateParams - } - } - } - - if ($result.Ensure -eq "Present" -and $Ensure -eq "Present") - { - Write-Verbose -Message "Updating File Type $FileType" - Invoke-SPDSCCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - $params = $args[0] - - $fileType = Get-SPEnterpriseSearchFileFormat ` - -SearchApplication $params.ServiceAppName | Where-Object -FilterScript { - $_.Identity -eq $params.FileType - } - - if ($null -ne $fileType) - { - if (($fileType.MimeType -ne $params.MimeType) -or - ($fileType.Name -ne $params.Description)) - { - Remove-SPEnterpriseSearchFileFormat -Identity $params.FileType ` - -SearchApplication $params.ServiceAppName ` - -Confirm:$false - - $newParams = @{ - FormatId = $params.FileType - SearchApplication = $params.ServiceAppName - FormatName = $params.Description - MimeType = $params.MimeType - } - - New-SPEnterpriseSearchFileFormat @newParams - } - - if ($params.ContainsKey("Enabled") -eq $true) - { - if ($fileType.Enabled -ne $params.Enabled) - { - $stateParams = @{ - Identity = $params.FileType - SearchApplication = $params.ServiceAppName - Enable = $params.Enabled - } - - Set-SPEnterpriseSearchFileFormatState @stateParams - } - } - } - } - } - - if ($Ensure -eq "Absent") - { - Write-Verbose -Message "Removing Crawl Rule $Path" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - Remove-SPEnterpriseSearchFileFormat -Identity $params.FileType ` - -SearchApplication $params.ServiceAppName ` - -Confirm:$false - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $FileType, - - [parameter(Mandatory = $true)] - [System.String] - $ServiceAppName, - - [parameter(Mandatory = $false)] - [System.String] - $Description, - - [parameter(Mandatory = $false)] - [System.String] - $MimeType, - - [parameter(Mandatory = $false)] - [System.Boolean] - $Enabled, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing Search File Type '$FileType'" - - $PSBoundParameters.Ensure = $Ensure - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($Ensure -eq "Present") - { - if ($PSBoundParameters.ContainsKey("Enabled") -eq $true) - { - if ($Enabled -ne $CurrentValues.Enabled) - { - return $false - } - } - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure", - "Description", - "MimeType") - } - else - { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchFileType/MSFT_SPSearchFileType.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchFileType/MSFT_SPSearchFileType.schema.mof deleted file mode 100644 index 06d07da6..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchFileType/MSFT_SPSearchFileType.schema.mof +++ /dev/null @@ -1,12 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPSearchFileType")] -class MSFT_SPSearchFileType : OMI_BaseResource -{ - [Key, Description("The name of the file type")] string FileType; - [Key, Description("The name of the search service application")] string ServiceAppName; - [Write, Description("The description of the file type")] string Description; - [Write, Description("The mime type of the file type")] string MimeType; - [Write, Description("The state of the file type")] boolean Enabled; - [Write, Description("Present if the file type should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchIndexPartition/MSFT_SPSearchIndexPartition.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchIndexPartition/MSFT_SPSearchIndexPartition.psm1 deleted file mode 100644 index 1cceafbc..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchIndexPartition/MSFT_SPSearchIndexPartition.psm1 +++ /dev/null @@ -1,261 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.UInt32] - $Index, - - [parameter(Mandatory = $true)] - [System.String[]] - $Servers, - - [parameter(Mandatory = $false)] - [System.String] - $RootDirectory, - - [parameter(Mandatory = $true)] - [System.String] - $ServiceAppName, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting Search Index Partition '$Index' settings" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - $ConfirmPreference = 'None' - - $ssa = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName - $currentTopology = $ssa.ActiveTopology - - $IndexComponents = (Get-SPEnterpriseSearchComponent -SearchTopology $currentTopology | ` - Where-Object -FilterScript { - ($_.GetType().Name -eq "IndexComponent") ` - -and ($_.IndexPartitionOrdinal -eq $params.Index) - }).ServerName - - return @{ - Index = $params.Index - Servers = $IndexComponents - RootDirectory = $params.RootDirectory - ServiceAppName = $params.ServiceAppName - InstallAccount = $params.InstallAccount - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.UInt32] - $Index, - - [parameter(Mandatory = $true)] - [System.String[]] - $Servers, - - [parameter(Mandatory = $false)] - [System.String] - $RootDirectory, - - [parameter(Mandatory = $true)] - [System.String] - $ServiceAppName, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting Search Index Partition '$Index' settings" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $CurrentValues) ` - -ScriptBlock { - $params = $args[0] - $CurrentValues = $args[1] - $ConfirmPreference = 'None' - - $AllSearchServers = $params.Servers - - # Ensure the search service instance is running on all servers - foreach($searchServer in $AllSearchServers) - { - $searchService = Get-SPEnterpriseSearchServiceInstance -Identity $searchServer - if($searchService.Status -eq "Offline") - { - Write-Verbose -Message "Start Search Service Instance" - Start-SPEnterpriseSearchServiceInstance -Identity $searchService - } - - #Wait for Search Service Instance to come online - $loopCount = 0 - $online = Get-SPEnterpriseSearchServiceInstance -Identity $searchServer - do - { - $online = Get-SPEnterpriseSearchServiceInstance -Identity $searchServer - Write-Verbose -Message "Waiting for service: $($online.TypeName)" - $loopCount++ - Start-Sleep -Seconds 30 - } - until ($online.Status -eq "Online" -or $loopCount -eq 20) - } - - if ($params.ContainsKey("RootDirectory") -eq $true) - { - # Create the index partition directory on each remote server - foreach($IndexPartitionServer in $params.Servers) - { - $networkPath = "\\$IndexPartitionServer\" + $params.RootDirectory.Replace(":\", "$\") - New-Item -Path $networkPath -ItemType Directory -Force - } - - # Create the directory on the local server as it will not apply the topology without it - if ((Test-Path -Path $params.RootDirectory) -eq $false) - { - New-Item $params.RootDirectory -ItemType Directory -Force - } - } - - # Get all service service instances to assign topology components to - $AllSearchServiceInstances = @{} - foreach ($server in $AllSearchServers) - { - $si = Get-SPEnterpriseSearchServiceInstance -Identity $server - $AllSearchServiceInstances.Add($server, $si) - } - - # Get current topology and prepare a new one - $ssa = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName - $currentTopology = $ssa.ActiveTopology - $newTopology = New-SPEnterpriseSearchTopology -SearchApplication $ssa ` - -Clone ` - -SearchTopology $currentTopology - - $componentTypes = @{ - Servers = "IndexComponent" - } - - # Build up the topology changes for each object type - @("Servers") | ForEach-Object -Process { - $CurrentSearchProperty = $_ - Write-Verbose -Message "Setting components for '$CurrentSearchProperty' property" - - if ($null -eq $CurrentValues.$CurrentSearchProperty) - { - $ComponentsToAdd = $params.$CurrentSearchProperty - } - else - { - $ComponentsToAdd = @() - $ComponentsToRemove = @() - - $components = $params.$CurrentSearchProperty | Where-Object -FilterScript { - $CurrentValues.$CurrentSearchProperty.Contains($_) -eq $false - } - foreach($component in $components) - { - $ComponentsToAdd += $component - } - $components = $CurrentValues.$CurrentSearchProperty | Where-Object -FilterScript { - $params.$CurrentSearchProperty.Contains($_) -eq $false - } - foreach($component in $components) - { - $ComponentsToRemove += $component - } - } - foreach($componentToAdd in $ComponentsToAdd) - { - $NewComponentParams = @{ - SearchTopology = $newTopology - SearchServiceInstance = $AllSearchServiceInstances.$componentToAdd - } - switch($componentTypes.$CurrentSearchProperty) - { - "IndexComponent" { - $NewComponentParams.Add("IndexPartition", $params.Index) - if ($params.ContainsKey("RootDirectory") -eq $true) - { - if ([string]::IsNullOrEmpty($params.RootDirectory) -eq $false) - { - $NewComponentParams.Add("RootDirectory", $params.RootDirectory) - } - } - New-SPEnterpriseSearchIndexComponent @NewComponentParams - } - } - } - foreach($componentToRemove in $ComponentsToRemove) - { - $component = Get-SPEnterpriseSearchComponent -SearchTopology $newTopology | ` - Where-Object -FilterScript { - ($_.GetType().Name -eq $componentTypes.$CurrentSearchProperty) ` - -and ($_.ServerName -eq $componentToRemove) ` - -and ($_.IndexPartitionOrdinal -eq $params.Index) - } - if ($null -ne $component) - { - $component | Remove-SPEnterpriseSearchComponent -SearchTopology $newTopology ` - -Confirm:$false - } - - } - } - - # Apply the new topology - Set-SPEnterpriseSearchTopology -Identity $newTopology - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.UInt32] - $Index, - - [parameter(Mandatory = $true)] - [System.String[]] - $Servers, - - [parameter(Mandatory = $false)] - [System.String] - $RootDirectory, - - [parameter(Mandatory = $true)] - [System.String] - $ServiceAppName, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing Search Index Partition '$Index' settings" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Servers") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchIndexPartition/MSFT_SPSearchIndexPartition.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchIndexPartition/MSFT_SPSearchIndexPartition.schema.mof deleted file mode 100644 index 3ba702ed..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchIndexPartition/MSFT_SPSearchIndexPartition.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPSearchIndexPartition")] -class MSFT_SPSearchIndexPartition : OMI_BaseResource -{ - [Key, Description("The number of the partition in this farm")] Uint32 Index; - [Required, Description("A list of the servers that this partition should exist on")] String Servers[]; - [Write, Description("The directory that the index should use locally on each server to store data")] String RootDirectory; - [Key, Description("The name of the search service application")] String ServiceAppName; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchResultSource/MSFT_SPSearchResultSource.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchResultSource/MSFT_SPSearchResultSource.psm1 deleted file mode 100644 index 45eece8b..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchResultSource/MSFT_SPSearchResultSource.psm1 +++ /dev/null @@ -1,292 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $SearchServiceAppName, - - [parameter(Mandatory = $true)] - [System.String] - $Query, - - [parameter(Mandatory = $true)] - [ValidateSet("Exchange Search Provider", - "Local People Provider", - "Local SharePoint Provider", - "OpenSearch Provider", - "Remote People Provider", - "Remote SharePoint Provider")] - [System.String] - $ProviderType, - - [parameter(Mandatory = $false)] - [System.String] - $ConnectionUrl, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting search result source '$Name'" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - [void] [Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server.Search") - - $nullReturn = @{ - Name = $params.Name - SearchServiceAppName = $params.SearchServiceAppName - Query = $null - ProviderType = $null - ConnectionUrl = $null - Ensure = "Absent" - InstallAccount = $params.InstallAccount - } - $serviceApp = Get-SPEnterpriseSearchServiceApplication -Identity $params.SearchServiceAppName - $searchSiteUrl = $serviceApp.SearchCenterUrl -replace "/pages" - $searchSite = Get-SPWeb -Identity $searchSiteUrl -ErrorAction SilentlyContinue - - if ($null -eq $searchSite) - { - Write-Verbose -Message ("Search centre site collection does not exist at " + ` - "$searchSiteUrl. Unable to create search context " + ` - "to determine result source details.") - return $nullReturn - } - - $adminNamespace = "Microsoft.Office.Server.Search.Administration" - $queryNamespace = "Microsoft.Office.Server.Search.Administration.Query" - $objectLevel = [Microsoft.Office.Server.Search.Administration.SearchObjectLevel] - $fedManager = New-Object -TypeName "$queryNamespace.FederationManager" ` - -ArgumentList $serviceApp - $searchOwner = New-Object -TypeName "$adminNamespace.SearchObjectOwner" ` - -ArgumentList @( - $objectLevel::Ssa, - $searchSite - ) - - $source = $fedManager.GetSourceByName($params.Name, $searchOwner) - - if ($null -ne $source) - { - $providers = $fedManager.ListProviders() - $provider = $providers.Values | Where-Object -FilterScript { - $_.Id -eq $source.ProviderId - } - return @{ - Name = $params.Name - SearchServiceAppName = $params.SearchServiceAppName - Query = $source.QueryTransform.QueryTemplate - ProviderType = $provider.Name - ConnectionUrl = $source.ConnectionUrlTemplate - Ensure = "Present" - InstallAccount = $params.InstallAccount - } - } - else - { - return $nullReturn - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $SearchServiceAppName, - - [parameter(Mandatory = $true)] - [System.String] - $Query, - - [parameter(Mandatory = $true)] - [ValidateSet("Exchange Search Provider", - "Local People Provider", - "Local SharePoint Provider", - "OpenSearch Provider", - "Remote People Provider", - "Remote SharePoint Provider")] - [System.String] - $ProviderType, - - [parameter(Mandatory = $false)] - [System.String] - $ConnectionUrl, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting search result source '$Name'" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($CurrentValues.Ensure -eq "Absent" -and $Ensure -eq "Present") - { - Write-Verbose -Message "Creating search result source $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - [void] [Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server.Search") - - $serviceApp = Get-SPEnterpriseSearchServiceApplication ` - -Identity $params.SearchServiceAppName - - $searchSiteUrl = $serviceApp.SearchCenterUrl -replace "/pages" - $searchSite = Get-SPWeb -Identity $searchSiteUrl -ErrorAction SilentlyContinue - - if ($null -eq $searchSite) - { - throw ("Search centre site collection does not exist at " + ` - "$searchSiteUrl. Unable to create search context " + ` - "to set result source.") - return - } - - $adminNamespace = "Microsoft.Office.Server.Search.Administration" - $queryNamespace = "Microsoft.Office.Server.Search.Administration.Query" - $objectLevel = [Microsoft.Office.Server.Search.Administration.SearchObjectLevel] - $fedManager = New-Object -TypeName "$queryNamespace.FederationManager" ` - -ArgumentList $serviceApp - $searchOwner = New-Object -TypeName "$adminNamespace.SearchObjectOwner" ` - -ArgumentList @( - $objectLevel::Ssa, - $searchSite - ) - - $transformType = "Microsoft.Office.Server.Search.Query.Rules.QueryTransformProperties" - $queryProperties = New-Object -TypeName $transformType - $resultSource = $fedManager.CreateSource($searchOwner) - $resultSource.Name = $params.Name - $providers = $fedManager.ListProviders() - $provider = $providers.Values | Where-Object -FilterScript { - $_.Name -eq $params.ProviderType - } - $resultSource.ProviderId = $provider.Id - $resultSource.CreateQueryTransform($queryProperties, $params.Query) - if ($params.ContainsKey("ConnectionUrl") -eq $true) - { - $resultSource.ConnectionUrlTemplate = $params.ConnectionUrl - } - $resultSource.Commit() - } - } - - if ($Ensure -eq "Absent") - { - Write-Verbose -Message "Removing search result source $Name" - Invoke-SPDSCCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - $params = $args[0] - [void] [Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server.Search") - - $serviceApp = Get-SPEnterpriseSearchServiceApplication ` - -Identity $params.SearchServiceAppName - - $searchSiteUrl = $serviceApp.SearchCenterUrl -replace "/pages" - $searchSite = Get-SPWeb -Identity $searchSiteUrl - - $adminNamespace = "Microsoft.Office.Server.Search.Administration" - $queryNamespace = "Microsoft.Office.Server.Search.Administration.Query" - $objectLevel = [Microsoft.Office.Server.Search.Administration.SearchObjectLevel] - $fedManager = New-Object -TypeName "$queryNamespace.FederationManager" ` - -ArgumentList $serviceApp - $searchOwner = New-Object -TypeName "$adminNamespace.SearchObjectOwner" ` - -ArgumentList @( - $objectLevel::Ssa, - $searchSite - ) - - $source = $fedManager.GetSourceByName($params.Name, $searchOwner) - if ($null -ne $source) - { - $fedManager.RemoveSource($source) - } - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $SearchServiceAppName, - - [parameter(Mandatory = $true)] - [System.String] - $Query, - - [parameter(Mandatory = $true)] - [ValidateSet("Exchange Search Provider", - "Local People Provider", - "Local SharePoint Provider", - "OpenSearch Provider", - "Remote People Provider", - "Remote SharePoint Provider")] - [System.String] - $ProviderType, - - [parameter(Mandatory = $false)] - [System.String] - $ConnectionUrl, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing search result source '$Name'" - - $PSBoundParameters.Ensure = $Ensure - - $CurrentValues = Get-TargetResource @PSBoundParameters - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchResultSource/MSFT_SPSearchResultSource.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchResultSource/MSFT_SPSearchResultSource.schema.mof deleted file mode 100644 index 7960da7b..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchResultSource/MSFT_SPSearchResultSource.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPSearchResultSource")] -class MSFT_SPSearchResultSource : OMI_BaseResource -{ - [Key, Description("The name of the result source")] String Name; - [Required, Description("The name of the search service application to associate this result source with")] String SearchServiceAppName; - [Required, Description("The query to pass to the provider source")] String Query; - [Required, Description("The provider type to use for the result source"), ValueMap{"Exchange Search Provider","Local People Provider","Local SharePoint Provider","OpenSearch Provider","Remote People Provider","Remote SharePoint Provider"}, Values{"Exchange Search Provider","Local People Provider","Local SharePoint Provider","OpenSearch Provider","Remote People Provider","Remote SharePoint Provider"}] String ProviderType; - [Write, Description("The URI to connect to the remote location")] String ConnectionUrl; - [Write, Description("Present if the result source should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchServiceApp/MSFT_SPSearchServiceApp.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchServiceApp/MSFT_SPSearchServiceApp.psm1 deleted file mode 100644 index 5a33366e..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchServiceApp/MSFT_SPSearchServiceApp.psm1 +++ /dev/null @@ -1,453 +0,0 @@ -function Get-TargetResource -{ - # Ignoring this because we need to generate a stub credential to return up the current - # crawl account as a PSCredential - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $ProxyName, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.String] - $SearchCenterUrl, - - [parameter(Mandatory = $false)] - [System.Boolean] - $CloudIndex, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $DefaultContentAccessAccount, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $WindowsServiceAccount, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting Search service application '$Name'" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` - -ScriptBlock { - $params = $args[0] - $scriptRoot = $args[1] - - Import-Module -Name (Join-Path $scriptRoot "MSFT_SPSearchServiceApp.psm1") - - [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") - [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Administration") - [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server.Search.Administration") - [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server.Search") - [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server") - - $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue - - $nullReturn = @{ - Name = $params.Name - ApplicationPool = $params.ApplicationPool - Ensure = "Absent" - } - - if ($null -eq $serviceApps) - { - return $nullReturn - } - $serviceApp = $serviceApps | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" - } - - if ($null -eq $serviceApp) - { - return $nullReturn - } - else - { - $c = [Microsoft.Office.Server.Search.Administration.SearchContext]::GetContext($serviceApp.Name) - $sc = New-Object -TypeName Microsoft.Office.Server.Search.Administration.Content ` - -ArgumentList $c; - $dummyPassword = ConvertTo-SecureString -String "-" -AsPlainText -Force - $defaultAccount = New-Object -TypeName System.Management.Automation.PSCredential ` - -ArgumentList @($sc.DefaultGatheringAccount, $dummyPassword) - - $cloudIndex = $false - $version = Get-SPDSCInstalledProductVersion - if(($version.FileMajorPart -gt 15) ` - -or ($version.FileMajorPart -eq 15 -and $version.FileBuildPart -ge 4745)) - { - $cloudIndex = $serviceApp.CloudIndex - } - - $serviceAppProxies = Get-SPServiceApplicationProxy -ErrorAction SilentlyContinue - if ($null -ne $serviceAppProxies) - { - $serviceAppProxy = $serviceAppProxies | Where-Object -FilterScript { - $serviceApp.IsConnected($_) - } - if ($null -ne $serviceAppProxy) - { - $proxyName = $serviceAppProxy.Name - } - } - - $searchService = Get-SPEnterpriseSearchService - $windowsAccount = New-Object -TypeName System.Management.Automation.PSCredential ` - -ArgumentList @($searchService.ProcessIdentity, $dummyPassword) - - $returnVal = @{ - Name = $serviceApp.DisplayName - ProxyName = $proxyName - ApplicationPool = $serviceApp.ApplicationPool.Name - DatabaseName = $serviceApp.SearchAdminDatabase.Name - DatabaseServer = $serviceApp.SearchAdminDatabase.Server.Name - Ensure = "Present" - SearchCenterUrl = $serviceApp.SearchCenterUrl - DefaultContentAccessAccount = $defaultAccount - CloudIndex = $cloudIndex - WindowsServiceAccount = $windowsAccount - InstallAccount = $params.InstallAccount - } - return $returnVal - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $ProxyName, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.String] - $SearchCenterUrl, - - [parameter(Mandatory = $false)] - [System.Boolean] - $CloudIndex, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $DefaultContentAccessAccount, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $WindowsServiceAccount, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting Search service application '$Name'" - - $result = Get-TargetResource @PSBoundParameters - - if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") - { - # Create the service app as it doesn't exist - - Write-Verbose -Message "Creating Search Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - $params = $args[0] - - $serviceInstance = Get-SPEnterpriseSearchServiceInstance -Local - Start-SPEnterpriseSearchServiceInstance -Identity $serviceInstance ` - -ErrorAction SilentlyContinue - $newParams = @{ - Name = $params.Name - ApplicationPool = $params.ApplicationPool - } - if ($params.ContainsKey("DatabaseServer") -eq $true) - { - $newParams.Add("DatabaseServer", $params.DatabaseServer) - } - if ($params.ContainsKey("DatabaseName") -eq $true) - { - $newParams.Add("DatabaseName", $params.DatabaseName) - } - - if ($params.ContainsKey("CloudIndex") -eq $true -and $params.CloudIndex -eq $true) - { - $version = Get-SPDSCInstalledProductVersion - if (($version.FileMajorPart -gt 15) ` - -or ($version.FileMajorPart -eq 15 -and $version.FileBuildPart -ge 4745)) - { - $newParams.Add("CloudIndex", $params.CloudIndex) - } - else - { - throw ("Please install SharePoint 2016 or SharePoint 2013 with August " + ` - "2015 CU or higher before attempting to create a cloud enabled " + ` - "search service application") - } - } - - $app = New-SPEnterpriseSearchServiceApplication @newParams - if ($app) - { - if ($null -eq $params.ProxyName) - { - $pName = "$($params.Name) Proxy" - } - else - { - $pName = $params.ProxyName - } - New-SPEnterpriseSearchServiceApplicationProxy -Name $pName -SearchApplication $app - if ($params.ContainsKey("DefaultContentAccessAccount") -eq $true) - { - $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool - $account = $params.DefaultContentAccessAccount - $setParams = @{ - ApplicationPool = $appPool - Identity = $app - DefaultContentAccessAccountName = $account.UserName - DefaultContentAccessAccountPassword = $account.Password - } - Set-SPEnterpriseSearchServiceApplication @setParams - } - - if ($params.ContainsKey("SearchCenterUrl") -eq $true) - { - $serviceApp = Get-SPServiceApplication -Name $params.Name | ` - Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" - } - $serviceApp.SearchCenterUrl = $params.SearchCenterUrl - $serviceApp.Update() - } - - if ($params.ContainsKey("WindowsServiceAccount") -eq $true) - { - Set-SPEnterpriseSearchService -ServiceAccount $WindowsServiceAccount.UserName ` - -ServicePassword $WindowsServiceAccount.Password - } - } - } - } - - if ($result.Ensure -eq "Present" -and $Ensure -eq "Present") - { - # Update the service app that already exists - Write-Verbose -Message "Updating Search Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $result) ` - -ScriptBlock { - $params = $args[0] - $result = $args[1] - - $serviceApp = Get-SPServiceApplication -Name $params.Name | ` - Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" - } - $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool - $setParams = @{ - ApplicationPool = $appPool - Identity = $serviceApp - } - if ($params.ContainsKey("DefaultContentAccessAccount") -eq $true) - { - $account = $params.DefaultContentAccessAccount - $setParams.Add("DefaultContentAccessAccountName", $account.UserName) - $setParams.Add("DefaultContentAccessAccountPassword", $account.Password) - } - Set-SPEnterpriseSearchServiceApplication @setParams - - if ($params.ContainsKey("SearchCenterUrl") -eq $true) - { - $serviceApp = Get-SPServiceApplication -Name $params.Name | ` - Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" - } - $serviceApp.SearchCenterUrl = $params.SearchCenterUrl - $serviceApp.Update() - } - - if ($params.ContainsKey("WindowsServiceAccount") -eq $true -and ` - $result.WindowsServiceAccount.UserName -ne $params.WindowsServiceAccount.UserName) - { - Set-SPEnterpriseSearchService -ServiceAccount $params.WindowsServiceAccount.UserName ` - -ServicePassword $params.WindowsServiceAccount.Password - } - } - } - - if ($Ensure -eq "Absent") - { - # The service app should not exit - Write-Verbose -Message "Removing Search Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $serviceApp = Get-SPServiceApplication -Name $params.Name | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" - - } - - $proxies = Get-SPServiceApplicationProxy - foreach($proxyInstance in $proxies) - { - if($serviceApp.IsConnected($proxyInstance)) - { - $proxyInstance.Delete() - } - } - - Remove-SPServiceApplication -Identity $serviceApp -Confirm:$false - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $ProxyName, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.String] - $SearchCenterUrl, - - [parameter(Mandatory = $false)] - [System.Boolean] - $CloudIndex, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $DefaultContentAccessAccount, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $WindowsServiceAccount, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing Search service application '$Name'" - - $PSBoundParameters.Ensure = $Ensure - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($PSBoundParameters.ContainsKey("DefaultContentAccessAccount") ` - -and $Ensure -eq "Present") - { - if ($DefaultContentAccessAccount.UserName ` - -ne $CurrentValues.DefaultContentAccessAccount.UserName) - { - Write-Verbose -Message "Default content access account is different, returning false" - return $false - } - } - - if ($PSBoundParameters.ContainsKey("WindowsServiceAccount") ` - -and $Ensure -eq "Present") - { - if ($WindowsServiceAccount.UserName ` - -ne $CurrentValues.WindowsServiceAccount.UserName) - { - Write-Verbose -Message "Windows service account is different, returning false" - return $false - } - } - - if ($Ensure -eq "Present") - { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure", - "ApplicationPool", - "SearchCenterUrl") - } - else - { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchServiceApp/MSFT_SPSearchServiceApp.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchServiceApp/MSFT_SPSearchServiceApp.schema.mof deleted file mode 100644 index e187966a..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchServiceApp/MSFT_SPSearchServiceApp.schema.mof +++ /dev/null @@ -1,16 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPSearchServiceApp")] -class MSFT_SPSearchServiceApp : OMI_BaseResource -{ - [Key, Description("The name of the search service application")] string Name; - [Write, Description("The proxy name, if not specified will be /Name of service app/ Proxy")] string ProxyName; - [Required, Description("The application pool that it should run in")] string ApplicationPool; - [Write, Description("The URL of the enterprise search center site collection")] string SearchCenterUrl; - [Write, Description("The name of the database (noting that some search databases will use this as a prefix)")] string DatabaseName; - [Write, Description("The server that host the databases for this service application")] string DatabaseServer; - [Write, Description("The default content access account for this search service app"), EmbeddedInstance("MSFT_Credential")] String DefaultContentAccessAccount; - [Write, Description("Should this search service application be a cloud based service app")] boolean CloudIndex; - [Write, Description("Present if the service app should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("Sets the windows services for search to run as this account"), EmbeddedInstance("MSFT_Credential")] string WindowsServiceAccount; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchTopology/MSFT_SPSearchTopology.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchTopology/MSFT_SPSearchTopology.psm1 deleted file mode 100644 index 46f18249..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchTopology/MSFT_SPSearchTopology.psm1 +++ /dev/null @@ -1,484 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $ServiceAppName, - - [parameter(Mandatory = $true)] - [System.String[]] - $Admin, - - [parameter(Mandatory = $true)] - [System.String[]] - $Crawler, - - [parameter(Mandatory = $true)] - [System.String[]] - $ContentProcessing, - - [parameter(Mandatory = $true)] - [System.String[]] - $AnalyticsProcessing, - - [parameter(Mandatory = $true)] - [System.String[]] - $QueryProcessing, - - [parameter(Mandatory = $true)] - [System.String[]] - $IndexPartition, - - [parameter(Mandatory = $true)] - [System.String] - $FirstPartitionDirectory, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting Search Topology for '$ServiceAppName'" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - $ConfirmPreference = 'None' - - $ssa = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName - - if ($null -eq $ssa) - { - return $null - } - $currentTopology = $ssa.ActiveTopology - - $allServers = Get-SPServer | ForEach-Object -Process { - return New-Object -TypeName System.Object | ` - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value $_.Name ` - -PassThru | ` - Add-Member -MemberType NoteProperty ` - -Name Id ` - -Value $_.Id ` - -PassThru - } - - $allComponents = Get-SPEnterpriseSearchComponent -SearchTopology $currentTopology - - $AdminComponents = @() - $AdminComponents += ($allComponents | Where-Object -FilterScript { - ($_.GetType().Name -eq "AdminComponent") - }).ServerId | ForEach-Object -Process { - $serverId = $_ - $server = $allServers | Where-Object -FilterScript { - $_.Id -eq $serverId - } | Select-Object -First 1 - return $server.Name - } - - $CrawlComponents = @() - $CrawlComponents += ($allComponents | Where-Object -FilterScript { - ($_.GetType().Name -eq "CrawlComponent") - }).ServerId | ForEach-Object -Process { - $serverId = $_ - $server = $allServers | Where-Object -FilterScript { - $_.Id -eq $serverId - } | Select-Object -First 1 - return $server.Name - } - - $ContentProcessingComponents = @() - $ContentProcessingComponents += ($allComponents | Where-Object -FilterScript { - ($_.GetType().Name -eq "ContentProcessingComponent") - }).ServerId | ForEach-Object -Process { - $serverId = $_ - $server = $allServers | Where-Object -FilterScript { - $_.Id -eq $serverId - } | Select-Object -First 1 - return $server.Name - } - - $AnalyticsProcessingComponents = @() - $AnalyticsProcessingComponents += ($allComponents | Where-Object -FilterScript { - ($_.GetType().Name -eq "AnalyticsProcessingComponent") - }).ServerId | ForEach-Object -Process { - $serverId = $_ - $server = $allServers | Where-Object -FilterScript { - $_.Id -eq $serverId - } | Select-Object -First 1 - return $server.Name - } - - $QueryProcessingComponents = @() - $QueryProcessingComponents += ($allComponents | Where-Object -FilterScript { - ($_.GetType().Name -eq "QueryProcessingComponent") - }).ServerId | ForEach-Object -Process { - $serverId = $_ - $server = $allServers | Where-Object -FilterScript { - $_.Id -eq $serverId - } | Select-Object -First 1 - return $server.Name - } - - $IndexComponents = @() - $IndexComponents += ($allComponents | Where-Object -FilterScript { - ($_.GetType().Name -eq "IndexComponent") - }).ServerId | ForEach-Object -Process { - $serverId = $_ - $server = $allServers | Where-Object -FilterScript { - $_.Id -eq $serverId - } | Select-Object -First 1 - return $server.Name - } - - $domain = (Get-CimInstance -ClassName Win32_ComputerSystem).Domain - - return @{ - ServiceAppName = $params.ServiceAppName - Admin = $AdminComponents -replace ".$domain" - Crawler = $CrawlComponents -replace ".$domain" - ContentProcessing = $ContentProcessingComponents -replace ".$domain" - AnalyticsProcessing = $AnalyticsProcessingComponents -replace ".$domain" - QueryProcessing = $QueryProcessingComponents -replace ".$domain" - InstallAccount = $params.InstallAccount - FirstPartitionDirectory = $params.FirstPartitionDirectory - IndexPartition = $IndexComponents -replace ".$domain" - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $ServiceAppName, - - [parameter(Mandatory = $true)] - [System.String[]] - $Admin, - - [parameter(Mandatory = $true)] - [System.String[]] - $Crawler, - - [parameter(Mandatory = $true)] - [System.String[]] - $ContentProcessing, - - [parameter(Mandatory = $true)] - [System.String[]] - $AnalyticsProcessing, - - [parameter(Mandatory = $true)] - [System.String[]] - $QueryProcessing, - - [parameter(Mandatory = $true)] - [System.String[]] - $IndexPartition, - - [parameter(Mandatory = $true)] - [System.String] - $FirstPartitionDirectory, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting Search Topology for '$ServiceAppName'" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $CurrentValues) ` - -ScriptBlock { - - $params = $args[0] - $CurrentValues = $args[1] - $ConfirmPreference = 'None' - - $AllSearchServers = @() - $AllSearchServers += ($params.Admin | Where-Object -FilterScript { - ($AllSearchServers -contains $_) -eq $false - }) - $AllSearchServers += ($params.Crawler | Where-Object -FilterScript { - ($AllSearchServers -contains $_) -eq $false - }) - $AllSearchServers += ($params.ContentProcessing | Where-Object -FilterScript { - ($AllSearchServers -contains $_) -eq $false - }) - $AllSearchServers += ($params.AnalyticsProcessing | Where-Object -FilterScript { - ($AllSearchServers -contains $_) -eq $false - }) - $AllSearchServers += ($params.QueryProcessing | Where-Object -FilterScript { - ($AllSearchServers -contains $_) -eq $false - }) - $AllSearchServers += ($params.IndexPartition | Where-Object -FilterScript { - ($AllSearchServers -contains $_) -eq $false - }) - - # Ensure the search service instance is running on all servers - foreach($searchServer in $AllSearchServers) { - - $searchService = Get-SPEnterpriseSearchServiceInstance -Identity $searchServer ` - -ErrorAction SilentlyContinue - if ($null -eq $searchService) - { - $domain = (Get-CimInstance -ClassName Win32_ComputerSystem).Domain - $searchServer = "$searchServer.$domain" - $searchService = Get-SPEnterpriseSearchServiceInstance -Identity $searchServer - } - - if($searchService.Status -eq "Offline") - { - Write-Verbose -Message "Start Search Service Instance" - Start-SPEnterpriseSearchServiceInstance -Identity $searchServer - } - - # Wait for Search Service Instance to come online - $loopCount = 0 - $online = Get-SPEnterpriseSearchServiceInstance -Identity $searchServer - while ($online.Status -ne "Online" -and $loopCount -lt 15) - { - $online = Get-SPEnterpriseSearchServiceInstance -Identity $searchServer - Write-Verbose -Message ("$([DateTime]::Now.ToShortTimeString()) - Waiting for " + ` - "search service instance to start on $searchServer " + ` - "(waited $loopCount of 15 minutes)") - $loopCount++ - Start-Sleep -Seconds 60 - } - } - - # Create the index partition directory on each remote server - foreach($IndexPartitionServer in $params.IndexPartition) { - $networkPath = "\\$IndexPartitionServer\" + ` - $params.FirstPartitionDirectory.Replace(":\", "$\") - New-Item $networkPath -ItemType Directory -Force - } - - # Create the directory on the local server as it will not apply the topology without it - if ((Test-Path -Path $params.FirstPartitionDirectory) -eq $false) - { - New-Item $params.FirstPartitionDirectory -ItemType Directory -Force - } - - # Get all service service instances to assign topology components to - $AllSearchServiceInstances = @{} - foreach ($server in $AllSearchServers) { - $serverName = $server - $serviceToAdd = Get-SPEnterpriseSearchServiceInstance -Identity $server ` - -ErrorAction SilentlyContinue - if ($null -eq $serviceToAdd) - { - $domain = (Get-CimInstance -ClassName Win32_ComputerSystem).Domain - $server = "$server.$domain" - $serviceToAdd = Get-SPEnterpriseSearchServiceInstance -Identity $server - } - if ($null -eq $serviceToAdd) { - throw "Unable to locate a search service instance on $serverName" - } - $AllSearchServiceInstances.Add($serverName, $serviceToAdd) - } - - # Get current topology and prepare a new one - $ssa = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName - if ($null -eq $ssa) { - throw "Search service applications '$($params.ServiceAppName)' was not found" - return - } - $currentTopology = $ssa.ActiveTopology - $newTopology = New-SPEnterpriseSearchTopology -SearchApplication $ssa ` - -Clone ` - -SearchTopology $currentTopology - - $componentTypes = @{ - Admin = "AdminComponent" - Crawler = "CrawlComponent" - ContentProcessing = "ContentProcessingComponent" - AnalyticsProcessing = "AnalyticsProcessingComponent" - QueryProcessing = "QueryProcessingComponent" - IndexPartition = "IndexComponent" - } - - # Build up the topology changes for each object type - @("Admin", - "Crawler", - "ContentProcessing", - "AnalyticsProcessing", - "QueryProcessing", - "IndexPartition") | ForEach-Object -Process { - - $CurrentSearchProperty = $_ - Write-Verbose "Setting components for '$CurrentSearchProperty' property" - - if ($null -eq $CurrentValues.$CurrentSearchProperty) - { - $ComponentsToAdd = $params.$CurrentSearchProperty - } - else - { - $ComponentsToAdd = $params.$CurrentSearchProperty | Where-Object -FilterScript { - $CurrentValues.$CurrentSearchProperty -contains $_ -eq $false - } - - $ComponentsToRemove = $CurrentValues.$CurrentSearchProperty | Where-Object -FilterScript { - $params.$CurrentSearchProperty -contains $_ -eq $false - } - } - foreach($ComponentToAdd in $ComponentsToAdd) { - $NewComponentParams = @{ - SearchTopology = $newTopology - SearchServiceInstance = $AllSearchServiceInstances.$ComponentToAdd - } - switch($componentTypes.$CurrentSearchProperty) { - "AdminComponent" { - New-SPEnterpriseSearchAdminComponent @NewComponentParams - } - "CrawlComponent" { - New-SPEnterpriseSearchCrawlComponent @NewComponentParams - } - "ContentProcessingComponent" { - New-SPEnterpriseSearchContentProcessingComponent @NewComponentParams - } - "AnalyticsProcessingComponent" { - New-SPEnterpriseSearchAnalyticsProcessingComponent @NewComponentParams - } - "QueryProcessingComponent" { - New-SPEnterpriseSearchQueryProcessingComponent @NewComponentParams - } - "IndexComponent" { - $NewComponentParams.Add("IndexPartition", 0) - if ($params.ContainsKey("FirstPartitionDirectory") -eq $true) - { - if ([string]::IsNullOrEmpty($params.FirstPartitionDirectory) -eq $false) - { - $dir = $params.FirstPartitionDirectory - $NewComponentParams.Add("RootDirectory", $dir) - } - } - New-SPEnterpriseSearchIndexComponent @NewComponentParams - } - } - } - foreach($ComponentToRemove in $ComponentsToRemove) { - if ($componentTypes.$CurrentSearchProperty -eq "IndexComponent") - { - $component = Get-SPEnterpriseSearchComponent -SearchTopology $newTopology | ` - Where-Object -FilterScript { - ($_.GetType().Name -eq $componentTypes.$CurrentSearchProperty) ` - -and ($_.ServerName -eq $ComponentToRemove) ` - -and ($_.IndexPartitionOrdinal -eq 0) - } - } - else - { - $component = Get-SPEnterpriseSearchComponent -SearchTopology $newTopology | ` - Where-Object -FilterScript { - ($_.GetType().Name -eq $componentTypes.$CurrentSearchProperty) ` - -and ($_.ServerName -eq $ComponentToRemove) - } - } - if ($null -ne $component) - { - $component | Remove-SPEnterpriseSearchComponent -SearchTopology $newTopology ` - -confirm:$false - } - } - } - - # Look for components that have no server name and remove them - $idsWithNoName = (Get-SPEnterpriseSearchComponent -SearchTopology $newTopology | ` - Where-Object -FilterScript { - $null -eq $_.ServerName - }).ComponentId - $idsWithNoName | ForEach-Object -Process { - $id = $_ - Get-SPEnterpriseSearchComponent -SearchTopology $newTopology | ` - Where-Object -FilterScript { - $_.ComponentId -eq $id - } | ` - Remove-SPEnterpriseSearchComponent -SearchTopology $newTopology ` - -confirm:$false - } - - # Apply the new topology to the farm - Set-SPEnterpriseSearchTopology -Identity $newTopology - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $ServiceAppName, - - [parameter(Mandatory = $true)] - [System.String[]] - $Admin, - - [parameter(Mandatory = $true)] - [System.String[]] - $Crawler, - - [parameter(Mandatory = $true)] - [System.String[]] - $ContentProcessing, - - [parameter(Mandatory = $true)] - [System.String[]] - $AnalyticsProcessing, - - [parameter(Mandatory = $true)] - [System.String[]] - $QueryProcessing, - - [parameter(Mandatory = $true)] - [System.String[]] - $IndexPartition, - - [parameter(Mandatory = $true)] - [System.String] - $FirstPartitionDirectory, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing Search Topology for '$ServiceAppName'" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($null -eq $CurrentValues) - { - return $false - } - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @( - "Admin", - "Crawler", - "ContentProcessing", - "AnalyticsProcessing", - "QueryProcessing", - "IndexPartition" - ) -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchTopology/MSFT_SPSearchTopology.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchTopology/MSFT_SPSearchTopology.schema.mof deleted file mode 100644 index 661fae08..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSearchTopology/MSFT_SPSearchTopology.schema.mof +++ /dev/null @@ -1,13 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPSearchTopology")] -class MSFT_SPSearchTopology : OMI_BaseResource -{ - [Key, Description("The name of the search service application for this topology")] String ServiceAppName; - [Required, Description("A list of servers that will run the admin component")] String Admin[]; - [Required, Description("A list of servers that will run the crawler component")] String Crawler[]; - [Required, Description("A list of servers that will run the content processing component")] String ContentProcessing[]; - [Required, Description("A list of servers that will run the analytics processing component")] String AnalyticsProcessing[]; - [Required, Description("A list of servers that will run the query processing component")] String QueryProcessing[]; - [Required, Description("A list of servers that will host the first (0) index partition")] String IndexPartition[]; - [Required, Description("The local directory servers will use to store the first index partition")] String FirstPartitionDirectory; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSecureStoreServiceApp/MSFT_SPSecureStoreServiceApp.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSecureStoreServiceApp/MSFT_SPSecureStoreServiceApp.psm1 deleted file mode 100644 index df431dfa..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSecureStoreServiceApp/MSFT_SPSecureStoreServiceApp.psm1 +++ /dev/null @@ -1,408 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $ProxyName, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $true)] - [System.Boolean] - $AuditingEnabled, - - [parameter(Mandatory = $false)] - [System.UInt32] - $AuditlogMaxSize, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.String] - $FailoverDatabaseServer, - - [parameter(Mandatory = $false)] - [System.Boolean] - $PartitionMode, - - [parameter(Mandatory = $false)] - [System.Boolean] - $Sharing, - - [parameter(Mandatory = $false)] - [ValidateSet("Windows", "SQL")] - [System.String] - $DatabaseAuthenticationType, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $DatabaseCredentials, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting secure store service application '$Name'" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $nullReturn = @{ - Name = $params.Name - ApplicationPool = $params.ApplicationPool - AuditingEnabled = $false - Ensure = "Absent" - } - - $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue - if ($null -eq $serviceApps) - { - return $nullReturn - } - $serviceApp = $serviceApps | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.SecureStoreService.Server.SecureStoreServiceApplication" - } - - if ($null -eq $serviceApp) - { - return $nullReturn - } - else - { - $serviceAppProxies = Get-SPServiceApplicationProxy -ErrorAction SilentlyContinue - if ($null -ne $serviceAppProxies) - { - $serviceAppProxy = $serviceAppProxies | Where-Object -FilterScript { - $serviceApp.IsConnected($_) - } - if ($null -ne $serviceAppProxy) - { - $proxyName = $serviceAppProxy.Name - } - } - - $propertyFlags = [System.Reflection.BindingFlags]::Instance ` - -bor [System.Reflection.BindingFlags]::NonPublic - - $propData = $serviceApp.GetType().GetProperties($propertyFlags) - - $dbProp = $propData | Where-Object -FilterScript { - $_.Name -eq "Database" - } - - $db = $dbProp.GetValue($serviceApp) - - return @{ - Name = $serviceApp.DisplayName - ProxyName = $proxyName - ApplicationPool = $serviceApp.ApplicationPool.Name - DatabaseName = $db.Name - DatabaseServer = $db.Server.Name - FailoverDatabaseServer = $db.FailoverServer - InstallAccount = $params.InstallAccount - Ensure = "Present" - } - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $ProxyName, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $true)] - [System.Boolean] - $AuditingEnabled, - - [parameter(Mandatory = $false)] - [System.UInt32] - $AuditlogMaxSize, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.String] - $FailoverDatabaseServer, - - [parameter(Mandatory = $false)] - [System.Boolean] - $PartitionMode, - - [parameter(Mandatory = $false)] - [System.Boolean] - $Sharing, - - [parameter(Mandatory = $false)] - [ValidateSet("Windows", "SQL")] - [System.String] - $DatabaseAuthenticationType, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $DatabaseCredentials, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting secure store service application '$Name'" - - $result = Get-TargetResource @PSBoundParameters - $params = $PSBoundParameters - - if ((($params.ContainsKey("DatabaseAuthenticationType") -eq $true) -and ` - ($params.ContainsKey("DatabaseCredentials") -eq $false)) -or ` - (($params.ContainsKey("DatabaseCredentials") -eq $true) -and ` - ($params.ContainsKey("DatabaseAuthenticationType") -eq $false))) - { - throw ("Where DatabaseCredentials are specified you must also specify " + ` - "DatabaseAuthenticationType to identify the type of credentials being passed") - return - } - - if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") - { - Write-Verbose -Message "Creating Secure Store Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $params ` - -ScriptBlock { - $params = $args[0] - - if ($params.ContainsKey("Ensure")) - { - $params.Remove("Ensure") | Out-Null - } - if ($params.ContainsKey("InstallAccount")) - { - $params.Remove("InstallAccount") | Out-Null - } - - if($params.ContainsKey("DatabaseAuthenticationType")) - { - if ($params.DatabaseAuthenticationType -eq "SQL") - { - $params.Add("DatabaseUsername", $params.DatabaseCredentials.Username) - $params.Add("DatabasePassword", $params.DatabaseCredentials.Password) - } - $params.Remove("DatabaseAuthenticationType") - } - - if ($params.ContainsKey("ProxyName")) - { - $pName = $params.ProxyName - $params.Remove("ProxyName") | Out-Null - } - if ($null -eq $pName) - { - $pName = "$($params.Name) Proxy" - } - New-SPSecureStoreServiceApplication @params | New-SPSecureStoreServiceApplicationProxy -Name $pName - } - } - - if ($result.Ensure -eq "Present" -and $Ensure -eq "Present") - { - if ($PSBoundParameters.ContainsKey("DatabaseServer") -and ` - ($result.DatabaseServer -ne $DatabaseServer)) - { - throw ("Specified database server does not match the actual " + ` - "database server. This resource cannot move the database " + ` - "to a different SQL instance.") - } - - if ($PSBoundParameters.ContainsKey("DatabaseName") -and ` - ($result.DatabaseName -ne $DatabaseName)) - { - throw ("Specified database name does not match the actual " + ` - "database name. This resource cannot rename the database.") - } - - if ([string]::IsNullOrEmpty($ApplicationPool) -eq $false ` - -and $ApplicationPool -ne $result.ApplicationPool) - { - Write-Verbose -Message "Updating Secure Store Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $serviceApp = Get-SPServiceApplication -Name $params.Name | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.SecureStoreService.Server.SecureStoreServiceApplication" - } - $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool - Set-SPSecureStoreServiceApplication -Identity $serviceApp -ApplicationPool $appPool - } - } - } - - if ($Ensure -eq "Absent") - { - # The service app should not exit - Write-Verbose -Message "Removing Secure Store Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $serviceApp = Get-SPServiceApplication -Name $params.Name | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.SecureStoreService.Server.SecureStoreServiceApplication" - } - - # Remove the connected proxy(ies) - $proxies = Get-SPServiceApplicationProxy - foreach($proxyInstance in $proxies) - { - if($serviceApp.IsConnected($proxyInstance)) - { - $proxyInstance.Delete() - } - } - - Remove-SPServiceApplication $serviceApp -Confirm:$false - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $ProxyName, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $true)] - [System.Boolean] - $AuditingEnabled, - - [parameter(Mandatory = $false)] - [System.UInt32] - $AuditlogMaxSize, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.String] - $FailoverDatabaseServer, - - [parameter(Mandatory = $false)] - [System.Boolean] - $PartitionMode, - - [parameter(Mandatory = $false)] - [System.Boolean] - $Sharing, - - [parameter(Mandatory = $false)] - [ValidateSet("Windows", "SQL")] - [System.String] - $DatabaseAuthenticationType, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $DatabaseCredentials, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing secure store service application $Name" - - $PSBoundParameters.Ensure = $Ensure - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($PSBoundParameters.ContainsKey("DatabaseServer") -and ` - ($CurrentValues.DatabaseServer -ne $DatabaseServer)) - { - Write-Verbose -Message ("Specified database server does not match the actual " + ` - "database server. This resource cannot move the database " + ` - "to a different SQL instance.") - return $false - } - - if ($PSBoundParameters.ContainsKey("DatabaseName") -and ` - ($CurrentValues.DatabaseName -ne $DatabaseName)) - { - Write-Verbose -Message ("Specified database name does not match the actual " + ` - "database name. This resource cannot rename the database.") - return $false - } - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ApplicationPool", "Ensure") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSecureStoreServiceApp/MSFT_SPSecureStoreServiceApp.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSecureStoreServiceApp/MSFT_SPSecureStoreServiceApp.schema.mof deleted file mode 100644 index 98b57000..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSecureStoreServiceApp/MSFT_SPSecureStoreServiceApp.schema.mof +++ /dev/null @@ -1,19 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPSecureStoreServiceApp")] -class MSFT_SPSecureStoreServiceApp : OMI_BaseResource -{ - [Key, Description("The name of the secure store service app")] string Name; - [Write, Description("The proxy name, if not specified will be /Name of service app/ Proxy")] string ProxyName; - [Required, Description("The name of the application pool it will run in")] string ApplicationPool; - [Required, Description("Is auditing enabled for this service app")] boolean AuditingEnabled; - [Write, Description("What is the maximum size of the audit log in MB")] uint32 AuditlogMaxSize; - [Write, Description("What SQL credentials should be used to access the database"), EmbeddedInstance("MSFT_Credential")] String DatabaseCredentials; - [Write, Description("The name of the database for the service app")] string DatabaseName; - [Write, Description("The name of the database server to host the database")] string DatabaseServer; - [Write, Description("What type of authentication should be used to access the database"), ValueMap{"Windows","SQL"}, Values{"Windows","SQL"}] string DatabaseAuthenticationType; - [Write, Description("The name of the database server hosting a failover instance of the database")] string FailoverDatabaseServer; - [Write, Description("Is partition mode enabled for this service app")] boolean PartitionMode; - [Write, Description("Is sharing enabled for this service app")] boolean Sharing; - [Write, Description("Present if the service app should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPServiceAppPool/MSFT_SPServiceAppPool.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPServiceAppPool/MSFT_SPServiceAppPool.psm1 deleted file mode 100644 index 2da3f966..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPServiceAppPool/MSFT_SPServiceAppPool.psm1 +++ /dev/null @@ -1,176 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ServiceAccount, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting service application pool '$Name'" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $sap = Get-SPServiceApplicationPool -Identity $params.Name ` - -ErrorAction SilentlyContinue - if ($null -eq $sap) - { - return @{ - Name = $params.Name - ServiceAccount = $params.ProcessAccountName - InstallAccount = $params.InstallAccount - Ensure = "Absent" - } - } - return @{ - Name = $sap.Name - ServiceAccount = $sap.ProcessAccountName - InstallAccount = $params.InstallAccount - Ensure = "Present" - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ServiceAccount, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting service application pool '$Name'" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($CurrentValues.Ensure -eq "Absent" -and $Ensure -eq "Present") - { - Write-Verbose -Message "Creating Service Application Pool $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - New-SPServiceApplicationPool -Name $params.Name ` - -Account $params.ServiceAccount - - $sap = Get-SPServiceApplicationPool -Identity $params.Name ` - -ErrorAction SilentlyContinue - if ($null -ne $sap) - { - if ($sap.ProcessAccountName -ne $params.ServiceAccount) - { - Set-SPServiceApplicationPool -Identity $params.Name ` - -Account $params.ServiceAccount - } - } - } - } - if ($CurrentValues.Ensure -eq "Present" -and $Ensure -eq "Present") - { - Write-Verbose -Message "Updating Service Application Pool $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $sap = Get-SPServiceApplicationPool -Identity $params.Name ` - -ErrorAction SilentlyContinue - if ($sap.ProcessAccountName -ne $params.ServiceAccount) - { - Set-SPServiceApplicationPool -Identity $params.Name ` - -Account $params.ServiceAccount - } - } - } - if ($Ensure -eq "Absent") - { - Write-Verbose -Message "Removing Service Application Pool $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - Remove-SPServiceApplicationPool -Identity $params.Name -Confirm:$false - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ServiceAccount, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing service application pool '$Name'" - - $PSBoundParameters.Ensure = $Ensure - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($Ensure -eq "Present") - { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ServiceAccount", "Ensure") - } - else - { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPServiceAppPool/MSFT_SPServiceAppPool.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPServiceAppPool/MSFT_SPServiceAppPool.schema.mof deleted file mode 100644 index a562ae7f..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPServiceAppPool/MSFT_SPServiceAppPool.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPServiceAppPool")] -class MSFT_SPServiceAppPool : OMI_BaseResource -{ - [Key, Description("The name of application pool")] string Name; - [Required, Description("The name of the managed account to run this service account as")] string ServiceAccount; - [Write, Description("Present if the service app pool should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPServiceAppProxyGroup/MSFT_SPServiceAppProxyGroup.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPServiceAppProxyGroup/MSFT_SPServiceAppProxyGroup.psm1 deleted file mode 100644 index dcf4593f..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPServiceAppProxyGroup/MSFT_SPServiceAppProxyGroup.psm1 +++ /dev/null @@ -1,449 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - [ValidateSet("Present","Absent")] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.String[]] - $ServiceAppProxies, - - [parameter(Mandatory = $false)] - [System.String[]] - $ServiceAppProxiesToInclude, - - [parameter(Mandatory = $false)] - [System.String[]] - $ServiceAppProxiesToExclude, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting Service Application Proxy Group $Name" - - if (($Ensure -eq "Present") ` - -and $ServiceAppProxies ` - -and (($ServiceAppProxiesToInclude) -or ($ServiceAppProxiesToExclude))) - { - Write-Verbose -Message ("Cannot use the ServiceAppProxies parameter together " + ` - "with the ServiceAppProxiesToInclude or " + ` - "ServiceAppProxiesToExclude parameters") - return $null - } - - if (($Ensure -eq "Present") ` - -and !$ServiceAppProxies ` - -and !$ServiceAppProxiesToInclude ` - -and !$ServiceAppProxiesToExclude) - { - Write-Verbose -Message ("At least one of the following parameters must be specified: " + ` - "ServiceAppProxies, ServiceAppProxiesToInclude, " + ` - "ServiceAppProxiesToExclude") - return $null - } - - $result = Invoke-SPDSCCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - $params = $args[0] - - #Try to get the proxy group - if ($params.Name -eq "Default") { - $ProxyGroup = Get-SPServiceApplicationProxyGroup -Default - } else { - $ProxyGroup = Get-SPServiceApplicationProxyGroup $params.name -ErrorAction SilentlyContinue - } - - if ($ProxyGroup){ - $Ensure = "Present" - } - else { - $Ensure = "Absent" - } - - $ServiceAppProxies = $ProxyGroup.Proxies.DisplayName - - return @{ - Name = $params.name - Ensure = $Ensure - ServiceAppProxies = $ServiceAppProxies - ServiceAppProxiesToInclude = $param.ServiceAppProxiesToInclude - ServiceAppProxiesToExclude = $param.ServiceAppProxiesToExclude - InstallAccount = $params.InstallAccount - } - - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - [ValidateSet("Present","Absent")] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.String[]] - $ServiceAppProxies, - - [parameter(Mandatory = $false)] - [System.String[]] - $ServiceAppProxiesToInclude, - - [parameter(Mandatory = $false)] - [System.String[]] - $ServiceAppProxiesToExclude, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting Service Application Proxy Group $Name" - - if (($Ensure -eq "Present") ` - -and $ServiceAppProxies ` - -and (($ServiceAppProxiesToInclude) -or ($ServiceAppProxiesToExclude))) - { - throw ("Cannot use the ServiceAppProxies parameter together " + ` - "with the ServiceAppProxiesToInclude or " + ` - "ServiceAppProxiesToExclude parameters") - } - - if (($Ensure -eq "Present") ` - -and !$ServiceAppProxies ` - -and !$ServiceAppProxiesToInclude ` - -and !$ServiceAppProxiesToExclude) - { - throw ("At least one of the following parameters must be specified: " + ` - "ServiceAppProxies, ServiceAppProxiesToInclude, " + ` - "ServiceAppProxiesToExclude") - } - - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - if ($params.Ensure -eq "Present") - { - if ($params.Name -eq "Default") - { - $ProxyGroup = Get-SPServiceApplicationProxyGroup -Default - } - else - { - $ProxyGroup = Get-SPServiceApplicationProxyGroup -Identity $params.Name ` - -ErrorAction SilentlyContinue - } - - if (!($ProxyGroup)) - { - Write-Verbose -Message "Creating new Service Application Proxy Group $($params.Name)" - $ProxyGroup = New-SPServiceApplicationProxyGroup -Name $params.Name - } - #Explicit Service Applications - if ($params.ServiceAppProxies) - { - if ($ProxyGroup.Proxies.DisplayName) - { - $differences = Compare-Object -ReferenceObject $ProxyGroup.Proxies.DisplayName ` - -DifferenceObject $params.ServiceAppProxies - - if ($null -eq $Differences) - { - Write-Verbose -Message ("Service Proxy Group $($params.name) " + ` - "membership matches desired state") - } - else - { - foreach ($difference in $differences) - { - if ($difference.SideIndicator -eq "=>") - { - $ServiceProxyName = $difference.InputObject - $ServiceProxy = Get-SPServiceApplicationProxy | ` - Where-Object -FilterScript { - $_.DisplayName -eq $ServiceProxyName - } - - if (!$ServiceProxy) - { - throw "Invalid Service Application Proxy $ServiceProxyName" - } - - Write-Verbose -Message "Adding $ServiceProxyName to $($params.name) Proxy Group" - $ProxyGroup | Add-SPServiceApplicationProxyGroupMember -Member $ServiceProxy - - } - elseif ($difference.SideIndicator -eq "<=") - { - $ServiceProxyName = $difference.InputObject - $ServiceProxy = Get-SPServiceApplicationProxy | ` - Where-Object -FilterScript { - $_.DisplayName -eq $ServiceProxyName - } - - if (!$ServiceProxy) - { - throw "Invalid Service Application Proxy $ServiceProxyName" - } - - Write-Verbose -Message "Removing $ServiceProxyName from $($params.name) Proxy Group" - $ProxyGroup | Remove-SPServiceApplicationProxyGroupMember -member $ServiceProxy - } - } - } - } - else - { - foreach ($ServiceProxyName in $params.ServiceAppProxies) - { - $ServiceProxy = Get-SPServiceApplicationProxy | Where-Object -FilterScript { - $_.DisplayName -eq $ServiceProxyName - } - - if (!$ServiceProxy) - { - throw "Invalid Service Application Proxy $ServiceProxyName" - } - - Write-Verbose -Message "Adding $ServiceProxyName to $($params.name) Proxy Group" - $ProxyGroup | Add-SPServiceApplicationProxyGroupMember -member $ServiceProxy - } - } - } - - if ($params.ServiceAppProxiesToInclude) - { - if ($ProxyGroup.Proxies.DisplayName) - { - $differences = Compare-Object -ReferenceObject $ProxyGroup.Proxies.DisplayName ` - -DifferenceObject $params.ServiceAppProxiesToInclude - - if ($null -eq $Differences) - { - Write-Verbose -Message "Service Proxy Group $($params.name) Membership matches desired state" - } - else - { - foreach ($difference in $differences) - { - if ($difference.SideIndicator -eq "=>") - { - $ServiceProxyName = $difference.InputObject - $ServiceProxy = Get-SPServiceApplicationProxy | ` - Where-Object -FilterScript { - $_.DisplayName -eq $ServiceProxyName - } - - if (!$ServiceProxy) - { - throw "Invalid Service Application Proxy $ServiceProxyName" - } - - Write-Verbose -Message "Adding $ServiceProxyName to $($params.name) Proxy Group" - $ProxyGroup | Add-SPServiceApplicationProxyGroupMember -member $ServiceProxy - - } - } - } - } - else - { - foreach ($ServiceProxyName in $params.ServiceAppProxies) - { - $ServiceProxy = Get-SPServiceApplicationProxy | ` - Where-Object -FilterScript { - $_.DisplayName -eq $ServiceProxyName - } - - if (!$ServiceProxy) - { - throw "Invalid Service Application Proxy $ServiceProxyName" - } - - Write-Verbose "Adding $ServiceProxyName to $($params.name) Proxy Group" - $ProxyGroup | Add-SPServiceApplicationProxyGroupMember -member $ServiceProxy - } - } - } - - if ($params.ServiceAppProxiesToExclude) - { - if ($ProxyGroup.Proxies.Displayname) - { - $differences = Compare-Object -ReferenceObject $ProxyGroup.Proxies.DisplayName ` - -DifferenceObject $params.ServiceAppProxiesToExclude ` - -IncludeEqual - - if ($null -eq $Differences) - { - throw "Error comparing ServiceAppProxiesToExclude for Service Proxy Group $($params.name)" - } - else - { - foreach ($difference in $differences) - { - if ($difference.SideIndicator -eq "==") - { - $ServiceProxyName = $difference.InputObject - $ServiceProxy = Get-SPServiceApplicationProxy | Where-Object -FilterScript { - $_.DisplayName -eq $ServiceProxyName - } - - if (!$ServiceProxy) - { - throw "Invalid Service Application Proxy $ServiceProxyName" - } - - Write-Verbose -Message "Removing $ServiceProxyName to $($params.name) Proxy Group" - $ProxyGroup | Remove-SPServiceApplicationProxyGroupMember -member $ServiceProxy - } - } - } - } - } - } - else - { - Write-Verbose "Removing $($params.name) Proxy Group" - $ProxyGroup | Remove-SPServiceApplicationProxyGroup -confirm:$false - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - [ValidateSet("Present","Absent")] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.String[]] - $ServiceAppProxies, - - [parameter(Mandatory = $false)] - [System.String[]] - $ServiceAppProxiesToInclude, - - [parameter(Mandatory = $false)] - [System.String[]] - $ServiceAppProxiesToExclude, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing Service Application Proxy Group $Name" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($null -eq $CurrentValues) - { - return $false - } - - if ($CurrentValues.Ensure -ne $Ensure) - { - return $false - } - - if ($ServiceAppProxies) - { - Write-Verbose -Message "Testing ServiceAppProxies property for $Name Proxy Group" - - if (-not $CurrentValues.ServiceAppProxies) - { - return $false - } - - $differences = Compare-Object -ReferenceObject $CurrentValues.ServiceAppProxies ` - -DifferenceObject $ServiceAppProxies - - if ($null -eq $differences) - { - Write-Verbose -Message "ServiceAppProxies match" - } - else - { - Write-Verbose -Message "ServiceAppProxies do not match" - return $false - } - } - - if ($ServiceAppProxiesToInclude){ - Write-Verbose -Message "Testing ServiceAppProxiesToInclude property for $Name Proxy Group" - - if (-not $CurrentValues.ServiceAppProxies) - { - return $false - } - - $differences = Compare-Object -ReferenceObject $CurrentValues.ServiceAppProxies ` - -DifferenceObject $ServiceAppProxiesToInclude - - if ($null -eq $differences) - { - Write-Verbose -Message "ServiceAppProxiesToInclude matches" - } - elseif ($differences.sideindicator -contains "=>") - { - Write-Verbose -Message "ServiceAppProxiesToInclude does not match" - return $false - } - } - - if ($ServiceAppProxiesToExclude) - { - Write-Verbose -Message "Testing ServiceAppProxiesToExclude property for $Name Proxy Group" - - if (-not $CurrentValues.ServiceAppProxies) - { - return $true - } - - $differences = Compare-Object -ReferenceObject $CurrentValues.ServiceAppProxies ` - -DifferenceObject $ServiceAppProxiesToExclude ` - -IncludeEqual - - if ($null -eq $differences) - { - return $false - } - elseif ($differences.sideindicator -contains "==") - { - Write-Verbose -Message "ServiceAppProxiesToExclude does not match" - return $false - } - } - - return $true -} diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPServiceAppProxyGroup/MSFT_SPServiceAppProxyGroup.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPServiceAppProxyGroup/MSFT_SPServiceAppProxyGroup.schema.mof deleted file mode 100644 index cfb861d6..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPServiceAppProxyGroup/MSFT_SPServiceAppProxyGroup.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPServiceAppProxyGroup")] -class MSFT_SPServiceAppProxyGroup : OMI_BaseResource -{ - [Key, Description("Name of the Proxy Group to create")] String Name; - [Write, Description("Present creates the proxy group if it does not already exist, Absent will delete the proxy group if it exists"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("List of service application proxies that belong in this proxy group, all others will be removed")] String ServiceAppProxies[]; - [Write, Description("List of service application proxies to add to this proxy group, existing proxies will remain")] String ServiceAppProxiesToInclude[]; - [Write, Description("List of service application proxies to remove from this proxy grop, all others will remain")] String ServiceAppProxiesToExclude[]; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPServiceAppSecurity/MSFT_SPServiceAppSecurity.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPServiceAppSecurity/MSFT_SPServiceAppSecurity.psm1 deleted file mode 100644 index a87d12e7..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPServiceAppSecurity/MSFT_SPServiceAppSecurity.psm1 +++ /dev/null @@ -1,419 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $ServiceAppName, - - [parameter(Mandatory = $true)] - [ValidateSet("Administrators","SharingPermissions")] - [System.String] - $SecurityType, - - [parameter(Mandatory = $false)] - [Microsoft.Management.Infrastructure.CimInstance[]] - $Members, - - [parameter(Mandatory = $false)] - [Microsoft.Management.Infrastructure.CimInstance[]] - $MembersToInclude, - - [parameter(Mandatory = $false)] - [System.String[]] - $MembersToExclude, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting all security options for $SecurityType in $ServiceAppName" - - if ($Members -and (($MembersToInclude) -or ($MembersToExclude))) - { - throw ("Cannot use the Members parameter together with the MembersToInclude or " + ` - "MembersToExclude parameters") - } - - if (!$Members -and !$MembersToInclude -and !$MembersToExclude) - { - throw ("At least one of the following parameters must be specified: Members, " + ` - "MembersToInclude, MembersToExclude") - } - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $serviceApp = Get-SPServiceApplication -Name $params.ServiceAppName - - if ($null -eq $serviceApp) - { - return @{ - ServiceAppName = "" - SecurityType = $params.SecurityType - InstallAccount = $params.InstallAccount - } - } - - switch ($params.SecurityType) - { - "Administrators" { - $security = $serviceApp | Get-SPServiceApplicationSecurity -Admin - } - "SharingPermissions" { - $security = $serviceApp | Get-SPServiceApplicationSecurity - } - } - - $members = @() - foreach ($securityEntry in $security.AccessRules) - { - $user = $securityEntry.Name - if ($user -like "i:*|*" -or $user -like "c:*|*") - { - $user = (New-SPClaimsPrincipal -Identity $user -IdentityType EncodedClaim).Value - if ($user -match "^s-1-[0-59]-\d+-\d+-\d+-\d+-\d+") - { - $user = Resolve-SPDscSecurityIdentifier -SID $user - } - } - - $accessLevel = $securityEntry.AllowedRights.ToString() - $accessLevel = $accessLevel.Replace("FullControl", "Full Control") - $accessLevel = $accessLevel.Replace("ChangePermissions", "Change Permissions") - $members += @{ - Username = $user - AccessLevel = $accessLevel - } - } - - return @{ - ServiceAppName = $params.ServiceAppName - SecurityType = $params.SecurityType - Members = $members - MembersToInclude = $params.MembersToInclude - MembersToExclude = $params.MembersToExclude - InstallAccount = $params.InstallAccount - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $ServiceAppName, - - [parameter(Mandatory = $true)] - [ValidateSet("Administrators","SharingPermissions")] - [System.String] - $SecurityType, - - [parameter(Mandatory = $false)] - [Microsoft.Management.Infrastructure.CimInstance[]] - $Members, - - [parameter(Mandatory = $false)] - [Microsoft.Management.Infrastructure.CimInstance[]] - $MembersToInclude, - - [parameter(Mandatory = $false)] - [System.String[]] - $MembersToExclude, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting all security options for $SecurityType in $ServiceAppName" - - if ($Members -and (($MembersToInclude) -or ($MembersToExclude))) - { - throw ("Cannot use the Members parameter together with the MembersToInclude or " + ` - "MembersToExclude parameters") - } - - if (!$Members -and !$MembersToInclude -and !$MembersToExclude) - { - throw ("At least one of the following parameters must be specified: Members, " + ` - "MembersToInclude, MembersToExclude") - } - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ([System.String]::IsNullOrEmpty($CurrentValues.ServiceAppName) -eq $true) - { - throw "Unable to locate service application $ServiceAppName" - } - - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $CurrentValues) ` - -ScriptBlock { - $params = $args[0] - $CurrentValues = $args[1] - - $serviceApp = Get-SPServiceApplication -Name $params.ServiceAppName - switch ($params.SecurityType) - { - "Administrators" { - $security = $serviceApp | Get-SPServiceApplicationSecurity -Admin - } - "SharingPermissions" { - $security = $serviceApp | Get-SPServiceApplicationSecurity - } - } - - if ($params.ContainsKey("Members") -eq $true) - { - foreach($desiredMember in $params.Members) - { - $isUser = Test-SPDSCIsADUser -IdentityName $desiredMember.Username - if ($isUser -eq $true) - { - $claim = New-SPClaimsPrincipal -Identity $desiredMember.Username ` - -IdentityType WindowsSamAccountName - } - else - { - $claim = New-SPClaimsPrincipal -Identity $desiredMember.Username ` - -IdentityType WindowsSecurityGroupName - } - - if ($CurrentValues.Members.Username -contains $desiredMember.Username) - { - if (($CurrentValues.Members | Where-Object -FilterScript { - $_.Username -eq $desiredMember.Username - } | Select-Object -First 1).AccessLevel -ne $desiredMember.AccessLevel) - { - Revoke-SPObjectSecurity -Identity $security ` - -Principal $claim - - Grant-SPObjectSecurity -Identity $security ` - -Principal $claim ` - -Rights $desiredMember.AccessLevel - } - } - else - { - Grant-SPObjectSecurity -Identity $security -Principal $claim -Rights $desiredMember.AccessLevel - } - } - - foreach($currentMember in $CurrentValues.Members) - { - if ($params.Members.Username -notcontains $currentMember.Username) - { - $isUser = Test-SPDSCIsADUser -IdentityName $desiredMember.Username - if ($isUser -eq $true) - { - $claim = New-SPClaimsPrincipal -Identity $desiredMember.Username ` - -IdentityType WindowsSamAccountName - } - else - { - $claim = New-SPClaimsPrincipal -Identity $desiredMember.Username ` - -IdentityType WindowsSecurityGroupName - } - Revoke-SPObjectSecurity -Identity $security -Principal $claim - } - } - } - - if ($params.ContainsKey("MembersToInclude") -eq $true) - { - foreach($desiredMember in $params.MembersToInclude) - { - $isUser = Test-SPDSCIsADUser -IdentityName $desiredMember.Username - if ($isUser -eq $true) - { - $claim = New-SPClaimsPrincipal -Identity $desiredMember.Username ` - -IdentityType WindowsSamAccountName - } - else - { - $claim = New-SPClaimsPrincipal -Identity $desiredMember.Username ` - -IdentityType WindowsSecurityGroupName - } - if ($CurrentValues.Members.Username -contains $desiredMember.Username) - { - if (($CurrentValues.Members | Where-Object -FilterScript { - $_.Username -eq $desiredMember.Username - } | Select-Object -First 1).AccessLevel -ne $desiredMember.AccessLevel) - { - Revoke-SPObjectSecurity -Identity $security ` - -Principal $claim - - Grant-SPObjectSecurity -Identity $security ` - -Principal $claim ` - -Rights $desiredMember.AccessLevel - } - } - else - { - Grant-SPObjectSecurity -Identity $security ` - -Principal $claim ` - -Rights $desiredMember.AccessLevel - } - } - } - - if ($params.ContainsKey("MembersToExclude") -eq $true) - { - foreach($excludeMember in $params.MembersToExclude) - { - if ($CurrentValues.Members.Username -contains $excludeMember) - { - $isUser = Test-SPDSCIsADUser -IdentityName $desiredMember.Username - if ($isUser -eq $true) - { - $claim = New-SPClaimsPrincipal -Identity $desiredMember.Username ` - -IdentityType WindowsSamAccountName - } - else - { - $claim = New-SPClaimsPrincipal -Identity $desiredMember.Username ` - -IdentityType WindowsSecurityGroupName - } - Revoke-SPObjectSecurity -Identity $security -Principal $claim - } - } - } - - switch ($params.SecurityType) - { - "Administrators" { - $security = $serviceApp | Set-SPServiceApplicationSecurity -ObjectSecurity $security ` - -Admin - } - "SharingPermissions" { - $security = $serviceApp | Set-SPServiceApplicationSecurity -ObjectSecurity $security - } - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $ServiceAppName, - - [parameter(Mandatory = $true)] - [ValidateSet("Administrators","SharingPermissions")] - [System.String] - $SecurityType, - - [parameter(Mandatory = $false)] - [Microsoft.Management.Infrastructure.CimInstance[]] - $Members, - - [parameter(Mandatory = $false)] - [Microsoft.Management.Infrastructure.CimInstance[]] - $MembersToInclude, - - [parameter(Mandatory = $false)] - [System.String[]] - $MembersToExclude, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing all security options for $SecurityType in $ServiceAppName" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ([System.String]::IsNullOrEmpty($CurrentValues.ServiceAppName) -eq $true) - { - return $false - } - - if ($Members) - { - Write-Verbose -Message "Processing Members parameter" - $differences = Compare-Object -ReferenceObject $CurrentValues.Members.Username ` - -DifferenceObject $Members.Username - - if ($null -eq $differences) - { - Write-Verbose -Message "Security list matches - checking that permissions match on each object" - foreach($currentMember in $CurrentValues.Members) - { - if ($currentMember.AccessLevel -ne ($Members | Where-Object -FilterScript { - $_.Username -eq $currentMember.Username - } | Select-Object -First 1).AccessLevel) - { - Write-Verbose -Message "$($currentMember.Username) has incorrect permission level. Test failed." - return $false - } - } - return $true - } - else - { - Write-Verbose -Message "Security list does not match" - return $false - } - } - - $result = $true - if ($MembersToInclude) - { - Write-Verbose -Message "Processing MembersToInclude parameter" - foreach ($member in $MembersToInclude) - { - if (-not($CurrentValues.Members.Username -contains $member.Username)) - { - Write-Verbose -Message "$($member.Username) does not have access. Set result to false" - $result = $false - } - else - { - Write-Verbose -Message "$($member.Username) already has access. Checking permission..." - if ($member.AccessLevel -ne ($CurrentValues.Members | Where-Object -FilterScript { - $_.Username -eq $member.Username - } | Select-Object -First 1).AccessLevel) - { - Write-Verbose -Message "$($member.Username) has incorrect permission level. Test failed." - return $false - } - } - } - } - - if ($MembersToExclude) - { - Write-Verbose -Message "Processing MembersToExclude parameter" - foreach ($member in $MembersToExclude) - { - if ($CurrentValues.Members.Username -contains $member.Username) - { - Write-Verbose -Message "$member already has access. Set result to false" - $result = $false - } - else - { - Write-Verbose -Message "$member does not have access. Skipping" - } - } - } - - return $result -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPServiceAppSecurity/MSFT_SPServiceAppSecurity.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPServiceAppSecurity/MSFT_SPServiceAppSecurity.schema.mof deleted file mode 100644 index f68a8073..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPServiceAppSecurity/MSFT_SPServiceAppSecurity.schema.mof +++ /dev/null @@ -1,16 +0,0 @@ -[ClassVersion("1.0.0.0")] -class MSFT_SPServiceAppSecurityEntry -{ - [Key, Description("The username for the entry")] String Username; - [Required, Description("The access level for the entry"), ValueMap{"Change Permissions","Full Control", "Write", "Read"}, Values{"Change Permissions","Full Control", "Write", "Read"}] String AccessLevel; -}; -[ClassVersion("1.0.0.0"), FriendlyName("SPServiceAppSecurity")] -class MSFT_SPServiceAppSecurity : OMI_BaseResource -{ - [Key, Description("The name of the service application you wish to apply security settings to")] String ServiceAppName; - [Key, Description("Administrators will set the administrators for the service app, SharingPermissions will set those granted access through the permissions button seen in the Sharing section of the ribbon in central admin"), ValueMap{"Administrators","SharingPermissions"}, Values{"Administrators","SharingPermissions"}] string SecurityType; - [Write, Description("A list of members to set the group to. Those not in this list will be removed"), EmbeddedInstance("MSFT_SPServiceAppSecurityEntry")] String Members[]; - [Write, Description("A list of members to add. Members not in this list will be left in the group"), EmbeddedInstance("MSFT_SPServiceAppSecurityEntry")] String MembersToInclude[]; - [Write, Description("A list of members to remove. Members not in this list will be left in the group")] String MembersToExclude[]; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPServiceInstance/MSFT_SPServiceInstance.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPServiceInstance/MSFT_SPServiceInstance.psm1 deleted file mode 100644 index da4e6f1d..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPServiceInstance/MSFT_SPServiceInstance.psm1 +++ /dev/null @@ -1,295 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present" - ) - - Write-Verbose -Message "Getting service instance '$Name'" - - $newName = (Get-SPDscServiceTypeName -DisplayName $Name) - - $invokeArgs = @{ - Credential = $InstallAccount - Arguments = @($PSBoundParameters, $newName) - } - $result = Invoke-SPDSCCommand @invokeArgs -ScriptBlock { - $params = $args[0] - $newName = $args[1] - - $si = Get-SPServiceInstance -Server $env:COMPUTERNAME | Where-Object -FilterScript { - $_.TypeName -eq $params.Name -or ` - $_.TypeName -eq $newName -or ` - $_.GetType().Name -eq $newName - } - - if ($null -eq $si) - { - $domain = (Get-CimInstance -ClassName Win32_ComputerSystem).Domain - $fqdn = "$($env:COMPUTERNAME).$domain" - $si = Get-SPServiceInstance -Server $fqdn | Where-Object -FilterScript { - $_.TypeName -eq $params.Name -or ` - $_.TypeName -eq $newName -or ` - $_.GetType().Name -eq $newName - } - } - - if ($null -eq $si) - { - return @{ - Name = $params.Name - Ensure = "Absent" - InstallAccount = $params.InstallAccount - } - } - if ($si.Status -eq "Online") - { - $localEnsure = "Present" - } - else - { - $localEnsure = "Absent" - } - - return @{ - Name = $params.Name - Ensure = $localEnsure - InstallAccount = $params.InstallAccount - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present" - ) - - Write-Verbose -Message "Setting service instance '$Name'" - - $newName = (Get-SPDscServiceTypeName -DisplayName $Name) - $invokeArgs = @{ - Credential = $InstallAccount - Arguments = @($PSBoundParameters, $newName) - } - - if ($Ensure -eq "Present") - { - Write-Verbose -Message "Provisioning service instance '$Name'" - - Invoke-SPDSCCommand @invokeArgs -ScriptBlock { - $params = $args[0] - $newName = $args[1] - - $si = Get-SPServiceInstance -Server $env:COMPUTERNAME | Where-Object -FilterScript { - $_.TypeName -eq $params.Name -or ` - $_.TypeName -eq $newName -or ` - $_.GetType().Name -eq $newName - } - - if ($null -eq $si) - { - $domain = (Get-CimInstance -ClassName Win32_ComputerSystem).Domain - $fqdn = "$($env:COMPUTERNAME).$domain" - $si = Get-SPServiceInstance -Server $fqdn | Where-Object -FilterScript { - $_.TypeName -eq $params.Name -or ` - $_.TypeName -eq $newName -or ` - $_.GetType().Name -eq $newName - } - } - if ($null -eq $si) { - throw [Exception] "Unable to locate service application '$($params.Name)'" - } - Start-SPServiceInstance -Identity $si - } - } - else - { - Write-Verbose -Message "Deprovisioning service instance '$Name'" - - Invoke-SPDSCCommand @invokeArgs -ScriptBlock { - $params = $args[0] - $newName = $args[1] - - $si = Get-SPServiceInstance -Server $env:COMPUTERNAME | Where-Object -FilterScript { - $_.TypeName -eq $params.Name -or ` - $_.TypeName -eq $newName -or ` - $_.GetType().Name -eq $newName - } - - if ($null -eq $si) - { - $domain = (Get-CimInstance -ClassName Win32_ComputerSystem).Domain - $fqdn = "$($env:COMPUTERNAME).$domain" - $si = Get-SPServiceInstance -Server $fqdn | Where-Object -FilterScript { - $_.TypeName -eq $params.Name -or ` - $_.TypeName -eq $newName -or ` - $_.GetType().Name -eq $newName - } - } - if ($null -eq $si) { - throw [Exception] "Unable to locate service application '$($params.Name)'" - } - Stop-SPServiceInstance -Identity $si - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present" - ) - - Write-Verbose -Message "Testing service instance '$Name'" - - $PSBoundParameters.Ensure = $Ensure - - $testArgs = @{ - CurrentValues = (Get-TargetResource @PSBoundParameters) - DesiredValues = $PSBoundParameters - ValuesToCheck = @("Name", "Ensure") - } - return Test-SPDscParameterState @testArgs -} - -function Get-SPDscServiceTypeName -{ - [CmdletBinding()] - [OutputType([System.String])] - param( - [Parameter(Mandatory = $true)] - [string] - $DisplayName - ) - switch ($DisplayName) - { - "Access Database Service 2010" { - return "AccessServerWebServiceInstance" - } - "Access Services" { - return "AccessServicesWebServiceInstance" - } - "App Management Service" { - return "AppManagementServiceInstance" - } - "Business Data Connectivity Service" { - return "BdcServiceInstance" - } - "PerformancePoint Service" { - return "BIMonitoringServiceInstance" - } - "Excel Calculation Services" { - return "ExcelServerWebServiceInstance" - } - "Document Conversions Launcher Service" { - return "LauncherServiceInstance" - } - "Document Conversions Load Balancer Service" { - return "LoadBalancerServiceInstance" - } - "Managed Metadata Web Service" { - return "MetadataWebServiceInstance" - } - "Lotus Notes Connector" { - return "NotesWebServiceInstance" - } - "PowerPoint Conversion Service" { - return "PowerPointConversionServiceInstance" - } - "User Profile Synchronization Service" { - return "ProfileSynchronizationServiceInstance" - } - "Search Query and Site Settings Service" { - return "SearchQueryAndSiteSettingsServiceInstance" - } - "Search Host Controller Service" { - return "SearchRuntimeServiceInstance" - } - "SharePoint Server Search" { - return "SearchServiceInstance" - } - "Secure Store Service" { - return "SecureStoreServiceInstance" - } - "Microsoft SharePoint Foundation Incoming E-Mail" { - return "SPIncomingEmailServiceInstance" - } - "Request Management" { - return "SPRequestManagementServiceInstance" - } - "Microsoft SharePoint Foundation Subscription Settings Service" { - return "SPSubscriptionSettingsServiceInstance" - } - "Microsoft SharePoint Foundation Sandboxed Code Service" { - return "SPUserCodeServiceInstance" - } - "Claims to Windows Token Service" { - return "SPWindowsTokenServiceInstance" - } - "Microsoft SharePoint Foundation Workflow Timer Service" { - return "SPWorkflowTimerServiceInstance" - } - "Machine Translation Service" { - return "TranslationServiceInstance" - } - "User Profile Service" { - return "UserProfileServiceInstance" - } - "Visio Graphics Service" { - return "VisioGraphicsServiceInstance" - } - "Word Automation Services" { - return "WordServiceInstance" - } - "Work Management Service" { - return "WorkManagementServiceInstance" - } - Default { - return $DisplayName - } - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPServiceInstance/MSFT_SPServiceInstance.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPServiceInstance/MSFT_SPServiceInstance.schema.mof deleted file mode 100644 index 875823de..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPServiceInstance/MSFT_SPServiceInstance.schema.mof +++ /dev/null @@ -1,7 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPServiceInstance")] -class MSFT_SPServiceInstance : OMI_BaseResource -{ - [Key, Description("The name of the service instance to manage")] string Name; - [Write, Description("Present to ensure it runs on this server, or absent to ensure it is stopped"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSessionStateService/MSFT_SPSessionStateService.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSessionStateService/MSFT_SPSessionStateService.psm1 deleted file mode 100644 index e426a633..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSessionStateService/MSFT_SPSessionStateService.psm1 +++ /dev/null @@ -1,179 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.UInt32] - $SessionTimeout, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting SPSessionStateService info" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $svc = Get-SPSessionStateService - $Ensure = "Absent" - if ($svc.SessionStateEnabled -eq $true) - { - $Ensure = "Present" - } - return @{ - DatabaseName = $svc.CatalogName - DatabaseServer = $svc.ServerName - Ensure = $Ensure - SessionTimeout = $svc.Timeout.TotalMinutes - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.UInt32] - $SessionTimeout, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting SPSessionStateService info" - - if($SessionTimeout -eq 0) - { - $SessionTimeout = 60 - } - - if ($Ensure -eq "Present") - { - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $svc = Get-SPSessionStateService - if($svc.SessionStateEnabled) - { - if($svc.Timeout.TotalMinutes -ne $params.SessionTimeout){ - Write-Verbose -Message "Configuring SPSessionState timeout" - Set-SPSessionStateService -SessionTimeout $params.SessionTimeout - } - } - else - { - Write-Verbose -Message "Enabling SPSessionState" - Enable-SPSessionStateService -DatabaseName $params.DatabaseName ` - -DatabaseServer $params.DatabaseServer ` - -SessionTimeout $params.SessionTimeout - } - } - } - if ($Ensure -eq "Absent") - { - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $svc = Get-SPSessionStateService - if($svc.SessionStateEnabled) - { - Write-Verbose -Message "Disabling SPSessionState" - Disable-SPSessionStateService - } - else - { - Write-Verbose -Message "Keeping SPSessionState disabled" - } - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.UInt32] - $SessionTimeout, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing SPSessionStateService info" - - $PSBoundParameters.Ensure = $Ensure - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($Ensure -eq "Present") - { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure","SessionTimeout") - } - else - { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSessionStateService/MSFT_SPSessionStateService.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSessionStateService/MSFT_SPSessionStateService.schema.mof deleted file mode 100644 index 1cfd177b..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSessionStateService/MSFT_SPSessionStateService.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPSessionStateService")] -class MSFT_SPSessionStateService : OMI_BaseResource -{ - [Key, Description("The name of the database for the service")] string DatabaseName; - [Key, Description("The name of the database server for the database")] string DatabaseServer; - [Write, Description("Present is the state service should be enabled, absent if it should be disabled"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("What is the timeout on sessions")] uint32 SessionTimeout; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPShellAdmins/MSFT_SPShellAdmins.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPShellAdmins/MSFT_SPShellAdmins.psm1 deleted file mode 100644 index 74f5e8b4..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPShellAdmins/MSFT_SPShellAdmins.psm1 +++ /dev/null @@ -1,956 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String[]] - $Members, - - [parameter(Mandatory = $false)] - [System.String[]] - $MembersToInclude, - - [parameter(Mandatory = $false)] - [System.String[]] - $MembersToExclude, - - [parameter(Mandatory = $false)] - [Microsoft.Management.Infrastructure.CimInstance[]] - $ContentDatabases, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllContentDatabases, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting Shell Admins config" - - if ($Members -and (($MembersToInclude) -or ($MembersToExclude))) - { - Write-Verbose -Message ("Cannot use the Members parameter together with the " + ` - "MembersToInclude or MembersToExclude parameters") - return $null - } - - if ($ContentDatabases) - { - foreach ($contentDatabase in $ContentDatabases) - { - if ($contentDatabase.Members -and (($contentDatabase.MembersToInclude) ` - -or ($contentDatabase.MembersToExclude))) - { - Write-Verbose -Message ("ContentDatabases: Cannot use the Members parameter " + ` - "together with the MembersToInclude or " + ` - "MembersToExclude parameters") - return $null - } - - if (!$contentDatabase.Members ` - -and !$contentDatabase.MembersToInclude ` - -and !$contentDatabase.MembersToExclude) - { - Write-Verbose -Message ("ContentDatabases: At least one of the following " + ` - "parameters must be specified: Members, " + ` - "MembersToInclude, MembersToExclude") - return $null - } - } - } - else - { - if (!$Members -and !$MembersToInclude -and !$MembersToExclude) - { - Write-Verbose -Message ("At least one of the following parameters must be " + ` - "specified: Members, MembersToInclude, MembersToExclude") - return $null - } - } - - if ($ContentDatabases -and $AllContentDatabases) - { - Write-Verbose -Message ("Cannot use the ContentDatabases parameter together with the " + ` - "AllContentDatabases parameter") - return $null - } - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` - -ScriptBlock { - $params = $args[0] - $scriptRoot = $args[1] - - Import-Module -Name (Join-Path -Path $scriptRoot -ChildPath "MSFT_SPShellAdmins.psm1") - - try - { - $spFarm = Get-SPFarm - } - catch - { - Write-Verbose -Message ("No local SharePoint farm was detected. Shell admin " + ` - "settings will not be applied") - return $null - } - - $shellAdmins = Get-SPShellAdmin - $allContentDatabases = $true - - $cdbPermissions = @() - $databases = Get-SPContentDatabase - foreach ($contentDatabase in $databases) - { - $cdbPermission = @{} - - $cdbPermission.Name = $contentDatabase.Name - $dbShellAdmins = Get-SPShellAdmin -Database $contentDatabase.Id - $cdbPermission.Members = $dbShellAdmins.UserName - - $cdbPermissions += $cdbPermission - } - - return @{ - Name = $params.Name - Members = $shellAdmins.UserName - MembersToInclude = $params.MembersToInclude - MembersToExclude = $params.MembersToExclude - ContentDatabases = $cdbPermissions - AllContentDatabases = $params.AllContentDatabases - InstallAccount = $params.InstallAccount - } - } - return $result -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String[]] - $Members, - - [parameter(Mandatory = $false)] - [System.String[]] - $MembersToInclude, - - [parameter(Mandatory = $false)] - [System.String[]] - $MembersToExclude, - - [parameter(Mandatory = $false)] - [Microsoft.Management.Infrastructure.CimInstance[]] - $ContentDatabases, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllContentDatabases, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting Shell Admin config" - - if ($Members -and (($MembersToInclude) -or ($MembersToExclude))) - { - throw ("Cannot use the Members parameter together with the " + ` - "MembersToInclude or MembersToExclude parameters") - } - - if ($ContentDatabases) - { - foreach ($contentDatabase in $ContentDatabases) - { - if ($contentDatabase.Members -and (($contentDatabase.MembersToInclude) ` - -or ($contentDatabase.MembersToExclude))) - { - throw ("ContentDatabases: Cannot use the Members parameter " + ` - "together with the MembersToInclude or " + ` - "MembersToExclude parameters") - } - - if (!$contentDatabase.Members ` - -and !$contentDatabase.MembersToInclude ` - -and !$contentDatabase.MembersToExclude) - { - throw ("ContentDatabases: At least one of the following " + ` - "parameters must be specified: Members, " + ` - "MembersToInclude, MembersToExclude") - } - } - } - else - { - if (!$Members -and !$MembersToInclude -and !$MembersToExclude) - { - throw ("At least one of the following parameters must be " + ` - "specified: Members, MembersToInclude, MembersToExclude") - } - } - - if ($ContentDatabases -and $AllContentDatabases) - { - throw ("Cannot use the ContentDatabases parameter together with the " + ` - "AllContentDatabases parameter") - } - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` - -ScriptBlock { - $params = $args[0] - $scriptRoot = $args[1] - - Import-Module -Name (Join-Path -Path $scriptRoot -ChildPath "MSFT_SPShellAdmins.psm1") - - try - { - $spFarm = Get-SPFarm - } - catch - { - throw ("No local SharePoint farm was detected. Shell admin " + ` - "settings will not be applied") - } - - $shellAdmins = Get-SPShellAdmin - - if ($params.Members) - { - Write-Verbose -Message "Processing Members" - if ($shellAdmins) - { - $differences = Compare-Object -ReferenceObject $shellAdmins.UserName ` - -DifferenceObject $params.Members - - if ($null -eq $differences) - { - Write-Verbose -Message ("Shell Admins group matches. No further " + ` - "processing required") - } - else - { - Write-Verbose -Message ("Shell Admins group does not match. Perform " + ` - "corrective action") - - foreach ($difference in $differences) - { - if ($difference.SideIndicator -eq "=>") - { - $user = $difference.InputObject - try - { - Add-SPShellAdmin -UserName $user - } - catch - { - throw ("Error while setting the Shell Admin. The Shell " + ` - "Admin permissions will not be applied. Error " + ` - "details: $($_.Exception.Message)") - return - } - } - elseif ($difference.SideIndicator -eq "<=") - { - $user = $difference.InputObject - try - { - Remove-SPShellAdmin -UserName $user -Confirm:$false - } - catch - { - throw ("Error while removing the Shell Admin. The Shell Admin " + ` - "permissions will not be revoked. Error details: " + ` - "$($_.Exception.Message)") - return - } - } - } - } - } - else - { - foreach ($member in $params.Members) - { - try - { - Add-SPShellAdmin -UserName $member - } - catch - { - throw ("Error while setting the Shell Admin. The Shell Admin " + ` - "permissions will not be applied. Error details: " + ` - "$($_.Exception.Message)") - return - } - } - } - } - - if ($params.MembersToInclude) - { - Write-Verbose -Message "Processing MembersToInclude" - if ($shellAdmins) - { - foreach ($member in $params.MembersToInclude) - { - if (-not $shellAdmins.UserName.Contains($member)) - { - try - { - Add-SPShellAdmin -UserName $member - } - catch - { - throw ("Error while setting the Shell Admin. The Shell Admin " + ` - "permissions will not be applied. Error details: " + ` - "$($_.Exception.Message)") - return - } - } - } - } - else - { - foreach ($member in $params.MembersToInclude) - { - try - { - Add-SPShellAdmin -UserName $member - } - catch - { - throw ("Error while setting the Shell Admin. The Shell Admin " + ` - "permissions will not be applied. Error details: $($_.Exception.Message)") - return - } - } - } - } - - if ($params.MembersToExclude) - { - Write-Verbose -Message "Processing MembersToExclude" - if ($shellAdmins) - { - foreach ($member in $params.MembersToExclude) - { - if ($shellAdmins.UserName.Contains($member)) - { - try - { - Remove-SPShellAdmin -UserName $member -Confirm:$false - } - catch - { - throw ("Error while removing the Shell Admin. The Shell Admin " + ` - "permissions will not be revoked. Error details: " + ` - "$($_.Exception.Message)") - return - } - } - } - } - } - - if ($params.ContentDatabases) - { - Write-Verbose -Message "Processing ContentDatabases parameter" - # The ContentDatabases parameter is set - # Compare the configuration against the actual set and correct any issues - - foreach ($contentDatabase in $params.ContentDatabases) - { - # Check if configured database exists, throw error if not - Write-Verbose -Message "Processing Content Database: $($contentDatabase.Name)" - - $currentCDB = Get-SPContentDatabase | Where-Object -FilterScript { - $_.Name -eq $contentDatabase.Name - } - if ($null -ne $currentCDB) - { - $dbShellAdmins = Get-SPShellAdmin -database $currentCDB.Id - - if ($contentDatabase.Members) - { - Write-Verbose -Message "Processing Members" - if ($dbShellAdmins) - { - $differences = Compare-Object -ReferenceObject $contentDatabase.Members ` - -DifferenceObject $dbShellAdmins.UserName - foreach ($difference in $differences) - { - if ($difference.SideIndicator -eq "<=") - { - $user = $difference.InputObject - try - { - Add-SPShellAdmin -database $currentCDB.Id -UserName $user - } - catch - { - throw ("Error while setting the Shell Admin. The " + ` - "Shell Admin permissions will not be applied. " + ` - "Error details: $($_.Exception.Message)") - return - } - } - elseif ($difference.SideIndicator -eq "=>") - { - $user = $difference.InputObject - try - { - Remove-SPShellAdmin -Database $currentCDB.Id ` - -UserName $user ` - -Confirm:$false - } - catch - { - throw ("Error while removing the Shell Admin. The " + ` - "Shell Admin permissions will not be revoked. " + ` - "Error details: $($_.Exception.Message)") - return - } - } - } - } - else - { - foreach ($member in $contentDatabase.Members) - { - try - { - Add-SPShellAdmin -database $currentCDB.Id -UserName $member - } - catch - { - throw ("Error while setting the Shell Admin. The Shell " + ` - "Admin permissions will not be applied. Error " + ` - "details: $($_.Exception.Message)") - return - } - } - } - } - - if ($contentDatabase.MembersToInclude) - { - Write-Verbose -Message "Processing MembersToInclude" - if ($dbShellAdmins) - { - foreach ($member in $contentDatabase.MembersToInclude) - { - if (-not $dbShellAdmins.UserName.Contains($member)) - { - try - { - Add-SPShellAdmin -database $currentCDB.Id -UserName $member - } - catch - { - throw ("Error while setting the Shell Admin. The " + ` - "Shell Admin permissions will not be applied. " + ` - "Error details: $($_.Exception.Message)") - return - } - } - } - } - else - { - foreach ($member in $contentDatabase.MembersToInclude) - { - try - { - Add-SPShellAdmin -database $currentCDB.Id -UserName $member - } - catch - { - throw ("Error while setting the Shell Admin. The Shell " + ` - "Admin permissions will not be applied. Error " + ` - "details: $($_.Exception.Message)") - return - } - } - } - } - - if ($contentDatabase.MembersToExclude) - { - Write-Verbose -Message "Processing MembersToExclude" - if ($dbShellAdmins) - { - foreach ($member in $contentDatabase.MembersToExclude) - { - if ($dbShellAdmins.UserName.Contains($member)) - { - try - { - Remove-SPShellAdmin -Database $currentCDB.Id ` - -UserName $member ` - -Confirm:$false - } - catch - { - throw ("Error while removing the Shell Admin. The " + ` - "Shell Admin permissions will not be revoked. " + ` - "Error details: $($_.Exception.Message)") - return - } - } - } - } - } - } - else - { - throw "Specified database does not exist: $($contentDatabase.Name)" - } - } - } - - if ($params.AllContentDatabases) - { - Write-Verbose -Message "Processing AllContentDatabases parameter" - - foreach ($contentDatabase in (Get-SPContentDatabase)) - { - $dbShellAdmins = Get-SPShellAdmin -database $contentDatabase.Id - if ($params.Members) - { - Write-Verbose -Message "Processing Content Database: $($contentDatabase.Name)" - if ($dbShellAdmins) - { - $differences = Compare-Object -ReferenceObject $dbShellAdmins.UserName ` - -DifferenceObject $params.Members - - if ($null -eq $differences) - { - Write-Verbose -Message ("Shell Admins group matches. No further " + ` - "processing required") - } - else - { - Write-Verbose -Message ("Shell Admins group does not match. Perform " + ` - "corrective action") - - foreach ($difference in $differences) - { - if ($difference.SideIndicator -eq "=>") - { - - $user = $difference.InputObject - try - { - Add-SPShellAdmin -database $contentDatabase.Id -UserName $user - } - catch - { - throw ("Error while setting the Shell Admin. The " + ` - "Shell Admin permissions will not be applied. " + ` - "Error details: $($_.Exception.Message)") - return - } - } - elseif ($difference.SideIndicator -eq "<=") - { - $user = $difference.InputObject - try - { - Remove-SPShellAdmin -Database $contentDatabase.Id ` - -UserName $user ` - -Confirm:$false - } - catch - { - throw ("Error while removing the Shell Admin. The " + ` - "Shell Admin permissions will not be revoked. " + ` - "Error details: $($_.Exception.Message)") - return - } - } - } - } - } - else - { - foreach ($member in $params.Members) - { - try - { - Add-SPShellAdmin -database $contentDatabase.Id -UserName $member - } - catch - { - throw ("Error while setting the Shell Admin. The Shell Admin " + ` - "permissions will not be applied. Error details: " + ` - "$($_.Exception.Message)") - return - } - } - } - } - - if ($params.MembersToInclude) - { - if ($dbShellAdmins) - { - foreach ($member in $params.MembersToInclude) - { - if (-not $dbShellAdmins.UserName.Contains($member)) - { - try - { - Add-SPShellAdmin -database $contentDatabase.Id -UserName $member - } - catch - { - throw ("Error while setting the Shell Admin. The Shell " + ` - "Admin permissions will not be applied. Error " + ` - "details: $($_.Exception.Message)") - return - } - } - } - } - else - { - foreach ($member in $params.MembersToInclude) - { - try - { - Add-SPShellAdmin -database $contentDatabase.Id -UserName $member - } - catch - { - throw ("Error while setting the Shell Admin. The Shell Admin " + ` - "permissions will not be applied. Error details: " + ` - "$($_.Exception.Message)") - return - } - } - - } - } - - if ($params.MembersToExclude) - { - if ($dbShellAdmins) - { - foreach ($member in $params.MembersToExclude) - { - if ($dbShellAdmins.UserName.Contains($member)) - { - try - { - Remove-SPShellAdmin -Database $contentDatabase.Id ` - -UserName $member ` - -Confirm:$false - } - catch - { - throw ("Error while removing the Shell Admin. The Shell " + ` - "Admin permissions will not be revoked. Error " + ` - "details: $($_.Exception.Message)") - return - } - } - } - } - } - } - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String[]] - $Members, - - [parameter(Mandatory = $false)] - [System.String[]] - $MembersToInclude, - - [parameter(Mandatory = $false)] - [System.String[]] - $MembersToExclude, - - [parameter(Mandatory = $false)] - [Microsoft.Management.Infrastructure.CimInstance[]] - $ContentDatabases, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllContentDatabases, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing Shell Admin settings" - - # Start checking - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($null -eq $CurrentValues) - { - return $false - } - - if ($Members) - { - Write-Verbose -Message "Processing Members parameter" - if (-not $CurrentValues.Members) - { - return $false - } - - $differences = Compare-Object -ReferenceObject $CurrentValues.Members ` - -DifferenceObject $Members - - if ($null -eq $differences) - { - Write-Verbose -Message "Shell Admins group matches" - } - else - { - Write-Verbose -Message "Shell Admins group does not match" - return $false - } - } - - if ($MembersToInclude) - { - Write-Verbose -Message "Processing MembersToInclude parameter" - if (-not $CurrentValues.Members) - { - return $false - } - - foreach ($member in $MembersToInclude) - { - if (-not($CurrentValues.Members.Contains($member))) - { - Write-Verbose -Message "$member is not a Shell Admin. Set result to false" - return $false - } - else - { - Write-Verbose -Message "$member is already a Shell Admin. Skipping" - } - } - } - - if ($MembersToExclude) - { - Write-Verbose -Message "Processing MembersToExclude parameter" - if ($CurrentValues.Members) - { - foreach ($member in $MembersToExclude) - { - if ($CurrentValues.Members.Contains($member)) - { - Write-Verbose -Message "$member is a Shell Admin. Set result to false" - return $false - } - else - { - Write-Verbose -Message "$member is not a Shell Admin. Skipping" - } - } - } - } - - if ($AllContentDatabases) - { - # The AllContentDatabases parameter is set - # Check the Members group against all databases - Write-Verbose -Message "Processing AllContentDatabases parameter" - - foreach ($contentDatabase in $CurrentValues.ContentDatabases) - { - # Check if configured database exists, throw error if not - Write-Verbose -Message "Processing Content Database: $($contentDatabase.Name)" - - if ($Members) - { - if (-not $contentDatabase.Members) - { - return $false - } - - $differences = Compare-Object -ReferenceObject $contentDatabase.Members ` - -DifferenceObject $Members - - if ($null -eq $differences) - { - Write-Verbose -Message "Shell Admins group matches" - } - else - { - Write-Verbose -Message "Shell Admins group does not match" - return $false - } - } - - if ($MembersToInclude) - { - if (-not $contentDatabase.Members) - { - return $false - } - - foreach ($member in $MembersToInclude) - { - if (-not($contentDatabase.Members.Contains($member))) - { - Write-Verbose -Message "$member is not a Shell Admin. Set result to false" - return $false - } - else - { - Write-Verbose -Message "$member is already a Shell Admin. Skipping" - } - } - } - - if ($MembersToExclude) - { - if ($contentDatabase.Members) - { - foreach ($member in $MembersToExclude) - { - if ($contentDatabase.Members.Contains($member)) - { - Write-Verbose -Message "$member is a Shell Admin. Set result to false" - return $false - } - else - { - Write-Verbose -Message "$member is not a Shell Admin. Skipping" - } - } - } - } - } - } - - if ($ContentDatabases) - { - # The ContentDatabases parameter is set - # Compare the configuration against the actual set - Write-Verbose -Message "Processing ContentDatabases parameter" - - foreach ($contentDatabase in $ContentDatabases) - { - # Check if configured database exists, throw error if not - Write-Verbose -Message "Processing Content Database: $($contentDatabase.Name)" - - $currentCDB = $CurrentValues.ContentDatabases | Where-Object -FilterScript { - $_.Name -eq $contentDatabase.Name - } - - if ($null -ne $currentCDB) - { - if ($contentDatabase.Members) - { - Write-Verbose -Message "Processing Members parameter" - if (-not $currentCDB.Members) - { - return $false - } - - $differences = Compare-Object -ReferenceObject $currentCDB.Members ` - -DifferenceObject $contentDatabase.Members - - if ($null -eq $differences) - { - Write-Verbose -Message "Shell Admins group matches" - } - else - { - Write-Verbose -Message "Shell Admins group does not match" - return $false - } - } - - if ($contentDatabase.MembersToInclude) - { - Write-Verbose -Message "Processing MembersToInclude parameter" - if (-not $currentCDB.Members) - { - return $false - } - - foreach ($member in $contentDatabase.MembersToInclude) - { - if (-not($currentCDB.Members.Contains($member))) - { - Write-Verbose -Message "$member is not a Shell Admin. Set result to false" - return $false - } - else - { - Write-Verbose -Message "$member is already a Shell Admin. Skipping" - } - } - } - - if ($contentDatabase.MembersToExclude) - { - Write-Verbose -Message "Processing MembersToExclude parameter" - if ($currentCDB.Members) - { - foreach ($member in $contentDatabase.MembersToExclude) - { - if ($currentCDB.Members.Contains($member)) - { - Write-Verbose -Message "$member is a Shell Admin. Set result to false" - return $false - } - else - { - Write-Verbose -Message "$member is not a Shell Admin. Skipping" - } - } - } - } - } - else - { - throw "Specified database does not exist: $($contentDatabase.Name)" - } - } - } - - return $true -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPShellAdmins/MSFT_SPShellAdmins.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPShellAdmins/MSFT_SPShellAdmins.schema.mof deleted file mode 100644 index b151ad86..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPShellAdmins/MSFT_SPShellAdmins.schema.mof +++ /dev/null @@ -1,20 +0,0 @@ -[ClassVersion("1.0.0")] -Class MSFT_SPContentDatabasePermissions -{ - [Key, Description("Name of the Content Database")] String Name; - [Write, Description("Exact list of accounts that will have to get Shell Admin permissions")] String Members[]; - [Write, Description("List of all accounts that must be in the Shell Admins group")] String MembersToInclude[]; - [Write, Description("List of all accounts that are not allowed to have Shell Admin permissions")] String MembersToExclude[]; -}; -[ClassVersion("1.0.0.0"), FriendlyName("SPShellAdmins")] -class MSFT_SPShellAdmins : OMI_BaseResource -{ - [Key, Description("Name for the config, used for administration purposes")] String Name; - [Write, Description("Exact list of accounts that will have to get Shell Admin permissions")] String Members[]; - [Write, Description("List of all accounts that must be in the Shell Admins group")] String MembersToInclude[]; - [Write, Description("List of all accounts that are not allowed to have Shell Admin permissions")] String MembersToExclude[]; - [Write, Description("Shell Admin configuration of Content Databases"), EmbeddedInstance("MSFT_SPContentDatabasePermissions")] String ContentDatabases[]; - [Write, Description("Specify if all content databases must get the same config as the general config")] Boolean AllContentDatabases; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSite/MSFT_SPSite.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSite/MSFT_SPSite.psm1 deleted file mode 100644 index 50a49483..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSite/MSFT_SPSite.psm1 +++ /dev/null @@ -1,302 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $true)] - [System.String] - $OwnerAlias, - - [parameter(Mandatory = $false)] - [System.UInt32] - $CompatibilityLevel, - - [parameter(Mandatory = $false)] - [System.String] - $ContentDatabase, - - [parameter(Mandatory = $false)] - [System.String] - $Description, - - [parameter(Mandatory = $false)] - [System.String] - $HostHeaderWebApplication, - - [parameter(Mandatory = $false)] - [System.UInt32] - $Language, - - [parameter(Mandatory = $false)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $OwnerEmail, - - [parameter(Mandatory = $false)] - [System.String] - $QuotaTemplate, - - [parameter(Mandatory = $false)] - [System.String] - $SecondaryEmail, - - [parameter(Mandatory = $false)] - [System.String] - $SecondaryOwnerAlias, - - [parameter(Mandatory = $false)] - [System.String] - $Template, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting site collection $Url" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $site = Get-SPSite -Identity $params.Url ` - -ErrorAction SilentlyContinue - - if ($null -eq $site) - { - return $null - } - else - { - if ($site.HostHeaderIsSiteName) - { - $HostHeaderWebApplication = $site.WebApplication.Url - } - - if ($null -eq $site.Owner) - { - $owner = $null - } - else - { - if ($site.WebApplication.UseClaimsAuthentication) - { - $owner = (New-SPClaimsPrincipal -Identity $site.Owner.UserLogin ` - -IdentityType "EncodedClaim").Value - } - else - { - $owner = $site.Owner.UserLogin - } - } - - if ($null -eq $site.SecondaryContact) - { - $secondaryOwner = $null - } - else - { - if ($site.WebApplication.UseClaimsAuthentication) - { - $secondaryOwner = (New-SPClaimsPrincipal -Identity $site.SecondaryContact.UserLogin ` - -IdentityType "EncodedClaim").Value - } - else - { - $secondaryOwner = $site.SecondaryContact.UserLogin - } - } - - $admService = Get-SPDSCContentService - $quota = ($admService.QuotaTemplates | ` - Where-Object -FilterScript { - $_.QuotaID -eq $site.Quota.QuotaID - }).Name - - return @{ - Url = $site.Url - OwnerAlias = $owner - CompatibilityLevel = $site.CompatibilityLevel - ContentDatabase = $site.ContentDatabase.Name - Description = $site.RootWeb.Description - HostHeaderWebApplication = $HostHeaderWebApplication - Language = $site.RootWeb.Language - Name = $site.RootWeb.Name - OwnerEmail = $site.Owner.Email - QuotaTemplate = $quota - SecondaryEmail = $site.SecondaryContact.Email - SecondaryOwnerAlias = $secondaryOwner - Template = "$($site.RootWeb.WebTemplate)#$($site.RootWeb.Configuration)" - InstallAccount = $params.InstallAccount - } - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $true)] - [System.String] - $OwnerAlias, - - [parameter(Mandatory = $false)] - [System.UInt32] - $CompatibilityLevel, - - [parameter(Mandatory = $false)] - [System.String] - $ContentDatabase, - - [parameter(Mandatory = $false)] - [System.String] - $Description, - - [parameter(Mandatory = $false)] - [System.String] - $HostHeaderWebApplication, - - [parameter(Mandatory = $false)] - [System.UInt32] - $Language, - - [parameter(Mandatory = $false)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $OwnerEmail, - - [parameter(Mandatory = $false)] - [System.String] - $QuotaTemplate, - - [parameter(Mandatory = $false)] - [System.String] - $SecondaryEmail, - - [parameter(Mandatory = $false)] - [System.String] - $SecondaryOwnerAlias, - - [parameter(Mandatory = $false)] - [System.String] - $Template, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting site collection $Url" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $params.Remove("InstallAccount") | Out-Null - - $site = Get-SPSite -Identity $params.Url -ErrorAction SilentlyContinue - - if ($null -eq $site) - { - New-SPSite @params | Out-Null - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $true)] - [System.String] - $OwnerAlias, - - [parameter(Mandatory = $false)] - [System.UInt32] - $CompatibilityLevel, - - [parameter(Mandatory = $false)] - [System.String] - $ContentDatabase, - - [parameter(Mandatory = $false)] - [System.String] - $Description, - - [parameter(Mandatory = $false)] - [System.String] - $HostHeaderWebApplication, - - [parameter(Mandatory = $false)] - [System.UInt32] - $Language, - - [parameter(Mandatory = $false)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $OwnerEmail, - - [parameter(Mandatory = $false)] - [System.String] - $QuotaTemplate, - - [parameter(Mandatory = $false)] - [System.String] - $SecondaryEmail, - - [parameter(Mandatory = $false)] - [System.String] - $SecondaryOwnerAlias, - - [parameter(Mandatory = $false)] - [System.String] - $Template, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing site collection $Url" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($null -eq $CurrentValues) - { - return $false - } - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Url") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSite/MSFT_SPSite.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSite/MSFT_SPSite.schema.mof deleted file mode 100644 index 7b28c3f8..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSite/MSFT_SPSite.schema.mof +++ /dev/null @@ -1,19 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPSite")] -class MSFT_SPSite : OMI_BaseResource -{ - [Key, Description("The URL of the site collection")] string Url; - [Required, Description("The username of the site collection administrator")] string OwnerAlias; - [Write, Description("The compatibility level of the site")] uint32 CompatibilityLevel; - [Write, Description("The name of the content database to create the site in")] string ContentDatabase; - [Write, Description("The description to apply to the site collection")] string Description; - [Write, Description("The URL of the host header web application to create this site in")] string HostHeaderWebApplication; - [Write, Description("The language code of the site")] uint32 Language; - [Write, Description("The display name of the site collection")] string Name; - [Write, Description("The email address of the site collection administrator")] string OwnerEmail; - [Write, Description("The quota template to apply to the site collection")] string QuotaTemplate; - [Write, Description("The secondary site collection admin email address")] string SecondaryEmail; - [Write, Description("The secondary site collection admin username")] string SecondaryOwnerAlias; - [Write, Description("The template to apply to the site collection")] string Template; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPStateServiceApp/MSFT_SPStateServiceApp.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPStateServiceApp/MSFT_SPStateServiceApp.psm1 deleted file mode 100644 index 40837272..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPStateServiceApp/MSFT_SPStateServiceApp.psm1 +++ /dev/null @@ -1,179 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $DatabaseCredentials, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting state service application '$Name'" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $serviceApp = Get-SPStateServiceApplication -Identity $params.Name ` - -ErrorAction SilentlyContinue - - if ($null -eq $serviceApp) - { - return @{ - Name = $params.Name - Ensure = "Absent" - InstallAccount = $params.InstallAccount - } - } - - return @{ - Name = $serviceApp.DisplayName - DatabaseName = $serviceApp.Databases.Name - DatabaseServer = $serviceApp.Databases.Server.Name - InstallAccount = $params.InstallAccount - Ensure = "Present" - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $DatabaseCredentials, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting state service application '$Name'" - - if ($Ensure -eq "Present") - { - Write-Verbose -Message "Creating State Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - - $params = $args[0] - - $dbParams = @{} - if ($params.ContainsKey("DatabaseName")) - { - $dbParams.Add("Name", $params.DatabaseName) - } - if ($params.ContainsKey("DatabaseServer")) - { - $dbParams.Add("DatabaseServer", $params.DatabaseServer) - } - if ($params.ContainsKey("DatabaseCredentials")) - { - $dbParams.Add("DatabaseCredentials", $params.DatabaseCredentials) - } - - $database = New-SPStateServiceDatabase @dbParams - $app = New-SPStateServiceApplication -Name $params.Name -Database $database - New-SPStateServiceApplicationProxy -ServiceApplication $app -DefaultProxyGroup | Out-Null - } - } - if ($Ensure -eq "Absent") - { - Write-Verbose -Message "Removing State Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - $params = $args[0] - - $serviceApp = Get-SPStateServiceApplication -Name $params.Name - Remove-SPServiceApplication $serviceApp -Confirm:$false - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $DatabaseCredentials, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing for state service application $Name" - - $PSBoundParameters.Ensure = $Ensure - - $CurrentValues = Get-TargetResource @PSBoundParameters - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Name", "Ensure") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPStateServiceApp/MSFT_SPStateServiceApp.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPStateServiceApp/MSFT_SPStateServiceApp.schema.mof deleted file mode 100644 index 6025b680..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPStateServiceApp/MSFT_SPStateServiceApp.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPStateServiceApp")] -class MSFT_SPStateServiceApp : OMI_BaseResource -{ - [Key, Description("The name of the state service app")] string Name; - [Write, Description("The database credentials for accessing the database"), EmbeddedInstance("MSFT_Credential")] String DatabaseCredentials; - [Required, Description("The name of the database for the service app")] string DatabaseName; - [Write, Description("The name of the database server")] string DatabaseServer; - [Write, Description("Present if the service app should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSubscriptionSettingsServiceApp/MSFT_SPSubscriptionSettingsServiceApp.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSubscriptionSettingsServiceApp/MSFT_SPSubscriptionSettingsServiceApp.psm1 deleted file mode 100644 index fe3443fb..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSubscriptionSettingsServiceApp/MSFT_SPSubscriptionSettingsServiceApp.psm1 +++ /dev/null @@ -1,234 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting Subscription Settings Service '$Name'" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $serviceApps = Get-SPServiceApplication -Name $params.Name ` - -ErrorAction SilentlyContinue - $nullReturn = @{ - Name = $params.Name - ApplicationPool = $params.ApplicationPool - Ensure = "Absent" - } - - if ($null -eq $serviceApps) - { - return $nullReturn - } - $serviceApp = $serviceApps | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.SharePoint.SPSubscriptionSettingsServiceApplication" - } - - if ($null -eq $serviceApp) - { - return $nullReturn - } - else - { - $propertyFlags = [System.Reflection.BindingFlags]::Instance ` - -bor [System.Reflection.BindingFlags]::NonPublic - - $propData = $serviceApp.GetType().GetProperties($propertyFlags) - - $dbProp = $propData | Where-Object -FilterScript { - $_.Name -eq "Database" - } - - $db = $dbProp.GetValue($serviceApp) - - return @{ - Name = $serviceApp.DisplayName - ApplicationPool = $serviceApp.ApplicationPool.Name - DatabaseName = $db.Name - DatabaseServer = $db.Server.Name - InstallAccount = $params.InstallAccount - Ensure = "Present" - } - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting Subscription Settings Service '$Name'" - - $result = Get-TargetResource @PSBoundParameters - - if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") - { - Write-Verbose -Message "Creating Subscription Settings Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $newParams = @{ - Name = $params.Name - ApplicationPool = $params.ApplicationPool - } - if ($params.ContainsKey("DatabaseName") -eq $true) - { - $newParams.Add("DatabaseName", $params.DatabaseName) - } - if ($params.ContainsKey("DatabaseServer") -eq $true) - { - $newParams.Add("DatabaseServer", $params.DatabaseServer) - } - $serviceApp = New-SPSubscriptionSettingsServiceApplication @newParams - New-SPSubscriptionSettingsServiceApplicationProxy -ServiceApplication $serviceApp | Out-Null - } - } - if ($result.Ensure -eq "Present" -and $Ensure -eq "Present") - { - if ($ApplicationPool -ne $result.ApplicationPool) - { - Write-Verbose -Message "Updating Subscription Settings Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - - $params = $args[0] - $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool - $service = Get-SPServiceApplication -Name $params.Name ` - | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.SharePoint.SPSubscriptionSettingsServiceApplication" - } - $service.ApplicationPool = $appPool - $service.Update() - } - } - } - if ($Ensure -eq "Absent") - { - Write-Verbose -Message "Removing Subscription Settings Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $service = Get-SPServiceApplication -Name $params.Name ` - | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.SharePoint.SPSubscriptionSettingsServiceApplication" - } - Remove-SPServiceApplication $service -Confirm:$false - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing Subscription Settings Service '$Name'" - - $PSBoundParameters.Ensure = $Ensure - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($Ensure -eq "Present") - { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ApplicationPool", "Ensure") - } - else - { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSubscriptionSettingsServiceApp/MSFT_SPSubscriptionSettingsServiceApp.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSubscriptionSettingsServiceApp/MSFT_SPSubscriptionSettingsServiceApp.schema.mof deleted file mode 100644 index ed6167db..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPSubscriptionSettingsServiceApp/MSFT_SPSubscriptionSettingsServiceApp.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPSubscriptionSettingsServiceApp")] -class MSFT_SPSubscriptionSettingsServiceApp : OMI_BaseResource -{ - [Key, Description("The name of the subscription settings service app")] string Name; - [Required, Description("The name of the application pool the service app runs in")] String ApplicationPool; - [Write, Description("The name of the database for the service app")] string DatabaseName; - [Write, Description("The name of the database server")] String DatabaseServer; - [Write, Description("Present if the service app should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPTimerJobState/MSFT_SPTimerJobState.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPTimerJobState/MSFT_SPTimerJobState.psm1 deleted file mode 100644 index 6bb22384..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPTimerJobState/MSFT_SPTimerJobState.psm1 +++ /dev/null @@ -1,258 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $WebApplication, - - [parameter(Mandatory = $false)] - [System.Boolean] - $Enabled, - - [parameter(Mandatory = $false)] - [System.String] - $Schedule, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting timer job settings for job '$Name'" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - try - { - $spFarm = Get-SPFarm - } - catch - { - Write-Verbose -Message ("No local SharePoint farm was detected. Timer job " + ` - "settings will not be applied") - return $null - } - - # Get a reference to the timer job - if ($params.ContainsKey("WebApplication")) - { - $timerjob = Get-SPTimerJob -Identity $params.Name ` - -WebApplication $params.WebApplication - } - else - { - $timerjob = Get-SPTimerJob $params.Name - } - - # Check if timer job if found - if ($null -eq $timerjob) - { - return $null - } - - $schedule = $null - if ($null -ne $timerjob.Schedule) - { - $schedule = $timerjob.Schedule.ToString() - } - - if ($null -eq $timerjob.WebApplication) - { - # Timer job is not associated to web application - return @{ - Name = $params.Name - Enabled = -not $timerjob.IsDisabled - Schedule = $schedule - InstallAccount = $params.InstallAccount - } - } - else - { - # Timer job is associated to web application - return @{ - Name = $params.Name - WebApplication = $timerjob.WebApplication.Url - Enabled = -not $timerjob.IsDisabled - Schedule = $schedule - InstallAccount = $params.InstallAccount - } - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $WebApplication, - - [parameter(Mandatory = $false)] - [System.Boolean] - $Enabled, - - [parameter(Mandatory = $false)] - [System.String] - $Schedule, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting timer job settings for job '$Name'" - - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - - $params = $args[0] - - try - { - $spFarm = Get-SPFarm - } - catch - { - throw "No local SharePoint farm was detected. Timer job settings will not be applied" - return - } - - Write-Verbose -Message "Start update" - - #find Timer Job - if ($params.ContainsKey("WebApplication") -eq $true) - { - $job = Get-SPTimerJob $params.Name -WebApplication $params.WebApplication - } - else - { - $job = Get-SPTimerJob $params.Name - } - - if ($job.GetType().IsArray -eq $false) - { - # Set the timer job settings - if ($params.ContainsKey("Enabled") -eq $true) - { - # Enable/Disable timer job - if ($params.Enabled) - { - Write-Verbose -Message "Enable timer job $($params.Name)" - try - { - Enable-SPTimerJob $job - } - catch - { - throw ("Error occurred while enabling job. Timer job settings will " + ` - "not be applied. Error details: $($_.Exception.Message)") - return - } - } - else - { - Write-Verbose -Message "Disable timer job $($params.Name)" - try - { - Disable-SPTimerJob $job - } - catch - { - throw ("Error occurred while disabling job. Timer job settings will " + ` - "not be applied. Error details: $($_.Exception.Message)") - return - } - } - } - - if ($params.ContainsKey("Schedule") -eq $true) - { - # Set timer job schedule - Write-Verbose -Message "Set timer job $($params.Name) schedule" - try - { - Set-SPTimerJob $job -Schedule $params.Schedule -ErrorAction Stop - } - catch - { - if ($_.Exception.Message -like "*The time given was not given in the proper format*") - { - throw "Incorrect schedule format used. New schedule will not be applied." - return - } - else - { - throw ("Error occurred. Timer job settings will not be applied. Error " + ` - "details: $($_.Exception.Message)") - return - } - } - } - } - else - { - throw "Could not find specified job. Total jobs found: $($job.Count)" - return - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $WebApplication, - - [parameter(Mandatory = $false)] - [System.Boolean] - $Enabled, - - [parameter(Mandatory = $false)] - [System.String] - $Schedule, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing timer job settings for job '$Name'" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($null -eq $CurrentValues) - { - return $false - } - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPTimerJobState/MSFT_SPTimerJobState.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPTimerJobState/MSFT_SPTimerJobState.schema.mof deleted file mode 100644 index fcbdf3ef..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPTimerJobState/MSFT_SPTimerJobState.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPTimerJobState")] -class MSFT_SPTimerJobState : OMI_BaseResource -{ - [Key, Description("The internal name of the timer job (not the display name)")] String Name; - [Write, Description("The name of the web application that the timer job belongs to")] String WebApplication; - [Write, Description("Should the timer job be enabled or not")] Boolean Enabled; - [Write, Description("The schedule for the timer job to execute on")] String Schedule; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuer/MSFT_SPTrustedIdentityTokenIssuer.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuer/MSFT_SPTrustedIdentityTokenIssuer.psm1 deleted file mode 100644 index 78855ee1..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuer/MSFT_SPTrustedIdentityTokenIssuer.psm1 +++ /dev/null @@ -1,429 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [String] - $Name, - - [parameter(Mandatory = $true)] - [String] - $Description, - - [parameter(Mandatory = $true)] - [String] - $Realm, - - [parameter(Mandatory = $true)] - [String] - $SignInUrl, - - [parameter(Mandatory = $true)] - [String] - $IdentifierClaim, - - [parameter(Mandatory = $true)] - [Microsoft.Management.Infrastructure.CimInstance[]] - $ClaimsMappings, - - [parameter(Mandatory = $false)] - [String] - $SigningCertificateThumbprint, - - [parameter(Mandatory = $false)] - [String] - $SigningCertificateFilePath, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [String] - $ClaimProviderName, - - [parameter(Mandatory = $false)] - [String] - $ProviderSignOutUri, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting SPTrustedIdentityTokenIssuer '$Name' settings" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $claimsMappings = @() - $spTrust = Get-SPTrustedIdentityTokenIssuer -Identity $params.Name ` - -ErrorAction SilentlyContinue - if ($spTrust) - { - $description = $spTrust.Description - $realm = $spTrust.DefaultProviderRealm - $signInUrl = $spTrust.ProviderUri.OriginalString - $identifierClaim = $spTrust.IdentityClaimTypeInformation.MappedClaimType - $SigningCertificateThumbprint = $spTrust.SigningCertificate.Thumbprint - $currentState = "Present" - $claimProviderName = $sptrust.ClaimProviderName - $providerSignOutUri = $sptrust.ProviderSignOutUri.OriginalString - $spTrust.ClaimTypeInformation| Foreach-Object -Process { - $claimsMappings = $claimsMappings + @{ - Name = $_.DisplayName - IncomingClaimType = $_.InputClaimType - LocalClaimType = $_.MappedClaimType - } - } - } - else - { - $description = "" - $realm = "" - $signInUrl = "" - $identifierClaim = "" - $SigningCertificateThumbprint = "" - $currentState = "Absent" - $claimProviderName = "" - $providerSignOutUri = "" - } - - return @{ - Name = $params.Name - Description = $description - Realm = $realm - SignInUrl = $signInUrl - IdentifierClaim = $identifierClaim - ClaimsMappings = $claimsMappings - SigningCertificateThumbprint = $SigningCertificateThumbprint - SigningCertificateFilePath = "" - Ensure = $currentState - ClaimProviderName = $claimProviderName - ProviderSignOutUri = $providerSignOutUri - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [String] - $Name, - - [parameter(Mandatory = $true)] - [String] - $Description, - - [parameter(Mandatory = $true)] - [String] - $Realm, - - [parameter(Mandatory = $true)] - [String] - $SignInUrl, - - [parameter(Mandatory = $true)] - [String] - $IdentifierClaim, - - [parameter(Mandatory = $true)] - [Microsoft.Management.Infrastructure.CimInstance[]] - $ClaimsMappings, - - [parameter(Mandatory = $false)] - [String] - $SigningCertificateThumbprint, - - [parameter(Mandatory = $false)] - [String] - $SigningCertificateFilePath, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [String] - $ClaimProviderName, - - [parameter(Mandatory = $false)] - [String] - $ProviderSignOutUri, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting SPTrustedIdentityTokenIssuer '$Name' settings" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($Ensure -eq "Present") - { - if ($CurrentValues.Ensure -eq "Absent") - { - if ($PSBoundParameters.ContainsKey("SigningCertificateThumbprint") -and ` - $PSBoundParameters.ContainsKey("SigningCertificateFilePath")) - { - throw ("Cannot use both parameters SigningCertificateThumbprint and SigningCertificateFilePath at the same time.") - return - } - - if (!$PSBoundParameters.ContainsKey("SigningCertificateThumbprint") -and ` - !$PSBoundParameters.ContainsKey("SigningCertificateFilePath")) - { - throw ("At least one of the following parameters must be specified: " + ` - "SigningCertificateThumbprint, SigningCertificateFilePath.") - return - } - - Write-Verbose -Message "Creating SPTrustedIdentityTokenIssuer '$Name'" - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - if ($params.SigningCertificateThumbprint) - { - Write-Verbose -Message ("Getting signing certificate with thumbprint " + ` - "$($params.SigningCertificateThumbprint) from the certificate store 'LocalMachine\My'") - - if ($params.SigningCertificateThumbprint -notmatch "^[A-Fa-f0-9]{40}$") - { - throw ("Parameter SigningCertificateThumbprint does not match valid format '^[A-Fa-f0-9]{40}$'.") - return - } - - $cert = Get-ChildItem -Path Cert:\LocalMachine\My | Where-Object -FilterScript { - $_.Thumbprint -match $params.SigningCertificateThumbprint - } - - if (!$cert) - { - throw ("Signing certificate with thumbprint $($params.SigningCertificateThumbprint) " + ` - "was not found in certificate store 'LocalMachine\My'.") - return - } - - if ($cert.HasPrivateKey) - { - throw ("SharePoint requires that the private key of the signing certificate" + ` - " is not installed in the certificate store.") - return - } - } - else - { - Write-Verbose -Message "Getting signing certificate from file system path '$($params.SigningCertificateFilePath)'" - try - { - $cert = New-Object -TypeName "System.Security.Cryptography.X509Certificates.X509Certificate2" ` - -ArgumentList @($params.SigningCertificateFilePath) - } - catch - { - throw ("Signing certificate was not found in path '$($params.SigningCertificateFilePath)'.") - return - } - } - - $claimsMappingsArray = @() - $params.ClaimsMappings| Foreach-Object -Process { - $runParams = @{} - $runParams.Add("IncomingClaimTypeDisplayName", $_.Name) - $runParams.Add("IncomingClaimType", $_.IncomingClaimType) - if ($null -eq $_.LocalClaimType) - { - $runParams.Add("LocalClaimType", $_.IncomingClaimType) - } - else - { - $runParams.Add("LocalClaimType", $_.LocalClaimType) - } - - $newMapping = New-SPClaimTypeMapping @runParams - $claimsMappingsArray += $newMapping - } - - if (!($claimsMappingsArray | Where-Object -FilterScript { - $_.MappedClaimType -like $params.IdentifierClaim - })) - { - throw ("IdentifierClaim does not match any claim type specified in ClaimsMappings.") - return - } - - $runParams = @{} - $runParams.Add("ImportTrustCertificate", $cert) - $runParams.Add("Name", $params.Name) - $runParams.Add("Description", $params.Description) - $runParams.Add("Realm", $params.Realm) - $runParams.Add("SignInUrl", $params.SignInUrl) - $runParams.Add("IdentifierClaim", $params.IdentifierClaim) - $runParams.Add("ClaimsMappings", $claimsMappingsArray) - $trust = New-SPTrustedIdentityTokenIssuer @runParams - - if ($null -eq $trust) - { - throw "SharePoint failed to create the SPTrustedIdentityTokenIssuer." - } - - if ((Get-SPClaimProvider| Where-Object -FilterScript { - $_.DisplayName -eq $params.ClaimProviderName - })) - { - $trust.ClaimProviderName = $params.ClaimProviderName - } - - if ($params.ProviderSignOutUri) - { - $trust.ProviderSignOutUri = New-Object -TypeName System.Uri ($params.ProviderSignOutUri) - } - $trust.Update() - } - } - } - else - { - Write-Verbose "Removing SPTrustedIdentityTokenIssuer '$Name'" - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - $Name = $params.Name - # SPTrustedIdentityTokenIssuer must be removed from each zone of each web app before - # it can be deleted - Get-SPWebApplication | Foreach-Object -Process { - $wa = $_ - $webAppUrl = $wa.Url - $update = $false - $urlZones = [Enum]::GetNames([Microsoft.SharePoint.Administration.SPUrlZone]) - $urlZones | Foreach-Object -Process { - $zone = $_ - $providers = Get-SPAuthenticationProvider -WebApplication $wa.Url ` - -Zone $zone ` - -ErrorAction SilentlyContinue - if (!$providers) - { - return - } - $trustedProviderToRemove = $providers | Where-Object -FilterScript { - $_ -is [Microsoft.SharePoint.Administration.SPTrustedAuthenticationProvider] ` - -and $_.LoginProviderName -like $params.Name - } - if ($trustedProviderToRemove) - { - Write-Verbose -Message ("Removing SPTrustedAuthenticationProvider " + ` - "'$Name' from web app '$webAppUrl' in zone " + ` - "'$zone'") - $wa.GetIisSettingsWithFallback($zone).ClaimsAuthenticationProviders.Remove($trustedProviderToRemove) | Out-Null - $update = $true - } - } - if ($update) - { - $wa.Update() - } - } - - $runParams = @{ - Identity = $params.Name - Confirm = $false - } - Remove-SPTrustedIdentityTokenIssuer @runParams - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([Boolean])] - param - ( - [parameter(Mandatory = $true)] - [String] - $Name, - - [parameter(Mandatory = $true)] - [String] - $Description, - - [parameter(Mandatory = $true)] - [String] - $Realm, - - [parameter(Mandatory = $true)] - [String] - $SignInUrl, - - [parameter(Mandatory = $true)] - [String] - $IdentifierClaim, - - [parameter(Mandatory = $true)] - [Microsoft.Management.Infrastructure.CimInstance[]] - $ClaimsMappings, - - [parameter(Mandatory = $false)] - [String] - $SigningCertificateThumbprint, - - [parameter(Mandatory = $false)] - [String] - $SigningCertificateFilePath, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [String] - $ClaimProviderName, - - [parameter(Mandatory = $false)] - [String] - $ProviderSignOutUri, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing SPTrustedIdentityTokenIssuer '$Name' settings" - - if ($PSBoundParameters.ContainsKey("SigningCertificateThumbprint") -and ` - $PSBoundParameters.ContainsKey("SigningCertificateFilePath")) - { - throw ("Cannot use both parameters SigningCertificateThumbprint and SigningCertificateFilePath at the same time.") - return - } - - if (!$PSBoundParameters.ContainsKey("SigningCertificateThumbprint") -and ` - !$PSBoundParameters.ContainsKey("SigningCertificateFilePath")) - { - throw ("At least one of the following parameters must be specified: " + ` - "SigningCertificateThumbprint, SigningCertificateFilePath.") - return - } - - $CurrentValues = Get-TargetResource @PSBoundParameters - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuer/MSFT_SPTrustedIdentityTokenIssuer.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuer/MSFT_SPTrustedIdentityTokenIssuer.schema.mof deleted file mode 100644 index f0056d89..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuer/MSFT_SPTrustedIdentityTokenIssuer.schema.mof +++ /dev/null @@ -1,26 +0,0 @@ - -[ClassVersion("1.0.0.0")] -class MSFT_SPClaimTypeMapping -{ - [Key, Description("Display name of the incoming claim type")] String Name; - [Required, Description("URI of the incoming claim type")] String IncomingClaimType; - [Write, Description("URI of the local claim type, not required if same as IncomingClaimType")] String LocalClaimType; -}; - - -[ClassVersion("1.1.0.0"), FriendlyName("SPTrustedIdentityTokenIssuer")] -class MSFT_SPTrustedIdentityTokenIssuer : OMI_BaseResource -{ - [Key, Description("Name of the SPTrustedIdentityTokenIssuer")] String Name; - [Required, Description("Description of the SPTrustedIdentityTokenIssuer")] String Description; - [Required, Description("Default Realm that is passed to identity provider")] String Realm; - [Required, Description("URL of the identity provider where user is redirected to for authentication")] String SignInUrl; - [Required, Description("Identity claim type that uniquely identifies the user")] String IdentifierClaim; - [Required, Description("Array of MSFT_SPClaimTypeMapping to use with cmdlet New-SPClaimTypeMapping"), EmbeddedInstance("MSFT_SPClaimTypeMapping")] String ClaimsMappings[]; - [Write, Description("Specify the thumbprint of the signing certificate, which must be located in certificate store LocalMachine\\My")] String SigningCertificateThumbprint; - [Write, Description("Specify the file path to the signing certificate if it is not stored in the local certificate store already")] String SigningCertificateFilePath; - [Write, Description("Name of a claims provider to set with this SPTrustedIdentityTokenIssuer")] String ClaimProviderName; - [Write, Description("Sign-out URL")] String ProviderSignOutUri; - [Write, Description("Present if the SPTrustedIdentityTokenIssuer should be created, or Absent if it should be removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPTrustedRootAuthority/MSFT_SPTrustedRootAuthority.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPTrustedRootAuthority/MSFT_SPTrustedRootAuthority.psm1 deleted file mode 100644 index 318f6d3d..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPTrustedRootAuthority/MSFT_SPTrustedRootAuthority.psm1 +++ /dev/null @@ -1,169 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $CertificateThumbprint, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose "Getting Trusted Root Authority with name '$Name'" - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $rootCert = Get-SPTrustedRootAuthority -Identity $params.Name -ErrorAction SilentlyContinue - - $ensure = "Absent" - - if($null -eq $rootCert) - { - return @{ - Name = $params.Name - CertificateThumbprint = [string]::Empty - Ensure = $ensure - } - } - else - { - $ensure = "Present" - - return @{ - Name = $params.Name - CertificateThumbprint = $rootCert.Certificate.Thumbprint - Ensure = $ensure - } - } - } - - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $CertificateThumbprint, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting SPTrustedRootAuthority '$Name'" - - $CurrentValues = Get-TargetResource @PSBoundParameters - if ($Ensure -eq "Present" -and $CurrentValues.Ensure -eq "Present") - { - Write-Verbose -Message "Updating SPTrustedRootAuthority '$Name'" - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - $cert = Get-Item -Path "CERT:\LocalMachine\My\$($params.CertificateThumbprint)" ` - -ErrorAction SilentlyContinue - - if($null -eq $cert) - { - throw "Certificate not found in the local Certificate Store" - } - - Set-SPTrustedRootAuthority -Identity $params.Name -Certificate $cert - } - } - if ($Ensure -eq "Present" -and $CurrentValues.Ensure -eq "Absent") - { - Write-Verbose -Message "Adding SPTrustedRootAuthority '$Name'" - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $cert = Get-Item -Path "CERT:\LocalMachine\My\$($params.CertificateThumbprint)" ` - -ErrorAction SilentlyContinue - - if($null -eq $cert) - { - throw "Certificate not found in the local Certificate Store" - } - - New-SPTrustedRootAuthority -Name $params.Name -Certificate $cert - } - } - if ($Ensure -eq "Absent") - { - Write-Verbose -Message "Removing SPTrustedRootAuthority '$Name'" - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - Remove-SPTrustedRootAuthority -Identity $params.Name ` - -ErrorAction SilentlyContinue - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $CertificateThumbprint, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing SPTrustedRootAuthority '$Name'" - - $CurrentValues = Get-TargetResource @PSBoundParameters - if($Ensure -eq "Present") - { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Name","CertificateThumbprint","Ensure") - } - else - { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Name","Ensure") - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPTrustedRootAuthority/MSFT_SPTrustedRootAuthority.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPTrustedRootAuthority/MSFT_SPTrustedRootAuthority.schema.mof deleted file mode 100644 index d71573d2..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPTrustedRootAuthority/MSFT_SPTrustedRootAuthority.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("SPTrustedRootAuthority")] -class MSFT_SPTrustedRootAuthority : OMI_BaseResource -{ - [Key, Description("Specifies the name of the trusted root authority to create.")] String Name; - [Required, Description("Specifies the X.509 certificate of the trusted root authority, as a certificate thumbprint.")] String CertificateThumbprint; - [Write, Description("Present ensures service app exists, absent ensures it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, EmbeddedInstance("MSFT_Credential"), Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUsageApplication/MSFT_SPUsageApplication.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUsageApplication/MSFT_SPUsageApplication.psm1 deleted file mode 100644 index 773ad782..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUsageApplication/MSFT_SPUsageApplication.psm1 +++ /dev/null @@ -1,328 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $DatabaseCredentials, - - [parameter(Mandatory = $false)] - [System.String] - $FailoverDatabaseServer, - - [parameter(Mandatory = $false)] - [System.UInt32] - $UsageLogCutTime, - - [parameter(Mandatory = $false)] - [System.String] - $UsageLogLocation, - - [parameter(Mandatory = $false)] - [System.UInt32] - $UsageLogMaxFileSizeKB, - - [parameter(Mandatory = $false)] - [System.UInt32] - $UsageLogMaxSpaceGB - ) - - Write-Verbose -Message "Getting usage application '$Name'" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $serviceApps = Get-SPServiceApplication -Name $params.Name ` - -ErrorAction SilentlyContinue - $nullReturn = @{ - Name = $params.Name - Ensure = "Absent" - } - - if ($null -eq $serviceApps) - { - return $nullReturn - } - $serviceApp = $serviceApps | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.SharePoint.Administration.SPUsageApplication" - } - - if ($null -eq $serviceApp) - { - return $nullReturn - } - else - { - $spUsageApplicationProxy = Get-SPServiceApplicationProxy | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.SharePoint.Administration.SPUsageApplicationProxy" - } - - $ensure = "Present" - if($spUsageApplicationProxy.Status -eq "Disabled") - { - $ensure = "Absent" - } - - $service = Get-SPUsageService - return @{ - Name = $serviceApp.DisplayName - InstallAccount = $params.InstallAccount - DatabaseName = $serviceApp.UsageDatabase.Name - DatabaseServer = $serviceApp.UsageDatabase.Server.Name - DatabaseCredentials = $params.DatabaseCredentials - FailoverDatabaseServer = $serviceApp.UsageDatabase.FailoverServer - UsageLogCutTime = $service.UsageLogCutTime - UsageLogLocation = $service.UsageLogDir - UsageLogMaxFileSizeKB = $service.UsageLogMaxFileSize / 1024 - UsageLogMaxSpaceGB = $service.UsageLogMaxSpaceGB - Ensure = $ensure - } - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $DatabaseCredentials, - - [parameter(Mandatory = $false)] - [System.String] - $FailoverDatabaseServer, - - [parameter(Mandatory = $false)] - [System.UInt32] - $UsageLogCutTime, - - [parameter(Mandatory = $false)] - [System.String] - $UsageLogLocation, - - [parameter(Mandatory = $false)] - [System.UInt32] - $UsageLogMaxFileSizeKB, - - [parameter(Mandatory = $false)] - [System.UInt32] - $UsageLogMaxSpaceGB - ) - - Write-Verbose -Message "Setting usage application $Name" - - $CurrentState = Get-TargetResource @PSBoundParameters - - if ($CurrentState.Ensure -eq "Absent" -and $Ensure -eq "Present") - { - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $newParams = @{} - $newParams.Add("Name", $params.Name) - if ($params.ContainsKey("DatabaseName")) - { - $newParams.Add("DatabaseName", $params.DatabaseName) - } - if ($params.ContainsKey("DatabaseCredentials")) - { - $params.Add("DatabaseUsername", $params.DatabaseCredentials.Username) - $params.Add("DatabasePassword", $params.DatabaseCredentials.Password) - } - if ($params.ContainsKey("DatabaseServer")) - { - $newParams.Add("DatabaseServer", $params.DatabaseServer) - } - if ($params.ContainsKey("FailoverDatabaseServer")) - { - $newParams.Add("FailoverDatabaseServer", $params.FailoverDatabaseServer) - } - - New-SPUsageApplication @newParams - } - } - - if ($Ensure -eq "Present") - { - Write-Verbose -Message "Configuring usage application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $spUsageApplicationProxy = Get-SPServiceApplicationProxy | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.SharePoint.Administration.SPUsageApplicationProxy" - } - - if($spUsageApplicationProxy.Status -eq "Disabled") - { - $spUsageApplicationProxy.Provision() - } - - $setParams = @{} - $setParams.Add("LoggingEnabled", $true) - if ($params.ContainsKey("UsageLogCutTime")) - { - $setParams.Add("UsageLogCutTime", $params.UsageLogCutTime) - } - if ($params.ContainsKey("UsageLogLocation")) - { - $setParams.Add("UsageLogLocation", $params.UsageLogLocation) - } - if ($params.ContainsKey("UsageLogMaxFileSizeKB")) - { - $setParams.Add("UsageLogMaxFileSizeKB", $params.UsageLogMaxFileSizeKB) - } - if ($params.ContainsKey("UsageLogMaxSpaceGB")) - { - $setParams.Add("UsageLogMaxSpaceGB", $params.UsageLogMaxSpaceGB) - } - Set-SPUsageService @setParams - } - } - - if ($Ensure -eq "Absent") - { - Write-Verbose -Message "Removing usage application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $service = Get-SPServiceApplication -Name $params.Name ` - | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.SharePoint.Administration.SPUsageApplication" - } - Remove-SPServiceApplication $service -Confirm:$false - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $DatabaseCredentials, - - [parameter(Mandatory = $false)] - [System.String] - $FailoverDatabaseServer, - - [parameter(Mandatory = $false)] - [System.UInt32] - $UsageLogCutTime, - - [parameter(Mandatory = $false)] - [System.String] - $UsageLogLocation, - - [parameter(Mandatory = $false)] - [System.UInt32] - $UsageLogMaxFileSizeKB, - - [parameter(Mandatory = $false)] - [System.UInt32] - $UsageLogMaxSpaceGB - ) - - Write-Verbose -Message "Testing for usage application '$Name'" - - $PSBoundParameters.Ensure = $Ensure - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($Ensure -eq "Present") - { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("UsageLogCutTime", - "UsageLogLocation", - "UsageLogMaxFileSizeKB", - "UsageLogMaxSpaceGB", - "Ensure") - } - else - { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUsageApplication/MSFT_SPUsageApplication.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUsageApplication/MSFT_SPUsageApplication.schema.mof deleted file mode 100644 index a97fbf15..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUsageApplication/MSFT_SPUsageApplication.schema.mof +++ /dev/null @@ -1,15 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPUsageApplication")] -class MSFT_SPUsageApplication : OMI_BaseResource -{ - [Key, Description("The name of the service application")] string Name; - [Write, Description("The name of the database for the service app")] string DatabaseName; - [Write, Description("The name of the database server")] string DatabaseServer; - [Write, Description("The credentials to use to access the database"), EmbeddedInstance("MSFT_Credential")] String DatabaseCredentials; - [Write, Description("The name of the failover database server")] string FailoverDatabaseServer; - [Write, Description("The time in minutes to cut over to new log files")] uint32 UsageLogCutTime; - [Write, Description("The location on each server to store the log files")] string UsageLogLocation; - [Write, Description("The maximum file size for log files in KB")] uint32 UsageLogMaxFileSizeKB; - [Write, Description("The total space of all log files on disk in GB")] uint32 UsageLogMaxSpaceGB; - [Write, Description("Present if the service app should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileProperty/MSFT_SPUserProfileProperty.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileProperty/MSFT_SPUserProfileProperty.psm1 deleted file mode 100644 index a70b222f..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileProperty/MSFT_SPUserProfileProperty.psm1 +++ /dev/null @@ -1,782 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.string] - $Name, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.string] - $UserProfileService, - - [parameter(Mandatory = $false)] - [System.string] - $DisplayName, - - [parameter(Mandatory = $false)] - [ValidateSet("BigInteger", - "Binary", - "Boolean", - "Date", - "DateNoYear", - "DateTime", - "Email", - "Float", - "Guid", - "HTML", - "Integer", - "Person", - "String", - "StringMultiValue", - "TimeZone", - "URL")] - [System.string] - $Type, - - [parameter(Mandatory = $false)] - [System.string] - $Description, - - [parameter(Mandatory = $false)] - [ValidateSet("Mandatory", "Optin","Optout", "Disabled")] - [System.string] - $PolicySetting, - - [parameter(Mandatory = $false)] - [ValidateSet("Public", "Contacts", "Organization", "Manager", "Private")] - [System.string] - $PrivacySetting, - - [parameter(Mandatory = $false)] - [System.string] - $MappingConnectionName, - - [parameter(Mandatory = $false)] - [System.string] - $MappingPropertyName, - - [parameter(Mandatory = $false)] - [System.string] - $MappingDirection, - - [parameter(Mandatory = $false)] - [System.uint32] - $Length, - - [parameter(Mandatory = $false)] - [System.uint32] - $DisplayOrder, - - [parameter(Mandatory = $false)] - [System.Boolean] - $IsEventLog, - - [parameter(Mandatory = $false)] - [System.Boolean] - $IsVisibleOnEditor, - - [parameter(Mandatory = $false)] - [System.Boolean] - $IsVisibleOnViewer, - - [parameter(Mandatory = $false)] - [System.Boolean] - $IsUserEditable, - - [parameter(Mandatory = $false)] - [System.Boolean] - $IsAlias, - - [parameter(Mandatory = $false)] - [System.Boolean] - $IsSearchable, - - [parameter(Mandatory = $false)] - [System.Boolean] - $UserOverridePrivacy, - - [parameter(Mandatory = $false)] - [System.string] - $TermStore, - - [parameter(Mandatory = $false)] - [System.string] - $TermGroup, - - [parameter(Mandatory = $false)] - [System.string] - $TermSet, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting user profile property $Name" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $upsa = Get-SPServiceApplication -Name $params.UserProfileService ` - -ErrorAction SilentlyContinue - $nullReturn = @{ - Name = $params.Name - UserProfileService = $params.UserProfileService - Ensure = "Absent" - } - if ($null -eq $upsa) - { - return $nullReturn - } - - $caURL = (Get-SPWebApplication -IncludeCentralAdministration | Where-Object -FilterScript { - $_.IsAdministrationWebApplication -eq $true - }).Url - - $context = Get-SPServiceContext -Site $caURL - - $userProfileSubTypeManager = Get-SPDSCUserProfileSubTypeManager -Context $context - $userProfileSubType = $userProfileSubTypeManager.GetProfileSubtype("UserProfile") - - $userProfileProperty = $userProfileSubType.Properties.GetPropertyByName($params.Name) - if ($null -eq $userProfileProperty) - { - return $nullReturn - } - - $termSet = @{ - TermSet = "" - TermGroup ="" - TermStore = "" - } - - if ($null -ne $userProfileProperty.CoreProperty.TermSet) - { - $termSet.TermSet = $userProfileProperty.CoreProperty.TermSet.Name - $termSet.TermGroup = $userProfileProperty.CoreProperty.TermSet.Group.Name - $termSet.TermStore = $userProfileProperty.CoreProperty.TermSet.TermStore.Name - } - $mapping = @{ - ConectionName = "" - PropertyName ="" - Direction = "" - } - - $userProfileConfigManager = New-Object -TypeName "Microsoft.Office.Server.UserProfiles.UserProfileConfigManager" ` - -ArgumentList $context - $syncConnection = $userProfileConfigManager.ConnectionManager | ` - Where-Object -FilterScript { - $null -ne $_.PropertyMapping -and $null -ne $_.PropertyMapping.Item($params.Name) - } - - if($null -ne $syncConnection) - { - $currentMapping = $syncConnection.PropertyMapping.Item($params.Name) - if($null -ne $currentMapping) - { - $mapping.Direction = "Import" - $mapping.ConnectionName = $params.MappingConnectionName - if($currentMapping.IsExport) - { - $mapping.Direction = "Export" - } - $mapping.PropertyName = $currentMapping.DataSourcePropertyName - } - } - - return @{ - Name = $userProfileProperty.Name - UserProfileService = $params.UserProfileService - DisplayName = $userProfileProperty.DisplayName - Type = $userProfileProperty.CoreProperty.Type - Description = $userProfileProperty.Description - PolicySetting = $userProfileProperty.PrivacyPolicy - PrivacySetting = $userProfileProperty.DefaultPrivacy - MappingConnectionName = $mapping.ConnectionName - MappingPropertyName = $mapping.PropertyName - MappingDirection = $Mapping.Direction - Length = $userProfileProperty.CoreProperty.Length - DisplayOrder =$userProfileProperty.DisplayOrder - IsEventLog =$userProfileProperty.TypeProperty.IsEventLog - IsVisibleOnEditor=$userProfileProperty.TypeProperty.IsVisibleOnEditor - IsVisibleOnViewer =$userProfileProperty.TypeProperty.IsVisibleOnViewer - IsUserEditable = $userProfileProperty.IsUserEditable - IsAlias = $userProfileProperty.IsAlias - IsSearchable = $userProfileProperty.CoreProperty.IsSearchable - TermStore = $termSet.TermStore - TermGroup = $termSet.TermGroup - TermSet = $termSet.TermSet - UserOverridePrivacy = $userProfileProperty.AllowPolicyOverride - Ensure = "Present" - } - - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.string] - $Name, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.string] - $UserProfileService, - - [parameter(Mandatory = $false)] - [System.string] - $DisplayName, - - [parameter(Mandatory = $false)] - [ValidateSet("BigInteger", - "Binary", - "Boolean", - "Date", - "DateNoYear", - "DateTime", - "Email", - "Float", - "Guid", - "HTML", - "Integer", - "Person", - "String", - "StringMultiValue", - "TimeZone", - "URL")] - [System.string] - $Type, - - [parameter(Mandatory = $false)] - [System.string] - $Description, - - [parameter(Mandatory = $false)] - [ValidateSet("Mandatory", "Optin","Optout", "Disabled")] - [System.string] - $PolicySetting, - - [parameter(Mandatory = $false)] - [ValidateSet("Public", "Contacts", "Organization", "Manager", "Private")] - [System.string] - $PrivacySetting, - - [parameter(Mandatory = $false)] - [System.string] - $MappingConnectionName, - - [parameter(Mandatory = $false)] - [System.string] - $MappingPropertyName, - - [parameter(Mandatory = $false)] - [System.string] - $MappingDirection, - - [parameter(Mandatory = $false)] - [System.uint32] - $Length, - - [parameter(Mandatory = $false)] - [System.uint32] - $DisplayOrder, - - [parameter(Mandatory = $false)] - [System.Boolean] - $IsEventLog, - - [parameter(Mandatory = $false)] - [System.Boolean] - $IsVisibleOnEditor, - - [parameter(Mandatory = $false)] - [System.Boolean] - $IsVisibleOnViewer, - - [parameter(Mandatory = $false)] - [System.Boolean] - $IsUserEditable, - - [parameter(Mandatory = $false)] - [System.Boolean] - $IsAlias, - - [parameter(Mandatory = $false)] - [System.Boolean] - $IsSearchable, - - [parameter(Mandatory = $false)] - [System.Boolean] - $UserOverridePrivacy, - - [parameter(Mandatory = $false)] - [System.string] - $TermStore, - - [parameter(Mandatory = $false)] - [System.string] - $TermGroup, - - [parameter(Mandatory = $false)] - [System.string] - $TermSet, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - # Note for integration test: CA can take a couple of minutes to notice the change. don't try - # refreshing properties page. Go through from a fresh "flow" from Service apps page - - Write-Verbose -Message "Setting user profile property $Name" - - $PSBoundParameters.Ensure = $Ensure - - $test = $PSBoundParameters - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $test ` - -ScriptBlock { - - $params = $args[0] - - if( ($params.ContainsKey("TermSet") ` - -or $params.ContainsKey("TermGroup") ` - -or $params.ContainsKey("TermSet") ) ` - -and ($params.ContainsKey("TermSet") ` - -and $params.ContainsKey("TermGroup") ` - -and $params.ContainsKey("TermSet") -eq $false) - ) - { - throw ("You have to provide all 3 parameters Termset, TermGroup and TermStore " + ` - "when providing any of the 3.") - } - - if ($params.ContainsKey("TermSet") ` - -and (@("string","stringmultivalue").Contains($params.Type.ToLower()) -eq $false)) - { - throw "Only String and String Maultivalue can use Termsets" - } - - $ups = Get-SPServiceApplication -Name $params.UserProfileService ` - -ErrorAction SilentlyContinue - - if ($null -eq $ups) - { - return $null - } - - $caURL = (Get-SPWebApplication -IncludeCentralAdministration | Where-Object -FilterScript { - $_.IsAdministrationWebApplication -eq $true - }).Url - $context = Get-SPServiceContext $caURL - - $userProfileConfigManager = New-Object -TypeName "Microsoft.Office.Server.UserProfiles.UserProfileConfigManager" ` - -ArgumentList $context - - if ($null -eq $userProfileConfigManager) - { #if config manager returns when ups is available then isuee is permissions - throw ("Account running process needs admin permissions on the user profile " + ` - "service application") - } - $coreProperties = $userProfileConfigManager.ProfilePropertyManager.GetCoreProperties() - - $userProfileSubTypeManager = Get-SPDSCUserProfileSubTypeManager $context - $userProfileSubType = $userProfileSubTypeManager.GetProfileSubtype("UserProfile") - - $userProfileProperty = $userProfileSubType.Properties.GetPropertyByName($params.Name) - - if ($null -ne $userProfileProperty ` - -and $userProfileProperty.CoreProperty.Type -ne $params.Type) - { - throw ("Can't change property type. Current Type is " + ` - "$($userProfileProperty.CoreProperty.Type)") - } - - $termSet = $null - - if ($params.ContainsKey("TermSet")) - { - $currentTermSet = $userProfileProperty.CoreProperty.TermSet; - if($currentTermSet.Name -ne $params.TermSet -or - $currentTermSet.Group.Name -ne $params.TermGroup -or - $currentTermSet.TermStore.Name -ne $params.TermStore) - { - $session = New-Object -TypeName Microsoft.SharePoint.Taxonomy.TaxonomySession ` - -ArgumentList $caURL - - $termStore = $session.TermStores[$params.TermStore] - - if ($null -eq $termStore) - { - throw "Term Store $($params.termStore) not found" - } - - $group = $termStore.Groups[$params.TermGroup] - - if($null -eq $group) - { - throw "Term Group $($params.termGroup) not found" - } - - $termSet = $group.TermSets[$params.TermSet] - if($null -eq $termSet) - { - throw "Term Set $($params.termSet) not found" - } - } - } - - if ($params.ContainsKey("Ensure") -and $params.Ensure -eq "Absent") - { - if ($null -ne $userProfileProperty) - { - $coreProperties.RemovePropertyByName($params.Name) - return - } - } - elseif($null -eq $userProfileProperty) - { - $coreProperty = $coreProperties.Create($false) - $coreProperty.Name = $params.Name - $coreProperty.DisplayName = $params.DisplayName - - Set-SPDscObjectPropertyIfValuePresent -ObjectToSet $coreProperty ` - -PropertyToSet "Length" ` - -ParamsValue $params ` - -ParamKey "Length" - - if($params.Type -eq "stringmultivalue") - { - $coreProperty.IsMultivalued = $true - } - - $coreProperty.Type = $params.Type - if($null -ne $termSet) - { - $coreProperty.TermSet = $termSet - } - - $userProfilePropertyManager = $userProfileConfigManager.ProfilePropertyManager - $userProfileTypeProperties = $userProfilePropertyManager.GetProfileTypeProperties([Microsoft.Office.Server.UserProfiles.ProfileType]::User) - $userProfileSubTypeProperties = $userProfileSubType.Properties - - $CoreProperties.Add($coreProperty) - $upTypeProperty = $userProfileTypeProperties.Create($coreProperty) - $userProfileTypeProperties.Add($upTypeProperty) - $upSubProperty = $userProfileSubTypeProperties.Create($UPTypeProperty) - $userProfileSubTypeProperties.Add($upSubProperty) - Start-Sleep -Milliseconds 100 - $userProfileProperty = $userProfileSubType.Properties.GetPropertyByName($params.Name) - - } - - $coreProperty = $userProfileProperty.CoreProperty - $userProfileTypeProperty = $userProfileProperty.TypeProperty - Set-SPDscObjectPropertyIfValuePresent -ObjectToSet $coreProperty ` - -PropertyToSet "DisplayName" ` - -ParamsValue $params ` - -ParamKey "DisplayName" - - Set-SPDscObjectPropertyIfValuePresent -ObjectToSet $coreProperty ` - -PropertyToSet "Description" ` - -ParamsValue $params ` - -ParamKey "Description" - - Set-SPDscObjectPropertyIfValuePresent -ObjectToSet $userProfileTypeProperty ` - -PropertyToSet "IsVisibleOnViewer" ` - -ParamsValue $params ` - -ParamKey "IsVisibleOnViewer" - - Set-SPDscObjectPropertyIfValuePresent -ObjectToSet $userProfileTypeProperty ` - -PropertyToSet "IsVisibleOnEditor" ` - -ParamsValue $params ` - -ParamKey "IsVisibleOnEditor" - - Set-SPDscObjectPropertyIfValuePresent -ObjectToSet $userProfileTypeProperty ` - -PropertyToSet "IsEventLog" ` - -ParamsValue $params ` - -ParamKey "IsEventLog" - - Set-SPDscObjectPropertyIfValuePresent -ObjectToSet $userProfileProperty ` - -PropertyToSet "DefaultPrivacy" ` - -ParamsValue $params ` - -ParamKey "PrivacySetting" - - Set-SPDscObjectPropertyIfValuePresent -ObjectToSet $userProfileProperty ` - -PropertyToSet "PrivacyPolicy" ` - -ParamsValue $params ` - -ParamKey "PolicySetting" - - Set-SPDscObjectPropertyIfValuePresent -ObjectToSet $userProfileProperty ` - -PropertyToSet "IsUserEditable" ` - -ParamsValue $params ` - -ParamKey "IsUserEditable" - - Set-SPDscObjectPropertyIfValuePresent -ObjectToSet $userProfileProperty ` - -PropertyToSet "UserOverridePrivacy" ` - -ParamsValue $params ` - -ParamKey "UserOverridePrivacy" - if ($null -ne $termSet) - { - $coreProperty.TermSet = $termSet - } - - $userProfileProperty.CoreProperty.Commit() - $userProfileTypeProperty.Commit() - $userProfileProperty.Commit() - - if ($params.ContainsKey("DisplayOrder")) - { - $profileManager = New-Object -TypeName "Microsoft.Office.Server.UserProfiles.UserProfileManager" ` - -ArgumentList $context - $profileManager.Properties.SetDisplayOrderByPropertyName($params.Name, $params.DisplayOrder) - $profileManager.Properties.CommitDisplayOrder() - } - - if ($params.ContainsKey("MappingConnectionName") ` - -and $params.ContainsKey("MappingPropertyName")) - { - $syncConnection = $userProfileConfigManager.ConnectionManager | Where-Object -FilterScript { - $_.DisplayName -eq $params.MappingConnectionName - } - - if ($null -eq $syncConnection ) - { - throw "connection not found" - } - $syncConnection = $userProfileConfigManager.ConnectionManager | Where-Object -FilterScript { - $_.DisplayName -eq $params.MappingConnectionName - } - - $currentMapping = $syncConnection.PropertyMapping.Item($params.Name) - - if($null -eq $currentMapping ` - -or ($currentMapping.DataSourcePropertyName -ne $params.MappingPropertyName) ` - -or ($currentMapping.IsImport ` - -and $params.ContainsKey("MappingDirection") ` - -and $params.MappingDirection -eq "Export") - ) - { - if ($null -ne $currentMapping) - { - $currentMapping.Delete() #API allows updating, but UI doesn't do that. - } - - $export = $params.ContainsKey("MappingDirection") -and $params.MappingDirection -eq "Export" - if ($Connection.Type -eq "ActiveDirectoryImport") - { - if ($export) - { - throw "not implemented" - } - else - { - $Connection.AddPropertyMapping($params.MappingPropertyName,$params.Name) - $Connection.Update() - } - } - else - { - if ($export) - { - $syncConnection.PropertyMapping.AddNewExportMapping([Microsoft.Office.Server.UserProfiles.ProfileType]::User, - $params.Name, - $params.MappingPropertyName) - } - else - { - $syncConnection.PropertyMapping.AddNewMapping([Microsoft.Office.Server.UserProfiles.ProfileType]::User, - $params.Name, - $params.MappingPropertyName) - } - } - } - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.string] - $Name, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.string] - $UserProfileService, - - [parameter(Mandatory = $false)] - [System.string] - $DisplayName, - - [parameter(Mandatory = $false)] - [ValidateSet("BigInteger", - "Binary", - "Boolean", - "Date", - "DateNoYear", - "DateTime", - "Email", - "Float", - "Guid", - "HTML", - "Integer", - "Person", - "String", - "StringMultiValue", - "TimeZone", - "URL")] - [System.string] - $Type, - - [parameter(Mandatory = $false)] - [System.string] - $Description, - - [parameter(Mandatory = $false)] - [ValidateSet("Mandatory", "Optin","Optout", "Disabled")] - [System.string] - $PolicySetting, - - [parameter(Mandatory = $false)] - [ValidateSet("Public", "Contacts", "Organization", "Manager", "Private")] - [System.string] - $PrivacySetting, - - [parameter(Mandatory = $false)] - [System.string] - $MappingConnectionName, - - [parameter(Mandatory = $false)] - [System.string] - $MappingPropertyName, - - [parameter(Mandatory = $false)] - [System.string] - $MappingDirection, - - [parameter(Mandatory = $false)] - [System.uint32] - $Length, - - [parameter(Mandatory = $false)] - [System.uint32] - $DisplayOrder, - - [parameter(Mandatory = $false)] - [System.Boolean] - $IsEventLog, - - [parameter(Mandatory = $false)] - [System.Boolean] - $IsVisibleOnEditor, - - [parameter(Mandatory = $false)] - [System.Boolean] - $IsVisibleOnViewer, - - [parameter(Mandatory = $false)] - [System.Boolean] - $IsUserEditable, - - [parameter(Mandatory = $false)] - [System.Boolean] - $IsAlias, - - [parameter(Mandatory = $false)] - [System.Boolean] - $IsSearchable, - - [parameter(Mandatory = $false)] - [System.Boolean] - $UserOverridePrivacy, - - [parameter(Mandatory = $false)] - [System.string] - $TermStore, - - [parameter(Mandatory = $false)] - [System.string] - $TermGroup, - - [parameter(Mandatory = $false)] - [System.string] - $TermSet, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - - ) - - Write-Verbose -Message "Testing for user profile property $Name" - - $PSBoundParameters.Ensure = $Ensure - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($Ensure -eq "Present") - { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Name", - "DisplayName", - "Type", - "Description", - "PolicySetting", - "PrivacySetting", - "MappingConnectionName", - "MappingPropertyName", - "MappingDirection", - "Length", - "DisplayOrder", - "IsEventLog", - "IsVisibleOnEditor", - "IsVisibleOnViewer", - "IsUserEditable", - "IsAlias", - "IsSearchabe", - "UserOverridePrivacy", - "TermGroup", - "TermStore", - "TermSet", - "Ensure") - } - else - { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileProperty/MSFT_SPUserProfileProperty.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileProperty/MSFT_SPUserProfileProperty.schema.mof deleted file mode 100644 index c7bad60c..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileProperty/MSFT_SPUserProfileProperty.schema.mof +++ /dev/null @@ -1,28 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPUserProfileProperty")] -class MSFT_SPUserProfileProperty : OMI_BaseResource -{ - [Key, Description("The internal name of the user profile property")] string Name; - [Write, Description("Present if the property should exist, absent if it should be removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Required, Description("The name of the user profile service application")] string UserProfileService; - [Write, Description("The display name of the property")] string DisplayName; - [Write, Description("The type of the property"), ValueMap{"BigInteger","Binary","Boolean","Date","DateNoYear","DateTime","Email","Float","Guid","HTML","Integer","Person","String","StringMultiValue","TimeZone","URL"}, Values{"BigInteger","Binary","Boolean","Date","DateNoYear","DateTime","Email","Float","Guid","HTML","Integer","Person","String","StringMultiValue","TimeZone","URL"}] string Type; - [Write, Description("The description of the property")] string Description; - [Write, Description("The policy setting to apply to the property"), ValueMap{"Mandatory","Optin","Optout","Disabled"}, Values{"Mandatory","Optin","Optout","Disabled"}] string PolicySetting; - [Write, Description("The privacy setting for the property"), ValueMap{"Public","Contacts","Organization","Manager","Private"}, Values{"Public","Contacts","Organization","Manager","Private"}] string PrivacySetting; - [Write, Description("The name of the UPS connect to map this property to")] string MappingConnectionName; - [Write, Description("The name of the property from the UPS connection to map to")] string MappingPropertyName; - [Write, Description("The direction of the mapping, either Import or Export")] string MappingDirection; - [Write, Description("The length of the field")] uint32 Length; - [Write, Description("The display order to put the property in to the list at")] uint32 DisplayOrder; - [Write, Description("Is this field used for event logging")] boolean IsEventLog; - [Write, Description("Is this field visible when editing a users profile, or hidden from editing")] boolean IsVisibleOnEditor; - [Write, Description("Is this field visible when viewing a users profile")] boolean IsVisibleOnViewer; - [Write, Description("Is this field able to be edited by a user, or only an administrator")] boolean IsUserEditable; - [Write, Description("Is this field an alias that can be used to refer to a user by")] boolean IsAlias; - [Write, Description("Is this field able to be searched upon")] boolean IsSearchable; - [Write, Description("Can users override the default privacy policy")] boolean UserOverridePrivacy; - [Write, Description("The name of the term store to look up managed terms from")] string TermStore; - [Write, Description("The name of the term store group that terms are in for this field")] string TermGroup; - [Write, Description("The name of the term set to allow values to be selected from")] string TermSet; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileSection/MSFT_SPUserProfileSection.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileSection/MSFT_SPUserProfileSection.psm1 deleted file mode 100644 index d0cce7b4..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileSection/MSFT_SPUserProfileSection.psm1 +++ /dev/null @@ -1,240 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.string] - $Name, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.string] - $UserProfileService, - - [parameter(Mandatory = $false)] - [System.string] - $DisplayName, - - [parameter(Mandatory = $false)] - [System.uint32] - $DisplayOrder, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting user profile section $Name" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $upsa = Get-SPServiceApplication -Name $params.UserProfileService ` - -ErrorAction SilentlyContinue - $nullReturn = @{ - Name = $params.Name - Ensure = "Absent" - UserProfileService = $params.UserProfileService - } - - if ($null -eq $upsa) - { - return $nullReturn - } - - $caURL = (Get-SpWebApplication -IncludeCentralAdministration | Where-Object -FilterScript { - $_.IsAdministrationWebApplication -eq $true - }).Url - $context = Get-SPServiceContext -Site $caURL - $userProfileConfigManager = New-Object -TypeName "Microsoft.Office.Server.UserProfiles.UserProfileConfigManager" ` - -ArgumentList $context - $properties = $userProfileConfigManager.GetPropertiesWithSection() - - $userProfileProperty = $properties.GetSectionByName($params.Name) - if ($null -eq $userProfileProperty) - { - return $nullReturn - } - - return @{ - Name = $userProfileProperty.Name - UserProfileService = $params.UserProfileService - DisplayName = $userProfileProperty.DisplayName - DisplayOrder =$userProfileProperty.DisplayOrder - Ensure = "Present" - } - - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.string] - $Name, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.string] - $UserProfileService, - - [parameter(Mandatory = $false)] - [System.string] - $DisplayName, - - [parameter(Mandatory = $false)] - [System.uint32] - $DisplayOrder, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - # note for integration test: CA can take a couple of minutes to notice the change. - # don't try refreshing properties page. go through from a fresh "flow" from Service apps page - Write-Verbose -Message "Setting user profile section $Name" - - $PSBoundParameters.Ensure = $Ensure - - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $ups = Get-SPServiceApplication -Name $params.UserProfileService ` - -ErrorAction SilentlyContinue - - if ($null -eq $ups) - { - throw "Service application $($params.UserProfileService) not found" - } - - $caURL = (Get-SpWebApplication -IncludeCentralAdministration | Where-Object -FilterScript { - $_.IsAdministrationWebApplication -eq $true - }).Url - $context = Get-SPServiceContext $caURL - - $userProfileConfigManager = New-Object -TypeName "Microsoft.Office.Server.UserProfiles.UserProfileConfigManager" ` - -ArgumentList $context - - if ($null -eq $userProfileConfigManager) - { #if config manager returns null when ups is available then isuee is permissions - throw "Account running process needs admin permission on user profile service application" - } - $properties = $userProfileConfigManager.GetPropertiesWithSection() - $userProfileProperty = $properties.GetSectionByName($params.Name) - - if ($params.ContainsKey("Ensure") -and $params.Ensure -eq "Absent") - { - if ($null -ne $userProfileProperty) - { - $properties.RemoveSectionByName($params.Name) - } - return - } - elseif($null -eq $userProfileProperty) - { - $coreProperty = $properties.Create($true) - $coreProperty.Name = $params.Name - $coreProperty.DisplayName = $params.DisplayName - $coreProperty.Commit() - } - else - { - Set-SPDscObjectPropertyIfValuePresent -ObjectToSet $userProfileProperty ` - -PropertyToSet "DisplayName" ` - -ParamsValue $params ` - -ParamKey "DisplayName" - $userProfileProperty.Commit() - } - - #region display order - if ($params.ContainsKey("DisplayOrder")) - { - $properties = $userProfileConfigManager.GetPropertiesWithSection() - $properties.SetDisplayOrderBySectionName($params.Name,$params.DisplayOrder) - $properties.CommitDisplayOrder() - } - - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.string] - $Name, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.string] - $UserProfileService, - - [parameter(Mandatory = $false)] - [System.string] - $DisplayName, - - [parameter(Mandatory = $false)] - [System.uint32] - $DisplayOrder, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - - ) - - Write-Verbose -Message "Testing user profile section $Name" - - $PSBoundParameters.Ensure = $Ensure - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($null -eq $CurrentValues) - { - return $false - } - - if ($Ensure -eq "Present") - { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Name", - "DisplayName", - "DisplayOrder", - "Ensure") - } - else - { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileSection/MSFT_SPUserProfileSection.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileSection/MSFT_SPUserProfileSection.schema.mof deleted file mode 100644 index 2908ffc7..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileSection/MSFT_SPUserProfileSection.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPUserProfileSection")] -class MSFT_SPUserProfileSection : OMI_BaseResource -{ - [Key, Description("The internal name of the user profile section")] string Name; - [Write, Description("Present if the section should exist, absent if it should be removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Required, Description("The name of the user profile service application this section exists in")] string UserProfileService; - [Write, Description("The display name of the section")] string DisplayName; - [Write, Description("A number used to sort sections by")] uint32 DisplayOrder; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/MSFT_SPUserProfileServiceApp.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/MSFT_SPUserProfileServiceApp.psm1 deleted file mode 100644 index 70d7f4f2..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/MSFT_SPUserProfileServiceApp.psm1 +++ /dev/null @@ -1,453 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $ProxyName, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $FarmAccount, - - [parameter(Mandatory = $false)] - [System.String] - $MySiteHostLocation, - - [parameter(Mandatory = $false)] - [System.String] - $ProfileDBName, - - [parameter(Mandatory = $false)] - [System.String] - $ProfileDBServer, - - [parameter(Mandatory = $false)] - [System.String] - $SocialDBName, - - [parameter(Mandatory = $false)] - [System.String] - $SocialDBServer, - - [parameter(Mandatory = $false)] - [System.String] - $SyncDBName, - - [parameter(Mandatory = $false)] - [System.String] - $SyncDBServer, - - [parameter(Mandatory = $false)] - [System.Boolean] - $EnableNetBIOS = $false, - - [parameter(Mandatory = $false)] - [System.Boolean] - $NoILMUsed = $false, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting user profile service application $Name" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue - $nullReturn = @{ - Name = $params.Name - Ensure = "Absent" - } - if ($null -eq $serviceApps) - { - return $nullReturn - } - $serviceApp = $serviceApps | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Server.Administration.UserProfileApplication" - } - - if ($null -eq $serviceApp) - { - return $nullReturn - } - else - { - $databases = @{} - $propertyFlags = [System.Reflection.BindingFlags]::Instance ` - -bor [System.Reflection.BindingFlags]::NonPublic - - $propData = $serviceApp.GetType().GetProperties($propertyFlags) - - $socialProp = $propData | Where-Object -FilterScript { - $_.Name -eq "SocialDatabase" - } - $databases.Add("SocialDatabase", $socialProp.GetValue($serviceApp)) - - $profileProp = $propData | Where-Object -FilterScript { - $_.Name -eq "ProfileDatabase" - } - $databases.Add("ProfileDatabase", $profileProp.GetValue($serviceApp)) - - $syncProp = $propData | Where-Object -FilterScript { - $_.Name -eq "SynchronizationDatabase" - } - $databases.Add("SynchronizationDatabase", $syncProp.GetValue($serviceApp)) - - $spFarm = Get-SPFarm - - if ($params.FarmAccount.UserName -eq $spFarm.DefaultServiceAccount.Name) - { - $farmAccount = $params.FarmAccount - } - else - { - $farmAccount = $spFarm.DefaultServiceAccount.Name - } - $serviceAppProxies = Get-SPServiceApplicationProxy -ErrorAction SilentlyContinue - if ($null -ne $serviceAppProxies) - { - $serviceAppProxy = $serviceAppProxies | Where-Object -FilterScript { - $serviceApp.IsConnected($_) - } - if ($null -ne $serviceAppProxy) - { - $proxyName = $serviceAppProxy.Name - } - } - return @{ - Name = $serviceApp.DisplayName - ProxyName = $proxyName - ApplicationPool = $serviceApp.ApplicationPool.Name - FarmAccount = $farmAccount - MySiteHostLocation = $params.MySiteHostLocation - ProfileDBName = $databases.ProfileDatabase.Name - ProfileDBServer = $databases.ProfileDatabase.Server.Name - SocialDBName = $databases.SocialDatabase.Name - SocialDBServer = $databases.SocialDatabase.Server.Name - SyncDBName = $databases.SynchronizationDatabase.Name - SyncDBServer = $databases.SynchronizationDatabase.Server.Name - InstallAccount = $params.InstallAccount - EnableNetBIOS = $serviceApp.NetBIOSDomainNamesEnabled - NoILMUsed = $serviceApp.NoILMUsed - Ensure = "Present" - } - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $ProxyName, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $FarmAccount, - - [parameter(Mandatory = $false)] - [System.String] - $MySiteHostLocation, - - [parameter(Mandatory = $false)] - [System.String] - $ProfileDBName, - - [parameter(Mandatory = $false)] - [System.String] - $ProfileDBServer, - - [parameter(Mandatory = $false)] - [System.String] - $SocialDBName, - - [parameter(Mandatory = $false)] - [System.String] - $SocialDBServer, - - [parameter(Mandatory = $false)] - [System.String] - $SyncDBName, - - [parameter(Mandatory = $false)] - [System.String] - $SyncDBServer, - - [parameter(Mandatory = $false)] - [System.Boolean] - $EnableNetBIOS = $false, - - [parameter(Mandatory = $false)] - [System.Boolean] - $NoILMUsed = $false, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting user profile service application $Name" - - if ($Ensure -eq "Present") - { - if ($PSBoundParameters.ContainsKey("FarmAccount") -eq $false) - { - throw ("Unable to provision the user profile service without the Farm Account. " + ` - "Please specify the FarmAccount parameter and try again") - return - } - - Write-Verbose -Message "Creating user profile service application $Name" - - # Add the FarmAccount to the local Administrators group, if it's not already there - $isLocalAdmin = Test-SPDSCUserIsLocalAdmin -UserName $FarmAccount.UserName - - if (!$isLocalAdmin) - { - Add-SPDSCUserToLocalAdmin -UserName $FarmAccount.UserName - } - - $result = Invoke-SPDSCCommand -Credential $FarmAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $updateEnableNetBIOS = $false - if ($params.ContainsKey("EnableNetBIOS")) - { - $updateEnableNetBIOS = $true - $enableNetBIOS = $params.EnableNetBIOS - $params.Remove("EnableNetBIOS") | Out-Null - } - - $updateNoILMUsed = $false - if ($params.ContainsKey("NoILMUsed")) - { - $updateNoILMUsed = $true - $NoILMUsed = $params.NoILMUsed - $params.Remove("NoILMUsed") | Out-Null - } - - if ($params.ContainsKey("InstallAccount")) - { - $params.Remove("InstallAccount") | Out-Null - } - if ($params.ContainsKey("Ensure")) - { - $params.Remove("Ensure") | Out-Null - } - $params.Remove("FarmAccount") | Out-Null - - $params = Rename-SPDSCParamValue -params $params ` - -oldName "SyncDBName" ` - -newName "ProfileSyncDBName" - - $params = Rename-SPDSCParamValue -params $params ` - -oldName "SyncDBServer" ` - -newName "ProfileSyncDBServer" - - if ($params.ContainsKey("ProxyName")) - { - $pName = $params.ProxyName - $params.Remove("ProxyName") | Out-Null - } - if ($null -eq $pName) - { - $pName = "$($params.Name) Proxy" - } - - $serviceApps = Get-SPServiceApplication -Name $params.Name ` - -ErrorAction SilentlyContinue - $app = $serviceApps | Select-Object -First 1 - if ($null -eq $serviceApps) - { - $app = New-SPProfileServiceApplication @params - if ($null -ne $app) - { - New-SPProfileServiceApplicationProxy -Name $pName ` - -ServiceApplication $app ` - -DefaultProxyGroup - } - } - - if (($updateEnableNetBIOS -eq $true) -or ($updateNoILMUsed -eq $true)) - { - if (($updateEnableNetBIOS -eq $true) -and ` - ($app.NetBIOSDomainNamesEnabled -ne $enableNetBIOS)) - { - $app.NetBIOSDomainNamesEnabled = $enableNetBIOS - } - - if (($updateNoILMUsed -eq $true) -and ` - ($app.NoILMUsed -ne $NoILMUsed)) - { - $app.NoILMUsed = $NoILMUsed - } - $app.Update() - } - } - - # Remove the FarmAccount from the local Administrators group, if it was added above - if (!$isLocalAdmin) - { - Remove-SPDSCUserToLocalAdmin -UserName $FarmAccount.UserName - } - } - - if ($Ensure -eq "Absent") - { - Write-Verbose -Message "Removing user profile service application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - - $params = $args[0] - - $app = Get-SPServiceApplication -Name $params.Name ` - | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Server.Administration.UserProfileApplication" - } - - $proxies = Get-SPServiceApplicationProxy - foreach($proxyInstance in $proxies) - { - if($app.IsConnected($proxyInstance)) - { - $proxyInstance.Delete() - } - } - - Remove-SPServiceApplication -Identity $app -Confirm:$false - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $ProxyName, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $FarmAccount, - - [parameter(Mandatory = $false)] - [System.String] - $MySiteHostLocation, - - [parameter(Mandatory = $false)] - [System.String] - $ProfileDBName, - - [parameter(Mandatory = $false)] - [System.String] - $ProfileDBServer, - - [parameter(Mandatory = $false)] - [System.String] - $SocialDBName, - - [parameter(Mandatory = $false)] - [System.String] - $SocialDBServer, - - [parameter(Mandatory = $false)] - [System.String] - $SyncDBName, - - [parameter(Mandatory = $false)] - [System.String] - $SyncDBServer, - - [parameter(Mandatory = $false)] - [System.Boolean] - $EnableNetBIOS = $false, - - [parameter(Mandatory = $false)] - [System.Boolean] - $NoILMUsed = $false, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing for user profile service application $Name" - - $PSBoundParameters.Ensure = $Ensure - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if($Ensure -eq "Present") - { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Name", - "EnableNetBIOS", - "NoILMUsed", - "Ensure") - } - else - { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Name", "Ensure") - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/MSFT_SPUserProfileServiceApp.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/MSFT_SPUserProfileServiceApp.schema.mof deleted file mode 100644 index 5c320b89..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/MSFT_SPUserProfileServiceApp.schema.mof +++ /dev/null @@ -1,19 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPUserProfileServiceApp")] -class MSFT_SPUserProfileServiceApp : OMI_BaseResource -{ - [Key, Description("The name of the user profile service")] string Name; - [Write, Description("The proxy name, if not specified will be /Name of service app/ Proxy")] string ProxyName; - [Required, Description("The name of the application pool to run the service app in")] string ApplicationPool; - [Write, Description("The farm account to use when provisioning the app"), EmbeddedInstance("MSFT_Credential")] String FarmAccount; - [Write, Description("The URL of the my site host collection")] string MySiteHostLocation; - [Write, Description("The name of the profile database")] string ProfileDBName; - [Write, Description("The name of the server to host the profile database")] string ProfileDBServer; - [Write, Description("The name of the social database")] string SocialDBName; - [Write, Description("The name of the database server to host the social database")] string SocialDBServer; - [Write, Description("The name of the sync database")] string SyncDBName; - [Write, Description("The name of the database server to host the sync database")] string SyncDBServer; - [Write, Description("Whether Farm should resolve NetBIOS domain names")] boolean EnableNetBIOS; - [Write, Description("Specifies if the service application should be configured to use AD Import")] boolean NoILMUsed; - [Write, Description("Present if the service app should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceAppPermissions/MSFT_SPUserProfileServiceAppPermissions.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceAppPermissions/MSFT_SPUserProfileServiceAppPermissions.psm1 deleted file mode 100644 index 6ffb2797..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceAppPermissions/MSFT_SPUserProfileServiceAppPermissions.psm1 +++ /dev/null @@ -1,365 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $ProxyName, - - [parameter(Mandatory = $true)] - [System.String[]] - $CreatePersonalSite, - - [parameter(Mandatory = $true)] - [System.String[]] - $FollowAndEditProfile, - - [parameter(Mandatory = $true)] - [System.String[]] - $UseTagsAndNotes, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting permissions for user profile service proxy '$ProxyName" - - Confirm-SPDscUpaPermissionsConfig -Parameters $PSBoundParameters - - $result = Invoke-SPDSCCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - $params = $args[0] - - $proxy = Get-SPServiceApplicationProxy | Where-Object { $_.DisplayName -eq $params.ProxyName } - if ($null -eq $proxy) - { - return @{ - ProxyName = $params.ProxyName - CreatePersonalSite = $null - FollowAndEditProfile = $null - UseTagsAndNotes = $null - InstallAccount = $params.InstallAccount - } - } - $security = Get-SPProfileServiceApplicationSecurity -ProfileServiceApplicationProxy $proxy - - $createPersonalSite = @() - $followAndEditProfile = @() - $useTagsAndNotes = @() - - foreach ($securityEntry in $security.AccessRules) - { - $user = $securityEntry.Name - if ($user -like "i:*|*" -or $user -like "c:*|*") - { - # Only claims users can be processed by the PowerShell cmdlets, so only - # report on and manage the claims identities - if ($user -eq "c:0(.s|true") - { - $user = "Everyone" - } - else - { - $user = (New-SPClaimsPrincipal -Identity $user -IdentityType EncodedClaim).Value - } - } - if ($securityEntry.AllowedRights.ToString() -eq "All") - { - $createPersonalSite += $user - $followAndEditProfile += $user - $useTagsAndNotes += $user - } - if ($securityEntry.AllowedRights.ToString() -like "*UsePersonalFeatures*") - { - $followAndEditProfile += $user - } - if ($securityEntry.AllowedRights.ToString() -like "*UseSocialFeatures*") - { - $useTagsAndNotes += $user - } - if (($securityEntry.AllowedRights.ToString() -like "*CreatePersonalSite*") ` - -and ($securityEntry.AllowedRights.ToString() -like "*UseMicrobloggingAndFollowing*")) - { - $createPersonalSite += $user - } - } - - if ($createPersonalSite.Length -eq 0) - { - $createPersonalSite += "None" - } - if ($followAndEditProfile.Length -eq 0) - { - $followAndEditProfile += "None" - } - if ($useTagsAndNotes.Length -eq 0) - { - $useTagsAndNotes += "None" - } - - return @{ - ProxyName = $params.ProxyName - CreatePersonalSite = $createPersonalSite - FollowAndEditProfile = $followAndEditProfile - UseTagsAndNotes = $useTagsAndNotes - InstallAccount = $params.InstallAccount - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $ProxyName, - - [parameter(Mandatory = $true)] - [System.String[]] - $CreatePersonalSite, - - [parameter(Mandatory = $true)] - [System.String[]] - $FollowAndEditProfile, - - [parameter(Mandatory = $true)] - [System.String[]] - $UseTagsAndNotes, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting permissions for user profile service proxy '$ProxyName" - - Confirm-SPDscUpaPermissionsConfig -Parameters $PSBoundParameters - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($CurrentValues.CreatePersonalSite -contains "NT AUTHORITY\Authenticated Users" ` - -or $CurrentValues.FollowAndEditProfile -contains "NT AUTHORITY\Authenticated Users" ` - -or $CurrentValues.UseTagsAndNotes -contains "NT AUTHORITY\Authenticated Users") - { - Write-Warning -Message ("Permissions were found for the non-claims identity " + ` - "'NT AUTHORITY\Authenticated Users'. This will be removed as " + ` - "identies on service app proxy permissions should be claims based.") - - Invoke-SPDSCCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - $params = $args[0] - - $proxy = Get-SPServiceApplicationProxy | Where-Object { $_.DisplayName -eq $params.ProxyName } - $security = Get-SPProfileServiceApplicationSecurity -ProfileServiceApplicationProxy $proxy - Revoke-SPObjectSecurity -Identity $security -All - Set-SPProfileServiceApplicationSecurity -Identity $security -ProfileServiceApplicationProxy $proxy -Confirm:$false - Write-Verbose -Message "Successfully cleared all permissions on the service app proxy" - } - - Write-Verbose -Message "Waiting 2 minutes for proxy permissions to be applied fully before continuing" - Start-Sleep -Seconds 120 - Write-Verbose -Message "Continuing configuration by getting the new current values." - $CurrentValues = Get-TargetResource @PSBoundParameters - } - - Invoke-SPDSCCommand -Credential $InstallAccount -Arguments @($PSBoundParameters, $CurrentValues) -ScriptBlock { - $params = $args[0] - $CurrentValues = $args[1] - - $proxy = Get-SPServiceApplicationProxy | Where-Object { $_.DisplayName -eq $params.ProxyName } - if ($null -eq $proxy) - { - throw "Unable to find service application proxy called '$($params.ProxyName)'" - return - } - $security = Get-SPProfileServiceApplicationSecurity -ProfileServiceApplicationProxy $proxy - - $permissionsToUpdate = @{ - "CreatePersonalSite" = "Create Personal Site" - "FollowAndEditProfile" = "Use Personal Features" - "UseTagsAndNotes" = "Use Social Features" - } - - foreach ($permission in $permissionsToUpdate.Keys) - { - $permissionsDiff = Compare-Object -ReferenceObject $CurrentValues.$permission ` - -DifferenceObject $params.$permission - - $everyoneDiff = $permissionsDiff | Where-Object -FilterScript { $_.InputObject -eq "Everyone" } - $noneDiff = $permissionsDiff | Where-Object -FilterScript { $_.InputObject -eq "None" } - - if (($null -ne $noneDiff) -and ($noneDiff.SideIndicator -eq "=>")) - { - # Need to remove everyone - foreach($user in $CurrentValues.$permission) - { - if ($user -ne "Everyone" -and $user -ne "None") - { - $isUser = Test-SPDSCIsADUser -IdentityName $user - if ($isUser -eq $true) - { - $claim = New-SPClaimsPrincipal -Identity $user ` - -IdentityType WindowsSamAccountName - } - else - { - $claim = New-SPClaimsPrincipal -Identity $user ` - -IdentityType WindowsSecurityGroupName - } - Revoke-SPObjectSecurity -Identity $security ` - -Principal $claim ` - -Rights $permissionsToUpdate.$permission - } - elseif ($user -eq "Everyone") - { - # Revoke the all user permissions - $allClaimsUsersClaim = New-SPClaimsPrincipal -Identity "c:0(.s|true" ` - -IdentityType EncodedClaim - Revoke-SPObjectSecurity -Identity $security ` - -Principal $allClaimsUsersClaim ` - -Rights $permissionsToUpdate.$permission - } - } - } - elseif (($null -ne $everyoneDiff) -and ($everyoneDiff.SideIndicator -eq "=>")) - { - # Need to add everyone, so remove all the permissions that exist currently of this type - # and then add the everyone permissions - foreach($user in $CurrentValues.$permission) - { - if ($user -ne "Everyone" -and $user -ne "None") - { - $isUser = Test-SPDSCIsADUser -IdentityName $user - if ($isUser -eq $true) { - $claim = New-SPClaimsPrincipal -Identity $user ` - -IdentityType WindowsSamAccountName - } - else - { - $claim = New-SPClaimsPrincipal -Identity $user ` - -IdentityType WindowsSecurityGroupName - } - Revoke-SPObjectSecurity -Identity $security ` - -Principal $claim ` - -Rights $permissionsToUpdate.$permission - } - } - - $allClaimsUsersClaim = New-SPClaimsPrincipal -Identity "c:0(.s|true" ` - -IdentityType EncodedClaim - Grant-SPObjectSecurity -Identity $security ` - -Principal $allClaimsUsersClaim ` - -Rights $permissionsToUpdate.$permission - } - else - { - # permission changes aren't to everyone or none, process each change - foreach ($permissionChange in $permissionsDiff) - { - if ($permissionChange.InputObject -ne "Everyone" -and ` - $permissionChange.InputObject -ne "None") - { - $isUser = Test-SPDSCIsADUser -IdentityName $permissionChange.InputObject - if ($isUser -eq $true) - { - $claim = New-SPClaimsPrincipal -Identity $permissionChange.InputObject ` - -IdentityType WindowsSamAccountName - } - else - { - $claim = New-SPClaimsPrincipal -Identity $permissionChange.InputObject ` - -IdentityType WindowsSecurityGroupName - } - if ($permissionChange.SideIndicator -eq "=>") - { - # Grant permission to the identity - Grant-SPObjectSecurity -Identity $security ` - -Principal $claim ` - -Rights $permissionsToUpdate.$permission - } - if ($permissionChange.SideIndicator -eq "<=") - { - # Revoke permission for the identity - Revoke-SPObjectSecurity -Identity $security ` - -Principal $claim ` - -Rights $permissionsToUpdate.$permission - } - } - } - } - } - - Set-SPProfileServiceApplicationSecurity -Identity $security ` - -ProfileServiceApplicationProxy $proxy ` - -Confirm:$false - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $ProxyName, - - [parameter(Mandatory = $true)] - [System.String[]] - $CreatePersonalSite, - - [parameter(Mandatory = $true)] - [System.String[]] - $FollowAndEditProfile, - - [parameter(Mandatory = $true)] - [System.String[]] - $UseTagsAndNotes, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing permissions for user profile service proxy '$ProxyName" - - Confirm-SPDscUpaPermissionsConfig -Parameters $PSBoundParameters - - $CurrentValues = Get-TargetResource @PSBoundParameters - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("CreatePersonalSite", ` - "FollowAndEditProfile", ` - "UseTagsAndNotes") -} - -function Confirm-SPDscUpaPermissionsConfig() -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [Object] - $Parameters - ) - - @( - "CreatePersonalSite", - "FollowAndEditProfile", - "UseTagsAndNotes" - ) | ForEach-Object -Process { - if (($Parameters.$_ -contains "Everyone") -and ($Parameters.$_ -contains "None")) - { - throw ("You can not specify 'Everyone' and 'None' in the same property. " + ` - "Check the value for the '$_' property on this resource.") - } - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceAppPermissions/MSFT_SPUserProfileServiceAppPermissions.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceAppPermissions/MSFT_SPUserProfileServiceAppPermissions.schema.mof deleted file mode 100644 index 499f6862..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceAppPermissions/MSFT_SPUserProfileServiceAppPermissions.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPUserProfileServiceAppPermissions")] -class MSFT_SPUserProfileServiceAppPermissions : OMI_BaseResource -{ - [Key, Description("The name of the proxy that is attached to the user profile service you wish to set permissions for")] string ProxyName; - [Required, Description("A list of user principals that will have the Create personal site permission")] string CreatePersonalSite[]; - [Required, Description("A list of user principals that will have the Follow users and edit profile permission")] string FollowAndEditProfile[]; - [Required, Description("A list of user principals that will have the Use tags and notes permission")] string UseTagsAndNotes[]; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncConnection/MSFT_SPUserProfileSyncConnection.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncConnection/MSFT_SPUserProfileSyncConnection.psm1 deleted file mode 100644 index c1cbf3f4..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncConnection/MSFT_SPUserProfileSyncConnection.psm1 +++ /dev/null @@ -1,383 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $Forest, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $ConnectionCredentials, - - [parameter(Mandatory = $true)] - [System.String] - $UserProfileService, - - [parameter(Mandatory = $true)] - [System.String[]] - $IncludedOUs, - - [parameter(Mandatory = $false)] - [System.String[]] - $ExcludedOUs, - - [parameter(Mandatory = $false)] - [System.String] - $Server, - - [parameter(Mandatory = $false)] - [System.Boolean] - $Force, - - [parameter(Mandatory = $false)] - [System.Boolean] - $UseSSL, - - [parameter(Mandatory = $false)] - [ValidateSet("ActiveDirectory","BusinessDataCatalog")] - [System.String] - $ConnectionType, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting user profile service sync connection $Name" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $ups = Get-SPServiceApplication -Name $params.UserProfileService ` - -ErrorAction SilentlyContinue - - if ($null -eq $ups) - { - return $null - } - else - { - $context = Get-SPDSCServiceContext -ProxyGroup $ups.ServiceApplicationProxyGroup - $upcm = New-Object -TypeName "Microsoft.Office.Server.UserProfiles.UserProfileConfigManager" ` - -ArgumentList $context - - $connection = $upcm.ConnectionManager | Where-Object -FilterScript { - $_.DisplayName -eq $params.Name - } - if ($null -eq $connection) - { - return $null - } - $namingContext = $connection.NamingContexts | Select-Object -First 1 - if ($null -eq $namingContext) - { - return $null - } - $accountCredentials = "$($connection.AccountDomain)\$($connection.AccountUsername)" - $domainController = $namingContext.PreferredDomainControllers | Select-Object -First 1 - return @{ - UserProfileService = $UserProfileService - Forest = $connection.Server - Name = $namingContext.DisplayName - Credentials = $accountCredentials - IncludedOUs = $namingContext.ContainersIncluded - ExcludedOUs = $namingContext.ContainersExcluded - Server =$domainController - UseSSL = $connection.UseSSL - ConnectionType = $connection.Type.ToString() - Force = $params.Force - } - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $Forest, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $ConnectionCredentials, - - [parameter(Mandatory = $true)] - [System.String] - $UserProfileService, - - [parameter(Mandatory = $true)] - [System.String[]] - $IncludedOUs, - - [parameter(Mandatory = $false)] - [System.String[]] - $ExcludedOUs, - - [parameter(Mandatory = $false)] - [System.String] - $Server, - - [parameter(Mandatory = $false)] - [System.Boolean] - $Force, - - [parameter(Mandatory = $false)] - [System.Boolean] - $UseSSL, - - [parameter(Mandatory = $false)] - [ValidateSet("ActiveDirectory","BusinessDataCatalog")] - [System.String] - $ConnectionType, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting user profile service sync connection $Name" - - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` - -ScriptBlock { - - $params = $args[0] - $scriptRoot = $args[1] - - Import-Module -Name (Join-Path $scriptRoot "MSFT_SPUserProfileSyncConnection.psm1") - - if ($params.ContainsKey("InstallAccount")) { $params.Remove("InstallAccount") | Out-Null } - $ups = Get-SPServiceApplication -Name $params.UserProfileService -ErrorAction SilentlyContinue - - if ($null -eq $ups) { - throw "User Profile Service Application $($params.UserProfileService) not found" - } - $context = Get-SPDSCServiceContext -ProxyGroup $ups.ServiceApplicationProxyGroup - - Write-Verbose -Message "retrieving UserProfileConfigManager " - $upcm = New-Object -TypeName "Microsoft.Office.Server.UserProfiles.UserProfileConfigManager" ` - -ArgumentList @($context) - - if ($upcm.IsSynchronizationRunning()) - { - throw "Synchronization is in Progress." - } - - $connection = $upcm.ConnectionManager | Where-Object -FilterScript { - $_.DisplayName -eq $params.Name - } | Select-Object -first 1 - - if ($null -ne $connection -and $params.Forest -ieq $connection.Server) - { - $domain = $params.ConnectionCredentials.UserName.Split("\")[0] - $userName= $params.ConnectionCredentials.UserName.Split("\")[1] - $connection.SetCredentials($domain, $userName, $params.ConnectionCredentials.Password) - - $connection.NamingContexts | ForEach-Object -Process { - $namingContext = $_ - if ($params.ContainsKey("IncludedOUs")) - { - $namingContext.ContainersIncluded.Clear() - $params.IncludedOUs| ForEach-Object -Process { - $namingContext.ContainersIncluded.Add($_) - } - } - $namingContext.ContainersExcluded.Clear() - if ($params.ContainsKey("ExcludedOUs")) - { - $params.IncludedOUs| ForEach-Object -Process { - $namingContext.ContainersExcluded.Add($_) - } - } - } - $connection.Update() - $connection.RefreshSchema($params.ConnectionCredentials.Password) - - return - } - else - { - Write-Verbose -Message "creating a new connection " - if ($null -ne $connection -and $params.Forest -ine $connection.Server) - { - if ($params.ContainsKey("Force") -and $params.Force -eq $true) - { - $connection.Delete() - } - else - { - throw "connection exists and forest is different. use force" - } - - } - - $servers = New-Object -TypeName "System.Collections.Generic.List[[System.String]]" - if ($params.ContainsKey("Server")) - { - $servers.add($params.Server) - } - $listIncludedOUs = New-Object -TypeName "System.Collections.Generic.List[[System.String]]" - $params.IncludedOUs | ForEach-Object -Process { - $listIncludedOUs.Add($_) - } - - $listExcludedOUs = New-Object -TypeName "System.Collections.Generic.List[[System.String]]" - if ($params.ContainsKey("ExcludedOus")) - { - $params.ExcludedOus | ForEach-Object -Process { - $listExcludedOUs.Add($_) - } - } - $list = New-Object -TypeName System.Collections.Generic.List[[Microsoft.Office.Server.UserProfiles.DirectoryServiceNamingContext]] - - $partition = Get-SPDSCADSIObject -LdapPath ("LDAP://" +("DC=" + $params.Forest.Replace(".", ",DC="))) - $list.Add((New-Object -TypeName "Microsoft.Office.Server.UserProfiles.DirectoryServiceNamingContext" ` - -ArgumentList @( - $partition.distinguishedName, - $params.Forest, - $false, - (New-Object -TypeName "System.Guid" ` - -ArgumentList $partition.objectGUID), - $listIncludedOUs, - $listExcludedOUs, - $null , - $false))) - $partition = Get-SPDSCADSIObject -LdapPath ("LDAP://CN=Configuration," + ("DC=" + $params.Forest.Replace(".", ",DC="))) - $list.Add((New-Object -TypeName "Microsoft.Office.Server.UserProfiles.DirectoryServiceNamingContext" ` - -ArgumentList @( - $partition.distinguishedName, - $params.Forest, - $true, - (New-Object -TypeName "System.Guid" ` - -ArgumentList $partition.objectGUID), - $listIncludedOUs , - $listExcludedOUs , - $null , - $false))) - - $userDomain = $params.ConnectionCredentials.UserName.Split("\")[0] - $userName= $params.ConnectionCredentials.UserName.Split("\")[1] - - $upcm.ConnectionManager.AddActiveDirectoryConnection( [Microsoft.Office.Server.UserProfiles.ConnectionType]::ActiveDirectory, ` - $params.Name, ` - $params.Forest, ` - $params.UseSSL, ` - $userDomain, ` - $userName, ` - $params.ConnectionCredentials.Password, ` - $list, ` - $null,` - $null) | Out-Null - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $Forest, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $ConnectionCredentials, - - [parameter(Mandatory = $true)] - [System.String] - $UserProfileService, - - [parameter(Mandatory = $true)] - [System.String[]] - $IncludedOUs, - - [parameter(Mandatory = $false)] - [System.String[]] - $ExcludedOUs, - - [parameter(Mandatory = $false)] - [System.String] - $Server, - - [parameter(Mandatory = $false)] - [System.Boolean] - $Force, - - [parameter(Mandatory = $false)] - [System.Boolean] - $UseSSL, - - [parameter(Mandatory = $false)] - [ValidateSet("ActiveDirectory","BusinessDataCatalog")] - [System.String] - $ConnectionType, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing for user profile service sync connection $Name" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($null -eq $CurrentValues) - { - return $false - } - - if ($Force -eq $true) - { - return $false - } - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Name", - "Forest", - "UserProfileService", - "Server", - "UseSSL", - "IncludedOUs", - "ExcludedOUs") -} - -<# -.DESCRIPTION - -This method is not intensed for public use, and was created to facilitate unit testing -#> -function Get-SPDSCADSIObject -{ - param( - [string] $LdapPath - ) - return [ADSI]($LdapPath) -} - - -Export-ModuleMember -Function *-TargetResource, Get-SPDSCADSIObject diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncConnection/MSFT_SPUserProfileSyncConnection.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncConnection/MSFT_SPUserProfileSyncConnection.schema.mof deleted file mode 100644 index be9b5ec5..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncConnection/MSFT_SPUserProfileSyncConnection.schema.mof +++ /dev/null @@ -1,15 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPUserProfileSyncConnection")] -class MSFT_SPUserProfileSyncConnection : OMI_BaseResource -{ - [Key, Description("The name of the connection")] string Name; - [Required, Description("The name of the AD forest to read from")] string Forest; - [Required, Description("The name of the user profile service that this connection is attached to")] string UserProfileService; - [Required, Description("The credentials to connect to Active Directory with"), EmbeddedInstance("MSFT_Credential")] string ConnectionCredentials; - [Required, Description("A list of the OUs to import users from")] string IncludedOUs[]; - [Write, Description("A list of the OUs to ignore users from")] string ExcludedOUs[]; - [Write, Description("The specific AD server to connect to")] string Server; - [Write, Description("Should SSL be used for the connection")] boolean UseSSL; - [Write, Description("Set to true to run the set method on every call to this resource")] boolean Force; - [Write, Description("The type of the connection - currently only Active Directory is supported"), ValueMap{"ActiveDirectory","BusinessDataCatalog"}, Values{"ActiveDirectory","BusinessDataCatalog"}] string ConnectionType; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] string InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncService/MSFT_SPUserProfileSyncService.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncService/MSFT_SPUserProfileSyncService.psm1 deleted file mode 100644 index 46f7f471..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncService/MSFT_SPUserProfileSyncService.psm1 +++ /dev/null @@ -1,375 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $UserProfileServiceAppName, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $FarmAccount, - - [parameter(Mandatory = $false)] - [System.Boolean] - $RunOnlyWhenWriteable, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting user profile sync service for $UserProfileServiceAppName" - - if ((Get-SPDSCInstalledProductVersion).FileMajorPart -ne 15) - { - throw [Exception] ("Only SharePoint 2013 is supported to deploy the user profile sync " + ` - "service via DSC, as 2016 does not use the FIM based sync service.") - } - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $syncServices = Get-SPServiceInstance -Server $env:COMPUTERNAME ` - -ErrorAction SilentlyContinue - - if ($null -eq $syncServices) - { - return @{ - UserProfileServiceAppName = $params.UserProfileServiceAppName - Ensure = "Absent" - FarmAccount = $params.FarmAccount - RunOnlyWhenWriteable = $params.RunOnlyWhenWriteable - InstallAccount = $params.InstallAccount - } - } - - $syncService = $syncServices | Where-Object -FilterScript { - $_.GetType().Name -eq "UserProfileServiceInstance" - } - - if ($null -eq $syncService) - { - $domain = (Get-CimInstance -ClassName Win32_ComputerSystem).Domain - $currentServer = "$($env:COMPUTERNAME).$domain" - $syncServices = Get-SPServiceInstance -Server $currentServer ` - -ErrorAction SilentlyContinue - $syncService = $syncServices | Where-Object -FilterScript { - $_.GetType().Name -eq "UserProfileServiceInstance" - } - } - - if ($null -eq $syncService) - { - return @{ - UserProfileServiceAppName = $params.UserProfileServiceAppName - Ensure = "Absent" - FarmAccount = $params.FarmAccount - RunOnlyWhenWriteable = $params.RunOnlyWhenWriteable - InstallAccount = $params.InstallAccount - } - } - if ($null -ne $syncService.UserProfileApplicationGuid -and ` - $syncService.UserProfileApplicationGuid -ne [Guid]::Empty) - { - $upa = Get-SPServiceInstance -Identity $syncService.UserProfileApplicationGuid ` - -ErrorAction SilentlyContinue - } - if ($syncService.Status -eq "Online") - { - $localEnsure = "Present" - } - else - { - $localEnsure = "Absent" - } - - $spFarm = Get-SPFarm - - if ($params.FarmAccount.UserName -eq $spFarm.DefaultServiceAccount.Name) - { - $farmAccount = $params.FarmAccount - } - else - { - $farmAccount = $spFarm.DefaultServiceAccount.Name - } - - return @{ - UserProfileServiceAppName = $upa.Name - Ensure = $localEnsure - FarmAccount = $farmAccount - RunOnlyWhenWriteable = $params.RunOnlyWhenWriteable - InstallAccount = $params.InstallAccount - } - } - return $result -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $UserProfileServiceAppName, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $FarmAccount, - - [parameter(Mandatory = $false)] - [System.Boolean] - $RunOnlyWhenWriteable, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting user profile sync service for $UserProfileServiceAppName" - - $PSBoundParameters.Ensure = $Ensure - - if ((Get-SPDSCInstalledProductVersion).FileMajorPart -ne 15) - { - throw [Exception] ("Only SharePoint 2013 is supported to deploy the user profile sync " + ` - "service via DSC, as 2016 does not use the FIM based sync service.") - } - - if ($PSBoundParameters.ContainsKey("RunOnlyWhenWriteable") -eq $true) - { - $databaseReadOnly = Test-SPDscUserProfileDBReadOnly ` - -UserProfileServiceAppName $UserProfileServiceAppName ` - -InstallAccount $InstallAccount - - if ($databaseReadOnly) - { - Write-Verbose -Message ("User profile database is read only, setting user profile " + ` - "sync service to not run on the local server") - $PSBoundParameters.Ensure = "Absent" - } - else - { - $PSBoundParameters.Ensure = "Present" - } - } - - # Add the FarmAccount to the local Admins group, if it's not already there - $isLocalAdmin = Test-SPDSCUserIsLocalAdmin -UserName $FarmAccount.UserName - - if (!$isLocalAdmin) - { - Add-SPDSCUserToLocalAdmin -UserName $FarmAccount.UserName - - # Cycle the Timer Service so that it picks up the local Admin token - Restart-Service -Name "SPTimerV4" - } - - try - { - Invoke-SPDSCCommand -Credential $FarmAccount -Arguments $PSBoundParameters -ScriptBlock { - $params = $args[0] - - $currentServer = $env:COMPUTERNAME - - $syncServices = Get-SPServiceInstance -Server $currentServer ` - -ErrorAction SilentlyContinue - $syncService = $syncServices | Where-Object -FilterScript { - $_.GetType().Name -eq "UserProfileServiceInstance" - } - if ($null -eq $syncService) - { - $domain = (Get-CimInstance -ClassName Win32_ComputerSystem).Domain - $currentServer = "$currentServer.$domain" - $syncService = $syncServices | Where-Object -FilterScript { - $_.GetType().Name -eq "UserProfileServiceInstance" - } - } - if ($null -eq $syncService) - { - throw "Unable to locate a user profile service instance on $currentServer to start" - } - - # Start the Sync service if it should be running on this server - if (($params.Ensure -eq "Present") -and ($syncService.Status -ne "Online")) - { - $serviceApps = Get-SPServiceApplication -Name $params.UserProfileServiceAppName ` - -ErrorAction SilentlyContinue - if ($null -eq $serviceApps) { - throw [Exception] ("No user profile service was found " + ` - "named $($params.UserProfileServiceAppName)") - } - $ups = $serviceApps | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Server.Administration.UserProfileApplication" - } - - $userName = $params.FarmAccount.UserName - $password = $params.FarmAccount.GetNetworkCredential().Password - $ups.SetSynchronizationMachine($currentServer, $syncService.ID, $userName, $password) - - Start-SPServiceInstance -Identity $syncService.ID - - $desiredState = "Online" - } - # Stop the Sync service in all other cases - else - { - Stop-SPServiceInstance -Identity $syncService.ID -Confirm:$false - $desiredState = "Disabled" - } - - $count = 0 - $maxCount = 10 - - while (($count -lt $maxCount) -and ($syncService.Status -ne $desiredState)) - { - if ($syncService.Status -ne $desiredState) - { - Start-Sleep -Seconds 60 - } - # Get the current status of the Sync service - Write-Verbose ("$([DateTime]::Now.ToShortTimeString()) - Waiting for user profile " + ` - "sync service to become '$desiredState' (waited $count of " + ` - "$maxCount minutes)") - $syncService = $syncServices | Where-Object -FilterScript { - $_.GetType().Name -eq "UserProfileServiceInstance" - } - $count++ - } - } - } - finally - { - # Remove the FarmAccount from the local Admins group, if it was added above - if (!$isLocalAdmin) - { - Remove-SPDSCUserToLocalAdmin -UserName $FarmAccount.UserName - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $UserProfileServiceAppName, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $FarmAccount, - - [parameter(Mandatory = $false)] - [System.Boolean] - $RunOnlyWhenWriteable, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing user profile sync service for $UserProfileServiceAppName" - - $PSBoundParameters.Ensure = $Ensure - - if ((Get-SPDSCInstalledProductVersion).FileMajorPart -ne 15) - { - throw [Exception] ("Only SharePoint 2013 is supported to deploy the user profile sync " + ` - "service via DSC, as 2016 does not use the FIM based sync service.") - } - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($PSBoundParameters.ContainsKey("RunOnlyWhenWriteable") -eq $true) - { - $databaseReadOnly = Test-SPDscUserProfileDBReadOnly ` - -UserProfileServiceAppName $UserProfileServiceAppName ` - -InstallAccount $InstallAccount - - if ($databaseReadOnly) - { - Write-Verbose -Message ("User profile database is read only, setting user profile " + ` - "sync service to not run on the local server") - $PSBoundParameters.Ensure = "Absent" - } - else - { - $PSBoundParameters.Ensure = "Present" - } - } - - Write-Verbose -Message "Testing for User Profile Synchronization Service" - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") -} - -function Test-SPDscUserProfileDBReadOnly() -{ - param( - [Parameter(Mandatory = $true)] - [String] - $UserProfileServiceAppName, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - $databaseReadOnly = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $UserProfileServiceAppName ` - -ScriptBlock { - $UserProfileServiceAppName = $args[0] - - $serviceApps = Get-SPServiceApplication -Name $UserProfileServiceAppName ` - -ErrorAction SilentlyContinue - if ($null -eq $serviceApps) - { - throw [Exception] ("No user profile service was found " + ` - "named $UserProfileServiceAppName") - } - $ups = $serviceApps | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Server.Administration.UserProfileApplication" - } - - $propType = $ups.GetType() - $propData = $propType.GetProperties([System.Reflection.BindingFlags]::Instance -bor ` - [System.Reflection.BindingFlags]::NonPublic) - $profileProp = $propData | Where-Object -FilterScript { - $_.Name -eq "ProfileDatabase" - } - $profileDBName = $profileProp.GetValue($ups).Name - - $database = Get-SPDatabase | Where-Object -FilterScript { - $_.Name -eq $profileDBName - } - return $database.IsReadyOnly - } - return $databaseReadOnly -} - -Export-ModuleMember -Function *-TargetResource - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncService/MSFT_SPUserProfileSyncService.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncService/MSFT_SPUserProfileSyncService.schema.mof deleted file mode 100644 index 68327b13..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncService/MSFT_SPUserProfileSyncService.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPUserProfileSyncService")] -class MSFT_SPUserProfileSyncService : OMI_BaseResource -{ - [Key, Description("The name of the user profile service for this sync instance")] string UserProfileServiceAppName; - [Write, Description("Present to ensure the service is running, absent to ensure it is not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Required, Description("The farm account, which is needed to provision the service app"), EmbeddedInstance("MSFT_Credential")] String FarmAccount; - [Write, Description("Should the sync service only run when the user profile database is in a writeable state?")] Boolean RunOnlyWhenWriteable; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPVisioServiceApp/MSFT_SPVisioServiceApp.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPVisioServiceApp/MSFT_SPVisioServiceApp.psm1 deleted file mode 100644 index e0682617..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPVisioServiceApp/MSFT_SPVisioServiceApp.psm1 +++ /dev/null @@ -1,210 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.String] - $ProxyName, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting Visio Graphics service app '$Name'" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $serviceApps = Get-SPServiceApplication -Name $params.Name ` - -ErrorAction SilentlyContinue - $nullReturn = @{ - Name = $params.Name - ApplicationPool = $params.ApplicationPool - Ensure = "Absent" - } - if ($null -eq $serviceApps) - { - return $nullReturn - } - $serviceApp = $serviceApps | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Visio.Server.Administration.VisioGraphicsServiceApplication" - } - - if ($null -eq $serviceApp) - { - return $nullReturn - } - else - { - return @{ - Name = $serviceApp.DisplayName - ApplicationPool = $serviceApp.ApplicationPool.Name - Ensure = "Present" - InstallAccount = $params.InstallAccount - } - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.String] - $ProxyName, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting Visio Graphics service app '$Name'" - - $result = Get-TargetResource @PSBoundParameters - - if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") - { - Write-Verbose -Message "Creating Visio Graphics Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $visioApp = New-SPVisioServiceApplication -Name $params.Name ` - -ApplicationPool $params.ApplicationPool - if ($params.ContainsKey("ProxyName")) - { - $pName = $params.ProxyName - $params.Remove("ProxyName") | Out-Null - } - - if ($null -eq $pName) { - $pName = "$($params.Name) Proxy" - } - if ($null -ne $visioApp) - { - $visioProxy = New-SPVisioServiceApplicationProxy -Name $pName -ServiceApplication $params.Name - } - } - } - if ($result.Ensure -eq "Present" -and $Ensure -eq "Present") - { - if ($ApplicationPool -ne $result.ApplicationPool) - { - Write-Verbose -Message "Updating Visio Graphics Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool - - Get-SPServiceApplication -Name $params.Name ` - | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Visio.Server.Administration.VisioGraphicsServiceApplication" - } | Set-SPVisioServiceApplication -ServiceApplicationPool $appPool - } - } - } - - if ($Ensure -eq "Absent") - { - Write-Verbose -Message "Removing Visio service application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $app = Get-SPServiceApplication -Name $params.Name ` - | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Visio.Server.Administration.VisioGraphicsServiceApplication" - } - - $proxies = Get-SPServiceApplicationProxy - foreach($proxyInstance in $proxies) - { - if($app.IsConnected($proxyInstance)) - { - $proxyInstance.Delete() - } - } - - Remove-SPServiceApplication -Identity $app -Confirm:$false - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.String] - $ProxyName, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing Visio Graphics service app '$Name'" - - $PSBoundParameters.Ensure = $Ensure - - $CurrentValues = Get-TargetResource @PSBoundParameters - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ApplicationPool", "Ensure") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPVisioServiceApp/MSFT_SPVisioServiceApp.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPVisioServiceApp/MSFT_SPVisioServiceApp.schema.mof deleted file mode 100644 index a6f71658..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPVisioServiceApp/MSFT_SPVisioServiceApp.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPVisioServiceApp")] -class MSFT_SPVisioServiceApp : OMI_BaseResource -{ - [Key, Description("The name of the service application")] string Name; - [Required, Description("The name of the application pool to run the service app in")] string ApplicationPool; - [Write, Description("The name of the Visio Service Application Proxy")] string ProxyName; - [Write, Description("Present if the service app should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWeb/MSFT_SPWeb.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWeb/MSFT_SPWeb.psm1 deleted file mode 100644 index 0ae2dc4e..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWeb/MSFT_SPWeb.psm1 +++ /dev/null @@ -1,283 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.String] - $Description, - - [parameter(Mandatory = $false)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.UInt32] - $Language, - - [parameter(Mandatory = $false)] - [System.String] - $Template, - - [parameter(Mandatory = $false)] - [System.Boolean] - $UniquePermissions, - - [parameter(Mandatory = $false)] - [System.Boolean] - $UseParentTopNav, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AddToQuickLaunch, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AddToTopNav, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting SPWeb '$Url'" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $web = Get-SPWeb -Identity $params.Url -ErrorAction SilentlyContinue - - if ($web) - { - $ensureResult = "Present" - $templateResult = "$($web.WebTemplate)#$($web.WebTemplateId)" - $parentTopNav = $web.Navigation.UseShared - } - else - { - $ensureResult = "Absent" - } - - return @{ - Url = $web.Url - Ensure = $ensureResult - Description = $web.Description - Name = $web.Title - Language = $web.Language - Template = $templateResult - UniquePermissions = $web.HasUniquePerm - UseParentTopNav = $parentTopNav - } - } - - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.String] - $Description, - - [parameter(Mandatory = $false)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.UInt32] - $Language, - - [parameter(Mandatory = $false)] - [System.String] - $Template, - - [parameter(Mandatory = $false)] - [System.Boolean] - $UniquePermissions, - - [parameter(Mandatory = $false)] - [System.Boolean] - $UseParentTopNav, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AddToQuickLaunch, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AddToTopNav, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting SPWeb '$Url'" - - $PSBoundParameters.Ensure = $Ensure - - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - if ($null -eq $params.InstallAccount) - { - $currentUserName = "$env:USERDOMAIN\$env:USERNAME" - } - else - { - $currentUserName = $params.InstallAccount.UserName - } - - Write-Verbose "Grant user '$currentUserName' Access To Process Identity for '$($params.Url)'..." - $site = New-Object -Type Microsoft.SharePoint.SPSite -ArgumentList $params.Url - $site.WebApplication.GrantAccessToProcessIdentity($currentUserName) - - $web = Get-SPWeb -Identity $params.Url -ErrorAction SilentlyContinue - - if ($null -eq $web) - { - $params.Remove("InstallAccount") | Out-Null - $params.Remove("Ensure") | Out-Null - - New-SPWeb @params | Out-Null - } - else - { - if ($params.Ensure -eq "Absent") - { - Remove-SPweb $params.Url -confirm:$false - } - else - { - $changedWeb = $false - - if ($web.Title -ne $params.Name) - { - $web.Title = $params.Name - $changedWeb = $true - } - - if ($web.Description -ne $params.Description) - { - $web.Description = $params.Description - $changedWeb = $true - } - - if ($web.Navigation.UseShared -ne $params.UseParentTopNav) - { - $web.Navigation.UseShared = $params.UseParentTopNav - $changedWeb = $true - } - - if ($web.HasUniquePerm -ne $params.UniquePermissions) - { - $web.HasUniquePerm = $params.UniquePermissions - $changedWeb = $true - } - - if ($changedWeb) - { - $web.Update() - } - } - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.String] - $Description, - - [parameter(Mandatory = $false)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.UInt32] - $Language, - - [parameter(Mandatory = $false)] - [System.String] - $Template, - - [parameter(Mandatory = $false)] - [System.Boolean] - $UniquePermissions, - - [parameter(Mandatory = $false)] - [System.Boolean] - $UseParentTopNav, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AddToQuickLaunch, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AddToTopNav, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing SPWeb '$Url'" - - $PSBoundParameters.Ensure = $Ensure - - $CurrentValues = Get-TargetResource @PSBoundParameters - - $valuesToCheck = @("Url", - "Name", - "Description", - "UniquePermissions", - "UseParentTopNav", - "Ensure") - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck $valuesToCheck -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWeb/MSFT_SPWeb.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWeb/MSFT_SPWeb.schema.mof deleted file mode 100644 index 899a8449..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWeb/MSFT_SPWeb.schema.mof +++ /dev/null @@ -1,15 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPWeb")] -class MSFT_SPWeb : OMI_BaseResource -{ - [Key, Description("The URL of the web")] string Url; - [Write, Description("Present if the web should exist or Absent if it should be removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("The description to apply to the web")] string Description; - [Write, Description("The Name of the web")] string Name; - [Write, Description("The Lanhuage (LCID) of the web")] uint32 Language; - [Write, Description("The WebTemplate to use to create the web")] string Template; - [Write, Description("True if the web should have unique permissions, otherwise false.")] Boolean UniquePermissions; - [Write, Description("True if the web should use the parent nav bar, otherwise false.")] Boolean UseParentTopNav; - [Write, Description("True if the web should be in the quick launch of the parent web, otherwise false.")] Boolean AddToQuickLaunch; - [Write, Description("True if the web should be added to the top nav bar of the parent web, otherwise false.")] Boolean AddToTopNav; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppBlockedFileTypes/MSFT_SPWebAppBlockedFileTypes.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppBlockedFileTypes/MSFT_SPWebAppBlockedFileTypes.psm1 deleted file mode 100644 index b5e2d43c..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppBlockedFileTypes/MSFT_SPWebAppBlockedFileTypes.psm1 +++ /dev/null @@ -1,142 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $false)] - [System.String[]] - $Blocked, - - [parameter(Mandatory = $false)] - [System.String[]] - $EnsureBlocked, - - [parameter(Mandatory = $false)] - [System.String[]] - $EnsureAllowed, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting web application '$url' blocked file types" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters,$PSScriptRoot) ` - -ScriptBlock { - $params = $args[0] - $ScriptRoot = $args[1] - - $wa = Get-SPWebApplication -Identity $params.Url -ErrorAction SilentlyContinue - if ($null -eq $wa) { return $null } - - $modulePath = "..\..\Modules\SharePointDsc.WebApplication\SPWebApplication.BlockedFileTypes.psm1" - Import-Module -Name (Join-Path -Path $ScriptRoot -ChildPath $modulePath -Resolve) - - $result = Get-SPDSCWebApplicationBlockedFileTypeConfig -WebApplication $wa - $result.Add("Url", $params.Url) - $result.Add("InstallAccount", $params.InstallAccount) - return $result - } - return $result -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $false)] - [System.String[]] - $Blocked, - - [parameter(Mandatory = $false)] - [System.String[]] - $EnsureBlocked, - - [parameter(Mandatory = $false)] - [System.String[]] - $EnsureAllowed, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting web application '$Url' blocked file types" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters,$PSScriptRoot) ` - -ScriptBlock { - $params = $args[0] - $ScriptRoot = $args[1] - - $wa = Get-SPWebApplication -Identity $params.Url -ErrorAction SilentlyContinue - if ($null -eq $wa) { - throw "Web application $($params.Url) was not found" - return - } - - $modulePath = "..\..\Modules\SharePointDsc.WebApplication\SPWebApplication.BlockedFileTypes.psm1" - Import-Module -Name (Join-Path -Path $ScriptRoot -ChildPath $modulePath -Resolve) - - Set-SPDSCWebApplicationBlockedFileTypeConfig -WebApplication $wa -Settings $params - $wa.Update() - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $false)] - [System.String[]] - $Blocked, - - [parameter(Mandatory = $false)] - [System.String[]] - $EnsureBlocked, - - [parameter(Mandatory = $false)] - [System.String[]] - $EnsureAllowed, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing for web application '$Url' blocked file types" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($null -eq $CurrentValues) - { - return $false - } - - $modulePath = "..\..\Modules\SharePointDsc.WebApplication\SPWebApplication.BlockedFileTypes.psm1" - Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath $modulePath -Resolve) - - return Test-SPDSCWebApplicationBlockedFileTypeConfig -CurrentSettings $CurrentValues ` - -DesiredSettings $PSBoundParameters -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppBlockedFileTypes/MSFT_SPWebAppBlockedFileTypes.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppBlockedFileTypes/MSFT_SPWebAppBlockedFileTypes.schema.mof deleted file mode 100644 index b2ecbd49..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppBlockedFileTypes/MSFT_SPWebAppBlockedFileTypes.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("1.0.0"), FriendlyName("SPWebAppBlockedFileTypes")] -class MSFT_SPWebAppBlockedFileTypes : OMI_BaseResource -{ - [Key, Description("The URL of the web application to set blocked file types for")] string Url; - [write, Description("This is a fixed list to use for blocked file types in this web app")] string Blocked[]; - [write, Description("This list of file types that will always be added to the list for this web app. Types not in this list will be left in the list")] string EnsureBlocked[]; - [write, Description("This list of file types that will always be removedfrom the list for this web app. Types not in this list will be left in the list")] string EnsureAllowed[]; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] string InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppGeneralSettings/MSFT_SPWebAppGeneralSettings.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppGeneralSettings/MSFT_SPWebAppGeneralSettings.psm1 deleted file mode 100644 index fdb8f667..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppGeneralSettings/MSFT_SPWebAppGeneralSettings.psm1 +++ /dev/null @@ -1,339 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $false)] - [System.UInt32] - $TimeZone, - - [parameter(Mandatory = $false)] - [System.Boolean] - $Alerts, - - [parameter(Mandatory = $false)] - [System.UInt32] - $AlertsLimit, - - [parameter(Mandatory = $false)] - [System.Boolean] - $RSS, - - [parameter(Mandatory = $false)] - [System.Boolean] - $BlogAPI, - - [parameter(Mandatory = $false)] - [System.Boolean] - $BlogAPIAuthenticated, - - [parameter(Mandatory = $false)] - [ValidateSet("Strict","Permissive")] - [System.String] - $BrowserFileHandling, - - [parameter(Mandatory = $false)] - [System.Boolean] - $SecurityValidation, - - [parameter(Mandatory = $false)] - [System.Boolean] - $SecurityValidationExpires, - - [parameter(Mandatory = $false)] - [System.Uint32] - $SecurityValidationTimeoutMinutes, - - [parameter(Mandatory = $false)] - [System.Boolean] - $RecycleBinEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $RecycleBinCleanupEnabled, - - [parameter(Mandatory = $false)] - [System.UInt32] - $RecycleBinRetentionPeriod, - - [parameter(Mandatory = $false)] - [System.UInt32] - $SecondStageRecycleBinQuota, - - [parameter(Mandatory = $false)] - [System.UInt32] - $MaximumUploadSize, - - [parameter(Mandatory = $false)] - [System.Boolean] - $CustomerExperienceProgram, - - [parameter(Mandatory = $false)] - [System.Boolean] - $PresenceEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowOnlineWebPartCatalog, - - [parameter(Mandatory = $false)] - [System.Boolean] - $SelfServiceSiteCreationEnabled, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting web application '$url' general settings" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters,$PSScriptRoot) ` - -ScriptBlock { - $params = $args[0] - $ScriptRoot = $args[1] - - $wa = Get-SPWebApplication -Identity $params.Url -ErrorAction SilentlyContinue - if ($null -eq $wa) - { - return $null - } - - $modulePath = "..\..\Modules\SharePointDsc.WebApplication\SPWebApplication.GeneralSettings.psm1" - Import-Module -Name (Join-Path -Path $ScriptRoot -ChildPath $modulePath -Resolve) - - $result = Get-SPDSCWebApplicationGeneralConfig -WebApplication $wa - $result.Add("Url", $params.Url) - $result.Add("InstallAccount", $params.InstallAccount) - return $result - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $false)] - [System.UInt32] - $TimeZone, - - [parameter(Mandatory = $false)] - [System.Boolean] - $Alerts, - - [parameter(Mandatory = $false)] - [System.UInt32] - $AlertsLimit, - - [parameter(Mandatory = $false)] - [System.Boolean] - $RSS, - - [parameter(Mandatory = $false)] - [System.Boolean] - $BlogAPI, - - [parameter(Mandatory = $false)] - [System.Boolean] - $BlogAPIAuthenticated, - - [parameter(Mandatory = $false)] - [ValidateSet("Strict","Permissive")] - [System.String] - $BrowserFileHandling, - - [parameter(Mandatory = $false)] - [System.Boolean] - $SecurityValidation, - - [parameter(Mandatory = $false)] - [System.Boolean] - $SecurityValidationExpires, - - [parameter(Mandatory = $false)] - [System.Uint32] - $SecurityValidationTimeoutMinutes, - - [parameter(Mandatory = $false)] - [System.Boolean] - $RecycleBinEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $RecycleBinCleanupEnabled, - - [parameter(Mandatory = $false)] - [System.UInt32] - $RecycleBinRetentionPeriod, - - [parameter(Mandatory = $false)] - [System.UInt32] - $SecondStageRecycleBinQuota, - - [parameter(Mandatory = $false)] - [System.UInt32] - $MaximumUploadSize, - - [parameter(Mandatory = $false)] - [System.Boolean] - $CustomerExperienceProgram, - - [parameter(Mandatory = $false)] - [System.Boolean] - $PresenceEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowOnlineWebPartCatalog, - - [parameter(Mandatory = $false)] - [System.Boolean] - $SelfServiceSiteCreationEnabled, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting web application '$url' general settings" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters,$PSScriptRoot) ` - -ScriptBlock { - $params = $args[0] - $ScriptRoot = $args[1] - - $wa = Get-SPWebApplication -Identity $params.Url -ErrorAction SilentlyContinue - if ($null -eq $wa) - { - throw "Web application $($params.Url) was not found" - return - } - - $modulePath = "..\..\Modules\SharePointDsc.WebApplication\SPWebApplication.GeneralSettings.psm1" - Import-Module -Name (Join-Path -Path $ScriptRoot -ChildPath $modulePath -Resolve) - - Set-SPDSCWebApplicationGeneralConfig -WebApplication $wa -Settings $params - $wa.Update() - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $false)] - [System.UInt32] - $TimeZone, - - [parameter(Mandatory = $false)] - [System.Boolean] - $Alerts, - - [parameter(Mandatory = $false)] - [System.UInt32] - $AlertsLimit, - - [parameter(Mandatory = $false)] - [System.Boolean] - $RSS, - - [parameter(Mandatory = $false)] - [System.Boolean] - $BlogAPI, - - [parameter(Mandatory = $false)] - [System.Boolean] - $BlogAPIAuthenticated, - - [parameter(Mandatory = $false)] - [ValidateSet("Strict","Permissive")] - [System.String] - $BrowserFileHandling, - - [parameter(Mandatory = $false)] - [System.Boolean] - $SecurityValidation, - - [parameter(Mandatory = $false)] - [System.Boolean] - $SecurityValidationExpires, - - [parameter(Mandatory = $false)] - [System.Uint32] - $SecurityValidationTimeoutMinutes, - - [parameter(Mandatory = $false)] - [System.Boolean] - $RecycleBinEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $RecycleBinCleanupEnabled, - - [parameter(Mandatory = $false)] - [System.UInt32] - $RecycleBinRetentionPeriod, - - [parameter(Mandatory = $false)] - [System.UInt32] - $SecondStageRecycleBinQuota, - - [parameter(Mandatory = $false)] - [System.UInt32] - $MaximumUploadSize, - - [parameter(Mandatory = $false)] - [System.Boolean] - $CustomerExperienceProgram, - - [parameter(Mandatory = $false)] - [System.Boolean] - $PresenceEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowOnlineWebPartCatalog, - - [parameter(Mandatory = $false)] - [System.Boolean] - $SelfServiceSiteCreationEnabled, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing web application '$url' general settings" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($null -eq $CurrentValues) - { - return $false - } - - $modulePath = "..\..\Modules\SharePointDsc.WebApplication\SPWebApplication.GeneralSettings.psm1" - Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath $modulePath -Resolve) - - return Test-SPDSCWebApplicationGeneralConfig -CurrentSettings $CurrentValues -DesiredSettings $PSBoundParameters -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppGeneralSettings/MSFT_SPWebAppGeneralSettings.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppGeneralSettings/MSFT_SPWebAppGeneralSettings.schema.mof deleted file mode 100644 index 0a93b4cd..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppGeneralSettings/MSFT_SPWebAppGeneralSettings.schema.mof +++ /dev/null @@ -1,25 +0,0 @@ -[ClassVersion("1.0.0"), FriendlyName("SPWebAppGeneralSettings")] -class MSFT_SPWebAppGeneralSettings : OMI_BaseResource -{ - [Key, Description("The URL of the web app to set the general settings for")] string Url; - [Write, Description("The timezone code to use for this web app. A full list is at https://msdn.microsoft.com/en-us/library/office/microsoft.sharepoint.spregionalsettings.timezones.aspx")] uint32 TimeZone; - [Write, Description("Should alerts be enabled for this web app")] boolean Alerts; - [Write, Description("What is the maximum number of alerts that a user can create in this web app")] uint32 AlertsLimit; - [Write, Description("Should RSS feeds be enabled in this web app")] boolean RSS; - [Write, Description("Should the Blog API be enabled in this web app")] boolean BlogAPI; - [Write, Description("Is authentication required for the blog API")] boolean BlogAPIAuthenticated; - [Write, Description("What file handling mode should be used in this web app - strict or permissive"), ValueMap{"Strict","Permissive"}, Values{"Strict","Permissive"}] String BrowserFileHandling; - [Write, Description("Is security validation enforced in this web app")] boolean SecurityValidation; - [Write, Description("Does security validation expire after a set time")] boolean SecurityValidationExpires; - [Write, Description("Number of minutes security validation will expire if securityvalidationexpires is set")] uint32 SecurityValidationTimeOutMinutes; - [Write, Description("Is the recycle bin enabled in this web application")] boolean RecycleBinEnabled; - [Write, Description("Is automatic cleanup of the recycle bin enabled in this web app")] boolean RecycleBinCleanupEnabled; - [Write, Description("How many days does the recycle bin keep content for")] uint32 RecycleBinRetentionPeriod; - [Write, Description("How much content does the second stage recycle bin keep content for")] uint32 SecondStageRecycleBinQuota; - [Write, Description("What is the maximum file upload size for this web app (in MB)")] uint32 MaximumUploadSize; - [Write, Description("Should the customer experience program be enabled in this web app")] boolean CustomerExperienceProgram; - [Write, Description("Should the Online WebPart Gallery be enabled for this web app")] boolean AllowOnlineWebPartCatalog; - [Write, Description("Should Self Service Site Creation be enabled")] boolean SelfServiceSiteCreationEnabled; - [Write, Description("Is Skype for Business presence enabled for this web app")] boolean PresenceEnabled; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] string InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppPermissions/MSFT_SPWebAppPermissions.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppPermissions/MSFT_SPWebAppPermissions.psm1 deleted file mode 100644 index 529ebcd5..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppPermissions/MSFT_SPWebAppPermissions.psm1 +++ /dev/null @@ -1,732 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $false)] - [ValidateSet("Manage Lists", "Override List Behaviors", "Add Items", "Edit Items", - "Delete Items", "View Items", "Approve Items", "Open Items", - "View Versions", "Delete Versions", "Create Alerts", - "View Application Pages")] - [System.String[]] - $ListPermissions, - - [parameter(Mandatory = $false)] - [ValidateSet("Manage Permissions", "View Web Analytics Data", "Create Subsites", - "Manage Web Site", "Add and Customize Pages", "Apply Themes and Borders", - "Apply Style Sheets", "Create Groups", "Browse Directories", - "Use Self-Service Site Creation", "View Pages", "Enumerate Permissions", - "Browse User Information", "Manage Alerts", "Use Remote Interfaces", - "Use Client Integration Features", "Open", "Edit Personal User Information")] - [System.String[]] - $SitePermissions, - - [parameter(Mandatory = $false)] - [ValidateSet("Manage Personal Views", "Add/Remove Personal Web Parts", - "Update Personal Web Parts")] - [System.String[]] - $PersonalPermissions, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllPermissions, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting permissions for Web Application '$WebAppUrl'" - - Test-SPDSCInput @PSBoundParameters - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $wa = Get-SPWebApplication -Identity $params.WebAppUrl -ErrorAction SilentlyContinue - - if ($null -eq $wa) - { - throw "The specified web application could not be found." - } - - if ($wa.RightsMask -eq [Microsoft.SharePoint.SPBasePermissions]::FullMask) - { - $returnval = @{ - WebAppUrl = $params.WebAppUrl - AllPermissions = $true - } - } - else - { - $ListPermissions = @() - $SitePermissions = @() - $PersonalPermissions = @() - - $rightsmask = ($wa.RightsMask -split ",").trim() - foreach ($rightmask in $rightsmask) - { - switch ($rightmask) - { - "ManageLists" { - $ListPermissions += "Manage Lists" - } - "CancelCheckout" { - $ListPermissions += "Override List Behaviors" - } - "AddListItems" { - $ListPermissions += "Add Items" - } - "EditListItems" { - $ListPermissions += "Edit Items" - } - "DeleteListItems" { - $ListPermissions += "Delete Items" - } - "ViewListItems" { - $ListPermissions += "View Items" - } - "ApproveItems" { - $ListPermissions += "Approve Items" - } - "OpenItems" { - $ListPermissions += "Open Items" - } - "ViewVersions" { - $ListPermissions += "View Versions" - } - "DeleteVersions" { - $ListPermissions += "Delete Versions" - } - "CreateAlerts" { - $ListPermissions += "Create Alerts" - } - "ViewFormPages" { - $ListPermissions += "View Application Pages" - } - - "ManagePermissions" { - $SitePermissions += "Manage Permissions" - } - "ViewUsageData" { - $SitePermissions += "View Web Analytics Data" - } - "ManageSubwebs" { - $SitePermissions += "Create Subsites" - } - "ManageWeb" { - $SitePermissions += "Manage Web Site" - } - "AddAndCustomizePages" { - $SitePermissions += "Add and Customize Pages" - } - "ApplyThemeAndBorder" { - $SitePermissions += "Apply Themes and Borders" - } - "ApplyStyleSheets" { - $SitePermissions += "Apply Style Sheets" - } - "CreateGroups" { - $SitePermissions += "Create Groups" - } - "BrowseDirectories" { - $SitePermissions += "Browse Directories" - } - "CreateSSCSite" { - $SitePermissions += "Use Self-Service Site Creation" - } - "ViewPages" { - $SitePermissions += "View Pages" - } - "EnumeratePermissions" { - $SitePermissions += "Enumerate Permissions" - } - "BrowseUserInfo" { - $SitePermissions += "Browse User Information" - } - "ManageAlerts" { - $SitePermissions += "Manage Alerts" - } - "UseRemoteAPIs" { - $SitePermissions += "Use Remote Interfaces" - } - "UseClientIntegration" { - $SitePermissions += "Use Client Integration Features" - } - "Open" { - $SitePermissions += "Open" - } - "EditMyUserInfo" { - $SitePermissions += "Edit Personal User Information" - } - - "ManagePersonalViews" { - $PersonalPermissions += "Manage Personal Views" - } - "AddDelPrivateWebParts" { - $PersonalPermissions += "Add/Remove Personal Web Parts" - } - "UpdatePersonalWebParts" { - $PersonalPermissions += "Update Personal Web Parts" - } - } - } - - $returnval = @{ - WebAppUrl = $params.WebAppUrl - ListPermissions = $ListPermissions - SitePermissions = $SitePermissions - PersonalPermissions = $PersonalPermissions - } - } - return $returnval - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $false)] - [ValidateSet("Manage Lists", "Override List Behaviors", "Add Items", "Edit Items", - "Delete Items", "View Items", "Approve Items", "Open Items", - "View Versions", "Delete Versions", "Create Alerts", - "View Application Pages")] - [System.String[]] - $ListPermissions, - - [parameter(Mandatory = $false)] - [ValidateSet("Manage Permissions", "View Web Analytics Data", "Create Subsites", - "Manage Web Site", "Add and Customize Pages", "Apply Themes and Borders", - "Apply Style Sheets", "Create Groups", "Browse Directories", - "Use Self-Service Site Creation", "View Pages", "Enumerate Permissions", - "Browse User Information", "Manage Alerts", "Use Remote Interfaces", - "Use Client Integration Features", "Open", "Edit Personal User Information")] - [System.String[]] - $SitePermissions, - - [parameter(Mandatory = $false)] - [ValidateSet("Manage Personal Views", "Add/Remove Personal Web Parts", - "Update Personal Web Parts")] - [System.String[]] - $PersonalPermissions, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllPermissions, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting permissions for Web Application '$WebAppUrl'" - - Test-SPDSCInput @PSBoundParameters - - $result = Get-TargetResource @PSBoundParameters - - if ($AllPermissions) { - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $wa = Get-SPWebApplication -Identity $params.WebAppUrl ` - -ErrorAction SilentlyContinue - - if ($null -eq $wa) - { - throw "The specified web application could not be found." - } - - $wa.RightsMask = [Microsoft.SharePoint.SPBasePermissions]::FullMask - $wa.Update() - } - } - else - { - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $wa = Get-SPWebApplication -Identity $params.WebAppUrl ` - -ErrorAction SilentlyContinue - - if ($null -eq $wa) - { - throw "The specified web application could not be found." - } - - $newMask = [Microsoft.SharePoint.SPBasePermissions]::EmptyMask - foreach ($lp in $params.ListPermissions) - { - switch ($lp) - { - "Manage Lists" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::ManageLists - } - "Override List Behaviors" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::CancelCheckout - } - "Add Items" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::AddListItems - } - "Edit Items" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::EditListItems - } - "Delete Items" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::DeleteListItems - } - "View Items" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::ViewListItems - } - "Approve Items" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::ApproveItems - } - "Open Items" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::OpenItems - } - "View Versions" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::ViewVersions - } - "Delete Versions" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::DeleteVersions - } - "Create Alerts" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::CreateAlerts - } - "View Application Pages" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::ViewFormPages - } - } - } - - foreach ($sp in $params.SitePermissions) - { - switch ($sp) - { - "Manage Permissions" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::ManagePermissions - } - "View Web Analytics Data" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::ViewUsageData - } - "Create Subsites" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::ManageSubwebs - } - "Manage Web Site" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::ManageWeb - } - "Add and Customize Pages" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::AddAndCustomizePages - } - "Apply Themes and Borders" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::ApplyThemeAndBorder - } - "Apply Style Sheets" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::ApplyStyleSheets - } - "Create Groups" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::CreateGroups - } - "Browse Directories" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::BrowseDirectories - } - "Use Self-Service Site Creation" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::CreateSSCSite - } - "View Pages" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::ViewPages - } - "Enumerate Permissions" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::EnumeratePermissions - } - "Browse User Information" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::BrowseUserInfo - } - "Manage Alerts" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::ManageAlerts - } - "Use Remote Interfaces" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::UseRemoteAPIs - } - "Use Client Integration Features" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::UseClientIntegration - } - "Open" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::Open - } - "Edit Personal User Information" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::EditMyUserInfo - } - } - } - - foreach ($pp in $params.PersonalPermissions) - { - switch ($pp) - { - "Manage Personal Views" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::ManagePersonalViews - } - "Add/Remove Personal Web Parts" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::AddDelPrivateWebParts - } - "Update Personal Web Parts" { - $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::UpdatePersonalWebParts - } - } - } - $wa.RightsMask = $newMask - $wa.Update() - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $false)] - [ValidateSet("Manage Lists", "Override List Behaviors", "Add Items", "Edit Items", - "Delete Items", "View Items", "Approve Items", "Open Items", - "View Versions", "Delete Versions", "Create Alerts", - "View Application Pages")] - [System.String[]] - $ListPermissions, - - [parameter(Mandatory = $false)] - [ValidateSet("Manage Permissions", "View Web Analytics Data", "Create Subsites", - "Manage Web Site", "Add and Customize Pages", "Apply Themes and Borders", - "Apply Style Sheets", "Create Groups", "Browse Directories", - "Use Self-Service Site Creation", "View Pages", "Enumerate Permissions", - "Browse User Information", "Manage Alerts", "Use Remote Interfaces", - "Use Client Integration Features", "Open", "Edit Personal User Information")] - [System.String[]] - $SitePermissions, - - [parameter(Mandatory = $false)] - [ValidateSet("Manage Personal Views", "Add/Remove Personal Web Parts", - "Update Personal Web Parts")] - [System.String[]] - $PersonalPermissions, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllPermissions, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing permissions for Web Application '$WebAppUrl'" - - Test-SPDSCInput @PSBoundParameters - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($AllPermissions -eq $true) - { - if ($CurrentValues.ContainsKey("AllPermissions")) - { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("AllPermissions") - } - else - { - return $false - } - } - else - { - if ($CurrentValues.ContainsKey("AllPermissions")) - { - return $false - } - else - { - if ($null -ne (Compare-Object -ReferenceObject $ListPermissions ` - -DifferenceObject $CurrentValues.ListPermissions)) - { - return $false - } - if ($null -ne (Compare-Object -ReferenceObject $SitePermissions ` - -DifferenceObject $CurrentValues.SitePermissions)) - { - return $false - } - if ($null -ne (Compare-Object -ReferenceObject $PersonalPermissions ` - -DifferenceObject $CurrentValues.PersonalPermissions)) - { - return $false - } - return $true - } - } -} - -function Test-SPDSCInput() -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $false)] - [ValidateSet("Manage Lists", "Override List Behaviors", "Add Items", "Edit Items", - "Delete Items", "View Items", "Approve Items", "Open Items", - "View Versions", "Delete Versions", "Create Alerts", - "View Application Pages")] - [System.String[]] - $ListPermissions, - - [parameter(Mandatory = $false)] - [ValidateSet("Manage Permissions", "View Web Analytics Data", "Create Subsites", - "Manage Web Site", "Add and Customize Pages", "Apply Themes and Borders", - "Apply Style Sheets", "Create Groups", "Browse Directories", - "Use Self-Service Site Creation", "View Pages", "Enumerate Permissions", - "Browse User Information", "Manage Alerts", "Use Remote Interfaces", - "Use Client Integration Features", "Open", "Edit Personal User Information")] - [System.String[]] - $SitePermissions, - - [parameter(Mandatory = $false)] - [ValidateSet("Manage Personal Views", "Add/Remove Personal Web Parts", - "Update Personal Web Parts")] - [System.String[]] - $PersonalPermissions, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllPermissions, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - if ($AllPermissions) - { - # AllPermissions parameter specified with and one of the other parameters - if ($ListPermissions -or $SitePermissions -or $PersonalPermissions) - { - throw ("Do not specify parameters ListPermissions, SitePermissions " + ` - "or PersonalPermissions when specifying parameter AllPermissions") - } - } - else - { - # You have to specify all three parameters - if (-not ($ListPermissions -and $SitePermissions -and $PersonalPermissions)) - { - throw ("One of the parameters ListPermissions, SitePermissions or " + ` - "PersonalPermissions is missing") - } - } - - #Checks - if ($ListPermissions -contains "Approve Items" -and -not ($ListPermissions -contains "Edit Items")) - { - throw "Edit Items is required when specifying Approve Items" - } - - if (($ListPermissions -contains "Manage Lists" ` - -or $ListPermissions -contains "Override List Behaviors" ` - -or $ListPermissions -contains "Add Items" ` - -or $ListPermissions -contains "Edit Items" ` - -or $ListPermissions -contains "Delete Items" ` - -or $ListPermissions -contains "Approve Items" ` - -or $ListPermissions -contains "Open Items" ` - -or $ListPermissions -contains "View Versions" ` - -or $ListPermissions -contains "Delete Versions" ` - -or $ListPermissions -contains "Create Alerts" ` - -or $SitePermissions -contains "Manage Permissions" ` - -or $SitePermissions -contains "Manage Web Site" ` - -or $SitePermissions -contains "Add and Customize Pages" ` - -or $SitePermissions -contains "Manage Alerts" ` - -or $SitePermissions -contains "Use Client Integration Features" ` - -or $PersonalPermissions -contains "Manage Personal Views" ` - -or $PersonalPermissions -contains "Add/Remove Personal Web Parts" ` - -or $PersonalPermissions -contains "Update Personal Web Parts") ` - -and -not ($ListPermissions -contains "View Items")) - { - throw ("View Items is required when specifying Manage Lists, Override List Behaviors, " + ` - "Add Items, Edit Items, Delete Items, Approve Items, Open Items, View " + ` - "Versions, Delete Versions, Create Alerts, Manage Permissions, Manage Web Site, " + ` - "Add and Customize Pages, Manage Alerts, Use Client Integration Features, " + ` - "Manage Personal Views, Add/Remove Personal Web Parts or Update Personal Web Parts") - } - - if (($ListPermissions -contains "View Versions" ` - -or $SitePermissions -contains "Manage Permissions") ` - -and -not ($ListPermissions -contains "Open Items")) - { - throw "Open Items is required when specifying View Versions or Manage Permissions" - } - - if (($ListPermissions -contains "Delete Versions" ` - -or $SitePermissions -contains "Manage Permissions") ` - -and -not ($ListPermissions -contains "View Versions")) - { - throw "View Versions is required when specifying Delete Versions or Manage Permissions" - } - - if ($SitePermissions -contains "Manage Alerts" ` - -and -not ($ListPermissions -contains "Create Alerts")) - { - throw "Create Alerts is required when specifying Manage Alerts" - } - - if ($SitePermissions -contains "Manage Web Site" ` - -and -not ($SitePermissions -contains "Add and Customize Pages")) - { - throw "Add and Customize Pages is required when specifying Manage Web Site" - } - - if (($SitePermissions -contains "Manage Permissions" ` - -or $SitePermissions -contains "Manage Web Site" ` - -or $SitePermissions -contains "Add and Customize Pages" ` - -or $SitePermissions -contains "Enumerate Permissions") ` - -and -not ($SitePermissions -contains "Browse Directories")) - { - throw ("Browse Directories is required when specifying Manage Permissions, Manage Web " + ` - "Site, Add and Customize Pages or Enumerate Permissions") - } - - if (($ListPermissions -contains "Manage Lists" ` - -or $ListPermissions -contains "Override List Behaviors" ` - -or $ListPermissions -contains "Add Items" ` - -or $ListPermissions -contains "Edit Items" ` - -or $ListPermissions -contains "Delete Items" ` - -or $ListPermissions -contains "View Items" ` - -or $ListPermissions -contains "Approve Items" ` - -or $ListPermissions -contains "Open Items" ` - -or $ListPermissions -contains "View Versions" ` - -or $ListPermissions -contains "Delete Versions" ` - -or $ListPermissions -contains "Create Alerts" ` - -or $SitePermissions -contains "Manage Permissions" ` - -or $SitePermissions -contains "View Web Analytics Data" ` - -or $SitePermissions -contains "Create Subsites" ` - -or $SitePermissions -contains "Manage Web Site" ` - -or $SitePermissions -contains "Add and Customize Pages" ` - -or $SitePermissions -contains "Apply Themes and Borders" ` - -or $SitePermissions -contains "Apply Style Sheets" ` - -or $SitePermissions -contains "Create Groups" ` - -or $SitePermissions -contains "Browse Directories" ` - -or $SitePermissions -contains "Use Self-Service Site Creation" ` - -or $SitePermissions -contains "Enumerate Permissions" ` - -or $SitePermissions -contains "Manage Alerts" ` - -or $PersonalPermissions -contains "Manage Personal Views" ` - -or $PersonalPermissions -contains "Add/Remove Personal Web Parts" ` - -or $PersonalPermissions -contains "Update Personal Web Parts") ` - -and -not ($SitePermissions -contains "View Pages")) - { - throw ("View Pages is required when specifying Manage Lists, Override List Behaviors, " + ` - "Add Items, Edit Items, Delete Items, View Items, Approve Items, Open Items, " + ` - "View Versions, Delete Versions, Create Alerts, Manage Permissions, View Web " + ` - "Analytics Data, Create Subsites, Manage Web Site, Add and Customize Pages, " + ` - "Apply Themes and Borders, Apply Style Sheets, Create Groups, Browse " + ` - "Directories, Use Self-Service Site Creation, Enumerate Permissions, Manage " + ` - "Alerts, Manage Personal Views, Add/Remove Personal Web Parts or Update " + ` - "Personal Web Parts") - } - - if (($SitePermissions -contains "Manage Permissions" ` - -or $SitePermissions -contains "Manage Web Site") ` - -and -not ($SitePermissions -contains "Enumerate Permissions")) - { - throw ("Enumerate Permissions is required when specifying Manage Permissions or " + ` - "Manage Web Site") - } - - if (($SitePermissions -contains "Manage Permissions" ` - -or $SitePermissions -contains "Create Subsites" ` - -or $SitePermissions -contains "Manage Web Site" ` - -or $SitePermissions -contains "Create Groups" ` - -or $SitePermissions -contains "Use Self-Service Site Creation" ` - -or $SitePermissions -contains "Enumerate Permissions" ` - -or $SitePermissions -contains "Edit Personal User Information") ` - -and -not ($SitePermissions -contains "Browse User Information")) - { - throw ("Browse User Information is required when specifying Manage Permissions, " + ` - "Create Subsites, Manage Web Site, Create Groups, Use Self-Service Site " + ` - "Creation, Enumerate Permissions or Edit Personal User Information") - } - - if ($SitePermissions -contains "Use Client Integration Features" ` - -and -not ($SitePermissions -contains "Use Remote Interfaces")) - { - throw "Use Remote Interfaces is required when specifying Use Client Integration Features" - } - - if (($ListPermissions -contains "Manage Lists" ` - -or $ListPermissions -contains "Override List Behaviors" ` - -or $ListPermissions -contains "Add Items" ` - -or $ListPermissions -contains "Edit Items" ` - -or $ListPermissions -contains "Delete Items" ` - -or $ListPermissions -contains "View Items" ` - -or $ListPermissions -contains "Approve Items" ` - -or $ListPermissions -contains "Open Items" ` - -or $ListPermissions -contains "View Versions" ` - -or $ListPermissions -contains "Delete Versions" ` - -or $ListPermissions -contains "Create Alerts" ` - -or $ListPermissions -contains "View Application Pages" ` - -or $SitePermissions -contains "Manage Permissions" ` - -or $SitePermissions -contains "View Web Analytics Data" ` - -or $SitePermissions -contains "Create Subsites" ` - -or $SitePermissions -contains "Manage Web Site" ` - -or $SitePermissions -contains "Add and Customize Pages" ` - -or $SitePermissions -contains "Apply Themes and Borders" ` - -or $SitePermissions -contains "Apply Style Sheets" ` - -or $SitePermissions -contains "Create Groups" ` - -or $SitePermissions -contains "Browse Directories" ` - -or $SitePermissions -contains "Use Self-Service Site Creation" ` - -or $SitePermissions -contains "View Pages" ` - -or $SitePermissions -contains "Enumerate Permissions" ` - -or $SitePermissions -contains "Browse User Information" ` - -or $SitePermissions -contains "Manage Alerts" ` - -or $SitePermissions -contains "Use Remote Interfaces" ` - -or $SitePermissions -contains "Use Client Integration Features" ` - -or $SitePermissions -contains "Edit Personal User Information" ` - -or $PersonalPermissions -contains "Manage Personal Views" ` - -or $PersonalPermissions -contains "Add/Remove Personal Web Parts" ` - -or $PersonalPermissions -contains "Update Personal Web Parts") ` - -and -not ($SitePermissions -contains "Open")) - { - throw "Open is required when specifying any of the other permissions" - } - - if ($PersonalPermissions -contains "Add/Remove Personal Web Parts" ` - -and -not ($PersonalPermissions -contains "Update Personal Web Parts")) - { - throw "Update Personal Web Parts is required when specifying Add/Remove Personal Web Parts" - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppPermissions/MSFT_SPWebAppPermissions.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppPermissions/MSFT_SPWebAppPermissions.schema.mof deleted file mode 100644 index 98e8979a..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppPermissions/MSFT_SPWebAppPermissions.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPWebAppPermissions")] -class MSFT_SPWebAppPermissions : OMI_BaseResource -{ - [Key, Description("The url of the web application")] string WebAppUrl; - [Write, Description("List permissions that need to be configured"), ValueMap{"Manage Lists","Override List Behaviors","Add Items","Edit Items","Delete Items","View Items","Approve Items","Open Items","View Versions","Delete Versions","Create Alerts","View Application Pages"}, Values{"Manage Lists","Override List Behaviors","Add Items","Edit Items","Delete Items","View Items","Approve Items","Open Items","View Versions","Delete Versions","Create Alerts","View Application Pages"}] string ListPermissions[]; - [Write, Description("Site permissions that need to be configured"), ValueMap{"Manage Permissions","View Web Analytics Data","Create Subsites","Manage Web Site","Add and Customize Pages","Apply Themes and Borders","Apply Style Sheets","Create Groups","Browse Directories","Use Self-Service Site Creation","View Pages","Enumerate Permissions","Browse User Information","Manage Alerts","Use Remote Interfaces","Use Client Integration Features","Open","Edit Personal User Information"}, Values{"Manage Permissions","View Web Analytics Data","Create Subsites","Manage Web Site","Add and Customize Pages","Apply Themes and Borders","Apply Style Sheets","Create Groups","Browse Directories","Use Self-Service Site Creation","View Pages","Enumerate Permissions","Browse User Information","Manage Alerts","Use Remote Interfaces","Use Client Integration Features","Open","Edit Personal User Information"}] string SitePermissions[]; - [Write, Description("Personal permissions that need to be configured"), ValueMap{"Manage Personal Views","Add/Remove Personal Web Parts","Update Personal Web Parts"}, Values{"Manage Personal Views","Add/Remove Personal Web Parts","Update Personal Web Parts"}] string PersonalPermissions[]; - [Write, Description("Set all permissions")] boolean AllPermissions; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppPolicy/MSFT_SPWebAppPolicy.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppPolicy/MSFT_SPWebAppPolicy.psm1 deleted file mode 100644 index 9b43fa6e..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppPolicy/MSFT_SPWebAppPolicy.psm1 +++ /dev/null @@ -1,823 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $false)] - [Microsoft.Management.Infrastructure.CimInstance[]] - $Members, - - [parameter(Mandatory = $false)] - [Microsoft.Management.Infrastructure.CimInstance[]] - $MembersToInclude, - - [parameter(Mandatory = $false)] - [Microsoft.Management.Infrastructure.CimInstance[]] - $MembersToExclude, - - [parameter(Mandatory = $false)] - [System.Boolean] - $SetCacheAccountsPolicy, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting web app policy for $WebAppUrl" - - if ($Members -and (($MembersToInclude) -or ($MembersToExclude))) - { - Write-Verbose -Message ("Cannot use the Members parameter together with " + ` - "the MembersToInclude or MembersToExclude parameters") - return $null - } - - if (!$Members -and !$MembersToInclude -and !$MembersToExclude) - { - Write-Verbose -Message ("At least one of the following parameters must be specified: " + ` - "Members, MembersToInclude, MembersToExclude") - return $null - } - - foreach ($member in $Members) - { - if (($member.ActAsSystemAccount -eq $true) ` - -and ($member.PermissionLevel -ne "Full Control")) - { - Write-Verbose -Message ("Members Parameter: You cannot specify ActAsSystemAccount " + ` - "with any other permission than Full Control") - return $null - } - } - - foreach ($member in $MembersToInclude) - { - if (($member.ActAsSystemAccount -eq $true) ` - -and ($member.PermissionLevel -ne "Full Control")) - { - Write-Verbose -Message ("MembersToInclude Parameter: You cannot specify " + ` - "ActAsSystemAccount with any other permission than Full " + ` - "Control") - return $null - } - } - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $wa = Get-SPWebApplication -Identity $params.WebAppUrl ` - -ErrorAction SilentlyContinue - - if ($null -eq $wa) - { - return $null - } - - $SetCacheAccountsPolicy = $false - if ($params.SetCacheAccountsPolicy) - { - if (($wa.Properties.ContainsKey("portalsuperuseraccount") -eq $true) -and ` - ($wa.Properties.ContainsKey("portalsuperreaderaccount") -eq $true)) - { - - $correctPSU = $false - $correctPSR = $false - - $psu = $wa.Policies[$wa.Properties["portalsuperuseraccount"]] - if ($null -ne $psu) - { - if ($psu.PolicyRoleBindings.Type -eq 'FullControl') - { - $correctPSU = $true - } - } - - $psr = $wa.Policies[$wa.Properties["portalsuperreaderaccount"]] - if ($null -ne $psr) - { - if ($psr.PolicyRoleBindings.Type -eq 'FullRead') - { - $correctPSR = $true - } - } - - if ($correctPSU -eq $true -and $correctPSR -eq $true) - { - $SetCacheAccountsPolicy = $true - } - } - } - - $members = @() - foreach ($policy in $wa.Policies) - { - $member = @{} - $memberName = $policy.UserName - $identityType = "Native" - if ($memberName -like "i:*|*" -or $memberName -like "c:*|*") - { - $identityType = "Claims" - $convertedClaim = New-SPClaimsPrincipal -Identity $memberName ` - -IdentityType EncodedClaim ` - -ErrorAction SilentlyContinue - if ($null -ne $convertedClaim) - { - $memberName = $convertedClaim.Value - } - } - - if ($memberName -match "^s-1-[0-59]-\d+-\d+-\d+-\d+-\d+") - { - $memberName = Resolve-SPDscSecurityIdentifier -SID $memberName - } - - switch ($policy.PolicyRoleBindings.Type) - { - 'DenyAll' - { - $memberPermissionlevel = 'Deny All' - } - 'DenyWrite' - { - $memberPermissionlevel = 'Deny Write' - } - 'FullControl' - { - $memberPermissionlevel = 'Full Control' - } - 'FullRead' - { - $memberPermissionlevel = 'Full Read' - } - } - - $member.Username = $memberName - $member.PermissionLevel = $memberPermissionlevel - $member.ActAsSystemAccount = $policy.IsSystemUser - $member.IdentityType = $identityType - $members += $member - } - - $returnval = @{ - WebAppUrl = $params.WebAppUrl - Members = $members - MembersToInclude = $params.MembersToInclude - MembersToExclude = $params.MembersToExclude - SetCacheAccountsPolicy = $SetCacheAccountsPolicy - InstallAccount = $params.InstallAccount - } - - return $returnval - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $false)] - [Microsoft.Management.Infrastructure.CimInstance[]] - $Members, - - [parameter(Mandatory = $false)] - [Microsoft.Management.Infrastructure.CimInstance[]] - $MembersToInclude, - - [parameter(Mandatory = $false)] - [Microsoft.Management.Infrastructure.CimInstance[]] - $MembersToExclude, - - [parameter(Mandatory = $false)] - [System.Boolean] - $SetCacheAccountsPolicy, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting web app policy for $WebAppUrl" - - if ($Members -and (($MembersToInclude) -or ($MembersToExclude))) - { - throw ("Cannot use the Members parameter together with the " + ` - "MembersToInclude or MembersToExclude parameters") - } - - if (!$Members -and !$MembersToInclude -and !$MembersToExclude) - { - throw ("At least one of the following parameters must be specified: " + ` - "Members, MembersToInclude, MembersToExclude") - } - - foreach ($member in $Members) - { - if (($member.ActAsSystemAccount -eq $true) -and ` - ($member.PermissionLevel -ne "Full Control")) - { - throw ("Members Parameter: You cannot specify ActAsSystemAccount " + ` - "with any other permission than Full Control") - } - } - - foreach ($member in $MembersToInclude) - { - if (($member.ActAsSystemAccount -eq $true) -and ` - ($member.PermissionLevel -ne "Full Control")) - { - throw ("MembersToInclude Parameter: You cannot specify ActAsSystemAccount " + ` - "with any other permission than Full Control") - } - } - - $CurrentValues = Get-TargetResource @PSBoundParameters - - - $modulePath = "..\..\Modules\SharePointDsc.WebAppPolicy\SPWebAppPolicy.psm1" - Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath $modulePath -Resolve) - - if ($null -eq $CurrentValues) - { - throw "Web application does not exist" - } - - $cacheAccounts = Get-SPDSCCacheAccountConfiguration -InputParameters $WebAppUrl - - if ($SetCacheAccountsPolicy) - { - if ($cacheAccounts.SuperUserAccount -eq "" -or $cacheAccounts.SuperReaderAccount -eq "") - { - throw ("Cache accounts not configured properly. PortalSuperUserAccount or " + ` - "PortalSuperReaderAccount property is not configured.") - } - } - - # Determine the default identity type to use for entries that do not have it specified - $defaultIdentityType = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $wa = Get-SPWebApplication -Identity $params.WebAppUrl - if ($wa.UseClaimsAuthentication -eq $true) - { - return "Claims" - } - else - { - return "Native" - } - } - - $changeUsers = @() - - if ($Members -or $MembersToInclude) - { - $allMembers = @() - if ($Members) - { - Write-Verbose -Message "Members property is set - setting full membership list" - $membersToCheck = $Members - } - if ($MembersToInclude) - { - Write-Verbose -Message ("MembersToInclude property is set - setting membership " + ` - "list to ensure specified members are included") - $membersToCheck = $MembersToInclude - } - foreach ($member in $membersToCheck) - { - $allMembers += $member - } - - # Determine if cache accounts are to be included users - if ($SetCacheAccountsPolicy) - { - Write-Verbose -Message "SetCacheAccountsPolicy is True - Adding Cache Accounts to list" - $psuAccount = @{ - UserName = $cacheAccounts.SuperUserAccount - PermissionLevel = "Full Control" - IdentityMode = $cacheAccounts.IdentityMode - } - $allMembers += $psuAccount - - $psrAccount = @{ - UserName = $cacheAccounts.SuperReaderAccount - PermissionLevel = "Full Read" - IdentityMode = $cacheAccounts.IdentityMode - } - $allMembers += $psrAccount - } - - # Get the list of differences from the current configuration - $differences = Compare-SPDSCWebAppPolicy -WAPolicies $CurrentValues.Members ` - -DSCSettings $allMembers ` - -DefaultIdentityType $defaultIdentityType - - foreach ($difference in $differences) - { - switch ($difference.Status) - { - Additional { - # Only remove users if the "Members" property was set - # instead of "MembersToInclude" - if ($Members) - { - $user = @{ - Type = "Delete" - Username = $difference.Username - IdentityMode = $difference.IdentityType - } - } - } - Different { - $user = @{ - Type = "Change" - Username = $difference.Username - PermissionLevel = $difference.DesiredPermissionLevel - ActAsSystemAccount = $difference.DesiredActAsSystemSetting - IdentityMode = $difference.IdentityType - } - } - Missing { - $user = @{ - Type = "Add" - Username = $difference.Username - PermissionLevel = $difference.DesiredPermissionLevel - ActAsSystemAccount = $difference.DesiredActAsSystemSetting - IdentityMode = $difference.IdentityType - } - } - } - $changeUsers += $user - } - } - - if ($MembersToExclude) - { - Write-Verbose -Message ("MembersToExclude property is set - setting membership list " + ` - "to ensure specified members are not included") - - foreach ($member in $MembersToExclude) - { - $policy = $CurrentValues.Members | Where-Object -FilterScript { - $_.UserName -eq $member.UserName -and $_.IdentityType -eq $identityType - } - - if (($cacheAccounts.SuperUserAccount -eq $member.Username) -or ` - ($cacheAccounts.SuperReaderAccount -eq $member.Username)) - { - throw "You cannot exclude the Cache accounts from the Web Application Policy" - } - - if ($null -ne $policy) - { - $user = @{ - Type = "Delete" - Username = $member.UserName - } - } - $changeUsers += $user - } - } - - ## Perform changes - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters,$PSScriptRoot,$changeUsers) ` - -ScriptBlock { - $params = $args[0] - $scriptRoot = $args[1] - $changeUsers = $args[2] - - $modulePath = "..\..\Modules\SharePointDsc.WebAppPolicy\SPWebAppPolicy.psm1" - Import-Module -Name (Join-Path -Path $scriptRoot -ChildPath $modulePath -Resolve) - - $wa = Get-SPWebApplication -Identity $params.WebAppUrl -ErrorAction SilentlyContinue - - if ($null -eq $wa) - { - throw "Specified web application could not be found." - } - - $denyAll = $wa.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::DenyAll) - $denyWrite = $wa.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::DenyWrite) - $fullControl = $wa.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::FullControl) - $fullRead = $wa.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::FullRead) - - Write-Verbose -Message "Processing changes" - - foreach ($user in $changeUsers) - { - switch ($user.Type) - { - "Add" { - # User does not exist. Add user - Write-Verbose -Message "Adding $($user.Username)" - - $userToAdd = $user.Username - if ($user.IdentityMode -eq "Claims") - { - $isUser = Test-SPDSCIsADUser -IdentityName $user.Username - if ($isUser -eq $true) - { - $principal = New-SPClaimsPrincipal -Identity $user.Username ` - -IdentityType WindowsSamAccountName - $userToAdd = $principal.ToEncodedString() - } - else - { - $principal = New-SPClaimsPrincipal -Identity $user.Username ` - -IdentityType WindowsSecurityGroupName - $userToAdd = $principal.ToEncodedString() - } - } - $newPolicy = $wa.Policies.Add($userToAdd, $user.UserName) - foreach ($permissionLevel in $user.PermissionLevel) - { - switch ($permissionLevel) - { - "Deny All" { - $newPolicy.PolicyRoleBindings.Add($denyAll) - } - "Deny Write" { - $newPolicy.PolicyRoleBindings.Add($denyWrite) - } - "Full Control" { - $newPolicy.PolicyRoleBindings.Add($fullControl) - } - "Full Read" { - $newPolicy.PolicyRoleBindings.Add($fullRead) - } - } - } - if ($user.ActAsSystemAccount) - { - $newPolicy.IsSystemUser = $user.ActAsSystemAccount - } - } - "Change" { - # User exists. Check permissions - $userToChange = $user.Username - if ($user.IdentityMode -eq "Claims") - { - $isUser = Test-SPDSCIsADUser -IdentityName $user.Username - if ($isUser -eq $true) - { - $principal = New-SPClaimsPrincipal -Identity $user.Username ` - -IdentityType WindowsSamAccountName - $userToChange = $principal.ToEncodedString() - } - else - { - $principal = New-SPClaimsPrincipal -Identity $user.Username ` - -IdentityType WindowsSecurityGroupName - $userToChange = $principal.ToEncodedString() - } - } - $policy = $wa.Policies | Where-Object -FilterScript { - $_.UserName -eq $userToChange - } - - Write-Verbose -Message "User $($user.Username) exists, checking permissions" - if ($user.ActAsSystemAccount -ne $policy.IsSystemUser) - { - $policy.IsSystemUser = $user.ActAsSystemAccount - } - - switch ($policy.PolicyRoleBindings.Type) - { - 'DenyAll' - { - $userPermissionlevel = 'Deny All' - } - 'DenyWrite' - { - $userPermissionlevel = 'Deny Write' - } - 'FullControl' - { - $userPermissionlevel = 'Full Control' - } - 'FullRead' - { - $userPermissionlevel = 'Full Read' - } - } - - $polbinddiff = Compare-Object -ReferenceObject $userPermissionlevel ` - -DifferenceObject $user.PermissionLevel - if ($null -ne $polbinddiff) - { - $policy.PolicyRoleBindings.RemoveAll() - foreach ($permissionLevel in $user.PermissionLevel) - { - switch ($permissionLevel) - { - "Deny All" { - $policy.PolicyRoleBindings.Add($denyAll) - } - "Deny Write" { - $policy.PolicyRoleBindings.Add($denyWrite) - } - "Full Control" { - $policy.PolicyRoleBindings.Add($fullControl) - } - "Full Read" { - $policy.PolicyRoleBindings.Add($fullRead) - } - } - } - } - } - "Delete" - { - Write-Verbose -Message "Removing $($user.Username)" - $userToDrop = $user.Username - if ($user.IdentityMode -eq "Claims") - { - $isUser = Test-SPDSCIsADUser -IdentityName $user.Username - if ($isUser -eq $true) - { - $principal = New-SPClaimsPrincipal -Identity $user.Username ` - -IdentityType WindowsSamAccountName - $userToDrop = $principal.ToEncodedString() - } - else - { - $principal = New-SPClaimsPrincipal -Identity $user.Username ` - -IdentityType WindowsSecurityGroupName - $userToDrop = $principal.ToEncodedString() - } - } - Remove-SPDSCGenericObject -SourceCollection $wa.Policies ` - -Target $userToDrop ` - -ErrorAction SilentlyContinue - } - } - } - $wa.Update() - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $false)] - [Microsoft.Management.Infrastructure.CimInstance[]] - $Members, - - [parameter(Mandatory = $false)] - [Microsoft.Management.Infrastructure.CimInstance[]] - $MembersToInclude, - - [parameter(Mandatory = $false)] - [Microsoft.Management.Infrastructure.CimInstance[]] - $MembersToExclude, - - [parameter(Mandatory = $false)] - [System.Boolean] - $SetCacheAccountsPolicy, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing web app policy for $WebAppUrl" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - $modulePath = "..\..\Modules\SharePointDsc.WebAppPolicy\SPWebAppPolicy.psm1" - Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath $modulePath -Resolve) - - if ($null -eq $CurrentValues) - { - return $false - } - - $cacheAccounts = Get-SPDSCCacheAccountConfiguration -InputParameters $WebAppUrl - if ($SetCacheAccountsPolicy) - { - if (($cacheAccounts.SuperUserAccount -eq "") -or ` - ($cacheAccounts.SuperReaderAccount -eq "")) - { - throw "Cache accounts not configured properly. PortalSuperUserAccount or " + ` - "PortalSuperReaderAccount property is not configured." - } - } - - # Determine the default identity type to use for entries that do not have it specified - $defaultIdentityType = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $wa = Get-SPWebApplication -Identity $params.WebAppUrl - if ($wa.UseClaimsAuthentication -eq $true) - { - return "Claims" - } - else - { - return "Native" - } - } - - # If checking the full members list, or the list of members to include then build the - # appropriate members list and check for the output of Compare-SPDSCWebAppPolicy - if ($Members -or $MembersToInclude) - { - $allMembers = @() - if ($Members) - { - Write-Verbose -Message "Members property is set - testing full membership list" - $membersToCheck = $Members - } - if ($MembersToInclude) - { - Write-Verbose -Message ("MembersToInclude property is set - testing membership " + ` - "list to ensure specified members are included") - $membersToCheck = $MembersToInclude - } - foreach ($member in $membersToCheck) - { - $allMembers += $member - } - - # Determine if cache accounts are to be included users - if ($SetCacheAccountsPolicy) - { - Write-Verbose -Message "SetCacheAccountsPolicy is True - Adding Cache Accounts to list" - $psuAccount = @{ - UserName = $cacheAccounts.SuperUserAccount - PermissionLevel = "Full Control" - IdentityMode = $cacheAccounts.IdentityMode - } - $allMembers += $psuAccount - - $psrAccount = @{ - UserName = $cacheAccounts.SuperReaderAccount - PermissionLevel = "Full Read" - IdentityMode = $cacheAccounts.IdentityMode - } - $allMembers += $psrAccount - } - - # Get the list of differences from the current configuration - $differences = Compare-SPDSCWebAppPolicy -WAPolicies $CurrentValues.Members ` - -DSCSettings $allMembers ` - -DefaultIdentityType $defaultIdentityType - - # If checking members, any difference counts as a fail - if ($Members) - { - if ($differences.Count -eq 0) - { - return $true - } - else - { - Write-Verbose -Message "Differences in the policy were found, returning false" - return $false - } - } - - # If only checking members to include only differences or missing records count as a fail - if ($MembersToInclude) - { - if (($differences | Where-Object -FilterScript { - $_.Status -eq "Different" -or $_.Status -eq "Missing" - }).Count -eq 0) - { - return $true - } - else - { - Write-Verbose -Message "Different or Missing policy was found, returning false" - return $false - } - } - } - - # If checking members to exlclude, simply compare the list of user names to the current - # membership list - if ($MembersToExclude) - { - Write-Verbose -Message ("MembersToExclude property is set - checking for permissions " + ` - "that need to be removed") - foreach ($member in $MembersToExclude) - { - if (($cacheAccounts.SuperUserAccount -eq $member.Username) -or ` - ($cacheAccounts.SuperReaderAccount -eq $member.Username)) - { - throw "You cannot exclude the Cache accounts from the Web Application Policy" - } - - foreach ($policy in $CurrentValues.Members) - { - if ($policy.Username -eq $member.Username) - { - return $false - } - } - } - return $true - } -} - -function Get-SPDSCCacheAccountConfiguration() -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param ( - [parameter(Mandatory = $false)] - [Object[]] - $InputParameters - ) - - $cacheAccounts = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $InputParameters ` - -ScriptBlock { - Write-Verbose -Message "Retrieving CacheAccounts" - $params = $args[0] - - $wa = Get-SPWebApplication -Identity $params -ErrorAction SilentlyContinue - - if ($null -eq $wa) - { - throw "Specified web application could not be found." - } - - $returnval = @{ - SuperUserAccount = "" - SuperReaderAccount = "" - } - - if ($wa.Properties.ContainsKey("portalsuperuseraccount")) - { - $memberName = $wa.Properties["portalsuperuseraccount"] - if ($wa.UseClaimsAuthentication -eq $true) - { - $convertedClaim = New-SPClaimsPrincipal -Identity $memberName ` - -IdentityType EncodedClaim ` - -ErrorAction SilentlyContinue - if($null -ne $convertedClaim) - { - $memberName = $convertedClaim.Value - } - } - $returnval.SuperUserAccount = $memberName - } - if ($wa.Properties.ContainsKey("portalsuperreaderaccount")) - { - $memberName = $wa.Properties["portalsuperreaderaccount"] - if ($wa.UseClaimsAuthentication -eq $true) - { - $convertedClaim = New-SPClaimsPrincipal -Identity $memberName ` - -IdentityType EncodedClaim ` - -ErrorAction SilentlyContinue - if($null -ne $convertedClaim) - { - $memberName = $convertedClaim.Value - } - } - $returnval.SuperReaderAccount = $memberName - } - - if ($wa.UseClaimsAuthentication -eq $true) - { - $returnval.IdentityMode = "Claims" - } - else - { - $returnval.IdentityMode = "Native" - } - - return $returnval - } - - return $cacheAccounts -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppPolicy/MSFT_SPWebAppPolicy.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppPolicy/MSFT_SPWebAppPolicy.schema.mof deleted file mode 100644 index 10f38d30..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppPolicy/MSFT_SPWebAppPolicy.schema.mof +++ /dev/null @@ -1,18 +0,0 @@ -[ClassVersion("1.0.0.0")] -Class MSFT_SPWebPolicyPermissions -{ - [Key, Description("Name of the account")] String Username; - [Write, Description("Permission level of the account"), ValueMap{"Deny All","Deny Write","Full Read","Full Control"}, Values{"Deny All","Deny Write","Full Read","Full Control"}] String PermissionLevel[]; - [Write, Description("Identity type for this entry, either claims or native. If not specified it will default to whatever mode the web application is in."), ValueMap{"Claims","Native"}, Values{"Claims","Native"}] String IdentityType; - [Write, Description("Specifies if the account is allowed to act as a system account")] Boolean ActAsSystemAccount; -}; -[ClassVersion("1.0.0.0"), FriendlyName("SPWebAppPolicy")] -class MSFT_SPWebAppPolicy : OMI_BaseResource -{ - [Key, Description("The URL of the web application")] string WebAppUrl; - [Write, Description("Exact list of accounts that will have to get Web Policy permissions"), EmbeddedInstance("MSFT_SPWebPolicyPermissions")] String Members[]; - [Write, Description("List of all accounts that must be in the Web Policy group"), EmbeddedInstance("MSFT_SPWebPolicyPermissions")] String MembersToInclude[]; - [Write, Description("List of all accounts that are not allowed to have any Web Policy permissions"), EmbeddedInstance("MSFT_SPWebPolicyPermissions")] String MembersToExclude[]; - [Write, Description("Include the Cache Accounts in the policy or not")] Boolean SetCacheAccountsPolicy; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppProxyGroup/MSFT_SPWebAppProxyGroup.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppProxyGroup/MSFT_SPWebAppProxyGroup.psm1 deleted file mode 100644 index f63330d9..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppProxyGroup/MSFT_SPWebAppProxyGroup.psm1 +++ /dev/null @@ -1,129 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $true)] - [System.String] - $ServiceAppProxyGroup, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting $WebAppUrl Service Proxy Group Association" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $WebApp = get-spwebapplication $params.WebAppUrl - if (!$WebApp) - { - return @{ - WebAppUrl = $null - ServiceAppProxyGroup = $null - InstallAccount = $InstallAccount - } - } - - if ($WebApp.ServiceApplicationProxyGroup.friendlyname -eq "[default]") - { - $ServiceAppProxyGroup = "Default" - } - else - { - $ServiceAppProxyGroup = $WebApp.ServiceApplicationProxyGroup.name - } - - return @{ - WebAppUrl = $params.WebAppUrl - ServiceAppProxyGroup = $ServiceAppProxyGroup - InstallAccount = $InstallAccount - } - } - - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $true)] - [System.String] - $ServiceAppProxyGroup, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting $WebAppUrl Service Proxy Group Association" - - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - if ($params.ServiceAppProxyGroup -eq "Default") - { - $params.ServiceAppProxyGroup = "[default]" - } - - Set-SPWebApplication -Identity $params.WebAppUrl ` - -ServiceApplicationProxyGroup $params.ServiceAppProxyGroup - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $true)] - [System.String] - $ServiceAppProxyGroup, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing $WebAppUrl Service Proxy Group Association" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if (($null -eq $CurrentValues.WebAppUrl) -or ($null -eq $CurrentValues.ServiceAppProxyGroup)) - { - return $false - } - - if ($CurrentValues.ServiceAppProxyGroup -eq $ServiceAppProxyGroup) - { - return $true - } - else - { - return $false - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppProxyGroup/MSFT_SPWebAppProxyGroup.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppProxyGroup/MSFT_SPWebAppProxyGroup.schema.mof deleted file mode 100644 index e5781169..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppProxyGroup/MSFT_SPWebAppProxyGroup.schema.mof +++ /dev/null @@ -1,7 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPWebAppProxyGroup")] -class MSFT_SPWebAppProxyGroup : OMI_BaseResource -{ - [Key, Description("URL of the web application")] String WebAppUrl; - [Required, Description("Name of the Service Application Proxy Group")] string ServiceAppProxyGroup; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppSiteUseAndDeletion/MSFT_SPWebAppSiteUseAndDeletion.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppSiteUseAndDeletion/MSFT_SPWebAppSiteUseAndDeletion.psm1 deleted file mode 100644 index 3269748d..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppSiteUseAndDeletion/MSFT_SPWebAppSiteUseAndDeletion.psm1 +++ /dev/null @@ -1,236 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $false)] - [System.Boolean] - $SendUnusedSiteCollectionNotifications, - - [parameter(Mandatory = $false)] - [System.UInt32] - $UnusedSiteNotificationPeriod, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AutomaticallyDeleteUnusedSiteCollections, - - [parameter(Mandatory = $false)] - [ValidateRange(2,168)] - [System.UInt32] - $UnusedSiteNotificationsBeforeDeletion, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting web application '$url' site use and deletion settings" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - try - { - $spFarm = Get-SPFarm - } - catch - { - Write-Verbose -Message ("No local SharePoint farm was detected. Site Use and " + ` - "Deletion settings will not be applied") - return $null - } - - $wa = Get-SPWebApplication -Identity $params.Url ` - -ErrorAction SilentlyContinue - if ($null -eq $wa) - { - return $null - } - - return @{ - # Set the Site Use and Deletion settings - Url = $params.Url - SendUnusedSiteCollectionNotifications = $wa.SendUnusedSiteCollectionNotifications - UnusedSiteNotificationPeriod = $wa.UnusedSiteNotificationPeriod.TotalDays - AutomaticallyDeleteUnusedSiteCollections = $wa.AutomaticallyDeleteUnusedSiteCollections - UnusedSiteNotificationsBeforeDeletion = $wa.UnusedSiteNotificationsBeforeDeletion - InstallAccount = $params.InstallAccount - } - } - - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $false)] - [System.Boolean] - $SendUnusedSiteCollectionNotifications, - - [parameter(Mandatory = $false)] - [System.UInt32] - $UnusedSiteNotificationPeriod, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AutomaticallyDeleteUnusedSiteCollections, - - [parameter(Mandatory = $false)] - [ValidateRange(2,168)] - [System.UInt32] - $UnusedSiteNotificationsBeforeDeletion, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting web application '$Url' Site Use and Deletion settings" - - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - try - { - $spFarm = Get-SPFarm - } - catch - { - throw ("No local SharePoint farm was detected. Site Use and Deletion settings " + ` - "will not be applied") - } - - $wa = Get-SPWebApplication -Identity $params.Url -ErrorAction SilentlyContinue - if ($null -eq $wa) - { - throw "Configured web application could not be found" - } - - # Check if the specified value is in the range for the configured schedule - $job = Get-SPTimerJob -Identity job-dead-site-delete -WebApplication $params.Url - if ($null -eq $job) - { - throw "Dead Site Delete timer job for web application $($params.Url) could not be found" - } - else - { - # Check schedule value - switch ($job.Schedule.Description) - { - "Daily" { - if (($params.UnusedSiteNotificationsBeforeDeletion -lt 28) -or - ($params.UnusedSiteNotificationsBeforeDeletion -gt 168)) - { - throw ("Value of UnusedSiteNotificationsBeforeDeletion has to be >28 and " + ` - "<168 when the schedule is set to daily") - } - } - "Weekly" { - if (($params.UnusedSiteNotificationsBeforeDeletion -lt 4) -or - ($params.UnusedSiteNotificationsBeforeDeletion -gt 24)) - { - throw ("Value of UnusedSiteNotificationsBeforeDeletion has to be >4 and " + ` - "<24 when the schedule is set to weekly") - } - } - "Monthly" { - if (($params.UnusedSiteNotificationsBeforeDeletion -lt 2) -or - ($params.UnusedSiteNotificationsBeforeDeletion -gt 6)) - { - throw ("Value of UnusedSiteNotificationsBeforeDeletion has to be >2 and " + ` - "<6 when the schedule is set to monthly") - } - } - } - } - - Write-Verbose -Message "Start update" - - # Set the Site Use and Deletion settings - if ($params.ContainsKey("SendUnusedSiteCollectionNotifications")) - { - $wa.SendUnusedSiteCollectionNotifications = ` - $params.SendUnusedSiteCollectionNotifications - } - if ($params.ContainsKey("UnusedSiteNotificationPeriod")) - { - $timespan = New-TimeSpan -Days $params.UnusedSiteNotificationPeriod - $wa.UnusedSiteNotificationPeriod = $timespan - } - if ($params.ContainsKey("AutomaticallyDeleteUnusedSiteCollections")) - { - $wa.AutomaticallyDeleteUnusedSiteCollections = ` - $params.AutomaticallyDeleteUnusedSiteCollections - } - if ($params.ContainsKey("UnusedSiteNotificationsBeforeDeletion")) - { - $wa.UnusedSiteNotificationsBeforeDeletion = ` - $params.UnusedSiteNotificationsBeforeDeletion - } - $wa.Update() - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $false)] - [System.Boolean] - $SendUnusedSiteCollectionNotifications, - - [parameter(Mandatory = $false)] - [System.UInt32] - $UnusedSiteNotificationPeriod, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AutomaticallyDeleteUnusedSiteCollections, - - [parameter(Mandatory = $false)] - [ValidateRange(2,168)] - [System.UInt32] - $UnusedSiteNotificationsBeforeDeletion, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing web application '$url' site use and deletion settings" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($null -eq $CurrentValues) - { - return $false - } - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppSiteUseAndDeletion/MSFT_SPWebAppSiteUseAndDeletion.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppSiteUseAndDeletion/MSFT_SPWebAppSiteUseAndDeletion.schema.mof deleted file mode 100644 index 0de0fd28..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppSiteUseAndDeletion/MSFT_SPWebAppSiteUseAndDeletion.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ -[ClassVersion("1.0.0"), FriendlyName("SPWebAppSiteUseAndDeletion")] -class MSFT_SPWebAppSiteUseAndDeletion : OMI_BaseResource -{ - [Key, Description("The URL of the web application")] string Url; - [Write, Description("Should emails be sent to notify site owners of unused site collections")] boolean SendUnusedSiteCollectionNotifications; - [Write, Description("How many days should pass before a site is flagged as unused")] uint32 UnusedSiteNotificationPeriod; - [Write, Description("Should unused site collection be automatically deleted")] boolean AutomaticallyDeleteUnusedSiteCollections; - [Write, Description("How many days before an unused site is deleted should an email be sent to the owner")] uint32 UnusedSiteNotificationsBeforeDeletion; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] string InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppThrottlingSettings/MSFT_SPWebAppThrottlingSettings.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppThrottlingSettings/MSFT_SPWebAppThrottlingSettings.psm1 deleted file mode 100644 index 216828d2..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppThrottlingSettings/MSFT_SPWebAppThrottlingSettings.psm1 +++ /dev/null @@ -1,247 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $false)] - [System.UInt32] - $ListViewThreshold, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowObjectModelOverride, - - [parameter(Mandatory = $false)] - [System.UInt32] - $AdminThreshold, - - [parameter(Mandatory = $false)] - [System.UInt32] - $ListViewLookupThreshold, - - [parameter(Mandatory = $false)] - [System.Boolean] - $HappyHourEnabled, - - [parameter(Mandatory = $false)] - [Microsoft.Management.Infrastructure.CimInstance] - $HappyHour, - - [parameter(Mandatory = $false)] - [System.UInt32] - $UniquePermissionThreshold, - - [parameter(Mandatory = $false)] - [System.Boolean] - $RequestThrottling, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ChangeLogEnabled, - - [parameter(Mandatory = $false)] - [System.UInt32] - $ChangeLogExpiryDays, - - [parameter(Mandatory = $false)] - [System.Boolean] - $EventHandlersEnabled, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting web application '$url' throttling settings" - - $paramArgs = @($PSBoundParameters,$PSScriptRoot) - $result = Invoke-SPDSCCommand -Credential $InstallAccount -Arguments $paramArgs -ScriptBlock { - $params = $args[0] - $ScriptRoot = $args[1] - - $wa = Get-SPWebApplication -Identity $params.Url -ErrorAction SilentlyContinue - if ($null -eq $wa) - { - return $null - } - - $relPath = "..\..\Modules\SharePointDsc.WebApplication\SPWebApplication.Throttling.psm1" - Import-Module -Name (Join-Path -Path $ScriptRoot -ChildPath $relPath -Resolve) - - $result = Get-SPDSCWebApplicationThrottlingConfig -WebApplication $wa - $result.Add("Url", $params.Url) - $result.Add("InstallAccount", $params.InstallAccount) - return $result - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $false)] - [System.UInt32] - $ListViewThreshold, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowObjectModelOverride, - - [parameter(Mandatory = $false)] - [System.UInt32] - $AdminThreshold, - - [parameter(Mandatory = $false)] - [System.UInt32] - $ListViewLookupThreshold, - - [parameter(Mandatory = $false)] - [System.Boolean] - $HappyHourEnabled, - - [parameter(Mandatory = $false)] - [Microsoft.Management.Infrastructure.CimInstance] - $HappyHour, - - [parameter(Mandatory = $false)] - [System.UInt32] - $UniquePermissionThreshold, - - [parameter(Mandatory = $false)] - [System.Boolean] - $RequestThrottling, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ChangeLogEnabled, - - [parameter(Mandatory = $false)] - [System.UInt32] - $ChangeLogExpiryDays, - - [parameter(Mandatory = $false)] - [System.Boolean] - $EventHandlersEnabled, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting web application '$Url' throttling settings" - - $paramArgs = @($PSBoundParameters,$PSScriptRoot) - - $result = Invoke-SPDSCCommand -Credential $InstallAccount -Arguments $paramArgs -ScriptBlock { - $params = $args[0] - $ScriptRoot = $args[1] - - $wa = Get-SPWebApplication -Identity $params.Url -ErrorAction SilentlyContinue - if ($null -eq $wa) - { - throw "Web application $($params.Url) was not found" - return - } - - $relPath = "..\..\Modules\SharePointDsc.WebApplication\SPWebApplication.Throttling.psm1" - Import-Module -Name (Join-Path -Path $ScriptRoot -ChildPath $relPath -Resolve) - Set-SPDSCWebApplicationThrottlingConfig -WebApplication $wa -Settings $params - $wa.Update() - - # Happy hour settings - if ($params.ContainsKey("HappyHour") -eq $true) - { - # Happy hour settins use separate update method so use a fresh web app to update these - $wa2 = Get-SPWebApplication -Identity $params.Url - Set-SPDSCWebApplicationHappyHourConfig -WebApplication $wa2 -Settings $params.HappyHour - $wa2.Update() - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $false)] - [System.UInt32] - $ListViewThreshold, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowObjectModelOverride, - - [parameter(Mandatory = $false)] - [System.UInt32] - $AdminThreshold, - - [parameter(Mandatory = $false)] - [System.UInt32] - $ListViewLookupThreshold, - - [parameter(Mandatory = $false)] - [System.Boolean] - $HappyHourEnabled, - - [parameter(Mandatory = $false)] - [Microsoft.Management.Infrastructure.CimInstance] - $HappyHour, - - [parameter(Mandatory = $false)] - [System.UInt32] - $UniquePermissionThreshold, - - [parameter(Mandatory = $false)] - [System.Boolean] - $RequestThrottling, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ChangeLogEnabled, - - [parameter(Mandatory = $false)] - [System.UInt32] - $ChangeLogExpiryDays, - - [parameter(Mandatory = $false)] - [System.Boolean] - $EventHandlersEnabled, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing web application '$url' throttling settings" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($null -eq $CurrentValues) - { - return $false - } - - $relPath = "..\..\Modules\SharePointDsc.WebApplication\SPWebApplication.Throttling.psm1" - Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath $relPath -Resolve) - return Test-SPDSCWebApplicationThrottlingConfig -CurrentSettings $CurrentValues ` - -DesiredSettings $PSBoundParameters -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppThrottlingSettings/MSFT_SPWebAppThrottlingSettings.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppThrottlingSettings/MSFT_SPWebAppThrottlingSettings.schema.mof deleted file mode 100644 index 0814b256..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppThrottlingSettings/MSFT_SPWebAppThrottlingSettings.schema.mof +++ /dev/null @@ -1,25 +0,0 @@ -[ClassVersion("1.0.0.0")] -Class MSFT_SPWebApplicationHappyHour -{ - [write] uint32 Hour; - [write] uint32 Minute; - [write] uint32 Duration; - -}; -[ClassVersion("1.0.0.0"), FriendlyName("SPWebAppThrottlingSettings")] -class MSFT_SPWebAppThrottlingSettings : OMI_BaseResource -{ - [Key, Description("The URL of the web application")] string Url; - [Write, Description("What should the list view threshold for this site be set to")] uint32 ListViewThreshold; - [Write, Description("Should object model code be able to be override the list view threshold")] boolean AllowObjectModelOverride; - [Write, Description("What is the list view threshold for site administrators")] uint32 AdminThreshold; - [Write, Description("What is the maximum number of lookup fields in a single list view")] uint32 ListViewLookupThreshold; - [Write, Description("Should the happy hour window be enabled for this web app")] boolean HappyHourEnabled; - [Write, Description("The time window for happy hour"), EmbeddedInstance("MSFT_SPWebApplicationHappyHour")] string HappyHour; - [Write, Description("What is the limit for unique permissions on a single object in this web app")] uint32 UniquePermissionThreshold; - [Write, Description("Is request throttling enabled on this web app")] boolean RequestThrottling; - [Write, Description("Is the change log enabled for this web app")] boolean ChangeLogEnabled; - [Write, Description("How many days does the change log store data for")] uint32 ChangeLogExpiryDays; - [Write, Description("Are event handlers enabled in the web application")] boolean EventHandlersEnabled; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] string InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppWorkflowSettings/MSFT_SPWebAppWorkflowSettings.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppWorkflowSettings/MSFT_SPWebAppWorkflowSettings.psm1 deleted file mode 100644 index 2c6484ea..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppWorkflowSettings/MSFT_SPWebAppWorkflowSettings.psm1 +++ /dev/null @@ -1,137 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ExternalWorkflowParticipantsEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $UserDefinedWorkflowsEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $EmailToNoPermissionWorkflowParticipantsEnable, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting web application '$url' workflow settings" - - $paramArgs = @($PSBoundParameters,$PSScriptRoot) - $result = Invoke-SPDSCCommand -Credential $InstallAccount -Arguments $paramArgs -ScriptBlock { - $params = $args[0] - $ScriptRoot = $args[1] - - - $wa = Get-SPWebApplication -Identity $params.Url -ErrorAction SilentlyContinue - if ($null -eq $wa) - { - return $null - } - - $relPath = "..\..\Modules\SharePointDsc.WebApplication\SPWebApplication.Workflow.psm1" - Import-Module (Join-Path $ScriptRoot $relPath -Resolve) - - $result = Get-SPDSCWebApplicationWorkflowConfig -WebApplication $wa - $result.Add("Url", $params.Url) - $result.Add("InstallAccount", $params.InstallAccount) - return $result - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ExternalWorkflowParticipantsEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $UserDefinedWorkflowsEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $EmailToNoPermissionWorkflowParticipantsEnable, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting web application '$Url' workflow settings" - - $paramArgs = @($PSBoundParameters,$PSScriptRoot) - $result = Invoke-SPDSCCommand -Credential $InstallAccount -Arguments $paramArgs -ScriptBlock { - $params = $args[0] - $ScriptRoot = $args[1] - - $wa = Get-SPWebApplication -Identity $params.Url -ErrorAction SilentlyContinue - if ($null -eq $wa) { - throw "Web application $($params.Url) was not found" - return - } - - $relpath = "..\..\Modules\SharePointDsc.WebApplication\SPWebApplication.Workflow.psm1" - Import-Module (Join-Path $ScriptRoot $relPath -Resolve) - Set-SPDSCWebApplicationWorkflowConfig -WebApplication $wa -Settings $params - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ExternalWorkflowParticipantsEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $UserDefinedWorkflowsEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $EmailToNoPermissionWorkflowParticipantsEnable, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing web application '$Url' workflow settings" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($null -eq $CurrentValues) { return $false } - - $relPath = "..\..\Modules\SharePointDsc.WebApplication\SPWebApplication.Workflow.psm1" - Import-Module (Join-Path $PSScriptRoot $relPath -Resolve) - return Test-SPDSCWebApplicationWorkflowConfig -CurrentSettings $CurrentValues ` - -DesiredSettings $PSBoundParameters -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppWorkflowSettings/MSFT_SPWebAppWorkflowSettings.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppWorkflowSettings/MSFT_SPWebAppWorkflowSettings.schema.mof deleted file mode 100644 index 60c944fa..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebAppWorkflowSettings/MSFT_SPWebAppWorkflowSettings.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPWebAppWorkflowSettings")] -class MSFT_SPWebAppWorkflowSettings : OMI_BaseResource -{ - [Key, Description("The URL of the web application")] string Url; - [Write, Description("Are external workflow participants enabled in the web app")] boolean ExternalWorkflowParticipantsEnabled; - [Write, Description("Are user defined workflows enabled in this web app")] boolean UserDefinedWorkflowsEnabled; - [Write, Description("Are documents sent via email to external participants of workflow")] boolean EmailToNoPermissionWorkflowParticipantsEnable; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] string InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebApplication/MSFT_SPWebApplication.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebApplication/MSFT_SPWebApplication.psm1 deleted file mode 100644 index 372edcc2..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebApplication/MSFT_SPWebApplication.psm1 +++ /dev/null @@ -1,426 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPoolAccount, - - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowAnonymous, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.String] - $HostHeader, - - [parameter(Mandatory = $false)] - [System.String] - $Path, - - [parameter(Mandatory = $false)] - [System.String] - $Port, - - [parameter(Mandatory = $false)] - [System.Boolean] - $UseSSL, - - [parameter(Mandatory = $false)] - [ValidateSet("NTLM","Kerberos","Claims","Classic")] - [System.String] - $AuthenticationMethod, - - [parameter(Mandatory = $false)] - [System.String] - $AuthenticationProvider, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting web application '$Name' config" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $wa = Get-SPWebApplication -Identity $params.Name -ErrorAction SilentlyContinue - if ($null -eq $wa) - { - return @{ - Name = $params.Name - ApplicationPool = $params.ApplicationPool - ApplicationPoolAccount = $params.ApplicationPoolAccount - Url = $params.Url - Ensure = "Absent" - } - } - - ### COMMENT: Are we making an assumption here, about Default Zone - $authProvider = Get-SPAuthenticationProvider -WebApplication $wa.Url -Zone "Default" - if ($null -eq $authProvider) - { - $authenticationProvider = "" - $localAuthMode = "Classic" - } - else - { - if ($authProvider.DisplayName -eq "Windows Authentication") - { - if ($authProvider.DisableKerberos -eq $true) - { - $localAuthMode = "NTLM" - } - else - { - $localAuthMode = "Kerberos" - } - $authenticationProvider = "Windows Authentication" - } - else - { - $localAuthMode = "Claims" - $authenticationProvider = $authProvider.DisplayName - } - } - - return @{ - Name = $wa.DisplayName - ApplicationPool = $wa.ApplicationPool.Name - ApplicationPoolAccount = $wa.ApplicationPool.Username - Url = $wa.Url - AllowAnonymous = $authProvider.AllowAnonymous - DatabaseName = $wa.ContentDatabases[0].Name - DatabaseServer = $wa.ContentDatabases[0].Server - HostHeader = (New-Object -TypeName System.Uri $wa.Url).Host - Path = $wa.IisSettings[0].Path - Port = (New-Object -TypeName System.Uri $wa.Url).Port - AuthenticationMethod = $localAuthMode - AuthenticationProvider = $authenticationProvider - UseSSL = (New-Object -TypeName System.Uri $wa.Url).Scheme -eq "https" - InstallAccount = $params.InstallAccount - Ensure = "Present" - } - } - return $result -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPoolAccount, - - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowAnonymous, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.String] - $HostHeader, - - [parameter(Mandatory = $false)] - [System.String] - $Path, - - [parameter(Mandatory = $false)] - [System.String] - $Port, - - [parameter(Mandatory = $false)] - [System.Boolean] - $UseSSL, - - [parameter(Mandatory = $false)] - [ValidateSet("NTLM","Kerberos","Claims","Classic")] - [System.String] - $AuthenticationMethod, - - [parameter(Mandatory = $false)] - [System.String] - $AuthenticationProvider, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting web application '$Name' config" - - if ($Ensure -eq "Present") - { - if ($PSBoundParameters.ContainsKey("AuthenticationMethod") -eq $false) - { - throw [Exception] ("When Ensure is Present, the AuthenticationMethod " + ` - "parameter is required.") - } - - if ($AuthenticationMethod -eq "Claims" -and [string]::IsNullOrEmpty($AuthenticationProvider)) - { - throw [Exception] ("When configuring SPWebApplication to use Claims the " + ` - "AuthenticationProvider value must be specified.") - } - - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $wa = Get-SPWebApplication -Identity $params.Name -ErrorAction SilentlyContinue - if ($null -eq $wa) - { - $newWebAppParams = @{ - Name = $params.Name - ApplicationPool = $params.ApplicationPool - Url = $params.Url - } - - # Get a reference to the Administration WebService - $admService = Get-SPDSCContentService - $appPools = $admService.ApplicationPools | Where-Object -FilterScript { - $_.Name -eq $params.ApplicationPool - } - if ($null -eq $appPools) - { - # Application pool does not exist, create a new one. - # Test if the specified managed account exists. If so, add - # ApplicationPoolAccount parameter to create the application pool - try - { - Get-SPManagedAccount $params.ApplicationPoolAccount -ErrorAction Stop | Out-Null - $newWebAppParams.Add("ApplicationPoolAccount", $params.ApplicationPoolAccount) - } - catch - { - if ($_.Exception.Message -like "*No matching accounts were found*") - { - throw ("The specified managed account was not found. Please make " + ` - "sure the managed account exists before continuing.") - return - } - else - { - throw ("Error occurred. Web application was not created. Error " + ` - "details: $($_.Exception.Message)") - return - } - } - } - - if ($params.ContainsKey("AuthenticationMethod") -eq $true) - { - if ($params.AuthenticationMethod -ne "Classic") - { - if ($params.AuthenticationMethod -eq "Claims") - { - $ap = Get-SPTrustedIdentityTokenIssuer -Identity $params.AuthenticationProvider - } - else - { - $disableKerberos = ($params.AuthenticationMethod -eq "NTLM") - $ap = New-SPAuthenticationProvider -UseWindowsIntegratedAuthentication ` - -DisableKerberos:$disableKerberos - } - - $newWebAppParams.Add("AuthenticationProvider", $ap) - } - } - - if ($params.ContainsKey("AllowAnonymous") -eq $true) - { - $newWebAppParams.Add("AllowAnonymousAccess", $params.AllowAnonymous) - } - if ($params.ContainsKey("DatabaseName") -eq $true) - { - $newWebAppParams.Add("DatabaseName", $params.DatabaseName) - } - if ($params.ContainsKey("DatabaseServer") -eq $true) - { - $newWebAppParams.Add("DatabaseServer", $params.DatabaseServer) - } - if ($params.ContainsKey("HostHeader") -eq $true) - { - $newWebAppParams.Add("HostHeader", $params.HostHeader) - } - if ($params.ContainsKey("Path") -eq $true) - { - $newWebAppParams.Add("Path", $params.Path) - } - if ($params.ContainsKey("Port") -eq $true) - { - $newWebAppParams.Add("Port", $params.Port) - } - if ($params.ContainsKey("UseSSL") -eq $true) - { - $newWebAppParams.Add("SecureSocketsLayer", $params.UseSSL) - } - - New-SPWebApplication @newWebAppParams | Out-Null - } - } - } - - if ($Ensure -eq "Absent") - { - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $wa = Get-SPWebApplication -Identity $params.Name -ErrorAction SilentlyContinue - if ($null -ne $wa) - { - $wa | Remove-SPWebApplication -Confirm:$false -DeleteIISSite - } - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPoolAccount, - - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowAnonymous, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.String] - $HostHeader, - - [parameter(Mandatory = $false)] - [System.String] - $Path, - - [parameter(Mandatory = $false)] - [System.String] - $Port, - - [parameter(Mandatory = $false)] - [System.Boolean] - $UseSSL, - - [parameter(Mandatory = $false)] - [ValidateSet("NTLM","Kerberos","Claims","Classic")] - [System.String] - $AuthenticationMethod, - - [parameter(Mandatory = $false)] - [System.String] - $AuthenticationProvider, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing for web application '$Name' config" - - $PSBoundParameters.Ensure = $Ensure - - if ($Ensure -eq "Present" -and - $PSBoundParameters.ContainsKey("AuthenticationMethod") -eq $false) - { - throw [Exception] ("When Ensure is Present, the AuthenticationMethod " + ` - "parameter is required.") - } - - $CurrentValues = Get-TargetResource @PSBoundParameters - - $testReturn = Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") - return $testReturn -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebApplication/MSFT_SPWebApplication.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebApplication/MSFT_SPWebApplication.schema.mof deleted file mode 100644 index 0741d7c2..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebApplication/MSFT_SPWebApplication.schema.mof +++ /dev/null @@ -1,20 +0,0 @@ -[ClassVersion("1.1.0.0"), FriendlyName("SPWebApplication")] -class MSFT_SPWebApplication : OMI_BaseResource -{ - [Key, Description("The name of the web application")] string Name; - [Required, Description("The name of the application pool to run this site in")] string ApplicationPool; - [Required, Description("The name of the managed account to run the app pool with")] string ApplicationPoolAccount; - [Required, Description("The URL of the web application")] string Url; - [Write, Description("Should anonymous access be enabled for this web app")] boolean AllowAnonymous; - [Write, Description("What authentication mode should be used for the web app"), ValueMap{"NTLM","Kerberos","Claims","Classic"}, Values{"NTLM","Kerberos","Claims","Classic"}] string AuthenticationMethod; - [Write, Description("What authentication provider should be used for the web app. This value is required when AuthenticationMethod is set to Claims")] string AuthenticationProvider; - [Write, Description("The name of the first content database to be created with this web app")] string DatabaseName; - [Write, Description("The name of the database server to host the default content DB")] string DatabaseServer; - [Write, Description("The host header to use for the web app")] string HostHeader; - [Write, Description("The path on the local servers to host the IIS web site from")] string Path; - [Write, Description("The port to run the site on")] string Port; - [Write, Description("Should this web app use SSL")] boolean UseSSL; - [Write, Description("Present if the web app should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] string InstallAccount; -}; - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebApplicationAppDomain/MSFT_SPWebApplicationAppDomain.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebApplicationAppDomain/MSFT_SPWebApplicationAppDomain.psm1 deleted file mode 100644 index 8ac2d471..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebApplicationAppDomain/MSFT_SPWebApplicationAppDomain.psm1 +++ /dev/null @@ -1,173 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $AppDomain, - - [parameter(Mandatory = $true)] - [System.String] - $WebApplication, - - [parameter(Mandatory = $true)] - [System.String] - [ValidateSet("Default","Internet","Intranet","Extranet","Custom")] - $Zone, - - [parameter(Mandatory = $false)] - [System.String] - $Port, - - [parameter(Mandatory = $false)] - [System.Boolean] - $SSL, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting app domain settings for '$AppDomain'" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - $webAppAppDomain = Get-SPWebApplicationAppDomain -WebApplication $params.WebApplication ` - -Zone $params.Zone - - if ($null -eq $webAppAppDomain) - { - return $null - } - else - { - return @{ - AppDomain = $webAppAppDomain.AppDomain - WebApplication = $params.WebApplication - Zone = $webAppAppDomain.UrlZone - Port = $webAppAppDomain.Port - SSL = $webAppAppDomain.IsSchemeSSL - InstallAccount = $params.InstallAccount - } - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $AppDomain, - - [parameter(Mandatory = $true)] - [System.String] - $WebApplication, - - [parameter(Mandatory = $true)] - [System.String] - [ValidateSet("Default","Internet","Intranet","Extranet","Custom")] - $Zone, - - [parameter(Mandatory = $false)] - [System.String] - $Port, - - [parameter(Mandatory = $false)] - [System.Boolean] - $SSL, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting app domain settings for '$AppDomain'" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $CurrentValues) ` - -ScriptBlock { - $params = $args[0] - $CurrentValues = $args[1] - - if ($null -ne $CurrentValues) - { - Get-SPWebApplicationAppDomain -WebApplication $params.WebApplication ` - -Zone $params.Zone | Remove-SPWebApplicationAppDomain - Start-Sleep -Seconds 5 - } - - $newParams = @{ - AppDomain = $params.AppDomain - WebApplication = $params.WebApplication - Zone = $params.Zone - } - if ($params.ContainsKey("Port") -eq $true) - { - $newParams.Add("Port", $params.Port) - } - if ($params.ContainsKey("SSL") -eq $true) - { - $newParams.Add("SecureSocketsLayer", $params.SSL) - } - - New-SPWebApplicationAppDomain @newParams - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $AppDomain, - - [parameter(Mandatory = $true)] - [System.String] - $WebApplication, - - [parameter(Mandatory = $true)] - [System.String] - [ValidateSet("Default","Internet","Intranet","Extranet","Custom")] - $Zone, - - [parameter(Mandatory = $false)] - [System.String] - $Port, - - [parameter(Mandatory = $false)] - [System.Boolean] - $SSL, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing app domain settings for '$AppDomain'" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($null -eq $CurrentValues) - { - return $false - } - - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("AppDomain", "Port", "SSL") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebApplicationAppDomain/MSFT_SPWebApplicationAppDomain.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebApplicationAppDomain/MSFT_SPWebApplicationAppDomain.schema.mof deleted file mode 100644 index 37e11133..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebApplicationAppDomain/MSFT_SPWebApplicationAppDomain.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPWebApplicationAppDomain")] -class MSFT_SPWebApplicationAppDomain : OMI_BaseResource -{ - [Key, Description("The URL of the web application to set the app domain for")] string WebApplication; - [Key, Description("The zone that this app domain applies to"), ValueMap{"Default","Internet","Intranet","Extranet","Custom"}, Values{"Default","Internet","Intranet","Extranet","Custom"}] string Zone; - [Required, Description("The domain for apps in this web app zone")] string AppDomain; - [Write, Description("The port to run apps on")] string Port; - [Write, Description("Should apps run under SSL")] boolean SSL; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebApplicationExtension/MSFT_SPWebApplicationExtension.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebApplicationExtension/MSFT_SPWebApplicationExtension.psm1 deleted file mode 100644 index 9666fd60..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebApplicationExtension/MSFT_SPWebApplicationExtension.psm1 +++ /dev/null @@ -1,423 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $true)] - [ValidateSet("Default","Intranet","Internet","Extranet","Custom")] - [System.String] - $Zone, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowAnonymous, - - [parameter(Mandatory = $false)] - [System.String] - $HostHeader, - - [parameter(Mandatory = $false)] - [System.String] - $Path, - - [parameter(Mandatory = $false)] - [System.String] - $Port, - - [parameter(Mandatory = $false)] - [System.Boolean] - $UseSSL, - - [parameter(Mandatory = $false)] - [ValidateSet("NTLM","Kerberos","Claims")] - [System.String] - $AuthenticationMethod, - - [parameter(Mandatory = $false)] - [System.String] - $AuthenticationProvider, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting web application extension '$Name' config" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters,$PSScriptRoot) ` - -ScriptBlock { - $params = $args[0] - $ScriptRoot = $args[1] - - $wa = Get-SPWebApplication -Identity $params.WebAppUrl -ErrorAction SilentlyContinue - - if ($null -eq $wa) - { - Write-Verbose -Message "WebApplication $($params.WebAppUrl) does not exist" - return @{ - WebAppUrl = $params.WebAppUrl - Name = $params.Name - Url = $null - Zone = $null - Ensure = "Absent" - } - } - - $zone = [Microsoft.SharePoint.Administration.SPUrlZone]::$($params.Zone) - $waExt = $wa.IisSettings[$zone] - - if ($null -eq $waExt) - { - return @{ - WebAppUrl = $params.WebAppUrl - Name = $params.Name - Url = $params.Url - Zone = $params.zone - Ensure = "Absent" - } - } - - $publicUrl = (Get-SPAlternateURL -WebApplication $params.WebAppUrl -Zone $params.zone).PublicUrl - - if ($null -ne $waExt.SecureBindings.HostHeader) #default to SSL bindings if present - { - $HostHeader = $waExt.SecureBindings.HostHeader - $Port = $waExt.SecureBindings.Port - $UseSSL = $true - } - else - { - $HostHeader = $waExt.ServerBindings.HostHeader - $Port = $waExt.ServerBindings.Port - $UseSSL = $false - } - - $authProvider = Get-SPAuthenticationProvider -WebApplication $wa.Url -Zone $params.zone - if($authProvider.DisplayName -eq "Windows Authentication") - { - if ($authProvider.DisableKerberos -eq $true) - { - $localAuthMode = "NTLM" - } - else - { - $localAuthMode = "Kerberos" - } - } - else - { - $localAuthMode = "Claims" - $authenticationProvider = $authProvider.DisplayName - } - - return @{ - WebAppUrl = $params.WebAppUrl - Name = $waExt.ServerComment - Url = $PublicURL - AllowAnonymous = $authProvider.AllowAnonymous - HostHeader = $HostHeader - Path = $waExt.Path - Port = $Port - Zone = $params.zone - AuthenticationMethod = $localAuthMode - AuthenticationProvider = $authenticationProvider - UseSSL = $UseSSL - InstallAccount = $params.InstallAccount - Ensure = "Present" - } - } - return $result -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $true)] - [ValidateSet("Default","Intranet","Internet","Extranet","Custom")] - [System.String] - $Zone, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowAnonymous, - - [parameter(Mandatory = $false)] - [System.String] - $HostHeader, - - [parameter(Mandatory = $false)] - [System.String] - $Path, - - [parameter(Mandatory = $false)] - [System.String] - $Port, - - [parameter(Mandatory = $false)] - [System.Boolean] - $UseSSL, - - [parameter(Mandatory = $false)] - [ValidateSet("NTLM","Kerberos","Claims")] - [System.String] - $AuthenticationMethod, - - [parameter(Mandatory = $false)] - [System.String] - $AuthenticationProvider, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting web application extension '$Name' config" - - if ($Ensure -eq "Present") - { - if ($AuthenticationMethod -eq "Claims" -and [string]::IsNullOrEmpty($AuthenticationProvider)) - { - throw [Exception] "When configuring SPWebApplication to use Claims the AuthenticationProvider value must be specified." - } - - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters,$PSScriptRoot) ` - -ScriptBlock { - $params = $args[0] - $ScriptRoot = $args[1] - - - $wa = Get-SPWebApplication -Identity $params.WebAppUrl -ErrorAction SilentlyContinue - if ($null -eq $wa) - { - throw "Web Application with URL $($params.WebAppUrl) does not exist" - } - - - $zone = [Microsoft.SharePoint.Administration.SPUrlZone]::$($params.Zone) - $waExt = $wa.IisSettings[$zone] - - if ($null -eq $waExt) - { - $newWebAppExtParams = @{ - Name = $params.Name - Url = $params.Url - Zone = $params.zone - } - - - if ($params.ContainsKey("AuthenticationMethod") -eq $true) - { - if($params.AuthenticationMethod -eq "Claims") - { - try - { - $ap = Get-SPTrustedIdentityTokenIssuer -Identity $params.AuthenticationProvider -ErrorAction Stop - } - catch - { - throw [Exception] "Cannot find Authentication Provider $($params.AuthenticationProvider)" - } - } - else - { - $disableKerberos = ($params.AuthenticationMethod -eq "NTLM") - $ap = New-SPAuthenticationProvider -UseWindowsIntegratedAuthentication ` - -DisableKerberos:$disableKerberos - } - - $newWebAppExtParams.Add("AuthenticationProvider", $ap) - } - - if ($params.ContainsKey("AllowAnonymous") -eq $true) - { - $newWebAppExtParams.Add("AllowAnonymousAccess", $params.AllowAnonymous) - } - if ($params.ContainsKey("HostHeader") -eq $true) - { - $newWebAppExtParams.Add("HostHeader", $params.HostHeader) - } - if ($params.ContainsKey("Path") -eq $true) - { - $newWebAppExtParams.Add("Path", $params.Path) - } - if ($params.ContainsKey("Port") -eq $true) - { - $newWebAppExtParams.Add("Port", $params.Port) - } - if ($params.ContainsKey("UseSSL") -eq $true) - { - $newWebAppExtParams.Add("SecureSocketsLayer", $params.UseSSL) - } - - $wa | New-SPWebApplicationExtension @newWebAppExtParams | Out-Null - } - else - { - if ($params.ContainsKey("AllowAnonymous") -eq $true) - { - $waExt.AllowAnonymous = $params.AllowAnonymous - $wa.update() - } - - if ($params.ContainsKey("AuthenticationMethod") -eq $true) - { - if($params.AuthenticationMethod -eq "Claims") - { - try - { - $ap = Get-SPTrustedIdentityTokenIssuer -Identity $params.AuthenticationProvider -ErrorAction Stop - } - catch - { - throw [Exception] "Cannot find Authentication Provider $($params.AuthenticationProvider)" - } - } - else - { - $disableKerberos = ($params.AuthenticationMethod -eq "NTLM") - $ap = New-SPAuthenticationProvider -UseWindowsIntegratedAuthentication ` - -DisableKerberos:$disableKerberos - } - - Set-SPWebApplication -Identity $params.WebAppUrl -Zone $params.zone -AuthenticationProvider $ap - } - } - } - } - - if ($Ensure -eq "Absent") - { - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters,$PSScriptRoot) ` - -ScriptBlock { - $params = $args[0] - $ScriptRoot = $args[1] - - $wa = Get-SPWebApplication -Identity $params.WebAppUrl -ErrorAction SilentlyContinue - if ($null -eq $wa) - { - throw "Web Application with URL $($params.WebAppUrl) does not exist" - } - if ($null -ne $wa) - { - $wa | Remove-SPWebApplication -Zone $params.zone -Confirm:$false -DeleteIISSite - } - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $true)] - [ValidateSet("Default","Intranet","Internet","Extranet","Custom")] - [System.String] - $Zone, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowAnonymous, - - [parameter(Mandatory = $false)] - [System.String] - $HostHeader, - - [parameter(Mandatory = $false)] - [System.String] - $Path, - - [parameter(Mandatory = $false)] - [System.String] - $Port, - - [parameter(Mandatory = $false)] - [System.Boolean] - $UseSSL, - - [parameter(Mandatory = $false)] - [ValidateSet("NTLM","Kerberos","Claims")] - [System.String] - $AuthenticationMethod, - - [parameter(Mandatory = $false)] - [System.String] - $AuthenticationProvider, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing for web application extension '$Name'config" - - $PSBoundParameters.Ensure = $Ensure - - $CurrentValues = Get-TargetResource @PSBoundParameters - - $testReturn = Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure","AuthenticationMethod","AllowAnonymous") - return $testReturn -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebApplicationExtension/MSFT_SPWebApplicationExtension.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebApplicationExtension/MSFT_SPWebApplicationExtension.schema.mof deleted file mode 100644 index aff259f8..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWebApplicationExtension/MSFT_SPWebApplicationExtension.schema.mof +++ /dev/null @@ -1,18 +0,0 @@ -[ClassVersion("1.1.0.0"), FriendlyName("SPWebApplicationExtension")] -class MSFT_SPWebApplicationExtension : OMI_BaseResource -{ - [Key, Description("The URL of the parent web application")] string WebAppUrl; - [Required, Description("The name of the web application extension")] string Name; - [Required, Description("The URL of the web application extension")] string Url; - [Key, Description("Specifies one of the five zones with which the internal URL of this new extension is to be associated."),ValueMap{"Default","Intranet","Internet","Extranet","Custom"}, Values{"Default","Intranet","Internet","Extranet","Custom"}] string Zone; - [Write, Description("Should anonymous access be enabled for this web app extension")] boolean AllowAnonymous; - [Write, Description("What authentication mode should be used for the web app extension"), ValueMap{"NTLM","Kerberos","Claims"}, Values{"NTLM","Kerberos","Claims"}] string AuthenticationMethod; - [Write, Description("What authentication provider should be used for the web app. This value is required when AuthenticationMethod is set to Claims")] string AuthenticationProvider; - [Write, Description("The host header to use for the web app extension")] string HostHeader; - [Write, Description("The path on the local servers to host the IIS web site from")] string Path; - [Write, Description("The port to run the site on")] string Port; - [Write, Description("Should this web app extension use SSL")] boolean UseSSL; - [Write, Description("Present if the web app should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] string InstallAccount; -}; - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/MSFT_SPWordAutomationServiceApp.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/MSFT_SPWordAutomationServiceApp.psm1 deleted file mode 100644 index 6c7fb3d9..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/MSFT_SPWordAutomationServiceApp.psm1 +++ /dev/null @@ -1,676 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [ValidateSet("docx","doc","mht","rtf","xml")] - [System.String[]] - $SupportedFileFormats, - - [parameter(Mandatory = $false)] - [System.Boolean] - $DisableEmbeddedFonts, - - [parameter(Mandatory = $false)] - [ValidateRange(10,100)] - [System.UInt32] - $MaximumMemoryUsage, - - [parameter(Mandatory = $false)] - [ValidateRange(1,1000)] - [System.UInt32] - $RecycleThreshold, - - [parameter(Mandatory = $false)] - [System.Boolean] - $DisableBinaryFileScan, - - [parameter(Mandatory = $false)] - [ValidateRange(1,1000)] - [System.UInt32] - $ConversionProcesses, - - [parameter(Mandatory = $false)] - [ValidateRange(1,59)] - [System.UInt32] - $JobConversionFrequency, - - [parameter(Mandatory = $false)] - [System.UInt32] - $NumberOfConversionsPerProcess, - - [parameter(Mandatory = $false)] - [ValidateRange(1,60)] - [System.UInt32] - $TimeBeforeConversionIsMonitored, - - [parameter(Mandatory = $false)] - [ValidateRange(1,10)] - [System.UInt32] - $MaximumConversionAttempts, - - [parameter(Mandatory = $false)] - [ValidateRange(1,60)] - [System.UInt32] - $MaximumSyncConversionRequests, - - [parameter(Mandatory = $false)] - [ValidateRange(10,60)] - [System.UInt32] - $KeepAliveTimeout, - - [parameter(Mandatory = $false)] - [ValidateRange(60,3600)] - [System.UInt32] - $MaximumConversionTime, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting Word Automation service app '$Name'" - - $PSBoundParameters.Ensure = $Ensure - - if (($ApplicationPool ` - -or $DatabaseName ` - -or $DatabaseServer ` - -or $SupportedFileFormats ` - -or $DisableEmbeddedFonts ` - -or $MaximumMemoryUsage ` - -or $RecycleThreshold ` - -or $DisableBinaryFileScan ` - -or $ConversionProcesses ` - -or $JobConversionFrequency ` - -or $NumberOfConversionsPerProcess ` - -or $TimeBeforeConversionIsMonitored ` - -or $MaximumConversionAttempts ` - -or $MaximumSyncConversionRequests ` - -or $KeepAliveTimeout ` - -or $MaximumConversionTime) ` - -and ($Ensure -eq "Absent")) - { - throw "You cannot use any of the parameters when Ensure is specified as Absent" - } - - if (($Ensure -eq "Present") -and -not ($ApplicationPool -and $DatabaseName)) - { - throw ("An Application Pool and Database Name are required to configure the Word " + ` - "Automation Service Application") - } - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $serviceApps = Get-SPServiceApplication -Name $params.Name ` - -ErrorAction SilentlyContinue - $nullReturn = @{ - Name = $params.Name - Ensure = "Absent" - ApplicationPool = $params.ApplicationPool - } - - if ($null -eq $serviceApps) - { - return $nullReturn - } - - $serviceApp = $serviceApps | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Word.Server.Service.WordServiceApplication" - } - - if ($null -eq $serviceApp) - { - return $nullReturn - } - - $supportedFileFormats = @() - if ($serviceApp.WordServiceFormats.OpenXmlDocument) - { - $supportedFileFormats += "docx" - } - if ($serviceApp.WordServiceFormats.Word972003Document) - { - $supportedFileFormats += "doc" - } - if ($serviceApp.WordServiceFormats.RichTextFormat) - { - $supportedFileFormats += "rtf" - } - if ($serviceApp.WordServiceFormats.WebPage) - { - $supportedFileFormats += "mht" - } - if ($serviceApp.WordServiceFormats.Word2003Xml) - { - $supportedFileFormats += "xml" - } - - $returnVal = @{ - Name = $serviceApp.DisplayName - Ensure = "Present" - ApplicationPool = $serviceApp.ApplicationPool.Name - DatabaseName = $serviceApp.Database.Name - DatabaseServer = $serviceApp.Database.Server.Name - SupportedFileFormats = $supportedFileFormats - DisableEmbeddedFonts = $serviceApp.DisableEmbeddedFonts - MaximumMemoryUsage = $serviceApp.MaximumMemoryUsage - RecycleThreshold = $serviceApp.RecycleProcessThreshold - DisableBinaryFileScan = $serviceApp.DisableBinaryFileScan - ConversionProcesses = $serviceApp.TotalActiveProcesses - JobConversionFrequency = $serviceApp.TimerJobFrequency.TotalMinutes - NumberOfConversionsPerProcess = $serviceApp.ConversionsPerInstance - TimeBeforeConversionIsMonitored = $serviceApp.ConversionTimeout.TotalMinutes - MaximumConversionAttempts = $serviceApp.MaximumConversionAttempts - MaximumSyncConversionRequests = $serviceApp.MaximumSyncConversionRequests - KeepAliveTimeout = $serviceApp.KeepAliveTimeout.TotalSeconds - MaximumConversionTime = $serviceApp.MaximumConversionTime.TotalSeconds - InstallAccount = $params.InstallAccount - } - return $returnVal - } - - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [ValidateSet("docx","doc","mht","rtf","xml")] - [System.String[]] - $SupportedFileFormats, - - [parameter(Mandatory = $false)] - [System.Boolean] - $DisableEmbeddedFonts, - - [parameter(Mandatory = $false)] - [ValidateRange(10,100)] - [System.UInt32] - $MaximumMemoryUsage, - - [parameter(Mandatory = $false)] - [ValidateRange(1,1000)] - [System.UInt32] - $RecycleThreshold, - - [parameter(Mandatory = $false)] - [System.Boolean] - $DisableBinaryFileScan, - - [parameter(Mandatory = $false)] - [ValidateRange(1,1000)] - [System.UInt32] - $ConversionProcesses, - - [parameter(Mandatory = $false)] - [ValidateRange(1,59)] - [System.UInt32] - $JobConversionFrequency, - - [parameter(Mandatory = $false)] - [System.UInt32] - $NumberOfConversionsPerProcess, - - [parameter(Mandatory = $false)] - [ValidateRange(1,60)] - [System.UInt32] - $TimeBeforeConversionIsMonitored, - - [parameter(Mandatory = $false)] - [ValidateRange(1,10)] - [System.UInt32] - $MaximumConversionAttempts, - - [parameter(Mandatory = $false)] - [ValidateRange(1,60)] - [System.UInt32] - $MaximumSyncConversionRequests, - - [parameter(Mandatory = $false)] - [ValidateRange(10,60)] - [System.UInt32] - $KeepAliveTimeout, - - [parameter(Mandatory = $false)] - [ValidateRange(60,3600)] - [System.UInt32] - $MaximumConversionTime, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting Word Automation service app '$Name'" - - if (($ApplicationPool ` - -or $DatabaseName ` - -or $DatabaseServer ` - -or $SupportedFileFormats ` - -or $DisableEmbeddedFonts ` - -or $MaximumMemoryUsage ` - -or $RecycleThreshold ` - -or $DisableBinaryFileScan ` - -or $ConversionProcesses ` - -or $JobConversionFrequency ` - -or $NumberOfConversionsPerProcess ` - -or $TimeBeforeConversionIsMonitored ` - -or $MaximumConversionAttempts ` - -or $MaximumSyncConversionRequests ` - -or $KeepAliveTimeout ` - -or $MaximumConversionTime) ` - -and ($Ensure -eq "Absent")) - { - throw "You cannot use any of the parameters when Ensure is specified as Absent" - } - - $PSBoundParameters.Ensure = $Ensure - - if (($Ensure -eq "Present") -and -not ($ApplicationPool -and $DatabaseName)) - { - throw ("An Application Pool and Database Name are required to configure the Word " + ` - "Automation Service Application") - } - - $result = Get-TargetResource @PSBoundParameters - if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") - { - Write-Verbose -Message "Creating Word Automation Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool - if ($appPool) - { - $cmdletparams = @{} - $cmdletparams.Name = $params.Name - if ($params.Name) - { - $cmdletparams.DatabaseName = $params.DatabaseName - } - if ($params.Name) - { - $cmdletparams.DatabaseServer = $params.DatabaseServer - } - if ($params.Name) - { - $cmdletparams.ApplicationPool = $params.ApplicationPool - } - - $serviceApp = New-SPWordConversionServiceApplication @cmdletparams - } - else - { - throw "Specified application pool does not exist" - } - } - } - - if ($result.Ensure -eq "Present" -and $Ensure -eq "Present") - { - Write-Verbose -Message "Updating Word Automation Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $serviceApp = Get-SPServiceApplication -Name $params.Name ` - | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Word.Server.Service.WordServiceApplication" - } - - # Check if the specified Application Pool is different and change if so - if ([string]::IsNullOrEmpty($ApplicationPool) -eq $false ` - -and $ApplicationPool -ne $result.ApplicationPool) - { - $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool - Set-SPWordConversionServiceApplication -Identity $serviceApp -ApplicationPool $appPool - } - # Check if the specified Database Name and Server are different and change if so - if ($params.DatabaseName) - { - if ($params.DatabaseServer) - { - if ($serviceApp.Database.Server.Name -ne $params.DatabaseServer) - { - Set-SPWordConversionServiceApplication -Identity $serviceApp ` - -DatabaseServer $params.DatabaseServer ` - -DatabaseName $params.DatabaseName - } - } - else - { - if ($serviceApp.Database.Name -ne $params.DatabaseName) - { - Set-SPWordConversionServiceApplication -Identity $serviceApp ` - -DatabaseName $params.DatabaseName - } - } - } - - if ($params.SupportedFileFormats) - { - if ($params.SupportedFileFormats.Contains("docx")) - { - $serviceApp.WordServiceFormats.OpenXmlDocument = $true - } - else - { - $serviceApp.WordServiceFormats.OpenXmlDocument = $false - } - if ($params.SupportedFileFormats.Contains("doc")) - { - $serviceApp.WordServiceFormats.Word972003Document = $true - } - else - { - $serviceApp.WordServiceFormats.Word972003Document = $false - } - if ($params.SupportedFileFormats.Contains("rtf")) - { - $serviceApp.WordServiceFormats.RichTextFormat = $true - } - else - { - $serviceApp.WordServiceFormats.RichTextFormat = $false - } - if ($params.SupportedFileFormats.Contains("mht")) - { - $serviceApp.WordServiceFormats.WebPage = $true - } - else - { - $serviceApp.WordServiceFormats.WebPage = $false - } - if ($params.SupportedFileFormats.Contains("xml")) - { - $serviceApp.WordServiceFormats.Word2003Xml = $true - } - else - { - $serviceApp.WordServiceFormats.Word2003Xml = $false - } - } - - if ($params.DisableEmbeddedFonts) - { - $serviceApp.DisableEmbeddedFonts = $params.DisableEmbeddedFonts - } - if ($params.MaximumMemoryUsage) - { - $serviceApp.MaximumMemoryUsage = $params.MaximumMemoryUsage - } - if ($params.RecycleThreshold) - { - $serviceApp.RecycleProcessThreshold = $params.RecycleThreshold - } - if ($params.DisableBinaryFileScan) - { - $serviceApp.DisableBinaryFileScan = $params.DisableBinaryFileScan - } - if ($params.ConversionProcesses) - { - $serviceApp.TotalActiveProcesses = $params.ConversionProcesses - } - if ($params.JobConversionFrequency) - { - # Check for TimerJob and change schedule - $wordAutomationTimerjob = Get-SPTimerJob $params.Name - if ($wordAutomationTimerjob.Count -eq 1) - { - $schedule = "every $($params.JobConversionFrequency) minutes between 0 and 0" - Set-SPTimerJob $wordAutomationTimerjob -Schedule $schedule - } - else - { - throw "Timerjob could not be found" - } - } - if ($params.NumberOfConversionsPerProcess) - { - $serviceApp.ConversionsPerInstance = $params.NumberOfConversionsPerProcess - } - if ($params.TimeBeforeConversionIsMonitored) - { - $timespan = New-TimeSpan -Minutes $params.TimeBeforeConversionIsMonitored - $serviceApp.ConversionTimeout = $timespan - } - if ($params.MaximumConversionAttempts) - { - $serviceApp.MaximumConversionAttempts = $params.MaximumConversionAttempts - } - if ($params.MaximumSyncConversionRequests) - { - $serviceApp.MaximumSyncConversionRequests = $params.MaximumSyncConversionRequests - } - if ($params.KeepAliveTimeout) - { - $timespan = New-TimeSpan -Seconds $params.KeepAliveTimeout - $serviceApp.KeepAliveTimeout = $timespan - } - if ($params.MaximumConversionTime) - { - $timespan = New-TimeSpan -Seconds $params.MaximumConversionTime - $serviceApp.MaximumConversionTime = $timespan - } - - $serviceApp.Update() - } - } - - if ($Ensure -eq "Absent") - { - Write-Verbose -Message "Removing Word Automation Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - $params = $args[0] - - $serviceApp = Get-SPServiceApplication -Name $params.Name | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Word.Server.Service.WordServiceApplication" - } - if ($null -ne $serviceApp) - { - $proxies = Get-SPServiceApplicationProxy - foreach($proxyInstance in $proxies) - { - if($serviceApp.IsConnected($proxyInstance)) - { - $proxyInstance.Delete() - } - } - - # Service app existed, deleting - Remove-SPServiceApplication -Identity $serviceApp -RemoveData -Confirm:$false - } - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [ValidateSet("docx","doc","mht","rtf","xml")] - [System.String[]] - $SupportedFileFormats, - - [parameter(Mandatory = $false)] - [System.Boolean] - $DisableEmbeddedFonts, - - [parameter(Mandatory = $false)] - [ValidateRange(10,100)] - [System.UInt32] - $MaximumMemoryUsage, - - [parameter(Mandatory = $false)] - [ValidateRange(1,1000)] - [System.UInt32] - $RecycleThreshold, - - [parameter(Mandatory = $false)] - [System.Boolean] - $DisableBinaryFileScan, - - [parameter(Mandatory = $false)] - [ValidateRange(1,1000)] - [System.UInt32] - $ConversionProcesses, - - [parameter(Mandatory = $false)] - [ValidateRange(1,59)] - [System.UInt32] - $JobConversionFrequency, - - [parameter(Mandatory = $false)] - [System.UInt32] - $NumberOfConversionsPerProcess, - - [parameter(Mandatory = $false)] - [ValidateRange(1,60)] - [System.UInt32] - $TimeBeforeConversionIsMonitored, - - [parameter(Mandatory = $false)] - [ValidateRange(1,10)] - [System.UInt32] - $MaximumConversionAttempts, - - [parameter(Mandatory = $false)] - [ValidateRange(1,60)] - [System.UInt32] - $MaximumSyncConversionRequests, - - [parameter(Mandatory = $false)] - [ValidateRange(10,60)] - [System.UInt32] - $KeepAliveTimeout, - - [parameter(Mandatory = $false)] - [ValidateRange(60,3600)] - [System.UInt32] - $MaximumConversionTime, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing Word Automation service app '$Name'" - - $PSBoundParameters.Ensure = $Ensure - - if (($ApplicationPool ` - -or $DatabaseName ` - -or $DatabaseServer ` - -or $SupportedFileFormats ` - -or $DisableEmbeddedFonts ` - -or $MaximumMemoryUsage ` - -or $RecycleThreshold ` - -or $DisableBinaryFileScan ` - -or $ConversionProcesses ` - -or $JobConversionFrequency ` - -or $NumberOfConversionsPerProcess ` - -or $TimeBeforeConversionIsMonitored ` - -or $MaximumConversionAttempts ` - -or $MaximumSyncConversionRequests ` - -or $KeepAliveTimeout ` - -or $MaximumConversionTime) ` - -and ($Ensure -eq "Absent")) - { - throw "You cannot use any of the parameters when Ensure is specified as Absent" - } - - if (($Ensure -eq "Present") -and -not ($ApplicationPool -and $DatabaseName)) - { - throw ("An Application Pool and Database Name are required to configure the Word " + ` - "Automation Service Application") - } - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($null -eq $CurrentValues) - { - return $false - } - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/MSFT_SPWordAutomationServiceApp.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/MSFT_SPWordAutomationServiceApp.schema.mof deleted file mode 100644 index 399a6bb2..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/MSFT_SPWordAutomationServiceApp.schema.mof +++ /dev/null @@ -1,23 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPWordAutomationServiceApp")] -class MSFT_SPWordAutomationServiceApp : OMI_BaseResource -{ - [Key, Description("THe name of the service application")] string Name; - [Write, Description("Present to ensure the app exists, absent to ensure that it does not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("The name of the application pool to run the service app in")] string ApplicationPool; - [Write, Description("The name of the database for the service app")] string DatabaseName; - [Write, Description("The name of the server that will host the database")] string DatabaseServer; - [Write, Description("The list of supported file types"), ValueMap{"docx","doc","mht","rtf","xml"}, Values{"docx","doc","mht","rtf","xml"}] string SupportedFileFormats[]; - [Write, Description("Should embedded fonts be disabled")] boolean DisableEmbeddedFonts; - [Write, Description("What is the maximum amount of memory the service app should use (in MB)")] uint32 MaximumMemoryUsage; - [Write, Description("What is the recycle threshold for this service app")] uint32 RecycleThreshold; - [Write, Description("Should binary file scans be disabled")] boolean DisableBinaryFileScan; - [Write, Description("How many conversion processes can be run at once")] uint32 ConversionProcesses; - [Write, Description("How frequently should new jobs be started from the queue (in minutes)")] uint32 JobConversionFrequency; - [Write, Description("How many document conversions should be included in a single process")] uint32 NumberOfConversionsPerProcess; - [Write, Description("How long can a conversion be run before it becomes monitored")] uint32 TimeBeforeConversionIsMonitored; - [Write, Description("What is the maximum number of attempts to convert a document")] uint32 MaximumConversionAttempts; - [Write, Description("What is the maximum number of sync conversion requests for the service app")] uint32 MaximumSyncConversionRequests; - [Write, Description("How long is the keep alive timeout set to for the service app")] uint32 KeepAliveTimeout; - [Write, Description("What is the maximum time in seconds for a document conversion to be allowed to run")] uint32 MaximumConversionTime; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] string InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWorkManagementServiceApp/MSFT_SPWorkManagementServiceApp.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWorkManagementServiceApp/MSFT_SPWorkManagementServiceApp.psm1 deleted file mode 100644 index c4685082..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWorkManagementServiceApp/MSFT_SPWorkManagementServiceApp.psm1 +++ /dev/null @@ -1,396 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $ProxyName, - - [parameter(Mandatory = $false)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.UInt32] - $MinimumTimeBetweenEwsSyncSubscriptionSearches, - - [parameter(Mandatory = $false)] - [System.UInt32] - $MinimumTimeBetweenProviderRefreshes, - - [parameter(Mandatory = $false)] - [System.UInt32] - $MinimumTimeBetweenSearchQueries, - - [parameter(Mandatory = $false)] - [System.UInt32] - $NumberOfSubscriptionSyncsPerEwsSyncRun, - - [parameter(Mandatory = $false)] - [System.UInt32] - $NumberOfUsersEwsSyncWillProcessAtOnce, - - [parameter(Mandatory = $false)] - [System.UInt32] - $NumberOfUsersPerEwsSyncBatch, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Getting Work management service app '$Name'" - - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue - - $nullReturn = @{ - Name = $params.Name - Ensure = "Absent" - ApplicationPool = $params.ApplicationPool - } - - if ($null -eq $serviceApps) - { - return $nullReturn - } - $serviceApp = $serviceApps | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Server.WorkManagement.WorkManagementServiceApplication" - } - - if ($null -eq $serviceApp) - { - return $nullReturn - } - else - { - $serviceAppProxies = Get-SPServiceApplicationProxy -ErrorAction SilentlyContinue - if ($null -ne $serviceAppProxies) - { - $serviceAppProxy = $serviceAppProxies | Where-Object -FilterScript { - $serviceApp.IsConnected($_) - } - if ($null -ne $serviceAppProxy) - { - $proxyName = $serviceAppProxy.Name - } - } - - return @{ - Name = $serviceApp.DisplayName - ProxyName = $proxyName - ApplicationPool = $serviceApp.ApplicationPool.Name - MinimumTimeBetweenEwsSyncSubscriptionSearches = $serviceApp.AdminSettings.MinimumTimeBetweenEwsSyncSubscriptionSearches.TotalMinutes - MinimumTimeBetweenProviderRefreshes = $serviceApp.AdminSettings.MinimumTimeBetweenProviderRefreshes.TotalMinutes - MinimumTimeBetweenSearchQueries = $serviceApp.AdminSettings.MinimumTimeBetweenProviderRefreshes.TotalMinutes - NumberOfSubscriptionSyncsPerEwsSyncRun = $serviceApp.AdminSettings.NumberOfSubscriptionSyncsPerEwsSyncRun - NumberOfUsersEwsSyncWillProcessAtOnce = $serviceApp.AdminSettings.NumberOfUsersEwsSyncWillProcessAtOnce - NumberOfUsersPerEwsSyncBatch = $serviceApp.AdminSettings.NumberOfUsersPerEwsSyncBatch - Ensure = "Present" - } - } - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $ProxyName, - - [parameter(Mandatory = $false)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.UInt32] - $MinimumTimeBetweenEwsSyncSubscriptionSearches, - - [parameter(Mandatory = $false)] - [System.UInt32] - $MinimumTimeBetweenProviderRefreshes, - - [parameter(Mandatory = $false)] - [System.UInt32] - $MinimumTimeBetweenSearchQueries, - - [parameter(Mandatory = $false)] - [System.UInt32] - $NumberOfSubscriptionSyncsPerEwsSyncRun, - - [parameter(Mandatory = $false)] - [System.UInt32] - $NumberOfUsersEwsSyncWillProcessAtOnce, - - [parameter(Mandatory = $false)] - [System.UInt32] - $NumberOfUsersPerEwsSyncBatch, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Setting Work management service app '$Name'" - $PSBoundParameters.Ensure = $Ensure - - if ($Ensure -ne "Absent" -and $PSBoundParameters.ContainsKey("ApplicationPool") -eq $false) - { - throw "Parameter ApplicationPool is required unless service is being removed(Ensure='Absent')" - } - - $result = Get-TargetResource @PSBoundParameters - - if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") - { - Write-Verbose -Message "Creating work management Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - if ($params.ContainsKey("Ensure")) - { - $params.Remove("Ensure") | Out-Null - } - if ($params.ContainsKey("InstallAccount")) - { - $params.Remove("InstallAccount") | Out-Null - } - if ($params.ContainsKey("ProxyName")) - { - $pName = $params.ProxyName - $params.Remove("ProxyName") | Out-Null - } - if ($null -eq $pName) { - $pName = "$($params.Name) Proxy" - } - - $app = New-SPWorkManagementServiceApplication @params - if ($null -ne $app) - { - New-SPWorkManagementServiceApplicationProxy -Name $pName ` - -ServiceApplication $app ` - -DefaultProxyGroup - Start-Sleep -Milliseconds 200 - } - } - } - - if ($result.Ensure -eq "Present" -and $Ensure -eq "Present") - { - if ([string]::IsNullOrEmpty($ApplicationPool) -eq $false ` - -and $ApplicationPool -ne $result.ApplicationPool) - { - Write-Verbose -Message "Updating Application Pool of Work Management Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $serviceApp = Get-SPServiceApplication -Name $params.Name | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Server.WorkManagement.WorkManagementServiceApplication" - } - $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool - Set-SPWorkManagementServiceApplication -Identity $serviceApp -ApplicationPool $appPool - } - } - - Write-Verbose -Message "Updating Application Pool of Work Management Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $setParams = @{} - if ($params.ContainsKey("MinimumTimeBetweenEwsSyncSubscriptionSearches")) - { - $setParams.Add("MinimumTimeBetweenEwsSyncSubscriptionSearches", - $params.MinimumTimeBetweenEwsSyncSubscriptionSearches) - } - if ($params.ContainsKey("MinimumTimeBetweenProviderRefreshes")) - { - $setParams.Add("MinimumTimeBetweenProviderRefreshes", - $params.MinimumTimeBetweenProviderRefreshes) - } - if ($params.ContainsKey("MinimumTimeBetweenSearchQueries")) - { - $setParams.Add("MinimumTimeBetweenSearchQueries", - $params.MinimumTimeBetweenSearchQueries) - } - if ($params.ContainsKey("NumberOfSubscriptionSyncsPerEwsSyncRun")) - { - $setParams.Add("NumberOfSubscriptionSyncsPerEwsSyncRun", - $params.NumberOfSubscriptionSyncsPerEwsSyncRun) - } - if ($params.ContainsKey("NumberOfUsersEwsSyncWillProcessAtOnce")) - { - $setParams.Add("NumberOfUsersEwsSyncWillProcessAtOnce", - $params.NumberOfUsersEwsSyncWillProcessAtOnce) - } - if ($params.ContainsKey("NumberOfUsersPerEwsSyncBatch")) - { - $setParams.Add("NumberOfUsersPerEwsSyncBatch", - $params.NumberOfUsersPerEwsSyncBatch) - } - - $setParams.Add("Name", $params.Name) - $setParams.Add("ApplicationPool", $params.ApplicationPool) - - if ($setParams.ContainsKey("MinimumTimeBetweenEwsSyncSubscriptionSearches")) - { - $setParams.MinimumTimeBetweenEwsSyncSubscriptionSearches = New-TimeSpan -Days $setParams.MinimumTimeBetweenEwsSyncSubscriptionSearches - } - if ($setParams.ContainsKey("MinimumTimeBetweenProviderRefreshes")) - { - $setParams.MinimumTimeBetweenProviderRefreshes = New-TimeSpan -Days $setParams.MinimumTimeBetweenProviderRefreshes - } - if ($setParams.ContainsKey("MinimumTimeBetweenSearchQueries")) - { - $setParams.MinimumTimeBetweenSearchQueries = New-TimeSpan -Days $setParams.MinimumTimeBetweenSearchQueries - } - $setParams.Add("Confirm", $false) - $appService = Get-SPServiceApplication -Name $params.Name | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Server.WorkManagement.WorkManagementServiceApplication" - } - - $appService | Set-SPWorkManagementServiceApplication @setPArams | Out-Null - } - } - - if ($Ensure -eq "Absent") - { - # The service app should not exit - Write-Verbose -Message "Removing Work Management Service Application $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $serviceApp = Get-SPServiceApplication -Name $params.Name | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Server.WorkManagement.WorkManagementServiceApplication" - } - - $proxies = Get-SPServiceApplicationProxy - foreach($proxyInstance in $proxies) - { - if($serviceApp.IsConnected($proxyInstance)) - { - $proxyInstance.Delete() - } - } - - Remove-SPServiceApplication $serviceApp -Confirm:$false - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $ProxyName, - - [parameter(Mandatory = $false)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.UInt32] - $MinimumTimeBetweenEwsSyncSubscriptionSearches, - - [parameter(Mandatory = $false)] - [System.UInt32] - $MinimumTimeBetweenProviderRefreshes, - - [parameter(Mandatory = $false)] - [System.UInt32] - $MinimumTimeBetweenSearchQueries, - - [parameter(Mandatory = $false)] - [System.UInt32] - $NumberOfSubscriptionSyncsPerEwsSyncRun, - - [parameter(Mandatory = $false)] - [System.UInt32] - $NumberOfUsersEwsSyncWillProcessAtOnce, - - [parameter(Mandatory = $false)] - [System.UInt32] - $NumberOfUsersPerEwsSyncBatch, - - [parameter(Mandatory = $false)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing Work management service app '$Name'" - - $PSBoundParameters.Ensure = $Ensure - - $CurrentValues = Get-TargetResource @PSBoundParameters - - if ($Ensure -eq "Present") - { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ApplicationPool", - "MinimumTimeBetweenEwsSyncSubscriptionSearches", - "MinimumTimeBetweenProviderRefreshes", - "MinimumTimeBetweenSearchQueries", - "Name", - "NumberOfSubscriptionSyncsPerEwsSyncRun", - "NumberOfUsersEwsSyncWillProcessAtOnce", - "NumberOfUsersPerEwsSyncBatch", - "Ensure") - } - else - { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") - } -} - -Export-ModuleMember -Function *-TargetResource - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWorkManagementServiceApp/MSFT_SPWorkManagementServiceApp.schema.mof b/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWorkManagementServiceApp/MSFT_SPWorkManagementServiceApp.schema.mof deleted file mode 100644 index dd6c2e86..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/DSCResources/MSFT_SPWorkManagementServiceApp/MSFT_SPWorkManagementServiceApp.schema.mof +++ /dev/null @@ -1,15 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPWorkManagementServiceApp")] -class MSFT_SPWorkManagementServiceApp : OMI_BaseResource -{ - [Key, Description("The name of the work management service application")] string Name; - [Write, Description("The proxy name, if not specified will be /Name of service app/ Proxy")] string ProxyName; - [Write, Description("Present to ensure the app exists, Absent to ensure it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("The name of the application pool this will run in")] String ApplicationPool; - [Write, Description("The minimum amount of time bween EWS sync subscription searches")] uint32 MinimumTimeBetweenEwsSyncSubscriptionSearches; - [Write, Description("The minimum time between provider refreshes")] uint32 MinimumTimeBetweenProviderRefreshes; - [Write, Description("The minimum time between search queries")] uint32 MinimumTimeBetweenSearchQueries; - [Write, Description("The number of subscription syncronisations per EWS sync run")] uint32 NumberOfSubscriptionSyncsPerEwsSyncRun; - [Write, Description("How many users will EWS calls include at once")] uint32 NumberOfUsersEwsSyncWillProcessAtOnce; - [Write, Description("How many users are included in a batch for EWS")] uint32 NumberOfUsersPerEwsSyncBatch; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/LICENSE b/lib/puppet_x/dsc_resources/SharePointDsc/LICENSE deleted file mode 100644 index b8b569d7..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.ContentDatabase/SPContentDatabase.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.ContentDatabase/SPContentDatabase.psm1 deleted file mode 100644 index 1aa6a0ae..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.ContentDatabase/SPContentDatabase.psm1 +++ /dev/null @@ -1,76 +0,0 @@ -function Mount-SPDscContentDatabase() -{ - param - ( - [Parameter(Mandatory=$true)] - [System.Collections.Hashtable] - $params, - - [Parameter(Mandatory=$true)] - [System.Boolean] - $enabled - ) - - if ($params.ContainsKey("Enabled")) - { - $params.Remove("Enabled") - } - - if ($params.ContainsKey("Ensure")) - { - $params.Remove("Ensure") - } - - if ($params.ContainsKey("InstallAccount")) - { - $params.Remove("InstallAccount") - } - - if ($params.ContainsKey("MaximumSiteCount")) - { - $params.MaxSiteCount = $params.MaximumSiteCount - $params.Remove("MaximumSiteCount") - } - if ($params.ContainsKey("WebAppUrl")) - { - $params.WebApplication = $params.WebAppUrl - $params.Remove("WebAppUrl") - } - - try - { - $cdb = Mount-SPContentDatabase @params - } - catch - { - throw ("Error occurred while mounting content database. " + ` - "Content database is not mounted. " + ` - "Error details: $($_.Exception.Message)") - } - - if ($cdb.Status -eq "Online") - { - $cdbenabled = $true - } - else - { - $cdbenabled = $false - } - - if ($enabled -ne $cdbenabled) - { - switch ($params.Enabled) - { - $true - { - $cdb.Status = [Microsoft.SharePoint.Administration.SPObjectStatus]::Online - } - $false - { - $cdb.Status = [Microsoft.SharePoint.Administration.SPObjectStatus]::Disabled - } - } - } - - return $cdb -} diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.Farm/SPFarm.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.Farm/SPFarm.psm1 deleted file mode 100644 index c0016716..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.Farm/SPFarm.psm1 +++ /dev/null @@ -1,206 +0,0 @@ -<# - -.SYNOPSIS - -Get-SPDSCConfigDBStatus is used to determine the state of a configuration database - -.DESCRIPTION - -Get-SPDSCConfigDBStatus will determine two things - firstly, if the config database -exists, and secondly if the user executing the script has appropriate permissions -to the instance to create the database. These values are used by the SPFarm resource -to determine what actions to take in it's set method. - -.PARAMETER SQLServer - -The name of the SQL server to check against - -.PARAMETER Database - -The name of the database to validate as the configuration database - -.EXAMPLE - -Get-SPDSCConfigDBStatus -SQLServer sql.contoso.com -Database SP_Config - -#> -function Get-SPDSCConfigDBStatus -{ - param( - [Parameter(Mandatory = $true)] - [String] - $SQLServer, - - [Parameter(Mandatory = $true)] - [String] - $Database - ) - - $connection = New-Object -TypeName "System.Data.SqlClient.SqlConnection" - $connection.ConnectionString = "Server=$SQLServer;Integrated Security=SSPI;Database=Master" - $command = New-Object -TypeName "System.Data.SqlClient.SqlCommand" - - try - { - $currentUser = ([Security.Principal.WindowsIdentity]::GetCurrent()).Name - $connection.Open() - $command.Connection = $connection - - $command.CommandText = "SELECT COUNT(*) FROM sys.databases WHERE name = '$Database'" - $configDBexists = ($command.ExecuteScalar() -eq 1) - - $command.CommandText = "SELECT COUNT(*) FROM sys.databases WHERE name = '$($Database)_Lock'" - $lockExists = ($command.ExecuteScalar() -eq 1) - - $serverRolesToCheck = @("dbcreator", "securityadmin") - $hasPermissions = $true - foreach ($serverRole in $serverRolesToCheck) - { - $command.CommandText = "SELECT IS_SRVROLEMEMBER('$serverRole')" - if ($command.ExecuteScalar() -eq "0") - { - Write-Verbose -Message "$currentUser does not have '$serverRole' role on server '$SQLServer'" - $hasPermissions = $false - } - } - - return @{ - DatabaseExists = $configDBexists - ValidPermissions = $hasPermissions - Locked = $lockExists - } - } - finally - { - if ($connection.State -eq "Open") - { - $connection.Close() - $connection.Dispose() - } - } -} - -<# - -.SYNOPSIS - -Add-SPDSCConfigDBLock is used to create a lock to tell other servers that the -config DB is currently provisioning - -.DESCRIPTION - -Add-SPDSCConfigDBLock will create an empty database with the same name as the -config DB but suffixed with "_Lock". The presences of this database will -indicate to other servers that the config database is in the process of being -provisioned as the database is removed at the end of the process. - -.PARAMETER SQLServer - -The name of the SQL server to check against - -.PARAMETER Database - -The name of the database to validate as the configuration database - -.EXAMPLE - -Add-SPDSCConfigDBLock -SQLServer sql.contoso.com -Database SP_Config - -#> -function Add-SPDSCConfigDBLock -{ - param( - [Parameter(Mandatory = $true)] - [String] - $SQLServer, - - [Parameter(Mandatory = $true)] - [String] - $Database - ) - - Write-Verbose -Message "Creating lock database $($Database)_Lock" - - $connection = New-Object -TypeName "System.Data.SqlClient.SqlConnection" - $connection.ConnectionString = "Server=$SQLServer;Integrated Security=SSPI;Database=Master" - $command = New-Object -TypeName "System.Data.SqlClient.SqlCommand" - - try - { - $connection.Open() - $command.Connection = $connection - - $command.CommandText = "CREATE DATABASE [$($Database)_Lock]" - $command.ExecuteNonQuery() - } - finally - { - if ($connection.State -eq "Open") - { - $connection.Close() - $connection.Dispose() - } - } -} - -<# - -.SYNOPSIS - -Remove-SPDSCConfigDBLock is used to create a lock to tell other servers that the -config DB is currently provisioning - -.DESCRIPTION - -Remove-SPDSCConfigDBLock will cremove the lock database created by the -Add-SPDSCConfigDBLock command. - -.PARAMETER SQLServer - -The name of the SQL server to check against - -.PARAMETER Database - -The name of the database to validate as the configuration database - -.EXAMPLE - -Remove-SPDSCConfigDBLock -SQLServer sql.contoso.com -Database SP_Config - -#> -function Remove-SPDSCConfigDBLock -{ - param( - [Parameter(Mandatory = $true)] - [String] - $SQLServer, - - [Parameter(Mandatory = $true)] - [String] - $Database - ) - - Write-Verbose -Message "Removing lock database $($Database)_Lock" - - $connection = New-Object -TypeName "System.Data.SqlClient.SqlConnection" - $connection.ConnectionString = "Server=$SQLServer;Integrated Security=SSPI;Database=Master" - $command = New-Object -TypeName "System.Data.SqlClient.SqlCommand" - - try - { - $connection.Open() - $command.Connection = $connection - - $command.CommandText = "DROP DATABASE [$($Database)_Lock]" - $command.ExecuteNonQuery() - } - finally - { - if ($connection.State -eq "Open") - { - $connection.Close() - $connection.Dispose() - } - } -} - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.Search/SPSearchContentSource.Schedules.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.Search/SPSearchContentSource.Schedules.psm1 deleted file mode 100644 index a9c02254..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.Search/SPSearchContentSource.Schedules.psm1 +++ /dev/null @@ -1,136 +0,0 @@ -function Get-SPDSCSearchCrawlSchedule -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param( - [parameter(Mandatory = $false)] - $Schedule - ) - - if ($null -eq $Schedule) - { - return @{ - ScheduleType = "None" - } - } - - $scheduleType = $Schedule.GetType().Name - $result = @{ - CrawlScheduleRepeatDuration = $Schedule.RepeatDuration - CrawlScheduleRepeatInterval = $Schedule.RepeatInterval - StartHour = $Schedule.StartHour - StartMinute = $Schedule.StartMinute - } - - switch ($scheduleType) - { - "DailySchedule" { - $result.Add("ScheduleType", "Daily") - $result.Add("CrawlScheduleRunEveryInterval", $Schedule.DaysInterval) - } - "WeeklySchedule" { - $result.Add("ScheduleType", "Weekly") - $result.Add("CrawlScheduleRunEveryInterval", $Schedule.WeeksInterval) - $result.Add("CrawlScheduleDaysOfWeek", $Schedule.DaysOfWeek) - } - "MonthlyDateSchedule" { - $result.Add("ScheduleType", "Monthly") - $result.Add("CrawlScheduleDaysOfMonth", ($Schedule.DaysOfMonth.ToString() -replace "Day")) - $result.Add("CrawlScheduleMonthsOfYear", $schedule.MonthsOfYear) - } - Default { - throw "An unknown schedule type was detected" - } - } - return $result -} - -function Test-SPDSCSearchCrawlSchedule -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param( - [parameter(Mandatory = $true)] $CurrentSchedule, - [parameter(Mandatory = $true)] $DesiredSchedule - ) - - Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\SharePointDsc.Util\SharePointDsc.Util.psm1") - - if ($CurrentSchedule.ScheduleType -ne $DesiredSchedule.ScheduleType) - { - return $false - } - - if ((Test-SPDSCObjectHasProperty -Object $DesiredSchedule ` - -PropertyName "CrawlScheduleRepeatDuration") -eq $true ` - -and $CurrentSchedule.CrawlScheduleRepeatDuration -ne $DesiredSchedule.CrawlScheduleRepeatDuration) - { - return $false - } - if ((Test-SPDSCObjectHasProperty -Object $DesiredSchedule ` - -PropertyName "CrawlScheduleRepeatInterval") -eq $true ` - -and $CurrentSchedule.CrawlScheduleRepeatInterval -ne $DesiredSchedule.CrawlScheduleRepeatInterval) - { - return $false - } - if ((Test-SPDSCObjectHasProperty -Object $DesiredSchedule ` - -PropertyName "StartHour") -eq $true ` - -and $CurrentSchedule.StartHour -ne $DesiredSchedule.StartHour) - { - return $false - } - if ((Test-SPDSCObjectHasProperty -Object $DesiredSchedule ` - -PropertyName "StartMinute") -eq $true ` - -and $CurrentSchedule.StartMinute -ne $DesiredSchedule.StartMinute) - { - return $false - } - - switch ($CurrentSchedule.ScheduleType) - { - "Daily" { - if ((Test-SPDSCObjectHasProperty -Object $DesiredSchedule ` - -PropertyName "CrawlScheduleRunEveryInterval") -eq $true ` - -and $CurrentSchedule.CrawlScheduleRunEveryInterval -ne $DesiredSchedule.CrawlScheduleRunEveryInterval) - { - return $false - } - } - "Weekly" { - if ((Test-SPDSCObjectHasProperty -Object $DesiredSchedule ` - -PropertyName "CrawlScheduleRunEveryInterval") -eq $true ` - -and $CurrentSchedule.CrawlScheduleRunEveryInterval -ne $DesiredSchedule.CrawlScheduleRunEveryInterval) - { - return $false - } - $days = $CurrentSchedule.CrawlScheduleDaysOfWeek.ToString() - if ((Test-SPDSCObjectHasProperty -Object $DesiredSchedule ` - -PropertyName "CrawlScheduleDaysOfWeek") -eq $true ` - -and $null -ne (Compare-Object -ReferenceObject $days.Split(', ', [System.StringSplitOptions]::RemoveEmptyEntries) ` - -DifferenceObject $DesiredSchedule.CrawlScheduleDaysOfWeek)) - { - return $false - } - } - "Monthly" { - if ((Test-SPDSCObjectHasProperty -Object $DesiredSchedule ` - -PropertyName "CrawlScheduleDaysOfMonth") -eq $true ` - -and $CurrentSchedule.CrawlScheduleDaysOfMonth -ne $DesiredSchedule.CrawlScheduleDaysOfMonth) - { - return $false - } - $months = $CurrentSchedule.CrawlScheduleMonthsOfYear.ToString() - if ((Test-SPDSCObjectHasProperty -Object $DesiredSchedule ` - -PropertyName "CrawlScheduleMonthsOfYear") -eq $true ` - -and $null -eq (Compare-Object -ReferenceObject $months.Split(', ', [System.StringSplitOptions]::RemoveEmptyEntries) ` - -DifferenceObject $DesiredSchedule.CrawlScheduleMonthsOfYear)) - { - return $false - } - } - } - return $true -} - -Export-ModuleMember -Function * diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 deleted file mode 100644 index dc796e2d..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 +++ /dev/null @@ -1,750 +0,0 @@ -function Add-SPDSCUserToLocalAdmin -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true,Position=1)] - [string] - $UserName - ) - - if ($UserName.Contains("\") -eq $false) - { - throw [Exception] "Usernames should be formatted as domain\username" - } - - $domainName = $UserName.Split('\')[0] - $accountName = $UserName.Split('\')[1] - - Write-Verbose -Message "Adding $domainName\$userName to local admin group" - ([ADSI]"WinNT://$($env:computername)/Administrators,group").Add("WinNT://$domainName/$accountName") | Out-Null -} - -function Get-SPDscOSVersion -{ - [CmdletBinding()] - param() - return [System.Environment]::OSVersion.Version -} - -function Get-SPDSCAssemblyVersion -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true,Position=1)] - [string] - $PathToAssembly - ) - return (Get-Command $PathToAssembly).FileVersionInfo.FileMajorPart -} - -function Get-SPDscFarmVersionInfo -{ - param - ( - [parameter(Mandatory = $false)] - [System.String] - $ProductToCheck - ) - - $farm = Get-SPFarm - $productVersions = [Microsoft.SharePoint.Administration.SPProductVersions]::GetProductVersions($farm) - $server = Get-SPServer -Identity $env:COMPUTERNAME - $versionInfo = @{} - $versionInfo.Highest = "" - $versionInfo.Lowest = "" - - $serverProductInfo = $productVersions.GetServerProductInfo($server.id) - $products = $serverProductInfo.Products - - if ($ProductToCheck) - { - $products = $products | Where-Object -FilterScript { - $_ -eq $ProductToCheck - } - - if ($null -eq $products) - { - throw "Product not found: $ProductToCheck" - } - } - - # Loop through all products - foreach ($product in $products) - { - $singleProductInfo = $serverProductInfo.GetSingleProductInfo($product) - $patchableUnits = $singleProductInfo.PatchableUnitDisplayNames - - # Loop through all individual components within the product - foreach ($patchableUnit in $patchableUnits) - { - # Check if the displayname is the Proofing tools (always mentioned in first product, - # generates noise) - if (($patchableUnit -notmatch "Microsoft Server Proof") -and - ($patchableUnit -notmatch "SQL Express") -and - ($patchableUnit -notmatch "OMUI") -and - ($patchableUnit -notmatch "XMUI") -and - ($patchableUnit -notmatch "Project Server") -and - ($patchableUnit -notmatch "Microsoft SharePoint Server (2013|2016)")) - { - $patchableUnitsInfo = $singleProductInfo.GetPatchableUnitInfoByDisplayName($patchableUnit) - $currentVersion = "" - foreach ($patchableUnitInfo in $patchableUnitsInfo) - { - # Loop through version of the patchableUnit - $currentVersion = $patchableUnitInfo.LatestPatch.Version.ToString() - - # Check if the version of the patchableUnit is the highest for the installed product - if ($currentVersion -gt $versionInfo.Highest) - { - $versionInfo.Highest = $currentVersion - } - - if ($versionInfo.Lowest -eq "") - { - $versionInfo.Lowest = $currentVersion - } - else - { - if ($currentversion -lt $versionInfo.Lowest) - { - $versionInfo.Lowest = $currentVersion - } - } - } - } - } - } - return $versionInfo -} - -function Get-SPDscFarmProductsInfo -{ - $farm = Get-SPFarm - $productVersions = [Microsoft.SharePoint.Administration.SPProductVersions]::GetProductVersions($farm) - $server = Get-SPServer -Identity $env:COMPUTERNAME - - $serverProductInfo = $productVersions.GetServerProductInfo($server.id) - return $serverProductInfo.Products -} - -function Get-SPDscRegProductsInfo -{ - $registryLocation = Get-ChildItem -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall" - $sharePointPrograms = $registryLocation | Where-Object -FilterScript { - $_.PsPath -like "*\Office*" - } | ForEach-Object -Process { - Get-ItemProperty -Path $_.PsPath - } - - return $sharePointPrograms.DisplayName -} - -function Get-SPDSCRegistryKey -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Key, - - [parameter(Mandatory = $true)] - [System.String] - $Value - ) - - if ((Test-Path -Path $Key) -eq $true) - { - $regKey = Get-ItemProperty -LiteralPath $Key - return $regKey.$Value - } - else - { - throw "Specified registry key $Key could not be found." - } -} - -function Get-SPDSCServiceContext -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true,Position=1)] - $ProxyGroup - ) - Write-Verbose -Message "Getting SPContext for Proxy group $($proxyGroup)" - return [Microsoft.SharePoint.SPServiceContext]::GetContext($proxyGroup,[Microsoft.SharePoint.SPSiteSubscriptionIdentifier]::Default) -} - -function Get-SPDSCContentService -{ - [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") | Out-Null - return [Microsoft.SharePoint.Administration.SPWebService]::ContentService -} - -function Get-SPDSCUserProfileSubTypeManager -{ - [CmdletBinding()] - param - ( - $Context - ) - [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") | Out-Null - return [Microsoft.Office.Server.UserProfiles.ProfileSubtypeManager]::Get($Context) -} - -function Get-SPDSCInstalledProductVersion -{ - $pathToSearch = "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\*\ISAPI\Microsoft.SharePoint.dll" - $fullPath = Get-Item $pathToSearch | Sort-Object { $_.Directory } -Descending | Select-Object -First 1 - return (Get-Command $fullPath).FileVersionInfo -} - -function Invoke-SPDSCCommand -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $Credential, - - [parameter(Mandatory = $false)] - [Object[]] - $Arguments, - - [parameter(Mandatory = $true)] - [ScriptBlock] - $ScriptBlock - ) - - $VerbosePreference = 'Continue' - - $baseScript = @" - if (`$null -eq (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue)) - { - Add-PSSnapin Microsoft.SharePoint.PowerShell - } - -"@ - - $invokeArgs = @{ - ScriptBlock = [ScriptBlock]::Create($baseScript + $ScriptBlock.ToString()) - } - if ($null -ne $Arguments) - { - $invokeArgs.Add("ArgumentList", $Arguments) - } - - if ($null -eq $Credential) - { - if ($Env:USERNAME.Contains("$")) - { - throw [Exception] ("You need to specify a value for either InstallAccount " + ` - "or PsDscRunAsCredential.") - return - } - Write-Verbose -Message "Executing as the local run as user $($Env:USERDOMAIN)\$($Env:USERNAME)" - - try - { - $result = Invoke-Command @invokeArgs -Verbose - } - catch - { - if ($_.Exception.Message.Contains("An update conflict has occurred, and you must re-try this action")) - { - Write-Verbose -Message ("Detected an update conflict, restarting server to " + ` - "allow DSC to resume and retry") - $global:DSCMachineStatus = 1 - } - else - { - throw $_ - } - } - return $result - } - else - { - if ($Credential.UserName.Split("\")[1] -eq $Env:USERNAME) - { - if (-not $Env:USERNAME.Contains("$")) - { - throw [Exception] ("Unable to use both InstallAccount and " + ` - "PsDscRunAsCredential in a single resource. Remove one " + ` - "and try again.") - return - } - } - Write-Verbose -Message ("Executing using a provided credential and local PSSession " + ` - "as user $($Credential.UserName)") - - # Running garbage collection to resolve issues related to Azure DSC extention use - [GC]::Collect() - - $session = New-PSSession -ComputerName $env:COMPUTERNAME ` - -Credential $Credential ` - -Authentication CredSSP ` - -Name "Microsoft.SharePoint.DSC" ` - -SessionOption (New-PSSessionOption -OperationTimeout 0 ` - -IdleTimeout 60000) ` - -ErrorAction Continue - - if ($session) - { - $invokeArgs.Add("Session", $session) - } - - try - { - $result = Invoke-Command @invokeArgs -Verbose - } - catch - { - if ($_.Exception.Message.Contains("An update conflict has occurred, and you must re-try this action")) - { - Write-Verbose -Message ("Detected an update conflict, restarting server to " + ` - "allow DSC to resume and retry") - $global:DSCMachineStatus = 1 - } - else - { - throw $_ - } - } - - if ($session) - { - Remove-PSSession -Session $session - } - return $result - } -} - -function Rename-SPDSCParamValue -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true,Position=1,ValueFromPipeline=$true)] - $Params, - - [parameter(Mandatory = $true,Position=2)] - $OldName, - - [parameter(Mandatory = $true,Position=3)] - $NewName - ) - - if ($Params.ContainsKey($OldName)) - { - $Params.Add($NewName, $Params.$OldName) - $Params.Remove($OldName) | Out-Null - } - return $Params -} - -function Remove-SPDSCUserToLocalAdmin -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true,Position=1)] - [string] - $UserName - ) - - if ($UserName.Contains("\") -eq $false) - { - throw [Exception] "Usernames should be formatted as domain\username" - } - - $domainName = $UserName.Split('\')[0] - $accountName = $UserName.Split('\')[1] - - Write-Verbose -Message "Removing $domainName\$userName from local admin group" - ([ADSI]"WinNT://$($env:computername)/Administrators,group").Remove("WinNT://$domainName/$accountName") | Out-Null -} - -function Resolve-SPDscSecurityIdentifier -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [String] - $SID - ) - $memberName = ([wmi]"Win32_SID.SID='$SID'").AccountName - $memberName = "$($env:USERDOMAIN)\$memberName" - return $memberName -} - -function Test-SPDSCObjectHasProperty -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true,Position=1)] - [Object] - $Object, - - [parameter(Mandatory = $true,Position=2)] - [String] - $PropertyName - ) - - if (([bool]($Object.PSobject.Properties.name -contains $PropertyName)) -eq $true) - { - if ($null -ne $Object.$PropertyName) - { - return $true - } - } - return $false -} - -function Test-SPDSCRunAsCredential -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $Credential - ) - - # If no specific credential is passed and it's not the machine account, it must be - # PsDscRunAsCredential - if (($null -eq $Credential) -and ($Env:USERNAME.Contains("$") -eq $false)) - { - return $true - } - # return false for all other scenarios - return $false -} - -function Test-SPDSCRunningAsFarmAccount -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param ( - [parameter(Mandatory = $false)] - [pscredential] - $InstallAccount - ) - - if ($null -eq $InstallAccount) - { - if ($Env:USERNAME.Contains("$")) - { - throw [Exception] "You need to specify a value for either InstallAccount or PsDscRunAsCredential." - return - } - $Username = "$($Env:USERDOMAIN)\$($Env:USERNAME)" - } - else - { - $Username = $InstallAccount.UserName - } - - $result = Invoke-SPDSCCommand -Credential $InstallAccount -ScriptBlock { - try - { - $spFarm = Get-SPFarm - } - catch - { - Write-Verbose -Message "Unable to detect local farm." - return $null - } - return $spFarm.DefaultServiceAccount.Name - } - - if ($Username -eq $result) - { - return $true - } - return $false -} - -function Test-SPDscParameterState -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true, Position=1)] - [HashTable] - $CurrentValues, - - [parameter(Mandatory = $true, Position=2)] - [Object] - $DesiredValues, - - [parameter(Mandatory = $false, Position=3)] - [Array] - $ValuesToCheck - ) - - $returnValue = $true - - if (($DesiredValues.GetType().Name -ne "HashTable") ` - -and ($DesiredValues.GetType().Name -ne "CimInstance") ` - -and ($DesiredValues.GetType().Name -ne "PSBoundParametersDictionary")) - { - throw ("Property 'DesiredValues' in Test-SPDscParameterState must be either a " + ` - "Hashtable or CimInstance. Type detected was $($DesiredValues.GetType().Name)") - } - - if (($DesiredValues.GetType().Name -eq "CimInstance") -and ($null -eq $ValuesToCheck)) - { - throw ("If 'DesiredValues' is a CimInstance then property 'ValuesToCheck' must contain " + ` - "a value") - } - - if (($null -eq $ValuesToCheck) -or ($ValuesToCheck.Count -lt 1)) - { - $KeyList = $DesiredValues.Keys - } - else - { - $KeyList = $ValuesToCheck - } - - $KeyList | ForEach-Object -Process { - if (($_ -ne "Verbose") -and ($_ -ne "InstallAccount")) - { - if (($CurrentValues.ContainsKey($_) -eq $false) ` - -or ($CurrentValues.$_ -ne $DesiredValues.$_) ` - -or (($DesiredValues.ContainsKey($_) -eq $true) -and ($null -ne $DesiredValues.$_ -and $DesiredValues.$_.GetType().IsArray))) - { - if ($DesiredValues.GetType().Name -eq "HashTable" -or ` - $DesiredValues.GetType().Name -eq "PSBoundParametersDictionary") - { - $CheckDesiredValue = $DesiredValues.ContainsKey($_) - } - else - { - $CheckDesiredValue = Test-SPDSCObjectHasProperty $DesiredValues $_ - } - - if ($CheckDesiredValue) - { - $desiredType = $DesiredValues.$_.GetType() - $fieldName = $_ - if ($desiredType.IsArray -eq $true) - { - if (($CurrentValues.ContainsKey($fieldName) -eq $false) ` - -or ($null -eq $CurrentValues.$fieldName)) - { - Write-Verbose -Message ("Expected to find an array value for " + ` - "property $fieldName in the current " + ` - "values, but it was either not present or " + ` - "was null. This has caused the test method " + ` - "to return false.") - $returnValue = $false - } - else - { - $arrayCompare = Compare-Object -ReferenceObject $CurrentValues.$fieldName ` - -DifferenceObject $DesiredValues.$fieldName - if ($null -ne $arrayCompare) - { - Write-Verbose -Message ("Found an array for property $fieldName " + ` - "in the current values, but this array " + ` - "does not match the desired state. " + ` - "Details of the changes are below.") - $arrayCompare | ForEach-Object -Process { - Write-Verbose -Message "$($_.InputObject) - $($_.SideIndicator)" - } - $returnValue = $false - } - } - } - else - { - switch ($desiredType.Name) - { - "String" { - if ([string]::IsNullOrEmpty($CurrentValues.$fieldName) ` - -and [string]::IsNullOrEmpty($DesiredValues.$fieldName)) - {} - else - { - Write-Verbose -Message ("String value for property " + ` - "$fieldName does not match. " + ` - "Current state is " + ` - "'$($CurrentValues.$fieldName)' " + ` - "and desired state is " + ` - "'$($DesiredValues.$fieldName)'") - $returnValue = $false - } - } - "Int32" { - if (($DesiredValues.$fieldName -eq 0) ` - -and ($null -eq $CurrentValues.$fieldName)) - {} - else - { - Write-Verbose -Message ("Int32 value for property " + ` - "$fieldName does not match. " + ` - "Current state is " + ` - "'$($CurrentValues.$fieldName)' " + ` - "and desired state is " + ` - "'$($DesiredValues.$fieldName)'") - $returnValue = $false - } - } - "Int16" { - if (($DesiredValues.$fieldName -eq 0) ` - -and ($null -eq $CurrentValues.$fieldName)) - {} - else - { - Write-Verbose -Message ("Int16 value for property " + ` - "$fieldName does not match. " + ` - "Current state is " + ` - "'$($CurrentValues.$fieldName)' " + ` - "and desired state is " + ` - "'$($DesiredValues.$fieldName)'") - $returnValue = $false - } - } - default { - Write-Verbose -Message ("Unable to compare property $fieldName " + ` - "as the type ($($desiredType.Name)) is " + ` - "not handled by the " + ` - "Test-SPDscParameterState cmdlet") - $returnValue = $false - } - } - } - } - } - } - } - return $returnValue -} - -function Test-SPDSCUserIsLocalAdmin -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true,Position=1)] - [string] - $UserName - ) - - if ($UserName.Contains("\") -eq $false) - { - throw [Exception] "Usernames should be formatted as domain\username" - } - - $domainName = $UserName.Split('\')[0] - $accountName = $UserName.Split('\')[1] - - return ([ADSI]"WinNT://$($env:computername)/Administrators,group").PSBase.Invoke("Members") | ` - ForEach-Object -Process { - $_.GetType().InvokeMember("Name", 'GetProperty', $null, $_, $null) - } | Where-Object -FilterScript { - $_ -eq $accountName - } -} - -function Test-SPDSCIsADUser -{ - [OutputType([System.Boolean])] - [CmdletBinding()] - param ( - [string] - $IdentityName - ) - - if ($IdentityName -like "*\*") - { - $IdentityName = $IdentityName.Substring($IdentityName.IndexOf('\') + 1) - } - - $searcher = New-Object -TypeName System.DirectoryServices.DirectorySearcher - $searcher.filter = "((samAccountName=$IdentityName))" - $searcher.SearchScope = "subtree" - $searcher.PropertiesToLoad.Add("objectClass") | Out-Null - $searcher.PropertiesToLoad.Add("objectCategory") | Out-Null - $searcher.PropertiesToLoad.Add("name") | Out-Null - $result = $searcher.FindOne() - - if ($null -eq $result) - { - throw "Unable to locate identity '$IdentityName' in the current domain." - } - - if ($result[0].Properties.objectclass -contains "user") - { - return $true - } - else - { - return $false - } -} - -function Set-SPDscObjectPropertyIfValuePresent -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [object] - $ObjectToSet, - - [parameter(Mandatory = $true)] - [string] - $PropertyToSet, - - [parameter(Mandatory = $true)] - [object] - $ParamsValue, - - [parameter(Mandatory = $true)] - [string] - $ParamKey - ) - if ($ParamsValue.PSobject.Methods.name -contains "ContainsKey") - { - if ($ParamsValue.ContainsKey($ParamKey) -eq $true) - { - $ObjectToSet.$PropertyToSet = $ParamsValue.$ParamKey - } - } - else - { - if (((Test-SPDSCObjectHasProperty $ParamsValue $ParamKey) -eq $true) ` - -and ($null -ne $ParamsValue.$ParamKey)) - { - $ObjectToSet.$PropertyToSet = $ParamsValue.$ParamKey - } - } -} - -function Remove-SPDSCGenericObject -{ - [CmdletBinding()] - param ( - [parameter(Mandatory = $true)] - [Object] - $SourceCollection, - - [parameter(Mandatory = $true)] - [Object] - $Target - ) - $SourceCollection.Remove($Target) -} - -Export-ModuleMember -Function * diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.WebAppPolicy/SPWebAppPolicy.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.WebAppPolicy/SPWebAppPolicy.psm1 deleted file mode 100644 index 3cc63ae9..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.WebAppPolicy/SPWebAppPolicy.psm1 +++ /dev/null @@ -1,194 +0,0 @@ -function Assert-SPDSCPolicyUser() -{ - Param ( - [Parameter(Mandatory=$false)] - [Array] - $CurrentDifferences, - - [Parameter(Mandatory=$true)] - [String] - $UsernameToCheck - ) - - foreach ($difference in $CurrentDifferences) - { - if($difference.ContainsKey($UsernameToCheck)) - { - return $true - } - } - return $false -} - -function Compare-SPDSCWebAppPolicy() -{ - Param ( - [Parameter(Mandatory=$true)] - [Array] - $WAPolicies, - - [Parameter(Mandatory=$true)] - [Array] - $DSCSettings, - - [Parameter(Mandatory=$true)] - [String] - $DefaultIdentityType - ) - Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\SharePointDsc.Util\SharePointDsc.Util.psm1" ` - -Resolve) - $diff = @() - - foreach ($policy in $WAPolicies) - { - $memberexists = $false - foreach($setting in $DSCSettings) - { - $identityType = $DefaultIdentityType - if ((Test-SPDSCObjectHasProperty -Object $setting ` - -PropertyName "IdentityType") -eq $true) - { - $identityType = $setting.IdentityType - } - if (($policy.Username -eq $setting.Username) -and ` - ($policy.IdentityType -eq $identityType)) - { - - $memberexists = $true - - $polbinddiff = Compare-Object -ReferenceObject $policy.PermissionLevel.ToLower() ` - -DifferenceObject $setting.PermissionLevel.ToLower() - - if ($null -ne $polbinddiff) - { - Write-Verbose -Message ("Permission level different for " + ` - "$($policy.IdentityType) user '$($policy.Username)'") - - if (-not (Assert-SPDSCPolicyUser -CurrentDifferences $diff ` - -UsernameToCheck $policy.Username.ToLower())) - { - $diff += @{ - Username = $policy.Username.ToLower() - Status = "Different" - IdentityType = $policy.IdentityType - DesiredPermissionLevel = $setting.PermissionLevel - DesiredActAsSystemSetting = $setting.ActAsSystemAccount - } - } - } - - if ($setting.ActAsSystemAccount) - { - if ($policy.ActAsSystemAccount -ne $setting.ActAsSystemAccount) - { - Write-Verbose -Message ("System User different for " + ` - "$($policy.IdentityType) user '$($policy.Username)'") - - if (-not (Assert-SPDSCPolicyUser -CurrentDifferences $diff ` - -UsernameToCheck $policy.Username.ToLower())) - { - $diff += @{ - Username = $policy.Username.ToLower() - Status = "Different" - IdentityType = $policy.IdentityType - DesiredPermissionLevel = $setting.PermissionLevel - DesiredActAsSystemSetting = $setting.ActAsSystemAccount - } - } - } - } - } - } - - if (-not $memberexists) - { - if (-not (Assert-SPDSCPolicyUser -CurrentDifferences $diff ` - -UsernameToCheck $policy.Username.ToLower())) - { - $diff += @{ - Username = $policy.Username.ToLower() - Status = "Additional" - IdentityType = $policy.IdentityType - DesiredPermissionLevel = $null - DesiredActAsSystemSetting = $null - } - } - } - } - - foreach ($setting in $DSCSettings) - { - $memberexists = $false - $identityType = $DefaultIdentityType - if ((Test-SPDSCObjectHasProperty -Object $setting -PropertyName "IdentityType") -eq $true) - { - $identityType = $setting.IdentityType - } - foreach($policy in $WAPolicies) - { - if (($policy.Username -eq $setting.Username) -and ` - ($policy.IdentityType -eq $identityType)) - { - $memberexists = $true - - $polbinddiff = Compare-Object -ReferenceObject $policy.PermissionLevel.ToLower() ` - -DifferenceObject $setting.PermissionLevel.ToLower() - if ($null -ne $polbinddiff) - { - Write-Verbose -Message ("Permission level different for " + ` - "$($policy.IdentityType) user '$($policy.Username)'") - - if (-not (Assert-SPDSCPolicyUser -CurrentDifferences $diff ` - -UsernameToCheck $policy.Username.ToLower())) - { - $diff += @{ - Username = $setting.Username.ToLower() - Status = "Different" - IdentityType = $identityType - DesiredPermissionLevel = $setting.PermissionLevel - DesiredActAsSystemSetting = $setting.ActAsSystemAccount - } - } - } - - if ($setting.ActAsSystemAccount) - { - if ($policy.ActAsSystemAccount -ne $setting.ActAsSystemAccount) - { - Write-Verbose -Message ("System User different for " + ` - "$($policy.IdentityType) user '$($policy.Username)'") - - if (-not (Assert-SPDSCPolicyUser -CurrentDifferences $diff ` - -UsernameToCheck $policy.Username.ToLower())) - { - $diff += @{ - Username = $setting.Username.ToLower() - Status = "Different" - IdentityType = $identityType - DesiredPermissionLevel = $setting.PermissionLevel - DesiredActAsSystemSetting = $setting.ActAsSystemAccount - } - } - } - } - } - } - - if (-not $memberexists) - { - if (-not (Assert-SPDSCPolicyUser -CurrentDifferences $diff ` - -UsernameToCheck $setting.Username.ToLower())) - { - $diff += @{ - Username = $setting.Username.ToLower() - Status = "Missing" - IdentityType = $identityType - DesiredPermissionLevel = $setting.PermissionLevel - DesiredActAsSystemSetting = $setting.ActAsSystemAccount - } - } - } - } - return $diff -} diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.WebApplication/SPWebApplication.BlockedFileTypes.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.WebApplication/SPWebApplication.BlockedFileTypes.psm1 deleted file mode 100644 index d5711040..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.WebApplication/SPWebApplication.BlockedFileTypes.psm1 +++ /dev/null @@ -1,138 +0,0 @@ -function Get-SPDSCWebApplicationBlockedFileTypeConfig -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param( - [parameter(Mandatory = $true)] - $WebApplication - ) - $result = @() - $WebApplication.BlockedFileExtensions | ForEach-Object -Process { - $result += $_ - } - return @{ - Blocked = $result - } -} - -function Set-SPDSCWebApplicationBlockedFileTypeConfig -{ - [CmdletBinding()] - param( - [parameter(Mandatory = $true)] - $WebApplication, - - [parameter(Mandatory = $true)] - $Settings - ) - - if (($Settings.ContainsKey("Blocked") -eq $true) ` - -and (($Settings.ContainsKey("EnsureBlocked") -eq $true) ` - -or ($Settings.ContainsKey("EnsureAllowed") -eq $true))) - { - throw ("Blocked file types must use either the 'blocked' property or the " + ` - "'EnsureBlocked' and/or 'EnsureAllowed' properties, but not both.") - } - - if (($Settings.ContainsKey("Blocked") -eq $false) ` - -and ($Settings.ContainsKey("EnsureBlocked") -eq $false) ` - -and ($Settings.ContainsKey("EnsureAllowed") -eq $false)) - { - throw ("Blocked file types must specify at least one property (either 'Blocked, " + ` - "'EnsureBlocked' or 'EnsureAllowed')") - } - - if($Settings.ContainsKey("Blocked") -eq $true) - { - $WebApplication.BlockedFileExtensions.Clear(); - $Settings.Blocked | ForEach-Object -Process { - $WebApplication.BlockedFileExtensions.Add($_.ToLower()); - } - } - - if($Settings.ContainsKey("EnsureBlocked") -eq $true) - { - $Settings.EnsureBlocked | ForEach-Object -Process { - if(!$WebApplication.BlockedFileExtensions.Contains($_.ToLower())){ - $WebApplication.BlockedFileExtensions.Add($_.ToLower()); - } - } - } - - if($Settings.ContainsKey("EnsureAllowed") -eq $true) - { - $Settings.EnsureAllowed | ForEach-Object -Process { - if($WebApplication.BlockedFileExtensions.Contains($_.ToLower())){ - $WebApplication.BlockedFileExtensions.Remove($_.ToLower()); - } - } - } -} - -function Test-SPDSCWebApplicationBlockedFileTypeConfig -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param( - [parameter(Mandatory = $true)] - $CurrentSettings, - - [parameter(Mandatory = $true)] - $DesiredSettings - ) - - if (($DesiredSettings.ContainsKey("Blocked") -eq $true) ` - -and (($DesiredSettings.ContainsKey("EnsureBlocked") -eq $true) ` - -or ($DesiredSettings.ContainsKey("EnsureAllowed") -eq $true))) - { - throw ("Blocked file types must use either the 'blocked' property or the " + ` - "'EnsureBlocked' and/or 'EnsureAllowed' properties, but not both.") - } - - if (($DesiredSettings.ContainsKey("Blocked") -eq $false) ` - -and ($DesiredSettings.ContainsKey("EnsureBlocked") -eq $false) ` - -and ($DesiredSettings.ContainsKey("EnsureAllowed") -eq $false)) - { - throw ("Blocked file types must specify at least one property (either 'Blocked, " + ` - "'EnsureBlocked' or 'EnsureAllowed')") - } - - if ($DesiredSettings.ContainsKey("Blocked") -eq $true) - { - $compareResult = Compare-Object -ReferenceObject $CurrentSettings.Blocked ` - -DifferenceObject $DesiredSettings.Blocked - if ($null -eq $compareResult) - { - return $true - } - else - { - return $false - } - } - - if ($DesiredSettings.ContainsKey("EnsureBlocked") -eq $true) - { - $itemsToAdd = Compare-Object -ReferenceObject $CurrentSettings.Blocked ` - -DifferenceObject $DesiredSettings.EnsureBlocked | Where-Object { - $_.SideIndicator -eq "=>" - } - if ($null -ne $itemsToAdd) - { - return $false - } - } - - if ($DesiredSettings.ContainsKey("EnsureAllowed") -eq $true) - { - $itemsToRemove = Compare-Object -ReferenceObject $CurrentSettings.Blocked ` - -DifferenceObject $DesiredSettings.EnsureAllowed ` - -ExcludeDifferent -IncludeEqual - if ($null -ne $itemsToRemove) - { - return $false - } - } - return $true -} - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.WebApplication/SPWebApplication.GeneralSettings.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.WebApplication/SPWebApplication.GeneralSettings.psm1 deleted file mode 100644 index a6e26f47..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.WebApplication/SPWebApplication.GeneralSettings.psm1 +++ /dev/null @@ -1,142 +0,0 @@ -function Get-SPDSCWebApplicationGeneralConfig -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param( - [parameter(Mandatory = $true)] - $WebApplication - ) - - if ($WebApplication.DefaultTimeZone -eq -1) - { - $timezone = $null - } - else - { - $timezone = $WebApplication.DefaultTimeZone - } - - return @{ - TimeZone = $timezone - Alerts = $WebApplication.AlertsEnabled - AlertsLimit = $WebApplication.AlertsMaximum - RSS = $WebApplication.SyndicationEnabled - BlogAPI = $WebApplication.MetaWeblogEnabled - BlogAPIAuthenticated = $WebApplication.MetaWeblogAuthenticationEnabled - BrowserFileHandling = $WebApplication.BrowserFileHandling - SecurityValidation = $WebApplication.FormDigestSettings.Enabled - SecurityValidationExpires = $WebApplication.FormDigestSettings.Expires - SecurityValidationTimeoutMinutes = $WebApplication.FormDigestSettings.Timeout.TotalMinutes - RecycleBinEnabled = $WebApplication.RecycleBinEnabled - RecycleBinCleanupEnabled = $WebApplication.RecycleBinCleanupEnabled - RecycleBinRetentionPeriod = $WebApplication.RecycleBinRetentionPeriod - SecondStageRecycleBinQuota = $WebApplication.SecondStageRecycleBinQuota - MaximumUploadSize = $WebApplication.MaximumFileSize - CustomerExperienceProgram = $WebApplication.BrowserCEIPEnabled - PresenceEnabled = $WebApplication.PresenceEnabled - AllowOnlineWebPartCatalog = $WebApplication.AllowAccessToWebPartCatalog - SelfServiceSiteCreationEnabled = $WebApplication.SelfServiceSiteCreationEnabled - } -} - -function Set-SPDSCWebApplicationGeneralConfig -{ - [CmdletBinding()] - param( - [parameter(Mandatory = $true)] - $WebApplication, - - [parameter(Mandatory = $true)] - $Settings - ) - - if ($Settings.SecurityValidationTimeoutMinutes) - { - Write-Verbose -Message "timeout minutes: $($Settings.SecurityValidationTimeOutMinutes)" - $mins = New-TimeSpan -Minutes $Settings.SecurityValidationTimeoutMinutes - $Settings.SecurityValidationTimeoutMinutes = $mins - } - - # Format here is SPWebApplication property = Custom settings property - $mapping = @{ - DefaultTimeZone = "TimeZone" - AlertsEnabled = "Alerts" - AlertsMaximum = "AlertsLimit" - SyndicationEnabled = "RSS" - MetaWeblogEnabled = "BlogAPI" - MetaWeblogAuthenticationEnabled = "BlogAPIAuthenticated" - BrowserFileHandling = "BrowserFileHandling" - MaximumFileSize = "MaximumUploadSize" - RecycleBinEnabled = "RecycleBinEnabled" - RecycleBinCleanupEnabled = "RecycleBinCleanupEnabled" - RecycleBinRetentionPeriod = "RecycleBinRetentionPeriod" - SecondStageRecycleBinQuota = "SecondStageRecycleBinQuota" - BrowserCEIPEnabled = "CustomerExperienceProgram" - PresenceEnabled = "Presence" - AllowAccessToWebPartCatalog = "AllowOnlineWebPartCatalog" - SelfServiceSiteCreationEnabled = "SelfServiceSiteCreationEnabled" - } - $mapping.Keys | ForEach-Object -Process { - Set-SPDscObjectPropertyIfValuePresent -ObjectToSet $WebApplication ` - -PropertyToSet $_ ` - -ParamsValue $settings ` - -ParamKey $mapping[$_] - } - - # Set form digest settings child properties - Set-SPDscObjectPropertyIfValuePresent -ObjectToSet $WebApplication.FormDigestSettings ` - -PropertyToSet "Enabled" ` - -ParamsValue $settings ` - -ParamKey "SecurityValidation" - - Set-SPDscObjectPropertyIfValuePresent -ObjectToSet $WebApplication.FormDigestSettings ` - -PropertyToSet "Expires" ` - -ParamsValue $settings ` - -ParamKey "SecurityValidationExpires" - - Set-SPDscObjectPropertyIfValuePresent -ObjectToSet $WebApplication.FormDigestSettings ` - -PropertyToSet "Timeout" ` - -ParamsValue $settings ` - -ParamKey "SecurityValidationTimeOutMinutes" -} - -function Test-SPDSCWebApplicationGeneralConfig -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param( - [parameter(Mandatory = $true)] - $CurrentSettings, - - [parameter(Mandatory = $true)] - $DesiredSettings - ) - - $relPath = "..\..\Modules\SharePointDsc.Util\SharePointDsc.Util.psm1" - Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath $relPath -Resolve) - $valuesToCheck = @("TimeZone", - "Alerts", - "AlertsLimit", - "RSS", - "BlogAPI", - "BlogAPIAuthenticated", - "BrowserFileHandling", - "SecurityValidation", - "SecurityValidationExpires", - "SecurityValidationTimeoutMinutes", - "RecycleBinEnabled", - "RecycleBinCleanupEnabled", - "RecycleBinRetentionPeriod", - "SecondStageRecycleBinQuota", - "MaximumUploadSize", - "CustomerExperienceProgram", - "PresenceEnabled", - "AllowOnlineWebPartCatalog", - "SelfServiceSiteCreationEnabled" - ) - $testReturn = Test-SPDscParameterState -CurrentValues $CurrentSettings ` - -DesiredValues $DesiredSettings ` - -ValuesToCheck $valuesToCheck - return $testReturn -} - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.WebApplication/SPWebApplication.Throttling.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.WebApplication/SPWebApplication.Throttling.psm1 deleted file mode 100644 index 921d85ec..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.WebApplication/SPWebApplication.Throttling.psm1 +++ /dev/null @@ -1,172 +0,0 @@ -function Get-SPDSCWebApplicationThrottlingConfig -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param( - [parameter(Mandatory = $true)] - $WebApplication - ) - return @{ - ListViewThreshold = $WebApplication.MaxItemsPerThrottledOperation - AllowObjectModelOverride = $WebApplication.AllowOMCodeOverrideThrottleSettings - AdminThreshold = $WebApplication.MaxItemsPerThrottledOperationOverride - ListViewLookupThreshold = $WebApplication.MaxQueryLookupFields - HappyHourEnabled = $WebApplication.UnthrottledPrivilegedOperationWindowEnabled - HappyHour = @{ - Hour = $WebApplication.DailyStartUnthrottledPrivilegedOperationsHour - Minute = $WebApplication.DailyStartUnthrottledPrivilegedOperationsMinute - Duration = $WebApplication.DailyUnthrottledPrivilegedOperationsDuration - } - UniquePermissionThreshold = $WebApplication.MaxUniquePermScopesPerList - RequestThrottling = $WebApplication.HttpThrottleSettings.PerformThrottle - ChangeLogEnabled = $WebApplication.ChangeLogExpirationEnabled - ChangeLogExpiryDays = $WebApplication.ChangeLogRetentionPeriod.Days - EventHandlersEnabled = $WebApplication.EventHandlersEnabled - } -} - -function Set-SPDSCWebApplicationThrottlingConfig -{ - [CmdletBinding()] - param( - [parameter(Mandatory = $true)] - $WebApplication, - - [parameter(Mandatory = $true)] - $Settings - ) - - # Format here is SPWebApplication property = Custom settings property - $mapping = @{ - MaxItemsPerThrottledOperation = "ListViewThreshold" - AllowOMCodeOverrideThrottleSettings = "AllowObjectModelOverride" - MaxItemsPerThrottledOperationOverride = "AdminThreshold" - MaxQueryLookupFields = "ListViewLookupThreshold" - UnthrottledPrivilegedOperationWindowEnabled = "HappyHourEnabled" - MaxUniquePermScopesPerList = "UniquePermissionThreshold" - EventHandlersEnabled = "EventHandlersEnabled" - ChangeLogExpirationEnabled = "ChangeLogEnabled" - } - $mapping.Keys | ForEach-Object -Process { - Set-SPDscObjectPropertyIfValuePresent -ObjectToSet $WebApplication ` - -PropertyToSet $_ ` - -ParamsValue $settings ` - -ParamKey $mapping[$_] - } - - # Set throttle settings child property seperately - Set-SPDscObjectPropertyIfValuePresent -ObjectToSet $WebApplication.HttpThrottleSettings ` - -PropertyToSet "PerformThrottle" ` - -ParamsValue $Settings ` - -ParamKey "RequestThrottling" - - # Create time span object separately - if ((Test-SPDSCObjectHasProperty $Settings "ChangeLogExpiryDays") -eq $true) - { - $days = New-TimeSpan -Days $Settings.ChangeLogExpiryDays - $WebApplication.ChangeLogRetentionPeriod = $days - } -} - - -function Set-SPDSCWebApplicationHappyHourConfig -{ - [CmdletBinding()] - param( - [parameter(Mandatory = $true)] - $WebApplication, - - [parameter(Mandatory = $true)] - $Settings - ) - - if ((Test-SPDSCObjectHasProperty $Settings "Hour") -eq $false ` - -or (Test-SPDSCObjectHasProperty $Settings "Minute") -eq $false ` - -or (Test-SPDSCObjectHasProperty $Settings "Duration") -eq $false) - { - throw "Happy hour settings must include 'hour', 'minute' and 'duration'" - } - else - { - if ($Settings.Hour -lt 0 -or $Settings.Hour -gt 23) - { - throw "Happy hour setting 'hour' must be between 0 and 23" - } - if ($Settings.Minute -lt 0 -or $Settings.Minute -gt 59) - { - throw "Happy hour setting 'minute' must be between 0 and 59" - } - if ($Settings.Duration -lt 0 -or $Settings.Duration -gt 23) - { - throw "Happy hour setting 'hour' must be between 0 and 23" - } - $h = $Settings.Hour - $m = $Settings.Minute - $d = $Settings.Duration - $WebApplication.SetDailyUnthrottledPrivilegedOperationWindow($h, $m, $d) - } -} - -function Test-SPDSCWebApplicationThrottlingConfig -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param( - [parameter(Mandatory = $true)] - $CurrentSettings, - - [parameter(Mandatory = $true)] - $DesiredSettings - ) - - $relPath = "..\..\Modules\SharePointDsc.Util\SharePointDsc.Util.psm1" - Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath $relPath -Resolve) - $testReturn = Test-SPDscParameterState -CurrentValues $CurrentSettings ` - -DesiredValues $DesiredSettings ` - -ValuesToCheck @( - "ListViewThreshold", - "AllowObjectModelOverride", - "AdminThreshold", - "ListViewLookupThreshold", - "HappyHourEnabled", - "UniquePermissionThreshold", - "RequestThrottling", - "ChangeLogEnabled", - "ChangeLogExpiryDays", - "EventHandlersEnabled" - ) - if ($testReturn -eq $true) - { - if ($null -ne $DesiredSettings.HappyHour) - { - $DesiredHappyHour = @{} - if ($null -ne $DesiredSettings.HappyHour.Hour) - { - $DesiredHappyHour.Add("Hour",[int32]$DesiredSettings.HappyHour.Hour) - } - else - { - $DesiredHappyHour.Add("Hour",$null) - } - if ($null -ne $DesiredSettings.HappyHour.Minute) - { - $DesiredHappyHour.Add("Minute",[int32]$DesiredSettings.HappyHour.Minute) - } else - { - $DesiredHappyHour.Add("Minute",$null) - } - if ($null -ne $DesiredSettings.HappyHour.Duration) - { - $DesiredHappyHour.Add("Duration",[int32]$DesiredSettings.HappyHour.Duration) - } else - { - $DesiredHappyHour.Add("Duration",$null) - } - - $testReturn = Test-SPDscParameterState -CurrentValues $CurrentSettings.HappyHour ` - -DesiredValues $DesiredHappyHour ` - -ValuesToCheck @("Hour", "Minute", "Duration") - } - } - return $testReturn -} diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.WebApplication/SPWebApplication.Workflow.psm1 b/lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.WebApplication/SPWebApplication.Workflow.psm1 deleted file mode 100644 index 25814e04..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/Modules/SharePointDsc.WebApplication/SPWebApplication.Workflow.psm1 +++ /dev/null @@ -1,68 +0,0 @@ -function Get-SPDSCWebApplicationWorkflowConfig -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param( - [parameter(Mandatory = $true)] - $WebApplication - ) - return @{ - ExternalWorkflowParticipantsEnabled = ` - $WebApplication.ExternalWorkflowParticipantsEnabled - UserDefinedWorkflowsEnabled = ` - $WebApplication.UserDefinedWorkflowsEnabled - EmailToNoPermissionWorkflowParticipantsEnable = ` - $WebApplication.EmailToNoPermissionWorkflowParticipantsEnabled - } -} - -function Set-SPDSCWebApplicationWorkflowConfig -{ - [CmdletBinding()] - param( - [parameter(Mandatory = $true)] - $WebApplication, - - [parameter(Mandatory = $true)] - $Settings - ) - if ($Settings.ContainsKey("UserDefinedWorkflowsEnabled") -eq $true) - { - $WebApplication.UserDefinedWorkflowsEnabled = ` - $Settings.UserDefinedWorkflowsEnabled; - } - if ($Settings.ContainsKey("EmailToNoPermissionWorkflowParticipantsEnable") -eq $true) - { - $WebApplication.EmailToNoPermissionWorkflowParticipantsEnabled = ` - $Settings.EmailToNoPermissionWorkflowParticipantsEnable; - } - if ($Settings.ContainsKey("ExternalWorkflowParticipantsEnabled") -eq $true) - { - $WebApplication.ExternalWorkflowParticipantsEnabled = ` - $Settings.ExternalWorkflowParticipantsEnabled; - } - $WebApplication.UpdateWorkflowConfigurationSettings(); -} - -function Test-SPDSCWebApplicationWorkflowConfig { - [CmdletBinding()] - [OutputType([System.Boolean])] - param( - [parameter(Mandatory = $true)] - $CurrentSettings, - - [parameter(Mandatory = $true)] - $DesiredSettings - ) - - $relPath = "..\..\Modules\SharePointDsc.Util\SharePointDsc.Util.psm1" - Import-Module (Join-Path $PSScriptRoot $relPath -Resolve) - $valuesTocheck = @("UserDefinedWorkflowsEnabled", - "EmailToNoPermissionWorkflowParticipantsEnable", - "ExternalWorkflowParticipantsEnabled") - $testReturn = Test-SPDscParameterState -CurrentValues $CurrentSettings ` - -DesiredValues $DesiredSettings ` - -ValuesToCheck $valuesTocheck - return $testReturn -} - diff --git a/lib/puppet_x/dsc_resources/SharePointDsc/SharePointDsc.psd1 b/lib/puppet_x/dsc_resources/SharePointDsc/SharePointDsc.psd1 deleted file mode 100644 index 4bcfa646..00000000 --- a/lib/puppet_x/dsc_resources/SharePointDsc/SharePointDsc.psd1 +++ /dev/null @@ -1,163 +0,0 @@ -# -# Module manifest for module 'SharePointDsc' -# -# Generated by: Brian Farnhill -# -# Generated on: 17/03/2015 -# - -@{ - -# Script module or binary module file associated with this manifest. -# RootModule = '' - -# Version number of this module. -ModuleVersion = '1.8.0.0' - -# ID used to uniquely identify this module -GUID = '6c1176a0-4fac-4134-8ca2-3fa8a21a7b90' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2015-2017 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'This DSC module is used to deploy and configure SharePoint Server 2013 and 2016, and covers a wide range of areas including web apps, service apps and farm configuration.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Name of the Windows PowerShell host required by this module -# PowerShellHostName = '' - -# Minimum version of the Windows PowerShell host required by this module -# PowerShellHostVersion = '' - -# Minimum version of Microsoft .NET Framework required by this module -# DotNetFrameworkVersion = '' - -# Minimum version of the common language runtime (CLR) required by this module -# CLRVersion = '' - -# Processor architecture (None, X86, Amd64) required by this module -# ProcessorArchitecture = '' - -# Modules that must be imported into the global environment prior to importing this module -# RequiredModules = @() - -# Assemblies that must be loaded prior to importing this module -# RequiredAssemblies = @() - -# Script files (.ps1) that are run in the caller's environment prior to importing this module. -# ScriptsToProcess = @() - -# Type files (.ps1xml) to be loaded when importing this module -# TypesToProcess = @() - -# Format files (.ps1xml) to be loaded when importing this module -# FormatsToProcess = @() - -# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess -NestedModules = @("modules\SharePointDsc.Util\SharePointDsc.Util.psm1") - -# Functions to export from this module -#FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = @("Invoke-SPDSCCommand", - "Get-SPDSCInstalledProductVersion", - "Get-SPDSCContentService", - "Rename-SPDSCParamValue", - "Add-SPDSCUserToLocalAdmin", - "Remove-SPDSCUserToLocalAdmin", - "Test-SPDSCObjectHasProperty", - "Test-SPDSCRunAsCredential", - "Test-SPDSCUserIsLocalAdmin", - "Test-SPDscParameterState", - "Test-SPDSCIsADUser", - "Test-SPDSCRunningAsFarmAccount", - "Set-SPDscObjectPropertyIfValuePresent", - "Get-SPDSCUserProfileSubTypeManager", - "Get-SPDscOSVersion", - "Get-SPDSCRegistryKey", - "Resolve-SPDscSecurityIdentifier", - "Get-SPDscFarmProductsInfo", - "Get-SPDscFarmVersionInfo") - -# Variables to export from this module -#VariablesToExport = '*' - -# Aliases to export from this module -#AliasesToExport = '*' - -# List of all modules packaged with this module -# ModuleList = @() - -# List of all files packaged with this module -# FileList = @() - -# HelpInfo URI of this module -# HelpInfoURI = '' - -# Default prefix for commands exported from this module. Override the default prefix using Import-Module -prefix. -# DefaultCommandPrefix = '' - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/SharePointDsc/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/SharePointDsc' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - ReleaseNotes = " -* Fixed issue in SPServiceAppProxyGroup causing some service names to return as null -* Added TLS and SMTP port support for SharePoint 2016 -* Fixed issue in SPWebApplication where the Get method didn't return Classic - web applications properly -* Fixed issue in SPSubscriptionSettingsServiceApp not returning database values -* Updated Readme of SPInstall to include SharePoint Foundation is not supported -* Fixed issue with Access Denied in SPDesignerSettings -* Fixed missing brackets in error message in SPExcelServiceApp -* Removed the requirement for the ConfigWizard in SPInstallLanguagePack -* Fixed Language Pack detection issue in SPInstallLanguagePack -* Added support to set Windows service accounts for search related services to - SPSearchServiceApp resource -* Fixed issue in SPCreateFarm and SPJoinFarm where an exception was not handled - correctly -* Fixed issue in SPSessionStateService not returning correct database server - and name -* Fixed missing Ensure property default in SPRemoteFarmTrust -* Fixed issue in SPWebAppGeneralSettings where -1 was returned for the TimeZone -* Fixed incorrect UsagePoint check in SPQuotaTemplate -* Fixed issue in SPWebAppPolicy module where verbose messages are causing errors -* Fixed incorrect parameter naming in Get method of SPUserProfilePropery -* Fixed issue in SPBlobCacheSettings when trying to declare same URL with - different zone -* Improve documentation on SPProductUpdate to specify the need to unblock downloaded - files -* Added check if file is blocked in SPProductUpdate to prevent endless wait -* Enhance SPUserProfileServiceApp to allow for NoILM to be enabled -* Fixed issue in SPUserProfileProperty where PropertyMapping was Null -" - - } # End of PSData hashtable - -} # End of PrivateData hashtable -} - diff --git a/lib/puppet_x/dsc_resources/SystemLocaleDsc/DSCResources/MSFT_SystemLocale/MSFT_SystemLocale.psm1 b/lib/puppet_x/dsc_resources/SystemLocaleDsc/DSCResources/MSFT_SystemLocale/MSFT_SystemLocale.psm1 deleted file mode 100644 index 70f26b5c..00000000 --- a/lib/puppet_x/dsc_resources/SystemLocaleDsc/DSCResources/MSFT_SystemLocale/MSFT_SystemLocale.psm1 +++ /dev/null @@ -1,217 +0,0 @@ -#region localizeddata -if (Test-Path "${PSScriptRoot}\${PSUICulture}") -{ - Import-LocalizedData ` - -BindingVariable LocalizedData ` - -Filename MSFT_SystemLocale.psd1 ` - -BaseDirectory "${PSScriptRoot}\${PSUICulture}" -} -else -{ - #fallback to en-US - Import-LocalizedData ` - -BindingVariable LocalizedData ` - -Filename MSFT_SystemLocale.psd1 ` - -BaseDirectory "${PSScriptRoot}\en-US" -} -#endregion - -<# - .SYNOPSIS - Returns the current System Local on the node. - .PARAMETER IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes' - .PARAMETER SystemLocale - Specifies the System Locale. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [String] $IsSingleInstance, - - [Parameter(Mandatory = $true)] - [String] $SystemLocale - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.GettingSystemLocaleMessage) - ) -join '' ) - - # Get the current System Locale - $currentSystemLocale = Get-WinSystemLocale ` - -ErrorAction Stop - - # Generate the return object. - $returnValue = @{ - IsSingleInstance = $IsSingleInstance - SystemLocale = $currentSystemLocale.Name - } - - return $returnValue -} # Get-TargetResource - -<# - .SYNOPSIS - Sets the current System Locale on the node. - .PARAMETER IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes' - .PARAMETER SystemLocale - Specifies the System Locale. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [String] $IsSingleInstance, - - [Parameter(Mandatory = $true)] - [String] $SystemLocale - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.SettingSystemLocaleMessage) - ) -join '' ) - - # Get the current System Locale - $currentSystemLocale = Get-WinSystemLocale ` - -ErrorAction Stop - if ($currentSystemLocale.Name -ne $SystemLocale) - { - Set-WinSystemLocale ` - -SystemLocale $SystemLocale ` - -ErrorAction Stop - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.SystemLocaleUpdatedMessage) - ) -join '' ) - - $global:DSCMachineStatus = 1 - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.RestartRequiredMessage) - ) -join '' ) - } -} # Set-TargetResource - -<# - .SYNOPSIS - Tests if the current System Locale on the node needs to be changed. - .PARAMETER IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes' - .PARAMETER SystemLocale - Specifies the System Locale. - .OUTPUTS - Returns false if the System Locale needs to be changed or true if it is correct. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [String] $IsSingleInstance, - - [Parameter(Mandatory = $true)] - [String] $SystemLocale - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.TestingSystemLocaleMessage) - ) -join '' ) - - - if (-not (Test-SystemLocaleValue -SystemLocale $SystemLocale)) { - New-TerminatingError ` - -errorId 'InvalidSystemLocaleError' ` - -errorMessage ($LocalizedData.InvalidSystemLocaleError -f $SystemLocale) ` - -errorCategory InvalidArgument - } # if - - # Get the current System Locale - $currentSystemLocale = Get-WinSystemLocale ` - -ErrorAction Stop - - if ($currentSystemLocale.Name -ne $SystemLocale) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.SystemLocaleParameterNeedsUpdateMessage -f ` - $currentSystemLocale.Name,$SystemLocale) - ) -join '' ) - return $false - } - return $true -} # Test-TargetResource - -# Helper Functions -<# - .SYNOPSIS - Throw a custome exception. - .PARAMETER ErrorId - The identifier representing the exception being thrown. - .PARAMETER ErrorMessage - The error message to be used for this exception. - .PARAMETER ErrorCategory - The exception error category. -#> -function New-TerminatingError -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory)] - [String] $ErrorId, - - [Parameter(Mandatory)] - [String] $ErrorMessage, - - [Parameter(Mandatory)] - [System.Management.Automation.ErrorCategory] $ErrorCategory - ) - - $exception = New-Object ` - -TypeName System.InvalidOperationException ` - -ArgumentList $errorMessage - $errorRecord = New-Object ` - -TypeName System.Management.Automation.ErrorRecord ` - -ArgumentList $exception, $errorId, $errorCategory, $null - $PSCmdlet.ThrowTerminatingError($errorRecord) -} - -<# - .SYNOPSIS - Checks the provided System Locale against the list of valid cultures. - .PARAMETER SystemLocale - The System Locale to check the validitiy of. -#> -function Test-SystemLocaleValue -{ - [CmdletBinding()] - [OutputType([Boolean])] - param - ( - [Parameter(Mandatory)] - [String] $SystemLocale - ) - $validCultures = [System.Globalization.CultureInfo]::GetCultures(` - [System.Globalization.CultureTypes]::AllCultures` - ).name - return ($SystemLocale -in $validCultures) -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/SystemLocaleDsc/DSCResources/MSFT_SystemLocale/MSFT_SystemLocale.schema.mof b/lib/puppet_x/dsc_resources/SystemLocaleDsc/DSCResources/MSFT_SystemLocale/MSFT_SystemLocale.schema.mof deleted file mode 100644 index 1272747a..00000000 --- a/lib/puppet_x/dsc_resources/SystemLocaleDsc/DSCResources/MSFT_SystemLocale/MSFT_SystemLocale.schema.mof +++ /dev/null @@ -1,6 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SystemLocale")] -class MSFT_SystemLocale : OMI_BaseResource -{ - [Key, Description("Specifies the resource is a single instance, the value must be 'Yes'"), ValueMap{"Yes"}, Values{"Yes"}] String IsSingleInstance; - [Required, Description("Specifies the System Locale.")] String SystemLocale; -}; diff --git a/lib/puppet_x/dsc_resources/SystemLocaleDsc/DSCResources/MSFT_SystemLocale/en-us/MSFT_SystemLocale.psd1 b/lib/puppet_x/dsc_resources/SystemLocaleDsc/DSCResources/MSFT_SystemLocale/en-us/MSFT_SystemLocale.psd1 deleted file mode 100644 index 8486bbfb..00000000 --- a/lib/puppet_x/dsc_resources/SystemLocaleDsc/DSCResources/MSFT_SystemLocale/en-us/MSFT_SystemLocale.psd1 +++ /dev/null @@ -1,12 +0,0 @@ -# culture="en-US" -ConvertFrom-StringData -StringData @' - GettingSystemLocaleMessage = Getting Windows System Locale. - SettingSystemLocaleMessage = Setting Windows System Locale. - SystemLocaleUpdateParameterMessage = Setting Windows System Locale parameter {0} to "{1}". - SystemLocaleUpdatedMessage = Setting Windows System Locale updated. - RestartRequiredMessage = Node restart required. - TestingSystemLocaleMessage = Testing Windows System Locale. - SystemLocaleParameterNeedsUpdateMessage = System Locale is "{0}" but should be "{1}". Change required. - - InvalidSystemLocaleError = The System Locale "{0}" is invalid. -'@ diff --git a/lib/puppet_x/dsc_resources/SystemLocaleDsc/LICENSE b/lib/puppet_x/dsc_resources/SystemLocaleDsc/LICENSE deleted file mode 100644 index 8db96a2f..00000000 --- a/lib/puppet_x/dsc_resources/SystemLocaleDsc/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/lib/puppet_x/dsc_resources/SystemLocaleDsc/SystemLocaleDsc.psd1 b/lib/puppet_x/dsc_resources/SystemLocaleDsc/SystemLocaleDsc.psd1 deleted file mode 100644 index de4662b2..00000000 --- a/lib/puppet_x/dsc_resources/SystemLocaleDsc/SystemLocaleDsc.psd1 +++ /dev/null @@ -1,64 +0,0 @@ -@{ - -# Version number of this module. -ModuleVersion = '1.1.0.0' - -# ID used to uniquely identify this module -GUID = '9857ac65-2a1d-4902-bac5-1d90a99607e5' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2016 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'This DSC Resource allows configuration of the Windows System Locale.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Functions to export from this module -FunctionsToExport = 'Get-TargetResource', 'Test-TargetResource', 'Set-TargetResource' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Variables to export from this module -VariablesToExport = '*' - -# Aliases to export from this module -AliasesToExport = '*' - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource', 'SystemLocale') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/SystemLocaleDsc/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/SystemLocaleDsc' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - ReleaseNotes = '* Fix AppVeyor.yml build process. -* Convert Get-TargetResource to output IsSingleInstance value passed in as parameter. - -' - - } # End of PSData hashtable - -} # End of PrivateData hashtable -} - - diff --git a/lib/puppet_x/dsc_resources/xActiveDirectory/Assert-HADC.ps1 b/lib/puppet_x/dsc_resources/xActiveDirectory/Assert-HADC.ps1 deleted file mode 100644 index 3a4d69f5..00000000 --- a/lib/puppet_x/dsc_resources/xActiveDirectory/Assert-HADC.ps1 +++ /dev/null @@ -1,91 +0,0 @@ -[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingComputerNameHardcoded', '')] -[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] -param() - -# A configuration to Create High Availability Domain Controller -$secpasswd = ConvertTo-SecureString "Adrumble@6" -AsPlainText -Force -$domainCred = New-Object System.Management.Automation.PSCredential ("sva-dscdom\Administrator", $secpasswd) -$safemodeAdministratorCred = New-Object System.Management.Automation.PSCredential ("sva-dscdom\Administrator", $secpasswd) -$localcred = New-Object System.Management.Automation.PSCredential ("Administrator", $secpasswd) -$redmondCred = Get-Credential -Message "Enter Credentials for DNS Delegation: " -$newpasswd = ConvertTo-SecureString "Adrumble@7" -AsPlainText -Force -$userCred = New-Object System.Management.Automation.PSCredential ("sva-dscdom\Administrator", $newpasswd) - -configuration AssertHADC -{ - Import-DscResource -ModuleName xActiveDirectory - - Node $AllNodes.Where{$_.Role -eq "Primary DC"}.Nodename - { - WindowsFeature ADDSInstall - { - Ensure = "Present" - Name = "AD-Domain-Services" - } - - xADDomain FirstDS - { - DomainName = $Node.DomainName - DomainAdministratorCredential = $domaincred - SafemodeAdministratorPassword = $safemodeAdministratorCred - DnsDelegationCredential = $redmondCred - DependsOn = "[WindowsFeature]ADDSInstall" - } - - xWaitForADDomain DscForestWait - { - DomainName = $Node.DomainName - DomainUserCredential = $domaincred - RetryCount = $Node.RetryCount - RetryIntervalSec = $Node.RetryIntervalSec - DependsOn = "[xADDomain]FirstDS" - } - - xADUser FirstUser - { - DomainName = $Node.DomainName - DomainAdministratorCredential = $domaincred - UserName = "dummy" - Password = $userCred - Ensure = "Present" - DependsOn = "[xWaitForADDomain]DscForestWait" - } - - } - - Node $AllNodes.Where{$_.Role -eq "Replica DC"}.Nodename - { - WindowsFeature ADDSInstall - { - Ensure = "Present" - Name = "AD-Domain-Services" - } - - xWaitForADDomain DscForestWait - { - DomainName = $Node.DomainName - DomainUserCredential = $domaincred - RetryCount = $Node.RetryCount - RetryIntervalSec = $Node.RetryIntervalSec - DependsOn = "[WindowsFeature]ADDSInstall" - } - - xADDomainController SecondDC - { - DomainName = $Node.DomainName - DomainAdministratorCredential = $domaincred - SafemodeAdministratorPassword = $safemodeAdministratorCred - DependsOn = "[xWaitForADDomain]DscForestWait" - } - } -} - -$config = Invoke-Expression (Get-content $PSScriptRoot\HADCconfiguration.psd1 -Raw) -AssertHADC -configurationData $config - -$computerName1 = "sva-dsc1" -$computerName2 = "sva-dsc2" - -Start-DscConfiguration -Wait -Force -Verbose -ComputerName $computerName1 -Path $PSScriptRoot\AssertHADC -Credential $localcred -Start-DscConfiguration -Wait -Force -Verbose -ComputerName $computerName2 -Path $PSScriptRoot\AssertHADC -Credential $localcred - diff --git a/lib/puppet_x/dsc_resources/xActiveDirectory/Assert-ParentChildDomains.ps1 b/lib/puppet_x/dsc_resources/xActiveDirectory/Assert-ParentChildDomains.ps1 deleted file mode 100644 index 35eb14eb..00000000 --- a/lib/puppet_x/dsc_resources/xActiveDirectory/Assert-ParentChildDomains.ps1 +++ /dev/null @@ -1,92 +0,0 @@ -[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingComputerNameHardcoded', '')] -[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] -param() - -$secpasswd = ConvertTo-SecureString "Adrumble@6" -AsPlainText -Force -$domainCred = New-Object System.Management.Automation.PSCredential ("sva-dscdom\Administrator", $secpasswd) -$safemodeAdministratorCred = New-Object System.Management.Automation.PSCredential ("sva-dscdom\Administrator", $secpasswd) -$localcred = New-Object System.Management.Automation.PSCredential ("Administrator", $secpasswd) -$redmondCred = Get-Credential -Message "Enter Credentials for DNS Delegation: " -$newpasswd = ConvertTo-SecureString "Adrumble@7" -AsPlainText -Force -$userCred = New-Object System.Management.Automation.PSCredential ("sva-dscdom\Administrator", $newpasswd) - -configuration AssertParentChildDomains -{ - - Import-DscResource -ModuleName xActiveDirectory - - Node $AllNodes.Where{$_.Role -eq "Parent DC"}.Nodename - { - WindowsFeature ADDSInstall - { - Ensure = "Present" - Name = "AD-Domain-Services" - } - - xADDomain FirstDS - { - DomainName = $Node.DomainName - DomainAdministratorCredential = $domaincred - SafemodeAdministratorPassword = $safemodeAdministratorCred - DnsDelegationCredential = $redmondCred - DependsOn = "[WindowsFeature]ADDSInstall" - } - - xWaitForADDomain DscForestWait - { - DomainName = $Node.DomainName - DomainUserCredential = $domaincred - RetryCount = $Node.RetryCount - RetryIntervalSec = $Node.RetryIntervalSec - DependsOn = "[xADDomain]FirstDS" - } - - xADUser FirstUser - { - DomainName = $Node.DomainName - DomainAdministratorCredential = $domaincred - UserName = "dummy" - Password = $userCred - Ensure = "Present" - DependsOn = "[xWaitForADDomain]DscForestWait" - } - - } - - Node $AllNodes.Where{$_.Role -eq "Child DC"}.Nodename - { - WindowsFeature ADDSInstall - { - Ensure = "Present" - Name = "AD-Domain-Services" - } - - xWaitForADDomain DscForestWait - { - DomainName = $Node.ParentDomainName - DomainUserCredential = $domaincred - RetryCount = $Node.RetryCount - RetryIntervalSec = $Node.RetryIntervalSec - DependsOn = "[WindowsFeature]ADDSInstall" - } - - xADDomain ChildDS - { - DomainName = $Node.DomainName - ParentDomainName = $Node.ParentDomainName - DomainAdministratorCredential = $domaincred - SafemodeAdministratorPassword = $safemodeAdministratorCred - DependsOn = "[xWaitForADDomain]DscForestWait" - } - } -} - -$config = Invoke-Expression (Get-content $PSScriptRoot\ParentChildconfig.psd1 -Raw) -AssertParentChildDomains -configurationData $config - -$computerName1 = "sva-dsc1" -$computerName2 = "sva-dsc2" - -Start-DscConfiguration -Wait -Force -Verbose -ComputerName $computerName1 -Path $PSScriptRoot\AssertParentChildDomains -Credential $localcred -Start-DscConfiguration -Wait -Force -Verbose -ComputerName $computerName2 -Path $PSScriptRoot\AssertParentChildDomains -Credential $localcred - diff --git a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADCommon/MSFT_xADCommon.ps1 b/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADCommon/MSFT_xADCommon.ps1 deleted file mode 100644 index 5ce68dc9..00000000 --- a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADCommon/MSFT_xADCommon.ps1 +++ /dev/null @@ -1,601 +0,0 @@ -data localizedString -{ - # culture="en-US" - ConvertFrom-StringData @' - RoleNotFoundError = Please ensure that the PowerShell module for role '{0}' is installed - MembersAndIncludeExcludeError = The '{0}' and '{1}' and/or '{2}' parameters conflict. The '{0}' parameter should not be used in any combination with the '{1}' and '{2}' parameters. - MembersIsNullError = The Members parameter value is null. The '{0}' parameter must be provided if neither '{1}' nor '{2}' is provided. - MembersIsEmptyError = The Members parameter is empty. At least one group member must be provided. - IncludeAndExcludeConflictError = The member '{0}' is included in both '{1}' and '{2}' parameter values. The same member must not be included in both '{1}' and '{2}' parameter values. - IncludeAndExcludeAreEmptyError = The '{0}' and '{1}' parameters are either both null or empty. At least one member must be specified in one of these parameters. - - CheckingMembers = Checking for '{0}' members. - MembershipCountMismatch = Membership count is not correct. Expected '{0}' members, actual '{1}' members. - MemberNotInDesiredState = Member '{0}' is not in the desired state. - RemovingDuplicateMember = Removing duplicate member '{0}' definition. - MembershipInDesiredState = Membership is in the desired state. - MembershipNotDesiredState = Membership is NOT in the desired state. - CheckingDomain = Checking for domain '{0}'. - CheckingSite = Checking for site '{0}'. -'@ -} - -# Internal function to assert if the role specific module is installed or not -function Assert-Module -{ - [CmdletBinding()] - param - ( - [Parameter()] [ValidateNotNullOrEmpty()] - [System.String] $ModuleName = 'ActiveDirectory' - ) - - if (-not (Get-Module -Name $ModuleName -ListAvailable)) - { - $errorId = '{0}_ModuleNotFound' -f $ModuleName; - $errorMessage = $localizedString.RoleNotFoundError -f $moduleName; - ThrowInvalidOperationError -ErrorId $errorId -ErrorMessage $errorMessage; - } -} #end function Assert-Module - -# Internal function to test whether computer is a member of a domain -function Test-DomainMember { - [CmdletBinding()] - [OutputType([System.Boolean])] - param ( ) - $isDomainMember = [System.Boolean] (Get-CimInstance -ClassName Win32_ComputerSystem -Verbose:$false).PartOfDomain; - return $isDomainMember; -} - - -# Internal function to get the domain name of the computer -function Get-DomainName { - [CmdletBinding()] - [OutputType([System.String])] - param ( ) - $domainName = [System.String] (Get-CimInstance -ClassName Win32_ComputerSystem -Verbose:$false).Domain; - return $domainName; -} # function Get-DomainName - -# Internal function to build domain FQDN -function Resolve-DomainFQDN { - [CmdletBinding()] - param ( - [Parameter(Mandatory)] - [OutputType([System.String])] - [System.String] $DomainName, - - [Parameter()] [AllowNull()] - [System.String] $ParentDomainName - ) - $domainFQDN = $DomainName - if ($ParentDomainName) - { - $domainFQDN = '{0}.{1}' -f $DomainName, $ParentDomainName; - } - return $domainFQDN -} - -## Internal function to test/ domain availability -function Test-ADDomain -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory)] - [System.String] $DomainName, - - [Parameter()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.CredentialAttribute()] - $Credential - ) - Write-Verbose -Message ($localizedString.CheckingDomain -f $DomainName); - $ldapDomain = 'LDAP://{0}' -f $DomainName; - if ($PSBoundParameters.ContainsKey('Credential')) - { - $domain = New-Object DirectoryServices.DirectoryEntry($ldapDomain, $Credential.UserName, $Credential.GetNetworkCredential().Password); - } - else - { - $domain = New-Object DirectoryServices.DirectoryEntry($ldapDomain); - } - return ($null -ne $domain); -} - -# Internal function to get an Active Directory object's parent Distinguished Name -function Get-ADObjectParentDN -{ - <# - Copyright (c) 2016 The University Of Vermont - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, are permitted provided that - the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the - following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the - following disclaimer in the documentation and/or other materials provided with the distribution. - 3. Neither the name of the University nor the names of its contributors may be used to endorse or promote - products derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - http://www.uvm.edu/~gcd/code-license/ - #> - [CmdletBinding()] - [OutputType([System.String])] - param - ( - [Parameter(Mandatory)] - [System.String] - $DN - ) - - # https://www.uvm.edu/~gcd/2012/07/listing-parent-of-ad-object-in-powershell/ - $distinguishedNameParts = $DN -split '(? -function ConvertFrom-TimeSpan -{ - [CmdletBinding()] - [OutputType([System.Int32])] - param - ( - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [System.TimeSpan] - $TimeSpan, - - [Parameter(Mandatory)] - [ValidateSet('Seconds','Minutes','Hours','Days')] - [System.String] - $TimeSpanType - ) - switch ($TimeSpanType) - { - 'Seconds' { return $TimeSpan.TotalSeconds -as [System.UInt32] } - 'Minutes' { return $TimeSpan.TotalMinutes -as [System.UInt32] } - 'Hours' { return $TimeSpan.TotalHours -as [System.UInt32] } - 'Days' { return $TimeSpan.TotalDays -as [System.UInt32] } - } -} #end function ConvertFrom-TimeSpan - -<# - .SYNOPSIS - Returns common AD cmdlet connection parameter for splatting - .PARAMETER CommonName - When specified, a CommonName overrides theUsed by the xADUser cmdletReturns the Identity as the Name key. For example, the Get-ADUser, Set-ADUser and - Remove-ADUser cmdlets take an Identity parameter, but the New-ADUser cmdlet uses the - Name parameter. - .PARAMETER UseNameParameter - Returns the Identity as the Name key. For example, the Get-ADUser, Set-ADUser and - Remove-ADUser cmdlets take an Identity parameter, but the New-ADUser cmdlet uses the - Name parameter. - .EXAMPLE - $getADUserParams = Get-CommonADParameters @PSBoundParameters - - Returns connection parameters suitable for Get-ADUser using the splatted cmdlet - parameters. - .EXAMPLE - $newADUserParams = Get-CommonADParameters @PSBoundParameters -UseNameParameter - - Returns connection parameters suitable for New-ADUser using the splatted cmdlet - parameters. -#> -function Get-ADCommonParameters -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [Alias('UserName','GroupName','ComputerName')] - [System.String] - $Identity, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $CommonName, - - [Parameter()] - [ValidateNotNull()] - [Alias('DomainAdministratorCredential')] - [System.Management.Automation.PSCredential] - [System.Management.Automation.CredentialAttribute()] - $Credential, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [Alias('DomainController')] - [System.String] - $Server, - - [Parameter()] - [System.Management.Automation.SwitchParameter] - $UseNameParameter, - - [Parameter()] - [System.Management.Automation.SwitchParameter] - $PreferCommonName, - - ## Catch all to enable splatted $PSBoundParameters - [Parameter(ValueFromRemainingArguments)] - $RemainingArguments - ) - - if ($UseNameParameter) - { - if ($PreferCommonName -and ($PSBoundParameters.ContainsKey('CommonName'))) - { - $adConnectionParameters = @{ Name = $CommonName; } - } - else { - $adConnectionParameters = @{ Name = $Identity; } - } - } - else - { - if ($PreferCommonName -and ($PSBoundParameters.ContainsKey('CommonName'))) - { - $adConnectionParameters = @{ Identity = $CommonName; } - } - else { - $adConnectionParameters = @{ Identity = $Identity; } - } - } - - if ($Credential) - { - $adConnectionParameters['Credential'] = $Credential; - } - - if ($Server) - { - $adConnectionParameters['Server'] = $Server; - } - - return $adConnectionParameters; -} #end function Get-ADCommonParameters - -function ThrowInvalidOperationError -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [System.String] - $ErrorId, - - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [System.String] - $ErrorMessage - ) - - $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $ErrorMessage; - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidOperation; - $errorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord -ArgumentList $exception, $ErrorId, $errorCategory, $null; - throw $errorRecord; -} - -function ThrowInvalidArgumentError -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [System.String] - $ErrorId, - - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [System.String] - $ErrorMessage - ) - - $exception = New-Object -TypeName System.ArgumentException -ArgumentList $ErrorMessage; - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidArgument; - $errorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord -ArgumentList $exception, $ErrorId, $errorCategory, $null; - throw $errorRecord; - -} #end function ThrowInvalidArgumentError - -## Internal function to test site availability -function Test-ADReplicationSite -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory)] - [System.String] $SiteName, - - [Parameter(Mandatory)] - [System.String] $DomainName, - - [Parameter()] - [System.Management.Automation.PSCredential] - $Credential - ) - - Write-Verbose -Message ($localizedString.CheckingSite -f $SiteName); - - $existingDC = "$((Get-ADDomainController -Discover -DomainName $DomainName -ForceDiscover).HostName)"; - - try - { - $site = Get-ADReplicationSite -Identity $SiteName -Server $existingDC -Credential $Credential; - } - catch [Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException] - { - return $false; - } - - return ($null -ne $site); -} diff --git a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADCommon/MSFT_xADCommon.psm1 b/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADCommon/MSFT_xADCommon.psm1 deleted file mode 100644 index 86038565..00000000 --- a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADCommon/MSFT_xADCommon.psm1 +++ /dev/null @@ -1,4 +0,0 @@ -## Import all .ps1 files to enable testing using the unit test framework -Get-ChildItem -Path $PSScriptRoot -Include '*.ps1' -Recurse | ForEach-Object { - . $PSItem.FullName; -} diff --git a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADComputer/MSFT_xADComputer.psm1 b/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADComputer/MSFT_xADComputer.psm1 deleted file mode 100644 index c28cc143..00000000 --- a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADComputer/MSFT_xADComputer.psm1 +++ /dev/null @@ -1,521 +0,0 @@ -$moduleRoot = Split-Path -Path $MyInvocation.MyCommand.Path -Parent -#region LocalizedData -$culture = 'en-us' -if (Test-Path -Path (Join-Path -Path $moduleRoot -ChildPath $PSUICulture)) -{ - $culture = $PSUICulture -} -$importLocalizedDataParams = @{ - BindingVariable = 'LocalizedData' - Filename = 'MSFT_xADComputer.psd1' - BaseDirectory = $moduleRoot - UICulture = $culture -} -Import-LocalizedData @importLocalizedDataParams -#endregion - -## Create a property map that maps the DSC resource parameters to the -## Active Directory computer attributes. -$adPropertyMap = @( - @{ Parameter = 'ComputerName'; ADProperty = 'cn'; } - @{ Parameter = 'Location'; } - @{ Parameter = 'DnsHostName'; } - @{ Parameter = 'ServicePrincipalNames'; } - @{ Parameter = 'UserPrincipalName'; } - @{ Parameter = 'DisplayName'; } - @{ Parameter = 'Path'; ADProperty = 'distinguishedName'; } - @{ Parameter = 'Description'; } - @{ Parameter = 'Enabled'; } - @{ Parameter = 'Manager'; ADProperty = 'managedBy'; } -) - - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - # Common Name - [Parameter(Mandatory)] - [System.String] $ComputerName, - - [ValidateSet('Present', 'Absent')] - [System.String] $Ensure = 'Present', - - [ValidateNotNull()] - [System.String] $UserPrincipalName, - - [ValidateNotNull()] - [System.String] $DisplayName, - - [ValidateNotNull()] - [System.String] $Path, - - [ValidateNotNull()] - [System.String] $Location, - - [ValidateNotNull()] - [System.String] $DnsHostName, - - [ValidateNotNull()] - [System.String[]] $ServicePrincipalNames, - - [ValidateNotNull()] - [System.String] $Description, - - ## Computer's manager specified as a Distinguished Name (DN) - [ValidateNotNull()] - [System.String] $Manager, - - [ValidateNotNull()] - [System.String] $RequestFile, - - [ValidateNotNull()] - [System.Boolean] $Enabled = $true, - - [ValidateNotNull()] - [System.String] $DomainController, - - ## Ideally this should just be called 'Credential' but is here for consistency with xADUser - [ValidateNotNull()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.CredentialAttribute()] - $DomainAdministratorCredential - ) - - Assert-Module -ModuleName 'ActiveDirectory'; - Import-Module -Name 'ActiveDirectory' -Verbose:$false; - - try - { - $adCommonParameters = Get-ADCommonParameters @PSBoundParameters; - - $adProperties = @(); - ## Create an array of the AD property names to retrieve from the property map - foreach ($property in $adPropertyMap) - { - - if ($property.ADProperty) - { - $adProperties += $property.ADProperty; - } - else - { - $adProperties += $property.Parameter; - } - } - - Write-Verbose -Message ($LocalizedData.RetrievingADComputer -f $ComputerName); - $adComputer = Get-ADComputer @adCommonParameters -Properties $adProperties; - Write-Verbose -Message ($LocalizedData.ADComputerIsPresent -f $ComputerName); - $Ensure = 'Present'; - } - catch [Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException] - { - Write-Verbose -Message ($LocalizedData.ADComputerNotPresent -f $ComputerName); - $Ensure = 'Absent'; - } - catch - { - Write-Error -Message ($LocalizedData.RetrievingADComputerError -f $ComputerName); - throw $_; - } - - $targetResource = @{ - ComputerName = $ComputerName; - DistinguishedName = $adComputer.DistinguishedName; ## Read-only property - SID = $adComputer.SID; ## Read-only property - Ensure = $Ensure; - DomainController = $DomainController; - RequestFile = $RequestFile; - } - - ## Retrieve each property from the ADPropertyMap and add to the hashtable - foreach ($property in $adPropertyMap) - { - $propertyName = $property.Parameter; - if ($propertyName -eq 'Path') { - ## The path returned is not the parent container - if (-not [System.String]::IsNullOrEmpty($adComputer.DistinguishedName)) - { - $targetResource['Path'] = Get-ADObjectParentDN -DN $adComputer.DistinguishedName; - } - } - elseif ($property.ADProperty) - { - ## The AD property name is different to the function parameter to use this - $targetResource[$propertyName] = $adComputer.($property.ADProperty); - } - else - { - ## The AD property name matches the function parameter - if ($adComputer.$propertyName -is [Microsoft.ActiveDirectory.Management.ADPropertyValueCollection]) - { - $targetResource[$propertyName] = $adComputer.$propertyName -as [System.String[]]; - } - else - { - $targetResource[$propertyName] = $adComputer.$propertyName; - } - } - } - return $targetResource; - -} #end function Get-TargetResource - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - # Common Name - [Parameter(Mandatory)] - [System.String] $ComputerName, - - [ValidateSet('Present', 'Absent')] - [System.String] $Ensure = 'Present', - - [ValidateNotNull()] - [System.String] $UserPrincipalName, - - [ValidateNotNull()] - [System.String] $DisplayName, - - [ValidateNotNull()] - [System.String] $Path, - - [ValidateNotNull()] - [System.String] $Location, - - [ValidateNotNull()] - [System.String] $DnsHostName, - - [ValidateNotNull()] - [System.String[]] $ServicePrincipalNames, - - [ValidateNotNull()] - [System.String] $Description, - - ## Computer's manager specified as a Distinguished Name (DN) - [ValidateNotNull()] - [System.String] $Manager, - - [ValidateNotNull()] - [System.String] $RequestFile, - - [ValidateNotNull()] - [System.Boolean] $Enabled = $true, - - [ValidateNotNull()] - [System.String] $DomainController, - - ## Ideally this should just be called 'Credential' but is here for backwards compatibility - [ValidateNotNull()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.CredentialAttribute()] - $DomainAdministratorCredential - ) - - $targetResource = Get-TargetResource @PSBoundParameters; - $isCompliant = $true; - - if ($Ensure -eq 'Absent') - { - if ($targetResource.Ensure -eq 'Present') - { - Write-Verbose -Message ($LocalizedData.ADComputerNotDesiredPropertyState -f ` - 'Ensure', $PSBoundParameters.Ensure, $targetResource.Ensure); - $isCompliant = $false; - } - } - else - { - ## Add ensure and enabled as they may not be explicitly passed and we want to enumerate them - $PSBoundParameters['Ensure'] = $Ensure; - $PSBoundParameters['Enabled'] = $Enabled; - - foreach ($parameter in $PSBoundParameters.Keys) - { - if ($targetResource.ContainsKey($parameter)) - { - ## This check is required to be able to explicitly remove values with an empty string, if required - if (([System.String]::IsNullOrEmpty($PSBoundParameters.$parameter)) -and - ([System.String]::IsNullOrEmpty($targetResource.$parameter))) - { - # Both values are null/empty and therefore we are compliant - } - elseif ($parameter -eq 'ServicePrincipalNames') - { - $testMembersParams = @{ - ExistingMembers = $targetResource.ServicePrincipalNames -as [System.String[]]; - Members = $ServicePrincipalNames; - } - if (-not (Test-Members @testMembersParams)) - { - $existingSPNs = $testMembersParams['ExistingMembers'] -join ','; - $desiredSPNs = $ServicePrincipalNames -join ','; - Write-Verbose -Message ($LocalizedData.ADComputerNotDesiredPropertyState -f ` - 'ServicePrincipalNames', $desiredSPNs, $existingSPNs); - $isCompliant = $false; - } - } - elseif ($PSBoundParameters.$parameter -ne $targetResource.$parameter) - { - Write-Verbose -Message ($LocalizedData.ADComputerNotDesiredPropertyState -f ` - $parameter, $PSBoundParameters.$parameter, $targetResource.$parameter); - $isCompliant = $false; - } - } - } #end foreach PSBoundParameter - } - - if ($isCompliant) - { - Write-Verbose -Message ($LocalizedData.ADComputerInDesiredState -f $ComputerName) - return $true - } - else - { - Write-Verbose -Message ($LocalizedData.ADComputerNotInDesiredState -f $ComputerName) - return $false - } - -} #end function Test-TargetResource - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - # Common Name - [Parameter(Mandatory)] - [System.String] $ComputerName, - - [ValidateSet('Present', 'Absent')] - [System.String] $Ensure = 'Present', - - [ValidateNotNull()] - [System.String] $UserPrincipalName, - - [ValidateNotNull()] - [System.String] $DisplayName, - - [ValidateNotNull()] - [System.String] $Path, - - [ValidateNotNull()] - [System.String] $Location, - - [ValidateNotNull()] - [System.String] $DnsHostName, - - [ValidateNotNull()] - [System.String[]] $ServicePrincipalNames, - - [ValidateNotNull()] - [System.String] $Description, - - ## Computer's manager specified as a Distinguished Name (DN) - [ValidateNotNull()] - [System.String] $Manager, - - [ValidateNotNull()] - [System.String] $RequestFile, - - [ValidateNotNull()] - [System.Boolean] $Enabled = $true, - - [ValidateNotNull()] - [System.String] $DomainController, - - ## Ideally this should just be called 'Credential' but is here for backwards compatibility - [ValidateNotNull()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.CredentialAttribute()] - $DomainAdministratorCredential - ) - - $targetResource = Get-TargetResource @PSBoundParameters; - - ## Add ensure and enabled as they may not be explicitly passed and we want to enumerate them - $PSBoundParameters['Ensure'] = $Ensure; - $PSBoundParameters['Enabled'] = $Enabled; - - if ($Ensure -eq 'Present') - { - if ($targetResource.Ensure -eq 'Absent') { - ## Computer does not exist and needs creating - if ($RequestFile) - { - ## Use DJOIN to create the computer account as well as the ODJ Request file. - Write-Verbose -Message ($LocalizedData.ODJRequestStartMessage -f ` - $DomainName,$ComputerName,$RequestFile) - - # This should only be performed on a Domain Member, so detect the Domain Name. - $DomainName = Get-DomainName - $DJoinParameters = @( - '/PROVISION' - '/DOMAIN',$DomainName - '/MACHINE',$ComputerName ) - if ($PSBoundParameters.ContainsKey('Path')) - { - $DJoinParameters += @( '/MACHINEOU',$Path ) - } # if - - if ($PSBoundParameters.ContainsKey('DomainController')) - { - $DJoinParameters += @( '/DCNAME',$DomainController ) - } # if - - $DJoinParameters += @( '/SAVEFILE',$RequestFile ) - $Result = & djoin.exe @DjoinParameters - - if ($LASTEXITCODE -ne 0) - { - $errorId = 'ODJRequestError' - $errorMessage = $($LocalizedData.ODJRequestError ` - -f $LASTEXITCODE,$Result) - ThrowInvalidOperationError -ErrorId $errorId -ErrorMessage $errorMessage - } # if - - Write-Verbose -Message ($LocalizedData.ODJRequestCompleteMessage -f ` - $DomainName,$ComputerName,$RequestFile) - } - else - { - ## Create the computer account using New-ADComputer - $newADComputerParams = Get-ADCommonParameters @PSBoundParameters -UseNameParameter; - if ($PSBoundParameters.ContainsKey('Path')) - { - Write-Verbose -Message ($LocalizedData.UpdatingADComputerProperty -f 'Path', $Path); - $newADComputerParams['Path'] = $Path; - } - Write-Verbose -Message ($LocalizedData.AddingADComputer -f $ComputerName); - New-ADComputer @newADComputerParams; - } # if - ## Now retrieve the newly created computer - $targetResource = Get-TargetResource @PSBoundParameters; - } - - $setADComputerParams = Get-ADCommonParameters @PSBoundParameters; - $replaceComputerProperties = @{}; - $removeComputerProperties = @{}; - foreach ($parameter in $PSBoundParameters.Keys) - { - ## Only check/action properties specified/declared parameters that match one of the function's - ## parameters. This will ignore common parameters such as -Verbose etc. - if ($targetResource.ContainsKey($parameter)) - { - if ($parameter -eq 'Path' -and ($PSBoundParameters.Path -ne $targetResource.Path)) - { - ## Cannot move computers by updating the DistinguishedName property - $adCommonParameters = Get-ADCommonParameters @PSBoundParameters; - ## Using the SamAccountName for identity with Move-ADObject does not work, use the DN instead - $adCommonParameters['Identity'] = $targetResource.DistinguishedName; - Write-Verbose -Message ($LocalizedData.MovingADComputer -f ` - $targetResource.Path, $PSBoundParameters.Path); - Move-ADObject @adCommonParameters -TargetPath $PSBoundParameters.Path; - } - elseif ($parameter -eq 'ServicePrincipalNames') - { - Write-Verbose -Message ($LocalizedData.UpdatingADComputerProperty -f ` - 'ServicePrincipalNames', ($ServicePrincipalNames -join ',')); - $replaceComputerProperties['ServicePrincipalName'] = $ServicePrincipalNames; - } - elseif ($parameter -eq 'Enabled' -and ($PSBoundParameters.$parameter -ne $targetResource.$parameter)) - { - ## We cannot enable/disable an account with -Add or -Replace parameters, but inform that - ## we will change this as it is out of compliance (it always gets set anyway) - Write-Verbose -Message ($LocalizedData.UpdatingADComputerProperty -f ` - $parameter, $PSBoundParameters.$parameter); - } - elseif ($PSBoundParameters.$parameter -ne $targetResource.$parameter) - { - ## Find the associated AD property - $adProperty = $adPropertyMap | Where-Object { $_.Parameter -eq $parameter }; - - if ([System.String]::IsNullOrEmpty($adProperty)) - { - ## We can't do anything with an empty AD property! - } - elseif ([System.String]::IsNullOrEmpty($PSBoundParameters.$parameter)) - { - ## We are removing properties - ## Only remove if the existing value in not null or empty - if (-not ([System.String]::IsNullOrEmpty($targetResource.$parameter))) - { - Write-Verbose -Message ($LocalizedData.RemovingADComputerProperty -f ` - $parameter, $PSBoundParameters.$parameter); - if ($adProperty.UseCmdletParameter -eq $true) - { - ## We need to pass the parameter explicitly to Set-ADComputer, not via -Remove - $setADComputerParams[$adProperty.Parameter] = $PSBoundParameters.$parameter; - } - elseif ([System.String]::IsNullOrEmpty($adProperty.ADProperty)) - { - $removeComputerProperties[$adProperty.Parameter] = $targetResource.$parameter; - } - else - { - $removeComputerProperties[$adProperty.ADProperty] = $targetResource.$parameter; - } - } - } #end if remove existing value - else - { - ## We are replacing the existing value - Write-Verbose -Message ($LocalizedData.UpdatingADComputerProperty -f ` - $parameter, $PSBoundParameters.$parameter); - if ($adProperty.UseCmdletParameter -eq $true) - { - ## We need to pass the parameter explicitly to Set-ADComputer, not via -Replace - $setADComputerParams[$adProperty.Parameter] = $PSBoundParameters.$parameter; - } - elseif ([System.String]::IsNullOrEmpty($adProperty.ADProperty)) - { - $replaceComputerProperties[$adProperty.Parameter] = $PSBoundParameters.$parameter; - } - else - { - $replaceComputerProperties[$adProperty.ADProperty] = $PSBoundParameters.$parameter; - } - } #end if replace existing value - } - - } #end if TargetResource parameter - } #end foreach PSBoundParameter - - ## Only pass -Remove and/or -Replace if we have something to set/change - if ($replaceComputerProperties.Count -gt 0) - { - $setADComputerParams['Replace'] = $replaceComputerProperties; - } - if ($removeComputerProperties.Count -gt 0) - { - $setADComputerParams['Remove'] = $removeComputerProperties; - } - - Write-Verbose -Message ($LocalizedData.UpdatingADComputer -f $ComputerName); - [ref] $null = Set-ADComputer @setADComputerParams -Enabled $Enabled; - } - elseif (($Ensure -eq 'Absent') -and ($targetResource.Ensure -eq 'Present')) - { - ## User exists and needs removing - Write-Verbose ($LocalizedData.RemovingADComputer -f $ComputerName); - $adCommonParameters = Get-ADCommonParameters @PSBoundParameters; - [ref] $null = Remove-ADComputer @adCommonParameters -Confirm:$false; - } - -} #end function Set-TargetResource - -## Import the common AD functions -$adCommonFunctions = Join-Path ` - -Path (Split-Path -Path $PSScriptRoot -Parent) ` - -ChildPath '\MSFT_xADCommon\MSFT_xADCommon.ps1'; -. $adCommonFunctions; - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADComputer/MSFT_xADComputer.schema.mof b/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADComputer/MSFT_xADComputer.schema.mof deleted file mode 100644 index d2fdfce7..00000000 --- a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADComputer/MSFT_xADComputer.schema.mof +++ /dev/null @@ -1,20 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xADComputer")] -class MSFT_xADComputer : OMI_BaseResource -{ - [Key, Description("Specifies the name of the computer")] String ComputerName; - [Write, Description("Specifies the location of the computer, such as an office number")] String Location; - [Write, Description("Specifies the fully qualified domain name (FQDN) of the computer")] String DnsHostName; - [Write, Description("Specifies the service principal names for the computer account")] String ServicePrincipalNames[]; - [Write, Description("Specifies the UPN assigned to the computer account")] String UserPrincipalName; - [Write, Description("Specifies the display name of the computer")] String DisplayName; - [Write, Description("Specifies the X.500 path of the Organizational Unit (OU) or container where the computer is located")] String Path; - [Write, Description("Specifies a description of the computer object")] String Description; - [Write, Description("Specifies if the computer account is enabled")] Boolean Enabled; - [Write, Description("Specifies the user or group Distinguished Name that manages the computer object")] String Manager; - [Write, Description("Specifies the Active Directory Domain Services instance to connect to perform the task")] String DomainController; - [Write, Description("Specifies the user account credentials to use to perform the task"), EmbeddedInstance("MSFT_Credential")] String DomainAdministratorCredential; - [Write, Description("Specifies the full path to the Offline Domain Join Request file to create.")] String RequestFile; - [Write, ValueMap{"Present", "Absent"},Values{"Present", "Absent"}] String Ensure; - [Read, Description("Returns the X.500 path of the computer object")] String DistinguishedName; - [Read, Description("Returns the security identifier of the computer object")] String SID; -}; diff --git a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADComputer/en-US/MSFT_xADComputer.psd1 b/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADComputer/en-US/MSFT_xADComputer.psd1 deleted file mode 100644 index acb3811c..00000000 --- a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADComputer/en-US/MSFT_xADComputer.psd1 +++ /dev/null @@ -1,25 +0,0 @@ -# culture="en-US" -ConvertFrom-StringData @' - RoleNotFoundError = Please ensure that the PowerShell module for role '{0}' is installed. - RetrievingADComputerError = Error looking up Active Directory computer '{0}'. - - RetrievingADComputer = Retrieving Active Directory computer '{0}' ... - CreatingADDomainConnection = Creating connection to Active Directory domain ... - ADComputerIsPresent = Active Directory computer '{0}' is present. - ADComputerNotPresent = Active Directory computer '{0}' was NOT present. - ADComputerNotDesiredPropertyState = Computer '{0}' property is NOT in the desired state. Expected '{1}', actual '{2}'. - ADComputerInDesiredState = Active Directory computer '{0}' is in the desired state. - ADComputerNotInDesiredState = Active Directory computer '{0}' is NOT in the desired state. - - AddingADComputer = Adding Active Directory computer '{0}'. - RemovingADComputer = Removing Active Directory computer '{0}'. - UpdatingADComputer = Updating Active Directory computer '{0}'. - UpdatingADComputerProperty = Updating computer property '{0}' with/to '{1}'. - RemovingADComputerProperty = Removing computer property '{0}' with '{1}'. - MovingADComputer = Moving computer from '{0}' to '{1}'. - RenamingADComputer = Renaming computer from '{0}' to '{1}'. - - ODJRequestStartMessage=Attempting to create the ODJ request file '{2}' for computer '{1}' in Domain '{0}'. - ODJRequestCompleteMessage=The ODJ request file '{2}' for computer '{1}' in Domain '{0}' has been provisioned successfully. - ODJRequestError=Error {0} occured provisioning the computer using ODJ- {1}. -'@ diff --git a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADDomain/MSFT_xADDomain.psm1 b/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADDomain/MSFT_xADDomain.psm1 deleted file mode 100644 index 29fc8cf8..00000000 --- a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADDomain/MSFT_xADDomain.psm1 +++ /dev/null @@ -1,347 +0,0 @@ -# Localized messages -data localizedData -{ - # culture="en-US" - ConvertFrom-StringData @' - RoleNotFoundError = Please ensure that the PowerShell module for role '{0}' is installed. - InvalidDomainError = Computer is a member of the wrong domain?! - ExistingDomainMemberError = Computer is already a domain member. Cannot create a new '{0}' domain? - InvalidCredentialError = Domain '{0}' is available, but invalid credentials were supplied. - - QueryDomainWithLocalCredential = Computer is a domain member; querying domain '{0}' using local credential ... - QueryDomainWithCredential = Computer is a workgroup member; querying for domain '{0}' using supplied credential ... - DomainFound = Active Directory domain '{0}' found. - DomainNotFound = Active Directory domain '{0}' cannot be found. - CreatingChildDomain = Creating domain '{0}' as a child of domain '{1}' ... - CreatedChildDomain = Child domain '{0}' created. - CreatingForest = Creating AD forest '{0}' ... - CreatedForest = AD forest '{0}' created. - ResourcePropertyValueIncorrect = Property '{0}' value is incorrect; expected '{1}', actual '{2}'. - ResourceInDesiredState = Resource '{0}' is in the desired state. - ResourceNotInDesiredState = Resource '{0}' is NOT in the desired state. - RetryingGetADDomain = Attempt {0} of {1} to call Get-ADDomain failed, retrying in {2} seconds. - UnhandledError = Unhandled error occured, detail here: {0} - FaultExceptionAndDomainShouldExist = ServiceModel FaultException detected and domain should exist, performing retry... -'@ -} - -<# - .SYNOPSIS - Retrieves the name of the file that tracks the status of the xADDomain resource with the - specified domain name. - - .PARAMETER DomainName - The domain name of the xADDomain resource to retrieve the tracking file name of. - - .NOTES - The tracking file is currently output to the environment's temp directory. - - This file is NOT removed when a configuration completes, so if another call to a xADDomain - resource with the same domain name occurs in the same environment, this file will already - be present. - - This is so that when another call is made to the same resource, the resource will not - attempt to promote the machine to a domain controller again (which would cause an error). - - If the resource should be promoted to a domain controller once again, you must first remove - this file from the environment's temp directory (usually C:\Temp). - - If in the future this functionality needs to change so that future configurations are not - affected, $env:temp should be changed to the resource's cache location which is removed - after each configuration. - ($env:systemRoot\system32\Configuration\BuiltinProvCache\MSFT_xADDomain) -#> -function Get-TrackingFilename { - [OutputType([String])] - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [String] - $DomainName - ) - - return Join-Path -Path ($env:temp) -ChildPath ('{0}.xADDomain.completed' -f $DomainName) -} - -function Get-TargetResource -{ - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory)] - [String] $DomainName, - - [Parameter(Mandatory)] - [PSCredential] $DomainAdministratorCredential, - - [Parameter(Mandatory)] - [PSCredential] $SafemodeAdministratorPassword, - - [Parameter()] [ValidateNotNullOrEmpty()] - [String] $ParentDomainName, - - [Parameter()] [ValidateNotNullOrEmpty()] - [String] $DomainNetBIOSName, - - [Parameter()] [ValidateNotNullOrEmpty()] - [PSCredential] $DnsDelegationCredential, - - [Parameter()] [ValidateNotNullOrEmpty()] - [String] $DatabasePath, - - [Parameter()] [ValidateNotNullOrEmpty()] - [String] $LogPath, - - [Parameter()] [ValidateNotNullOrEmpty()] - [String] $SysvolPath - ) - - Assert-Module -ModuleName 'ADDSDeployment'; - $domainFQDN = Resolve-DomainFQDN -DomainName $DomainName -ParentDomainName $ParentDomainName; - $isDomainMember = Test-DomainMember; - - $retries = 0 - $maxRetries = 5 - $retryIntervalInSeconds = 30 - $domainShouldExist = (Test-Path (Get-TrackingFilename -DomainName $DomainName)) - do { - try - { - if ($isDomainMember) { - ## We're already a domain member, so take the credentials out of the equation - Write-Verbose ($localizedData.QueryDomainADWithLocalCredentials -f $domainFQDN); - $domain = Get-ADDomain -Identity $domainFQDN -ErrorAction Stop; - } - else { - Write-Verbose ($localizedData.QueryDomainWithCredential -f $domainFQDN); - $domain = Get-ADDomain -Identity $domainFQDN -Credential $DomainAdministratorCredential -ErrorAction Stop; - } - - ## No need to check whether the node is actually a domain controller. If we don't throw an exception, - ## the domain is already UP - and this resource shouldn't run. Domain controller functionality - ## should be checked by the xADDomainController resource? - Write-Verbose ($localizedData.DomainFound -f $domain.DnsRoot); - - $targetResource = @{ - DomainName = $domain.DnsRoot; - ParentDomainName = $domain.ParentDomain; - DomainNetBIOSName = $domain.NetBIOSName; - } - - return $targetResource; - } - catch [Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException] - { - $errorMessage = $localizedData.ExistingDomainMemberError -f $DomainName; - ThrowInvalidOperationError -ErrorId 'xADDomain_DomainMember' -ErrorMessage $errorMessage; - } - catch [Microsoft.ActiveDirectory.Management.ADServerDownException] - { - Write-Verbose ($localizedData.DomainNotFound -f $domainFQDN) - $domain = @{ }; - # will fall into retry mechanism - } - catch [System.Security.Authentication.AuthenticationException] - { - $errorMessage = $localizedData.InvalidCredentialError -f $DomainName; - ThrowInvalidOperationError -ErrorId 'xADDomain_InvalidCredential' -ErrorMessage $errorMessage; - } - catch - { - $errorMessage = $localizedData.UnhandledError -f ($_.Exception | Format-List -Force | Out-String) - Write-Verbose $errorMessage - - if ($domainShouldExist -and ($_.Exception.InnerException -is [System.ServiceModel.FaultException])) - { - Write-Verbose $localizedData.FaultExceptionAndDomainShouldExist - # will fall into retry mechanism - } else { - ## Not sure what's gone on here! - throw $_ - } - } - - if($domainShouldExist) { - $retries++ - Write-Verbose ($localizedData.RetryingGetADDomain -f $retries, $maxRetries, $retryIntervalInSeconds) - Start-Sleep -Seconds ($retries * $retryIntervalInSeconds) - } - - } while ($domainShouldExist -and ($retries -le $maxRetries) ) - -} #end function Get-TargetResource - -function Test-TargetResource -{ - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory)] - [String] $DomainName, - - [Parameter(Mandatory)] - [PSCredential] $DomainAdministratorCredential, - - [Parameter(Mandatory)] - [PSCredential] $SafemodeAdministratorPassword, - - [Parameter()] [ValidateNotNullOrEmpty()] - [String] $ParentDomainName, - - [Parameter()] [ValidateNotNullOrEmpty()] - [String] $DomainNetBIOSName, - - [Parameter()] [ValidateNotNullOrEmpty()] - [PSCredential] $DnsDelegationCredential, - - [Parameter()] [ValidateNotNullOrEmpty()] - [String] $DatabasePath, - - [Parameter()] [ValidateNotNullOrEmpty()] - [String] $LogPath, - - [Parameter()] [ValidateNotNullOrEmpty()] - [String] $SysvolPath - ) - - $targetResource = Get-TargetResource @PSBoundParameters - $isCompliant = $true; - - ## The Get-Target resource returns .DomainName as the domain's FQDN. Therefore, we - ## need to resolve this before comparison. - $domainFQDN = Resolve-DomainFQDN -DomainName $DomainName -ParentDomainName $ParentDomainName - if ($domainFQDN -ne $targetResource.DomainName) - { - $message = $localizedData.ResourcePropertyValueIncorrect -f 'DomainName', $domainFQDN, $targetResource.DomainName; - Write-Verbose -Message $message; - $isCompliant = $false; - } - - $propertyNames = @('ParentDomainName','DomainNetBIOSName'); - foreach ($propertyName in $propertyNames) - { - if ($PSBoundParameters.ContainsKey($propertyName)) - { - $propertyValue = (Get-Variable -Name $propertyName).Value; - if ($targetResource.$propertyName -ne $propertyValue) - { - $message = $localizedData.ResourcePropertyValueIncorrect -f $propertyName, $propertyValue, $targetResource.$propertyName; - Write-Verbose -Message $message; - $isCompliant = $false; - } - } - } - - if ($isCompliant) - { - Write-Verbose -Message ($localizedData.ResourceInDesiredState -f $domainFQDN); - return $true; - } - else - { - Write-Verbose -Message ($localizedData.ResourceNotInDesiredState -f $domainFQDN); - return $false; - } - -} #end function Test-TargetResource - -function Set-TargetResource -{ - param - ( - [Parameter(Mandatory)] - [String] $DomainName, - - [Parameter(Mandatory)] - [PSCredential] $DomainAdministratorCredential, - - [Parameter(Mandatory)] - [PSCredential] $SafemodeAdministratorPassword, - - [Parameter()] [ValidateNotNullOrEmpty()] - [String] $ParentDomainName, - - [Parameter()] [ValidateNotNullOrEmpty()] - [String] $DomainNetBIOSName, - - [Parameter()] [ValidateNotNullOrEmpty()] - [PSCredential] $DnsDelegationCredential, - - [Parameter()] [ValidateNotNullOrEmpty()] - [String] $DatabasePath, - - [Parameter()] [ValidateNotNullOrEmpty()] - [String] $LogPath, - - [Parameter()] [ValidateNotNullOrEmpty()] - [String] $SysvolPath - ) - - # Debug can pause Install-ADDSForest/Install-ADDSDomain, so we remove it. - [ref] $null = $PSBoundParameters.Remove("Debug"); - ## Not entirely necessary, but run Get-TargetResouece to ensure we raise any pre-flight errors. - $targetResource = Get-TargetResource @PSBoundParameters; - - $installADDSParams = @{ - SafeModeAdministratorPassword = $SafemodeAdministratorPassword.Password; - NoRebootOnCompletion = $true; - Force = $true; - } - - if ($PSBoundParameters.ContainsKey('DnsDelegationCredential')) - { - $installADDSParams['DnsDelegationCredential'] = $DnsDelegationCredential; - $installADDSParams['CreateDnsDelegation'] = $true; - } - if ($PSBoundParameters.ContainsKey('DatabasePath')) - { - $installADDSParams['DatabasePath'] = $DatabasePath; - } - if ($PSBoundParameters.ContainsKey('LogPath')) - { - $installADDSParams['LogPath'] = $LogPath; - } - if ($PSBoundParameters.ContainsKey('SysvolPath')) - { - $installADDSParams['SysvolPath'] = $SysvolPath; - } - - if ($PSBoundParameters.ContainsKey('ParentDomainName')) - { - Write-Verbose -Message ($localizedData.CreatingChildDomain -f $DomainName, $ParentDomainName); - $installADDSParams['Credential'] = $DomainAdministratorCredential - $installADDSParams['NewDomainName'] = $DomainName - $installADDSParams['ParentDomainName'] = $ParentDomainName - $installADDSParams['DomainType'] = 'ChildDomain'; - if ($PSBoundParameters.ContainsKey('DomainNetBIOSName')) - { - $installADDSParams['NewDomainNetbiosName'] = $DomainNetBIOSName; - } - Install-ADDSDomain @installADDSParams; - Write-Verbose -Message ($localizedData.CreatedChildDomain); - } - else - { - Write-Verbose -Message ($localizedData.CreatingForest -f $DomainName); - $installADDSParams['DomainName'] = $DomainName; - if ($PSBoundParameters.ContainsKey('DomainNetbiosName')) - { - $installADDSParams['DomainNetbiosName'] = $DomainNetBIOSName; - } - Install-ADDSForest @installADDSParams; - Write-Verbose -Message ($localizedData.CreatedForest -f $DomainName); - } - - "Finished" | Out-File -FilePath (Get-TrackingFilename -DomainName $DomainName) -Force - - # Signal to the LCM to reboot the node to compensate for the one we - # suppressed from Install-ADDSForest/Install-ADDSDomain - $global:DSCMachineStatus = 1 - -} #end function Set-TargetResource - -## Import the common AD functions -$adCommonFunctions = Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -ChildPath '\MSFT_xADCommon\MSFT_xADCommon.ps1'; -. $adCommonFunctions; - -Export-ModuleMember -Function *-TargetResource; diff --git a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADDomain/MSFT_xADDomain.schema.mof b/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADDomain/MSFT_xADDomain.schema.mof deleted file mode 100644 index 47c01842..00000000 --- a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADDomain/MSFT_xADDomain.schema.mof +++ /dev/null @@ -1,13 +0,0 @@ -[ClassVersion("1.0.1.0"), FriendlyName("xADDomain")] -class MSFT_xADDomain : OMI_BaseResource -{ - [Key, Description("Name of the domain to which the user will be added")] String DomainName; - [Required, Description("Credentials used to query for domain existence"), EmbeddedInstance("MSFT_Credential")] String DomainAdministratorCredential; - [Required, Description("Password for the administrator account when the computer is started in Safe Mode"), EmbeddedInstance("MSFT_Credential")] String SafemodeAdministratorPassword; - [Write, Description("Fully qualified name of the parent domain")] String ParentDomainName; - [Write, Description("NetBIOS name for the new domain")] String DomainNetbiosName; - [Write, Description("Credential used for creating DNS delegation"), EmbeddedInstance("MSFT_Credential")] String DnsDelegationCredential; - [Write, Description("Path to a directory that contains the domain database")] String DatabasePath; - [Write, Description("Path to a directory for the log file that will be written")] String LogPath; - [Write, Description("Path to a directory where the Sysvol file will be written")] String SysvolPath; -}; diff --git a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADDomainController/MSFT_xADDomainController.psm1 b/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADDomainController/MSFT_xADDomainController.psm1 deleted file mode 100644 index 1d6dd83b..00000000 --- a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADDomainController/MSFT_xADDomainController.psm1 +++ /dev/null @@ -1,224 +0,0 @@ -# -# xADDomainController: DSC resource to install a domain controller in Active -# Directory. -# - -function Get-TargetResource -{ - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory)] - [String]$DomainName, - - [Parameter(Mandatory)] - [PSCredential]$DomainAdministratorCredential, - - [Parameter(Mandatory)] - [PSCredential]$SafemodeAdministratorPassword, - - [String]$DatabasePath, - - [String]$LogPath, - - [String]$SysvolPath, - - [String]$SiteName - ) - - $returnValue = @{ - DomainName = $DomainName - Ensure = $false - } - - try - { - Write-Verbose -Message "Resolving '$($DomainName)' ..." - $domain = Get-ADDomain -Identity $DomainName -Credential $DomainAdministratorCredential - if ($domain -ne $null) - { - Write-Verbose -Message "Domain '$($DomainName)' is present. Looking for DCs ..." - try - { - $dc = Get-ADDomainController -Identity $env:COMPUTERNAME -Credential $DomainAdministratorCredential - Write-Verbose -Message "Found domain controller '$($dc.Name)' in domain '$($dc.Domain)'." - if ($dc.Domain -eq $DomainName) - { - Write-Verbose -Message "Current node '$($dc.Name)' is already a domain controller for domain '$($dc.Domain)'." - - $serviceNTDS = Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\NTDS\Parameters' - $serviceNETLOGON = Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon\Parameters' - - $returnValue.Ensure = $true - $returnValue.DatabasePath = $serviceNTDS.'DSA Working Directory' - $returnValue.LogPath = $serviceNTDS.'Database log files path' - $returnValue.SysvolPath = $serviceNETLOGON.SysVol -replace '\\sysvol$', '' - $returnValue.SiteName = $dc.Site - } - } - catch - { - if ($error[0]) {Write-Verbose $error[0].Exception} - Write-Verbose -Message "Current node does not host a domain controller." - } - } - } - catch [System.Management.Automation.CommandNotFoundException] - { - if ($error[0]) {Write-Verbose $error[0].Exception} - Write-Verbose -Message "Current node is not running AD WS, and hence is not a domain controller." - } - $returnValue -} - -function Set-TargetResource -{ - param - ( - [Parameter(Mandatory)] - [String]$DomainName, - - [Parameter(Mandatory)] - [PSCredential]$DomainAdministratorCredential, - - [Parameter(Mandatory)] - [PSCredential]$SafemodeAdministratorPassword, - - [String]$DatabasePath, - - [String]$LogPath, - - [String]$SysvolPath, - - [String]$SiteName - ) - - # Debug can pause Install-ADDSDomainController, so we remove it. - $parameters = $PSBoundParameters.Remove("Debug"); - $targetResource = Get-TargetResource @PSBoundParameters - - if ($targetResource.Ensure -eq $false) - { - ## Node is not a domain controllr so we promote it - Write-Verbose -Message "Checking if domain '$($DomainName)' is present ..." - $domain = $null; - try - { - $domain = Get-ADDomain -Identity $DomainName -Credential $DomainAdministratorCredential - } - catch - { - if ($error[0]) {Write-Verbose $error[0].Exception} - throw (New-Object -TypeName System.InvalidOperationException -ArgumentList "Domain '$($DomainName)' could not be found.") - } - - Write-Verbose -Message "Verified that domain '$($DomainName)' is present, continuing ..." - $params = @{ - DomainName = $DomainName - SafeModeAdministratorPassword = $SafemodeAdministratorPassword.Password - Credential = $DomainAdministratorCredential - NoRebootOnCompletion = $true - Force = $true - } - if ($DatabasePath -ne $null) - { - $params.Add("DatabasePath", $DatabasePath) - } - if ($LogPath -ne $null) - { - $params.Add("LogPath", $LogPath) - } - if ($SysvolPath -ne $null) - { - $params.Add("SysvolPath", $SysvolPath) - } - if ($SiteName -ne $null -and $SiteName -ne "") - { - $params.Add("SiteName", $SiteName) - } - - Install-ADDSDomainController @params - Write-Verbose -Message "Node is now a domain controller for '$($DomainName)'." - - # Signal to the LCM to reboot the node to compensate for the one we - # suppressed from Install-ADDSDomainController - $global:DSCMachineStatus = 1 - } - elseif ($targetResource.Ensure) - { - ## Node is a domain controller. We check if other properties are in desired state - if ($PSBoundParameters["SiteName"] -and $targetResource.SiteName -ne $SiteName) - { - ## DC is not in correct site. Move it. - Write-Verbose "Moving Domain Controller from '$($targetResource.SiteName)' to '$SiteName'" - Move-ADDirectoryServer -Identity $env:COMPUTERNAME -Site $SiteName -Credential $DomainAdministratorCredential - } - } -} - -function Test-TargetResource -{ - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory)] - [String]$DomainName, - - [Parameter(Mandatory)] - [PSCredential]$DomainAdministratorCredential, - - [Parameter(Mandatory)] - [PSCredential]$SafemodeAdministratorPassword, - - [String]$DatabasePath, - - [String]$LogPath, - - [String]$SysvolPath, - - [String]$SiteName - ) - - if ($PSBoundParameters.SiteName) - { - if (-not (Test-ADReplicationSite -SiteName $SiteName -DomainName $DomainName -Credential $DomainAdministratorCredential)) - { - throw (New-Object -TypeName System.InvalidOperationException -ArgumentList "Site '$($SiteName)' could not be found.") - } - } - - $isCompliant = $true - - try - { - $parameters = $PSBoundParameters.Remove("Debug"); - - $existingResource = Get-TargetResource @PSBoundParameters - $isCompliant = $existingResource.Ensure - - if ([System.String]::IsNullOrEmpty($SiteName)) - { - #If SiteName is not specified confgiuration is compliant - } - elseif ($existingResource.SiteName -ne $SiteName) - { - Write-Verbose "Domain Controller Site is not in a desired state. Expected '$SiteName', actual '$($existingResource.SiteName)'" - $isCompliant = $false - } - } - catch - { - if ($error[0]) {Write-Verbose $error[0].Exception} - Write-Verbose -Message "Domain '$($DomainName)' is NOT present on the current node." - $isCompliant = $false - } - - $isCompliant - -} - -## Import the common AD functions -$adCommonFunctions = Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -ChildPath '\MSFT_xADCommon\MSFT_xADCommon.ps1' -. $adCommonFunctions - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADDomainController/MSFT_xADDomainController.schema.mof b/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADDomainController/MSFT_xADDomainController.schema.mof deleted file mode 100644 index bde09183..00000000 --- a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADDomainController/MSFT_xADDomainController.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ -[ClassVersion("1.0.1.0"), FriendlyName("xADDomainController")] -class MSFT_xADDomainController : OMI_BaseResource -{ - [Key] String DomainName; - [Required, EmbeddedInstance("MSFT_Credential")] String DomainAdministratorCredential; - [Required, EmbeddedInstance("MSFT_Credential")] String SafemodeAdministratorPassword; - [write] String DatabasePath; - [write] String LogPath; - [write] String SysvolPath; - [write] String SiteName; -}; diff --git a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADDomainDefaultPasswordPolicy/MSFT_xADDomainDefaultPasswordPolicy.psm1 b/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADDomainDefaultPasswordPolicy/MSFT_xADDomainDefaultPasswordPolicy.psm1 deleted file mode 100644 index 619a218c..00000000 --- a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADDomainDefaultPasswordPolicy/MSFT_xADDomainDefaultPasswordPolicy.psm1 +++ /dev/null @@ -1,226 +0,0 @@ -# Localized messages -data localizedData -{ - # culture="en-US" - ConvertFrom-StringData @' - RoleNotFoundError = Please ensure that the PowerShell module for role '{0}' is installed. - QueryingDomainPasswordPolicy = Querying Active Directory domain '{0}' default password policy. - UpdatingDomainPasswordPolicy = Updating Active Directory domain '{0}' default password policy. - SettingPasswordPolicyValue = Setting password policy '{0}' property to '{1}'. - ResourcePropertyValueIncorrect = Property '{0}' value is incorrect; expected '{1}', actual '{2}'. - ResourceInDesiredState = Resource '{0}' is in the desired state. - ResourceNotInDesiredState = Resource '{0}' is NOT in the desired state. -'@ -} - -## List of changeable policy properties -$mutablePropertyMap = @( - @{ Name = 'ComplexityEnabled'; } - @{ Name = 'LockoutDuration'; IsTimeSpan = $true; } - @{ Name = 'LockoutObservationWindow'; IsTimeSpan = $true; } - @{ Name = 'LockoutThreshold'; } - @{ Name = 'MinPasswordAge'; IsTimeSpan = $true; } - @{ Name = 'MaxPasswordAge'; IsTimeSpan = $true; } - @{ Name = 'MinPasswordLength'; } - @{ Name = 'PasswordHistoryCount'; } - @{ Name = 'ReversibleEncryptionEnabled'; } -) - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory)] - [System.String] $DomainName, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] $DomainController, - - [Parameter()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.CredentialAttribute()] - $Credential - ) - Assert-Module -ModuleName 'ActiveDirectory'; - - $PSBoundParameters['Identity'] = $DomainName; - $getADDefaultDomainPasswordPolicyParams = Get-ADCommonParameters @PSBoundParameters; - Write-Verbose -Message ($localizedData.QueryingDomainPasswordPolicy -f $DomainName); - $policy = Get-ADDefaultDomainPasswordPolicy @getADDefaultDomainPasswordPolicyParams; - $targetResource = @{ - DomainName = $DomainName; - ComplexityEnabled = $policy.ComplexityEnabled; - LockoutDuration = ConvertFrom-Timespan -Timespan $policy.LockoutDuration -TimeSpanType Minutes; - LockoutObservationWindow = ConvertFrom-Timespan -Timespan $policy.LockoutObservationWindow -TimeSpanType Minutes; - LockoutThreshold = $policy.LockoutThreshold; - MinPasswordAge = ConvertFrom-Timespan -Timespan $policy.MinPasswordAge -TimeSpanType Minutes; - MaxPasswordAge = ConvertFrom-Timespan -Timespan $policy.MaxPasswordAge -TimeSpanType Minutes; - MinPasswordLength = $policy.MinPasswordLength; - PasswordHistoryCount = $policy.PasswordHistoryCount; - ReversibleEncryptionEnabled = $policy.ReversibleEncryptionEnabled; - } - return $targetResource; -} #end Get-TargetResource - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory)] - [System.String] $DomainName, - - [Parameter()] - [System.Boolean] $ComplexityEnabled, - - [Parameter()] - [System.UInt32] $LockoutDuration, - - [Parameter()] - [System.UInt32] $LockoutObservationWindow, - - [Parameter()] - [System.UInt32] $LockoutThreshold, - - [Parameter()] - [System.UInt32] $MinPasswordAge, - - [Parameter()] - [System.UInt32] $MaxPasswordAge, - - [Parameter()] - [System.UInt32] $MinPasswordLength, - - [Parameter()] - [System.UInt32] $PasswordHistoryCount, - - [Parameter()] - [System.Boolean] $ReversibleEncryptionEnabled, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] $DomainController, - - [Parameter()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.CredentialAttribute()] - $Credential - ) - $getTargetResourceParams = @{ - DomainName = $DomainName; - } - if ($PSBoundParameters.ContainsKey('Credential')) - { - $getTargetResourceParams['Credential'] = $Credential; - } - if ($PSBoundParameters.ContainsKey('DomainController')) - { - $getTargetResourceParams['DomainController'] = $DomainController; - } - $targetResource = Get-TargetResource @getTargetResourceParams; - - $inDesiredState = $true; - foreach ($property in $mutablePropertyMap) - { - $propertyName = $property.Name; - if ($PSBoundParameters.ContainsKey($propertyName)) - { - $expectedValue = $PSBoundParameters[$propertyName]; - $actualValue = $targetResource[$propertyName]; - if ($expectedValue -ne $actualValue) - { - $valueIncorrectMessage = $localizedData.ResourcePropertyValueIncorrect -f $propertyName, $expectedValue, $actualValue; - Write-Verbose -Message $valueIncorrectMessage; - $inDesiredState = $false; - } - } - } - - if ($inDesiredState) - { - Write-Verbose -Message ($localizedData.ResourceInDesiredState -f $DomainName); - return $true; - } - else - { - Write-Verbose -Message ($localizedData.ResourceNotInDesiredState -f $DomainName); - return $false; - } -} #end Test-TargetResource - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory)] - [System.String] $DomainName, - - [Parameter()] - [System.Boolean] $ComplexityEnabled, - - [Parameter()] - [System.UInt32] $LockoutDuration, - - [Parameter()] - [System.UInt32] $LockoutObservationWindow, - - [Parameter()] - [System.UInt32] $LockoutThreshold, - - [Parameter()] - [System.UInt32] $MinPasswordAge, - - [Parameter()] - [System.UInt32] $MaxPasswordAge, - - [Parameter()] - [System.UInt32] $MinPasswordLength, - - [Parameter()] - [System.UInt32] $PasswordHistoryCount, - - [Parameter()] - [System.Boolean] $ReversibleEncryptionEnabled, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] $DomainController, - - [Parameter()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.CredentialAttribute()] - $Credential - ) - Assert-Module -ModuleName 'ActiveDirectory'; - $PSBoundParameters['Identity'] = $DomainName; - $setADDefaultDomainPasswordPolicyParams = Get-ADCommonParameters @PSBoundParameters; - - foreach ($property in $mutablePropertyMap) - { - $propertyName = $property.Name; - if ($PSBoundParameters.ContainsKey($propertyName)) - { - $propertyValue = $PSBoundParameters[$propertyName]; - if ($property.IsTimeSpan -eq $true) - { - $propertyValue = ConvertTo-TimeSpan -TimeSpan $propertyValue -TimeSpanType Minutes; - } - $setADDefaultDomainPasswordPolicyParams[$propertyName] = $propertyValue; - Write-Verbose -Message ($localizedData.SettingPasswordPolicyValue -f $propertyName, $propertyValue); - } - } - - Write-Verbose -Message ($localizedData.UpdatingDomainPasswordPolicy -f $DomainName); - [ref] $null = Set-ADDefaultDomainPasswordPolicy @setADDefaultDomainPasswordPolicyParams; -} #end Set-TargetResource - -## Import the common AD functions -$adCommonFunctions = Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -ChildPath '\MSFT_xADCommon\MSFT_xADCommon.ps1'; -. $adCommonFunctions; - -Export-ModuleMember -Function *-TargetResource; diff --git a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADDomainDefaultPasswordPolicy/MSFT_xADDomainDefaultPasswordPolicy.schema.mof b/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADDomainDefaultPasswordPolicy/MSFT_xADDomainDefaultPasswordPolicy.schema.mof deleted file mode 100644 index 6eaca449..00000000 --- a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADDomainDefaultPasswordPolicy/MSFT_xADDomainDefaultPasswordPolicy.schema.mof +++ /dev/null @@ -1,17 +0,0 @@ -[ClassVersion("1.0.0"), FriendlyName("xADDomainDefaultPasswordPolicy")] -class MSFT_xADDomainDefaultPasswordPolicy : OMI_BaseResource -{ - [Key, Description("Name of the domain to which the password policy will be applied")] String DomainName; - [Write, Description("Whether password complexity is enabled for the default password policy")] Boolean ComplexityEnabled; - [Write, Description("Length of time that an account is locked after the number of failed login attempts (minutes)")] UInt32 LockoutDuration; - [Write, Description("Maximum time between two unsuccessful login attempts before the counter is reset to 0 (minutes)")] UInt32 LockoutObservationWindow; - [Write, Description("Number of unsuccessful login attempts that are permitted before an account is locked out")] UInt32 LockoutThreshold; - [Write, Description("Minimum length of time that you can have the same password (minutes)")] UInt32 MinPasswordAge; - [Write, Description("Maximum length of time that you can have the same password (minutes)")] UInt32 MaxPasswordAge; - [Write, Description("Minimum number of characters that a password must contain")] UInt32 MinPasswordLength; - [Write, Description("Number of previous passwords to remember")] UInt32 PasswordHistoryCount; - [Write, Description("Whether the directory must store passwords using reversible encryption")] Boolean ReversibleEncryptionEnabled; - [Write, Description("Active Directory domain controller to enact the change upon")] String DomainController; - [Write, Description("Credentials used to access the domain"), EmbeddedInstance("MSFT_Credential")] String Credential; -}; - diff --git a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADDomainTrust/MSFT_xADDomainTrust.psm1 b/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADDomainTrust/MSFT_xADDomainTrust.psm1 deleted file mode 100644 index df3d719d..00000000 --- a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADDomainTrust/MSFT_xADDomainTrust.psm1 +++ /dev/null @@ -1,398 +0,0 @@ -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData @' -MissingRoleMessage = Please ensure that the {0} role is installed - -CheckingTrustMessage = Checking if Trust between {0} and {1} exists ... -TestTrustMessage = Trust is {0} between source and target domains and it should be {1} -RemovingTrustMessage = Removing trust between {0} and {1} domains ... -DeleteTrustMessage = Trust between specified domains is now absent -AddingTrustMessage = Adding domain trust between {0} and {1} ... -SetTrustMessage = Trust between specified domains is now present - -CheckPropertyMessage = Checking for {0} between domains ... -DesiredPropertyMessage = {0} between domains is set correctly -NotDesiredPropertyMessage = {0} between domains is not correct. Expected {1}, actual {2} -SetPropertyMessage = {0} between domains is set -'@ -} - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory)] - [String]$SourceDomainName, - - [parameter(Mandatory)] - [String]$TargetDomainName, - - [parameter(Mandatory)] - [PSCredential]$TargetDomainAdministratorCredential, - - [parameter(Mandatory)] - [ValidateSet("External","Forest")] - [String]$TrustType, - - [parameter(Mandatory)] - [ValidateSet("Bidirectional","Inbound","Outbound")] - [String]$TrustDirection, - - [ValidateSet("Present","Absent")] - [String]$Ensure = 'Present' - ) - -#region Input Validation - - # Load the .NET assembly - try - { - Add-type -AssemblyName System.DirectoryServices - } - # If not found, means ADDS role is not installed - catch - { - $missingRoleMessage = $($LocalizedData.MissingRoleMessage) -f 'AD-Domain-Services' - New-TerminatingError -errorId ActiveDirectoryRoleMissing -errorMessage $missingRoleMessage -errorCategory NotInstalled - } - -#endregion - - try - { - switch ($TrustType) - { - 'External' {$DomainOrForest = 'Domain'} - 'Forest' {$DomainOrForest = 'Forest'} - } - # Create the target object - $trgDirectoryContext = New-Object System.DirectoryServices.ActiveDirectory.DirectoryContext($DomainOrForest,$TargetDomainName, $TargetDomainAdministratorCredential.UserName, $TargetDomainAdministratorCredential.GetNetworkCredential().Password) - $trgDomain = ([type]"System.DirectoryServices.ActiveDirectory.$DomainOrForest")::"Get$DomainOrForest"($trgDirectoryContext) - # Create the source object - $srcDirectoryContext = New-Object System.DirectoryServices.ActiveDirectory.DirectoryContext($DomainOrForest,$SourceDomainName) - $srcDomain = ([type]"System.DirectoryServices.ActiveDirectory.$DomainOrForest")::"Get$DomainOrForest"($srcDirectoryContext) - - # Find trust betwen source & destination. - $trust = $srcDomain.GetTrustRelationship($trgDomain) - - $Ensure = 'Present' - } - catch - { - $Ensure = 'Absent' - } - - # return a credential object without password - $CIMCredential = New-CimInstance -ClassName MSFT_Credential -ClientOnly ` - -Namespace root/microsoft/windows/desiredstateconfiguration ` - -Property @{ - UserName = [string]$TargetDomainAdministratorCredential.UserName - Password = [string]$null - } - - @{ - SourceDomainName = $SourceDomainName - TargetDomainName = $TargetDomainName - Ensure = $Ensure - TrustType = $trust.TrustType - TrustDirection = $trust.TrustDirection - TargetDomainAdministratorCredential = $CIMCredential - } - -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory)] - [String]$SourceDomainName, - - [parameter(Mandatory)] - [String]$TargetDomainName, - - [parameter(Mandatory)] - [PSCredential]$TargetDomainAdministratorCredential, - - [parameter(Mandatory)] - [ValidateSet("External","Forest")] - [String]$TrustType, - - [parameter(Mandatory)] - [ValidateSet("Bidirectional","Inbound","Outbound")] - [String]$TrustDirection, - - [ValidateSet("Present","Absent")] - [String]$Ensure = 'Present' - ) - - if($PSBoundParameters.ContainsKey('Debug')){$null = $PSBoundParameters.Remove('Debug')} - Validate-ResourceProperties @PSBoundParameters -Apply -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory)] - [String]$SourceDomainName, - - [parameter(Mandatory)] - [String]$TargetDomainName, - - [parameter(Mandatory)] - [PSCredential]$TargetDomainAdministratorCredential, - - [parameter(Mandatory)] - [ValidateSet("External","Forest")] - [String]$TrustType, - - [parameter(Mandatory)] - [ValidateSet("Bidirectional","Inbound","Outbound")] - [String]$TrustDirection, - - [ValidateSet("Present","Absent")] - [String]$Ensure = 'Present' - ) - -#region Input Validation - - # Load the .NET assembly - try - { - Add-type -AssemblyName System.DirectoryServices - } - # If not found, means ADDS role is not installed - catch - { - $missingRoleMessage = $($LocalizedData.MissingRoleMessage) -f 'AD-Domain-Services' - New-TerminatingError -errorId ActiveDirectoryRoleMissing -errorMessage $missingRoleMessage -errorCategory NotInstalled - } - -#endregion - - if($PSBoundParameters.ContainsKey('Debug')){$null = $PSBoundParameters.Remove('Debug')} - Validate-ResourceProperties @PSBoundParameters -} - -#region Helper Functions -function Validate-ResourceProperties -{ - [Cmdletbinding()] - param - ( - [parameter(Mandatory)] - [String]$SourceDomainName, - - [parameter(Mandatory)] - [String]$TargetDomainName, - - [parameter(Mandatory)] - [PSCredential]$TargetDomainAdministratorCredential, - - [parameter(Mandatory)] - [ValidateSet("External","Forest")] - [String]$TrustType, - - [parameter(Mandatory)] - [ValidateSet("Bidirectional","Inbound","Outbound")] - [String]$TrustDirection, - - [ValidateSet("Present","Absent")] - [String]$Ensure = 'Present', - - [Switch]$Apply - ) - - try - { - $checkingTrustMessage = $($LocalizedData.CheckingTrustMessage) -f $SourceDomainName,$TargetDomainName - Write-Verbose -Message $checkingTrustMessage - - switch ($TrustType) - { - 'External' {$DomainOrForest = 'Domain'} - 'Forest' {$DomainOrForest = 'Forest'} - } - # Create the target object - $trgDirectoryContext = New-Object System.DirectoryServices.ActiveDirectory.DirectoryContext($DomainOrForest,$TargetDomainName, $TargetDomainAdministratorCredential.UserName, $TargetDomainAdministratorCredential.GetNetworkCredential().Password) - $trgDomain = ([type]"System.DirectoryServices.ActiveDirectory.$DomainOrForest")::"Get$DomainOrForest"($trgDirectoryContext) - # Create the source object - $srcDirectoryContext = New-Object System.DirectoryServices.ActiveDirectory.DirectoryContext($DomainOrForest,$SourceDomainName) - $srcDomain = ([type]"System.DirectoryServices.ActiveDirectory.$DomainOrForest")::"Get$DomainOrForest"($srcDirectoryContext) - - # Find trust - try - { - # Find trust betwen source & destination. - $trust = $srcDomain.GetTrustRelationship($TargetDomainName) - - $TestTrustMessage = $($LocalizedData.TestTrustMessage) -f 'present',$Ensure - Write-Verbose -Message $TestTrustMessage - - if($Ensure -eq 'Present') - { - #region Test for trust direction - - $CheckPropertyMessage = $($LocalizedData.CheckPropertyMessage) -f 'trust direction' - Write-Verbose -Message $CheckPropertyMessage - - # Set the trust direction if not correct - if($trust.TrustDirection -ne $TrustDirection) - { - $notDesiredPropertyMessage = $($LocalizedData.NotDesiredPropertyMessage) -f 'Trust direction',$TrustDirection,$trust.TrustDirection - Write-Verbose -Message $notDesiredPropertyMessage - - if($Apply) - { - $srcDomain.UpdateTrustRelationship($trgDomain,$TrustDirection) - - $setPropertyMessage = $($LocalizedData.SetPropertyMessage) -f 'Trust direction' - Write-Verbose -Message $setPropertyMessage - } - else - { - return $false - } - } # end trust direction is not correct - - # Trust direction is correct - else - { - $desiredPropertyMessage = $($LocalizedData.DesiredPropertyMessage) -f 'Trust direction' - Write-Verbose -Message $desiredPropertyMessage - } - #endregion trust direction - - #region Test for trust type - - $CheckPropertyMessage = $($LocalizedData.CheckPropertyMessage) -f 'trust type' - Write-Verbose -Message $CheckPropertyMessage - - # Set the trust type if not correct - if($trust.TrustType-ne $TrustType) - { - $notDesiredPropertyMessage = $($LocalizedData.NotDesiredPropertyMessage) -f 'Trust type',$TrustType,$trust.TrustType - Write-Verbose -Message $notDesiredPropertyMessage - - if($Apply) - { - # Only way to fix the trust direction is to delete it and create again - # TODO: Add a property to ask user permission to delete an existing trust - $srcDomain.DeleteTrustRelationship($trgDomain) - $srcDomain.CreateTrustRelationship($trgDomain,$TrustDirection) - - $setPropertyMessage = $($LocalizedData.SetPropertyMessage) -f 'Trust type' - Write-Verbose -Message $setPropertyMessage - } - else - { - return $false - } - } # end trust type is not correct - - # Trust type is correct - else - { - $desiredPropertyMessage = $($LocalizedData.DesiredPropertyMessage) -f 'Trust type' - Write-Verbose -Message $desiredPropertyMessage - } - - #endregion Test for trust type - - # If both trust type and trust direction are correct, return true - if(-not $Apply) - { - return $true - } - } # end Ensure -eq present - - # If the trust should be absent, remove the trust - else - { - if($Apply) - { - $removingTrustMessage = $($LocalizedData.RemovingTrustMessage) -f $SourceDomainName,$TargetDomainName - Write-Verbose -Message $removingTrustMessage - - $srcDomain.DeleteTrustRelationship($trgDomain) - - $deleteTrustMessage = $LocalizedData.DeleteTrustMessage - Write-Verbose -Message $deleteTrustMessage - } - else - { - return $false - } - } # end Ensure -eq absent - } # end find trust - - # Trust does not exist between source and destination - catch [System.DirectoryServices.ActiveDirectory.ActiveDirectoryObjectNotFoundException] - { - $TestTrustMessage = $($LocalizedData.TestTrustMessage) -f 'absent',$Ensure - Write-Verbose -Message $TestTrustMessage - - if($Ensure -eq 'Present') - { - if($Apply) - { - $addingTrustMessage = $($LocalizedData.AddingTrustMessage) -f $SourceDomainName,$TargetDomainName - Write-Verbose -Message $addingTrustMessage - - $srcDomain.CreateTrustRelationship($trgDomain,$TrustDirection) - - $setTrustMessage = $LocalizedData.SetTrustMessage - Write-Verbose -Message $setTrustMessage - } - else - { - return $false - } - } # end Ensure -eq Present - else - { - if(-not $Apply) - { - return $true - } - } - } # end no trust - }# end getting directory object - catch [System.DirectoryServices.ActiveDirectory.ActiveDirectoryObjectNotFoundException] - { - throw - } -} - -# Internal function to throw terminating error with specified errroCategory, errorId and errorMessage -function New-TerminatingError -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory)] - [String]$errorId, - - [Parameter(Mandatory)] - [String]$errorMessage, - - [Parameter(Mandatory)] - [System.Management.Automation.ErrorCategory]$errorCategory - ) - - $exception = New-Object System.InvalidOperationException $errorMessage - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - throw $errorRecord -} - -#endregion - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADDomainTrust/MSFT_xADDomainTrust.schema.mof b/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADDomainTrust/MSFT_xADDomainTrust.schema.mof deleted file mode 100644 index 4f35d5a6..00000000 --- a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADDomainTrust/MSFT_xADDomainTrust.schema.mof +++ /dev/null @@ -1,13 +0,0 @@ - -[ClassVersion("1.0.1.0"), FriendlyName("xADDomainTrust")] -class MSFT_xADDomainTrust : OMI_BaseResource -{ - [Write, Description("Should this resource be present or absent"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credentials to authenticate to the target domain")] String TargetDomainAdministratorCredential; - [Key, Description("Name of the AD domain that is being trusted")] String TargetDomainName; - [Required, Description("Type of trust"), ValueMap{"External","Forest"}, Values{"External","Forest"}] String TrustType; - [Required, Description("Direction of trust"), ValueMap{"Bidirectional","Inbound","Outbound"}, Values{"Bidirectional","Inbound","Outbound"}] String TrustDirection; - [Key, Description("Name of the AD domain that is requesting the trust")] String SourceDomainName; -}; - - diff --git a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADGroup/MSFT_xADGroup.psm1 b/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADGroup/MSFT_xADGroup.psm1 deleted file mode 100644 index e23cff3f..00000000 --- a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADGroup/MSFT_xADGroup.psm1 +++ /dev/null @@ -1,492 +0,0 @@ -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData @' - RetrievingGroupMembers = Retrieving group membership based on '{0}' property. - GroupMembershipInDesiredState = Group membership is in the desired state. - GroupMembershipNotDesiredState = Group membership is NOT in the desired state. - - AddingGroupMembers = Adding '{0}' member(s) to AD group '{1}'. - RemovingGroupMembers = Removing '{0}' member(s) from AD group '{1}'. - AddingGroup = Adding AD Group '{0}' - UpdatingGroup = Updating AD Group '{0}' - RemovingGroup = Removing AD Group '{0}' - MovingGroup = Moving AD Group '{0}' to '{1}' - GroupNotFound = AD Group '{0}' was not found - NotDesiredPropertyState = AD Group '{0}' is not correct. Expected '{1}', actual '{2}' - UpdatingGroupProperty = Updating AD Group property '{0}' to '{1}' -'@ -} - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $GroupName, - - [ValidateSet('DomainLocal','Global','Universal')] - [System.String] - $GroupScope = 'Global', - - [ValidateSet('Security','Distribution')] - [System.String] - $Category = 'Security', - - [ValidateNotNullOrEmpty()] - [System.String] - $Path, - - [ValidateSet("Present", "Absent")] - [System.String] - $Ensure = "Present", - - [ValidateNotNullOrEmpty()] - [System.String] - $Description, - - [ValidateNotNullOrEmpty()] - [System.String] - $DisplayName, - - [ValidateNotNull()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.CredentialAttribute()] - $Credential, - - [ValidateNotNullOrEmpty()] - [System.String] - $DomainController, - - [System.String[]] - $Members, - - [System.String[]] - $MembersToInclude, - - [System.String[]] - $MembersToExclude, - - [ValidateSet('SamAccountName','DistinguishedName','SID','ObjectGUID')] - [System.String] - $MembershipAttribute = 'SamAccountName', - - ## This must be the user's DN - [ValidateNotNullOrEmpty()] - [System.String] - $ManagedBy, - - [ValidateNotNullOrEmpty()] - [System.String] - $Notes - ) - Assert-Module -ModuleName 'ActiveDirectory'; - $adGroupParams = Get-ADCommonParameters @PSBoundParameters; - try { - $adGroup = Get-ADGroup @adGroupParams -Property Name,GroupScope,GroupCategory,DistinguishedName,Description,DisplayName,ManagedBy,Info; - Write-Verbose -Message ($LocalizedData.RetrievingGroupMembers -f $MembershipAttribute); - ## Retrieve the current list of members, returning the specified membership attribute - $adGroupMembers = (Get-ADGroupMember @adGroupParams).$MembershipAttribute; - $targetResource = @{ - GroupName = $adGroup.Name; - GroupScope = $adGroup.GroupScope; - Category = $adGroup.GroupCategory; - Path = Get-ADObjectParentDN -DN $adGroup.DistinguishedName; - Description = $adGroup.Description; - DisplayName = $adGroup.DisplayName; - Members = $adGroupMembers; - MembersToInclude = $MembersToInclude; - MembersToExclude = $MembersToExclude; - MembershipAttribute = $MembershipAttribute; - ManagedBy = $adGroup.ManagedBy; - Notes = $adGroup.Info; - Ensure = 'Absent'; - } - if ($adGroup) - { - $targetResource['Ensure'] = 'Present'; - } - } - catch [Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException] { - Write-Verbose ($LocalizedData.GroupNotFound -f $GroupName); - $targetResource = @{ - GroupName = $GroupName; - GroupScope = $GroupScope; - Category = $Category; - Path = $Path; - Description = $Description; - DisplayName = $DisplayName; - Members = @(); - MembersToInclude = $MembersToInclude; - MembersToExclude = $MembersToExclude; - MembershipAttribute = $MembershipAttribute; - ManagedBy = $ManagedBy; - Notes = $Notes; - Ensure = 'Absent'; - } - } - return $targetResource; -} #end function Get-TargetResource - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $GroupName, - - [ValidateSet('DomainLocal','Global','Universal')] - [System.String] - $GroupScope = 'Global', - - [ValidateSet('Security','Distribution')] - [System.String] - $Category = 'Security', - - [ValidateNotNullOrEmpty()] - [System.String] - $Path, - - [ValidateSet("Present", "Absent")] - [System.String] - $Ensure = "Present", - - [ValidateNotNullOrEmpty()] - [System.String] - $Description, - - [ValidateNotNullOrEmpty()] - [System.String] - $DisplayName, - - [ValidateNotNull()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.CredentialAttribute()] - $Credential, - - [ValidateNotNullOrEmpty()] - [System.String] - $DomainController, - - [System.String[]] - $Members, - - [System.String[]] - $MembersToInclude, - - [System.String[]] - $MembersToExclude, - - [ValidateSet('SamAccountName','DistinguishedName','SID','ObjectGUID')] - [System.String] - $MembershipAttribute = 'SamAccountName', - - ## This must be the user's DN - [ValidateNotNullOrEmpty()] - [System.String] - $ManagedBy, - - [ValidateNotNullOrEmpty()] - [System.String] - $Notes - ) - ## Validate parameters before we even attempt to retrieve anything - $assertMemberParameters = @{}; - if ($PSBoundParameters.ContainsKey('Members') -and -not [system.string]::IsNullOrEmpty($Members)) - { - $assertMemberParameters['Members'] = $Members; - } - if ($PSBoundParameters.ContainsKey('MembersToInclude') -and -not [system.string]::IsNullOrEmpty($MembersToInclude)) - { - $assertMemberParameters['MembersToInclude'] = $MembersToInclude; - } - if ($PSBoundParameters.ContainsKey('MembersToExclude') -and -not [system.string]::IsNullOrEmpty($MembersToExclude)) - { - $assertMemberParameters['MembersToExclude'] = $MembersToExclude; - } - Assert-MemberParameters @assertMemberParameters -ModuleName 'xADDomain' -ErrorAction Stop; - - $targetResource = Get-TargetResource @PSBoundParameters; - $targetResourceInCompliance = $true; - if ($targetResource.GroupScope -ne $GroupScope) - { - Write-Verbose ($LocalizedData.NotDesiredPropertyState -f 'GroupScope', $GroupScope, $targetResource.GroupScope); - $targetResourceInCompliance = $false; - } - if ($targetResource.Category -ne $Category) - { - Write-Verbose ($LocalizedData.NotDesiredPropertyState -f 'Category', $Category, $targetResource.Category); - $targetResourceInCompliance = $false; - } - if ($Path -and ($targetResource.Path -ne $Path)) - { - Write-Verbose ($LocalizedData.NotDesiredPropertyState -f 'Path', $Path, $targetResource.Path); - $targetResourceInCompliance = $false; - } - if ($Description -and ($targetResource.Description -ne $Description)) - { - Write-Verbose ($LocalizedData.NotDesiredPropertyState -f 'Description', $Description, $targetResource.Description); - $targetResourceInCompliance = $false; - } - if ($DisplayName -and ($targetResource.DisplayName -ne $DisplayName)) - { - Write-Verbose ($LocalizedData.NotDesiredPropertyState -f 'DisplayName', $DisplayName, $targetResource.DisplayName); - $targetResourceInCompliance = $false; - } - if ($ManagedBy -and ($targetResource.ManagedBy -ne $ManagedBy)) - { - Write-Verbose ($LocalizedData.NotDesiredPropertyState -f 'ManagedBy', $ManagedBy, $targetResource.ManagedBy); - $targetResourceInCompliance = $false; - } - if ($Notes -and ($targetResource.Notes -ne $Notes)) - { - Write-Verbose ($LocalizedData.NotDesiredPropertyState -f 'Notes', $Notes, $targetResource.Notes); - $targetResourceInCompliance = $false; - } - ## Test group members match passed membership parameters - if (-not (Test-Members @assertMemberParameters -ExistingMembers $targetResource.Members)) - { - Write-Verbose -Message $LocalizedData.GroupMembershipNotDesiredState; - $targetResourceInCompliance = $false; - } - if ($targetResource.Ensure -ne $Ensure) - { - Write-Verbose ($LocalizedData.NotDesiredPropertyState -f 'Ensure', $Ensure, $targetResource.Ensure); - $targetResourceInCompliance = $false; - } - return $targetResourceInCompliance; -} #end function Test-TargetResource - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $GroupName, - - [ValidateSet('DomainLocal','Global','Universal')] - [System.String] - $GroupScope = 'Global', - - [ValidateSet('Security','Distribution')] - [System.String] - $Category = 'Security', - - [ValidateNotNullOrEmpty()] - [System.String] - $Path, - - [ValidateSet("Present", "Absent")] - [System.String] - $Ensure = "Present", - - [ValidateNotNullOrEmpty()] - [System.String] - $Description, - - [ValidateNotNullOrEmpty()] - [System.String] - $DisplayName, - - [ValidateNotNull()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.CredentialAttribute()] - $Credential, - - [ValidateNotNullOrEmpty()] - [System.String] - $DomainController, - - [System.String[]] - $Members, - - [System.String[]] - $MembersToInclude, - - [System.String[]] - $MembersToExclude, - - [ValidateSet('SamAccountName','DistinguishedName','SID','ObjectGUID')] - [System.String] - $MembershipAttribute = 'SamAccountName', - - ## This must be the user's DN - [ValidateNotNullOrEmpty()] - [System.String] - $ManagedBy, - - [ValidateNotNullOrEmpty()] - [System.String] - $Notes - - ) - Assert-Module -ModuleName 'ActiveDirectory'; - $adGroupParams = Get-ADCommonParameters @PSBoundParameters; - - try { - $adGroup = Get-ADGroup @adGroupParams -Property Name,GroupScope,GroupCategory,DistinguishedName,Description,DisplayName,ManagedBy,Info; - - if ($Ensure -eq 'Present') { - - $setADGroupParams = $adGroupParams.Clone(); - $setADGroupParams['Identity'] = $adGroup.DistinguishedName; - - # Update existing group properties - if ($Category -ne $adGroup.GroupCategory) - { - Write-Verbose ($LocalizedData.UpdatingGroupProperty -f 'Category', $Category); - $setADGroupParams['GroupCategory'] = $Category; - } - if ($GroupScope -ne $adGroup.GroupScope) - { - ## Cannot change DomainLocal to Global or vice versa directly. Need to change them to a Universal group first! - Set-ADGroup -Identity $adGroup.DistinguishedName -GroupScope Universal; - Write-Verbose ($LocalizedData.UpdatingGroupProperty -f 'GroupScope', $GroupScope); - $setADGroupParams['GroupScope'] = $GroupScope; - } - if ($Description -and ($Description -ne $adGroup.Description)) - { - Write-Verbose ($LocalizedData.UpdatingGroupProperty -f 'Description', $Description); - $setADGroupParams['Description'] = $Description; - } - if ($DisplayName -and ($DisplayName -ne $adGroup.DisplayName)) - { - Write-Verbose ($LocalizedData.UpdatingGroupProperty -f 'DisplayName', $DisplayName); - $setADGroupParams['DisplayName'] = $DisplayName; - } - if ($ManagedBy -and ($ManagedBy -ne $adGroup.ManagedBy)) - { - Write-Verbose ($LocalizedData.UpdatingGroupProperty -f 'ManagedBy', $ManagedBy); - $setADGroupParams['ManagedBy'] = $ManagedBy; - } - if ($Notes -and ($Notes -ne $adGroup.Info)) - { - Write-Verbose ($LocalizedData.UpdatingGroupProperty -f 'Notes', $Notes); - $setADGroupParams['Replace'] = @{ Info = $Notes }; - } - Write-Verbose ($LocalizedData.UpdatingGroup -f $GroupName); - Set-ADGroup @setADGroupParams; - - # Move group if the path is not correct - if ($Path -and ($Path -ne (Get-ADObjectParentDN -DN $adGroup.DistinguishedName))) { - Write-Verbose ($LocalizedData.MovingGroup -f $GroupName, $Path); - $moveADObjectParams = $adGroupParams.Clone(); - $moveADObjectParams['Identity'] = $adGroup.DistinguishedName - Move-ADObject @moveADObjectParams -TargetPath $Path; - } - - Write-Verbose -Message ($LocalizedData.RetrievingGroupMembers -f $MembershipAttribute); - $adGroupMembers = (Get-ADGroupMember @adGroupParams).$MembershipAttribute; - if (-not (Test-Members -ExistingMembers $adGroupMembers -Members $Members -MembersToInclude $MembersToInclude -MembersToExclude $MembersToExclude)) - { - ## The fact that we're in the Set method, there is no need to validate the parameter - ## combination as this was performed in the Test method - if ($PSBoundParameters.ContainsKey('Members') -and -not [system.string]::IsNullOrEmpty($Members)) - { - # Remove all existing first and add explicit members - $Members = Remove-DuplicateMembers -Members $Members; - # We can only remove members if there are members already in the group! - if ($adGroupMembers.Count -gt 0) - { - Write-Verbose -Message ($LocalizedData.RemovingGroupMembers -f $adGroupMembers.Count, $GroupName); - Remove-ADGroupMember @adGroupParams -Members $adGroupMembers -Confirm:$false; - } - Write-Verbose -Message ($LocalizedData.AddingGroupMembers -f $Members.Count, $GroupName); - Add-ADGroupMember @adGroupParams -Members $Members; - } - if ($PSBoundParameters.ContainsKey('MembersToInclude') -and -not [system.string]::IsNullOrEmpty($MembersToInclude)) - { - $MembersToInclude = Remove-DuplicateMembers -Members $MembersToInclude; - Write-Verbose -Message ($LocalizedData.AddingGroupMembers -f $MembersToInclude.Count, $GroupName); - Add-ADGroupMember @adGroupParams -Members $MembersToInclude; - } - if ($PSBoundParameters.ContainsKey('MembersToExclude') -and -not [system.string]::IsNullOrEmpty($MembersToExclude)) - { - $MembersToExclude = Remove-DuplicateMembers -Members $MembersToExclude; - Write-Verbose -Message ($LocalizedData.RemovingGroupMembers -f $MembersToExclude.Count, $GroupName); - Remove-ADGroupMember @adGroupParams -Members $MembersToExclude -Confirm:$false; - } - } - } - elseif ($Ensure -eq 'Absent') - { - # Remove existing group - Write-Verbose ($LocalizedData.RemovingGroup -f $GroupName); - Remove-ADGroup @adGroupParams -Confirm:$false; - } - } - catch [Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException] - { - ## The AD group doesn't exist - if ($Ensure -eq 'Present') - { - - Write-Verbose ($LocalizedData.GroupNotFound -f $GroupName); - Write-Verbose ($LocalizedData.AddingGroup -f $GroupName); - - $adGroupParams = Get-ADCommonParameters @PSBoundParameters -UseNameParameter; - if ($Description) - { - $adGroupParams['Description'] = $Description; - } - if ($DisplayName) - { - $adGroupParams['DisplayName'] = $DisplayName; - } - if ($ManagedBy) - { - $adGroupParams['ManagedBy'] = $ManagedBy; - } - if ($Path) - { - $adGroupParams['Path'] = $Path; - } - ## Create group - $adGroup = New-ADGroup @adGroupParams -GroupCategory $Category -GroupScope $GroupScope -PassThru; - - ## Only the New-ADGroup cmdlet takes a -Name parameter. Refresh - ## the parameters with the -Identity parameter rather than -Name - $adGroupParams = Get-ADCommonParameters @PSBoundParameters - - if ($Notes) { - ## Can't set the Notes field when creating the group - Write-Verbose ($LocalizedData.UpdatingGroupProperty -f 'Notes', $Notes); - $setADGroupParams = $adGroupParams.Clone(); - $setADGroupParams['Identity'] = $adGroup.DistinguishedName; - Set-ADGroup @setADGroupParams -Add @{ Info = $Notes }; - } - - ## Add the required members - if ($PSBoundParameters.ContainsKey('Members') -and -not [system.string]::IsNullOrEmpty($Members)) - { - $Members = Remove-DuplicateMembers -Members $Members; - Write-Verbose -Message ($LocalizedData.AddingGroupMembers -f $Members.Count, $GroupName); - Add-ADGroupMember @adGroupParams -Members $Members; - } - elseif ($PSBoundParameters.ContainsKey('MembersToInclude') -and -not [system.string]::IsNullOrEmpty($MembersToInclude)) - { - $MembersToInclude = Remove-DuplicateMembers -Members $MembersToInclude; - Write-Verbose -Message ($LocalizedData.AddingGroupMembers -f $MembersToInclude.Count, $GroupName); - Add-ADGroupMember @adGroupParams -Members $MembersToInclude; - } - - } - } #end catch -} #end function Set-TargetResource - -## Import the common AD functions -$adCommonFunctions = Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -ChildPath '\MSFT_xADCommon\MSFT_xADCommon.ps1'; -. $adCommonFunctions; - -Export-ModuleMember -Function *-TargetResource; diff --git a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADGroup/MSFT_xADGroup.schema.mof b/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADGroup/MSFT_xADGroup.schema.mof deleted file mode 100644 index 4466bb7c..00000000 --- a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADGroup/MSFT_xADGroup.schema.mof +++ /dev/null @@ -1,19 +0,0 @@ -[ClassVersion("1.0.1.0"), FriendlyName("xADGroup")] -class MSFT_xADGroup : OMI_BaseResource -{ - [Key, Description("Name of the Active Directory group")] String GroupName; - [Write, Description("Active Directory group scope"), ValueMap{"DomainLocal","Global","Universal"}, Values{"DomainLocal","Global","Universal"}] String GroupScope; - [Write, Description("Active Directory group category"), ValueMap{"Security","Distribution"}, Values{"Security","Distribution"}] String Category; - [Write, Description("Location of the group within Active Directory expressed as a Distinguished Name")] String Path; - [Write, Description("Should this resource be present or absent"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, Description("Description of the Active Directory group")] String Description; - [Write, Description("Display name of the Active Directory group")] String DisplayName; - [Write, Description("Credentials used to enact the change upon"), EmbeddedInstance("MSFT_Credential")] String Credential; - [Write, Description("Active Directory domain controller to enact the change upon")] String DomainController; - [Write, Description("Active Directory group membership should match membership exactly")] String Members[]; - [Write, Description("Active Directory group should include these members")] String MembersToInclude[]; - [Write, Description("Active Directory group should NOT include these members")] String MembersToExclude[]; - [Write, Description("Active Directory attribute used to perform membership operations"), ValueMap{"SamAccountName","DistinguishedName","ObjectGUID","SID"}, Values{"SamAccountName","DistinguishedName","ObjectGUID","SID"}] String MembershipAttribute; - [Write, Description("Active Directory managed by attribute specified as a DistinguishedName")] String ManagedBy; - [Write, Description("Active Directory group notes field")] String Notes; -}; diff --git a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADOrganizationalUnit/MSFT_xADOrganizationalUnit.psm1 b/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADOrganizationalUnit/MSFT_xADOrganizationalUnit.psm1 deleted file mode 100644 index 71617065..00000000 --- a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADOrganizationalUnit/MSFT_xADOrganizationalUnit.psm1 +++ /dev/null @@ -1,221 +0,0 @@ -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData @' - RoleNotFoundError = Please ensure that the PowerShell module for role '{0}' is installed - RetrievingOU = Retrieving OU '{0}'. - UpdatingOU = Updating OU '{0}' - DeletingOU = Deleting OU '{0}' - CreatingOU = Creating OU '{0}' - OUInDesiredState = OU '{0}' exists and is in the desired state - OUNotInDesiredState = OU '{0}' exists but is not in the desired state - OUExistsButShouldNot = OU '{0}' exists when it should not exist - OUDoesNotExistButShould = OU '{0}' does not exist when it should exist -'@ -} - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory)] - [System.String] $Name, - - [parameter(Mandatory)] - [System.String] $Path - ) - - Assert-Module -ModuleName 'ActiveDirectory'; - Write-Verbose ($LocalizedData.RetrievingOU -f $Name) - $ou = Get-ADOrganizationalUnit -Filter { Name -eq $Name } -SearchBase $Path -SearchScope OneLevel -Properties ProtectedFromAccidentalDeletion, Description - - $targetResource = @{ - Name = $Name - Path = $Path - Ensure = if ($null -eq $ou) { 'Absent' } else { 'Present' } - ProtectedFromAccidentalDeletion = $ou.ProtectedFromAccidentalDeletion - Description = $ou.Description - } - return $targetResource - -} # end function Get-TargetResource - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory)] - [System.String] $Name, - - [parameter(Mandatory)] - [System.String] $Path, - - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure = 'Present', - - [ValidateNotNull()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.CredentialAttribute()] - $Credential, - - [ValidateNotNull()] - [System.Boolean] $ProtectedFromAccidentalDeletion = $true, - - [ValidateNotNull()] - [System.String] $Description = '' - ) - - $targetResource = Get-TargetResource -Name $Name -Path $Path - - if ($targetResource.Ensure -eq 'Present') - { - if ($Ensure -eq 'Present') - { - ## Organizational unit exists - if ([System.String]::IsNullOrEmpty($Description)) { - $isCompliant = (($targetResource.Name -eq $Name) -and - ($targetResource.Path -eq $Path) -and - ($targetResource.ProtectedFromAccidentalDeletion -eq $ProtectedFromAccidentalDeletion)) - } - else { - $isCompliant = (($targetResource.Name -eq $Name) -and - ($targetResource.Path -eq $Path) -and - ($targetResource.ProtectedFromAccidentalDeletion -eq $ProtectedFromAccidentalDeletion) -and - ($targetResource.Description -eq $Description)) - } - - if ($isCompliant) - { - Write-Verbose ($LocalizedData.OUInDesiredState -f $targetResource.Name) - } - else - { - Write-Verbose ($LocalizedData.OUNotInDesiredState -f $targetResource.Name) - } - } - else - { - $isCompliant = $false - Write-Verbose ($LocalizedData.OUExistsButShouldNot -f $targetResource.Name) - } - } - else - { - ## Organizational unit does not exist - if ($Ensure -eq 'Present') - { - $isCompliant = $false - Write-Verbose ($LocalizedData.OUDoesNotExistButShould -f $targetResource.Name) - } - else - { - $isCompliant = $true - Write-Verbose ($LocalizedData.OUInDesiredState -f $targetResource.Name) - } - } - - return $isCompliant - -} #end function Test-TargetResource - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory)] - [System.String] $Name, - - [parameter(Mandatory)] - [System.String] $Path, - - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure = 'Present', - - [ValidateNotNull()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.CredentialAttribute()] - $Credential, - - [ValidateNotNull()] - [System.Boolean] $ProtectedFromAccidentalDeletion = $true, - - [ValidateNotNull()] - [System.String] $Description = '' - ) - - Assert-Module -ModuleName 'ActiveDirectory'; - $targetResource = Get-TargetResource -Name $Name -Path $Path - - if ($targetResource.Ensure -eq 'Present') - { - $ou = Get-ADOrganizationalUnit -Filter { Name -eq $Name } -SearchBase $Path -SearchScope OneLevel - if ($Ensure -eq 'Present') - { - Write-Verbose ($LocalizedData.UpdatingOU -f $targetResource.Name) - $setADOrganizationalUnitParams = @{ - Identity = $ou - Description = $Description - ProtectedFromAccidentalDeletion = $ProtectedFromAccidentalDeletion - } - if ($Credential) - { - $setADOrganizationalUnitParams['Credential'] = $Credential - } - Set-ADOrganizationalUnit @setADOrganizationalUnitParams - } - else - { - Write-Verbose ($LocalizedData.DeletingOU -f $targetResource.Name) - if ($targetResource.ProtectedFromAccidentalDeletion) - { - $setADOrganizationalUnitParams = @{ - Identity = $ou - ProtectedFromAccidentalDeletion = $ProtectedFromAccidentalDeletion - } - if ($Credential) - { - $setADOrganizationalUnitParams['Credential'] = $Credential - } - Set-ADOrganizationalUnit @setADOrganizationalUnitParams - } - - $removeADOrganizationalUnitParams = @{ - Identity = $ou - } - if ($Credential) - { - $removeADOrganizationalUnitParams['Credential'] = $Credential - } - Remove-ADOrganizationalUnit @removeADOrganizationalUnitParams - } - } - else - { - Write-Verbose ($LocalizedData.CreatingOU -f $targetResource.Name) - $newADOrganizationalUnitParams = @{ - Name = $Name - Path = $Path - Description = $Description - ProtectedFromAccidentalDeletion = $ProtectedFromAccidentalDeletion - } - if ($Credential) { - $newADOrganizationalUnitParams['Credential'] = $Credential - } - New-ADOrganizationalUnit @newADOrganizationalUnitParams - } - -} #end function Set-TargetResource - -## Import the common AD functions -$adCommonFunctions = Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -ChildPath '\MSFT_xADCommon\MSFT_xADCommon.ps1'; -. $adCommonFunctions; - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADOrganizationalUnit/MSFT_xADOrganizationalUnit.schema.mof b/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADOrganizationalUnit/MSFT_xADOrganizationalUnit.schema.mof deleted file mode 100644 index 687a7542..00000000 --- a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADOrganizationalUnit/MSFT_xADOrganizationalUnit.schema.mof +++ /dev/null @@ -1,12 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xADOrganizationalUnit")] -class MSFT_xADOrganizationalUnit : OMI_BaseResource -{ - [Key, Description("The name of OU")] string Name; - [Key, Description("Specifies the X500 path of the OU or container where the new object is created")] string Path; - - [Write, ValueMap{"Present", "Absent"}, Values{"Present", "Absent"}] string Ensure; - [Write, EmbeddedInstance("MSFT_Credential"),Description("The credential to be used to perform the operation on Active Directory")] string Credential; - [Write, Description("Defaults to True")] boolean ProtectedFromAccidentalDeletion; - [Write, Description("The description of the OU")] string Description; -}; - diff --git a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADRecycleBin/MSFT_xADRecycleBin.psm1 b/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADRecycleBin/MSFT_xADRecycleBin.psm1 deleted file mode 100644 index d64268fb..00000000 --- a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADRecycleBin/MSFT_xADRecycleBin.psm1 +++ /dev/null @@ -1,189 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $ForestFQDN, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $EnterpriseAdministratorCredential - ) - - Try - { - # AD cmdlets generate non-terminating errors. - $ErrorActionPreference = 'Stop' - - $RootDSE = Get-ADRootDSE -Server $ForestFQDN -Credential $EnterpriseAdministratorCredential - $RecycleBinPath = "CN=Recycle Bin Feature,CN=Optional Features,CN=Directory Service,CN=Windows NT,CN=Services,$($RootDSE.configurationNamingContext)" - $msDSEnabledFeature = Get-ADObject -Identity "CN=Partitions,$($RootDSE.configurationNamingContext)" -Property msDS-EnabledFeature -Server $ForestFQDN -Credential $EnterpriseAdministratorCredential | - Select-Object -ExpandProperty msDS-EnabledFeature - - If ($msDSEnabledFeature -contains $RecycleBinPath) { - $RecycleBinEnabled = $True - } Else { - $RecycleBinEnabled = $False - } - } - - Catch [Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException],[Microsoft.ActiveDirectory.Management.ADServerDownException] { - Write-Error -Message "Cannot contact forest $ForestFQDN. Check the spelling of the Forest FQDN and make sure that a domain contoller is available on the network." - Throw $_ - } - Catch [System.Security.Authentication.AuthenticationException] { - Write-Error -Message "Credential error. Check the username and password used." - Throw $_ - } - Catch { - Write-Error -Message "Unhandled exception getting Recycle Bin status for forest $ForestFQDN." - Throw $_ - } - - Finally { - $ErrorActionPreference = 'Continue' - } - - $returnValue = @{ - ForestFQDN = $ForestFQDN - RecycleBinEnabled = $RecycleBinEnabled - ForestMode = $RootDSE.forestFunctionality.ToString() - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $ForestFQDN, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $EnterpriseAdministratorCredential - ) - - - Try - { - # AD cmdlets generate non-terminating errors. - $ErrorActionPreference = 'Stop' - - $Forest = Get-ADForest -Identity $ForestFQDN -Server $ForestFQDN -Credential $EnterpriseAdministratorCredential - - # Check minimum forest level and throw if not - If (($Forest.ForestMode -as [int]) -lt 4) { - Write-Verbose -Message "Forest functionality level $($Forest.ForestMode) does not meet minimum requirement of Windows2008R2Forest or greater." - Throw "Forest functionality level $($Forest.ForestMode) does not meet minimum requirement of Windows2008R2Forest or greater." - } - - If ($PSCmdlet.ShouldProcess($Forest.RootDomain, "Enable Active Directory Recycle Bin")) { - Enable-ADOptionalFeature 'Recycle Bin Feature' -Scope ForestOrConfigurationSet ` - -Target $Forest.RootDomain -Server $Forest.DomainNamingMaster ` - -Credential $EnterpriseAdministratorCredential ` - -Verbose - } - } - - Catch [Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException],[Microsoft.ActiveDirectory.Management.ADServerDownException] { - Write-Error -Message "Cannot contact forest $ForestFQDN. Check the spelling of the Forest FQDN and make sure that a domain contoller is available on the network." - Throw $_ - } - Catch [System.Security.Authentication.AuthenticationException] { - Write-Error -Message "Credential error. Check the username and password used." - Throw $_ - } - Catch { - Write-Error -Message "Unhandled exception setting Recycle Bin status for forest $ForestFQDN." - Throw $_ - } - - Finally { - $ErrorActionPreference = 'Continue' - } - -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $ForestFQDN, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $EnterpriseAdministratorCredential - ) - - Try { - # AD cmdlets generate non-terminating errors. - $ErrorActionPreference = 'Stop' - - $RootDSE = Get-ADRootDSE -Server $ForestFQDN -Credential $EnterpriseAdministratorCredential - $RecycleBinPath = "CN=Recycle Bin Feature,CN=Optional Features,CN=Directory Service,CN=Windows NT,CN=Services,$($RootDSE.configurationNamingContext)" - $msDSEnabledFeature = Get-ADObject -Identity "CN=Partitions,$($RootDSE.configurationNamingContext)" -Property msDS-EnabledFeature -Server $ForestFQDN -Credential $EnterpriseAdministratorCredential | - Select-Object -ExpandProperty msDS-EnabledFeature - - If ($msDSEnabledFeature -contains $RecycleBinPath) { - Write-Verbose "Active Directory Recycle Bin is enabled." - Return $True - } Else { - Write-Verbose "Active Directory Recycle Bin is not enabled." - Return $False - } - } - - Catch [Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException],[Microsoft.ActiveDirectory.Management.ADServerDownException] { - Write-Error -Message "Cannot contact forest $ForestFQDN. Check the spelling of the Forest FQDN and make sure that a domain contoller is available on the network." - Throw $_ - } - Catch [System.Security.Authentication.AuthenticationException] { - Write-Error -Message "Credential error. Check the username and password used." - Throw $_ - } - Catch { - Write-Error -Message "Unhandled exception testing Recycle Bin status for forest $ForestFQDN." - Throw $_ - } - - Finally { - $ErrorActionPreference = 'Continue' - } - - -} - - -Export-ModuleMember -Function *-TargetResource - -<# -Test syntax: - -$cred = Get-Credential contoso\administrator - -# Valid Domain -Get-TargetResource -ForestFQDN contoso.com -EnterpriseAdministratorCredential $cred -Test-TargetResource -ForestFQDN contoso.com -EnterpriseAdministratorCredential $cred -Set-TargetResource -ForestFQDN contoso.com -EnterpriseAdministratorCredential $cred -WhatIf - -# Invalid Domain -Get-TargetResource -ForestFQDN contoso.cm -EnterpriseAdministratorCredential $cred -Test-TargetResource -ForestFQDN contoso.cm -EnterpriseAdministratorCredential $cred -Set-TargetResource -ForestFQDN contoso.cm -EnterpriseAdministratorCredential $cred -WhatIf -#> - - - diff --git a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADRecycleBin/MSFT_xADRecycleBin.schema.mof b/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADRecycleBin/MSFT_xADRecycleBin.schema.mof deleted file mode 100644 index 6688c5b4..00000000 --- a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADRecycleBin/MSFT_xADRecycleBin.schema.mof +++ /dev/null @@ -1,8 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xADRecycleBin")] -class MSFT_xADRecycleBin : OMI_BaseResource -{ - [Key] String ForestFQDN; - [Required, EmbeddedInstance("MSFT_Credential")] String EnterpriseAdministratorCredential; - [Read] String RecycleBinEnabled; - [Read] String ForestMode; -}; diff --git a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADRecycleBin/ResourceDesignerScripts/GeneratexADRecycleBinSchema.ps1 b/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADRecycleBin/ResourceDesignerScripts/GeneratexADRecycleBinSchema.ps1 deleted file mode 100644 index 831ac8e2..00000000 --- a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADRecycleBin/ResourceDesignerScripts/GeneratexADRecycleBinSchema.ps1 +++ /dev/null @@ -1,6 +0,0 @@ -New-xDscResource -Name MSFT_xADRecycleBin -FriendlyName xADRecycleBin -ModuleName xActiveDirectory -Path . -Force -Property @( - New-xDscResourceProperty -Name ForestFQDN -Type String -Attribute Key - New-xDscResourceProperty -Name EnterpriseAdministratorCredential -Type PSCredential -Attribute Required - New-xDscResourceProperty -Name RecycleBinEnabled -Type Boolean -Attribute Read - New-xDscResourceProperty -Name ForestMode -Type String -Attribute Read -) diff --git a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADUser/MSFT_xADUser.psm1 b/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADUser/MSFT_xADUser.psm1 deleted file mode 100644 index e5f0f84c..00000000 --- a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADUser/MSFT_xADUser.psm1 +++ /dev/null @@ -1,1017 +0,0 @@ -[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPassWordParams', '')] -param() - -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData @' - RoleNotFoundError = Please ensure that the PowerShell module for role '{0}' is installed. - RetrievingADUserError = Error looking up Active Directory user '{0}' ({0}@{1}). - PasswordParameterConflictError = Parameter '{0}' cannot be set to '{1}' when the '{2}' parameter is specified. - - RetrievingADUser = Retrieving Active Directory user '{0}' ({0}@{1}) ... - CreatingADDomainConnection = Creating connection to Active Directory domain '{0}' ... - CheckingADUserPassword = Checking Active Directory user '{0}' password ... - ADUserIsPresent = Active Directory user '{0}' ({0}@{1}) is present. - ADUserNotPresent = Active Directory user '{0}' ({0}@{1}) was NOT present. - ADUserNotDesiredPropertyState = User '{0}' property is NOT in the desired state. Expected '{1}', actual '{2}'. - - AddingADUser = Adding Active Directory user '{0}'. - RemovingADUser = Removing Active Directory user '{0}'. - UpdatingADUser = Updating Active Directory user '{0}'. - SettingADUserPassword = Setting Active Directory user password. - UpdatingADUserProperty = Updating user property '{0}' with/to '{1}'. - RemovingADUserProperty = Removing user property '{0}' with '{1}'. - MovingADUser = Moving user from '{0}' to '{1}'. - RenamingADUser = Renaming user from '{0}' to '{1}'. -'@ -} - -## Create a property map that maps the DSC resource parameters to the -## Active Directory user attributes. -$adPropertyMap = @( - @{ Parameter = 'CommonName'; ADProperty = 'cn'; } - @{ Parameter = 'UserPrincipalName'; } - @{ Parameter = 'DisplayName'; } - @{ Parameter = 'Path'; ADProperty = 'distinguishedName'; } - @{ Parameter = 'GivenName'; } - @{ Parameter = 'Initials'; } - @{ Parameter = 'Surname'; ADProperty = 'sn'; } - @{ Parameter = 'Description'; } - @{ Parameter = 'StreetAddress'; } - @{ Parameter = 'POBox'; } - @{ Parameter = 'City'; ADProperty = 'l'; } - @{ Parameter = 'State'; ADProperty = 'st'; } - @{ Parameter = 'PostalCode'; } - @{ Parameter = 'Country'; ADProperty = 'c'; } - @{ Parameter = 'Department'; } - @{ Parameter = 'Division'; } - @{ Parameter = 'Company'; } - @{ Parameter = 'Office'; ADProperty = 'physicalDeliveryOfficeName'; } - @{ Parameter = 'JobTitle'; ADProperty = 'title'; } - @{ Parameter = 'EmailAddress'; ADProperty = 'mail'; } - @{ Parameter = 'EmployeeID'; } - @{ Parameter = 'EmployeeNumber'; } - @{ Parameter = 'HomeDirectory'; } - @{ Parameter = 'HomeDrive'; } - @{ Parameter = 'HomePage'; ADProperty = 'wWWHomePage'; } - @{ Parameter = 'ProfilePath'; } - @{ Parameter = 'LogonScript'; ADProperty = 'scriptPath'; } - @{ Parameter = 'Notes'; ADProperty = 'info'; } - @{ Parameter = 'OfficePhone'; ADProperty = 'telephoneNumber'; } - @{ Parameter = 'MobilePhone'; ADProperty = 'mobile'; } - @{ Parameter = 'Fax'; ADProperty = 'facsimileTelephoneNumber'; } - @{ Parameter = 'Pager'; } - @{ Parameter = 'IPPhone'; } - @{ Parameter = 'HomePhone'; } - @{ Parameter = 'Enabled'; } - @{ Parameter = 'Manager'; } - @{ Parameter = 'PasswordNeverExpires'; UseCmdletParameter = $true; } - @{ Parameter = 'CannotChangePassword'; UseCmdletParameter = $true; } -) - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - ## Name of the domain where the user account is located (only used if password is managed) - [Parameter(Mandatory)] - [System.String] $DomainName, - - # Specifies the Security Account Manager (SAM) account name of the user (ldapDisplayName 'sAMAccountName') - [Parameter(Mandatory)] - [System.String] $UserName, - - ## Specifies a new password value for an account - [ValidateNotNull()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.CredentialAttribute()] - $Password, - - ## Specifies whether the user account is created or deleted - [ValidateSet('Present', 'Absent')] - [System.String] $Ensure = 'Present', - - ## Specifies the common nane assigned to the user account (ldapDisplayName 'cn') - [ValidateNotNull()] - [System.String] $CommonName = $UserName, - - ## Specifies the UPN assigned to the user account (ldapDisplayName 'userPrincipalName') - [ValidateNotNull()] - [System.String] $UserPrincipalName, - - ## Specifies the display name of the object (ldapDisplayName 'displayName') - [ValidateNotNull()] - [System.String] $DisplayName, - - ## Specifies the X.500 path of the Organizational Unit (OU) or container where the new object is created - [ValidateNotNull()] - [System.String] $Path, - - ## Specifies the user's given name (ldapDisplayName 'givenName') - [ValidateNotNull()] - [System.String] $GivenName, - - ## Specifies the initials that represent part of a user's name (ldapDisplayName 'initials') - [ValidateNotNull()] - [System.String] $Initials, - - ## Specifies the user's last name or surname (ldapDisplayName 'sn') - [ValidateNotNull()] - [System.String] $Surname, - - ## Specifies a description of the object (ldapDisplayName 'description') - [ValidateNotNull()] - [System.String] $Description, - - ## Specifies the user's street address (ldapDisplayName 'streetAddress') - [ValidateNotNull()] - [System.String] $StreetAddress, - - ## Specifies the user's post office box number (ldapDisplayName 'postOfficeBox') - [ValidateNotNull()] - [System.String] $POBox, - - ## Specifies the user's town or city (ldapDisplayName 'l') - [ValidateNotNull()] - [System.String] $City, - - ## Specifies the user's or Organizational Unit's state or province (ldapDisplayName 'st') - [ValidateNotNull()] - [System.String] $State, - - ## Specifies the user's postal code or zip code (ldapDisplayName 'postalCode') - [ValidateNotNull()] - [System.String] $PostalCode, - - ## Specifies the country or region code for the user's language of choice (ldapDisplayName 'c') - [ValidateNotNull()] - [System.String] $Country, - - ## Specifies the user's department (ldapDisplayName 'department') - [ValidateNotNull()] - [System.String] $Department, - - ## Specifies the user's division (ldapDisplayName 'division') - [ValidateNotNull()] - [System.String] $Division, - - ## Specifies the user's company (ldapDisplayName 'company') - [ValidateNotNull()] - [System.String] $Company, - - ## Specifies the location of the user's office or place of business (ldapDisplayName 'physicalDeliveryOfficeName') - [ValidateNotNull()] - [System.String] $Office, - - ## Specifies the user's title (ldapDisplayName 'title') - [ValidateNotNull()] - [System.String] $JobTitle, - - ## Specifies the user's e-mail address (ldapDisplayName 'mail') - [ValidateNotNull()] - [System.String] $EmailAddress, - - ## Specifies the user's employee ID (ldapDisplayName 'employeeID') - [ValidateNotNull()] - [System.String] $EmployeeID, - - ## Specifies the user's employee number (ldapDisplayName 'employeeNumber') - [ValidateNotNull()] - [System.String] $EmployeeNumber, - - ## Specifies a user's home directory path (ldapDisplayName 'homeDirectory') - [ValidateNotNull()] - [System.String] $HomeDirectory, - - ## Specifies a drive that is associated with the UNC path defined by the HomeDirectory property (ldapDisplayName 'homeDrive') - [ValidateNotNull()] - [System.String] $HomeDrive, - - ## Specifies the URL of the home page of the object (ldapDisplayName 'wWWHomePage') - [ValidateNotNull()] - [System.String] $HomePage, - - ## Specifies a path to the user's profile (ldapDisplayName 'profilePath') - [ValidateNotNull()] - [System.String] $ProfilePath, - - ## Specifies a path to the user's log on script (ldapDisplayName 'scriptPath') - [ValidateNotNull()] - [System.String] $LogonScript, - - ## Specifies the notes attached to the user's accoutn (ldapDisplayName 'info') - [ValidateNotNull()] - [System.String] $Notes, - - ## Specifies the user's office telephone number (ldapDisplayName 'telephoneNumber') - [ValidateNotNull()] - [System.String] $OfficePhone, - - ## Specifies the user's mobile phone number (ldapDisplayName 'mobile') - [ValidateNotNull()] - [System.String] $MobilePhone, - - ## Specifies the user's fax phone number (ldapDisplayName 'facsimileTelephoneNumber') - [ValidateNotNull()] - [System.String] $Fax, - - ## Specifies the user's home telephone number (ldapDisplayName 'homePhone') - [ValidateNotNull()] - [System.String] $HomePhone, - - ## Specifies the user's pager number (ldapDisplayName 'pager') - [ValidateNotNull()] - [System.String] $Pager, - - ## Specifies the user's IP telephony phone number (ldapDisplayName 'ipPhone') - [ValidateNotNull()] - [System.String] $IPPhone, - - ## Specifies the user's manager specified as a Distinguished Name (ldapDisplayName 'manager') - [ValidateNotNull()] - [System.String] $Manager, - - ## Specifies if the account is enabled (default True) - [ValidateNotNull()] - [System.Boolean] $Enabled = $true, - - ## Specifies whether the account password can be changed - [ValidateNotNull()] - [System.Boolean] $CannotChangePassword, - - ## Specifies whether the password of an account can expire - [ValidateNotNull()] - [System.Boolean] $PasswordNeverExpires, - - ## Specifies the Active Directory Domain Services instance to use to perform the task. - [ValidateNotNull()] - [System.String] $DomainController, - - ## Specifies the user account credentials to use to perform this task. Ideally this should just be called 'Credential' but is here for backwards compatibility - [ValidateNotNull()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.CredentialAttribute()] - $DomainAdministratorCredential, - - ## Specifies the authentication context type when testing user passwords #61 - [ValidateSet('Default','Negotiate')] - [System.String] $PasswordAuthentication = 'Default' - ) - - Assert-Module -ModuleName 'ActiveDirectory'; - - try - { - $adCommonParameters = Get-ADCommonParameters @PSBoundParameters; - - $adProperties = @(); - ## Create an array of the AD propertie names to retrieve from the property map - foreach ($property in $adPropertyMap) - { - if ($property.ADProperty) - { - $adProperties += $property.ADProperty; - } - else - { - $adProperties += $property.Parameter; - } - } - - Write-Verbose -Message ($LocalizedData.RetrievingADUser -f $UserName, $DomainName); - $adUser = Get-ADUser @adCommonParameters -Properties $adProperties; - Write-Verbose -Message ($LocalizedData.ADUserIsPresent -f $UserName, $DomainName); - $Ensure = 'Present'; - } - catch [Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException] - { - Write-Verbose -Message ($LocalizedData.ADUserNotPresent -f $UserName, $DomainName); - $Ensure = 'Absent'; - } - catch - { - Write-Error -Message ($LocalizedData.RetrievingADUserError -f $UserName, $DomainName); - throw $_; - } - - $targetResource = @{ - DomainName = $DomainName; - Password = $Password; - UserName = $UserName; - DistinguishedName = $adUser.DistinguishedName; ## Read-only property - Ensure = $Ensure; - DomainController = $DomainController; - } - - ## Retrieve each property from the ADPropertyMap and add to the hashtable - foreach ($property in $adPropertyMap) - { - if ($property.Parameter -eq 'Path') { - ## The path returned is not the parent container - if (-not [System.String]::IsNullOrEmpty($adUser.DistinguishedName)) - { - $targetResource['Path'] = Get-ADObjectParentDN -DN $adUser.DistinguishedName; - } - } - elseif ($property.ADProperty) - { - ## The AD property name is different to the function parameter to use this - $targetResource[$property.Parameter] = $adUser.($property.ADProperty); - } - else - { - ## The AD property name matches the function parameter - $targetResource[$property.Parameter] = $adUser.($property.Parameter); - } - } - return $targetResource; - -} #end function Get-TargetResource - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - ## Name of the domain where the user account is located (only used if password is managed) - [Parameter(Mandatory)] - [System.String] $DomainName, - - # Specifies the Security Account Manager (SAM) account name of the user (ldapDisplayName 'sAMAccountName') - [Parameter(Mandatory)] - [System.String] $UserName, - - ## Specifies a new password value for an account - [ValidateNotNull()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.CredentialAttribute()] - $Password, - - ## Specifies whether the user account is created or deleted - [ValidateSet('Present', 'Absent')] - [System.String] $Ensure = 'Present', - - ## Specifies the common nane assigned to the user account (ldapDisplayName 'cn') - [ValidateNotNull()] - [System.String] $CommonName = $UserName, - - ## Specifies the UPN assigned to the user account (ldapDisplayName 'userPrincipalName') - [ValidateNotNull()] - [System.String] $UserPrincipalName, - - ## Specifies the display name of the object (ldapDisplayName 'displayName') - [ValidateNotNull()] - [System.String] $DisplayName, - - ## Specifies the X.500 path of the Organizational Unit (OU) or container where the new object is created - [ValidateNotNull()] - [System.String] $Path, - - ## Specifies the user's given name (ldapDisplayName 'givenName') - [ValidateNotNull()] - [System.String] $GivenName, - - ## Specifies the initials that represent part of a user's name (ldapDisplayName 'initials') - [ValidateNotNull()] - [System.String] $Initials, - - ## Specifies the user's last name or surname (ldapDisplayName 'sn') - [ValidateNotNull()] - [System.String] $Surname, - - ## Specifies a description of the object (ldapDisplayName 'description') - [ValidateNotNull()] - [System.String] $Description, - - ## Specifies the user's street address (ldapDisplayName 'streetAddress') - [ValidateNotNull()] - [System.String] $StreetAddress, - - ## Specifies the user's post office box number (ldapDisplayName 'postOfficeBox') - [ValidateNotNull()] - [System.String] $POBox, - - ## Specifies the user's town or city (ldapDisplayName 'l') - [ValidateNotNull()] - [System.String] $City, - - ## Specifies the user's or Organizational Unit's state or province (ldapDisplayName 'st') - [ValidateNotNull()] - [System.String] $State, - - ## Specifies the user's postal code or zip code (ldapDisplayName 'postalCode') - [ValidateNotNull()] - [System.String] $PostalCode, - - ## Specifies the country or region code for the user's language of choice (ldapDisplayName 'c') - [ValidateNotNull()] - [System.String] $Country, - - ## Specifies the user's department (ldapDisplayName 'department') - [ValidateNotNull()] - [System.String] $Department, - - ## Specifies the user's division (ldapDisplayName 'division') - [ValidateNotNull()] - [System.String] $Division, - - ## Specifies the user's company (ldapDisplayName 'company') - [ValidateNotNull()] - [System.String] $Company, - - ## Specifies the location of the user's office or place of business (ldapDisplayName 'physicalDeliveryOfficeName') - [ValidateNotNull()] - [System.String] $Office, - - ## Specifies the user's title (ldapDisplayName 'title') - [ValidateNotNull()] - [System.String] $JobTitle, - - ## Specifies the user's e-mail address (ldapDisplayName 'mail') - [ValidateNotNull()] - [System.String] $EmailAddress, - - ## Specifies the user's employee ID (ldapDisplayName 'employeeID') - [ValidateNotNull()] - [System.String] $EmployeeID, - - ## Specifies the user's employee number (ldapDisplayName 'employeeNumber') - [ValidateNotNull()] - [System.String] $EmployeeNumber, - - ## Specifies a user's home directory path (ldapDisplayName 'homeDirectory') - [ValidateNotNull()] - [System.String] $HomeDirectory, - - ## Specifies a drive that is associated with the UNC path defined by the HomeDirectory property (ldapDisplayName 'homeDrive') - [ValidateNotNull()] - [System.String] $HomeDrive, - - ## Specifies the URL of the home page of the object (ldapDisplayName 'wWWHomePage') - [ValidateNotNull()] - [System.String] $HomePage, - - ## Specifies a path to the user's profile (ldapDisplayName 'profilePath') - [ValidateNotNull()] - [System.String] $ProfilePath, - - ## Specifies a path to the user's log on script (ldapDisplayName 'scriptPath') - [ValidateNotNull()] - [System.String] $LogonScript, - - ## Specifies the notes attached to the user's accoutn (ldapDisplayName 'info') - [ValidateNotNull()] - [System.String] $Notes, - - ## Specifies the user's office telephone number (ldapDisplayName 'telephoneNumber') - [ValidateNotNull()] - [System.String] $OfficePhone, - - ## Specifies the user's mobile phone number (ldapDisplayName 'mobile') - [ValidateNotNull()] - [System.String] $MobilePhone, - - ## Specifies the user's fax phone number (ldapDisplayName 'facsimileTelephoneNumber') - [ValidateNotNull()] - [System.String] $Fax, - - ## Specifies the user's home telephone number (ldapDisplayName 'homePhone') - [ValidateNotNull()] - [System.String] $HomePhone, - - ## Specifies the user's pager number (ldapDisplayName 'pager') - [ValidateNotNull()] - [System.String] $Pager, - - ## Specifies the user's IP telephony phone number (ldapDisplayName 'ipPhone') - [ValidateNotNull()] - [System.String] $IPPhone, - - ## Specifies the user's manager specified as a Distinguished Name (ldapDisplayName 'manager') - [ValidateNotNull()] - [System.String] $Manager, - - ## Specifies if the account is enabled (default True) - [ValidateNotNull()] - [System.Boolean] $Enabled = $true, - - ## Specifies whether the account password can be changed - [ValidateNotNull()] - [System.Boolean] $CannotChangePassword, - - ## Specifies whether the password of an account can expire - [ValidateNotNull()] - [System.Boolean] $PasswordNeverExpires, - - ## Specifies the Active Directory Domain Services instance to use to perform the task. - [ValidateNotNull()] - [System.String] $DomainController, - - ## Specifies the user account credentials to use to perform this task. Ideally this should just be called 'Credential' but is here for backwards compatibility - [ValidateNotNull()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.CredentialAttribute()] - $DomainAdministratorCredential, - - ## Specifies the authentication context type when testing user passwords #61 - [ValidateSet('Default','Negotiate')] - [System.String] $PasswordAuthentication = 'Default' - ) - - Assert-Parameters @PSBoundParameters; - $targetResource = Get-TargetResource @PSBoundParameters; - $isCompliant = $true; - - if ($Ensure -eq 'Absent') - { - if ($targetResource.Ensure -eq 'Present') - { - Write-Verbose -Message ($LocalizedData.ADUserNotDesiredPropertyState -f 'Ensure', $PSBoundParameters.Ensure, $targetResource.Ensure); - $isCompliant = $false; - } - } - else - { - ## Add common name, ensure and enabled as they may not be explicitly passed and we want to enumerate them - $PSBoundParameters['Ensure'] = $Ensure; - $PSBoundParameters['Enabled'] = $Enabled; - - foreach ($parameter in $PSBoundParameters.Keys) - { - if ($parameter -eq 'Password') - { - $testPasswordParams = @{ - Username = $UserName; - Password = $Password; - DomainName = $DomainName; - PasswordAuthentication = $PasswordAuthentication; - } - if ($DomainAdministratorCredential) - { - $testPasswordParams['DomainAdministratorCredential'] = $DomainAdministratorCredential; - } - if (-not (Test-Password @testPasswordParams)) - { - Write-Verbose -Message ($LocalizedData.ADUserNotDesiredPropertyState -f 'Password', '', ''); - $isCompliant = $false; - } - } - # Only check properties that are returned by Get-TargetResource - elseif ($targetResource.ContainsKey($parameter)) - { - ## This check is required to be able to explicitly remove values with an empty string, if required - if (([System.String]::IsNullOrEmpty($PSBoundParameters.$parameter)) -and ([System.String]::IsNullOrEmpty($targetResource.$parameter))) - { - # Both values are null/empty and therefore we are compliant - } - elseif ($PSBoundParameters.$parameter -ne $targetResource.$parameter) - { - Write-Verbose -Message ($LocalizedData.ADUserNotDesiredPropertyState -f $parameter, $PSBoundParameters.$parameter, $targetResource.$parameter); - $isCompliant = $false; - } - } - } #end foreach PSBoundParameter - } - - return $isCompliant; - -} #end function Test-TargetResource - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - ## Name of the domain where the user account is located (only used if password is managed) - [Parameter(Mandatory)] - [System.String] $DomainName, - - # Specifies the Security Account Manager (SAM) account name of the user (ldapDisplayName 'sAMAccountName') - [Parameter(Mandatory)] - [System.String] $UserName, - - ## Specifies a new password value for an account - [ValidateNotNull()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.CredentialAttribute()] - $Password, - - ## Specifies whether the user account is created or deleted - [ValidateSet('Present', 'Absent')] - [System.String] $Ensure = 'Present', - - ## Specifies the common nane assigned to the user account (ldapDisplayName 'cn') - [ValidateNotNull()] - [System.String] $CommonName = $UserName, - - ## Specifies the UPN assigned to the user account (ldapDisplayName 'userPrincipalName') - [ValidateNotNull()] - [System.String] $UserPrincipalName, - - ## Specifies the display name of the object (ldapDisplayName 'displayName') - [ValidateNotNull()] - [System.String] $DisplayName, - - ## Specifies the X.500 path of the Organizational Unit (OU) or container where the new object is created - [ValidateNotNull()] - [System.String] $Path, - - ## Specifies the user's given name (ldapDisplayName 'givenName') - [ValidateNotNull()] - [System.String] $GivenName, - - ## Specifies the initials that represent part of a user's name (ldapDisplayName 'initials') - [ValidateNotNull()] - [System.String] $Initials, - - ## Specifies the user's last name or surname (ldapDisplayName 'sn') - [ValidateNotNull()] - [System.String] $Surname, - - ## Specifies a description of the object (ldapDisplayName 'description') - [ValidateNotNull()] - [System.String] $Description, - - ## Specifies the user's street address (ldapDisplayName 'streetAddress') - [ValidateNotNull()] - [System.String] $StreetAddress, - - ## Specifies the user's post office box number (ldapDisplayName 'postOfficeBox') - [ValidateNotNull()] - [System.String] $POBox, - - ## Specifies the user's town or city (ldapDisplayName 'l') - [ValidateNotNull()] - [System.String] $City, - - ## Specifies the user's or Organizational Unit's state or province (ldapDisplayName 'st') - [ValidateNotNull()] - [System.String] $State, - - ## Specifies the user's postal code or zip code (ldapDisplayName 'postalCode') - [ValidateNotNull()] - [System.String] $PostalCode, - - ## Specifies the country or region code for the user's language of choice (ldapDisplayName 'c') - [ValidateNotNull()] - [System.String] $Country, - - ## Specifies the user's department (ldapDisplayName 'department') - [ValidateNotNull()] - [System.String] $Department, - - ## Specifies the user's division (ldapDisplayName 'division') - [ValidateNotNull()] - [System.String] $Division, - - ## Specifies the user's company (ldapDisplayName 'company') - [ValidateNotNull()] - [System.String] $Company, - - ## Specifies the location of the user's office or place of business (ldapDisplayName 'physicalDeliveryOfficeName') - [ValidateNotNull()] - [System.String] $Office, - - ## Specifies the user's title (ldapDisplayName 'title') - [ValidateNotNull()] - [System.String] $JobTitle, - - ## Specifies the user's e-mail address (ldapDisplayName 'mail') - [ValidateNotNull()] - [System.String] $EmailAddress, - - ## Specifies the user's employee ID (ldapDisplayName 'employeeID') - [ValidateNotNull()] - [System.String] $EmployeeID, - - ## Specifies the user's employee number (ldapDisplayName 'employeeNumber') - [ValidateNotNull()] - [System.String] $EmployeeNumber, - - ## Specifies a user's home directory path (ldapDisplayName 'homeDirectory') - [ValidateNotNull()] - [System.String] $HomeDirectory, - - ## Specifies a drive that is associated with the UNC path defined by the HomeDirectory property (ldapDisplayName 'homeDrive') - [ValidateNotNull()] - [System.String] $HomeDrive, - - ## Specifies the URL of the home page of the object (ldapDisplayName 'wWWHomePage') - [ValidateNotNull()] - [System.String] $HomePage, - - ## Specifies a path to the user's profile (ldapDisplayName 'profilePath') - [ValidateNotNull()] - [System.String] $ProfilePath, - - ## Specifies a path to the user's log on script (ldapDisplayName 'scriptPath') - [ValidateNotNull()] - [System.String] $LogonScript, - - ## Specifies the notes attached to the user's accoutn (ldapDisplayName 'info') - [ValidateNotNull()] - [System.String] $Notes, - - ## Specifies the user's office telephone number (ldapDisplayName 'telephoneNumber') - [ValidateNotNull()] - [System.String] $OfficePhone, - - ## Specifies the user's mobile phone number (ldapDisplayName 'mobile') - [ValidateNotNull()] - [System.String] $MobilePhone, - - ## Specifies the user's fax phone number (ldapDisplayName 'facsimileTelephoneNumber') - [ValidateNotNull()] - [System.String] $Fax, - - ## Specifies the user's home telephone number (ldapDisplayName 'homePhone') - [ValidateNotNull()] - [System.String] $HomePhone, - - ## Specifies the user's pager number (ldapDisplayName 'pager') - [ValidateNotNull()] - [System.String] $Pager, - - ## Specifies the user's IP telephony phone number (ldapDisplayName 'ipPhone') - [ValidateNotNull()] - [System.String] $IPPhone, - - ## Specifies the user's manager specified as a Distinguished Name (ldapDisplayName 'manager') - [ValidateNotNull()] - [System.String] $Manager, - - ## Specifies if the account is enabled (default True) - [ValidateNotNull()] - [System.Boolean] $Enabled = $true, - - ## Specifies whether the account password can be changed - [ValidateNotNull()] - [System.Boolean] $CannotChangePassword, - - ## Specifies whether the password of an account can expire - [ValidateNotNull()] - [System.Boolean] $PasswordNeverExpires, - - ## Specifies the Active Directory Domain Services instance to use to perform the task. - [ValidateNotNull()] - [System.String] $DomainController, - - ## Specifies the user account credentials to use to perform this task. Ideally this should just be called 'Credential' but is here for backwards compatibility - [ValidateNotNull()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.CredentialAttribute()] - $DomainAdministratorCredential, - - ## Specifies the authentication context type when testing user passwords #61 - [ValidateSet('Default','Negotiate')] - [System.String] $PasswordAuthentication = 'Default' - ) - - Assert-Parameters @PSBoundParameters; - $targetResource = Get-TargetResource @PSBoundParameters; - - ## Add common name, ensure and enabled as they may not be explicitly passed - $PSBoundParameters['Ensure'] = $Ensure; - $PSBoundParameters['Enabled'] = $Enabled; - - if ($Ensure -eq 'Present') - { - if ($targetResource.Ensure -eq 'Absent') { - ## User does not exist and needs creating - $newADUserParams = Get-ADCommonParameters @PSBoundParameters -UseNameParameter; - if ($PSBoundParameters.ContainsKey('Path')) - { - $newADUserParams['Path'] = $Path; - } - Write-Verbose -Message ($LocalizedData.AddingADUser -f $UserName); - New-ADUser @newADUserParams -SamAccountName $UserName; - ## Now retrieve the newly created user - $targetResource = Get-TargetResource @PSBoundParameters; - } - - $setADUserParams = Get-ADCommonParameters @PSBoundParameters; - $replaceUserProperties = @{}; - $removeUserProperties = @{}; - foreach ($parameter in $PSBoundParameters.Keys) - { - ## Only check/action properties specified/declared parameters that match one of the function's - ## parameters. This will ignore common parameters such as -Verbose etc. - if ($targetResource.ContainsKey($parameter)) - { - if ($parameter -eq 'Path' -and ($PSBoundParameters.Path -ne $targetResource.Path)) - { - ## Cannot move users by updating the DistinguishedName property - $adCommonParameters = Get-ADCommonParameters @PSBoundParameters; - ## Using the SamAccountName for identity with Move-ADObject does not work, use the DN instead - $adCommonParameters['Identity'] = $targetResource.DistinguishedName; - Write-Verbose -Message ($LocalizedData.MovingADUser -f $targetResource.Path, $PSBoundParameters.Path); - Move-ADObject @adCommonParameters -TargetPath $PSBoundParameters.Path; - } - elseif ($parameter -eq 'CommonName' -and ($PSBoundParameters.CommonName -ne $targetResource.CommonName)) - { - ## Cannot rename users by updating the CN property directly - $adCommonParameters = Get-ADCommonParameters @PSBoundParameters; - ## Using the SamAccountName for identity with Rename-ADObject does not work, use the DN instead - $adCommonParameters['Identity'] = $targetResource.DistinguishedName; - Write-Verbose -Message ($LocalizedData.RenamingADUser -f $targetResource.CommonName, $PSBoundParameters.CommonName); - Rename-ADObject @adCommonParameters -NewName $PSBoundParameters.CommonName; - } - elseif ($parameter -eq 'Password') - { - $adCommonParameters = Get-ADCommonParameters @PSBoundParameters; - Write-Verbose -Message ($LocalizedData.SettingADUserPassword -f $UserName); - Set-ADAccountPassword @adCommonParameters -Reset -NewPassword $Password.Password; - } - elseif ($parameter -eq 'Enabled' -and ($PSBoundParameters.$parameter -ne $targetResource.$parameter)) - { - ## We cannot enable/disable an account with -Add or -Replace parameters, but inform that - ## we will change this as it is out of compliance (it always gets set anyway) - Write-Verbose -Message ($LocalizedData.UpdatingADUserProperty -f $parameter, $PSBoundParameters.$parameter); - } - elseif ($PSBoundParameters.$parameter -ne $targetResource.$parameter) - { - ## Find the associated AD property - $adProperty = $adPropertyMap | Where-Object { $_.Parameter -eq $parameter }; - - if ([System.String]::IsNullOrEmpty($adProperty)) - { - ## We can't do anything is an empty AD property! - } - elseif ([System.String]::IsNullOrEmpty($PSBoundParameters.$parameter)) - { - ## We are removing properties - ## Only remove if the existing value in not null or empty - if (-not ([System.String]::IsNullOrEmpty($targetResource.$parameter))) - { - Write-Verbose -Message ($LocalizedData.RemovingADUserProperty -f $parameter, $PSBoundParameters.$parameter); - if ($adProperty.UseCmdletParameter -eq $true) - { - ## We need to pass the parameter explicitly to Set-ADUser, not via -Remove - $setADUserParams[$adProperty.Parameter] = $PSBoundParameters.$parameter; - } - elseif ([System.String]::IsNullOrEmpty($adProperty.ADProperty)) - { - $removeUserProperties[$adProperty.Parameter] = $targetResource.$parameter; - } - else - { - $removeUserProperties[$adProperty.ADProperty] = $targetResource.$parameter; - } - } - } #end if remove existing value - else - { - ## We are replacing the existing value - Write-Verbose -Message ($LocalizedData.UpdatingADUserProperty -f $parameter, $PSBoundParameters.$parameter); - if ($adProperty.UseCmdletParameter -eq $true) - { - ## We need to pass the parameter explicitly to Set-ADUser, not via -Replace - $setADUserParams[$adProperty.Parameter] = $PSBoundParameters.$parameter; - } - elseif ([System.String]::IsNullOrEmpty($adProperty.ADProperty)) - { - $replaceUserProperties[$adProperty.Parameter] = $PSBoundParameters.$parameter; - } - else - { - $replaceUserProperties[$adProperty.ADProperty] = $PSBoundParameters.$parameter; - } - } #end if replace existing value - } - - } #end if TargetResource parameter - } #end foreach PSBoundParameter - - ## Only pass -Remove and/or -Replace if we have something to set/change - if ($replaceUserProperties.Count -gt 0) - { - $setADUserParams['Replace'] = $replaceUserProperties; - } - if ($removeUserProperties.Count -gt 0) - { - $setADUserParams['Remove'] = $removeUserProperties; - } - - Write-Verbose -Message ($LocalizedData.UpdatingADUser -f $UserName); - [ref] $null = Set-ADUser @setADUserParams -Enabled $Enabled; - } - elseif (($Ensure -eq 'Absent') -and ($targetResource.Ensure -eq 'Present')) - { - ## User exists and needs removing - Write-Verbose ($LocalizedData.RemovingADUser -f $UserName); - $adCommonParameters = Get-ADCommonParameters @PSBoundParameters; - [ref] $null = Remove-ADUser @adCommonParameters -Confirm:$false; - } - -} #end function Set-TargetResource - -# Internal function to validate unsupported options/configurations -function Assert-Parameters -{ - [CmdletBinding()] - param - ( - [ValidateNotNull()] - [System.Management.Automation.PSCredential] $Password, - - [ValidateNotNull()] - [System.Boolean] $Enabled = $true, - - [Parameter(ValueFromRemainingArguments)] - $IgnoredArguments - ) - - ## We cannot test/set passwords on disabled AD accounts - if (($PSBoundParameters.ContainsKey('Password')) -and ($Enabled -eq $false)) - { - $throwInvalidArgumentErrorParams = @{ - ErrorId = 'xADUser_DisabledAccountPasswordConflict'; - ErrorMessage = $LocalizedData.PasswordParameterConflictError -f 'Enabled', $false, 'Password'; - } - ThrowInvalidArgumentError @throwInvalidArgumentErrorParams; - } - -} #end function Assert-Parameters - -# Internal function to test the validity of a user's password. -function Test-Password -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory)] - [System.String] $DomainName, - - [Parameter(Mandatory)] - [System.String] $UserName, - - [Parameter(Mandatory)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.CredentialAttribute()] - $Password, - - [ValidateNotNull()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.CredentialAttribute()] - $DomainAdministratorCredential, - - ## Specifies the authentication context type when testing user passwords #61 - [Parameter(Mandatory)] - [ValidateSet('Default','Negotiate')] - [System.String] $PasswordAuthentication - ) - - Write-Verbose -Message ($LocalizedData.CreatingADDomainConnection -f $DomainName); - Add-Type -AssemblyName 'System.DirectoryServices.AccountManagement'; - - if ($DomainAdministratorCredential) - { - $principalContext = New-Object System.DirectoryServices.AccountManagement.PrincipalContext( - [System.DirectoryServices.AccountManagement.ContextType]::Domain, - $DomainName, - $DomainAdministratorCredential.UserName, - $DomainAdministratorCredential.GetNetworkCredential().Password - ); - } - else - { - $principalContext = New-Object System.DirectoryServices.AccountManagement.PrincipalContext( - [System.DirectoryServices.AccountManagement.ContextType]::Domain, - $DomainName, - $null, - $null - ); - } - Write-Verbose -Message ($LocalizedData.CheckingADUserPassword -f $UserName); - - if ($PasswordAuthentication -eq 'Negotiate') - { - return $principalContext.ValidateCredentials( - $UserName, - $Password.GetNetworkCredential().Password, - [System.DirectoryServices.AccountManagement.ContextOptions]::Negotiate -bor - [System.DirectoryServices.AccountManagement.ContextOptions]::Signing -bor - [System.DirectoryServices.AccountManagement.ContextOptions]::Sealing - ); - } - else - { - ## Use default authentication context - return $principalContext.ValidateCredentials( - $UserName, - $Password.GetNetworkCredential().Password - ); - } - -} #end function Test-Password - -## Import the common AD functions -$adCommonFunctions = Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -ChildPath '\MSFT_xADCommon\MSFT_xADCommon.ps1'; -. $adCommonFunctions; - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADUser/MSFT_xADUser.schema.mof b/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADUser/MSFT_xADUser.schema.mof deleted file mode 100644 index c0ad1d63..00000000 --- a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xADUser/MSFT_xADUser.schema.mof +++ /dev/null @@ -1,50 +0,0 @@ -[ClassVersion("1.0.1.0"), FriendlyName("xADUser")] -class MSFT_xADUser : OMI_BaseResource -{ - [Key, Description("Name of the domain where the user account is located (only used if password is managed)")] String DomainName; - [Key, Description("Specifies the Security Account Manager (SAM) account name of the user (ldapDisplayName 'sAMAccountName')")] String UserName; - [Write, Description("Specifies a new password value for the account"), EmbeddedInstance("MSFT_Credential")] String Password; - [Write, Description("Specifies whether the user account is created or deleted"), ValueMap{"Present", "Absent"},Values{"Present", "Absent"}] String Ensure; - [Write, Description("Specifies the common nane assigned to the user account (ldapDisplayName 'cn')")] String CommonName; - [Write, Description("Specifies the UPN assigned to the user account (ldapDisplayName 'userPrincipalName')")] String UserPrincipalName; - [Write, Description("Specifies the display name of the object (ldapDisplayName 'displayName')")] String DisplayName; - [Write, Description("Specifies the X.500 path of the Organizational Unit (OU) or container where the new object is created")] String Path; - [Write, Description("Specifies the user's given name (ldapDisplayName 'givenName')")] String GivenName; - [Write, Description("Specifies the initials that represent part of a user's name (ldapDisplayName 'initials')")] String Initials; - [Write, Description("Specifies the user's last name or surname (ldapDisplayName 'sn')")] String Surname; - [Write, Description("Specifies a description of the object (ldapDisplayName 'description')")] String Description; - [Write, Description("Specifies the user's street address (ldapDisplayName 'streetAddress')")] String StreetAddress; - [Write, Description("Specifies the user's post office box number (ldapDisplayName 'postOfficeBox')")] String POBox; - [Write, Description("Specifies the user's town or city (ldapDisplayName 'l')")] String City; - [Write, Description("Specifies the user's or Organizational Unit's state or province (ldapDisplayName 'st')")] String State; - [Write, Description("Specifies the user's postal code or zip code (ldapDisplayName 'postalCode')")] String PostalCode; - [Write, Description("Specifies the country or region code for the user's language of choice (ldapDisplayName 'c')")] String Country; - [Write, Description("Specifies the user's department (ldapDisplayName 'department')")] String Department; - [Write, Description("Specifies the user's division (ldapDisplayName 'division')")] String Division; - [Write, Description("Specifies the user's company (ldapDisplayName 'company')")] String Company; - [Write, Description("Specifies the location of the user's office or place of business (ldapDisplayName 'physicalDeliveryOfficeName')")] String Office; - [Write, Description("Specifies the user's title (ldapDisplayName 'title')")] String JobTitle; - [Write, Description("Specifies the user's e-mail address (ldapDisplayName 'mail')")] String EmailAddress; - [Write, Description("Specifies the user's employee ID (ldapDisplayName 'employeeID')")] String EmployeeID; - [Write, Description("Specifies the user's employee number (ldapDisplayName 'employeeNumber')")] String EmployeeNumber; - [Write, Description("Specifies a user's home directory path (ldapDisplayName 'homeDirectory')")] String HomeDirectory; - [Write, Description("Specifies a drive that is associated with the UNC path defined by the HomeDirectory property (ldapDisplayName 'homeDrive')")] String HomeDrive; - [Write, Description("Specifies the URL of the home page of the object (ldapDisplayName 'wWWHomePage')")] String HomePage; - [Write, Description("Specifies a path to the user's profile (ldapDisplayName 'profilePath')")] String ProfilePath; - [Write, Description("Specifies a path to the user's log on script (ldapDisplayName 'scriptPath')")] String LogonScript; - [Write, Description("Specifies the notes attached to the user's accoutn (ldapDisplayName 'info')")] String Notes; - [Write, Description("Specifies the user's office telephone number (ldapDisplayName 'telephoneNumber')")] String OfficePhone; - [Write, Description("Specifies the user's mobile phone number (ldapDisplayName 'mobile')")] String MobilePhone; - [Write, Description("Specifies the user's fax phone number (ldapDisplayName 'facsimileTelephoneNumber')")] String Fax; - [Write, Description("Specifies the user's home telephone number (ldapDisplayName 'homePhone')")] String HomePhone; - [Write, Description("Specifies the user's pager number (ldapDisplayName 'pager')")] String Pager; - [Write, Description("Specifies the user's IP telephony phone number (ldapDisplayName 'ipPhone')")] String IPPhone; - [Write, Description("Specifies the user's manager specified as a Distinguished Name (ldapDisplayName 'manager')")] String Manager; - [Write, Description("Specifies if the account is enabled (default True)")] Boolean Enabled; - [Write, Description("Specifies whether the account password can be changed")] Boolean CannotChangePassword; - [Write, Description("Specifies whether the password of an account can expire")] Boolean PasswordNeverExpires; - [Write, Description("Specifies the Active Directory Domain Services instance to use to perform the task.")] String DomainController; - [Write, Description("Specifies the user account credentials to use to perform this task"), EmbeddedInstance("MSFT_Credential")] String DomainAdministratorCredential; - [Write, Description("Specifies the authentication context type used when testing passwords"), ValueMap{"Default","Negotiate"},Values{"Default","Negotiate"}] String PasswordAuthentication; - [Read, Description("Returns the X.500 path of the object")] String DistinguishedName; -}; diff --git a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xWaitForADDomain/MSFT_xWaitForADDomain.psm1 b/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xWaitForADDomain/MSFT_xWaitForADDomain.psm1 deleted file mode 100644 index b87e8c8e..00000000 --- a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xWaitForADDomain/MSFT_xWaitForADDomain.psm1 +++ /dev/null @@ -1,185 +0,0 @@ -function Get-TargetResource -{ - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory)] - [String]$DomainName, - - [PSCredential]$DomainUserCredential, - - [UInt64]$RetryIntervalSec = 60, - - [UInt32]$RetryCount = 10, - - [UInt32]$RebootRetryCount = 0 - - ) - - if($DomainUserCredential) - { - $convertToCimCredential = New-CimInstance -ClassName MSFT_Credential -Property @{Username=[string]$DomainUserCredential.UserName; Password=[string]$null} -Namespace root/microsoft/windows/desiredstateconfiguration -ClientOnly - } - else - { - $convertToCimCredential = $null - } - - $domain = Get-Domain -DomainName $DomainName -DomainUserCredential $DomainUserCredential - - - $returnValue = @{ - DomainName = $domain.Name - DomainUserCredential = $convertToCimCredential - RetryIntervalSec = $RetryIntervalSec - RetryCount = $RetryCount - RebootRetryCount = $RebootRetryCount - } - - $returnValue -} - - -function Set-TargetResource -{ - param - ( - [Parameter(Mandatory)] - [String]$DomainName, - - [PSCredential]$DomainUserCredential, - - [UInt64]$RetryIntervalSec = 60, - - [UInt32]$RetryCount = 10, - - [UInt32]$RebootRetryCount = 0 - - ) - - $rebootLogFile = "$env:temp\xWaitForADDomain_Reboot.tmp" - - for($count = 0; $count -lt $RetryCount; $count++) - { - $domain = Get-Domain -DomainName $DomainName -DomainUserCredential $DomainUserCredential - - if($domain) - { - if($RebootRetryCount -gt 0) - { - Remove-Item $rebootLogFile -ErrorAction SilentlyContinue - } - - break; - } - else - { - Write-Verbose -Message "Domain $DomainName not found. Will retry again after $RetryIntervalSec sec" - Start-Sleep -Seconds $RetryIntervalSec - Clear-DnsClientCache - } - } - - if(-not $domain) - { - if($RebootRetryCount -gt 0) - { - [UInt32]$rebootCount = Get-Content $RebootLogFile -ErrorAction SilentlyContinue - - if($rebootCount -lt $RebootRetryCount) - { - $rebootCount = $rebootCount + 1 - Write-Verbose -Message "Domain $DomainName not found after $count attempts with $RetryIntervalSec sec interval. Rebooting. Reboot attempt number $rebootCount of $RebootRetryCount." - Set-Content -Path $RebootLogFile -Value $rebootCount - $global:DSCMachineStatus = 1 - } - else - { - throw "Domain '$($DomainName)' NOT found after $RebootRetryCount Reboot attempts." - } - - - } - else - { - throw "Domain '$($DomainName)' NOT found after $RetryCount attempts." - } - } -} - -function Test-TargetResource -{ - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory)] - [String]$DomainName, - - [PSCredential]$DomainUserCredential, - - [UInt64]$RetryIntervalSec = 60, - - [UInt32]$RetryCount = 10, - - [UInt32]$RebootRetryCount = 0 - - ) - - $rebootLogFile = "$env:temp\xWaitForADDomain_Reboot.tmp" - - $domain = Get-Domain -DomainName $DomainName -DomainUserCredential $DomainUserCredential - - if($domain) - { - if($RebootRetryCount -gt 0) - { - Remove-Item $rebootLogFile -ErrorAction SilentlyContinue - } - - $true - } - else - { - $false - } -} - - - -function Get-Domain -{ - [OutputType([PSObject])] - param - ( - [Parameter(Mandatory)] - [String]$DomainName, - - [PSCredential]$DomainUserCredential - - ) - Write-Verbose -Message "Checking for domain $DomainName ..." - - if($DomainUserCredential) - { - $context = new-object System.DirectoryServices.ActiveDirectory.DirectoryContext('Domain', $DomainName, $DomainUserCredential.UserName, $DomainUserCredential.GetNetworkCredential().Password) - } - else - { - $context = new-object System.DirectoryServices.ActiveDirectory.DirectoryContext('Domain',$DomainName) - } - - try - { - $domain = ([System.DirectoryServices.ActiveDirectory.DomainController]::FindOne($context)).domain.ToString() - Write-Verbose -Message "Found domain $DomainName" - $returnValue = @{ - Name = $domain - } - - $returnValue - } - catch - { - Write-Verbose -Message "Domain $DomainName not found" - } -} diff --git a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xWaitForADDomain/MSFT_xWaitForADDomain.schema.mof b/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xWaitForADDomain/MSFT_xWaitForADDomain.schema.mof deleted file mode 100644 index 7b7a8233..00000000 --- a/lib/puppet_x/dsc_resources/xActiveDirectory/DSCResources/MSFT_xWaitForADDomain/MSFT_xWaitForADDomain.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("1.0.1.0"), FriendlyName("xWaitForADDomain")] -class MSFT_xWaitForADDomain : OMI_BaseResource -{ - [Key] String DomainName; - [Write, EmbeddedInstance("MSFT_Credential")] String DomainUserCredential; - [Write] uint64 RetryIntervalSec; - [Write] uint32 RetryCount; - [Write] uint32 RebootRetryCount; -}; diff --git a/lib/puppet_x/dsc_resources/xActiveDirectory/HADCConfiguration.psd1 b/lib/puppet_x/dsc_resources/xActiveDirectory/HADCConfiguration.psd1 deleted file mode 100644 index 3f4d236e..00000000 --- a/lib/puppet_x/dsc_resources/xActiveDirectory/HADCConfiguration.psd1 +++ /dev/null @@ -1,23 +0,0 @@ -@{ - AllNodes = @( - - @{ - Nodename = "sva-dsc1" - Role = "Primary DC" - DomainName = "sva-dscdom.nttest.microsoft.com" - PSDscAllowPlainTextPassword = $true - RetryCount = 20 - RetryIntervalSec = 30 - }, - - @{ - Nodename = "sva-dsc2" - Role = "Replica DC" - DomainName = "sva-dscdom.nttest.microsoft.com" - PSDscAllowPlainTextPassword = $true - RetryCount = 20 - RetryIntervalSec = 30 - } - ) -} - diff --git a/lib/puppet_x/dsc_resources/xActiveDirectory/LICENSE b/lib/puppet_x/dsc_resources/xActiveDirectory/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xActiveDirectory/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xActiveDirectory/Misc/New-ADDomainTrust.ps1 b/lib/puppet_x/dsc_resources/xActiveDirectory/Misc/New-ADDomainTrust.ps1 deleted file mode 100644 index 73f8ff64..00000000 --- a/lib/puppet_x/dsc_resources/xActiveDirectory/Misc/New-ADDomainTrust.ps1 +++ /dev/null @@ -1,17 +0,0 @@ -$Properties = @{ - SourceDomain = New-xDscResourceProperty -Name SourceDomainName -Type String -Attribute Key ` - -Description 'Name of the AD domain that is requesting the trust' - TargetDomain = New-xDscResourceProperty -Name TargetDomainName -Type String -Attribute Key ` - -Description 'Name of the AD domain that is being trusted' - TargetAdminCred = New-xDscResourceProperty -Name TargetDomainAdministratorCredential -Type PSCredential -Attribute Required ` - -Description 'Credentials to authenticate to the target domain' - TrustDirection = New-xDscResourceProperty -Name TrustDirection -Type String -Attribute Required -ValidateSet 'Bidirectional','Inbound','Outbound' ` - -Description 'Direction of trust' - TrustType = New-xDscResourceProperty -Name TrustType -Type String -Attribute Required -ValidateSet 'CrossLink','External','Forest','Kerberos','ParentChild','TreeRoot','Unknown' ` - -Description 'Type of trust' - Ensure = New-xDscResourceProperty -Name Ensure -Type String -Attribute Write -ValidateSet 'Present','Absent' ` - -Description 'Should this resource be present or absent' - - } -New-xDscResource -Name MSFT_xADDomainTrust -Property $Properties.Values -Path . -ModuleName xActiveDirectory -FriendlyName xADDomainTrust -Force - diff --git a/lib/puppet_x/dsc_resources/xActiveDirectory/ParentChildConfig.psd1 b/lib/puppet_x/dsc_resources/xActiveDirectory/ParentChildConfig.psd1 deleted file mode 100644 index 42b792e3..00000000 --- a/lib/puppet_x/dsc_resources/xActiveDirectory/ParentChildConfig.psd1 +++ /dev/null @@ -1,24 +0,0 @@ -@{ - AllNodes = @( - - @{ - Nodename = "sva-dsc1" - Role = "Parent DC" - DomainName = "sva-dscdom.nttest.microsoft.com" - PSDscAllowPlainTextPassword = $true - RetryCount = 50 - RetryIntervalSec = 30 - }, - - @{ - Nodename = "sva-dsc2" - Role = "Child DC" - DomainName = "sva-dscchild" - ParentDomainName = "sva-dscdom.nttest.microsoft.com" - PSDscAllowPlainTextPassword = $true - RetryCount = 50 - RetryIntervalSec = 30 - } - ) -} - diff --git a/lib/puppet_x/dsc_resources/xActiveDirectory/xActiveDirectory.psd1 b/lib/puppet_x/dsc_resources/xActiveDirectory/xActiveDirectory.psd1 deleted file mode 100644 index 1809222d..00000000 --- a/lib/puppet_x/dsc_resources/xActiveDirectory/xActiveDirectory.psd1 +++ /dev/null @@ -1,66 +0,0 @@ -@{ -# Version number of this module. -ModuleVersion = '2.16.0.0' - -# ID used to uniquely identify this module -GUID = '9FECD4F6-8F02-4707-99B3-539E940E9FF5' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'The xActiveDirectory module is originally part of the Windows PowerShell Desired State Configuration (DSC) Resource Kit. This version has been modified for use in Azure. This module contains the xADDomain, xADDomainController, xADUser, and xWaitForDomain resources. These DSC Resources allow you to configure and manage Active Directory. - -All of the resources in the DSC Resource Kit are provided AS IS, and are not supported through any Microsoft standard support program or service.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Minimum version of the common language runtime (CLR) required by this module -CLRVersion = '4.0' - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/xActiveDirectory/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/xActiveDirectory' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - ReleaseNotes = '* xAdDomainController: Update to complete fix for SiteName being required field. -* xADDomain: Added retry logic to prevent FaultException to crash in Get-TargetResource on subsequent reboots after a domain is created because the service is not yet running. This error is mostly occur when the resource is used with the DSCExtension on Azure. - -' - - } # End of PSData hashtable - -} # End of PrivateData hashtable -} - - - - - - diff --git a/lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/CommonResourceHelper.psm1 b/lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/CommonResourceHelper.psm1 deleted file mode 100644 index 257b21ba..00000000 --- a/lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/CommonResourceHelper.psm1 +++ /dev/null @@ -1,163 +0,0 @@ -<# - .SYNOPSIS - Tests if the current machine is a Nano server. -#> -function Test-IsNanoServer -{ - if (Test-Command -Name Get-ComputerInfo) - { - $computerInfo = Get-ComputerInfo - - if ("Server" -eq $computerInfo.OsProductType ` - -and "NanoServer" -eq $computerInfo.OsServerLevel) - { - return $true - } - } - - return $false -} - -<# - .SYNOPSIS - Tests if the the specified command is found. -#> -function Test-Command -{ - param - ( - [String] $Name - ) - - return ($null -ne (Get-Command -Name $Name -ErrorAction Continue 2> $null)) -} - -<# - .SYNOPSIS - Creates and throws an invalid argument exception - - .PARAMETER Message - The message explaining why this error is being thrown - - .PARAMETER ArgumentName - The name of the invalid argument that is causing this error to be thrown -#> -function New-InvalidArgumentException -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Message, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $ArgumentName - ) - - $argumentException = New-Object -TypeName 'ArgumentException' -ArgumentList @( $Message, - $ArgumentName ) - $newObjectParams = @{ - TypeName = 'System.Management.Automation.ErrorRecord' - ArgumentList = @( $argumentException, $ArgumentName, 'InvalidArgument', $null ) - } - $errorRecord = New-Object @newObjectParams - - throw $errorRecord -} - -<# - .SYNOPSIS - Creates and throws an invalid operation exception - - .PARAMETER Message - The message explaining why this error is being thrown - - .PARAMETER ErrorRecord - The error record containing the exception that is causing this terminating error -#> -function New-InvalidOperationException -{ - [CmdletBinding()] - param - ( - [ValidateNotNullOrEmpty()] - [String] - $Message, - - [ValidateNotNull()] - [System.Management.Automation.ErrorRecord] - $ErrorRecord - ) - - if ($null -eq $Message) - { - $invalidOperationException = New-Object -TypeName 'InvalidOperationException' - } - elseif ($null -eq $ErrorRecord) - { - $invalidOperationException = - New-Object -TypeName 'InvalidOperationException' -ArgumentList @( $Message ) - } - else - { - $invalidOperationException = - New-Object -TypeName 'InvalidOperationException' -ArgumentList @( $Message, - $ErrorRecord.Exception ) - } - - $newObjectParams = @{ - TypeName = 'System.Management.Automation.ErrorRecord' - ArgumentList = @( $invalidOperationException.ToString(), 'MachineStateIncorrect', - 'InvalidOperation', $null ) - } - $errorRecordToThrow = New-Object @newObjectParams - throw $errorRecordToThrow -} - -<# - .SYNOPSIS - Retrieves the localized string data based on the machine's culture. - Falls back to en-US strings if the machine's culture is not supported. - - .PARAMETER ResourceName - The name of the resource as it appears before '.strings.psd1' of the localized string file. - - For example: - For WindowsOptionalFeature: MSFT_xWindowsOptionalFeature - For Service: MSFT_xServiceResource - For Registry: MSFT_xRegistryResource -#> -function Get-LocalizedData -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $ResourceName - ) - - $resourceDirectory = (Join-Path -Path $PSScriptRoot -ChildPath $ResourceName) - $localizedStringFileLocation = Join-Path -Path $resourceDirectory -ChildPath $PSUICulture - - if (-not (Test-Path -Path $localizedStringFileLocation)) - { - # Fallback to en-US - $localizedStringFileLocation = Join-Path -Path $resourceDirectory -ChildPath 'en-US' - } - - Import-LocalizedData ` - -BindingVariable 'localizedData' ` - -FileName "$ResourceName.strings.psd1" ` - -BaseDirectory $localizedStringFileLocation - - return $localizedData -} - -Export-ModuleMember -Function @( 'Test-IsNanoServer', 'New-InvalidArgumentException', - 'New-InvalidOperationException', 'Get-LocalizedData' ) diff --git a/lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsCertificationAuthority/MSFT_xAdcsCertificationAuthority.psm1 b/lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsCertificationAuthority/MSFT_xAdcsCertificationAuthority.psm1 deleted file mode 100644 index b64532ba..00000000 --- a/lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsCertificationAuthority/MSFT_xAdcsCertificationAuthority.psm1 +++ /dev/null @@ -1,628 +0,0 @@ -# Suppressed as per PSSA Rule Severity guidelines for unit/integration tests: -# https://github.com/PowerShell/DscResources/blob/master/PSSARuleSeverities.md -[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '')] -param () - -Import-Module -Name (Join-Path -Path (Split-Path $PSScriptRoot -Parent) ` - -ChildPath 'CommonResourceHelper.psm1') - -# Localized messages for Write-Verbose statements in this resource -$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_xAdcsCertificationAuthority' - -<# - .SYNOPSIS - Returns an object containing the current state information for the ADCS CA on the server. - .PARAMETER CAType - Specifies the type of certification authority to install. - .PARAMETER Credential - To install an enterprise certification authority, the computer must be joined to an Active - Directory Domain Services domain and a user account that is a member of the Enterprise Admin - group is required. To install a standalone certification authority, the computer can be in a - workgroup or AD DS domain. If the computer is in a workgroup, a user account that is a member - of Administrators is required. If the computer is in an AD DS domain, a user account that is - a member of Domain Admins is required. - .PARAMETER Ensure - Specifies whether the Certificate Authority should be installed or uninstalled. - .PARAMETER CACommonName - Specifies the certification authority common name. - .PARAMETER CADistinguishedNameSuffix - Specifies the certification authority distinguished name suffix. - .PARAMETER CertFile - Specifies the file name of certification authority PKCS 12 formatted certificate file. - .PARAMETER CertFilePassword - Specifies the password for certification authority certificate file. - .PARAMETER CertificateID - Specifies the thumbprint or serial number of certification authority certificate. - .PARAMETER CryptoProviderName - The name of the cryptographic service provider or key storage provider that is used to generate - or store the private key for the CA. - .PARAMETER DatabaseDirectory - Specifies the folder location of the certification authority database. - .PARAMETER HashAlgorithmName - Specifies the signature hash algorithm used by the certification authority. - .PARAMETER IgnoreUnicode - Specifies that Unicode characters are allowed in certification authority name string. - .PARAMETER KeyContainerName - Specifies the name of an existing private key container. - .PARAMETER KeyLength - Specifies the bit length for new certification authority key. - .PARAMETER LogDirectory - Specifies the folder location of the certification authority database log. - .PARAMETER OutputCertRequestFile - Specifies the folder location for certificate request file. - .PARAMETER OverwriteExistingCAinDS - Specifies that the computer object in the Active Directory Domain Service domain should be - overwritten with the same computer name. - .PARAMETER OverwriteExistingDatabase - Specifies that the existing certification authority database should be overwritten. - .PARAMETER OverwriteExistingKey - Overwrite existing key container with the same name. - .PARAMETER ParentCA - Specifies the configuration string of the parent certification authority that will certify this - CA. - .PARAMETER ValidityPeriod - Specifies the validity period of the certification authority certificate in hours, days, weeks, - months or years. If this is a subordinate CA, do not use this parameter, because the validity - period is determined by the parent CA. - .PARAMETER ValidityPeriodUnits - Validity period of the certification authority certificate. If this is a subordinate CA, do not - specify this parameter because the validity period is determined by the parent CA. - .OUTPUTS - Returns an object containing the ADCS CA state information. -#> -Function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSShouldProcess', '')] - [CmdletBinding(SupportsShouldProcess = $true)] - [OutputType([System.Collections.Hashtable])] - param ( - [Parameter(Mandatory = $true)] - [ValidateSet('EnterpriseRootCA','EnterpriseSubordinateCA','StandaloneRootCA','StandaloneSubordinateCA')] - [string] - $CAType, - - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [Parameter()] - [ValidateSet('Present','Absent')] - [string] - $Ensure = 'Present', - - [Parameter()] - [string] - $CACommonName, - - [Parameter()] - [string] - $CADistinguishedNameSuffix, - - [Parameter()] - [string] - $CertFile, - - [Parameter()] - [pscredential] - $CertFilePassword, - - [Parameter()] - [string] - $CertificateID, - - [Parameter()] - [string] - $CryptoProviderName, - - [Parameter()] - [string] - $DatabaseDirectory, - - [Parameter()] - [string] - $HashAlgorithmName, - - [Parameter()] - [boolean] - $IgnoreUnicode, - - [Parameter()] - [string] - $KeyContainerName, - - [Parameter()] - [uint32] - $KeyLength, - - [Parameter()] - [string] - $LogDirectory, - - [Parameter()] - [string] - $OutputCertRequestFile, - - [Parameter()] - [boolean] - $OverwriteExistingCAinDS, - - [Parameter()] - [boolean] - $OverwriteExistingDatabase, - - [Parameter()] - [boolean] - $OverwriteExistingKey, - - [Parameter()] - [string] - $ParentCA, - - [Parameter()] - [ValidateSet('Hours','Days','Months','Years')] - [string] - $ValidityPeriod, - - [Parameter()] - [uint32] - $ValidityPeriodUnits - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.GettingAdcsCAStatusMessage -f $CAType) - ) -join '' ) - - $ADCSParams = @{} + $PSBoundParameters - $null = $ADCSParams.Remove('Ensure') - $null = $ADCSParams.Remove('Debug') - $null = $ADCSParams.Remove('ErrorAction') - - try - { - $null = Install-AdcsCertificationAuthority @ADCSParams -WhatIf - # CA is not installed - $Ensure = 'Absent' - } - catch [Microsoft.CertificateServices.Deployment.Common.CA.CertificationAuthoritySetupException] - { - # CA is already installed - $Ensure = 'Present' - } - catch - { - # Something else went wrong - Throw $_ - } - - return @{ - Ensure = $Ensure - CAType = $CAType - Credential = $Credential - } -} # Function Get-TargetResource - -<# - .SYNOPSIS - Installs or uinstalls the ADCS CA from the server. - .PARAMETER CAType - Specifies the type of certification authority to install. - .PARAMETER Credential - To install an enterprise certification authority, the computer must be joined to an Active - Directory Domain Services domain and a user account that is a member of the Enterprise Admin - group is required. To install a standalone certification authority, the computer can be in a - workgroup or AD DS domain. If the computer is in a workgroup, a user account that is a member - of Administrators is required. If the computer is in an AD DS domain, a user account that is - a member of Domain Admins is required. - .PARAMETER Ensure - Specifies whether the Certificate Authority should be installed or uninstalled. - .PARAMETER CACommonName - Specifies the certification authority common name. - .PARAMETER CADistinguishedNameSuffix - Specifies the certification authority distinguished name suffix. - .PARAMETER CertFile - Specifies the file name of certification authority PKCS 12 formatted certificate file. - .PARAMETER CertFilePassword - Specifies the password for certification authority certificate file. - .PARAMETER CertificateID - Specifies the thumbprint or serial number of certification authority certificate. - .PARAMETER CryptoProviderName - The name of the cryptographic service provider or key storage provider that is used to generate - or store the private key for the CA. - .PARAMETER DatabaseDirectory - Specifies the folder location of the certification authority database. - .PARAMETER HashAlgorithmName - Specifies the signature hash algorithm used by the certification authority. - .PARAMETER IgnoreUnicode - Specifies that Unicode characters are allowed in certification authority name string. - .PARAMETER KeyContainerName - Specifies the name of an existing private key container. - .PARAMETER KeyLength - Specifies the bit length for new certification authority key. - .PARAMETER LogDirectory - Specifies the folder location of the certification authority database log. - .PARAMETER OutputCertRequestFile - Specifies the folder location for certificate request file. - .PARAMETER OverwriteExistingCAinDS - Specifies that the computer object in the Active Directory Domain Service domain should be - overwritten with the same computer name. - .PARAMETER OverwriteExistingDatabase - Specifies that the existing certification authority database should be overwritten. - .PARAMETER OverwriteExistingKey - Overwrite existing key container with the same name. - .PARAMETER ParentCA - Specifies the configuration string of the parent certification authority that will certify this - CA. - .PARAMETER ValidityPeriod - Specifies the validity period of the certification authority certificate in hours, days, weeks, - months or years. If this is a subordinate CA, do not use this parameter, because the validity - period is determined by the parent CA. - .PARAMETER ValidityPeriodUnits - Validity period of the certification authority certificate. If this is a subordinate CA, do not - specify this parameter because the validity period is determined by the parent CA. -#> -Function Set-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSShouldProcess', '')] - [CmdletBinding()] - param ( - [Parameter(Mandatory = $true)] - [ValidateSet('EnterpriseRootCA','EnterpriseSubordinateCA','StandaloneRootCA','StandaloneSubordinateCA')] - [string] - $CAType, - - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [Parameter()] - [ValidateSet('Present','Absent')] - [string] - $Ensure = 'Present', - - [Parameter()] - [string] - $CACommonName, - - [Parameter()] - [string] - $CADistinguishedNameSuffix, - - [Parameter()] - [string] - $CertFile, - - [Parameter()] - [pscredential] - $CertFilePassword, - - [Parameter()] - [string] - $CertificateID, - - [Parameter()] - [string] - $CryptoProviderName, - - [Parameter()] - [string] - $DatabaseDirectory, - - [Parameter()] - [string] - $HashAlgorithmName, - - [Parameter()] - [boolean] - $IgnoreUnicode, - - [Parameter()] - [string] - $KeyContainerName, - - [Parameter()] - [uint32] - $KeyLength, - - [Parameter()] - [string] - $LogDirectory, - - [Parameter()] - [string] - $OutputCertRequestFile, - - [Parameter()] - [boolean] - $OverwriteExistingCAinDS, - - [Parameter()] - [boolean] - $OverwriteExistingDatabase, - - [Parameter()] - [boolean] - $OverwriteExistingKey, - - [Parameter()] - [string] - $ParentCA, - - [Parameter()] - [ValidateSet('Hours','Days','Months','Years')] - [string] - $ValidityPeriod, - - [Parameter()] - [uint32] - $ValidityPeriodUnits - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.SettingAdcsCAStatusMessage -f $CAType) - ) -join '' ) - - $ADCSParams = @{} + $PSBoundParameters - $null = $ADCSParams.Remove('Ensure') - $null = $ADCSParams.Remove('Debug') - $null = $ADCSParams.Remove('ErrorAction') - - switch ($Ensure) - { - 'Present' - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.InstallingAdcsCAMessage -f $CAType) - ) -join '' ) - - (Install-AdcsCertificationAuthority @ADCSParams -Force).ErrorString - } - 'Absent' - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.UninstallingAdcsCAMessage -f $CAType) - ) -join '' ) - - (Uninstall-AdcsCertificationAuthority -Force).ErrorString - } - } # switch -} # Function Set-TargetResource - -<# - .SYNOPSIS - Tests is the ADCS CA is in the desired state. - .PARAMETER CAType - Specifies the type of certification authority to install. - .PARAMETER Credential - To install an enterprise certification authority, the computer must be joined to an Active - Directory Domain Services domain and a user account that is a member of the Enterprise Admin - group is required. To install a standalone certification authority, the computer can be in a - workgroup or AD DS domain. If the computer is in a workgroup, a user account that is a member - of Administrators is required. If the computer is in an AD DS domain, a user account that is - a member of Domain Admins is required. - .PARAMETER Ensure - Specifies whether the Certificate Authority should be installed or uninstalled. - .PARAMETER CACommonName - Specifies the certification authority common name. - .PARAMETER CADistinguishedNameSuffix - Specifies the certification authority distinguished name suffix. - .PARAMETER CertFile - Specifies the file name of certification authority PKCS 12 formatted certificate file. - .PARAMETER CertFilePassword - Specifies the password for certification authority certificate file. - .PARAMETER CertificateID - Specifies the thumbprint or serial number of certification authority certificate. - .PARAMETER CryptoProviderName - The name of the cryptographic service provider or key storage provider that is used to generate - or store the private key for the CA. - .PARAMETER DatabaseDirectory - Specifies the folder location of the certification authority database. - .PARAMETER HashAlgorithmName - Specifies the signature hash algorithm used by the certification authority. - .PARAMETER IgnoreUnicode - Specifies that Unicode characters are allowed in certification authority name string. - .PARAMETER KeyContainerName - Specifies the name of an existing private key container. - .PARAMETER KeyLength - Specifies the bit length for new certification authority key. - .PARAMETER LogDirectory - Specifies the folder location of the certification authority database log. - .PARAMETER OutputCertRequestFile - Specifies the folder location for certificate request file. - .PARAMETER OverwriteExistingCAinDS - Specifies that the computer object in the Active Directory Domain Service domain should be - overwritten with the same computer name. - .PARAMETER OverwriteExistingDatabase - Specifies that the existing certification authority database should be overwritten. - .PARAMETER OverwriteExistingKey - Overwrite existing key container with the same name. - .PARAMETER ParentCA - Specifies the configuration string of the parent certification authority that will certify this - CA. - .PARAMETER ValidityPeriod - Specifies the validity period of the certification authority certificate in hours, days, weeks, - months or years. If this is a subordinate CA, do not use this parameter, because the validity - period is determined by the parent CA. - .PARAMETER ValidityPeriodUnits - Validity period of the certification authority certificate. If this is a subordinate CA, do not - specify this parameter because the validity period is determined by the parent CA. - .OUTPUTS - Returns true if the ADCS CA is in the desired state. -#> -Function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSShouldProcess', '')] - [CmdletBinding()] - [OutputType([System.Boolean])] - param ( - [Parameter(Mandatory = $true)] - [ValidateSet('EnterpriseRootCA','EnterpriseSubordinateCA','StandaloneRootCA','StandaloneSubordinateCA')] - [string] - $CAType, - - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [Parameter()] - [ValidateSet('Present','Absent')] - [string] - $Ensure = 'Present', - - [Parameter()] - [string] - $CACommonName, - - [Parameter()] - [string] - $CADistinguishedNameSuffix, - - [Parameter()] - [string] - $CertFile, - - [Parameter()] - [pscredential] - $CertFilePassword, - - [Parameter()] - [string] - $CertificateID, - - [Parameter()] - [string] - $CryptoProviderName, - - [Parameter()] - [string] - $DatabaseDirectory, - - [Parameter()] - [string] - $HashAlgorithmName, - - [Parameter()] - [boolean] - $IgnoreUnicode, - - [Parameter()] - [string] - $KeyContainerName, - - [Parameter()] - [uint32] - $KeyLength, - - [Parameter()] - [string] - $LogDirectory, - - [Parameter()] - [string] - $OutputCertRequestFile, - - [Parameter()] - [boolean] - $OverwriteExistingCAinDS, - - [Parameter()] - [boolean] - $OverwriteExistingDatabase, - - [Parameter()] - [boolean] - $OverwriteExistingKey, - - [Parameter()] - [string] - $ParentCA, - - [Parameter()] - [ValidateSet('Hours','Days','Months','Years')] - [string] - $ValidityPeriod, - - [Parameter()] - [uint32] - $ValidityPeriodUnits - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.TestingAdcsCAStatusMessage -f $CAType) - ) -join '' ) - - $ADCSParams = @{} + $PSBoundParameters - $null = $ADCSParams.Remove('Ensure') - $null = $ADCSParams.Remove('Debug') - $null = $ADCSParams.Remove('ErrorAction') - - try - { - $null = Install-AdcsCertificationAuthority @ADCSParams -WhatIf - # CA is not installed - switch ($Ensure) - { - 'Present' - { - # CA is not installed but should be - change required - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.AdcsCANotInstalledButShouldBeMessage -f $CAType) - ) -join '' ) - - return $false - } - 'Absent' - { - # CA is not installed and should not be - change not required - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.AdcsCANotInstalledAndShouldNotBeMessage -f $CAType) - ) -join '' ) - - return $true - } - } # switch - } - catch [Microsoft.CertificateServices.Deployment.Common.CA.CertificationAuthoritySetupException] - { - # CA is already installed - switch ($Ensure) - { - 'Present' - { - # CA is installed and should be - change not required - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.AdcsCAInstalledAndShouldBeMessage -f $CAType) - ) -join '' ) - - return $true - } - 'Absent' - { - # CA is installed and should not be - change required - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.AdcsCAInstalledButShouldNotBeMessage -f $CAType) - ) -join '' ) - - return $false - } - } # switch - } - catch - { - # Something else went wrong - Throw $_ - } # try -} # Function Test-TargetResource - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsCertificationAuthority/MSFT_xAdcsCertificationAuthority.schema.mof b/lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsCertificationAuthority/MSFT_xAdcsCertificationAuthority.schema.mof deleted file mode 100644 index 3dc6ceac..00000000 --- a/lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsCertificationAuthority/MSFT_xAdcsCertificationAuthority.schema.mof +++ /dev/null @@ -1,27 +0,0 @@ -[ClassVersion("0.1.0.0"), FriendlyName("xAdcsCertificationAuthority")] -class MSFT_xAdcsCertificationAuthority : OMI_BaseResource -{ - [key, Description("Specifies the type of certification authority to install. The possible values are EnterpriseRootCA, EnterpriseSubordinateCA, StandaloneRootCA, or StandaloneSubordinateCA."), ValueMap{"EnterpriseRootCA","EnterpriseSubordinateCA","StandaloneRootCA","StandaloneSubordinateCA"}, Values{"EnterpriseRootCA","EnterpriseSubordinateCA","StandaloneRootCA","StandaloneSubordinateCA"}] String CAType; - [Required, Description("To install an enterprise certification authority, the computer must be joined to an Active Directory Domain Services domain and a user account that is a member of the Enterprise Admin group is required. To install a standalone certification authority, the computer can be in a workgroup or AD DS domain. If the computer is in a workgroup, a user account that is a member of Administrators is required. If the computer is in an AD DS domain, a user account that is a member of Domain Admins is required."), EmbeddedInstance("MSFT_Credential")] String Credential; - [write, Description("Specifies whether the Certificate Authority should be installed or uninstalled."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [write, Description("Specifies the certification authority common name.")] String CACommonName; - [write, Description("Specifies the certification authority distinguished name suffix.")] String CADistinguishedNameSuffix; - [write, Description("Specifies the file name of certification authority PKCS 12 formatted certificate file.")] String CertFile; - [write, Description("Specifies the password for certification authority certificate file."), EmbeddedInstance("MSFT_Credential")] String CertFilePassword; - [write, Description("Specifies the thumbprint or serial number of certification authority certificate.")] String CertificateID; - [write, Description("The name of the cryptographic service provider or key storage provider that is used to generate or store the private key for the CA.")] String CryptoProviderName; - [write, Description("Specifies the folder location of the certification authority database.")] String DatabaseDirectory; - [write, Description("Specifies the signature hash algorithm used by the certification authority.")] String HashAlgorithmName; - [write, Description("Specifies that Unicode characters are allowed in certification authority name string.")] Boolean IgnoreUnicode; - [write, Description("Specifies the name of an existing private key container.")] String KeyContainerName; - [write, Description("Specifies the bit length for new certification authority key.")] Uint32 KeyLength; - [write, Description("Specifies the folder location of the certification authority database log.")] String LogDirectory; - [write, Description("Specifies the folder location for certificate request file.")] String OutputCertRequestFile; - [write, Description("Specifies that the computer object in the Active Directory Domain Service domain should be overwritten with the same computer name.")] Boolean OverwriteExistingCAinDS; - [write, Description("Specifies that the existing certification authority database should be overwritten.")] Boolean OverwriteExistingDatabase; - [write, Description("Overwrite existing key container with the same name")] Boolean OverwriteExistingKey; - [write, Description("Specifies the configuration string of the parent certification authority that will certify this CA.")] String ParentCA; - [write, Description("Specifies the validity period of the certification authority certificate in hours, days, weeks, months or years. If this is a subordinate CA, do not use this parameter, because the validity period is determined by the parent CA."), ValueMap{"Hours","Days","Months","Years"}, Values{"Hours","Days","Months","Years"}] String ValidityPeriod; - [write, Description("Validity period of the certification authority certificate. If this is a subordinate CA, do not specify this parameter because the validity period is determined by the parent CA.")] Uint32 ValidityPeriodUnits; -}; - diff --git a/lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsCertificationAuthority/en-us/MSFT_xAdcsCertificationAuthority.strings.psd1 b/lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsCertificationAuthority/en-us/MSFT_xAdcsCertificationAuthority.strings.psd1 deleted file mode 100644 index a5a9de17..00000000 --- a/lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsCertificationAuthority/en-us/MSFT_xAdcsCertificationAuthority.strings.psd1 +++ /dev/null @@ -1,13 +0,0 @@ -# Localized resources for MSFT_xAdcsCertificationAuthority - -ConvertFrom-StringData @' - GettingAdcsCAStatusMessage = Getting ADCS {0} Status. - TestingAdcsCAStatusMessage = Testing ADCS {0} Status. - AdcsCAInstalledButShouldNotBeMessage = ADCS {0} is installed but should not be. Change required. - AdcsCAInstalledAndShouldBeMessage = ADCS {0} is installed and should be. Change not required. - AdcsCANotInstalledButShouldBeMessage = ADCS {0} is not installed but should be. Change required. - AdcsCANotInstalledAndShouldNotBeMessage = ADCS {0} is not installed and should not be. Change not required. - SettingAdcsCAStatusMessage = Setting ADCS {0} Status. - InstallingAdcsCAMessage = Installing ADCS {0}. - UninstallingAdcsCAMessage = Uninstalling ADCS {0}. -'@ diff --git a/lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsOnlineResponder/MSFT_xAdcsOnlineResponder.psm1 b/lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsOnlineResponder/MSFT_xAdcsOnlineResponder.psm1 deleted file mode 100644 index 22599669..00000000 --- a/lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsOnlineResponder/MSFT_xAdcsOnlineResponder.psm1 +++ /dev/null @@ -1,262 +0,0 @@ -# Suppressed as per PSSA Rule Severity guidelines for unit/integration tests: -# https://github.com/PowerShell/DscResources/blob/master/PSSARuleSeverities.md -[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '')] -param () - -Import-Module -Name (Join-Path -Path (Split-Path $PSScriptRoot -Parent) ` - -ChildPath 'CommonResourceHelper.psm1') - -# Localized messages for Write-Verbose statements in this resource -$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_xAdcsOnlineResponder' - -<# - .SYNOPSIS - Returns an object containing the current state information for the ADCS Online Responder. - .PARAMETER IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes'. - .PARAMETER Credential - If the Online Responder service is configured to use Standalone certification authority, - then an account that is a member of the local Administrators on the CA is required. If - the Online Responder service is configured to use an Enterprise CA, then an account that - is a member of Domain Admins is required. - .PARAMETER Ensure - Specifies whether the Online Responder feature should be installed or uninstalled. - .OUTPUTS - Returns an object containing the ADCS Online Responder state information. -#> -Function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSShouldProcess', '')] - [CmdletBinding(SupportsShouldProcess = $true)] - [OutputType([System.Collections.Hashtable])] - param( - [Parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [String] - $IsSingleInstance, - - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [Parameter()] - [ValidateSet('Present','Absent')] - [string] - $Ensure = 'Present' - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.GettingAdcsOnlineResponderStatusMessage) - ) -join '' ) - - $ADCSParams = @{} + $PSBoundParameters - $null = $ADCSParams.Remove('IsSingleInstance') - $null = $ADCSParams.Remove('Ensure') - $null = $ADCSParams.Remove('Debug') - $null = $ADCSParams.Remove('ErrorAction') - - try - { - $null = Install-AdcsOnlineResponder @ADCSParams -WhatIf - # CA is not installed - $Ensure = 'Absent' - } - catch [Microsoft.CertificateServices.Deployment.Common.OCSP.OnlineResponderSetupException] - { - # CA is already installed - $Ensure = 'Present' - } - catch - { - # Something else went wrong - Throw $_ - } - - return @{ - Ensure = $Ensure - CAType = $CAType - Credential = $Credential - } -} # Function Get-TargetResource - -<# - .SYNOPSIS - Installs or uinstalls the ADCS Online Responder from the server. - .PARAMETER IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes'. - .PARAMETER Credential - If the Online Responder service is configured to use Standalone certification authority, - then an account that is a member of the local Administrators on the CA is required. If - the Online Responder service is configured to use an Enterprise CA, then an account that - is a member of Domain Admins is required. - .PARAMETER Ensure - Specifies whether the Online Responder feature should be installed or uninstalled. -#> -Function Set-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSShouldProcess', '')] - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [String] - $IsSingleInstance, - - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [Parameter()] - [ValidateSet('Present','Absent')] - [string] - $Ensure = 'Present' - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.SettingAdcsOnlineResponderStatusMessage) - ) -join '' ) - - $ADCSParams = @{} + $PSBoundParameters - $null = $ADCSParams.Remove('IsSingleInstance') - $null = $ADCSParams.Remove('Ensure') - $null = $ADCSParams.Remove('Debug') - $null = $ADCSParams.Remove('ErrorAction') - - switch ($Ensure) - { - 'Present' - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.InstallingAdcsOnlineResponderMessage) - ) -join '' ) - - (Install-AdcsOnlineResponder @ADCSParams -Force).ErrorString - } - 'Absent' - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.UninstallingAdcsOnlineResponderMessage) - ) -join '' ) - - (Uninstall-AdcsOnlineResponder -Force).ErrorString - } - } # switch -} # Function Set-TargetResource - -<# - .SYNOPSIS - Tests is the ADCS Online Responder is in the desired state. - .PARAMETER IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes'. - .PARAMETER Credential - If the Online Responder service is configured to use Standalone certification authority, - then an account that is a member of the local Administrators on the CA is required. If - the Online Responder service is configured to use an Enterprise CA, then an account that - is a member of Domain Admins is required. - .PARAMETER Ensure - Specifies whether the Online Responder feature should be installed or uninstalled. - .OUTPUTS - Returns true if the ADCS Online Responder is in the desired state. -#> -Function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSShouldProcess', '')] - [CmdletBinding()] - [OutputType([System.Boolean])] - param( - [parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [String] - $IsSingleInstance, - - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [Parameter()] - [ValidateSet('Present','Absent')] - [string] - $Ensure = 'Present' - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.TestingAdcsOnlineResponderStatusMessage -f $CAType) - ) -join '' ) - - $ADCSParams = @{} + $PSBoundParameters - $null = $ADCSParams.Remove('IsSingleInstance') - $null = $ADCSParams.Remove('Ensure') - $null = $ADCSParams.Remove('Debug') - $null = $ADCSParams.Remove('ErrorAction') - - try - { - $null = Install-AdcsOnlineResponder @ADCSParams -WhatIf - # Online Responder is not installed - switch ($Ensure) - { - 'Present' - { - # Online Responder is not installed but should be - change required - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.AdcsOnlineResponderNotInstalledButShouldBeMessage) - ) -join '' ) - - return $false - } - 'Absent' - { - # Online Responder is not installed and should not be - change not required - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.AdcsOnlineResponderNotInstalledAndShouldNotBeMessage) - ) -join '' ) - - return $true - } - } # switch - } - catch [Microsoft.CertificateServices.Deployment.Common.OCSP.OnlineResponderSetupException] - { - # Online Responder is already installed - switch ($Ensure) - { - 'Present' - { - # Online Responder is installed and should be - change not required - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.AdcsOnlineResponderInstalledAndShouldBeMessage) - ) -join '' ) - - return $true - } - 'Absent' - { - # Online Responder is installed and should not be - change required - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.AdcsOnlineResponderInstalledButShouldNotBeMessage) - ) -join '' ) - - return $false - } - } # switch - } - catch - { - # Something else went wrong - Throw $_ - } # try -} # Function Test-TargetResource - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsOnlineResponder/MSFT_xAdcsOnlineResponder.schema.mof b/lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsOnlineResponder/MSFT_xAdcsOnlineResponder.schema.mof deleted file mode 100644 index 88b11ddf..00000000 --- a/lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsOnlineResponder/MSFT_xAdcsOnlineResponder.schema.mof +++ /dev/null @@ -1,7 +0,0 @@ -[ClassVersion("0.1.0.0"), FriendlyName("xAdcsOnlineResponder")] -class MSFT_xAdcsOnlineResponder : OMI_BaseResource -{ - [Key, Description("Specifies the resource is a single instance, the value must be 'Yes'"), ValueMap{"Yes"}, Values{"Yes"}] String IsSingleInstance; - [Required, Description("If the Online Responder service is configured to use Standalone certification authority, then an account that is a member of the local Administrators on the CA is required. If the Online Responder service is configured to use an Enterprise CA, then an account that is a member of Domain Admins is required."), EmbeddedInstance("MSFT_Credential")] String Credential; - [Write, Description("Specifies whether the Online Responder feature should be installed or uninstalled."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; -}; diff --git a/lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsOnlineResponder/en-us/MSFT_xAdcsOnlineResponder.strings.psd1 b/lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsOnlineResponder/en-us/MSFT_xAdcsOnlineResponder.strings.psd1 deleted file mode 100644 index 73ed2913..00000000 --- a/lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsOnlineResponder/en-us/MSFT_xAdcsOnlineResponder.strings.psd1 +++ /dev/null @@ -1,13 +0,0 @@ -# Localized resources for MSFT_xAdcsOnlineResponder - -ConvertFrom-StringData @' - GettingAdcsOnlineResponderStatusMessage = Getting ADCS Online Responder Status. - TestingAdcsOnlineResponderStatusMessage = Testing ADCS Online Responder Status. - AdcsOnlineResponderInstalledButShouldNotBeMessage = ADCS Online Responder is installed but should not be. Change required. - AdcsOnlineResponderInstalledAndShouldBeMessage = ADCS Online Responder is installed and should be. Change not required. - AdcsOnlineResponderNotInstalledButShouldBeMessage = ADCS Online Responder is not installed but should be. Change required. - AdcsOnlineResponderNotInstalledAndShouldNotBeMessage = ADCS Online Responder is not installed and should not be. Change not required. - SettingAdcsOnlineResponderStatusMessage = Setting ADCS Online Responder Status. - InstallingAdcsOnlineResponderMessage = Installing ADCS Online Responder. - UninstallingAdcsOnlineResponderMessage = Uninstalling ADCS Online Responder. -'@ diff --git a/lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsWebEnrollment/MSFT_xAdcsWebEnrollment.psm1 b/lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsWebEnrollment/MSFT_xAdcsWebEnrollment.psm1 deleted file mode 100644 index 6a665e1e..00000000 --- a/lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsWebEnrollment/MSFT_xAdcsWebEnrollment.psm1 +++ /dev/null @@ -1,281 +0,0 @@ -# Suppressed as per PSSA Rule Severity guidelines for unit/integration tests: -# https://github.com/PowerShell/DscResources/blob/master/PSSARuleSeverities.md -[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '')] -param () - -Import-Module -Name (Join-Path -Path (Split-Path $PSScriptRoot -Parent) ` - -ChildPath 'CommonResourceHelper.psm1') - -# Localized messages for Write-Verbose statements in this resource -$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_xAdcsWebEnrollment' - -<# - .SYNOPSIS - Returns an object containing the current state information for the ADCS Web Enrollment. - .PARAMETER IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes'. - .PARAMETER CAConfig - CAConfig parameter string. Do not specify this if there is a local CA installed. - .PARAMETER Credential - If the Web Enrollment service is configured to use Standalone certification authority, then - an account that is a member of the local Administrators on the CA is required. If the - Web Enrollment service is configured to use an Enterprise CA, then an account that is a - member of Domain Admins is required. - .PARAMETER Ensure - Specifies whether the Web Enrollment feature should be installed or uninstalled. - .OUTPUTS - Returns an object containing the ADCS Web Enrollment state information. -#> -Function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSShouldProcess', '')] - [CmdletBinding(SupportsShouldProcess = $true)] - [OutputType([System.Collections.Hashtable])] - param( - [Parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [String] - $IsSingleInstance, - - [Parameter()] - [String] - $CAConfig, - - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [Parameter()] - [ValidateSet('Present','Absent')] - [String] - $Ensure = 'Present' - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.GettingAdcsWebEnrollmentStatusMessage) - ) -join '' ) - - $ADCSParams = @{} + $PSBoundParameters - $null = $ADCSParams.Remove('IsSingleInstance') - $null = $ADCSParams.Remove('Ensure') - $null = $ADCSParams.Remove('Debug') - $null = $ADCSParams.Remove('ErrorAction') - - try - { - $null = Install-AdcsWebEnrollment @ADCSParams -WhatIf - # CA is not installed - $Ensure = 'Absent' - } - catch [Microsoft.CertificateServices.Deployment.Common.WEP.WebEnrollmentSetupException] - { - # CA is already installed - $Ensure = 'Present' - } - catch - { - # Something else went wrong - Throw $_ - } - - return @{ - Ensure = $Ensure - CAType = $CAType - Credential = $Credential - } -} # Function Get-TargetResource - -<# - .SYNOPSIS - Installs or uinstalls the ADCS Web Enrollment from the server. - .PARAMETER IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes'. - .PARAMETER CAConfig - CAConfig parameter string. Do not specify this if there is a local CA installed. - .PARAMETER Credential - If the Web Enrollment service is configured to use Standalone certification authority, then - an account that is a member of the local Administrators on the CA is required. If the - Web Enrollment service is configured to use an Enterprise CA, then an account that is a - member of Domain Admins is required. - .PARAMETER Ensure - Specifies whether the Web Enrollment feature should be installed or uninstalled. -#> -Function Set-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSShouldProcess', '')] - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [String] - $IsSingleInstance, - - [Parameter()] - [String] - $CAConfig, - - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [Parameter()] - [ValidateSet('Present','Absent')] - [String] - $Ensure = 'Present' - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.SettingAdcsWebEnrollmentStatusMessage) - ) -join '' ) - - $ADCSParams = @{} + $PSBoundParameters - $null = $ADCSParams.Remove('IsSingleInstance') - $null = $ADCSParams.Remove('Ensure') - $null = $ADCSParams.Remove('Debug') - $null = $ADCSParams.Remove('ErrorAction') - - switch ($Ensure) - { - 'Present' - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.InstallingAdcsWebEnrollmentMessage) - ) -join '' ) - - (Install-AdcsWebEnrollment @ADCSParams -Force).ErrorString - } - 'Absent' - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.UninstallingAdcsWebEnrollmentMessage) - ) -join '' ) - - (Uninstall-AdcsWebEnrollment -Force).ErrorString - } - } # switch -} # Function Set-TargetResource - -<# - .SYNOPSIS - Tests is the ADCS Web Enrollment is in the desired state. - .PARAMETER IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes'. - .PARAMETER CAConfig - CAConfig parameter string. Do not specify this if there is a local CA installed. - .PARAMETER Credential - If the Web Enrollment service is configured to use Standalone certification authority, then - an account that is a member of the local Administrators on the CA is required. If the - Web Enrollment service is configured to use an Enterprise CA, then an account that is a - member of Domain Admins is required. - .PARAMETER Ensure - Specifies whether the Web Enrollment feature should be installed or uninstalled. - .OUTPUTS - Returns true if the ADCS Web Enrollment is in the desired state. -#> -Function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSShouldProcess', '')] - [CmdletBinding()] - [OutputType([System.Boolean])] - param( - [Parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [String] - $IsSingleInstance, - - [Parameter()] - [String] - $CAConfig, - - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [Parameter()] - [ValidateSet('Present','Absent')] - [String] - $Ensure = 'Present' - ) - - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.TestingAdcsWebEnrollmentStatusMessage -f $CAType) - ) -join '' ) - - $ADCSParams = @{} + $PSBoundParameters - $null = $ADCSParams.Remove('IsSingleInstance') - $null = $ADCSParams.Remove('Ensure') - $null = $ADCSParams.Remove('Debug') - $null = $ADCSParams.Remove('ErrorAction') - - try - { - $null = Install-AdcsWebEnrollment @ADCSParams -WhatIf - # Web Enrollment is not installed - switch ($Ensure) - { - 'Present' - { - # Web Enrollment is not installed but should be - change required - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.AdcsWebEnrollmentNotInstalledButShouldBeMessage) - ) -join '' ) - - return $false - } - 'Absent' - { - # Web Enrollment is not installed and should not be - change not required - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.AdcsWebEnrollmentNotInstalledAndShouldNotBeMessage) - ) -join '' ) - - return $true - } - } # switch - } - catch [Microsoft.CertificateServices.Deployment.Common.WEP.WebEnrollmentSetupException] - { - # Web Enrollment is already installed - switch ($Ensure) - { - 'Present' - { - # Web Enrollment is installed and should be - change not required - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.AdcsWebEnrollmentInstalledAndShouldBeMessage) - ) -join '' ) - - return $true - } - 'Absent' - { - # Web Enrollment is installed and should not be - change required - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.AdcsWebEnrollmentInstalledButShouldNotBeMessage) - ) -join '' ) - - return $false - } - } # switch - } - catch - { - # Something else went wrong - Throw $_ - } # try -} # Function Test-TargetResource - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsWebEnrollment/MSFT_xAdcsWebEnrollment.schema.mof b/lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsWebEnrollment/MSFT_xAdcsWebEnrollment.schema.mof deleted file mode 100644 index ccb41051..00000000 --- a/lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsWebEnrollment/MSFT_xAdcsWebEnrollment.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("0.1.0.0"), FriendlyName("xAdcsWebEnrollment")] -class MSFT_xAdcsWebEnrollment : OMI_BaseResource -{ - [Key, Description("Specifies the resource is a single instance, the value must be 'Yes'"), ValueMap{"Yes"}, Values{"Yes"}] String IsSingleInstance; - [Write, Description("CAConfig parameter string. Do not specify this if there is a local CA installed.")] String CAConfig; - [Required, Description("If the Web Enrollment service is configured to use Standalone certification authority, then an account that is a member of the local Administrators on the CA is required. If the Web Enrollment service is configured to use an Enterprise CA, then an account that is a member of Domain Admins is required."), EmbeddedInstance("MSFT_Credential")] String Credential; - [Write, Description("Specifies whether the Web Enrollment feature should be installed or uninstalled."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; -}; - diff --git a/lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsWebEnrollment/en-us/MSFT_xAdcsWebEnrollment.strings.psd1 b/lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsWebEnrollment/en-us/MSFT_xAdcsWebEnrollment.strings.psd1 deleted file mode 100644 index 360dd656..00000000 --- a/lib/puppet_x/dsc_resources/xAdcsDeployment/DSCResources/MSFT_xAdcsWebEnrollment/en-us/MSFT_xAdcsWebEnrollment.strings.psd1 +++ /dev/null @@ -1,13 +0,0 @@ -# Localized resources for MSFT_xAdcsWebEnrollment - -ConvertFrom-StringData @' - GettingAdcsWebEnrollmentStatusMessage = Getting ADCS Web Enrollment Status. - TestingAdcsWebEnrollmentStatusMessage = Testing ADCS Web Enrollment Status. - AdcsWebEnrollmentInstalledButShouldNotBeMessage = ADCS Web Enrollment is installed but should not be. Change required. - AdcsWebEnrollmentInstalledAndShouldBeMessage = ADCS Web Enrollment is installed and should be. Change not required. - AdcsWebEnrollmentNotInstalledButShouldBeMessage = ADCS Web Enrollment is not installed but should be. Change required. - AdcsWebEnrollmentNotInstalledAndShouldNotBeMessage = ADCS Web Enrollment is not installed and should not be. Change not required. - SettingAdcsWebEnrollmentStatusMessage = Setting ADCS Web Enrollment Status. - InstallingAdcsWebEnrollmentMessage = Installing ADCS Web Enrollment. - UninstallingAdcsWebEnrollmentMessage = Uninstalling ADCS Web Enrollment. -'@ diff --git a/lib/puppet_x/dsc_resources/xAdcsDeployment/LICENSE b/lib/puppet_x/dsc_resources/xAdcsDeployment/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xAdcsDeployment/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xAdcsDeployment/xAdcsDeployment.psd1 b/lib/puppet_x/dsc_resources/xAdcsDeployment/xAdcsDeployment.psd1 deleted file mode 100644 index d2a084d3..00000000 --- a/lib/puppet_x/dsc_resources/xAdcsDeployment/xAdcsDeployment.psd1 +++ /dev/null @@ -1,87 +0,0 @@ -@{ -# Version number of this module. -ModuleVersion = '1.1.0.0' - -# ID used to uniquely identify this module -GUID = 'f8ddd7fc-c6d6-469e-8a80-c96efabe2fcc' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2013 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'The xCertificateServices module can be used to install or uninstall Certificate Services components in Windows Server. All of the resources in the DSC Resource Kit are provided AS IS, and are not supported through any Microsoft standard support program or service.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Minimum version of the common language runtime (CLR) required by this module -CLRVersion = '4.0' - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/xAdcsDeployment/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/xAdcsDeployment' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - ReleaseNotes = '- Converted AppVeyor.yml to pull Pester from PSGallery instead of Chocolatey. -- Changed AppVeyor.yml to use default image. -- xAdcsCertificateAuthority: - - Change property format in Readme.md to be standard layout. - - Converted style to meet HQRM guidelines. - - Added verbose logging support. - - Added string localization. - - Fixed Get-TargetResource by removing IsCA and changing Ensure to return whether or not CA is installed. - - Added unit tests. - - Updated parameter format to meet HQRM guidelines. -- xAdcsOnlineResponder: - - Change property format in Readme.md to be standard layout. - - Added unit test header to be latest version. - - Added function help. - - Updated parameter format to meet HQRM guidelines. - - Updated resource to meet HQRM guidelines. -- xAdcsWebEnrollment: - - Change property format in Readme.md to be standard layout. - - Added unit test header to be latest version. - - Added function help. - - Updated parameter format to meet HQRM guidelines. - - Updated resource to meet HQRM guidelines. -- Added CommonResourceHelper.psm1 (copied from xPSDesiredStateConfiguration). -- Removed Technet Documentation HTML file from root folder. -- Removed redundant code from AppVeyor.yml. -- Fix markdown violations in Readme.md. -- Updated readme.md to match DSCResource.Template\Readme.md. - -' - - } # End of PSData hashtable - -} # End of PrivateData hashtable -} - - - - diff --git a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureAffinityGroup/MSFT_xAzureAffinityGroup.psm1 b/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureAffinityGroup/MSFT_xAzureAffinityGroup.psm1 deleted file mode 100644 index f3895c1d..00000000 --- a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureAffinityGroup/MSFT_xAzureAffinityGroup.psm1 +++ /dev/null @@ -1,133 +0,0 @@ -#region GET FUNCTION - -function Get-TargetResource { -[CmdletBinding()] -[OutputType([Hashtable])] -param ( -[Parameter(Mandatory)][string]$Location, -[Parameter(Mandatory)][string]$Name, -[string]$Description, -[string]$Label -) - $CurrentSubscription = Get-AzureSubscription -Current - Write-Verbose "The Azure subscription ID is $($CurrentSubscription.SubscriptionID)" - - # Native Get cmdlet - $Get = Get-AzureAffinityGroup -Name $Name -ErrorAction SilentlyContinue - - # Build Hashtable from native cmdlet values - $out = @{ - 'Ensure' = If ($Get.Name -eq $Name) {'Present'} Else {'Absent'} - 'Location' = $Get.Location - 'Name' = $Get.Name - 'Description' = $Get.Description - 'Label' = $Get.Label - } - $out - } - -# Get-TargetResource 'West US' 'TestVMWestUS1' 'West US Affinity Group for Test Virtual Machines' 'TestVMWestUS1' -Verbose -# Expectation is a hashtable with properties of the affinity group, if it exists. - -#endregion - - - -#region SET FUNCTION - -function Set-TargetResource { -[CmdletBinding()] -param( -[ValidateSet('Present','Absent')] -[string]$Ensure = 'Present', -[Parameter(Mandatory)][string]$Location, -[Parameter(Mandatory)][string]$Name, -[string]$Description, -[string]$Label -) - switch ($Ensure) { - 'Present' { - # Validate whether New or Set is required - $Get = Get-TargetResource -Location $Location -Name $Name -ErrorAction SilentlyContinue - - $PSBoundParameters.Remove('Ensure') | out-null - - if ($Get.Name -eq $Name) { - # Native Set cmdlet - $PSBoundParameters.Remove('Location') | out-null - Write-Verbose "Setting properties of existing Affinity Group: `"$Name`"" - Write-Verbose 'Please be patient as the operation completes.' - $CurrentSubscription = Get-AzureSubscription -Current - Write-Verbose "The Azure subscription ID is $($CurrentSubscription.SubscriptionID)" - Set-AzureAffinityGroup @PSBoundParameters - } - else { - # Native New cmdlet - Write-Verbose "Creating new Affinity Group: `"$Name`"" - Write-Verbose 'Please be patient as the operation completes.' - $CurrentSubscription = Get-AzureSubscription -Current - Write-Verbose "The Azure subscription ID is $($CurrentSubscription.SubscriptionID)" - New-AzureAffinityGroup @PSBoundParameters - } - } - 'Absent' { - Remove-AzureAffinityGroup $Name - } - } - } - -# Set-TargetResource 'Present' 'West US' 'TestVMWestUS1' 'West US Affinity Group for Test Virtual Machines' 'TestVMWestUS1' -Verbose -# Expectation is the affinity group will be created, set, or removed. Validate using Get-AzureAffinityGroup. - -#endregion - - - -#region TEST FUNCTION - -function Test-TargetResource { -[CmdletBinding()] -[OutputType([Boolean])] -param( -[ValidateSet('Present','Absent')] -[string]$Ensure, -[Parameter(Mandatory)][string]$Location, -[Parameter(Mandatory)][string]$Name, -[string]$Description, -[string]$Label -) - - # Output from Get-TargetResource - $Get = Get-TargetResource -Location $Location -Name $Name -ErrorAction SilentlyContinue - - # Removing Cmdlet parameters from output - $PSBoundParameters.Remove('Ensure') | out-null - $PSBoundParameters.Remove('Verbose') | out-null - $PSBoundParameters.Remove('Debug') | out-null - $PSBoundParameters.Remove('ErrorAction') | out-null - - # Compare dictionary and hash table - switch ($Ensure) { - 'Present'{$bool = $true} - 'Absent'{$bool = $false} - } - - $PSBoundParameters.keys | % { - if ($PSBoundParameters[$_] -ne $Get[$_]) { - switch ($Ensure) { - 'Present'{$bool = $false} - 'Absent'{$bool = $true} - } - write-verbose "$($_): $($PSBoundParameters[$_]) -ne `"$($Get[$_])`"" - } - } - - $bool - } - -# Test-TargetResource 'Present' 'West US' 'TestVMWestUS1' 'West US Affinity Group for Test Virtual Machines' 'TestVMWestUS1' -Verbose -# Expectation is True or False based on whether the affinity group has been deployed, depending on Present/Absent. - -#endregion - -Export-ModuleMember -function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureAffinityGroup/MSFT_xAzureAffinityGroup.schema.mof b/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureAffinityGroup/MSFT_xAzureAffinityGroup.schema.mof deleted file mode 100644 index e53e3a17..00000000 --- a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureAffinityGroup/MSFT_xAzureAffinityGroup.schema.mof +++ /dev/null @@ -1,12 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xAzureAffinityGroup")] -class MSFT_xAzureAffinityGroup : OMI_BaseResource -{ - [key, Description("Specifies a name for the new affinity group that is unique to the subscription.")] string Name; - [write, Description("Specifies whether the Azure Affinity Group should be present or absent."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [required, Description("Specifies the geographical location of the data center where the affinity group will be created. This must match a value from the Name property of objects returned by Get-AzureLocation.")] string Location; - [write, Description("Specifies a description for the affinity group. The description may be up to 1024 characters in length. ")] string Description; - [write, Description("Specifies a label for the affinity group. The label may be up to 100 characters in length. ")] string Label; -}; - - diff --git a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureQuickVM/MSFT_xAzureQuickVM.psm1 b/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureQuickVM/MSFT_xAzureQuickVM.psm1 deleted file mode 100644 index 69210952..00000000 --- a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureQuickVM/MSFT_xAzureQuickVM.psm1 +++ /dev/null @@ -1,123 +0,0 @@ -#region GET FUNCTION - -function Get-TargetResource { -[CmdletBinding()] -[OutputType([HashTable])] -param ( -[Parameter(Mandatory)][string]$Name, -[Parameter(Mandatory)][string]$ServiceName -) - $CurrentSubscription = Get-AzureSubscription -Current - Write-Verbose "The Azure subscription ID is $($CurrentSubscription.SubscriptionID)" - - # Native Get cmdlet - $Get = Get-AzureVM -Name $Name -ServiceName $ServiceName - - # Build Hashtable from native cmdlet values - @{ - 'Ensure' = If ($Get.Name -eq $Name) {'Present'} Else {'Absent'} - 'Name' = $Get.Name - 'ServiceName' = $Get.ServiceName - } - - } - -# Get-TargetResource -Name 'TestVM1' -ServiceName 'DSCCreatedService1' -Verbose -# Expectation is a hashtable with properties of the VM, if it exists. - -#endregion - - - -#region SET FUNCTION - -function Set-TargetResource { -[CmdletBinding()] -param( -[ValidateSet('Present','Absent')] -[string]$Ensure = 'Present', -[Parameter(Mandatory)][string]$Name, -[string]$ImageName, -[Parameter(Mandatory)][string]$ServiceName, -[bool]$Linux, -[string]$LinuxUser, -[bool]$Windows, -[string]$AdminUserName, -[string]$Password, -[string]$InstanceSize -) - # Removing parameters from output - $PSBoundParameters.Remove('Ensure') | out-null - $PSBoundParameters.Remove('Debug') | out-null - $PSBoundParameters.Remove('ErrorAction') | out-null - - switch ($Ensure) { - 'Present' { - # Native Set cmdlet - Write-Verbose "Creating VM `"$Name`" in Microsoft Azure." - Write-Verbose 'Please be patient as the operation completes.' - $CurrentSubscription = Get-AzureSubscription -Current - Write-Verbose "The Azure subscription ID is $($CurrentSubscription.SubscriptionID)" - New-AzureQuickVM @PSBoundParameters - } - 'Absent' { - # Native Set cmdlet - Write-Verbose "Removing VM `"$Name`" from Azure." - Write-Verbose 'Please be patient as the operation completes.' - $CurrentSubscription = Get-AzureSubscription -Current - Write-Verbose "The Azure subscription ID is $($CurrentSubscription.SubscriptionID)" - Remove-AzureVM -Name $Name -ServiceName $ServiceName -DeleteVHD - } - } - } - -# Set-TargetResource -Ensure 'Present' -Name 'TestVM1' -ImageName 'a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-201404.01-en.us-127GB.vhd' -ServiceName 'DSCCreatedService1' -Windows $True -AdminUserName 'YOURADMINACCOUNTHERE' -Password 'YOURPASSWORDHERE'-Verbose -# Expectation is the VM will be created, set, or removed. Validate using Get-AzureVM. - -#endregion - - - -#region TEST FUNCTION - -function Test-TargetResource { -[CmdletBinding()] -[OutputType([Boolean])] -param( -[ValidateSet('Present','Absent')] -[string]$Ensure = 'Present', -[Parameter(Mandatory)][string]$Name, -[string]$ImageName, -[Parameter(Mandatory)][string]$ServiceName, -[bool]$Linux, -[string]$LinuxUser, -[bool]$Windows, -[string]$AdminUserName, -[string]$Password, -[string]$InstanceSize -) - # Output from Get-TargetResource - $Get = Get-TargetResource -Name $Name -ServiceName $ServiceName -ErrorAction SilentlyContinue - - switch ($Ensure) { - 'Present'{$bool = $true} - 'Absent'{$bool = $false} - } - - if ($Name -ne $Get.Name -AND $ServiceName -ne $Get.ServiceName) { - switch ($Ensure) { - 'Present'{$bool = $false} - 'Absent'{$bool = $true} - } - write-verbose 'The VM could not be found in Azure.' - } - - $bool - } - -# Test-TargetResource -Ensure 'Present' -Name 'TestVM1' -ServiceName 'DSCCreatedService1' -Verbose -# Expectation is True or False based on whether the VM has been deployed, depending on Present/Absent. - -#endregion - -Export-ModuleMember -function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureQuickVM/MSFT_xAzureQuickVM.schema.mof b/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureQuickVM/MSFT_xAzureQuickVM.schema.mof deleted file mode 100644 index 66a232cc..00000000 --- a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureQuickVM/MSFT_xAzureQuickVM.schema.mof +++ /dev/null @@ -1,17 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xAzureQuickVM")] -class MSFT_xAzureQuickVM : OMI_BaseResource -{ - [key, Description("Specifies the name of the virtual machine.")] string Name; - [write, Description("Specifies whether the Azure VM should be present or absent."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [write, Description("Specifies the name of the operating system image to use to create the operating system disk.")] string ImageName; - [required, Description("Specifies the new or existing service name. ")] string ServiceName; - [write, Description("Creates a Linux virtual machine.")] boolean Linux; - [write, Description("Specifies the Linux administrative account name to create.")] string LinuxUser; - [write, Description("Creates a Windows virtual machine.")] boolean Windows; - [write, Description("Specifies the name for the administrative account to create.")] string AdminUsername; - [write, Description("Specifies the password for the administrative account.")] string Password; - [write, Description("Specifies the size of the instance. For a list of virtual machine sizes, see http://msdn.microsoft.com/library/azure/dn197896.aspx")] string InstanceSize; -}; - - diff --git a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureService/MSFT_xAzureService.psm1 b/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureService/MSFT_xAzureService.psm1 deleted file mode 100644 index b89652be..00000000 --- a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureService/MSFT_xAzureService.psm1 +++ /dev/null @@ -1,149 +0,0 @@ -#region GET FUNCTION - -function Get-TargetResource { -[CmdletBinding()] -[OutputType([HashTable])] -param ( -[ValidateSet('Present','Absent')] -[string]$Ensure = 'Present', -[Parameter(Mandatory)][string]$AffinityGroup, -[Parameter(Mandatory)][string]$ServiceName, -[string]$Description, -[string]$Label -) - $CurrentSubscription = Get-AzureSubscription -Current - Write-Verbose "The Azure subscription ID is $($CurrentSubscription.SubscriptionID)" - - # Native Get cmdlet - $Get = Get-AzureService $ServiceName -ErrorAction SilentlyContinue - - # Build Hashtable from native cmdlet values - @{ - 'Ensure' = If ($Get.ServiceName -eq $ServiceName) {'Present'} Else {'Absent'} - 'AffinityGroup' = $Get.AffinityGroup - 'ServiceName' = $Get.ServiceName - 'Description' = $Get.Description - 'Label' = $Get.Label - } - - } - -# Get-TargetResource 'Present' 'TestVMsWestUS1' 'testvmsservice1' 'Test Service created for Test Virtual Machines 1' 'Test VMs Service 1' -Verbose -# Expectation is a hashtable with properties of the service, if it exists. - -#endregion - - - -#region SET FUNCTION - -function Set-TargetResource { -[CmdletBinding()] -param( -[ValidateSet('Present','Absent')] -[string]$Ensure = 'Present', -[Parameter(Mandatory)][string]$AffinityGroup, -[Parameter(Mandatory)][string]$ServiceName, -[string]$Description, -[string]$Label -) - $CurrentSubscription = Get-AzureSubscription -Current - Write-Verbose "The Azure subscription ID is $($CurrentSubscription.SubscriptionID)" - - # Removing parameters from output - $PSBoundParameters.Remove('Debug') | out-null - $PSBoundParameters.Remove('ErrorAction') | out-null - - switch ($Ensure) { - 'Present' { - #Native test for name conflict - $TestAzureServiceName = Test-AzureName -Name $ServiceName -Service - - # Validate whether New or Set is required - $Get = Get-TargetResource -AffinityGroup $AffinityGroup -ServiceName $ServiceName -ErrorAction SilentlyContinue - $PSBoundParameters.Remove('Ensure') | out-null - - if ($Get.ServiceName -eq $ServiceName) { - # Native Set cmdlet - $PSBoundParameters.Remove('AffinityGroup') | out-null - Write-Verbose "Setting properties of Azure Service: `"$ServiceName`"" - Write-Verbose 'Please be patient as the operation completes.' - $CurrentSubscription = Get-AzureSubscription -Current - Write-Verbose "The Azure subscription ID is $($CurrentSubscription.SubscriptionID)" - Set-AzureService @PSBoundParameters - } - else{ - # Native New cmdlet - if ($TestAzureServiceName -eq $False){ - Write-Verbose "Creating new Azure Service: `"$ServiceName`"" - Write-Verbose 'Please be patient as the operation completes.' - $CurrentSubscription = Get-AzureSubscription -Current - Write-Verbose "The Azure subscription ID is $($CurrentSubscription.SubscriptionID)" - New-AzureService @PSBoundParameters - } - else { - Write-Error "Unable to create Service, the name `"$ServiceName`" is already in use" - } - } - } - 'Absent' { - $CurrentSubscription = Get-AzureSubscription -Current - Write-Verbose "The Azure subscription ID is $($CurrentSubscription.SubscriptionID)" - Remove-AzureService -ServiceName $ServiceName -Force - } - } - } - -# Set-TargetResource 'Present' 'TestVMsWestUS1' 'testvmsservice1' 'Test Service created for Test Virtual Machines 1' 'Test VMs Service 1' -Verbose -# Expectation is the service will be created, set, or removed. Validate using Get-AzureService. - -#endregion - - - -#region TEST FUNCTION - -function Test-TargetResource { -[CmdletBinding()] -[OutputType([Boolean])] -param( -[ValidateSet('Present','Absent')] -[string]$Ensure = 'Present', -[Parameter(Mandatory)][string]$AffinityGroup, -[Parameter(Mandatory)][string]$ServiceName, -[string]$Description, -[string]$Label -) - $Get = Get-TargetResource -AffinityGroup $AffinityGroup -ServiceName $ServiceName -ErrorAction SilentlyContinue - - # Removing Cmdlet parameters from output - $PSBoundParameters.Remove('Ensure') | out-null - $PSBoundParameters.Remove('Verbose') | out-null - $PSBoundParameters.Remove('Debug') | out-null - $PSBoundParameters.Remove('ErrorAction') | out-null - - # Compare dictionary and hash table - switch ($Ensure) { - 'Present'{$bool = $true} - 'Absent'{$bool = $false} - } - - $PSBoundParameters.keys | % { - if ($PSBoundParameters[$_] -ne $Get[$_]) { - switch ($Ensure) { - 'Present'{$bool = $false} - 'Absent'{$bool = $true} - } - write-verbose "$($_): $($PSBoundParameters[$_]) -ne `"$($Get[$_])`"" - } - } - - $bool - } - -# Test-TargetResource 'Present' 'TestVMsWestUS1' 'testvmsservice1' 'Test Service created for Test Virtual Machines 1' 'Test VMs Service 1' -Verbose -# Expectation is True or False based on whether the service has been deployed, depending on Present/Absent. - -#endregion - -Export-ModuleMember -function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureService/MSFT_xAzureService.schema.mof b/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureService/MSFT_xAzureService.schema.mof deleted file mode 100644 index d10a1300..00000000 --- a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureService/MSFT_xAzureService.schema.mof +++ /dev/null @@ -1,12 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xAzureService")] -class MSFT_xAzureService : OMI_BaseResource -{ - [key, Description("Specifies a name for the new cloud service that is unique to the subscription.")] string ServiceName; - [write, Description("Specifies whether the service should be present or absent."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [write, Description("Specifies the Azure Affinity Group for the service.")] string Description; - [required, Description("Specifies a description for the service.")] string AffinityGroup; - [write, Description("Specifies a label for the service.")] string Label; -}; - - diff --git a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureSqlDatabase/MSFT_xAzureSqlDatabase.psm1 b/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureSqlDatabase/MSFT_xAzureSqlDatabase.psm1 deleted file mode 100644 index a50a3178..00000000 --- a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureSqlDatabase/MSFT_xAzureSqlDatabase.psm1 +++ /dev/null @@ -1,380 +0,0 @@ -data localizedData -{ - # culture="en-US" - ConvertFrom-StringData @' -DatabaseServerCouldNotBeCreatedError=Could not create database in the following location: "{0}". Verify you did not exceed database server limit. -DatabaseServerNotExistsError=Database server "{0}" does not exist. You have to specify name of existing server. -'@ -} - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $ServerCredential, - - [parameter(Mandatory = $true)] - [System.String] - $ServerName, - - [System.String] - $AzureSubscriptionName, - - [System.String] - $AzurePublishSettingsFile - ) - - # Select Azure subscription - if ($AzureSubscriptionName -and $AzurePublishSettingsFile) - { - Write-Verbose "Azure Publish Setting provided. AzureSubscriptionName = $AzureSubscriptionName, AzurePublishSettingsFile = $AzurePublishSettingsFile. Selecting Azure subscription." - Import-AzurePublishSettingsFile $AzurePublishSettingsFile - Select-AzureSubscription -SubscriptionName $AzureSubscriptionName -Current -ErrorAction SilentlyContinue - $currentSubscription = Get-AzureSubscription -Current - Write-Verbose "The selected Azure subscription ID is $($currentSubscription.SubscriptionID)" - } - - # Verify that database server with given name exists - Write-Verbose "Verifying that server '$ServerName' exists" - - try { - $server = Get-AzureSqlDatabaseServer -ServerName $ServerName -ErrorAction Stop - Write-Verbose "Server '$ServerName' exists" - } catch [System.Exception] { - # Throw exception if specified ServerName does not exist - $errorMessage = $($LocalizedData.DatabaseServerNotExistsError) -f ${ServerName} - $errorMessage += "`nException message: `n" + $_ - Throw-InvalidOperationException -errorId "DatabaseServerNotExistsFailure" -errorMessage $errorMessage - } - - $nameState = $Name - $maxSizeGBState = $null - $collationState = $null - $editionState = $null - $serverCredentialState = $null - $serverNameState = $ServerName - $ensureState = $null - - # Get database state - Write-Verbose "Creating database server context for $ServerName" - $databaseServerContext = New-AzureSqlDatabaseServerContext -ServerName $ServerName -Credential $ServerCredential - - Write-Verbose "Checking whether Azure SQL database '$Name' exists" - $currentDatabase = Get-AzureSqlDatabase -ConnectionContext $databaseServerContext -DatabaseName $Name -ErrorAction SilentlyContinue - - Write-Verbose "Getting status of database '$Name'" - if ($currentDatabase) { - $maxSizeGBState = $currentDatabase.MaxSizeGB - $collationState = $currentDatabase.CollationName - $editionState = $currentDatabase.Edition - $ensureState = "Present" - - } else { - $ensureState = "Absent" - } - - $returnValue = @{ - Name = $nameState - MaximumSizeInGB = $maxSizeGBState - Collation = $collationState - Edition = $editionState - ServerCredential = $serverCredentialState - ServerName = $serverNameState - Ensure = $ensureState - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [System.UInt32] - $MaximumSizeInGB = 1, - - [System.String] - $Collation = "SQL_Latin1_General_CP1_CI_AS", - - [System.String] - $Edition = "Web", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $ServerCredential, - - [parameter(Mandatory = $true)] - [System.String] - $ServerName, - - [System.String] - $AzureSubscriptionName, - - [System.String] - $AzurePublishSettingsFile, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present" - ) - # Verify that database server with given name exists - Write-Verbose "Verifying that server '$ServerName' exists" - - try { - $server = Get-AzureSqlDatabaseServer -ServerName $ServerName -ErrorAction Stop - Write-Verbose "Server '$ServerName' exists" - } catch [System.Exception] { - # Throw exception if specified ServerName does not exist - $errorMessage = $($LocalizedData.DatabaseServerNotExistsError) -f ${ServerName} - $errorMessage += "`nException message: `n" + $_ - Throw-InvalidOperationException -errorId "DatabaseServerNotExistsFailure" -errorMessage $errorMessage - } - - # If we want to ensure database is present - if ($Ensure -eq "Present") - { - # Create database server context - Write-Verbose "Creating database server context for $ServerName" - $databaseServerContext = New-AzureSqlDatabaseServerContext -ServerName $ServerName -Credential $ServerCredential - - Write-Verbose "Checking whether Azure SQL database '$Name' exists" - $database = Get-AzureSqlDatabase -ConnectionContext $databaseServerContext -DatabaseName $Name -ErrorAction SilentlyContinue - - if ($database) { - Write-Verbose "Azure SQL database '$Name' exists." - - # Get passed values - $splat = @{} - $value = $null - - $paramName = "MaximumSizeInGB" - if ($PSBoundParameters.TryGetValue($paramName, [ref]$value)) { - $splat.Add("MaxSizeGB", $value) - } - - $paramName = "Edition" - if ($PSBoundParameters.TryGetValue($paramName, [ref]$value)) { - $splat.Add($paramName, $value) - } - - if ($splat.Count -ne 0) { - # Update database with passed values - Write-Verbose "Updating database '$Name' with properties specified by user." - $database = Set-AzureSqlDatabase -ConnectionContext $databaseServerContext -DatabaseName $Name @splat -ErrorAction Stop - } else { - Write-Verbose "No need for updating database '$Name' cause no additional properties were passed by the user." - } - - # If user specified collation which is different than current one, delete and recreate database (collation cannot be changed) - $paramName = "Collation" - if ($PSBoundParameters.TryGetValue($paramName, [ref]$value)) { - if ($value -ne $database.CollationName) { - Write-Verbose "Collation was specified with value '$value' which is different than current collation: '$($database.CollationName)'. Will remove and recreate database." - Remove-AzureSqlDatabase -ConnectionContext $databaseServerContext -DatabaseName $Name -Force - Write-Verbose "Azure SQL database '$Name' has been removed. Recreating it..." - $database = New-AzureSqlDatabase -ConnectionContext $databaseServerContext -DatabaseName $Name -MaxSizeGB $MaximumSizeInGB -Collation $Collation -Edition $Edition -ErrorAction Stop - Write-Verbose "Azure SQL database '$Name' has been created" - } - } - - } else { - Write-Verbose "Azure SQL database '$Name' does not exist. Creating it..." - if ($Collation) { - $database = New-AzureSqlDatabase -ConnectionContext $databaseServerContext -DatabaseName $Name -MaxSizeGB $MaximumSizeInGB -Collation $Collation -Edition $Edition -ErrorAction Stop - } else { - $database = New-AzureSqlDatabase -ConnectionContext $databaseServerContext -DatabaseName $Name -MaxSizeGB $MaximumSizeInGB -Edition $Edition -ErrorAction Stop - } - Write-Verbose "Azure SQL database '$Name' has been created" - } - } - # If we want to ensure database is absent - elseif ($Ensure -eq "Absent") - { - # Create database server context - Write-Verbose "Creating database server context for $ServerName" - $databaseServerContext = New-AzureSqlDatabaseServerContext -ServerName $ServerName -Credential $ServerCredential - - # Remove database - Write-Verbose "Checking whether Azure SQL database '$Name' exists." - $database = Get-AzureSqlDatabase -ConnectionContext $databaseServerContext -DatabaseName $Name -ErrorAction SilentlyContinue - - if ($database) { - Write-Verbose "Azure SQL database '$Name' exists. Removing it..." - Remove-AzureSqlDatabase -ConnectionContext $databaseServerContext -DatabaseName $Name -Force - Write-Verbose "Azure SQL database '$Name' has been removed." - } else { - Write-Verbose "Azure SQL database '$Name' does not exist. No need to remove." - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [System.UInt32] - $MaximumSizeInGB = 1, - - [System.String] - $Collation = "SQL_Latin1_General_CP1_CI_AS", - - [System.String] - $Edition = "Web", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $ServerCredential, - - [parameter(Mandatory = $true)] - [System.String] - $ServerName, - - [System.String] - $AzureSubscriptionName, - - [System.String] - $AzurePublishSettingsFile, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present" - ) - - $testResult = $true; - - # Select Azure subscription - if ($AzureSubscriptionName -and $AzurePublishSettingsFile) - { - Write-Verbose "Azure Publish Setting provided. AzureSubscriptionName = $AzureSubscriptionName, AzurePublishSettingsPath = $AzurePublishSettingsFile. Selecting Azure subscription." - Import-AzurePublishSettingsFile -PublishSettingsFile $AzurePublishSettingsFile -ErrorAction SilentlyContinue - Select-AzureSubscription -SubscriptionName $AzureSubscriptionName -Current -ErrorAction SilentlyContinue - $currentSubscription = Get-AzureSubscription -Current - Write-Verbose "The selected Azure subscription ID is $($currentSubscription.SubscriptionID)" - } - - # Select Azure subscription - if ($AzureSubscriptionName -and $AzurePublishSettingsFile) - { - Write-Verbose "Azure Publish Setting provided. AzureSubscriptionName = $AzureSubscriptionName, AzurePublishSettingsFile = $AzurePublishSettingsFile. Selecting Azure subscription." - Import-AzurePublishSettingsFile $AzurePublishSettingsFile - Select-AzureSubscription -SubscriptionName $AzureSubscriptionName -Current -ErrorAction SilentlyContinue - $currentSubscription = Get-AzureSubscription -Current - Write-Verbose "The selected Azure subscription ID is $($currentSubscription.SubscriptionID)" - } - - if ($Ensure -eq "Present") - { - # Verify that database server with given name exists - Write-Verbose "Verifying that server '$ServerName' exists" - - try { - $server = Get-AzureSqlDatabaseServer -ServerName $ServerName #-ErrorAction Stop - Write-Verbose "Server '$ServerName' exists" - } catch [System.Exception] { - # Throw exception if specified ServerName does not exist - $errorMessage = $($LocalizedData.DatabaseServerNotExistsError) -f ${ServerName} - $errorMessage += "`nException message: `n" + $_ - Throw-InvalidOperationException -errorId "DatabaseServerNotExistsFailure" -errorMessage $errorMessage - } - - # Check whether database is in desired state - Write-Verbose "Creating database server context for $ServerName" - $databaseServerContext = New-AzureSqlDatabaseServerContext -ServerName $ServerName -Credential $ServerCredential - - Write-Verbose "Checking whether Azure SQL database '$Name' exists" - $currentDatabase = Get-AzureSqlDatabase -ConnectionContext $databaseServerContext -DatabaseName $Name -ErrorAction SilentlyContinue - - if ($currentDatabase) { - - # Check whether current database properties match the specified ones - $editionMatches = $currentDatabase.Edition.Equals($Edition) - $maximumSizeInGBMatches = ($currentDatabase.MaxSizeGB -eq $MaximumSizeInGB) - $collationMatches = $currentDatabase.CollationName.Equals($Collation) - - if ($editionMatches -and $maximumSizeInGBMatches -and $collationMatches) { - Write-Verbose "Azure SQL database '$Name' exists and properties match." - } else { - # Check whether some of specified properties don't match - $value = $null - $paramNames = @("Edition", "MaximumSizeInGB", "Collation") - $specifiedPropertiesMatch = $true - foreach ($paramName in $paramNames) { - $paramMatches = (Get-Variable -Name ("$paramName" + "Matches")) - if (($PSBoundParameters.TryGetValue($paramName, [ref]$value)) -and (-not ($paramMatches.Value))) { - $testResult = $false - $specifiedPropertiesMatch = $false - Write-Verbose "Azure SQL database '$Name' exists but current $paramName value does not match desired value: $value. Resource is not in desired state." - } - } - - if ($specifiedPropertiesMatch) { - Write-Verbose "Azure SQL database '$Name' exists and specified properties match!" - } - } - - } else { - Write-Verbose "Azure SQL database '$Name' does not exist. Resource is not in desired state." - $testResult = $false - } - } - elseif ($Ensure -eq "Absent") - { - # Check whether database is in desired state - Write-Verbose "Creating database server context for $ServerName" - $databaseServerContext = New-AzureSqlDatabaseServerContext -ServerName $ServerName -Credential $ServerCredential - - Write-Verbose "Checking whether Azure SQL database '$Name' exists" - $currentDatabase = Get-AzureSqlDatabase -ConnectionContext $databaseServerContext -DatabaseName $Name -ErrorAction SilentlyContinue - - if ($currentDatabase) { - Write-Verbose "Azure SQL database '$Name' exists. Resource is not in desired state." - $testResult = $false - } - } - - return $testResult -} - -# Throws terminating error of category InvalidOperation with specified errorId and errorMessage -function Throw-InvalidOperationException -{ - param( - [parameter(Mandatory = $true)] - [System.String] - $errorId, - [parameter(Mandatory = $true)] - [System.String] - $errorMessage - ) - - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidOperation - $exception = New-Object System.InvalidOperationException $errorMessage - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - throw $errorRecord -} - -Export-ModuleMember -Function *-TargetResource - - - diff --git a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureSqlDatabase/MSFT_xAzureSqlDatabase.schema.mof b/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureSqlDatabase/MSFT_xAzureSqlDatabase.schema.mof deleted file mode 100644 index ef1a626d..00000000 --- a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureSqlDatabase/MSFT_xAzureSqlDatabase.schema.mof +++ /dev/null @@ -1,17 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xAzureSqlDatabase")] -class MSFT_xAzureSqlDatabase : OMI_BaseResource -{ - [Key, Description("Name of the database")] String Name; - [Write, Description("Maximum size of the database in GB")] UInt32 MaximumSizeInGB; - [Write, Description("Collation of the database")] String Collation; - [Write, Description("Edition of the database")] String Edition; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to the database server")] String ServerCredential; - [Required, Description("Name of the database server")] String ServerName; - [Write, Description("Specifies the name of the Azure subscription that should be set to Current")] String AzureSubscriptionName; - [Write, Description("Specifies the location of the Publish Settings file for the Azure Subscription")] String AzurePublishSettingsFile; - [Write, Description("Ensure that database is present or absent"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureSqlDatabaseServerFirewallRule/MSFT_xAzureSqlDatabaseServerFirewallRule.psm1 b/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureSqlDatabaseServerFirewallRule/MSFT_xAzureSqlDatabaseServerFirewallRule.psm1 deleted file mode 100644 index 0f353f37..00000000 --- a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureSqlDatabaseServerFirewallRule/MSFT_xAzureSqlDatabaseServerFirewallRule.psm1 +++ /dev/null @@ -1,210 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $RuleName, - - [parameter(Mandatory = $true)] - [System.String] - $ServerName, - - [parameter(Mandatory = $true)] - [System.String] - $StartIPAddress, - - [parameter(Mandatory = $true)] - [System.String] - $EndIPAddress, - - [System.String] - $AzureSubscriptionName, - - [System.String] - $AzurePublishSettingsFile - ) - - # Select Azure subscription - if ($AzureSubscriptionName -and $AzurePublishSettingsFile) - { - Write-Verbose "Azure Publish Setting provided. AzureSubscriptionName = $AzureSubscriptionName, AzurePublishSettingsFile = $AzurePublishSettingsFile. Selecting Azure subscription." - Import-AzurePublishSettingsFile $AzurePublishSettingsFile -verbose - Select-AzureSubscription -SubscriptionName $AzureSubscriptionName -Current -ErrorAction SilentlyContinue -verbose - $currentSubscription = Get-AzureSubscription -Current -verbose - Write-Verbose "The selected Azure subscription ID is $($currentSubscription.SubscriptionID)" - } - - $startIPAddressState = $null - $endIPAddressState = $null - $ensureState = $null - - # Get firewall rule state - Write-Verbose "Getting status of firewall rule '$RuleName'" - $currentFirewallRule = Get-AzureSqlDatabaseServerFirewallRule -ServerName $ServerName -RuleName $RuleName -ErrorAction SilentlyContinue -verbose - Write-Verbose "Status of firewall rule '$RuleName' obtained." - if ($currentFirewallRule) { - $startIPAddressState = $currentFirewallRule.StartIPAddress - $endIPAddressState = $currentFirewallRule.EndIPAddress - $ensureState = "Present" - } else { - $ensureState = "Absent" - } - - $returnValue = @{ - RuleName = $RuleName - ServerName = $ServerName - StartIPAddress = $startIPAddressState - EndIPAddress = $endIPAddressState - AzureSubscriptionName = $AzureSubscriptionName - AzurePublishSettingsFile = $AzurePublishSettingsFile - Ensure = $ensureState - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $RuleName, - - [parameter(Mandatory = $true)] - [System.String] - $ServerName, - - [parameter(Mandatory = $true)] - [System.String] - $StartIPAddress, - - [parameter(Mandatory = $true)] - [System.String] - $EndIPAddress, - - [System.String] - $AzureSubscriptionName, - - [System.String] - $AzurePublishSettingsFile, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present" - ) - - # Check whether firwall rule with specific name exists - $PSBoundParameters.Remove("Ensure") | Out-Null - $currentFirewallRule = Get-TargetResource @PSBoundParameters - $firwallRuleExists = $false - if ($currentFirewallRule.Ensure -eq "Present") { - $firewallRuleExists = $true - } - - # If we want to ensure firewall rule is present - if ($Ensure -eq "Present") - { - # Create firewall rule if not exists - if (-not $firewallRuleExists) { - Write-Verbose "Creating firewall rule '$RuleName'" - New-AzureSqlDatabaseServerFirewallRule -ServerName $ServerName -RuleName $RuleName -StartIpAddress $StartIPAddress -EndIpAddress $EndIPAddress -ErrorAction Stop | Out-Null - Write-Verbose "Firewall rule '$RuleName' created" - # Modify firewall rule if exists - } else { - Write-Verbose "Updating firewall rule '$RuleName'" - Set-AzureSqlDatabaseServerFirewallRule -ServerName $ServerName -RuleName $RuleName -StartIpAddress $StartIPAddress -EndIpAddress $EndIPAddress -ErrorAction Stop | Out-Null - Write-Verbose "Firewall rule '$RuleName' updated" - } - } - # If we want to ensure database is absent - elseif ($Ensure -eq "Absent") - { - # Remove firewall rule - if ($firewallRuleExists) { - Write-Verbose "Firewall rule '$RuleName' exists. Removing it." - Remove-AzureSqlDatabaseServerFirewallRule -ServerName $ServerName -RuleName $RuleName -verbose - Write-Verbose "Firewall rule '$RuleName' has been removed." - } else { - Write-Verbose "Firewall rule '$RuleName' does not exist. No need to remove." - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $RuleName, - - [parameter(Mandatory = $true)] - [System.String] - $ServerName, - - [parameter(Mandatory = $true)] - [System.String] - $StartIPAddress, - - [parameter(Mandatory = $true)] - [System.String] - $EndIPAddress, - - [System.String] - $AzureSubscriptionName, - - [System.String] - $AzurePublishSettingsFile, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present" - ) - - $testResult = $true; - - $PSBoundParameters.Remove("Ensure") | Out-Null - $currentFirewallRule = Get-TargetResource @PSBoundParameters - Write-Verbose "Testing whether resource is in desired state" - if($Ensure -eq "Present") { - if ($currentFirewallRule.Ensure -eq "Present") { - - # Check whether current firewall rule properties match the specified ones - if($currentFirewallRule.StartIpAddress.Equals($startIPAddress) -and $currentFirewallRule.EndIpAddress.Equals($endIPAddress)) { - Write-Verbose "SQL database server firewall rule '$RuleName' exists and properties match. Resource is in desired state." - } else { - Write-Verbose "SQL database server firewall rule '$RuleName' exists but properties don't match. Resource is not in desired state." - $testResult = $false - } - } else { - Write-Verbose "SQL database server firewall rule '$RuleName' does not exist, but expected to be present. Resource is not in desired state." - $testResult = $false - } - } elseif ($Ensure -eq "Absent") { - - # If firewall rule with given name exists, resource is not in the desired state - if ($currentFirewallRule.Ensure -eq "Present") { - Write-Verbose "SQL database server firewall rule '$RuleName' exists, but expected to be absent. Resource is not in desired state." - $testResult = $false - } else { - Write-Verbose "SQL database server firewall rule '$RuleName' does not exist. Resource is in desired state." - } - } - - $testResult - -} - - -Export-ModuleMember -Function *-TargetResource - - - diff --git a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureSqlDatabaseServerFirewallRule/MSFT_xAzureSqlDatabaseServerFirewallRule.schema.mof b/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureSqlDatabaseServerFirewallRule/MSFT_xAzureSqlDatabaseServerFirewallRule.schema.mof deleted file mode 100644 index ef96236c..00000000 --- a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureSqlDatabaseServerFirewallRule/MSFT_xAzureSqlDatabaseServerFirewallRule.schema.mof +++ /dev/null @@ -1,15 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xAzureSqlDatabaseServerFirewallRule")] -class MSFT_xAzureSqlDatabaseServerFirewallRule : OMI_BaseResource -{ - [Key, Description("Name of the firewall rule")] String RuleName; - [Key, Description("Name of the database server for which firewall rule should be created")] String ServerName; - [Required, Description("Start IP address of the firewall rule")] String StartIPAddress; - [Required, Description("End IP address of the firewall rule")] String EndIPAddress; - [Write, Description("Specifies the name of the Azure subscription that should be set to Current")] String AzureSubscriptionName; - [Write, Description("Specifies the location of the Publish Settings file for the Azure Subscription")] String AzurePublishSettingsFile; - [Write, Description("Ensure that firewall rule is present or absent"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureStorageAccount/MSFT_xAzureStorageAccount.psm1 b/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureStorageAccount/MSFT_xAzureStorageAccount.psm1 deleted file mode 100644 index 2e142bf6..00000000 --- a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureStorageAccount/MSFT_xAzureStorageAccount.psm1 +++ /dev/null @@ -1,240 +0,0 @@ -#region GET FUNCTION - -function Get-TargetResource { -[CmdletBinding()] -[OutputType([Hashtable])] -param ( -[Parameter(Mandatory)][string]$AffinityGroup, -[Parameter(Mandatory)][string]$StorageAccountName, -[string]$Container, -[string]$Folder, -[string]$Label -) - $CurrentSubscription = Get-AzureSubscription -Current - $CurrentSubscription.CurrentStorageAccountName = $StorageAccountName - Write-Verbose "The Azure subscription ID is $($CurrentSubscription.SubscriptionID)" - Write-Verbose "The Azure storage account is $($CurrentSubscription.CurrentStorageAccountName)" - - # Native Get cmdlet - $Get = Get-AzureStorageAccount -StorageAccountName $StorageAccountName -ErrorAction SilentlyContinue - if ($Get -ne $null -AND $Container -ne '') { - $StorageKey = Get-AzureStorageKey -StorageAccountName $StorageAccountName - $AzureStorageContext = New-AzureStorageContext -StorageAccountName $StorageAccountName -StorageAccountKey $StorageKey.Primary -Protocol Https - - $GetContainer = Get-AzureStorageContainer -Name $Container -Context $AzureStorageContext -ErrorAction SilentlyContinue | % Name - - if ($Folder){ - $GetFolder = Get-Item $Folder -ErrorAction SilentlyContinue | % FullName - } - } - - # Build Hashtable from cmdlet values - @{ - 'Ensure' = If ($Get.StorageAccountName -eq $StorageAccountName) {'Present'} Else {'Absent'} - 'AffinityGroup' = $Get.AffinityGroup - 'StorageAccountName' = $Get.StorageAccountName - 'Container' = $GetContainer - 'Folder' = $GetFolder - 'Label' = $Get.Label - } - - } - -# Get-TargetResource 'TestVMWestUS1' 'testvmstorage1' -Container 'scriptextensionfiles' -folder 'c:\Azure\scriptextensionfiles' -Verbose -# Expectation is a hashtable with properties of the storage account, if it exists. - -#endregion - - - -#region SET FUNCTION - -function Set-TargetResource { -[CmdletBinding()] -param( -[ValidateSet('Present','Absent')] -[string]$Ensure = 'Present', -[Parameter(Mandatory)][string]$AffinityGroup, -[Parameter(Mandatory)][string]$StorageAccountName, -[string]$Container, -[string]$Folder, -[string]$Label -) - - switch ($Ensure) { - 'Present' { - # Native Test for name conflict - $CurrentSubscription = Get-AzureSubscription -Current - Write-Verbose "The Azure subscription ID is $($CurrentSubscription.SubscriptionID)" - $TestAzureStorageName = Test-AzureName -Name $StorageAccountName -Storage - - # Test storage account name for Azure requirements, lowercase, no special characters, and between 3 and 24 characters - $AzureStorageNameRequirements = ($StorageAccountName -cmatch '^[a-z\d]+$') - if ($AzureStorageNameRequirements -eq $False) { - Write-Error 'The Storage Account Name does not meet requirements of 3-24 characters, lower case letters, and numbers.' - } - - # Validate whether New or Set is required - $Get = Get-TargetResource -AffinityGroup $AffinityGroup -StorageAccountName $StorageAccountName -Container $Container -Folder $Folder -Label $Label -ErrorAction SilentlyContinue - - if ($Get.StorageAccountName -eq $StorageAccountName) { - # Storage already exists. Verify Configuration with native Set cmdlet - $CurrentSubscription = Get-AzureSubscription -Current - Write-Verbose "The Azure subscription ID is $($CurrentSubscription.SubscriptionID)" - Set-AzureStorageAccount -StorageAccountName $StorageAccountName -Label $Label - - # Assign current storage account name - Set-AzureSubscription -SubscriptionName $CurrentSubscription.SubscriptionName -CurrentStorageAccountName $StorageAccountName - $CurrentSubscription = Get-AzureSubscription -Current - Write-verbose "Azure Storage Account Name: $($CurrentSubscription.CurrentStorageAccountName)" - - # Create Storage Context - $StorageKey = Get-AzureStorageKey -StorageAccountName $StorageAccountName - $AzureStorageContext = New-AzureStorageContext -StorageAccountName $StorageAccountName -StorageAccountKey $StorageKey.Primary - - # If Container does not exist, re-create it - if ($Get.Container -notcontains $Container) { - Write-Verbose "Creating container: $Container" - New-AzureStorageContainer -Name $Container -Context $AzureStorageContext - } - - # If files should be uploaded and are newer locally, update files - if ($Folder) { - foreach ($File in (Get-ChildItem -Path $Folder)) { - $Blob = Get-AzureStorageBlob -Context $AzureStorageContext -Container $Container -Blob $File.Name -ErrorAction SilentlyContinue - if (!$Blob -OR $File.LastWriteTime -gt $Blob.LastModified.DateTime) { - Write-Verbose "Uploading file: $($File.FUllName)" - Set-AzureStorageBlobContent -Context $AzureStorageContext -Container $Container -File $File.FullName -Force - } - } - } - } - else { - # Creating storage account using native New cmdlet - if ($TestAzureStorageName -eq $False){ - Write-Verbose "Creating Storage Account `"$StorageAccountName`" in Microsoft Azure." - Write-Verbose 'Please be patient as the operation completes.' - $CurrentSubscription = Get-AzureSubscription -Current - Write-Verbose "The Azure subscription ID is $($CurrentSubscription.SubscriptionID)" - New-AzureStorageAccount -StorageAccountName $StorageAccountName -Label $Label -AffinityGroup $AffinityGroup - - # Assign current storage account name - Set-AzureSubscription -SubscriptionName $CurrentSubscription.SubscriptionName -CurrentStorageAccountName $StorageAccountName - $CurrentSubscription = Get-AzureSubscription -Current - Write-verbose "Azure Storage Account Name: $($CurrentSubscription.CurrentStorageAccountName)" - - # Wait for creation to finish - $Status = (Get-AzureStorageAccount -StorageAccountName $StorageAccountName).StorageAccountStatus - While ($Status -ne 'Created') { - start-sleep 3 - $Status = (Get-AzureStorageAccount -StorageAccountName $StorageAccountName).StorageAccountStatus - } - - # Create Storage Context - $StorageKey = Get-AzureStorageKey -StorageAccountName $StorageAccountName - $AzureStorageContext = New-AzureStorageContext -StorageAccountName $StorageAccountName -StorageAccountKey $StorageKey.Primary - - # Create container - Write-Verbose "Creating container: $Container" - New-AzureStorageContainer -Name $Container -Context $AzureStorageContext - - # Upload files if needed - if ($Folder) { - foreach ($File in (Get-ChildItem -Path $Folder)) { - Write-Verbose "Uploading file: $File" - Set-AzureStorageBlobContent -Context $AzureStorageContext -Container $Container -File $File.FullName -Force - } - } - - if ($TestAzureStorageName -ne $False) { - # Test failed due to conflict or the name was invalid - Write-Error "Unable to create Storage Account, the name `"$StorageAccountName`" is invalid or already in use" - } - } - } - } - - 'Absent' { - $CurrentSubscription = Get-AzureSubscription -Current - Write-Verbose "The Azure subscription ID is $($CurrentSubscription.SubscriptionID)" - - # Create Storage Context - $StorageKey = Get-AzureStorageKey -StorageAccountName $StorageAccountName - $AzureStorageContext = New-AzureStorageContext -StorageAccountName $StorageAccountName -StorageAccountKey $StorageKey.Primary -Protocol Https - - # Remove each item in containers - $Containers = Get-AzureStorageContainer -Context $AzureStorageContext - foreach ($ContainerItem in $Containers) { - Write-Verbose "Removing Container `"$($ContainerItem.Name)`"" - $LeaseStatus = $ContainerItem.CloudBlobContainer.Properties.LeaseStatus - #Wait for Remove operation to complete - While ($LeaseStatus -eq 'Locked') { - Start-Sleep 5 - $LeaseStatus = (Get-AzureStorageContainer -Name $ContainerItem.Name -Context $AzureStorageContext).CloudBlobContainer.Properties.LeaseStatus - } - # Remove containers - Remove-AzureStorageContainer -Context $AzureStorageContext -Name $ContainerItem.Name -Force - } - # Remove Storage Account - Remove-AzureStorageAccount -StorageAccountName $StorageAccountName - } - } - } - -# Set-TargetResource 'Present' 'TestVMWestUS1' 'testvmstorage1' -Container 'scriptextensionfiles' -folder 'c:\Azure\scriptextensionfiles' -Verbose -# Expectation is the storage account will be created, set, or removed. Validate using Get-AzureStorageAccount. - -#endregion - - - -#region TEST FUNCTION - -function Test-TargetResource { -[CmdletBinding()] -[OutputType([Boolean])] -param( -[ValidateSet('Present','Absent')] -[string]$Ensure = 'Present', -[Parameter(Mandatory)][string]$AffinityGroup, -[Parameter(Mandatory)][string]$StorageAccountName, -[string]$Container, -[string]$Folder, -[string]$Label -) - # Output from Get-TargetResource - $Get = Get-TargetResource -AffinityGroup $AffinityGroup -StorageAccountName $StorageAccountName -ErrorAction SilentlyContinue - - $CurrentAccountSet = (Get-AzureSubscription -Current).CurrentStorageAccountName -eq $StorageAccountName - - # Compare dictionary and hash table - switch ($Ensure) { - 'Present'{ - $bool = $true - $bool = $CurrentAccountSet - } - 'Absent'{ - $bool = $false - $bool = !$CurrentAccountSet - } - } - - @('AffinityGroup','StorageAccountName','Container','Folder','Local') | % { - if ($PSBoundParameters[$_] -ne $Get[$_]) { - switch ($Ensure) { - 'Present'{$bool = $false} - 'Absent'{$bool = $true} - } - write-verbose "$($_): $($PSBoundParameters[$_]) -ne `"$($Get[$_])`"" - } - } - - $bool - } - -# Test-TargetResource 'Present' 'TestVMWestUS1' 'testvmstorage1' -Container 'scriptextensionfiles' -folder 'c:\Azure\scriptextensionfiles' -Verbose -# Expectation is True or False based on whether the storage account has been deployed, depending on Present/Absent. - -#endregion - -Export-ModuleMember -function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureStorageAccount/MSFT_xAzureStorageAccount.schema.mof b/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureStorageAccount/MSFT_xAzureStorageAccount.schema.mof deleted file mode 100644 index 9a810ce2..00000000 --- a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureStorageAccount/MSFT_xAzureStorageAccount.schema.mof +++ /dev/null @@ -1,13 +0,0 @@ - -[ClassVersion("1.0.1.0"), FriendlyName("xAzureStorageAccount")] -class MSFT_xAzureStorageAccount : OMI_BaseResource -{ - [key, Description("Specifies a name for the storage account. The storage account name must be unique to Windows Azure and must be between 3 and 24 characters in length and use lowercase letters and numbers only.")] string StorageAccountName; - [write, Description("Specifies whether the Azure Storage Account should be present or absent."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [required, Description("Specifies the name of an existing affinity group in the current subscription. You can specify either a Location or an AffinityGroup parameter, but not both. ")] string AffinityGroup; - [write, Description("Specifies a name for the Container that should be created in the Azure Storage Account.")] string Container; - [write, Description("Specifies a local folder. All files in the root of the folder will be uploaded to the new container.")] string Folder; - [write, Description("Specifies a label for the storage account. The label may be up to 100 characters in length.")] string Label; -}; - - diff --git a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureSubscription/MSFT_xAzureSubscription.psm1 b/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureSubscription/MSFT_xAzureSubscription.psm1 deleted file mode 100644 index 6e4a0ec9..00000000 --- a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureSubscription/MSFT_xAzureSubscription.psm1 +++ /dev/null @@ -1,98 +0,0 @@ -#region GET FUNCTION - -function Get-TargetResource { -[CmdletBinding()] -[OutputType([Hashtable])] -param ( -[Parameter(Mandatory)][string]$AzureSubscriptionName -) - # Native Get cmdlet - $Get = Get-AzureSubscription -Current -ErrorAction SilentlyContinue - - # Build Hashtable - @{ - 'Ensure' = If ($Get.SubscriptionName -eq $AzureSubscriptionName) {'Present'} Else {'Absent'} - 'AzureSubscriptionName' = $Get.SubscriptionName - } - - } - -# Get-TargetResource -AzureSubscriptionName 'Visual Studio Ultimate with MSDN' -Verbose -# Expectation is hashtable with subscription id, if it is registered - -#endregion - - - -#region SET FUNCTION - -function Set-TargetResource { -[CmdletBinding()] -param( -[ValidateSet('Present','Absent')] -[string]$Ensure = 'Present', -[Parameter(Mandatory)][string]$AzureSubscriptionName, -[string]$AzurePublishSettingsFile -) - switch ($Ensure) { - 'Present' { - if ($WhatIfPreference -eq $true) { - Write-Verbose 'What if:The Azure subscription ID is (SubscriptionID)' - } - else { - Import-AzurePublishSettingsFile -PublishSettingsFile $AzurePublishSettingsFile -ErrorAction SilentlyContinue - Select-AzureSubscription -SubscriptionName $AzureSubscriptionName -Current -ErrorAction SilentlyContinue - $CurrentSubscription = Get-AzureSubscription -Current - Write-Verbose "The Azure subscription ID is $($CurrentSubscription.SubscriptionID)" - } - } - 'Absent' { - Remove-AzureSubscription -SubscriptionName $AzureSubscriptionName -Force -ErrorAction SilentlyContinue - } - } - } - -# Set-TargetResource -Ensure 'Absent' -AzureSubscriptionName 'Visual Studio Ultimate with MSDN' -AzurePublishSettingsFile 'C:\Azure\MSDN.publishsettings' -Verbose -# Expectation is subscription woul dbe registered and set as current. Validate using Get-AzureSubscription. - -#endregion - - - -#region TEST FUNCTION - -function Test-TargetResource { -[CmdletBinding()] -[OutputType([Boolean])] -param( -[ValidateSet('Present','Absent')] -[string]$Ensure = 'Present', -[Parameter(Mandatory)][string]$AzureSubscriptionName, -[string]$AzurePublishSettingsFile -) - # Output from Get-TargetResource - $Get = Get-TargetResource -AzureSubscriptionName $AzureSubscriptionName -ErrorAction SilentlyContinue - - # Compare - switch ($Ensure) { - 'Present'{$bool = $true} - 'Absent'{$bool = $false} - } - - if ($AzureSubscriptionName -ne $Get.AzureSubscriptionName) { - switch ($Ensure) { - 'Present'{$bool = $false} - 'Absent'{$bool = $true} - } - write-verbose 'Azure Subscription not set to Current.' - } - - $bool - } - -# Test-TargetResource -Ensure 'Present' -AzureSubscriptionName 'Visual Studio Ultimate with MSDN' -AzurePublishSettingsFile 'C:\Azure\MSDN.publishsettings' -Verbose -# Expectation is boolean value representing whether subscription has been registered, depending on Present/Absent. - -#endregion - -Export-ModuleMember -function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureSubscription/MSFT_xAzureSubscription.schema.mof b/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureSubscription/MSFT_xAzureSubscription.schema.mof deleted file mode 100644 index 5ce77ab3..00000000 --- a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureSubscription/MSFT_xAzureSubscription.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xAzureSubscription")] -class MSFT_xAzureSubscription : OMI_BaseResource -{ - [write, Description("Specifies whether the subscription should be present or absent."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [key, Description("Specifies the name of the Azure subscription that should be set to Current.")] string AzureSubscriptionName; - [write, Description("Specifies the location of the Publish Settings file for the Azure Subscription.")] string AzurePublishSettingsFile; -}; - - diff --git a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureVM/MSFT_xAzureVM.psm1 b/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureVM/MSFT_xAzureVM.psm1 deleted file mode 100644 index 0b7f3d83..00000000 --- a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureVM/MSFT_xAzureVM.psm1 +++ /dev/null @@ -1,148 +0,0 @@ -#region GET FUNCTION - -function Get-TargetResource { -[CmdletBinding()] -[OutputType([Hashtable])] -param ( -[Parameter(Mandatory)][string]$Name, -[Parameter(Mandatory)][string]$ImageName, -[Parameter(Mandatory)][string]$ServiceName, -[Parameter(Mandatory)][string]$StorageAccountName -) - $CurrentSubscription = Get-AzureSubscription -Current - Write-Verbose "The Azure subscription ID is $($CurrentSubscription.SubscriptionID)" - - # Native Get cmdlet - $Get = Get-AzureVM -Name $Name -ServiceName $ServiceName - - # Build Hashtable from native cmdlet values - @{ - 'Ensure' = If ($Get.Name -eq $Name) {'Present'} Else {'Absent'} - 'Name' = $Get.Name - 'ServiceName' = $Get.ServiceName - } - - } - -# Get-TargetResource -Name 'TestVM1' -ServiceName 'testvmservice1' -storageaccountname 'testvmstorage1' -ImageName 'a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-201404.01-en.us-127GB.vhd' -Verbose -# Expectation is a hashtable with properties of the VM, if it exists. - -#endregion - - - -#region SET FUNCTION - -function Set-TargetResource { -[CmdletBinding()] -param( -[ValidateSet('Present','Absent')] -[string]$Ensure = 'Present', -[Parameter(Mandatory)][string]$Name, -[Parameter(Mandatory)][string]$ImageName, -[Parameter(Mandatory)][string]$ServiceName, -[Parameter(Mandatory)][string]$StorageAccountName, -[string]$InstanceSize = 'Medium', -[bool]$Linux, -[bool]$Windows, -[pscredential]$Credential, -[string]$ExtensionContainerName, -[string]$ExtensionFileList, -[string]$ExtensionScriptName -) - # Removing parameters from output - $PSBoundParameters.Remove('Ensure') | out-null - $PSBoundParameters.Remove('Debug') | out-null - $PSBoundParameters.Remove('ErrorAction') | out-null - - switch ($Ensure) { - 'Present' { - Write-Verbose "Creating VM `"$Name`" in Microsoft Azure." - Write-Verbose 'Please be patient as the operation completes.' - - # Create VM COnfig - $VM = New-AzureVMConfig -Name $Name -InstanceSize $InstanceSize -ImageName $ImageName -MediaLocation "http://$StorageAccountName.blob.core.windows.net/vhds/$Name.vhd" - - # Set OS Switch - if ($Windows -eq $true) {Add-AzureProvisioningConfig -VM $VM -AdminUserName $Credential.UserName -Password $Credential.GetNetworkCredential().Password -Windows} - else {Add-AzureProvisioningConfig -VM $VM -LinuxUser $Credential.UserName -Password $Credential.GetNetworkCredential().Password -Linux} - - if ($ExtensionContainerName -ne '') { - # VM Agent - $ExtensionFileList = $ExtensionFileList.Split(',') - Set-AzureVMCustomScriptExtension -ContainerName $ExtensionContainerName -FileName $ExtensionFileList -VM $VM -Run $ExtensionScriptName - } - - # Native cmdlet for new VM - - $CurrentSubscription = Get-AzureSubscription -Current - $CurrentSubscription.CurrentStorageAccountName = $StorageAccountName - Write-Verbose "The Azure subscription ID is $($CurrentSubscription.SubscriptionID)" - Write-Verbose "The Azure storage account is $($CurrentSubscription.CurrentStorageAccountName)" - - New-AzureVM -VMs $VM -ServiceName $ServiceName - } - 'Absent' { - # Native Remove cmdlet - Write-Verbose "Removing VM `"$Name`" from Azure." - Write-Verbose 'Please be patient as the operation completes.' - - $CurrentSubscription = Get-AzureSubscription -Current - Write-Verbose "The Azure subscription ID is $($CurrentSubscription.SubscriptionID)" - Remove-AzureVM -Name $Name -ServiceName $ServiceName -DeleteVHD - } - } - } - -# Set-TargetResource -Ensure 'Present' -Name 'TestVM1' -ServiceName 'testvmsservice1' -storageaccountname 'testvmstorage1' -ImageName 'a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-201404.01-en.us-127GB.vhd' -windows $true -Verbose -# Expectation is the VM will be created, set, or removed. Validate using Get-AzureVM. - -#endregion - - - -#region TEST FUNCTION - -function Test-TargetResource { -[CmdletBinding()] -[OutputType([Boolean])] -param( -[ValidateSet('Present','Absent')] -[string]$Ensure = 'Present', -[Parameter(Mandatory)][string]$Name, -[Parameter(Mandatory)][string]$ImageName, -[Parameter(Mandatory)][string]$ServiceName, -[Parameter(Mandatory)][string]$StorageAccountName, -[string]$InstanceSize, -[bool]$Linux, -[bool]$Windows, -[pscredential]$Credential, -[string]$ExtensionContainerName, -[string]$ExtensionFileList, -[string]$ExtensionScriptName -) - # Output from Get-TargetResource - $Get = Get-TargetResource -Name $Name -ServiceName $ServiceName -ImageName $ImageName -StorageAccountName $StorageAccountName -ErrorAction SilentlyContinue - - switch ($Ensure) { - 'Present'{$bool = $true} - 'Absent'{$bool = $false} - } - - if ($Name -ne $Get.Name -AND $ServiceName -ne $Get.ServiceName) { - switch ($Ensure) { - 'Present'{$bool = $false} - 'Absent'{$bool = $true} - } - write-verbose 'The VM could not be found in Azure.' - } - - $bool - } - -# Test-TargetResource -Ensure 'Absent' -Name 'TestVM1' -ServiceName 'testvmservice1' -storageaccountname 'testvmstorage1' -ImageName 'a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-201404.01-en.us-127GB.vhd' -windows $true -Verbose -# Expectation is True or False based on whether the VM has been deployed, depending on Present/Absent. - -#endregion - -Export-ModuleMember -function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureVM/MSFT_xAzureVM.schema.mof b/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureVM/MSFT_xAzureVM.schema.mof deleted file mode 100644 index 6821344c..00000000 --- a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureVM/MSFT_xAzureVM.schema.mof +++ /dev/null @@ -1,19 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xAzureVM")] -class MSFT_xAzureVM : OMI_BaseResource -{ - [key, Description("Specifies the name of the virtual machine.")] string Name; - [write, Description("Specifies whether the Azure VM should be present or absent."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [required, Description("Specifies the name of the operating system image to use to create the operating system disk.")] string ImageName; - [required, Description("Specifies the new or existing service name.")] string ServiceName; - [required, Description("Specifies the name of the storage account for the VM.")] string StorageAccountName; - [write, Description("Specifies the size of the instance. For a list of virtual machine sizes, see http://msdn.microsoft.com/library/azure/dn197896.aspx")] string InstanceSize; - [write, Description("Creates a Linux virtual machine.")] boolean Linux; - [write, Description("Creates a Windows virtual machine.")] boolean Windows; - [write, EmbeddedInstance("MSFT_Credential")] string Credential; - [write, Description("The name of the Container in Azure Blob storage where the script files will reside. Case sensitive.")] string ExtensionContainerName; - [write, Description("List of files in Azure Blob container that should be copied in to the VM. Case sensitive.")] string ExtensionFileList; - [write, Description("Name of one of the files in the container that will be exectued at startup. Case sensitive.")] string ExtensionScriptName; -}; - - diff --git a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureVMDscConfiguration/MSFT_xAzureVMDscConfiguration.psm1 b/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureVMDscConfiguration/MSFT_xAzureVMDscConfiguration.psm1 deleted file mode 100644 index 87de4f84..00000000 --- a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureVMDscConfiguration/MSFT_xAzureVMDscConfiguration.psm1 +++ /dev/null @@ -1,176 +0,0 @@ -# Purpose: -# Resource to Publish a Dsc Configuration archive to Azure storage - -#region GET - -function Get-TargetResource { -[CmdletBinding()] -[OutputType([Hashtable])] -param( - - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string]$StorageAccountName, - - [string]$ContainerName = 'windows-powershell-dsc', - - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string]$ConfigurationPath, - - [ValidateNotNullOrEmpty()] - [string]$AzureSubscriptionName, - - [ValidateNotNullOrEmpty()] - [string]$AzurePublishSettingsPath - -) - - if ($AzureSubscriptionName -and $AzurePublishSettingsPath) - { - Write-Verbose "Azure Publish Settings provided. AzureSubscriptionName = $AzureSubscriptionName, AzurePublishSettingsPath = $AzurePublishSettingsPath" - Import-AzurePublishSettingsFile $AzurePublishSettingsPath - Set-AzureSubscription -SubscriptionName $AzureSubscriptionName - } - - Write-Verbose "Storage Account Name = $StorageAccountName" - $storageAccountKey = (Get-AzureStorageKey $StorageAccountName).Primary - $Script:StorageContext = New-AzureStorageContext -StorageAccountName $StorageAccountName -StorageAccountKey $storageAccountKey -Protocol https - - Write-Verbose "ConfigurationPath = $ConfigurationPath" - $Script:ConfigFileName = [IO.Path]::GetFileName($ConfigurationPath) - - $storageBlobArchive = Get-AzureStorageBlob -Blob "$Script:ConfigFileName.zip" -Container $ContainerName -Context $Script:StorageContext -ErrorAction SilentlyContinue - $blobUri = $($storageBlobArchive.ICloudBlob.Uri.AbsoluteUri) - - Write-Verbose "Blob Uri is $blobUri" - - $returnValue = @{ - BlobUri = $blobUri - } - - return $returnValue - - } - -#endregion - - -#region SET - -function Set-TargetResource { -[CmdletBinding()] -param( - - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string]$StorageAccountName, - - [ValidateSet('Present','Absent')] - [string]$Ensure = 'Present', - - [string]$ContainerName = 'windows-powershell-dsc', - - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string]$ConfigurationPath, - - [ValidateNotNullOrEmpty()] - [string]$AzureSubscriptionName, - - [ValidateNotNullOrEmpty()] - [string]$AzurePublishSettingsPath - -) - - switch ($Ensure) { - 'Present' - { - Write-Verbose "Ensure is set to $Ensure. Calling Publish-AzureVMDscConfiguration to create the Configuration and Resource archive in Storage `"$($Script:StorageContext.StorageAccountName)`"" - Publish-AzureVMDscConfiguration -ConfigurationPath $ConfigurationPath -StorageContext $Script:StorageContext -Force -Verbose - } - - 'Absent' - { - Write-Verbose "Ensure is set to $Ensure. Calling Remove-AzureStorageBlob to remove the Blob from Storage `"$($Script:StorageContext.StorageAccountName)`"" - Remove-AzureStorageBlob -Blob "$Script:ConfigFileName.zip" -Container $ContainerName -Force - } - } - - } - -#endregion - - -#region TEST - -function Test-TargetResource { -[CmdletBinding()] -[OutputType([Boolean])] -param( - - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string]$StorageAccountName, - - [ValidateSet('Present','Absent')] - [string]$Ensure = 'Present', - - [string]$ContainerName = 'windows-powershell-dsc', - - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string]$ConfigurationPath, - - [ValidateNotNullOrEmpty()] - [string]$AzureSubscriptionName, - - [ValidateNotNullOrEmpty()] - [string]$AzurePublishSettingsPath - -) - Write-Verbose "Invoke Get-TargetResource to obtain the Absolute Uri to the Blob" - $parameters = @{} - $parameters["StorageAccountName"] = $StorageAccountName - $parameters["ContainerName"] = $ContainerName - $parameters["ConfigurationPath"] = $ConfigurationPath - - if($AzureSubscriptionName) - { - $parameters["AzureSubscriptionName"] = $AzureSubscriptionName - } - - if($AzurePublishSettingsPath) - { - $parameters["AzurePublishSettingsPath"] = $AzurePublishSettingsPath - } - - $blobUriObj = Get-TargetResource @parameters - - switch ($Ensure) { - 'Present' - { - if (-not $($blobUriObj.BlobUri)) - { - Write-Verbose "Ensure is set to $Ensure. But the archive is absent in Storage. We need to Publish the archive to Storage" - return $false - } - } - 'Absent' - { - if ($($blobUriObj.BlobUri)) - { - Write-Verbose "Ensure is set to $Ensure. But the archive is present in Storage. We need to Remove the archive from Storage" - return $false - } - } - } - - return $true - - } - -#endregion - - -Export-ModuleMember -function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureVMDscConfiguration/MSFT_xAzureVMDscConfiguration.schema.mof b/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureVMDscConfiguration/MSFT_xAzureVMDscConfiguration.schema.mof deleted file mode 100644 index d951473e..00000000 --- a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureVMDscConfiguration/MSFT_xAzureVMDscConfiguration.schema.mof +++ /dev/null @@ -1,18 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xAzureVMDscConfiguration")] -class MSFT_xAzureVMDscConfiguration : OMI_BaseResource -{ - [Key, Description("Specifies name of the existing storage account.")] string StorageAccountName; - - [Write, Description("Specifies whether the supplied Configuration is Present or Absent in Azure Storage"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - - [Write, Description("Specifies the name of the Container in the Azure Storage Account.")] string ContainerName; - - [Required, Description("Specifies location of the Dsc Configuration document")] string ConfigurationPath; - - [Write, Description("Specifies the name of the Azure subscription that should be set to Current.")] string AzureSubscriptionName; - [Write, Description("Specifies the location of the Publish Settings file for the Azure Subscription.")] string AzurePublishSettingsPath; - - [Read, Description("Absolute Uri of the Blob")] string BlobUri; -}; - diff --git a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureVMDscExtension/MSFT_xAzureVMDscExtension.psm1 b/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureVMDscExtension/MSFT_xAzureVMDscExtension.psm1 deleted file mode 100644 index e5e9c9fc..00000000 --- a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureVMDscExtension/MSFT_xAzureVMDscExtension.psm1 +++ /dev/null @@ -1,156 +0,0 @@ -#region GET FUNCTION - -function Get-TargetResource { -[CmdletBinding()] -[OutputType([Hashtable])] -param ( -[Parameter(Mandatory)][string]$VMName, -[Parameter(Mandatory)][string]$ServiceName, -[Parameter(Mandatory)][string]$ConfigurationArchive, -[Parameter(Mandatory)][string]$StorageAccountName -) - - $CurrentSubscription = Get-AzureSubscription -Current - $VM = Get-AzureVM -ServiceName $ServiceName -Name $VMName - $AgentDSCStatus = ($VM.ResourceExtensionStatusList | Where {$_.HandlerName -eq 'Microsoft.PowerShell.DSC'}) - $DscExtensionStatus = $VM | Get-AzureVMDscExtension -ErrorAction SilentlyContinue - - # Returning StorageAccountName input for troubleshooting purposes - return @{ - VMName = $VM.Name - ServiceName = $VM.ServiceName - ConfigurationArchive = $DscExtensionStatus.ModulesUrl - StorageAccountName = $StorageAccountName - Version = $AgentDSCStatus.Version - Timestamp = $AgentDSCStatus.ExtensionSettingStatus.TimestampUtc - Status = $AgentDSCStatus.ExtensionSettingStatus.Status - Code = $AgentDSCStatus.ExtensionSettingStatus.Code - Message = $AgentDSCStatus.ExtensionSettingStatus.FormattedMessage.Message - } - - } - -# Expectation is a hashtable with properties of the DSC Extension, if it exists. - -#endregion - - - -#region SET FUNCTION - -function Set-TargetResource { -[CmdletBinding()] -param( -[Parameter(Mandatory)][string]$VMName, -[Parameter(Mandatory)][string]$ServiceName, -[Parameter(Mandatory)][string]$ConfigurationArchive, -[Parameter(Mandatory)][string]$StorageAccountName, -[Microsoft.Management.Infrastructure.CimInstance[]]$ConfigurationArgument, -[string]$ConfigurationDataPath, -[string]$Configuration, -[string]$ContainerName, -[bool]$Force, -[string]$ReferenceName, -[string]$StorageEndpointSuffix, -[string]$Version -) - - $CurrentSubscription = Get-AzureSubscription -Current - $StorageKey = Get-AzureStorageKey -StorageAccountName $StorageAccountName - $AzureStorageContext = New-AzureStorageContext -StorageAccountName $StorageAccountName -StorageAccountKey $StorageKey.Primary -Protocol https - - $ExtensionParams = $PSBoundParameters - $ExtensionParams.Add('ConfigurationName',$Configuration) - If ($ConfigurationArgument) {$ExensionParams.ConfigurationArgument = Convert-KeyValuePairArrayToHashtable $ConfigurationArgument} - $ExtensionParams.Add('StorageContext',$AzureStorageContext) - $ExtensionParams.Remove('Configuration') - $ExtensionParams.Remove('StorageAccountName') - $ExtensionParams.Remove('VMName') - $ExtensionParams.Remove('ServiceName') - - Write-Verbose "The Azure subscription ID is $($CurrentSubscription.SubscriptionID)" - Write-Verbose "The Azure storage context is $AzureStorageContext" - - $VM = Get-AzureVM -ServiceName $ServiceName -Name $VMName - - Try { - $VM | Set-AzureVMDscExtension @ExtensionParams - } - Catch { - throw "Setting the DSC Extension failed with error: $_" - } - - $VM | Update-AzureVM - } - -# Expectation is the DSC script will be executed on the target VM - -#endregion - - - -#region TEST FUNCTION - -function Test-TargetResource { -[CmdletBinding()] -[OutputType([Boolean])] -param( -[Parameter(Mandatory)][string]$VMName, -[Parameter(Mandatory)][string]$ServiceName, -[Parameter(Mandatory)][string]$ConfigurationArchive, -[Parameter(Mandatory)][string]$StorageAccountName, -[Microsoft.Management.Infrastructure.CimInstance[]]$ConfigurationArgument, -[string]$ConfigurationDataPath, -[string]$Configuration, -[string]$ContainerName, -[bool]$Force, -[string]$ReferenceName, -[string]$StorageEndpointSuffix, -[string]$Version -) - - $Get = Get-TargetResource -VMName $VMName -ServiceName $ServiceName -ConfigurationArchive $ConfigurationArchive -StorageAccountName $StorageAccountName - - if ($Get.ConfigurationArchive) { - $Archive = $Get.ConfigurationArchive.Split('/')[$Get.ConfigurationArchive.Split('/').count-1] - } - - if ($Archive -eq $ConfigurationArchive -AND $Get.Status -eq 'Success') { - Write-Verbose 'The DSC configuration is already applied to the VM.' - return $true - } - - write-verbose 'The VM does not have the DSC Extension enabled.' - return $false - } - -# Expectation is True or False based on whether the VM has been deployed, depending on Present/Absent. - -#endregion - - - -#region HELPER FUNCTIONS - -# Converts CimInstance array of type KeyValuePair to hashtable -function Convert-KeyValuePairArrayToHashtable -{ -param ( - [parameter(Mandatory = $true)] - [Microsoft.Management.Infrastructure.CimInstance[]] - $array -) - - $hashtable = @{} - foreach($item in $array) - { - $hashtable += @{$item.Key = $item.Value} - } - - return $hashtable - } - -#endregion - - -Export-ModuleMember -function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureVMDscExtension/MSFT_xAzureVMDscExtension.schema.mof b/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureVMDscExtension/MSFT_xAzureVMDscExtension.schema.mof deleted file mode 100644 index a3f4aca6..00000000 --- a/lib/puppet_x/dsc_resources/xAzure/DSCResources/MSFT_xAzureVMDscExtension/MSFT_xAzureVMDscExtension.schema.mof +++ /dev/null @@ -1,22 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xAzureVMDscExtension")] -class MSFT_xAzureVMDscExtension : OMI_BaseResource -{ - [Key, Description("Specifies name of the VM. This is used together with ServiceName to construct a persistent vm object.")] string VMName; - [Required, Description("Specifies name of the Service where the VM is deployed.")] string ServiceName; - [Required, Description("The name of the configuration package .zip file that was previously uploaded by Publish-AzureVMDscConfiguration. This parameter must specify only the name of the file, without any path.")] string ConfigurationArchive; - [Required, Description("Specifies the name of the Storage Account used to create the Storage Context. The Azure Storage Context provides the security settings used to access the configuration script. This context should provide read access to the container specified by ContainerName.")] string StorageAccountName; - [Write, EmbeddedInstance("MSFT_KeyValuePair"), Description("A hashtable specifying the arguments to the configuration function. The keys correspond to the parameter names and the values to the parameter values.")] string ConfigurationArgument; - [Write, Description("The path to a .psd1 file that specifies the data for the configuration function.")] string ConfigurationDataPath; - [Write, Description("Name of the configuration script or module that will be invoked by the DSC Extension.")] string Configuration; - [Write, Description("Name of the Azure Storage Container where the ConfigurationArchive is located.")] string ContainerName; - [Write, Description("By default Set-AzureVMDscExtension will not overwrite any existing blobs. Use -Force to overwrite them.")] boolean Force; - [Write, Description("The Extension Reference Name")] string ReferenceName; - [Write, Description("The DNS endpoint suffix for all storage services, e.g. core.windows.net")] string StorageEndpointSuffix; - [Write, Description("The specific version of the DSC Extension to use. If not given, it will default to 1.*")] string Version; - [Read, Description("Returns the timestamp of the last DSC Extension execution.")] string TimeStamp; - [Read, Description("Returns the message code for the latest oepration by the DSC Extension.")] string Code; - [Read, Description("Returns the formatted message string for the latest operation by the DSC Extension.")] string Message; - [Read, Description("Returns the state of the DSC Extension from Azure.")] string Status; -}; - diff --git a/lib/puppet_x/dsc_resources/xAzure/LICENSE b/lib/puppet_x/dsc_resources/xAzure/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xAzure/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xAzure/ResourceDesignerScripts/GenerateXAzureSqlDatabase.ps1 b/lib/puppet_x/dsc_resources/xAzure/ResourceDesignerScripts/GenerateXAzureSqlDatabase.ps1 deleted file mode 100644 index b5b89464..00000000 --- a/lib/puppet_x/dsc_resources/xAzure/ResourceDesignerScripts/GenerateXAzureSqlDatabase.ps1 +++ /dev/null @@ -1,10 +0,0 @@ -$Name = New-xDscResourceProperty -Name Name -Type String -Attribute Key -Description 'Name of the database' -$ServerName = New-xDscResourceProperty -Name ServerName -Type String -Attribute Key -Description 'Name of the database server in which database should be created' -$MaximumSizeInGB = New-xDscResourceProperty -Name MaximumSizeInGB -Type UInt32 -Attribute Write -Description 'Maximum size of the database in GB' -$Collation = New-xDscResourceProperty -Name Collation -Type String -Attribute Write -Description 'Collation of the database' -$Edition = New-xDscResourceProperty -Name Edition -Type String -Attribute Write -Description 'Edition of the database' -$ServerCredential = New-xDscResourceProperty -Name ServerCredential -Type PSCredential -Attribute Required -Description 'Credential to the database server' -$AzureSubscriptionName = New-xDscResourceProperty -Name AzureSubscriptionName -Type String -Attribute Write -Description 'Specifies the name of the Azure subscription that should be set to Current' -$AzurePublishSettingsFile = New-xDscResourceProperty -Name AzurePublishSettingsFile -Type String -Attribute Write -Description 'Specifies the location of the Publish Settings file for the Azure Subscription' -$Ensure = New-xDscResourceProperty -Name Ensure -Type String -Attribute Write -ValidateSet "Present", "Absent" -Description 'Ensure that database is present or absent' -New-xDscResource -Name MSFT_xAzureSqlDatabase -Property @($Name, $ServerName, $MaximumSizeInGB, $Collation, $Edition, $ServerCredential, $AzureSubscriptionName, $AzurePublishSettingsFile, $Ensure) -ModuleName xAzure -FriendlyName xAzureSqlDatabase diff --git a/lib/puppet_x/dsc_resources/xAzure/ResourceDesignerScripts/GenerateXAzureSqlDatabaseServerFirewallRule.ps1 b/lib/puppet_x/dsc_resources/xAzure/ResourceDesignerScripts/GenerateXAzureSqlDatabaseServerFirewallRule.ps1 deleted file mode 100644 index 437c3040..00000000 --- a/lib/puppet_x/dsc_resources/xAzure/ResourceDesignerScripts/GenerateXAzureSqlDatabaseServerFirewallRule.ps1 +++ /dev/null @@ -1,9 +0,0 @@ -$Name = New-xDscResourceProperty -Name RuleName -Type String -Attribute Key -Description 'Name of the firewall rule' -$ServerName = New-xDscResourceProperty -Name ServerName -Type String -Attribute Key -Description 'Name of the database server for which firewall rule should be created' -$StartIPAddress = New-xDscResourceProperty -Name StartIPAddress -Type String -Attribute Required -Description 'Start IP address of the firewall rule' -$EndIPAddress = New-xDscResourceProperty -Name EndIPAddress -Type String -Attribute Required -Description 'End IP address of the firewall rule' -$AzureSubscriptionName = New-xDscResourceProperty -Name AzureSubscriptionName -Type String -Attribute Write -Description 'Specifies the name of the Azure subscription that should be set to Current' -$AzurePublishSettingsFile = New-xDscResourceProperty -Name AzurePublishSettingsFile -Type String -Attribute Write -Description 'Specifies the location of the Publish Settings file for the Azure Subscription' -$Ensure = New-xDscResourceProperty -Name Ensure -Type String -Attribute Write -ValidateSet "Present", "Absent" -Description 'Ensure that firewall rule is present or absent' -New-xDscResource -Name MSFT_xAzureSqlDatabaseServerFirewallRule -Property @($Name, $ServerName, $StartIPAddress, $EndIPAddress, $AzureSubscriptionName, $AzurePublishSettingsFile, $Ensure) -ModuleName xAzure -FriendlyName xAzureSqlDatabaseServerFirewallRule - diff --git a/lib/puppet_x/dsc_resources/xAzure/xAzure.psd1 b/lib/puppet_x/dsc_resources/xAzure/xAzure.psd1 deleted file mode 100644 index acb0573a..00000000 --- a/lib/puppet_x/dsc_resources/xAzure/xAzure.psd1 +++ /dev/null @@ -1,31 +0,0 @@ -@{ -# Version number of this module. -ModuleVersion = '0.2.0.0' - -# ID used to uniquely identify this module -GUID = '40179489-2ad9-46f7-b34f-b55e30650700' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'Module with DSC Resources for Azure Resources' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Minimum version of the common language runtime (CLR) required by this module -CLRVersion = '4.0' - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' -} diff --git a/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackAdmin/MSFT_xAzurePackAdmin.psm1 b/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackAdmin/MSFT_xAzurePackAdmin.psm1 deleted file mode 100644 index 04f8498b..00000000 --- a/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackAdmin/MSFT_xAzurePackAdmin.psm1 +++ /dev/null @@ -1,170 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present', - - [parameter(Mandatory = $true)] - [System.String] - $Principal, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $AzurePackAdminCredential, - - [parameter(Mandatory = $true)] - [System.String] - $SQLServer, - - [System.String] - $SQLInstance = 'MSSQLSERVER', - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $dbUser - ) - - $ConnectionString = Get-SQLConnectionString -SQLServer $SQLServer -SQLInstance $SQLInstance -dbUser $dbUser - - $Ensure = - if(Get-MgmtSvcAdminUser -Principal $Principal -ConnectionString $ConnectionString) - { - 'Present' - } - else - { - 'Absent' - } - - $returnValue = @{ - Ensure = $Ensure - Principal = $Principal - SQLServer = $SQLServer - SQLInstance = $SQLInstance - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present', - - [parameter(Mandatory = $true)] - [System.String] - $Principal, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $AzurePackAdminCredential, - - [parameter(Mandatory = $true)] - [System.String] - $SQLServer, - - [System.String] - $SQLInstance = 'MSSQLSERVER', - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $dbUser - ) - - $ConnectionString = Get-SQLConnectionString -SQLServer $SQLServer -SQLInstance $SQLInstance -dbUser $dbUser - - switch($Ensure) - { - 'Present' - { - if(!(Get-MgmtSvcAdminUser -Principal $Principal -ConnectionString $ConnectionString)) - { - Add-MgmtSvcAdminUser -Principal $Principal -ConnectionString $ConnectionString - } - } - 'Absent' - { - if(Get-MgmtSvcAdminUser -Principal $Principal -ConnectionString $ConnectionString) - { - Remove-MgmtSvcAdminUser -Principal $Principal -ConnectionString $ConnectionString - } - } - } - - if(!(Test-TargetResource @PSBoundParameters)) - { - throw 'Set-TargetResouce failed' - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present', - - [parameter(Mandatory = $true)] - [System.String] - $Principal, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $AzurePackAdminCredential, - - [parameter(Mandatory = $true)] - [System.String] - $SQLServer, - - [System.String] - $SQLInstance = 'MSSQLSERVER', - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $dbUser - ) - - $result = ((Get-TargetResource @PSBoundParameters).Ensure -eq $Ensure) - - $result -} - -Function Get-SQLConnectionString -{ - param( - [parameter(Mandatory = $true)] - [String]$SQLServer, - - [parameter(Mandatory = $true)] - [String]$SQLInstance, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $dbUser - ) - - if($SQLInstance -eq 'MSSQLSERVER') - { - return "Data Source=$SQLServer;Initial Catalog=Microsoft.MgmtSvc.Store;User ID=$($dbUser.UserName);Password=$($dbUser.GetNetworkCredential().password)" - } - else - { - return "Data Source=$SQLServer\$SQLInstance;Initial Catalog=Microsoft.MgmtSvc.Store;User ID=$($dbUser.UserName);Password=$($dbUser.GetNetworkCredential().password)" - } -} - - -Export-ModuleMember -Function *-TargetResource \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackAdmin/MSFT_xAzurePackAdmin.schema.mof b/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackAdmin/MSFT_xAzurePackAdmin.schema.mof deleted file mode 100644 index 8cdc8878..00000000 --- a/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackAdmin/MSFT_xAzurePackAdmin.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xAzurePackAdmin")] -class MSFT_xAzurePackAdmin : OMI_BaseResource -{ - [Write, Description("An enumerated value that describes if the principal is an Azure Pack admin.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Key, Description("The Azure Pack admin principal.")] String Principal; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the installation.")] String AzurePackAdminCredential; - [Key, Description("Database server for the Azure Pack databases.")] String SQLServer; - [Write, Description("Database instance for the Azure Pack databases.")] String SQLInstance; - [Required, EmbeddedInstance("MSFT_Credential"), Description("SQL user to be used to create the database if the SetupCredential cannot be used.")] String dbUser; -}; diff --git a/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackDatabaseSetting/MSFT_xAzurePackDatabaseSetting.psm1 b/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackDatabaseSetting/MSFT_xAzurePackDatabaseSetting.psm1 deleted file mode 100644 index 9ebdb42e..00000000 --- a/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackDatabaseSetting/MSFT_xAzurePackDatabaseSetting.psm1 +++ /dev/null @@ -1,149 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("AdminSite","TenantSite")] - [System.String] - $Namespace, - - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $Value, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $AzurePackAdminCredential, - - [parameter(Mandatory = $true)] - [System.String] - $SQLServer, - - [System.String] - $SQLInstance = "MSSQLSERVER", - - [System.Management.Automation.PSCredential] - $dbUser - ) - - if($SQLInstance -eq "MSSQLSERVER") - { - $ConnectionString = "Data Source=$SQLServer;Initial Catalog=Microsoft.MgmtSvc.PortalConfigStore;User ID=$($dbUser.UserName);Password=$($dbUser.GetNetworkCredential().password)"; - } - else - { - $ConnectionString = "Data Source=$SQLServer\$SQLInstance;Initial Catalog=Microsoft.MgmtSvc.PortalConfigStore;User ID=$($dbUser.UserName);Password=$($dbUser.GetNetworkCredential().password)"; - } - - $Value = (Get-MgmtSvcDatabaseSetting -Namespace $Namespace -Name $Name -ConnectionString $ConnectionString).Value - - $returnValue = @{ - Name = $Name - Value = $Value - SQLServer = $SQLServer - SQLInstance = $SQLInstance - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("AdminSite","TenantSite")] - [System.String] - $Namespace, - - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $Value, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $AzurePackAdminCredential, - - [parameter(Mandatory = $true)] - [System.String] - $SQLServer, - - [System.String] - $SQLInstance = "MSSQLSERVER", - - [System.Management.Automation.PSCredential] - $dbUser - ) - - - if($SQLInstance -eq "MSSQLSERVER") - { - $ConnectionString = "Data Source=$SQLServer;Initial Catalog=Microsoft.MgmtSvc.PortalConfigStore;User ID=$($dbUser.UserName);Password=$($dbUser.GetNetworkCredential().password)"; - } - else - { - $ConnectionString = "Data Source=$SQLServer\$SQLInstance;Initial Catalog=Microsoft.MgmtSvc.PortalConfigStore;User ID=$($dbUser.UserName);Password=$($dbUser.GetNetworkCredential().password)"; - } - - Set-MgmtSvcDatabaseSetting -Namespace $Namespace -Name $Name -Value $Value -ConnectionString $ConnectionString -Force - - if(!(Test-TargetResource @PSBoundParameters)) - { - throw "Set-TargetResouce failed" - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("AdminSite","TenantSite")] - [System.String] - $Namespace, - - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $Value, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $AzurePackAdminCredential, - - [parameter(Mandatory = $true)] - [System.String] - $SQLServer, - - [System.String] - $SQLInstance = "MSSQLSERVER", - - [System.Management.Automation.PSCredential] - $dbUser - ) - - $result = ((Get-TargetResource @PSBoundParameters).Value -eq $Value) - - $result -} - - -Export-ModuleMember -Function *-TargetResource \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackDatabaseSetting/MSFT_xAzurePackDatabaseSetting.schema.mof b/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackDatabaseSetting/MSFT_xAzurePackDatabaseSetting.schema.mof deleted file mode 100644 index 270d219d..00000000 --- a/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackDatabaseSetting/MSFT_xAzurePackDatabaseSetting.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xAzurePackDatabaseSetting")] -class MSFT_xAzurePackDatabaseSetting : OMI_BaseResource -{ - [Key, Description("Specifies the namespace."),ValueMap{"AdminSite","TenantSite"}, Values{"AdminSite","TenantSite"}] String Namespace; - [Key, Description("Specifies the name of the setting.")] String Name; - [Required, Description("Specifies the value of the setting.")] String Value; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the installation.")] String AzurePackAdminCredential; - [Key, Description("Database server for the Azure Pack databases.")] String SQLServer; - [Write, Description("Database instance for the Azure Pack databases.")] String SQLInstance; - [Write, EmbeddedInstance("MSFT_Credential"), Description("SQL user to be used to create the database if the SetupCredential cannot be used.")] String dbUser; -}; diff --git a/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackFQDN/MSFT_xAzurePackFQDN.psm1 b/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackFQDN/MSFT_xAzurePackFQDN.psm1 deleted file mode 100644 index 232374f7..00000000 --- a/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackFQDN/MSFT_xAzurePackFQDN.psm1 +++ /dev/null @@ -1,194 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("AdminSite","AuthSite","TenantSite","WindowsAuthSite")] - [System.String] - $Namespace, - - [parameter(Mandatory = $true)] - [System.String] - $FullyQualifiedDomainName, - - [System.UInt16] - $Port, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $AzurePackAdminCredential, - - [parameter(Mandatory = $true)] - [System.String] - $SQLServer, - - [System.String] - $SQLInstance = "MSSQLSERVER", - - [System.Management.Automation.PSCredential] - $dbUser - ) - - if($SQLInstance -eq "MSSQLSERVER") - { - $ConnectionString = "Data Source=$SQLServer;Initial Catalog=Microsoft.MgmtSvc.Store;User ID=$($dbUser.UserName);Password=$($dbUser.GetNetworkCredential().password)"; - } - else - { - $ConnectionString = "Data Source=$SQLServer\$SQLInstance;Initial Catalog=Microsoft.MgmtSvc.Store;User ID=$($dbUser.UserName);Password=$($dbUser.GetNetworkCredential().password)"; - } - - $FQDN = Get-MgmtSvcFQDN -Namespace $Namespace -ConnectionString $ConnectionString - - $returnValue = @{ - Namespace = $Namespace - FullyQualifiedDomainName = $FQDN.FullyQualifiedDomainName - Port = $FQDN.Port - SQLServer = $SQLServer - SQLInstance = $SQLInstance - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("AdminSite","AuthSite","TenantSite","WindowsAuthSite")] - [System.String] - $Namespace, - - [parameter(Mandatory = $true)] - [System.String] - $FullyQualifiedDomainName, - - [System.UInt16] - $Port, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $AzurePackAdminCredential, - - [parameter(Mandatory = $true)] - [System.String] - $SQLServer, - - [System.String] - $SQLInstance = "MSSQLSERVER", - - [System.Management.Automation.PSCredential] - $dbUser - ) - - if($Port -eq 0) - { - Switch($Namespace) - { - "AdminSite" - { - $Port = 30091 - } - "AuthSite" - { - $Port = 30071 - } - "TenantSite" - { - $Port = 30081 - } - "WindowsAuthSite" - { - $Port = 30072 - } - } - } - - if($SQLInstance -eq "MSSQLSERVER") - { - $ConnectionString = "Data Source=$SQLServer;Initial Catalog=Microsoft.MgmtSvc.Store;User ID=$($dbUser.UserName);Password=$($dbUser.GetNetworkCredential().password)"; - } - else - { - $ConnectionString = "Data Source=$SQLServer\$SQLInstance;Initial Catalog=Microsoft.MgmtSvc.Store;User ID=$($dbUser.UserName);Password=$($dbUser.GetNetworkCredential().password)"; - } - - Set-MgmtSvcFQDN -Namespace $Namespace -FullyQualifiedDomainName $FullyQualifiedDomainName -Port $Port -ConnectionString $ConnectionString - - if(!(Test-TargetResource @PSBoundParameters)) - { - throw "Set-TargetResouce failed" - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("AdminSite","AuthSite","TenantSite","WindowsAuthSite")] - [System.String] - $Namespace, - - [parameter(Mandatory = $true)] - [System.String] - $FullyQualifiedDomainName, - - [System.UInt16] - $Port, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $AzurePackAdminCredential, - - [parameter(Mandatory = $true)] - [System.String] - $SQLServer, - - [System.String] - $SQLInstance = "MSSQLSERVER", - - [System.Management.Automation.PSCredential] - $dbUser - ) - - if($Port -eq 0) - { - Switch($Namespace) - { - "AdminSite" - { - $Port = 30091 - } - "AuthSite" - { - $Port = 30071 - } - "TenantSite" - { - $Port = 30081 - } - "WindowsAuthSite" - { - $Port = 30072 - } - } - } - - $FQDN = Get-TargetResource @PSBoundParameters - - $result = (($FQDN.FullyQualifiedDomainName -eq $FullyQualifiedDomainName) -and ($FQDN.Port -eq $Port)) - - $result -} - - -Export-ModuleMember -Function *-TargetResource \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackFQDN/MSFT_xAzurePackFQDN.schema.mof b/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackFQDN/MSFT_xAzurePackFQDN.schema.mof deleted file mode 100644 index ccf203af..00000000 --- a/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackFQDN/MSFT_xAzurePackFQDN.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xAzurePackFQDN")] -class MSFT_xAzurePackFQDN : OMI_BaseResource -{ - [Key, Description("Specifies a namespace."), ValueMap{"AdminSite","AuthSite","TenantSite","WindowsAuthSite"}, Values{"AdminSite","AuthSite","TenantSite","WindowsAuthSite"}] String Namespace; - [Required, Description("Specifies a Fully Qualified Domain Name (FQDN).")] String FullyQualifiedDomainName; - [Write, Description("Specifies a port number.")] Uint16 Port; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the installation.")] String AzurePackAdminCredential; - [Required, Description("Database server for the Azure Pack databases.")] String SQLServer; - [Write, Description("Database instance for the Azure Pack databases.")] String SQLInstance; - [Write, EmbeddedInstance("MSFT_Credential"), Description("SQL user to be used to create the database if the SetupCredential cannot be used.")] String dbUser; -}; diff --git a/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackIdentityProvider/MSFT_xAzurePackIdentityProvider.psm1 b/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackIdentityProvider/MSFT_xAzurePackIdentityProvider.psm1 deleted file mode 100644 index 08c1539e..00000000 --- a/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackIdentityProvider/MSFT_xAzurePackIdentityProvider.psm1 +++ /dev/null @@ -1,196 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Membership","Windows")] - [System.String] - $Target, - - [parameter(Mandatory = $true)] - [System.String] - $FullyQualifiedDomainName, - - [System.UInt16] - $Port, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $AzurePackAdminCredential, - - [parameter(Mandatory = $true)] - [System.String] - $SQLServer, - - [System.String] - $SQLInstance = "MSSQLSERVER", - - [System.Management.Automation.PSCredential] - $dbUser - ) - - if($SQLInstance -eq "MSSQLSERVER") - { - $ConnectionString = "Data Source=$SQLServer;Initial Catalog=Microsoft.MgmtSvc.PortalConfigStore;User ID=$($dbUser.UserName);Password=$($dbUser.GetNetworkCredential().password)"; - } - else - { - $ConnectionString = "Data Source=$SQLServer\$SQLInstance;Initial Catalog=Microsoft.MgmtSvc.PortalConfigStore;User ID=$($dbUser.UserName);Password=$($dbUser.GetNetworkCredential().password)"; - } - - switch($Target) - { - "Membership" - { - $Namespace = "AuthSite" - } - "Windows" - { - $Namespace = "WindowsAuthSite" - } - } - $FQDN = ((ConvertFrom-Json (Get-MgmtSvcDatabaseSetting -Namespace $Namespace -Name Authentication.RelyingParty.Primary -ConnectionString $ConnectionString).Value).ReplyTo).Split("/")[2] - - $returnValue = @{ - Target = $Target - FullyQualifiedDomainName = $FQDN.Split(":")[0] - Port = $FQDN.Split(":")[1] - SQLServer = $SQLServer - SQLInstance = $SQLInstance - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Membership","Windows")] - [System.String] - $Target, - - [parameter(Mandatory = $true)] - [System.String] - $FullyQualifiedDomainName, - - [System.UInt16] - $Port, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $AzurePackAdminCredential, - - [parameter(Mandatory = $true)] - [System.String] - $SQLServer, - - [System.String] - $SQLInstance = "MSSQLSERVER", - - [System.Management.Automation.PSCredential] - $dbUser - ) - - if($Port -eq 0) - { - Switch($Target) - { - "Windows" - { - $Port = 30091 - } - "Membership" - { - $Port = 30081 - } - } - } - - if($SQLInstance -eq "MSSQLSERVER") - { - $PortalConnectionString = "Data Source=$SQLServer;Initial Catalog=Microsoft.MgmtSvc.PortalConfigStore;User ID=$($dbUser.UserName);Password=$($dbUser.GetNetworkCredential().password)"; - $ManagementConnectionString = "Data Source=$SQLServer;Initial Catalog=Microsoft.MgmtSvc.Store;User ID=$($dbUser.UserName);Password=$($dbUser.GetNetworkCredential().password)"; - } - else - { - $PortalConnectionString = "Data Source=$SQLServer\$SQLInstance;Initial Catalog=Microsoft.MgmtSvc.PortalConfigStore;User ID=$($dbUser.UserName);Password=$($dbUser.GetNetworkCredential().password)"; - $ManagementConnectionString = "Data Source=$SQLServer\$SQLInstance;Initial Catalog=Microsoft.MgmtSvc.Store;User ID=$($dbUser.UserName);Password=$($dbUser.GetNetworkCredential().password)"; - } - - Set-MgmtSvcIdentityProviderSettings -Target $Target -MetadataEndpoint "https://$FullyQualifiedDomainName`:$Port/FederationMetadata/2007-06/FederationMetadata.xml" -PortalConnectionString $PortalConnectionString -ManagementConnectionString $ManagementConnectionString -DisableCertificateValidation; - - if(!(Test-TargetResource @PSBoundParameters)) - { - throw "Set-TargetResouce failed" - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Membership","Windows")] - [System.String] - $Target, - - [parameter(Mandatory = $true)] - [System.String] - $FullyQualifiedDomainName, - - [System.UInt16] - $Port, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $AzurePackAdminCredential, - - [parameter(Mandatory = $true)] - [System.String] - $SQLServer, - - [System.String] - $SQLInstance = "MSSQLSERVER", - - [System.Management.Automation.PSCredential] - $dbUser - ) - - if($Port -eq 0) - { - Switch($Target) - { - "Windows" - { - $Port = 30091 - } - "Membership" - { - $Port = 30081 - } - } - } - - $FQDN = Get-TargetResource @PSBoundParameters - - if ($Port -ne 443) - { - $TestPort = $Port - } - - $result = (($FQDN.FullyQualifiedDomainName -eq $FullyQualifiedDomainName) -and ($FQDN.Port -eq $TestPort)) - - $result -} - - -Export-ModuleMember -Function *-TargetResource \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackIdentityProvider/MSFT_xAzurePackIdentityProvider.schema.mof b/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackIdentityProvider/MSFT_xAzurePackIdentityProvider.schema.mof deleted file mode 100644 index 3e086044..00000000 --- a/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackIdentityProvider/MSFT_xAzurePackIdentityProvider.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xAzurePackIdentityProvider")] -class MSFT_xAzurePackIdentityProvider : OMI_BaseResource -{ - [Key, Description("Specifies the target site."), ValueMap{"Membership","Windows"}, Values{"Membership","Windows"}] String Target; - [Required, Description("Specifies a Fully Qualified Domain Name (FQDN).")] String FullyQualifiedDomainName; - [Write, Description("Specifies a port number.")] Uint16 Port; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the installation.")] String AzurePackAdminCredential; - [Required, Description("Database server for the Azure Pack databases.")] String SQLServer; - [Write, Description("Database instance for the Azure Pack databases.")] String SQLInstance; - [Write, EmbeddedInstance("MSFT_Credential"), Description("SQL user to be used to create the database if the SetupCredential cannot be used.")] String dbUser; -}; diff --git a/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackRelyingParty/MSFT_xAzurePackRelyingParty.psm1 b/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackRelyingParty/MSFT_xAzurePackRelyingParty.psm1 deleted file mode 100644 index aead3830..00000000 --- a/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackRelyingParty/MSFT_xAzurePackRelyingParty.psm1 +++ /dev/null @@ -1,193 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Admin","Tenant")] - [System.String] - $Target, - - [parameter(Mandatory = $true)] - [System.String] - $FullyQualifiedDomainName, - - [System.UInt16] - $Port, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $AzurePackAdminCredential, - - [parameter(Mandatory = $true)] - [System.String] - $SQLServer, - - [System.String] - $SQLInstance = "MSSQLSERVER", - - [System.Management.Automation.PSCredential] - $dbUser - ) - - if($SQLInstance -eq "MSSQLSERVER") - { - $ConnectionString = "Data Source=$SQLServer;Initial Catalog=Microsoft.MgmtSvc.PortalConfigStore;User ID=$($dbUser.UserName);Password=$($dbUser.GetNetworkCredential().password)"; - } - else - { - $ConnectionString = "Data Source=$SQLServer\$SQLInstance;Initial Catalog=Microsoft.MgmtSvc.PortalConfigStore;User ID=$($dbUser.UserName);Password=$($dbUser.GetNetworkCredential().password)"; - } - - switch($Target) - { - "Admin" - { - $Namespace = "AdminSite" - } - "Tenant" - { - $Namespace = "TenantSite" - } - } - - $FQDN = ((ConvertFrom-Json (Get-MgmtSvcDatabaseSetting -Namespace $Namespace -Name Authentication.IdentityProvider -ConnectionString $ConnectionString).Value).Endpoint).Split("/")[2] - - - $returnValue = @{ - Target = $Target - FullyQualifiedDomainName = $FQDN.Split(":")[0] - Port = $FQDN.Split(":")[1] - SQLServer = $SQLServer - SQLInstance = $SQLInstance - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Admin","Tenant")] - [System.String] - $Target, - - [parameter(Mandatory = $true)] - [System.String] - $FullyQualifiedDomainName, - - [System.UInt16] - $Port, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $AzurePackAdminCredential, - - [parameter(Mandatory = $true)] - [System.String] - $SQLServer, - - [System.String] - $SQLInstance = "MSSQLSERVER", - - [System.Management.Automation.PSCredential] - $dbUser - ) - - if($Port -eq 0) - { - Switch($Target) - { - "Admin" - { - $Port = 30072 - } - "Tenant" - { - $Port = 30071 - } - } - } - - if($SQLInstance -eq "MSSQLSERVER") - { - $PortalConnectionString = "Data Source=$SQLServer;Initial Catalog=Microsoft.MgmtSvc.PortalConfigStore;User ID=$($dbUser.UserName);Password=$($dbUser.GetNetworkCredential().password)"; - $ManagementConnectionString = "Data Source=$SQLServer;Initial Catalog=Microsoft.MgmtSvc.Store;User ID=$($dbUser.UserName);Password=$($dbUser.GetNetworkCredential().password)"; - } - else - { - $PortalConnectionString = "Data Source=$SQLServer\$SQLInstance;Initial Catalog=Microsoft.MgmtSvc.PortalConfigStore;User ID=$($dbUser.UserName);Password=$($dbUser.GetNetworkCredential().password)"; - $ManagementConnectionString = "Data Source=$SQLServer\$SQLInstance;Initial Catalog=Microsoft.MgmtSvc.Store;User ID=$($dbUser.UserName);Password=$($dbUser.GetNetworkCredential().password)"; - } - - Set-MgmtSvcRelyingPartySettings -Target $Target -MetadataEndpoint "https://$FullyQualifiedDomainName`:$Port/FederationMetadata/2007-06/FederationMetadata.xml" -PortalConnectionString $PortalConnectionString -ManagementConnectionString $ManagementConnectionString -DisableCertificateValidation; - - if(!(Test-TargetResource @PSBoundParameters)) - { - throw "Set-TargetResouce failed" - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Admin","Tenant")] - [System.String] - $Target, - - [parameter(Mandatory = $true)] - [System.String] - $FullyQualifiedDomainName, - - [System.UInt16] - $Port, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $AzurePackAdminCredential, - - [parameter(Mandatory = $true)] - [System.String] - $SQLServer, - - [System.String] - $SQLInstance = "MSSQLSERVER", - - [System.Management.Automation.PSCredential] - $dbUser - ) - - if($Port -eq 0) - { - Switch($Target) - { - "Admin" - { - $Port = 30072 - } - "Tenant" - { - $Port = 30071 - } - } - } - - $FQDN = Get-TargetResource @PSBoundParameters - - $result = (($FQDN.FullyQualifiedDomainName -eq $FullyQualifiedDomainName) -and ($FQDN.Port -eq $Port)) - - $result -} - - -Export-ModuleMember -Function *-TargetResource \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackRelyingParty/MSFT_xAzurePackRelyingParty.schema.mof b/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackRelyingParty/MSFT_xAzurePackRelyingParty.schema.mof deleted file mode 100644 index e23c11c9..00000000 --- a/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackRelyingParty/MSFT_xAzurePackRelyingParty.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xAzurePackRelyingParty")] -class MSFT_xAzurePackRelyingParty : OMI_BaseResource -{ - [Key, Description("Specifies the target site."), ValueMap{"Admin","Tenant"}, Values{"Admin","Tenant"}] String Target; - [Key, Description("Specifies a Fully Qualified Domain Name (FQDN).")] String FullyQualifiedDomainName; - [Write, Description("Specifies a port number.")] Uint16 Port; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the installation.")] String AzurePackAdminCredential; - [Required, Description("Database server for the Azure Pack databases.")] String SQLServer; - [Write, Description("Database instance for the Azure Pack databases.")] String SQLInstance; - [Write, EmbeddedInstance("MSFT_Credential"), Description("SQL user to be used to create the database if the SetupCredential cannot be used.")] String dbUser; -}; diff --git a/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackResourceProvider/MSFT_xAzurePackResourceProvider.psm1 b/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackResourceProvider/MSFT_xAzurePackResourceProvider.psm1 deleted file mode 100644 index e2985569..00000000 --- a/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackResourceProvider/MSFT_xAzurePackResourceProvider.psm1 +++ /dev/null @@ -1,764 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $AuthenticationSite, - - [parameter(Mandatory = $true)] - [System.String] - $AdminUri, - - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $AzurePackAdminCredential, - - [System.String] - $DisplayName, - - [System.Boolean] - $Enabled = $true, - - [System.Boolean] - $PassthroughEnabled, - - [System.Boolean] - $AllowAnonymousAccess, - - [System.Boolean] - $AllowMultipleInstances, - - [System.String] - $AdminForwardingAddress, - - [System.String] - [ValidateSet("None","Basic","Windows")] - $AdminAuthenticationMode, - - [System.Management.Automation.PSCredential] - $AdminAuthenticationUser, - - [System.String] - $TenantForwardingAddress, - - [System.String] - [ValidateSet("None","Basic","Windows")] - $TenantAuthenticationMode, - - [System.Management.Automation.PSCredential] - $TenantAuthenticationUser, - - [System.String] - $TenantSourceUriTemplate, - - [System.String] - $TenantTargetUriTemplate, - - [System.String] - $UsageForwardingAddress, - - [System.String] - [ValidateSet("None","Basic","Windows")] - $UsageAuthenticationMode, - - [System.Management.Automation.PSCredential] - $UsageAuthenticationUser, - - [System.String] - $HealthCheckForwardingAddress, - - [System.String] - [ValidateSet("None","Basic","Windows")] - $HealthCheckAuthenticationMode, - - [System.Management.Automation.PSCredential] - $HealthCheckAuthenticationUser, - - [System.String] - $NotificationForwardingAddress, - - [System.String] - [ValidateSet("None","Basic","Windows")] - $NotificationAuthenticationMode, - - [System.Management.Automation.PSCredential] - $NotificationAuthenticationUser, - - [System.String] - $InstanceId, - - [System.String] - $InstanceDisplayName, - - [System.String] - $MaxQuotaUpdateBatchSize, - - [System.String] - $SubscriptionStatusPollingInterval, - - [System.String] - [ValidateSet("Standard","UsageProvider","CloudServiceProvider")] - $Type - ) - - $RP = Invoke-Command -ComputerName . -Credential $AzurePackAdminCredential -Authentication Credssp { - $AuthenticationSite = $args[0] - $AdminUri = $args[1] - $Name = $args[2] - $RP = Get-MgmtSvcResourceProviderConfiguration -Name $Name; - @{ - AuthenticationSite = $AuthenticationSite - AdminUri = $AdminUri - Name = $Name - DisplayName = $RP.DisplayName - Enabled = $RP.Enabled - PassthroughEnabled = $RP.PassthroughEnabled - AllowAnonymousAccess = $RP.AllowAnonymousAccess - AllowMultipleInstances = $RP.AllowMultipleInstances - AdminForwardingAddress = $RP.AdminEndpoint.ForwardingAddress.AbsoluteUri - AdminAuthenticationMode = $RP.AdminEndpoint.AuthenticationMode - AdminAuthenticationUsername = $RP.AdminEndpoint.AuthenticationUsername - TenantForwardingAddress = $RP.TenantEndpoint.ForwardingAddress.AbsoluteUri - TenantAuthenticationMode = $RP.TenantEndpoint.AuthenticationMode - TenantAuthenticationUsername = $RP.TenantEndpoint.AuthenticationUsername - TenantSourceUriTemplate = $RP.TenantEndpoint.SourceUriTemplate - TenantTargetUriTemplate = $RP.TenantEndpoint.TargetUriTemplate - UsageForwardingAddress = $RP.UsageEndpoint.ForwardingAddress.AbsoluteUri - UsageAuthenticationMode = $RP.UsageEndpoint.AuthenticationMode - UsageAuthenticationUsername = $RP.UsageEndpoint.AuthenticationUsername - HealthCheckForwardingAddress = $RP.HealthCheckEndpoint.ForwardingAddress.AbsoluteUri - HealthCheckAuthenticationMode = $RP.HealthCheckEndpoint.AuthenticationMode - HealthCheckAuthenticationUsername = $RP.HealthCheckEndpoint.AuthenticationUsername - NotificationForwardingAddress = $RP.NotificationEndpoint.ForwardingAddress.AbsoluteUri - NotificationAuthenticationMode = $RP.NotificationEndpoint.AuthenticationMode - NotificationAuthenticationUsername = $RP.NotificationEndpoint.AuthenticationUsername - InstanceId = $RP.InstanceId - InstanceDisplayName = $RP.InstanceDisplayName - MaxQuotaUpdateBatchSize = $RP.MaxQuotaUpdateBatchSize - SubscriptionStatusPollingInterval = $RP.SubscriptionStatusPollingInterval - Type = $RP.Type - } - } -ArgumentList @($AuthenticationSite,$AdminUri,$Name) - - $returnValue = $RP - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $AuthenticationSite, - - [parameter(Mandatory = $true)] - [System.String] - $AdminUri, - - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $AzurePackAdminCredential, - - [System.String] - $DisplayName, - - [System.Boolean] - $Enabled = $true, - - [System.Boolean] - $PassthroughEnabled, - - [System.Boolean] - $AllowAnonymousAccess, - - [System.Boolean] - $AllowMultipleInstances, - - [System.String] - $AdminForwardingAddress, - - [System.String] - [ValidateSet("None","Basic","Windows")] - $AdminAuthenticationMode, - - [System.Management.Automation.PSCredential] - $AdminAuthenticationUser, - - [System.String] - $TenantForwardingAddress, - - [System.String] - [ValidateSet("None","Basic","Windows")] - $TenantAuthenticationMode, - - [System.Management.Automation.PSCredential] - $TenantAuthenticationUser, - - [System.String] - $TenantSourceUriTemplate, - - [System.String] - $TenantTargetUriTemplate, - - [System.String] - $UsageForwardingAddress, - - [System.String] - [ValidateSet("None","Basic","Windows")] - $UsageAuthenticationMode, - - [System.Management.Automation.PSCredential] - $UsageAuthenticationUser, - - [System.String] - $HealthCheckForwardingAddress, - - [System.String] - [ValidateSet("None","Basic","Windows")] - $HealthCheckAuthenticationMode, - - [System.Management.Automation.PSCredential] - $HealthCheckAuthenticationUser, - - [System.String] - $NotificationForwardingAddress, - - [System.String] - [ValidateSet("None","Basic","Windows")] - $NotificationAuthenticationMode, - - [System.Management.Automation.PSCredential] - $NotificationAuthenticationUser, - - [System.String] - $InstanceId, - - [System.String] - $InstanceDisplayName, - - [System.String] - $MaxQuotaUpdateBatchSize, - - [System.String] - $SubscriptionStatusPollingInterval, - - [System.String] - [ValidateSet("Standard","UsageProvider","CloudServiceProvider")] - $Type - ) - - Invoke-Command -ComputerName . -Credential $AzurePackAdminCredential -Authentication Credssp { - $AuthenticationSite = $args[0] - $AdminUri = $args[1] - $Name = $args[2] - $AzurePackAdminCredential = $args[3] - $DisplayName = $args[4] - $Enabled = $args[5] - $PassthroughEnabled = $args[6] - $AllowAnonymousAccess = $args[7] - $AllowMultipleInstances = $args[8] - $AdminForwardingAddress = $args[9] - $AdminAuthenticationMode = $args[10] - $AdminAuthenticationUser = $args[11] - $TenantForwardingAddress = $args[12] - $TenantAuthenticationMode = $args[13] - $TenantAuthenticationUser = $args[14] - $TenantSourceUriTemplate = $args[15] - $TenantTargetUriTemplate = $args[16] - $UsageForwardingAddress = $args[17] - $UsageAuthenticationMode = $args[18] - $UsageAuthenticationUser = $args[19] - $HealthCheckForwardingAddress = $args[20] - $HealthCheckAuthenticationMode = $args[21] - $HealthCheckAuthenticationUser = $args[22] - $NotificationForwardingAddress = $args[23] - $NotificationAuthenticationMode = $args[24] - $NotificationAuthenticationUser = $args[25] - $InstanceId = $args[26] - $InstanceDisplayName = $args[27] - $MaxQuotaUpdateBatchSize = $args[28] - $SubscriptionStatusPollingInterval = $args[29] - $Type = $args[30] - - Import-Module -Name MgmtSvcConfig - - $TokenTry = 0 - While (!($Token) -and ($TokenTry -lt 5)) { - $Token = Get-MgmtSvcToken -Type Windows -AuthenticationSite $AuthenticationSite -ClientRealm 'http://azureservices/AdminSite' -User $AzurePackAdminCredential -DisableCertificateValidation - If (!($Token)) { - Start-Sleep 5 - $TokenTry++ - } - } - - if($Token) - { - if(Get-MgmtSvcResourceProviderConfiguration -Name $Name) - { - $RP = Get-MgmtSvcResourceProviderConfiguration -Name $Name - $Vars = @( - "DisplayName", - "Enabled", - "PassthroughEnabled", - "AllowAnonymousAccess", - "AllowMultipleInstances", - "AdminForwardingAddress", - "AdminAuthenticationMode", - "AdminAuthenticationUser", - "TenantForwardingAddress", - "TenantAuthenticationMode", - "TenantAuthenticationUser", - "TenantSourceUriTemplate", - "TenantTargetUriTemplate", - "UsageForwardingAddress", - "UsageAuthenticationMode", - "UsageAuthenticationUser", - "HealthCheckForwardingAddress", - "HealthCheckAuthenticationMode", - "HealthCheckAuthenticationUser", - "NotificationForwardingAddress", - "NotificationAuthenticationMode", - "NotificationAuthenticationUser", - "InstanceId", - "InstanceDisplayName", - "MaxQuotaUpdateBatchSize", - "SubscriptionStatusPollingInterval", - "Type" - ) - foreach($Var in $Vars) - { - if(!([String]::IsNullOrEmpty((Get-Variable -Name $Var).Value))) - { - if( - (($Var.Contains("User")) -and ((Get-Variable -Name $Var).Value.Username -ne $RP.($Var + "name"))) -or - (!($Var.Contains("User")) -and ((Get-Variable -Name $Var).Value -ne $RP.$Var)) - ) - { - switch($Var) - { - "AdminForwardingAddress" - { - $RP.AdminEndpoint.ForwardingAddress = (Get-Variable -Name $Var).Value - } - "AdminAuthenticationMode" - { - $RP.AdminEndpoint.AuthenticationMode = (Get-Variable -Name $Var).Value - } - "AdminAuthenticationUser" - { - $RP.AdminEndpoint.AuthenticationUsername = (Get-Variable -Name $Var).Value.Username - $RP.AdminEndpoint.AuthenticationPassword = (Get-Variable -Name $Var).Value.GetNetworkCredential().Password - } - "TenantForwardingAddress" - { - $RP.TenantEndpoint.ForwardingAddress = (Get-Variable -Name $Var).Value - } - "TenantAuthenticationMode" - { - $RP.TenantEndpoint.AuthenticationMode = (Get-Variable -Name $Var).Value - } - "TenantAuthenticationUser" - { - $RP.TenantEndpoint.AuthenticationUsername = (Get-Variable -Name $Var).Value.Username - $RP.AdminEndpoint.AuthenticationPassword = (Get-Variable -Name $Var).Value.GetNetworkCredential().Password - } - "TenantSourceUriTemplate" - { - $RP.TenantEndpoint.SourceUriTemplate = (Get-Variable -Name $Var).Value - } - "TenantTargetUriTemplate" - { - $RP.TenantEndpoint.TargetUriTemplate = (Get-Variable -Name $Var).Value - } - "UsageForwardingAddress" - { - $RP.UsageEndpoint.ForwardingAddress = (Get-Variable -Name $Var).Value - } - "UsageAuthenticationMode" - { - $RP.UsageEndpoint.AuthenticationMode = (Get-Variable -Name $Var).Value - } - "UsageAuthenticationUser" - { - $RP.UsageEndpoint.AuthenticationUsername = (Get-Variable -Name $Var).Value.Username - $RP.AdminEndpoint.AuthenticationPassword = (Get-Variable -Name $Var).Value.GetNetworkCredential().Password - } - "HealthCheckForwardingAddress" - { - $RP.HealthCheckEndpoint.ForwardingAddress = (Get-Variable -Name $Var).Value - } - "HealthCheckAuthenticationMode" - { - $RP.HealthCheckEndpoint.AuthenticationMode = (Get-Variable -Name $Var).Value - } - "HealthCheckAuthenticationUser" - { - $RP.HealthCheckEndpoint.AuthenticationUsername = (Get-Variable -Name $Var).Value.Username - $RP.HealthCheckEndpoint.AuthenticationPassword = (Get-Variable -Name $Var).Value.GetNetworkCredential().Password - } - "NotificationForwardingAddress" - { - $RP.NotificationEndpoint.ForwardingAddress = (Get-Variable -Name $Var).Value - } - "NotificationAuthenticationMode" - { - $RP.NotificationEndpoint.AuthenticationMode = (Get-Variable -Name $Var).Value - } - "NotificationAuthenticationUser" - { - $RP.NotificationEndpoint.AuthenticationUsername = (Get-Variable -Name $Var).Value.Username - $RP.NotificationEndpoint.AuthenticationPassword = (Get-Variable -Name $Var).Value.GetNetworkCredential().Password - } - "SubscriptionStatusPollingInterval" - { - $RP.NotificationEndpoint.AuthenticationUsername = New-TimeSpan -Seconds ((Get-Variable -Name $Var).Value) - } - - Default - { - $RP.$Var = (Get-Variable -Name $Var).Value - } - } - } - } - } - Set-MgmtSvcResourceProvider -AdminUri $AdminUri -Token $Token -ResourceProvider $RP -DisableCertificateValidation -Confirm:$false - } - else - { - $RPParams = @{} - $Vars = @( - "Name", - "DisplayName", - "AdminForwardingAddress", - "AdminAuthenticationMode", - "AdminAuthenticationUser", - "TenantForwardingAddress", - "TenantAuthenticationMode", - "TenantAuthenticationUser", - "TenantSourceUriTemplate", - "TenantTargetUriTemplate", - "UsageForwardingAddress", - "UsageAuthenticationMode", - "UsageAuthenticationUser", - "HealthCheckForwardingAddress", - "HealthCheckAuthenticationMode", - "HealthCheckAuthenticationUser", - "NotificationForwardingAddress", - "NotificationAuthenticationMode", - "NotificationAuthenticationUser", - "InstanceId", - "InstanceDisplayName", - "MaxQuotaUpdateBatchSize", - "SubscriptionStatusPollingInterval", - "Type" - ) - foreach($Var in $Vars) - { - if(!([String]::IsNullOrEmpty((Get-Variable -Name $Var).Value))) - { - if($Var.Contains("User")) - { - $RPParams.Add(($Var + "name"),(Get-Variable -Name $Var).Value.UserName) - $RPParams.Add(($Var.Replace("User","Password")),(Get-Variable -Name $Var).Value.GetNetworkCredential().Password) - } - else - { - $RPParams.Add($Var,(Get-Variable -Name $Var).Value) - } - } - } - $RP = New-MgmtSvcResourceProviderConfiguration @RPParams - $Vars = @( - "Enabled", - "PassthroughEnabled", - "AllowAnonymousAccess", - "AllowMultipleInstances" - ) - foreach($Var in $Vars) - { - if(!([String]::IsNullOrEmpty((Get-Variable -Name $Var).Value))) - { - $RP.$Var = (Get-Variable -Name $Var).Value - } - } - Add-MgmtSvcResourceProvider -AdminUri $AdminUri -Token $Token -ResourceProvider $RP -DisableCertificateValidation -Confirm:$false - } - } - } -ArgumentList @($AuthenticationSite,$AdminUri,$Name,$AzurePackAdminCredential,$DisplayName,$Enabled,$PassthroughEnabled,$AllowAnonymousAccess,$AllowMultipleInstances,$AdminForwardingAddress,$AdminAuthenticationMode,$AdminAuthenticationUser,$TenantForwardingAddress,$TenantAuthenticationMode,$TenantAuthenticationUser,$TenantSourceUriTemplate,$TenantTargetUriTemplate,$UsageForwardingAddress,$UsageAuthenticationMode,$UsageAuthenticationUser,$HealthCheckForwardingAddress,$HealthCheckAuthenticationMode,$HealthCheckAuthenticationUser,$NotificationForwardingAddress,$NotificationAuthenticationMode,$NotificationAuthenticationUser,$InstanceId,$InstanceDisplayName,$MaxQuotaUpdateBatchSize,$SubscriptionStatusPollingInterval,$Type) - - if(!(Test-TargetResource @PSBoundParameters)) - { - throw "Set-TargetResouce failed" - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $AuthenticationSite, - - [parameter(Mandatory = $true)] - [System.String] - $AdminUri, - - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $AzurePackAdminCredential, - - [System.String] - $DisplayName, - - [System.Boolean] - $Enabled = $true, - - [System.Boolean] - $PassthroughEnabled, - - [System.Boolean] - $AllowAnonymousAccess, - - [System.Boolean] - $AllowMultipleInstances, - - [System.String] - $AdminForwardingAddress, - - [System.String] - [ValidateSet("None","Basic","Windows")] - $AdminAuthenticationMode, - - [System.Management.Automation.PSCredential] - $AdminAuthenticationUser, - - [System.String] - $TenantForwardingAddress, - - [System.String] - [ValidateSet("None","Basic","Windows")] - $TenantAuthenticationMode, - - [System.Management.Automation.PSCredential] - $TenantAuthenticationUser, - - [System.String] - $TenantSourceUriTemplate, - - [System.String] - $TenantTargetUriTemplate, - - [System.String] - $UsageForwardingAddress, - - [System.String] - [ValidateSet("None","Basic","Windows")] - $UsageAuthenticationMode, - - [System.Management.Automation.PSCredential] - $UsageAuthenticationUser, - - [System.String] - $HealthCheckForwardingAddress, - - [System.String] - [ValidateSet("None","Basic","Windows")] - $HealthCheckAuthenticationMode, - - [System.Management.Automation.PSCredential] - $HealthCheckAuthenticationUser, - - [System.String] - $NotificationForwardingAddress, - - [System.String] - [ValidateSet("None","Basic","Windows")] - $NotificationAuthenticationMode, - - [System.Management.Automation.PSCredential] - $NotificationAuthenticationUser, - - [System.String] - $InstanceId, - - [System.String] - $InstanceDisplayName, - - [System.String] - $MaxQuotaUpdateBatchSize, - - [System.String] - $SubscriptionStatusPollingInterval, - - [System.String] - [ValidateSet("Standard","UsageProvider","CloudServiceProvider")] - $Type - ) - - $RP = Get-TargetResource @PSBoundParameters - - if($RP.InstanceId) - { - $result = $true - - $Vars = @( - "DisplayName", - "Enabled", - "PassthroughEnabled", - "AllowAnonymousAccess", - "AllowMultipleInstances", - "AdminForwardingAddress", - "AdminAuthenticationMode", - "TenantForwardingAddress", - "TenantAuthenticationMode", - "TenantSourceUriTemplate", - "TenantTargetUriTemplate", - "UsageForwardingAddress", - "UsageAuthenticationMode", - "HealthCheckForwardingAddress", - "HealthCheckAuthenticationMode", - "NotificationForwardingAddress", - "NotificationAuthenticationMode", - "InstanceId", - "InstanceDisplayName", - "MaxQuotaUpdateBatchSize", - "SubscriptionStatusPollingInterval", - "Type" - ) - foreach($Var in $Vars) - { - if($result -and !([String]::IsNullOrEmpty((Get-Variable -Name $Var).Value))) - { - if($Var.Contains("AuthenticationMode") -or ($Var -eq "Type") -or ($Var -eq "SubscriptionStatusPollingInterval")) - { - if($Var -eq "SubscriptionStatusPollingInterval") - { - if((New-TimeSpan -Seconds ((Get-Variable -Name $Var).Value)) -ne $RP.$Var) - { - Write-Verbose ("$Var is " + $RP.$Var + " and should be " + ((Get-Variable -Name $Var).Value)) - $result = $false - } - } - else - { - switch((Get-Variable -Name $Var).Value) - { - "None" - { - if(((Get-Variable -Name $Var).Value -ne $RP.$Var) -and (0 -ne $RP.$Var)) - { - Write-Verbose ("$Var is " + $RP.$Var + " and should be " + ((Get-Variable -Name $Var).Value)) - $result = $false - } - } - "Basic" - { - if(((Get-Variable -Name $Var).Value -ne $RP.$Var) -and (1 -ne $RP.$Var)) - { - Write-Verbose ("$Var is " + $RP.$Var + " and should be " + ((Get-Variable -Name $Var).Value)) - $result = $false - } - } - "Windows" - { - if(((Get-Variable -Name $Var).Value -ne $RP.$Var) -and (2 -ne $RP.$Var)) - { - Write-Verbose ("$Var is " + $RP.$Var + " and should be " + ((Get-Variable -Name $Var).Value)) - $result = $false - } - } - "Standard" - { - if(((Get-Variable -Name $Var).Value -ne $RP.$Var) -and (0 -ne $RP.$Var)) - { - Write-Verbose ("$Var is " + $RP.$Var + " and should be " + ((Get-Variable -Name $Var).Value)) - $result = $false - } - } - "UsageProvider" - { - if(((Get-Variable -Name $Var).Value -ne $RP.$Var) -and (1 -ne $RP.$Var)) - { - Write-Verbose ("$Var is " + $RP.$Var + " and should be " + ((Get-Variable -Name $Var).Value)) - $result = $false - } - } - "CloudServiceProvider" - { - if(((Get-Variable -Name $Var).Value -ne $RP.$Var) -and (2 -ne $RP.$Var)) - { - Write-Verbose ("$Var is " + $RP.$Var + " and should be " + ((Get-Variable -Name $Var).Value)) - $result = $false - } - } - } - } - } - else - { - if((Get-Variable -Name $Var).Value -ne $RP.$Var) - { - Write-Verbose ("$Var is " + $RP.$Var + " and should be " + ((Get-Variable -Name $Var).Value)) - $result = $false - } - } - } - } - - if($result) - { - $Vars = @( - "NotificationAuthenticationUser", - "AdminAuthenticationUser", - "TenantAuthenticationUser", - "UsageAuthenticationUser", - "HealthCheckAuthenticationUser" - ) - foreach($Var in $Vars) - { - if($result -and !([String]::IsNullOrEmpty((Get-Variable -Name $Var).Value))) - { - if((Get-Variable -Name $Var).Value.UserName -ne $RP.($Var + "name")) - { - Write-Verbose ("$Var is " + $RP.($Var + "name") + " and should be " + ((Get-Variable -Name $Var).Value.UserName)) - $result = $false - } - } - } - } - } - else - { - Write-Verbose "Resource provider $name does not exist" - $result = $false - } - - $result -} - - -Export-ModuleMember -Function *-TargetResource \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackResourceProvider/MSFT_xAzurePackResourceProvider.schema.mof b/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackResourceProvider/MSFT_xAzurePackResourceProvider.schema.mof deleted file mode 100644 index 0fb31ab0..00000000 --- a/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackResourceProvider/MSFT_xAzurePackResourceProvider.schema.mof +++ /dev/null @@ -1,40 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xAzurePackResourceProvider")] -class MSFT_xAzurePackResourceProvider : OMI_BaseResource -{ - [Required, Description("URL of the authentication site.")] String AuthenticationSite; - [Required, Description("Specifies the URI of the Windows Azure Pack administrator API.")] String AdminUri; - [Key, Description("Specifies the name of a resource provider.")] String Name; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the installation.")] String AzurePackAdminCredential; - [Write, Description("Specifies the display name of a resource provider.")] String DisplayName; - [Write, Description("Enables the resource provider.")] Boolean Enabled; - [Write, Description("Indicates whether the resource provider supports API pass-through.")] Boolean PassthroughEnabled; - [Write, Description("Specifies the URI of the Windows Azure Pack administrator API.")] Boolean AllowAnonymousAccess; - [Write, Description("Indicates that the cmdlet allows multiple instances of the resource provider.")] Boolean AllowMultipleInstances; - [Write, Description("Specifies an administrative forwarding address for a resource provider.")] String AdminForwardingAddress; - [Write, Description("Specifies the administrative authentication mode for a resource provider."), ValueMap{"None","Basic","Windows"}, Values{"None","Basic","Windows"}] String AdminAuthenticationMode; - [Write, EmbeddedInstance("MSFT_Credential"), Description("Specifies, as a PSCredential object, an administrative user name and password to connect to a resource provider.")] String AdminAuthenticationUser; - [Read, Description("Output for the administrative user name.")] String AdminAuthenticationUsername; - [Write, Description("Specifies the tenant forwarding address of a resource provider.")] String TenantForwardingAddress; - [Write, Description("Specifies the tenant authentication mode for a resource provider."), ValueMap{"None","Basic","Windows"}, Values{"None","Basic","Windows"}] String TenantAuthenticationMode; - [Write, EmbeddedInstance("MSFT_Credential"), Description("Specifies, as a PSCredential object, a tenant user name and password to connect to a resource provider.")] String TenantAuthenticationUser; - [Read, Description("Output for the tenant user name.")] String TenantAuthenticationUsername; - [Write, Description("Specifies the tenant source URI template of a resource provider.")] String TenantSourceUriTemplate; - [Write, Description("Specifies the tenant target URI template of a resource provider.")] String TenantTargetUriTemplate; - [Write, Description("Specifies the tenant forwarding address of a resource provider.")] String UsageForwardingAddress; - [Write, Description("Specifies the usage authentication mode for a resource provider."), ValueMap{"None","Basic","Windows"}, Values{"None","Basic","Windows"}] String UsageAuthenticationMode; - [Write, EmbeddedInstance("MSFT_Credential"), Description("Specifies, as a PSCredential object, a usage user name and password to connect to a resource provider.")] String UsageAuthenticationUser; - [Read, Description("Output for the usage user name.")] String UsageAuthenticationUsername; - [Write, Description("Specifies the health check forwarding address for a resource provider.")] String HealthCheckForwardingAddress; - [Write, Description("Specifies the health check authentication mode for a resource provider."), ValueMap{"None","Basic","Windows"}, Values{"None","Basic","Windows"}] String HealthCheckAuthenticationMode; - [Write, EmbeddedInstance("MSFT_Credential"), Description("Specifies, as a PSCredential object, a health check user name and password to connect to a resource provider.")] String HealthCheckAuthenticationUser; - [Read, Description("Output for the health check user name.")] String HealthCheckAuthenticationUsername; - [Write, Description("Specifies the notification forwarding address of a resource provider.")] String NotificationForwardingAddress; - [Write, Description("Specifies the notification authentication mode for a resource provider."), ValueMap{"None","Basic","Windows"}, Values{"None","Basic","Windows"}] String NotificationAuthenticationMode; - [Write, EmbeddedInstance("MSFT_Credential"), Description("Specifies, as a PSCredential object, a notification user name and password to connect to a resource provider.")] String NotificationAuthenticationUser; - [Read, Description("Output for the notification user name.")] String NotificationAuthenticationUsername; - [Write, Description("Specifies an ID for an instance of a resource provider.")] String InstanceId; - [Write, Description("Specifies a display name for an instance of a resource provider.")] String InstanceDisplayName; - [Write, Description("Specifies the number of subscriptions that can be updated in a single request.")] String MaxQuotaUpdateBatchSize; - [Write, Description("Specifies the time interval at which the management service polls the resource provider for subscription status updates.")] String SubscriptionStatusPollingInterval; - [Write, Description("Specifies the type of the resource provider."), ValueMap{"Standard","UsageProvider","CloudServiceProvider"}, Values{"Standard","UsageProvider","CloudServiceProvider"}] String Type; -}; diff --git a/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackSetup/MSFT_xAzurePackSetup.psm1 b/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackSetup/MSFT_xAzurePackSetup.psm1 deleted file mode 100644 index ea4fe069..00000000 --- a/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackSetup/MSFT_xAzurePackSetup.psm1 +++ /dev/null @@ -1,670 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet('Admin API','Tenant API','Tenant Public API','SQL Server Extension','MySQL Extension','Admin Site','Admin Authentication Site','Tenant Site','Tenant Authentication Site')] - [System.String] - $Role, - - [parameter(Mandatory = $true)] - [ValidateSet('Install','Initialize')] - [System.String] - $Action, - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = '\WindowsAzurePack2013', - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.Management.Automation.PSCredential] - $Passphrase = $SetupCredential, - - [System.String] - $SQLServer = 'localhost', - - [System.String] - $SQLInstance = 'MSSQLSERVER', - - [System.Management.Automation.PSCredential] - $dbUser, - - [System.String] - $EnableCeip = 'No' - ) - - $returnValue = @{ - Role = $Role - Action = $Action - SourcePath = $SourcePath - SourceFolder = $SourceFolder - SQLServer = $SQLServer - SQLInstance = $SQLInstance - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet('Admin API','Tenant API','Tenant Public API','SQL Server Extension','MySQL Extension','Admin Site','Admin Authentication Site','Tenant Site','Tenant Authentication Site')] - [System.String] - $Role, - - [parameter(Mandatory = $true)] - [ValidateSet('Install','Initialize')] - [System.String] - $Action, - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = '\WindowsAzurePack2013', - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.Management.Automation.PSCredential] - $Passphrase = $SetupCredential, - - [System.String] - $SQLServer = 'localhost', - - [System.String] - $SQLInstance = 'MSSQLSERVER', - - [System.Management.Automation.PSCredential] - $dbUser, - - [System.String] - $EnableCeip = 'No' - ) - - switch($Action) - { - 'Install' - { - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - - $Path = 'msiexec.exe' - $Path = ResolvePath $Path - Write-Verbose "Path: $Path" - - $TempPath = [IO.Path]::GetTempPath().TrimEnd('\') - $Products = (Get-WmiObject -Class Win32_Product).IdentifyingNumber - $Components = GetWAPComponents -Role $Role - foreach($Component in $Components) - { - $ComponentInstalled = $true - if($ComponentInstalled) - { - $IdentifyingNumbers = GetWAPComponentIdentifyingNumbers -Component $Component - $ComponentInstalled = GetComponentInstalled -Products $Products -IdentifyingNumbers $IdentifyingNumbers - if(!$ComponentInstalled) - { - $MSIPath = ResolvePath "$SourcePath\$SourceFolder\$Component.msi" - Copy-Item -Path $MSIPath -Destination $TempPath - $Arguments = "/q /lv $TempPath\$Component.log /i $TempPath\$Component.msi ALLUSERS=2" - Write-Verbose "Arguments: $Arguments" - $Process = StartWin32Process -Path $Path -Arguments $Arguments -Credential $SetupCredential - Write-Verbose $Process - WaitForWin32ProcessEnd -Path $Path -Arguments $Arguments -Credential $SetupCredential - Remove-Item -Path "$TempPath\$Component.msi" - $ComponentInstalled = GetComponentInstalled -Products $Products -IdentifyingNumbers $IdentifyingNumbers - } - } - } - } - 'Initialize' - { - if($EnableCeip -ne 'Yes') - { - $EnableCeip = 'No' - } - $Features = GetWAPFeatures -Role $Role - $ConfigStorePassphrase = $Passphrase.GetNetworkCredential().Password - foreach($Feature in $Features) - { - Write-Verbose "Feature: $Feature" - if (!(Get-MgmtSvcFeature -Name $Feature).Configured) - { - if($SQLInstance -eq 'MSSQLSERVER') - { - $Server = $SQLServer - } - else - { - $Server = "$SQLServer\$SQLInstance" - } - Initialize-MgmtSvcFeature -Name $Feature -Passphrase "$ConfigStorePassphrase" -EnableCeip $EnableCeip -Server $Server -UserName $dbUser.UserName -Password $dbUser.GetNetworkCredential().Password - } - } - } - } - - if((Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Name 'PendingFileRenameOperations' -ErrorAction SilentlyContinue) -ne $null) - { - $global:DSCMachineStatus = 1 - } - else - { - if(!(Test-TargetResource @PSBoundParameters)) - { - throw 'Set-TargetResouce failed' - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet('Admin API','Tenant API','Tenant Public API','SQL Server Extension','MySQL Extension','Admin Site','Admin Authentication Site','Tenant Site','Tenant Authentication Site')] - [System.String] - $Role, - - [parameter(Mandatory = $true)] - [ValidateSet('Install','Initialize')] - [System.String] - $Action, - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = '\WindowsAzurePack2013', - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.Management.Automation.PSCredential] - $Passphrase = $SetupCredential, - - [System.String] - $SQLServer = 'localhost', - - [System.String] - $SQLInstance = 'MSSQLSERVER', - - [System.Management.Automation.PSCredential] - $dbUser, - - [System.String] - $EnableCeip = 'No' - ) - - switch($Action) - { - 'Install' - { - $result = $true - $Products = (Get-WmiObject -Class Win32_Product).IdentifyingNumber - $Components = GetWAPComponents -Role $Role - foreach($Component in $Components) - { - if($result) - { - $IdentifyingNumbers = GetWAPComponentIdentifyingNumbers -Component $Component - $ComponentInstalled = GetComponentInstalled -Products $Products -IdentifyingNumbers $IdentifyingNumbers - if(!$ComponentInstalled) - { - $result = $false - } - } - } - } - 'Initialize' - { - $result = $true - $Features = GetWAPFeatures -Role $Role - foreach($Feature in $Features) - { - if($result) - { - Write-Verbose "Feature: $Feature" -verbose - $result = (Get-MgmtSvcFeature -Name $Feature).Configured - Write-Verbose "Configured: $result" -Verbose - } - } - } - } - - $result -} - - -function GetWAPComponents -{ - param - ( - [String] - $Role - ) - - switch($Role) - { - 'Admin API' - { - return @( - 'MgmtSvc-PowerShellAPI', - 'MgmtSvc-WebAppGallery', - 'MgmtSvc-Monitoring', - 'MgmtSvc-Usage', - 'MgmtSvc-AdminAPI', - 'MgmtSvc-ConfigSite' - ) - } - 'Tenant API' - { - return @( - 'MgmtSvc-PowerShellAPI', - 'MgmtSvc-TenantAPI', - 'MgmtSvc-ConfigSite' - ) - } - 'Tenant Public API' - { - return @( - 'MgmtSvc-PowerShellAPI', - 'MgmtSvc-TenantPublicAPI', - 'MgmtSvc-ConfigSite' - ) - } - 'SQL Server Extension' - { - return @( - 'MgmtSvc-PowerShellAPI', - 'MgmtSvc-SQLServer', - 'MgmtSvc-ConfigSite' - ) - } - 'MySQL Extension' - { - return @( - 'MgmtSvc-PowerShellAPI', - 'MgmtSvc-MySQL', - 'MgmtSvc-ConfigSite' - ) - } - 'Admin Site' - { - return @( - 'MgmtSvc-PowerShellAPI', - 'MgmtSvc-AdminSite', - 'MgmtSvc-ConfigSite' - ) - } - 'Admin Authentication Site' - { - return @( - 'MgmtSvc-PowerShellAPI', - 'MgmtSvc-WindowsAuthSite', - 'MgmtSvc-ConfigSite' - ) - } - 'Tenant Site' - { - return @( - 'MgmtSvc-PowerShellAPI', - 'MgmtSvc-TenantSite', - 'MgmtSvc-ConfigSite' - ) - } - 'Tenant Authentication Site' - { - return @( - 'MgmtSvc-PowerShellAPI', - 'MgmtSvc-AuthSite', - 'MgmtSvc-ConfigSite' - ) - } - } -} - - -function GetWAPComponentIdentifyingNumbers -{ - param - ( - [String] - $Component - ) - - switch($Component) - { - 'MgmtSvc-PowerShellAPI' - { - return @( - '{09AAA3CE-A0B6-4B5D-AE51-43DF1C3EB192}', - '{C5C97081-9A6A-4FCA-BA98-F01DE7B6BAEE}', - '{43A453AF-BE0A-4C4B-9C6C-57FFE693AFCC}', - '{48EF1B2C-1DA3-4887-8D3D-263C2047DE20}', - '{16487D2C-F851-450D-AB52-1163D8057D9A}', - '{9AF631FF-CE1F-481F-9B05-D88D5BDE6CF3}', #Update Rollup 6 - '{AD89FCD8-868C-4FDA-910F-9F888BF687FD}', #Update Rollup 7 - '{567EE4F8-35CA-4111-A2F9-9AFE911959B1}', #Update Rollup 8 - '{F525AB73-3F65-4AF7-AE32-C6E732B9A7E0}' #Update Rollup 9.1 - ) - } - 'MgmtSvc-WebAppGallery' - { - return @( - '{AC29E1CB-2F30-475E-ADD8-B039DDA7DFE4}', - '{F78A7C67-DAD0-4219-9563-DA69021F3425}', - '{D001C96D-B5D8-47F1-A57D-0993949E086D}', - '{A72F27D3-C1DD-4BF3-B837-45B2457E9206}', - '{E33E0D2B-D289-4300-B431-CA51052E1507}', - '{C4E6A478-2DCD-47C2-BE94-CD29FBD3C7E8}', #Update Rollup 6 - '{7B69C3FB-1789-4F6F-9737-61785B3A190C}', #Update Rollup 7 - '{95BD63BE-88C5-4F43-9CC8-31A1903C3D75}', #Update Rollup 8 - '{9C9D2734-902A-4F41-8C56-AC21E216745F}' #Update Rollup 9.1 - - ) - } - 'MgmtSvc-Monitoring' - { - return @( - '{0A45C3A5-2265-4C0F-968D-EA0AE95B6D3D}', - '{7AFA9F9B-B776-409B-A073-43A5F2005782}', - '{48EA248F-E9FA-48CF-9B11-65F73631BE80}', - '{08F8076E-46A3-4A26-93EC-7EE48FD693FF}', - '{EAB7C0A2-17C0-46DC-8DD5-3167FCCA3471}', - '{53C0310D-097D-46CA-A766-C3E87931ECF4}', #Update Rollup 6 - '{7759F5CB-0DE5-4AE9-BF29-EF6F2D1D214A}', #Update Rollup 7 - '{BD31C44E-1E91-4C61-8955-CC4386EB31CB}', #Update Rollup 8 - '{649E3CE3-4F85-4F49-B850-1A4B00BDF944}' #Update Rollup 9.1 - - ) - } - 'MgmtSvc-Usage' - { - return @( - '{6939C616-4589-4115-B0F9-A43164936EC4}', - '{E214B687-AF1B-40FE-B1CF-702395ED138D}', - '{49DAC463-8658-4163-8ED6-4C1AE2A7AE99}', - '{09B94677-ED88-4633-AD07-DF16115E3E13}', - '{9DCEAFF9-7499-47D4-98E8-EF6877E7D5CF}', - '{3F4E4AED-6955-4690-B7EF-FFBBDB7CB471}', #Update Rollup 6 - '{CD94B684-BF21-45B7-BBB2-A05478AB05F7}', #Update Rollup 7 - '{D8AFA6F8-7CF5-4C6F-BE6E-5EBEB9A5EE3D}', #Update Rollup 8 - '{946B0B96-13AF-404E-98F0-D38BF3828E8E}' #Update Rollup 9.1 - - ) - } - 'MgmtSvc-AdminAPI' - { - return @( - '{D52908B7-6A78-4BC7-8451-490C7BF88395}', - '{E82D6570-E501-4CF1-B1C7-ECB62AB90694}', - '{5002046F-645B-4316-BC6A-86AB1DF1C3FB}', - '{5C578A41-64DD-43DC-9772-8A2EDDCA8B3A}', - '{7A18CA60-6275-463A-A28F-15B3DECE9167}', - '{1675BB48-4805-4FF0-B973-64D75292C410}', - '{1675BB48-4805-4FF0-B973-64D75292C410}', #Update Rollup 6 - '{E00081AD-CE78-4F2A-9CD2-8833C15F490B}', #Update Rollup 7 - '{7CA2FE56-D216-431D-AD9B-96F2EFA0060F}', #Update Rollup 8 - '{DAB5A87F-32D0-4E96-B7FD-47DBDC6EAEED}' #Update Rollup 9.1 - - - ) - } - 'MgmtSvc-TenantAPI' - { - return @( - '{763C3BFE-6A60-4D5D-AF6C-F167A5CF47DF}', - '{F1E998DF-0018-49E6-947F-AF7A00CE2404}', - '{A3DD0B04-3A0D-4211-9CE4-ED71544D2ED6}', - '{5F2419BD-ED3D-4645-AC00-9D85F428465F}', - '{57AAAF80-FED1-4574-B8A5-D67C3347B7F3}', - '{A0F1EB25-B0A7-4774-8556-D42CC9C274C0}', #Update Rollup 6 - '{66D13937-01D3-413B-89EA-9C38FC8EEDE6}', #Update Rollup 7 - '{5FB651B3-5247-450F-B459-903602EF90AB}', #Update Rollup 8 - '{CF41308C-9BC3-46C1-8B39-135D00E491E8}' #Update Rollup 9.1 - - ) - } - 'MgmtSvc-TenantPublicAPI' - { - return @( - '{4D0102B7-74CD-4563-B475-45C7EC09E18C}', - '{9BD35794-7F08-4979-A741-91E681A42DC9}', - '{5D0CA554-B0B3-4C30-894A-D08D8543FE90}', - '{0A29836B-8F77-4A99-8D50-925D7DA3E04B}', - '{91EEF0F7-E4CA-4162-AF4F-D4D67CBFADAE}', - '{6F996F63-3332-4356-9CCF-5E22653796BC}', #Update Rollup 6 - '{E741DC5B-3DBF-4882-A029-6E089FA76B71}', #Update Rollup 7 - '{90C2701B-6410-4C6D-B595-30D19DD8BD48}', #Update Rollup 8 - '{7442368E-A20A-4B4A-9304-104B7191CD82}' #Update Rollup 9.1 - - ) - } - 'MgmtSvc-SQLServer' - { - return @( - '{F16B58A7-106E-4859-929C-519F45C2423F}', - '{FF4E91C5-9B03-427A-89B0-2FB44567CA36}', - '{84E267A7-461F-497B-B6D5-42A8DFADD3B4}', - '{298A4DBF-9D1D-4DEF-95C6-34DD48EAD26F}', - '{71C55DAA-0C85-4186-A1E9-5064C5CC686D}', - '{59360F27-E25F-467C-BA58-FC3D9ADA9C1B}', #Update Rollup 6 - '{6D0C8DE3-B386-4D13-B5C7-4B513CF272AF}', #Update Rollup 7 - '{24AB07BB-750C-4CC4-959A-69D68F03B672}', #Update Rollup 8 - '{FFE3B7AD-BED4-4F9C-98CC-D75E64B770EE}' #Update Rollup 9.1 - - ) - } - 'MgmtSvc-MySQL' - { - return @( - '{A559BC28-C942-4A1F-AEE3-8D6143EBF635}', - '{AF2FFFAE-987A-4026-9500-768FA17F16CA}', - '{90F5754A-2836-46FA-9B36-7014337B26A1}', - '{1206E655-0171-4835-9A6B-91B4C2E385B8}', - '{ED962FFD-1998-4F03-9165-B0B0E27AF0C5}', - '{5593C408-CEC3-4E60-88DF-672DC14311AB}', #Update Rollup 6 - '{7D37EA03-C7CE-406A-8B15-5D722F7F0F7D}', #Update Rollup 7 - '{6FF0D21B-C7CC-4881-9463-4CFFFA5143F9}', #Update Rollup 8 - '{038DEB00-87C2-483D-B303-3732A6CE6280}' #Update Rollup 9.1 - - ) - } - 'MgmtSvc-AdminSite' - { - return @( - '{2F31F894-4AC3-4A7F-9F18-D50A9B327123}', - '{D96559C2-0C06-42D1-9D5A-27437F814191}', - '{B349A781-813C-44E7-8A10-9055F375B3D5}', - '{7424D4D1-A1E0-4147-88A1-739E0B51C01A}', - '{265EE8DB-FE0B-4532-AAD3-6787D6B4D91B}', - '{78E55590-A6C7-4D4A-A7FA-640242F19EF3}', #Update Rollup 6 - '{7C76D912-7CC3-4644-BC36-E2715D14C7FC}', #Update Rollup 7 - '{713C3A58-010A-4DA4-8FA3-E1012C844F6C}', #Update Rollup 8 - '{8DFE1C24-EF33-4DE8-A8F2-192C7E1FECE0}' #Update Rollup 9.1 - - ) - } - 'MgmtSvc-WindowsAuthSite' - { - return @( - '{85EF5065-777C-410C-857A-041B386D476C}', - '{40A83017-F95A-49A5-AE0D-C106298E5898}', - '{F47FFCA3-AE68-48FB-9A9E-AC4469D675E2}', - '{FEC02487-C505-4227-A9D4-8B160BB156FE}', - '{9381CC0F-A0B5-4DDE-8141-6E725B95919C}', - '{7BD73C40-4276-4C9D-9C00-B2B591FF87A8}', #Update Rollup 6 - '{9B74B70D-9D6F-4531-AC74-0A10329B0E45}', #Update Rollup 7 - '{C36C12EA-71F5-46EB-8BAB-F32C53161B2E}', #Update Rollup 8 - '{42A86301-91AA-4CF2-95AB-C305052ECEFD}' #Update Rollup 9.1 - - ) - } - 'MgmtSvc-TenantSite' - { - return @( - '{CAF63E4C-6859-4EF1-B531-1FFED6DEB9B5}', - '{8FC72370-FBF0-40BB-9398-E45FB9263C51}', - '{57382D8D-7C0D-4D8B-85DB-261363B70C3E}', - '{A72F27D3-C1DD-4BF3-B837-45B2457E9206}', - '{348B0395-AD2A-45A6-BFFA-BB502F59ABC0}', - '{7756023B-9368-46CC-AB7D-304655031F75}', #Update Rollup 6 - '{E71A1932-C6DC-4522-B93A-131A3C7AB347}', #Update Rollup 7 - '{FC2F4900-7DEF-4314-B838-1A47B4DB09DD}', #Update Rollup 8 - '{78E38778-C952-4B53-96D8-A65DB9683269}' #Update Rollup 9.1 - - ) - } - 'MgmtSvc-AuthSite' - { - return @( - '{D3AE936A-C357-4B66-870F-415FF6248424}', - '{20141108-1261-4285-9818-9FA493FFD0D3}', - '{A3B5F452-94AC-4138-BE55-5F78F91AFC0B}', - '{9FA55C04-8F44-4047-9482-C359ACA91D19}', - '{6D4ABA37-50DB-4FA5-B833-D152370A4121}', - '{5A064009-39C2-4694-A92F-FFF1473CC978}', #Update Rollup 6 - '{C45CE895-84AD-4B9C-AEE3-F3112381FB17}', #Update Rollup 7 - '{9AD3BB15-3471-4A0F-A0CD-BB1408F598B8}', #Update Rollup 8 - '{B2D82054-D973-4447-BDDF-AE7D11E86585}' #Update Rollup 9.1 - - ) - } - 'MgmtSvc-ConfigSite' - { - return @( - '{32C316B4-3E22-4E4F-BF4C-BF76D38459D4}', - '{4950C7DA-C2FC-4FC5-8E47-76B742E8E630}', - '{E78CDA83-404D-4C32-A09D-B58F2C1C7BF2}', - '{91D917FC-E486-4040-8764-A2AF83776142}', - '{72BA84F9-BAA5-4451-AFA5-89841CFDA170}', - '{282F6FAA-E6F1-4910-8A64-F20453944ACA}', #Update Rollup 6 - '{FA421F0C-4E2C-4721-B190-0AED841503D3}', #Update Rollup 7 - '{A3A5D3F7-C18E-4BE9-B792-9699B3B334DE}', #Update Rollup 8 - '{53DA6693-27E7-438C-A4C1-BE2FCA1811DC}' #Update Rollup 9.1 - ) - } - } -} - - -function GetComponentInstalled -{ - param - ( - [String[]] - $Products, - - [String[]] - $IdentifyingNumbers - ) - - $ComponentInstalled = $false - foreach($IdentifyingNumber in $IdentifyingNumbers) - { - if(!$ComponentInstalled) - { - if($Products | Where-Object {$_ -eq $IdentifyingNumber}) - { - $ComponentInstalled = $true - } - } - } - - return $ComponentInstalled -} - - -function GetWAPFeatures -{ - param - ( - [String] - $Role - ) - - switch($Role) - { - 'Admin API' - { - return @( - 'AdminAPI', - 'WebAppGallery', - 'Monitoring', - 'UsageCollector', - 'UsageService' - ) - } - 'Tenant API' - { - return @( - 'TenantAPI' - ) - } - 'Tenant Public API' - { - return @( - 'TenantPublicAPI' - ) - } - 'SQL Server Extension' - { - return @( - 'SQLServer' - ) - } - 'MySQL Extension' - { - return @( - 'MySQL' - ) - } - 'Admin Site' - { - return @( - 'AdminSite' - ) - } - 'Admin Authentication Site' - { - return @( - 'WindowsAuthSite' - ) - } - 'Tenant Site' - { - return @( - 'TenantSite' - ) - } - 'Tenant Authentication Site' - { - return @( - 'AuthSite' - ) - } - } -} - - -Export-ModuleMember -Function *-TargetResource \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackSetup/MSFT_xAzurePackSetup.schema.mof b/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackSetup/MSFT_xAzurePackSetup.schema.mof deleted file mode 100644 index 175c4f69..00000000 --- a/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackSetup/MSFT_xAzurePackSetup.schema.mof +++ /dev/null @@ -1,14 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xAzurePackSetup")] -class MSFT_xAzurePackSetup : OMI_BaseResource -{ - [Key, Description("The Azure Pack role to be installed or initialized."), ValueMap{"Admin API","Tenant API","Tenant Public API","SQL Server Extension","MySQL Extension","Admin Site","Admin Authentication Site","Tenant Site","Tenant Authentication Site"}, Values{"Admin API","Tenant API","Tenant Public API","SQL Server Extension","MySQL Extension","Admin Site","Admin Authentication Site","Tenant Site","Tenant Authentication Site"}] String Role; - [Key, Description("Install or initialize."), ValueMap{"Install","Initialize"}, Values{"Install","Initialize"}] String Action; - [Required, Description("UNC path to the root of the source files for installation.")] String SourcePath; - [Write, Description("Folder within the source path containing the source files for installation.")] String SourceFolder; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the installation.")] String SetupCredential; - [Write, EmbeddedInstance("MSFT_Credential"), Description("Passphrase for the Azure Pack deployment.")] String Passphrase; - [Write, Description("Database server for the Azure Pack databases.")] String SQLServer; - [Write, Description("Database instance for the Azure Pack databases.")] String SQLInstance; - [Write, EmbeddedInstance("MSFT_Credential"), Description("SQL user to be used to create the database if the SetupCredential cannot be used.")] String dbUser; - [Write, Description("Enable Customer Experience Improvement Program.")] String EnableCeip; -}; diff --git a/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackUpdate/MSFT_xAzurePackUpdate.psm1 b/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackUpdate/MSFT_xAzurePackUpdate.psm1 deleted file mode 100644 index edec3dc8..00000000 --- a/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackUpdate/MSFT_xAzurePackUpdate.psm1 +++ /dev/null @@ -1,372 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet('Admin API','Tenant API','Tenant Public API','SQL Server Extension','MySQL Extension','Admin Site','Admin Authentication Site','Tenant Site','Tenant Authentication Site')] - [System.String] - $Role, - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = '\WindowsAzurePack2013\Updates', - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - $returnValue = @{ - Role = $Role - SourcePath = $SourcePath - SourceFolder = $SourceFolder - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet('Admin API','Tenant API','Tenant Public API','SQL Server Extension','MySQL Extension','Admin Site','Admin Authentication Site','Tenant Site','Tenant Authentication Site')] - [System.String] - $Role, - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = '\WindowsAzurePack2013\Updates', - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - - $Path = 'msiexec.exe' - $Path = ResolvePath $Path - Write-Verbose "Path: $Path" - - $TempPath = [IO.Path]::GetTempPath().TrimEnd('\') - $Products = (Get-WmiObject -Class Win32_Product).IdentifyingNumber - $Components = GetWAPComponents -Role $Role - foreach($Component in $Components) - { - $ComponentInstalled = $true - if($ComponentInstalled) - { - $IdentifyingNumbers = GetWAPComponentIdentifyingNumbers -Component $Component - $ComponentInstalled = GetComponentInstalled -Products $Products -IdentifyingNumbers $IdentifyingNumbers - if(!$ComponentInstalled) - { - $MSIPath = ResolvePath "$SourcePath\$SourceFolder\$Component.msi" - Copy-Item -Path $MSIPath -Destination $TempPath - $Arguments = "/q /lv $TempPath\$Component.log /i $TempPath\$Component.msi ALLUSERS=2" - Write-Verbose "Arguments: $Arguments" - $Process = StartWin32Process -Path $Path -Arguments $Arguments -Credential $SetupCredential - Write-Verbose $Process - WaitForWin32ProcessEnd -Path $Path -Arguments $Arguments -Credential $SetupCredential - Remove-Item -Path "$TempPath\$Component.msi" - $ComponentInstalled = GetComponentInstalled -Products $Products -IdentifyingNumbers $IdentifyingNumbers - } - } - } - - if((Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Name 'PendingFileRenameOperations' -ErrorAction SilentlyContinue) -ne $null) - { - $global:DSCMachineStatus = 1 - } - else - { - if(!(Test-TargetResource @PSBoundParameters)) - { - throw 'Set-TargetResouce failed' - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet('Admin API','Tenant API','Tenant Public API','SQL Server Extension','MySQL Extension','Admin Site','Admin Authentication Site','Tenant Site','Tenant Authentication Site')] - [System.String] - $Role, - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = '\WindowsAzurePack2013\Updates', - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - $result = $true - $Products = (Get-WmiObject -Class Win32_Product).IdentifyingNumber - $Components = GetWAPComponents -Role $Role - foreach($Component in $Components) - { - if($result) - { - $IdentifyingNumbers = GetWAPComponentIdentifyingNumbers -Component $Component - $ComponentInstalled = GetComponentInstalled -Products $Products -IdentifyingNumbers $IdentifyingNumbers - if(!$ComponentInstalled) - { - $result = $false - } - } - } - - $result -} - - -function GetWAPComponents -{ - param - ( - [String] - $Role - ) - - switch($Role) - { - 'Admin API' - { - return @( - 'MgmtSvc-PowerShellAPI', - 'MgmtSvc-WebAppGallery', - 'MgmtSvc-Monitoring', - 'MgmtSvc-Usage', - 'MgmtSvc-AdminAPI', - 'MgmtSvc-ConfigSite' - ) - } - 'Tenant API' - { - return @( - 'MgmtSvc-PowerShellAPI', - 'MgmtSvc-TenantAPI', - 'MgmtSvc-ConfigSite' - ) - } - 'Tenant Public API' - { - return @( - 'MgmtSvc-PowerShellAPI', - 'MgmtSvc-TenantPublicAPI', - 'MgmtSvc-ConfigSite' - ) - } - 'SQL Server Extension' - { - return @( - 'MgmtSvc-PowerShellAPI', - 'MgmtSvc-SQLServer', - 'MgmtSvc-ConfigSite' - ) - } - 'MySQL Extension' - { - return @( - 'MgmtSvc-PowerShellAPI', - 'MgmtSvc-MySQL', - 'MgmtSvc-ConfigSite' - ) - } - 'Admin Site' - { - return @( - 'MgmtSvc-PowerShellAPI', - 'MgmtSvc-AdminSite', - 'MgmtSvc-ConfigSite' - ) - } - 'Admin Authentication Site' - { - return @( - 'MgmtSvc-PowerShellAPI', - 'MgmtSvc-WindowsAuthSite', - 'MgmtSvc-ConfigSite' - ) - } - 'Tenant Site' - { - return @( - 'MgmtSvc-PowerShellAPI', - 'MgmtSvc-TenantSite', - 'MgmtSvc-ConfigSite' - ) - } - 'Tenant Authentication Site' - { - return @( - 'MgmtSvc-PowerShellAPI', - 'MgmtSvc-AuthSite', - 'MgmtSvc-ConfigSite' - ) - } - } -} - - -function GetWAPComponentIdentifyingNumbers -{ - param - ( - [String] - $Component - ) - - switch($Component) - { - 'MgmtSvc-PowerShellAPI' - { - return @( - '{F525AB73-3F65-4AF7-AE32-C6E732B9A7E0}' - - ) - } - 'MgmtSvc-WebAppGallery' - { - return @( - '{9C9D2734-902A-4F41-8C56-AC21E216745F}' - - ) - } - 'MgmtSvc-Monitoring' - { - return @( - '{649E3CE3-4F85-4F49-B850-1A4B00BDF944}' - - ) - } - 'MgmtSvc-Usage' - { - return @( - '{946B0B96-13AF-404E-98F0-D38BF3828E8E}' - - ) - } - 'MgmtSvc-AdminAPI' - { - return @( - '{DAB5A87F-32D0-4E96-B7FD-47DBDC6EAEED}' - - ) - } - 'MgmtSvc-TenantAPI' - { - return @( - '{CF41308C-9BC3-46C1-8B39-135D00E491E8}' - - ) - } - 'MgmtSvc-TenantPublicAPI' - { - return @( - '{7442368E-A20A-4B4A-9304-104B7191CD82}' - - ) - } - 'MgmtSvc-SQLServer' - { - return @( - '{FFE3B7AD-BED4-4F9C-98CC-D75E64B770EE}' - - ) - } - 'MgmtSvc-MySQL' - { - return @( - '{038DEB00-87C2-483D-B303-3732A6CE6280}' - - ) - } - 'MgmtSvc-AdminSite' - { - return @( - '{8DFE1C24-EF33-4DE8-A8F2-192C7E1FECE0}' - - ) - } - 'MgmtSvc-WindowsAuthSite' - { - return @( - '{42A86301-91AA-4CF2-95AB-C305052ECEFD}' - - ) - } - 'MgmtSvc-TenantSite' - { - return @( - '{78E38778-C952-4B53-96D8-A65DB9683269}' - - ) - } - 'MgmtSvc-AuthSite' - { - return @( - '{B2D82054-D973-4447-BDDF-AE7D11E86585}' - - ) - } - 'MgmtSvc-ConfigSite' - { - return @( - '{53DA6693-27E7-438C-A4C1-BE2FCA1811DC}' - - ) - } - } -} - - -function GetComponentInstalled -{ - param - ( - [String[]] - $Products, - - [String[]] - $IdentifyingNumbers - ) - - $ComponentInstalled = $false - foreach($IdentifyingNumber in $IdentifyingNumbers) - { - if(!$ComponentInstalled) - { - if($Products | Where-Object {$_ -eq $IdentifyingNumber}) - { - $ComponentInstalled = $true - } - } - } - - return $ComponentInstalled -} - - -Export-ModuleMember -Function *-TargetResource \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackUpdate/MSFT_xAzurePackUpdate.schema.mof b/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackUpdate/MSFT_xAzurePackUpdate.schema.mof deleted file mode 100644 index e8425ec0..00000000 --- a/lib/puppet_x/dsc_resources/xAzurePack/DSCResources/MSFT_xAzurePackUpdate/MSFT_xAzurePackUpdate.schema.mof +++ /dev/null @@ -1,8 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xAzurePackUpdate")] -class MSFT_xAzurePackUpdate : OMI_BaseResource -{ - [Key, Description("The Azure Pack role to be updated."), ValueMap{"Admin API","Tenant API","Tenant Public API","SQL Server Extension","MySQL Extension","Admin Site","Admin Authentication Site","Tenant Site","Tenant Authentication Site"}, Values{"Admin API","Tenant API","Tenant Public API","SQL Server Extension","MySQL Extension","Admin Site","Admin Authentication Site","Tenant Site","Tenant Authentication Site"}] String Role; - [Required, Description("UNC path to the root of the source files for installation.")] String SourcePath; - [Write, Description("Folder within the source path containing the source files for installation.")] String SourceFolder; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the installation.")] String SetupCredential; -}; diff --git a/lib/puppet_x/dsc_resources/xAzurePack/LICENSE b/lib/puppet_x/dsc_resources/xAzurePack/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xAzurePack/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xAzurePack/en-US/xPDT.strings.psd1 b/lib/puppet_x/dsc_resources/xAzurePack/en-US/xPDT.strings.psd1 deleted file mode 100644 index e3145612..00000000 --- a/lib/puppet_x/dsc_resources/xAzurePack/en-US/xPDT.strings.psd1 +++ /dev/null @@ -1,10 +0,0 @@ -ConvertFrom-StringData @' -FileNotFound=File not found in the environment path -AbsolutePathOrFileName=Absolute path or file name expected -InvalidArgument=Invalid argument: '{0}' with value: '{1}' -InvalidArgumentAndMessage={0} {1} -ErrorStarting=Failure starting process matching path '{0}'. Message: {1} -FailureWaitingForProcessesToStart=Failed to wait for processes to start -ProcessStarted=Process matching path '{0}' started in process ID {1} -ProcessAlreadyStarted=Process matching path '{0}' already started in process ID {1} -'@ diff --git a/lib/puppet_x/dsc_resources/xAzurePack/xAzurePack.psd1 b/lib/puppet_x/dsc_resources/xAzurePack/xAzurePack.psd1 deleted file mode 100644 index 03041675..00000000 --- a/lib/puppet_x/dsc_resources/xAzurePack/xAzurePack.psd1 +++ /dev/null @@ -1,55 +0,0 @@ -@{ -# Version number of this module. -ModuleVersion = '1.4.0.0' - -# ID used to uniquely identify this module -GUID = 'bd5e20f0-d520-48ec-84c7-c43c66007db7' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'Module with DSC Resources for deployment and configuration of Microsoft Windows Azure Pack.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Minimum version of the common language runtime (CLR) required by this module -CLRVersion = '4.0' - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/xAzurePack/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/xAzurePack' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - # ReleaseNotes = '' - - } # End of PSData hashtable - -} # End of PrivateData hashtable -} diff --git a/lib/puppet_x/dsc_resources/xAzurePack/xPDT.psm1 b/lib/puppet_x/dsc_resources/xAzurePack/xPDT.psm1 deleted file mode 100644 index c90beaa1..00000000 --- a/lib/puppet_x/dsc_resources/xAzurePack/xPDT.psm1 +++ /dev/null @@ -1,708 +0,0 @@ -data LocalizedData -{ - ConvertFrom-StringData @' - -FileNotFound=File not found in the environment path -AbsolutePathOrFileName=Absolute path or file name expected -InvalidArgument=Invalid argument: '{0}' with value: '{1}' -InvalidArgumentAndMessage={0} {1} -ErrorStarting=Failure starting process matching path '{0}'. Message: {1} -FailureWaitingForProcessesToStart=Failed to wait for processes to start -ProcessStarted=Process matching path '{0}' started in process ID {1} -ProcessAlreadyStarted=Process matching path '{0}' already started in process ID {1} -'@ -} - -Import-LocalizedData LocalizedData -filename xPDT.strings.psd1 - -function ThrowInvalidArgumentError -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $errorId, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $errorMessage - ) - - $errorCategory=[System.Management.Automation.ErrorCategory]::InvalidArgument - $exception = New-Object System.ArgumentException $errorMessage; - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - throw $errorRecord -} - -function ResolvePath -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Path - ) - - $Path = [Environment]::ExpandEnvironmentVariables($Path) - if(IsRootedPath $Path) - { - if(!(Test-Path $Path -PathType Leaf)) - { - ThrowInvalidArgumentError "CannotFindRootedPath" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.FileNotFound) - } - return $Path - } - if([string]::IsNullOrEmpty($env:Path)) - { - ThrowInvalidArgumentError "EmptyEnvironmentPath" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.FileNotFound) - } - if((Split-Path $Path -Leaf) -ne $Path) - { - ThrowInvalidArgumentError "NotAbsolutePathOrFileName" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.AbsolutePathOrFileName) - } - foreach($rawSegment in $env:Path.Split(";")) - { - $segment = [Environment]::ExpandEnvironmentVariables($rawSegment) - $segmentRooted = $false - try - { - $segmentRooted=[IO.Path]::IsPathRooted($segment) - } - catch {} - if(!$segmentRooted) - { - continue - } - $candidate = join-path $segment $Path - if(Test-Path $candidate -PathType Leaf) - { - return $candidate - } - } - ThrowInvalidArgumentError "CannotFindRelativePath" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.FileNotFound) -} - -function IsRootedPath -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path - ) - - try - { - return [IO.Path]::IsPathRooted($Path) - } - catch - { - ThrowInvalidArgumentError "CannotGetIsPathRooted" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $_.Exception.Message) - } -} - -function ExtractArguments -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - $functionBoundParameters, - - [parameter(Mandatory = $true)] - [string[]] - $argumentNames, - - [string[]] - $newArgumentNames - ) - - $returnValue=@{} - - for($i=0;$i -lt $argumentNames.Count;$i++) - { - $argumentName = $argumentNames[$i] - - if($newArgumentNames -eq $null) - { - $newArgumentName = $argumentName - } - else - { - $newArgumentName = $newArgumentNames[$i] - } - - if($functionBoundParameters.ContainsKey($argumentName)) - { - $null = $returnValue.Add($newArgumentName,$functionBoundParameters[$argumentName]) - } - } - - return $returnValue -} - -function CallPInvoke -{ - $script:ProgramSource = @" -using System; -using System.Collections.Generic; -using System.Text; -using System.Security; -using System.Runtime.InteropServices; -using System.Diagnostics; -using System.Security.Principal; -using System.ComponentModel; -using System.IO; - -namespace Source -{ - [SuppressUnmanagedCodeSecurity] - public static class NativeMethods - { - //The following structs and enums are used by the various Win32 API's that are used in the code below - - [StructLayout(LayoutKind.Sequential)] - public struct STARTUPINFO - { - public Int32 cb; - public string lpReserved; - public string lpDesktop; - public string lpTitle; - public Int32 dwX; - public Int32 dwY; - public Int32 dwXSize; - public Int32 dwXCountChars; - public Int32 dwYCountChars; - public Int32 dwFillAttribute; - public Int32 dwFlags; - public Int16 wShowWindow; - public Int16 cbReserved2; - public IntPtr lpReserved2; - public IntPtr hStdInput; - public IntPtr hStdOutput; - public IntPtr hStdError; - } - - [StructLayout(LayoutKind.Sequential)] - public struct PROCESS_INFORMATION - { - public IntPtr hProcess; - public IntPtr hThread; - public Int32 dwProcessID; - public Int32 dwThreadID; - } - - [Flags] - public enum LogonType - { - LOGON32_LOGON_INTERACTIVE = 2, - LOGON32_LOGON_NETWORK = 3, - LOGON32_LOGON_BATCH = 4, - LOGON32_LOGON_SERVICE = 5, - LOGON32_LOGON_UNLOCK = 7, - LOGON32_LOGON_NETWORK_CLEARTEXT = 8, - LOGON32_LOGON_NEW_CREDENTIALS = 9 - } - - [Flags] - public enum LogonProvider - { - LOGON32_PROVIDER_DEFAULT = 0, - LOGON32_PROVIDER_WINNT35, - LOGON32_PROVIDER_WINNT40, - LOGON32_PROVIDER_WINNT50 - } - [StructLayout(LayoutKind.Sequential)] - public struct SECURITY_ATTRIBUTES - { - public Int32 Length; - public IntPtr lpSecurityDescriptor; - public bool bInheritHandle; - } - - public enum SECURITY_IMPERSONATION_LEVEL - { - SecurityAnonymous, - SecurityIdentification, - SecurityImpersonation, - SecurityDelegation - } - - public enum TOKEN_TYPE - { - TokenPrimary = 1, - TokenImpersonation - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - internal struct TokPriv1Luid - { - public int Count; - public long Luid; - public int Attr; - } - - public const int GENERIC_ALL_ACCESS = 0x10000000; - public const int CREATE_NO_WINDOW = 0x08000000; - internal const int SE_PRIVILEGE_ENABLED = 0x00000002; - internal const int TOKEN_QUERY = 0x00000008; - internal const int TOKEN_ADJUST_PRIVILEGES = 0x00000020; - internal const string SE_INCRASE_QUOTA = "SeIncreaseQuotaPrivilege"; - - [DllImport("kernel32.dll", - EntryPoint = "CloseHandle", SetLastError = true, - CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] - public static extern bool CloseHandle(IntPtr handle); - - [DllImport("advapi32.dll", - EntryPoint = "CreateProcessAsUser", SetLastError = true, - CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] - public static extern bool CreateProcessAsUser( - IntPtr hToken, - string lpApplicationName, - string lpCommandLine, - ref SECURITY_ATTRIBUTES lpProcessAttributes, - ref SECURITY_ATTRIBUTES lpThreadAttributes, - bool bInheritHandle, - Int32 dwCreationFlags, - IntPtr lpEnvrionment, - string lpCurrentDirectory, - ref STARTUPINFO lpStartupInfo, - ref PROCESS_INFORMATION lpProcessInformation - ); - - [DllImport("advapi32.dll", EntryPoint = "DuplicateTokenEx")] - public static extern bool DuplicateTokenEx( - IntPtr hExistingToken, - Int32 dwDesiredAccess, - ref SECURITY_ATTRIBUTES lpThreadAttributes, - Int32 ImpersonationLevel, - Int32 dwTokenType, - ref IntPtr phNewToken - ); - - [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] - public static extern Boolean LogonUser( - String lpszUserName, - String lpszDomain, - String lpszPassword, - LogonType dwLogonType, - LogonProvider dwLogonProvider, - out IntPtr phToken - ); - - [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)] - internal static extern bool AdjustTokenPrivileges( - IntPtr htok, - bool disall, - ref TokPriv1Luid newst, - int len, - IntPtr prev, - IntPtr relen - ); - - [DllImport("kernel32.dll", ExactSpelling = true)] - internal static extern IntPtr GetCurrentProcess(); - - [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)] - internal static extern bool OpenProcessToken( - IntPtr h, - int acc, - ref IntPtr phtok - ); - - [DllImport("advapi32.dll", SetLastError = true)] - internal static extern bool LookupPrivilegeValue( - string host, - string name, - ref long pluid - ); - - public static void CreateProcessAsUser(string strCommand, string strDomain, string strName, string strPassword) - { - var hToken = IntPtr.Zero; - var hDupedToken = IntPtr.Zero; - TokPriv1Luid tp; - var pi = new PROCESS_INFORMATION(); - var sa = new SECURITY_ATTRIBUTES(); - sa.Length = Marshal.SizeOf(sa); - Boolean bResult = false; - try - { - bResult = LogonUser( - strName, - strDomain, - strPassword, - LogonType.LOGON32_LOGON_BATCH, - LogonProvider.LOGON32_PROVIDER_DEFAULT, - out hToken - ); - if (!bResult) - { - throw new Win32Exception("The user could not be logged on. Ensure that the user has an existing profile on the machine and that correct credentials are provided. Logon error #" + Marshal.GetLastWin32Error().ToString()); - } - IntPtr hproc = GetCurrentProcess(); - IntPtr htok = IntPtr.Zero; - bResult = OpenProcessToken( - hproc, - TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, - ref htok - ); - if(!bResult) - { - throw new Win32Exception("Open process token error #" + Marshal.GetLastWin32Error().ToString()); - } - tp.Count = 1; - tp.Luid = 0; - tp.Attr = SE_PRIVILEGE_ENABLED; - bResult = LookupPrivilegeValue( - null, - SE_INCRASE_QUOTA, - ref tp.Luid - ); - if(!bResult) - { - throw new Win32Exception("Error in looking up privilege of the process. This should not happen if DSC is running as LocalSystem Lookup privilege error #" + Marshal.GetLastWin32Error().ToString()); - } - bResult = AdjustTokenPrivileges( - htok, - false, - ref tp, - 0, - IntPtr.Zero, - IntPtr.Zero - ); - if(!bResult) - { - throw new Win32Exception("Token elevation error #" + Marshal.GetLastWin32Error().ToString()); - } - - bResult = DuplicateTokenEx( - hToken, - GENERIC_ALL_ACCESS, - ref sa, - (int)SECURITY_IMPERSONATION_LEVEL.SecurityIdentification, - (int)TOKEN_TYPE.TokenPrimary, - ref hDupedToken - ); - if(!bResult) - { - throw new Win32Exception("Duplicate Token error #" + Marshal.GetLastWin32Error().ToString()); - } - var si = new STARTUPINFO(); - si.cb = Marshal.SizeOf(si); - si.lpDesktop = ""; - bResult = CreateProcessAsUser( - hDupedToken, - null, - strCommand, - ref sa, - ref sa, - false, - 0, - IntPtr.Zero, - null, - ref si, - ref pi - ); - if(!bResult) - { - throw new Win32Exception("The process could not be created. Create process as user error #" + Marshal.GetLastWin32Error().ToString()); - } - } - finally - { - if (pi.hThread != IntPtr.Zero) - { - CloseHandle(pi.hThread); - } - if (pi.hProcess != IntPtr.Zero) - { - CloseHandle(pi.hProcess); - } - if (hDupedToken != IntPtr.Zero) - { - CloseHandle(hDupedToken); - } - } - } - } -} - -"@ - Add-Type -TypeDefinition $ProgramSource -ReferencedAssemblies "System.ServiceProcess" -} - -function GetWin32Process -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [PSCredential] - $Credential - ) - - $fileName = [io.path]::GetFileNameWithoutExtension($Path) - $GetProcesses = @(Get-Process -Name $fileName -ErrorAction SilentlyContinue) - $Processes = foreach($process in $GetProcesses) - { - if($Process.Path -ieq $Path) - { - try - { - [wmi]"Win32_Process.Handle='$($Process.Id)'" - } - catch - { - } - } - } - if($PSBoundParameters.ContainsKey('Credential')) - { - $Processes = $Processes | Where-Object {(GetWin32ProcessOwner $_) -eq $Credential.UserName} - } - if($Arguments -eq $null) {$Arguments = ""} - $Processes = $Processes | Where-Object {(GetWin32ProcessArgumentsFromCommandLine $_.CommandLine) -eq $Arguments} - - return $Processes -} - -function GetWin32ProcessOwner -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNull()] - $Process - ) - - try - { - $Owner = $Process.GetOwner() - } - catch - {} - if($owner.Domain -ne $null) - { - return $Owner.Domain + "\" + $Owner.User - } - else - { - return $Owner.User - } -} - -function GetWin32ProcessArgumentsFromCommandLine -{ - param - ( - [String] - $commandLine - ) - - if($commandLine -eq $null) - { - return "" - } - $commandLine=$commandLine.Trim() - if($commandLine.Length -eq 0) - { - return "" - } - if($commandLine[0] -eq '"') - { - $charToLookfor=[char]'"' - } - else - { - $charToLookfor=[char]' ' - } - $endOfCommand=$commandLine.IndexOf($charToLookfor ,1) - if($endOfCommand -eq -1) - { - return "" - } - return $commandLine.Substring($endOfCommand+1).Trim() -} - -function StartWin32Process -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [PSCredential] - $Credential, - - [Switch] - $AsTask - ) - - $GetArguments = ExtractArguments $PSBoundParameters ("Path","Arguments","Credential") - $Processes = @(GetWin32Process @getArguments) - if ($processes.Count -eq 0) - { - if($PSBoundParameters.ContainsKey("Credential")) - { - if($AsTask) - { - $ActionArguments = ExtractArguments $PSBoundParameters ` - ("Path", "Arguments") ` - ("Execute", "Argument") - if([string]::IsNullOrEmpty($Arguments)) - { - $null = $ActionArguments.Remove("Argument") - } - $TaskGuid = [guid]::NewGuid().ToString() - $Action = New-ScheduledTaskAction @ActionArguments - $null = Register-ScheduledTask -TaskName "xPDT $TaskGuid" -Action $Action -User $Credential.UserName -Password $Credential.GetNetworkCredential().Password -RunLevel Highest - $err = Start-ScheduledTask -TaskName "xPDT $TaskGuid" - } - else - { - try - { - CallPInvoke - [Source.NativeMethods]::CreateProcessAsUser(("$Path " + $Arguments),$Credential.GetNetworkCredential().Domain,$Credential.GetNetworkCredential().UserName,$Credential.GetNetworkCredential().Password) - } - catch - { - $exception = New-Object System.ArgumentException $_ - $errorCategory = [System.Management.Automation.ErrorCategory]::OperationStopped - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, "Win32Exception", $errorCategory, $null - $err = $errorRecord - } - } - } - else - { - $StartArguments = ExtractArguments $PSBoundParameters ` - ("Path", "Arguments", "Credential") ` - ("FilePath", "ArgumentList", "Credential") - if([string]::IsNullOrEmpty($Arguments)) - { - $null = $StartArguments.Remove("ArgumentList") - } - $err = Start-Process @StartArguments - } - if($err -ne $null) - { - throw $err - } - if (!(WaitForWin32ProcessStart @GetArguments)) - { - ThrowInvalidArgumentError "FailureWaitingForProcessesToStart" ($LocalizedData.ErrorStarting -f $Path,$LocalizedData.FailureWaitingForProcessesToStart) - } - } - else - { - return ($LocalizedData.ProcessAlreadyStarted -f $Path,$Processes.ProcessId) - } - $Processes = @(GetWin32Process @getArguments) - return ($LocalizedData.ProcessStarted -f $Path,$Processes.ProcessId) -} - -function WaitForWin32ProcessStart -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [PSCredential] - $Credential - ) - - $start = [DateTime]::Now - $GetArguments = ExtractArguments $PSBoundParameters ("Path","Arguments","Credential") - do - { - $value = @(GetWin32Process @GetArguments).Count -ge 1 - } while(!$value -and ([DateTime]::Now - $start).TotalMilliseconds -lt 60000) - - return $value -} - -function WaitForWin32ProcessEnd -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [PSCredential] - $Credential - ) - - $GetArguments = ExtractArguments $PSBoundParameters ("Path","Arguments","Credential") - While (WaitForWin32ProcessStart @GetArguments) - { - Start-Sleep 1 - } - Get-ScheduledTask | Where-Object {($_.TaskName.Length -ge 4) -and ($_.TaskName.Substring(0,4) -eq "xPDT") -and ($_.Actions.Execute -eq $Path) -and ($_.Actions.Arguments -eq $Arguments)} | Where-Object {$_ -ne $null} | Unregister-ScheduledTask -Confirm:$false -} - -function NetUse -{ - param - ( - [parameter(Mandatory)] - [string] - $SourcePath, - - [parameter(Mandatory)] - [PSCredential] - $Credential, - - [string] - $Ensure = "Present" - ) - - if(($SourcePath.Length -ge 2) -and ($SourcePath.Substring(0,2) -eq "\\")) - { - - if ($Ensure -eq "Absent") - { - $cmd = "net.exe use $SourcePath /del" - } - else - { - $cmd = "net.exe use $SourcePath $($Credential.GetNetworkCredential().Password) /user:$($Credential.GetNetworkCredential().Domain)\$($Credential.GetNetworkCredential().UserName)" - } - Invoke-Expression $cmd - } -} - -Export-ModuleMember ResolvePath,StartWin32Process,WaitForWin32ProcessEnd,NetUse diff --git a/lib/puppet_x/dsc_resources/xBitlocker/DSCResources/MSFT_xBLAutoBitlocker/MSFT_xBLAutoBitlocker.psm1 b/lib/puppet_x/dsc_resources/xBitlocker/DSCResources/MSFT_xBLAutoBitlocker/MSFT_xBLAutoBitlocker.psm1 deleted file mode 100644 index 74a1d6b2..00000000 --- a/lib/puppet_x/dsc_resources/xBitlocker/DSCResources/MSFT_xBLAutoBitlocker/MSFT_xBLAutoBitlocker.psm1 +++ /dev/null @@ -1,398 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Fixed","Removable")] - [System.String] - $DriveType, - - [System.Int32] - $MinDiskCapacityGB, - - [ValidateSet("PasswordProtector","RecoveryPasswordProtector","StartupKeyProtector","TpmProtector")] - [parameter(Mandatory = $true)] - [System.String] - $PrimaryProtector, - - [System.String] - $AdAccountOrGroup, - - [System.Boolean] - $AdAccountOrGroupProtector, - - [System.Boolean] - $AutoUnlock = $false, - - [ValidateSet("Aes128","Aes256")] - [System.String] - $EncryptionMethod, - - [System.Boolean] - $HardwareEncryption, - - [System.Management.Automation.PSCredential] - $Password, - - [System.Boolean] - $PasswordProtector, - - [System.Management.Automation.PSCredential] - $Pin, - - [System.String] - $RecoveryKeyPath, - - [System.Boolean] - $RecoveryKeyProtector, - - [System.Boolean] - $RecoveryPasswordProtector, - - [System.Boolean] - $Service, - - [System.Boolean] - $SkipHardwareTest, - - [System.String] - $StartupKeyPath, - - [System.Boolean] - $StartupKeyProtector, - - [System.Boolean] - $TpmProtector, - - [System.Boolean] - $UsedSpaceOnly - ) - - #Load helper module Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xBitlockerCommon.psm1" -Verbose:0 - - CheckForPreReqs - - $returnValue = @{ - DriveType = $DriveType - } - - $returnValue -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Fixed","Removable")] - [System.String] - $DriveType, - - [System.Int32] - $MinDiskCapacityGB, - - [ValidateSet("PasswordProtector","RecoveryPasswordProtector","StartupKeyProtector","TpmProtector")] - [parameter(Mandatory = $true)] - [System.String] - $PrimaryProtector, - - [System.String] - $AdAccountOrGroup, - - [System.Boolean] - $AdAccountOrGroupProtector, - - [System.Boolean] - $AutoUnlock = $false, - - [ValidateSet("Aes128","Aes256")] - [System.String] - $EncryptionMethod, - - [System.Boolean] - $HardwareEncryption, - - [System.Management.Automation.PSCredential] - $Password, - - [System.Boolean] - $PasswordProtector, - - [System.Management.Automation.PSCredential] - $Pin, - - [System.String] - $RecoveryKeyPath, - - [System.Boolean] - $RecoveryKeyProtector, - - [System.Boolean] - $RecoveryPasswordProtector, - - [System.Boolean] - $Service, - - [System.Boolean] - $SkipHardwareTest, - - [System.String] - $StartupKeyPath, - - [System.Boolean] - $StartupKeyProtector, - - [System.Boolean] - $TpmProtector, - - [System.Boolean] - $UsedSpaceOnly - ) - - #Load helper module Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xBitlockerCommon.psm1" -Verbose:0 - - CheckForPreReqs - - $autoBlVols = GetAutoBitlockerStatus @PSBoundParameters - - if ($autoBlVols -eq $null) - { - throw "No Auto Bitlocker volumes were found" - } - else - { - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "DriveType","MinDiskCapacityGB" - AddParameters -PSBoundParametersIn $PSBoundParameters -ParamsToAdd @{"MountPoint" = ""} - - #Loop through each potential AutoBitlocker volume, see whether they are enabled for Bitlocker, and if not, enable it - foreach ($key in $autoBlVols.Keys) - { - $PSBoundParameters["MountPoint"] = $key - - $testResult = TestBitlocker @PSBoundParameters - - if ($testResult -eq $false) - { - EnableBitlocker @PSBoundParameters -VerbosePreference $VerbosePreference - } - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Fixed","Removable")] - [System.String] - $DriveType, - - [System.Int32] - $MinDiskCapacityGB, - - [ValidateSet("PasswordProtector","RecoveryPasswordProtector","StartupKeyProtector","TpmProtector")] - [parameter(Mandatory = $true)] - [System.String] - $PrimaryProtector, - - [System.String] - $AdAccountOrGroup, - - [System.Boolean] - $AdAccountOrGroupProtector, - - [System.Boolean] - $AutoUnlock = $false, - - [ValidateSet("Aes128","Aes256")] - [System.String] - $EncryptionMethod, - - [System.Boolean] - $HardwareEncryption, - - [System.Management.Automation.PSCredential] - $Password, - - [System.Boolean] - $PasswordProtector, - - [System.Management.Automation.PSCredential] - $Pin, - - [System.String] - $RecoveryKeyPath, - - [System.Boolean] - $RecoveryKeyProtector, - - [System.Boolean] - $RecoveryPasswordProtector, - - [System.Boolean] - $Service, - - [System.Boolean] - $SkipHardwareTest, - - [System.String] - $StartupKeyPath, - - [System.Boolean] - $StartupKeyProtector, - - [System.Boolean] - $TpmProtector, - - [System.Boolean] - $UsedSpaceOnly - ) - - #Load helper module Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xBitlockerCommon.psm1" -Verbose:0 - - CheckForPreReqs - - $autoBlVols = GetAutoBitlockerStatus @PSBoundParameters - - if ($autoBlVols -eq $null) - { - return $false - } - else - { - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "DriveType","MinDiskCapacityGB" - AddParameters -PSBoundParametersIn $PSBoundParameters -ParamsToAdd @{"MountPoint" = ""} - - #Check whether any potential AutoBitlocker volume is not currently enabled for Bitlocker, or doesn't have the correct settings - foreach ($key in $autoBlVols.Keys) - { - $PSBoundParameters["MountPoint"] = $key - - $testResult = TestBitlocker @PSBoundParameters -VerbosePreference $VerbosePreference - - if ($testResult -eq $false) - { - return $testResult - } - } - } - - return $true -} - -function GetAutoBitlockerStatus -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Fixed","Removable")] - [System.String] - $DriveType, - - [System.Int32] - $MinDiskCapacityGB, - - [ValidateSet("PasswordProtector","RecoveryPasswordProtector","StartupKeyProtector","TpmProtector")] - [parameter(Mandatory = $true)] - [System.String] - $PrimaryProtector, - - [System.String] - $AdAccountOrGroup, - - [System.Boolean] - $AdAccountOrGroupProtector, - - [System.Boolean] - $AutoUnlock = $false, - - [ValidateSet("Aes128","Aes256")] - [System.String] - $EncryptionMethod, - - [System.Boolean] - $HardwareEncryption, - - [System.Management.Automation.PSCredential] - $Password, - - [System.Boolean] - $PasswordProtector, - - [System.Management.Automation.PSCredential] - $Pin, - - [System.String] - $RecoveryKeyPath, - - [System.Boolean] - $RecoveryKeyProtector, - - [System.Boolean] - $RecoveryPasswordProtector, - - [System.Boolean] - $Service, - - [System.Boolean] - $SkipHardwareTest, - - [System.String] - $StartupKeyPath, - - [System.Boolean] - $StartupKeyProtector, - - [System.Boolean] - $TpmProtector, - - [System.Boolean] - $UsedSpaceOnly - ) - - #First get all Bitlocker Volumes of type Data - $allBlvs = Get-BitLockerVolume | where {$_.VolumeType -eq "Data"} - - #Filter on size if it was specified - if ($PSBoundParameters.ContainsKey("MinDiskCapacityGB")) - { - $allBlvs = $allBlvs | where {$_.CapacityGB -ge $MinDiskCapacityGB} - } - - #Now find disks of the appropriate drive type, and add them to the collection - if ($allBlvs -ne $null) - { - [Hashtable]$returnValue = @{} - - foreach ($blv in $allBlvs) - { - $vol = $null - $vol = Get-Volume -Path $blv.MountPoint -ErrorAction SilentlyContinue | where {$_.DriveType -like $DriveType} - - if ($vol -ne $null) - { - [Hashtable]$props = @{ - VolumeStatus = $blv.VolumeStatus - KeyProtectors = $blv.KeyProtector - EncryptionMethod = $blv.EncryptionMethod - } - - $returnValue.Add($blv.MountPoint, $props) - } - } - } - - $returnValue -} - -Export-ModuleMember -Function *-TargetResource - - diff --git a/lib/puppet_x/dsc_resources/xBitlocker/DSCResources/MSFT_xBLAutoBitlocker/MSFT_xBLAutoBitlocker.schema.mof b/lib/puppet_x/dsc_resources/xBitlocker/DSCResources/MSFT_xBLAutoBitlocker/MSFT_xBLAutoBitlocker.schema.mof deleted file mode 100644 index 419b8398..00000000 --- a/lib/puppet_x/dsc_resources/xBitlocker/DSCResources/MSFT_xBLAutoBitlocker/MSFT_xBLAutoBitlocker.schema.mof +++ /dev/null @@ -1,32 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xBLAutoBitlocker")] -class MSFT_xBLAutoBitlocker : OMI_BaseResource -{ - //Used to automatically enable Bitlocker on drives of type Fixed or Removable. Does not work on Operating System drives. - - [Key, ValueMap{"Fixed","Removable"}, Values{"Fixed","Removable"}] String DriveType; //The type of volume, as reported by Get-Volume, to auto apply Bitlocker to - [Write] Sint32 MinDiskCapacityGB; //If specified, only disks this size or greater will auto apply Bitlocker - [Required, ValueMap{"PasswordProtector","RecoveryPasswordProtector","StartupKeyProtector","TpmProtector"}, Values{"PasswordProtector","RecoveryPasswordProtector","StartupKeyProtector","TpmProtector"}] String PrimaryProtector; - [Write] Boolean AutoUnlock; //Whether volumes should be enabled for auto unlock using Enable-BitlockerAutoUnlock - - //Remaing properties correspond directly to Enable-Bitlocker parameters - //http://technet.microsoft.com/en-us/library/jj649837.aspx - [Write] String AdAccountOrGroup; - [Write] Boolean AdAccountOrGroupProtector; - [Write, ValueMap{"Aes128","Aes256"}, Values{"Aes128","Aes256"}] String EncryptionMethod; - [Write] Boolean HardwareEncryption; - [Write, EmbeddedInstance("MSFT_Credential")] String Password; //NOTE: Username doesn't matter for the credential. Just put the Password in the Password field - [Write] Boolean PasswordProtector; - [Write, EmbeddedInstance("MSFT_Credential")] String Pin; //NOTE: Username doesn't matter for the credential. Just put the Pin in the Password field - [Write] String RecoveryKeyPath; - [Write] Boolean RecoveryKeyProtector; - [Write] Boolean RecoveryPasswordProtector; - [Write] Boolean Service; - [Write] Boolean SkipHardwareTest; - [Write] String StartupKeyPath; - [Write] Boolean StartupKeyProtector; - [Write] Boolean TpmProtector; - [Write] Boolean UsedSpaceOnly; -}; - - diff --git a/lib/puppet_x/dsc_resources/xBitlocker/DSCResources/MSFT_xBLBitlocker/MSFT_xBLBitlocker.psm1 b/lib/puppet_x/dsc_resources/xBitlocker/DSCResources/MSFT_xBLBitlocker/MSFT_xBLBitlocker.psm1 deleted file mode 100644 index 295a4b5b..00000000 --- a/lib/puppet_x/dsc_resources/xBitlocker/DSCResources/MSFT_xBLBitlocker/MSFT_xBLBitlocker.psm1 +++ /dev/null @@ -1,243 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $MountPoint, - - [ValidateSet("PasswordProtector","RecoveryPasswordProtector","StartupKeyProtector","TpmProtector")] - [parameter(Mandatory = $true)] - [System.String] - $PrimaryProtector, - - [System.String] - $AdAccountOrGroup, - - [System.Boolean] - $AdAccountOrGroupProtector, - - [System.Boolean] - $AllowImmediateReboot = $false, - - [System.Boolean] - $AutoUnlock = $false, - - [ValidateSet("Aes128","Aes256")] - [System.String] - $EncryptionMethod, - - [System.Boolean] - $HardwareEncryption, - - [System.Management.Automation.PSCredential] - $Password, - - [System.Boolean] - $PasswordProtector, - - [System.Management.Automation.PSCredential] - $Pin, - - [System.String] - $RecoveryKeyPath, - - [System.Boolean] - $RecoveryKeyProtector, - - [System.Boolean] - $RecoveryPasswordProtector, - - [System.Boolean] - $Service, - - [System.Boolean] - $SkipHardwareTest, - - [System.String] - $StartupKeyPath, - - [System.Boolean] - $StartupKeyProtector, - - [System.Boolean] - $TpmProtector, - - [System.Boolean] - $UsedSpaceOnly - ) - - #Load helper module Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xBitlockerCommon.psm1" -Verbose:0 - - CheckForPreReqs - - $returnValue = @{ - MountPoint = $MountPoint - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $MountPoint, - - [ValidateSet("PasswordProtector","RecoveryPasswordProtector","StartupKeyProtector","TpmProtector")] - [parameter(Mandatory = $true)] - [System.String] - $PrimaryProtector, - - [System.String] - $AdAccountOrGroup, - - [System.Boolean] - $AdAccountOrGroupProtector, - - [System.Boolean] - $AllowImmediateReboot = $false, - - [System.Boolean] - $AutoUnlock = $false, - - [ValidateSet("Aes128","Aes256")] - [System.String] - $EncryptionMethod, - - [System.Boolean] - $HardwareEncryption, - - [System.Management.Automation.PSCredential] - $Password, - - [System.Boolean] - $PasswordProtector, - - [System.Management.Automation.PSCredential] - $Pin, - - [System.String] - $RecoveryKeyPath, - - [System.Boolean] - $RecoveryKeyProtector, - - [System.Boolean] - $RecoveryPasswordProtector, - - [System.Boolean] - $Service, - - [System.Boolean] - $SkipHardwareTest, - - [System.String] - $StartupKeyPath, - - [System.Boolean] - $StartupKeyProtector, - - [System.Boolean] - $TpmProtector, - - [System.Boolean] - $UsedSpaceOnly - ) - - #Load helper module Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xBitlockerCommon.psm1" -Verbose:0 - - CheckForPreReqs - - EnableBitlocker @PSBoundParameters -VerbosePreference $VerbosePreference -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $MountPoint, - - [ValidateSet("PasswordProtector","RecoveryPasswordProtector","StartupKeyProtector","TpmProtector")] - [parameter(Mandatory = $true)] - [System.String] - $PrimaryProtector, - - [System.String] - $AdAccountOrGroup, - - [System.Boolean] - $AdAccountOrGroupProtector, - - [System.Boolean] - $AllowImmediateReboot = $false, - - [System.Boolean] - $AutoUnlock = $false, - - [ValidateSet("Aes128","Aes256")] - [System.String] - $EncryptionMethod, - - [System.Boolean] - $HardwareEncryption, - - [System.Management.Automation.PSCredential] - $Password, - - [System.Boolean] - $PasswordProtector, - - [System.Management.Automation.PSCredential] - $Pin, - - [System.String] - $RecoveryKeyPath, - - [System.Boolean] - $RecoveryKeyProtector, - - [System.Boolean] - $RecoveryPasswordProtector, - - [System.Boolean] - $Service, - - [System.Boolean] - $SkipHardwareTest, - - [System.String] - $StartupKeyPath, - - [System.Boolean] - $StartupKeyProtector, - - [System.Boolean] - $TpmProtector, - - [System.Boolean] - $UsedSpaceOnly - ) - - #Load helper module Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xBitlockerCommon.psm1" -Verbose:0 - - CheckForPreReqs - - $testResult = TestBitlocker @PSBoundParameters -VerbosePreference $VerbosePreference - - return $testResult -} - -Export-ModuleMember -Function *-TargetResource - - diff --git a/lib/puppet_x/dsc_resources/xBitlocker/DSCResources/MSFT_xBLBitlocker/MSFT_xBLBitlocker.schema.mof b/lib/puppet_x/dsc_resources/xBitlocker/DSCResources/MSFT_xBLBitlocker/MSFT_xBLBitlocker.schema.mof deleted file mode 100644 index 1ca2f91e..00000000 --- a/lib/puppet_x/dsc_resources/xBitlocker/DSCResources/MSFT_xBLBitlocker/MSFT_xBLBitlocker.schema.mof +++ /dev/null @@ -1,30 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xBLBitlocker")] -class MSFT_xBLBitlocker : OMI_BaseResource -{ - [Key] String MountPoint; //The MountPoint name as reported in Get-BitLockerVolume - [Required, ValueMap{"PasswordProtector","RecoveryPasswordProtector","StartupKeyProtector","TpmProtector"}, Values{"PasswordProtector","RecoveryPasswordProtector","StartupKeyProtector","TpmProtector"}] String PrimaryProtector; //The type of key protector that will be used as the primary key protector - [Write] Boolean AutoUnlock; //Whether volumes should be enabled for auto unlock using Enable-BitlockerAutoUnlock - [Write] Boolean AllowImmediateReboot; //Whether the computer can be immediately rebooted after enabling Bitlocker on an OS drive. Defaults to false. - - //Remaing properties correspond directly to Enable-Bitlocker parameters - //http://technet.microsoft.com/en-us/library/jj649837.aspx - [Write] String AdAccountOrGroup; - [Write] Boolean AdAccountOrGroupProtector; - [Write, ValueMap{"Aes128","Aes256"}, Values{"Aes128","Aes256"}] String EncryptionMethod; - [Write] Boolean HardwareEncryption; - [Write, EmbeddedInstance("MSFT_Credential")] String Password; //NOTE: Username doesn't matter for the credential. Just put the Password in the Password field - [Write] Boolean PasswordProtector; - [Write, EmbeddedInstance("MSFT_Credential")] String Pin; //NOTE: Username doesn't matter for the credential. Just put the Pin in the Password field - [Write] String RecoveryKeyPath; - [Write] Boolean RecoveryKeyProtector; - [Write] Boolean RecoveryPasswordProtector; - [Write] Boolean Service; - [Write] Boolean SkipHardwareTest; - [Write] String StartupKeyPath; - [Write] Boolean StartupKeyProtector; - [Write] Boolean TpmProtector; - [Write] Boolean UsedSpaceOnly; -}; - - diff --git a/lib/puppet_x/dsc_resources/xBitlocker/DSCResources/MSFT_xBLTpm/MSFT_xBLTpm.psm1 b/lib/puppet_x/dsc_resources/xBitlocker/DSCResources/MSFT_xBLTpm/MSFT_xBLTpm.psm1 deleted file mode 100644 index 4ba56274..00000000 --- a/lib/puppet_x/dsc_resources/xBitlocker/DSCResources/MSFT_xBLTpm/MSFT_xBLTpm.psm1 +++ /dev/null @@ -1,118 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity - ) - - #Load helper module Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xBitlockerCommon.psm1" -Verbose:0 - - CheckForPreReqs - - $tpm = Get-Tpm - - if ($tpm -ne $null) - { - $returnValue = @{ - Identity = $Identity - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [System.Boolean] - $AllowClear, - - [System.Boolean] - $AllowPhysicalPresence, - - [System.Boolean] - $AllowImmediateReboot = $false - ) - - #Load helper module Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xBitlockerCommon.psm1" -Verbose:0 - - CheckForPreReqs - - $PSBoundParameters.Remove("Identity") | Out-Null - $PSBoundParameters.Remove("AllowImmediateReboot") | Out-Null - - $tpm = Initialize-Tpm @PSBoundParameters - - if ($tpm -ne $null) - { - if ($tpm.RestartRequired -eq $true) - { - $global:DSCMachineStatus = 1 - - if ($AllowImmediateReboot -eq $true) - { - Write-Verbose "Forcing an immediate reboot of the computer in 30 seconds" - - Start-Sleep -Seconds 30 - Restart-Computer -Force - } - } - } - else - { - throw "Failed to initialize TPM" - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [System.Boolean] - $AllowClear, - - [System.Boolean] - $AllowPhysicalPresence, - - [System.Boolean] - $AllowImmediateReboot = $false - ) - - #Load helper module Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xBitlockerCommon.psm1" -Verbose:0 - - CheckForPreReqs - - $tpm = Get-Tpm - - if ($tpm -eq $null) - { - return $false - } - else - { - return $tpm.TpmReady - } -} - - -Export-ModuleMember -Function *-TargetResource - - diff --git a/lib/puppet_x/dsc_resources/xBitlocker/DSCResources/MSFT_xBLTpm/MSFT_xBLTpm.schema.mof b/lib/puppet_x/dsc_resources/xBitlocker/DSCResources/MSFT_xBLTpm/MSFT_xBLTpm.schema.mof deleted file mode 100644 index 383c7bc5..00000000 --- a/lib/puppet_x/dsc_resources/xBitlocker/DSCResources/MSFT_xBLTpm/MSFT_xBLTpm.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xBLTpm")] -class MSFT_xBLTpm : OMI_BaseResource -{ - [Key] String Identity; //Not actually used, so could be anything - [Write] Boolean AllowClear; //Indicates that the provisioning process clears the TPM, if necessary, to move the TPM closer to complying with Windows Server® 2012 standards - [Write] Boolean AllowPhysicalPresence; //Indicates that the provisioning process may send physical presence commands that require a user to be present in order to continue. - [Write] Boolean AllowImmediateReboot; //Whether the computer can rebooted immediately after initializing the TPM -}; - - diff --git a/lib/puppet_x/dsc_resources/xBitlocker/LICENSE b/lib/puppet_x/dsc_resources/xBitlocker/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xBitlocker/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xBitlocker/Misc/xBitlockerCommon.psm1 b/lib/puppet_x/dsc_resources/xBitlocker/Misc/xBitlockerCommon.psm1 deleted file mode 100644 index a89d9e03..00000000 --- a/lib/puppet_x/dsc_resources/xBitlocker/Misc/xBitlockerCommon.psm1 +++ /dev/null @@ -1,516 +0,0 @@ -#A common function used to enable Bitlocker on a disk. -function EnableBitlocker -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $MountPoint, - - [ValidateSet("PasswordProtector","RecoveryPasswordProtector","StartupKeyProtector","TpmProtector")] - [parameter(Mandatory = $true)] - [System.String] - $PrimaryProtector, - - [System.String] - $AdAccountOrGroup, - - [System.Boolean] - $AdAccountOrGroupProtector, - - [System.Boolean] - $AllowImmediateReboot = $false, - - [System.Boolean] - $AutoUnlock = $false, - - [ValidateSet("Aes128","Aes256")] - [System.String] - $EncryptionMethod, - - [System.Boolean] - $HardwareEncryption, - - [System.Management.Automation.PSCredential] - $Password, - - [System.Boolean] - $PasswordProtector, - - [System.Management.Automation.PSCredential] - $Pin, - - [System.String] - $RecoveryKeyPath, - - [System.Boolean] - $RecoveryKeyProtector, - - [System.Boolean] - $RecoveryPasswordProtector, - - [System.Boolean] - $Service, - - [System.Boolean] - $SkipHardwareTest, - - [System.String] - $StartupKeyPath, - - [System.Boolean] - $StartupKeyProtector, - - [System.Boolean] - $TpmProtector, - - [System.Boolean] - $UsedSpaceOnly, - - $VerbosePreference - ) - - Write-Verbose "Beginning processing of MountPoint: $($MountPoint)" - - $blv = Get-BitLockerVolume -MountPoint $MountPoint -ErrorAction SilentlyContinue - - if ($blv -ne $null) - { - if ($PSBoundParameters.ContainsKey("TpmProtector") -and $PrimaryProtector -ne "TpmProtector") - { - throw "If TpmProtector is used, it must be the PrimaryProtector." - } - - if ($PSBoundParameters.ContainsKey("Pin") -and !($PSBoundParameters.ContainsKey("TpmProtector"))) - { - throw "A TpmProtector must be used if Pin is used." - } - - if ($PSBoundParameters.ContainsKey("AdAccountOrGroupProtector") -and $PrimaryProtector -notlike "AdAccountOrGroupProtector" -and !(ContainsKeyProtector -Type "AdAccountOrGroup" -KeyProtectorCollection $blv.KeyProtector)) - { - Write-Verbose "Adding AdAccountOrGroupProtector" - Add-BitLockerKeyProtector -MountPoint $MountPoint -AdAccountOrGroupProtector -AdAccountOrGroup $AdAccountOrGroup - } - - if ($PSBoundParameters.ContainsKey("PasswordProtector") -and $PrimaryProtector -notlike "PasswordProtector" -and !(ContainsKeyProtector -Type "Password" -KeyProtectorCollection $blv.KeyProtector)) - { - Write-Verbose "Adding PasswordProtector" - Add-BitLockerKeyProtector -MountPoint $MountPoint -PasswordProtector -Password $Password.Password - } - - if ($PSBoundParameters.ContainsKey("RecoveryKeyProtector") -and $PrimaryProtector -notlike "RecoveryKeyProtector" -and !(ContainsKeyProtector -Type "ExternalKey" -KeyProtectorCollection $blv.KeyProtector)) - { - Write-Verbose "Adding RecoveryKeyProtector" - Add-BitLockerKeyProtector -MountPoint $MountPoint -RecoveryKeyProtector -RecoveryKeyPath $RecoveryKeyPath - } - - if ($PSBoundParameters.ContainsKey("RecoveryPasswordProtector") -and $PrimaryProtector -notlike "RecoveryPasswordProtector" -and !(ContainsKeyProtector -Type "RecoveryPassword" -KeyProtectorCollection $blv.KeyProtector)) - { - Write-Verbose "Adding RecoveryPasswordProtector" - Add-BitLockerKeyProtector -MountPoint $MountPoint -RecoveryPasswordProtector - } - - if ($PSBoundParameters.ContainsKey("StartupKeyProtector") -and $PrimaryProtector -notlike "TpmProtector" -and $PrimaryProtector -notlike "StartupKeyProtector" -and !(ContainsKeyProtector -Type "ExternalKey" -KeyProtectorCollection $blv.KeyProtector)) - { - Write-Verbose "Adding StartupKeyProtector" - Add-BitLockerKeyProtector -MountPoint $MountPoint -StartupKeyProtector -StartupKeyPath $StartupKeyPath - } - - if ($PSBoundParameters.ContainsKey("TpmProtector") -and $PrimaryProtector -notlike "TpmProtector" -and !(ContainsKeyProtector -Type "Tpm" -KeyProtectorCollection $blv.KeyProtector -StartsWith $true)) - { - Write-Verbose "Adding TpmProtector" - Add-BitLockerKeyProtector -MountPoint $MountPoint -TpmProtector $TpmProtector - } - - #Now enable Bitlocker with the primary key protector - if ($blv.VolumeStatus -eq "FullyDecrypted") - { - #First add non-key related parameters - $params = @{} - $params.Add("MountPoint", $MountPoint) - - if ($PSBoundParameters.ContainsKey("EncryptionMethod")) - { - $params.Add("EncryptionMethod", $EncryptionMethod) - } - - if ($PSBoundParameters.ContainsKey("HardwareEncryption")) - { - $params.Add("HardwareEncryption", $true) - } - - if ($PSBoundParameters.ContainsKey("Service")) - { - $params.Add("Service", $true) - } - - if ($PSBoundParameters.ContainsKey("SkipHardwareTest")) - { - $params.Add("SkipHardwareTest", $true) - } - - if ($PSBoundParameters.ContainsKey("UsedSpaceOnly")) - { - $params.Add("UsedSpaceOnly", $true) - } - - #Now add the primary protector - $handledTpmAlready = $false - - #Deal with a couple one off cases - if ($PSBoundParameters.ContainsKey("Pin")) - { - $handledTpmAlready = $true - - $params.Add("Pin", $Pin.Password) - - if ($PSBoundParameters.ContainsKey("StartupKeyProtector")) - { - $params.Add("TpmAndPinAndStartupKeyProtector", $true) - $params.Add("StartupKeyPath", $StartupKeyPath) - } - else - { - $params.Add("TpmAndPinProtector", $true) - } - } - - if ($PSBoundParameters.ContainsKey("StartupKeyProtector") -and $PrimaryProtector -like "TpmProtector" -and $handledTpmAlready -eq $false) - { - $handledTpmAlready = $true - - $params.Add("TpmAndStartupKeyProtector", $true) - $params.Add("StartupKeyPath", $StartupKeyPath) - } - - - #Now deal with the standard primary protectors - if ($PrimaryProtector -like "PasswordProtector") - { - $params.Add("PasswordProtector", $true) - $params.Add("Password", $Password.Password) - } - elseif ($PrimaryProtector -like "RecoveryPasswordProtector") - { - $params.Add("RecoveryPasswordProtector", $true) - } - elseif ($PrimaryProtector -like "StartupKeyProtector") - { - $params.Add("StartupKeyProtector", $true) - $params.Add("StartupKeyPath", $StartupKeyPath) - } - elseif ($PrimaryProtector -like "TpmProtector" -and $handledTpmAlready -eq $false) - { - $params.Add("TpmProtector", $true) - } - - #Run Enable-Bitlocker - Write-Verbose "Running Enable-Bitlocker" - - $newBlv = Enable-Bitlocker @params - - #Check if the Enable succeeded - if ($newBlv -ne $null) - { - if ($blv.VolumeType -eq "OperatingSystem") #Only initiate reboot if this is an OS drive - { - $global:DSCMachineStatus = 1 - - if ($AllowImmediateReboot -eq $true) - { - Write-Verbose "Forcing an immediate reboot of the computer in 30 seconds" - - Start-Sleep -Seconds 30 - Restart-Computer -Force - } - } - } - else - { - throw "Failed to successfully enable Bitlocker on MountPoint $($MountPoint)" - } - - #Finally, enable AutoUnlock if requested - if ($AutoUnlock -eq $true -and $blv.VolumeType -ne "OperatingSystem") - { - Enable-BitlockerAutoUnlock -MountPoint $MountPoint - } - } - } - else - { - throw "Unable to find Bitlocker Volume associated with Mount Point '$($MountPoint)'" - } -} - -#A common function used to test if Bitlocker is enabled on a disk with the appropriate settings -function TestBitlocker -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $MountPoint, - - [ValidateSet("PasswordProtector","RecoveryPasswordProtector","StartupKeyProtector","TpmProtector")] - [parameter(Mandatory = $true)] - [System.String] - $PrimaryProtector, - - [System.String] - $AdAccountOrGroup, - - [System.Boolean] - $AdAccountOrGroupProtector, - - [System.Boolean] - $AllowImmediateReboot = $false, - - [System.Boolean] - $AutoUnlock = $false, - - [ValidateSet("Aes128","Aes256")] - [System.String] - $EncryptionMethod, - - [System.Boolean] - $HardwareEncryption, - - [System.Management.Automation.PSCredential] - $Password, - - [System.Boolean] - $PasswordProtector, - - [System.Management.Automation.PSCredential] - $Pin, - - [System.String] - $RecoveryKeyPath, - - [System.Boolean] - $RecoveryKeyProtector, - - [System.Boolean] - $RecoveryPasswordProtector, - - [System.Boolean] - $Service, - - [System.Boolean] - $SkipHardwareTest, - - [System.String] - $StartupKeyPath, - - [System.Boolean] - $StartupKeyProtector, - - [System.Boolean] - $TpmProtector, - - [System.Boolean] - $UsedSpaceOnly, - - $VerbosePreference - ) - - $blv = Get-BitLockerVolume -MountPoint $MountPoint -ErrorAction SilentlyContinue - - if ($blv -eq $null) - { - Write-Verbose "Unable to locate MountPoint: $($MountPoint)" - return $false - } - elseif ($blv.KeyProtector -eq $null -or $blv.KeyProtector.Count -eq 0) - { - Write-Verbose "No key protectors on MountPoint: $($MountPoint)" - return $false - } - elseif ($AutoUnlock -eq $true -and $blv.AutoUnlockEnabled -ne $true) - { - Write-Verbose "AutoUnlock is not enabled for MountPoint: $($MountPoint)" - return $false - } - else - { - if ($PSBoundParameters.ContainsKey("AdAccountOrGroupProtector") -and !(ContainsKeyProtector -Type "AdAccountOrGroup" -KeyProtectorCollection $blv.KeyProtector)) - { - Write-Verbose "MountPoint '$($MountPoint) 'does not have AdAccountOrGroupProtector (AdAccountOrGroup)" - return $false - } - - if ($PSBoundParameters.ContainsKey("PasswordProtector") -and !(ContainsKeyProtector -Type "Password" -KeyProtectorCollection $blv.KeyProtector)) - { - Write-Verbose "MountPoint '$($MountPoint) 'does not have PasswordProtector (Password)" - return $false - } - - if ($PSBoundParameters.ContainsKey("Pin") -and !(ContainsKeyProtector -Type "TpmPin" -KeyProtectorCollection $blv.KeyProtector -StartsWith $true)) - { - Write-Verbose "MountPoint '$($MountPoint) 'does not have TpmPin assigned." - return $false - } - - if ($PSBoundParameters.ContainsKey("RecoveryKeyProtector") -and !(ContainsKeyProtector -Type "ExternalKey" -KeyProtectorCollection $blv.KeyProtector)) - { - Write-Verbose "MountPoint '$($MountPoint) 'does not have RecoveryKeyProtector (ExternalKey)" - return $false - } - - if ($PSBoundParameters.ContainsKey("RecoveryPasswordProtector") -and !(ContainsKeyProtector -Type "RecoveryPassword" -KeyProtectorCollection $blv.KeyProtector)) - { - Write-Verbose "MountPoint '$($MountPoint) 'does not have RecoveryPasswordProtector (RecoveryPassword)" - return $false - } - - if ($PSBoundParameters.ContainsKey("StartupKeyProtector")) - { - if ($PrimaryProtector -notlike "TpmProtector") - { - if (!(ContainsKeyProtector -Type "ExternalKey" -KeyProtectorCollection $blv.KeyProtector)) - { - Write-Verbose "MountPoint '$($MountPoint) 'does not have StartupKeyProtector (ExternalKey)" - return $false - } - } - else #TpmProtector is primary - { - if(!(ContainsKeyProtector -Type "Tpm" -KeyProtectorCollection $blv.KeyProtector -StartsWith $true) -and !(ContainsKeyProtector -Type "StartupKey" -KeyProtectorCollection $blv.KeyProtector -Contains $true)) - { - Write-Verbose "MountPoint '$($MountPoint) 'does not have TPM + StartupKey protector." - return $false - } - } - } - - if ($PSBoundParameters.ContainsKey("TpmProtector") -and !(ContainsKeyProtector -Type "Tpm" -KeyProtectorCollection $blv.KeyProtector -StartsWith $true)) - { - Write-Verbose "MountPoint '$($MountPoint) 'does not have TpmProtector" - return $false - } - } - - return $true -} - -#Ensures that required Bitlocker prereqs are installed -function CheckForPreReqs -{ - $hasAllPreReqs = $true - - $blFeature = Get-WindowsFeature BitLocker - $blAdminToolsFeature = Get-WindowsFeature RSAT-Feature-Tools-BitLocker - $blAdminToolsRemoteFeature = Get-WindowsFeature RSAT-Feature-Tools-BitLocker-RemoteAdminTool - - if ($blFeature.InstallState -ne "Installed") - { - $hasAllPreReqs = $false - - Write-Error "The Bitlocker feature needs to be installed before the xBitlocker module can be used" - } - - if ($blAdminToolsFeature.InstallState -ne "Installed") - { - $hasAllPreReqs = $false - - Write-Error "The RSAT-Feature-Tools-BitLocker feature needs to be installed before the xBitlocker module can be used" - } - - if ($blAdminToolsRemoteFeature.InstallState -ne "Installed") - { - $hasAllPreReqs = $false - - Write-Error "The RSAT-Feature-Tools-BitLocker-RemoteAdminTool feature needs to be installed before the xBitlocker module can be used" - } - - if ($hasAllPreReqs -eq $false) - { - throw "Required Bitlocker features need to be installed before xBitlocker can be used" - } -} - -#Checks whether the KeyProtectorCollection returned from Get-BitlockerVolume contains the specified key protector type -function ContainsKeyProtector -{ - param([string]$Type, $KeyProtectorCollection, [bool]$StartsWith = $false, [bool]$EndsWith = $false, [bool]$Contains = $false) - - if ($KeyProtectorCollection -ne $null) - { - foreach ($keyProtector in $KeyProtectorCollection) - { - if ($keyProtector.KeyProtectorType -eq $Type) - { - return $true - } - elseif ($StartsWith -eq $true -and $keyProtector.KeyProtectorType.ToString().StartsWith($Type)) - { - return $true - } - elseif ($EndsWith -eq $true -and $keyProtector.KeyProtectorType.ToString().EndsWith($Type)) - { - return $true - } - elseif ($Contains -eq $true -and $keyProtector.KeyProtectorType.ToString().Contains($Type)) - { - return $true - } - } - } - - return $false -} - -#Takes $PSBoundParameters from another function and adds in the keys and values from the given Hashtable -function AddParameters -{ - param($PSBoundParametersIn, [Hashtable]$ParamsToAdd) - - foreach ($key in $ParamsToAdd.Keys) - { - if (!($PSBoundParametersIn.ContainsKey($key))) #Key doesn't exist, so add it with value - { - $PSBoundParametersIn.Add($key, $ParamsToAdd[$key]) | Out-Null - } - else #Key already exists, so just replace the value - { - $PSBoundParametersIn[$key] = $ParamsToAdd[$key] - } - } -} - -#Takes $PSBoundParameters from another function. If ParamsToRemove is specified, it will remove each param. -#If ParamsToKeep is specified, everything but those params will be removed. If both ParamsToRemove and ParamsToKeep -#are specified, only ParamsToKeep will be used. -function RemoveParameters -{ - param($PSBoundParametersIn, [string[]]$ParamsToKeep, [string[]]$ParamsToRemove) - - if ($ParamsToKeep -ne $null -and $ParamsToKeep.Count -gt 0) - { - [string[]]$ParamsToRemove = @() - - $lowerParamsToKeep = StringArrayToLower -Array $ParamsToKeep - - foreach ($key in $PSBoundParametersIn.Keys) - { - if (!($lowerParamsToKeep.Contains($key.ToLower()))) - { - $ParamsToRemove += $key - } - } - } - - if ($ParamsToRemove -ne $null -and $ParamsToRemove.Count -gt 0) - { - foreach ($param in $ParamsToRemove) - { - $PSBoundParametersIn.Remove($param) | Out-Null - } - } -} - -Export-ModuleMember -Function * diff --git a/lib/puppet_x/dsc_resources/xBitlocker/xBitlocker.psd1 b/lib/puppet_x/dsc_resources/xBitlocker/xBitlocker.psd1 deleted file mode 100644 index 50e5cbcb..00000000 --- a/lib/puppet_x/dsc_resources/xBitlocker/xBitlocker.psd1 +++ /dev/null @@ -1,118 +0,0 @@ -# -# Module manifest for module 'xBitlocker' -# -# Generated by: Mike Hendrickson -# -# Generated on: 8/29/2014 -# - -@{ - -# Script module or binary module file associated with this manifest. -# RootModule = '' - -# Version number of this module. -ModuleVersion = '1.1.0.0' - -# ID used to uniquely identify this module -GUID = 'dc4f3fd0-4e1d-4916-84f8-d0bb89d52507' - -# Author of this module -Author = 'Mike Hendrickson' - -# Company or vendor of this module -CompanyName = 'Microsoft' - -# Copyright statement for this module -Copyright = '(c) 2014 administrator. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'This DSC Module allows you to configure Bitlocker on a single disk, configure a TPM chip, or automatically enable Bitlocker on multiple disks.' - -# Minimum version of the Windows PowerShell engine required by this module -# PowerShellVersion = '' - -# Name of the Windows PowerShell host required by this module -# PowerShellHostName = '' - -# Minimum version of the Windows PowerShell host required by this module -# PowerShellHostVersion = '' - -# Minimum version of Microsoft .NET Framework required by this module -# DotNetFrameworkVersion = '' - -# Minimum version of the common language runtime (CLR) required by this module -# CLRVersion = '' - -# Processor architecture (None, X86, Amd64) required by this module -# ProcessorArchitecture = '' - -# Modules that must be imported into the global environment prior to importing this module -# RequiredModules = @() - -# Assemblies that must be loaded prior to importing this module -# RequiredAssemblies = @() - -# Script files (.ps1) that are run in the caller's environment prior to importing this module. -# ScriptsToProcess = @() - -# Type files (.ps1xml) to be loaded when importing this module -# TypesToProcess = @() - -# Format files (.ps1xml) to be loaded when importing this module -# FormatsToProcess = @() - -# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess -# NestedModules = @() - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Variables to export from this module -VariablesToExport = '*' - -# Aliases to export from this module -AliasesToExport = '*' - -# List of all modules packaged with this module -# ModuleList = @() - -# List of all files packaged with this module -# FileList = @() - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/xBitlocker/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/xBitlocker' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - # ReleaseNotes = '' - - } # End of PSData hashtable - -} # End of PrivateData hashtable - -# HelpInfo URI of this module -# HelpInfoURI = '' - -# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. -# DefaultCommandPrefix = '' - -} - - diff --git a/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertReq/MSFT_xCertReq.psm1 b/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertReq/MSFT_xCertReq.psm1 deleted file mode 100644 index 9b58fdee..00000000 --- a/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertReq/MSFT_xCertReq.psm1 +++ /dev/null @@ -1,941 +0,0 @@ -#Requires -Version 4.0 - -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Certificate Common Modules -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'CertificateDsc.Common' ` - -ChildPath 'CertificateDsc.Common.psm1')) - -# Import the Certificate Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'CertificateDsc.ResourceHelper' ` - -ChildPath 'CertificateDsc.ResourceHelper.psm1')) - -# Import the Certificate PDT Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'CertificateDsc.PDT' ` - -ChildPath 'CertificateDsc.PDT.psm1')) - -# Import Localization Strings -$localizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xCertReq' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# - .SYNOPSIS - Returns the current state of the certificate that may need to be requested. - - .PARAMETER Subject - Provide the text string to use as the subject of the certificate. - - .PARAMETER CAServerFQDN - The FQDN of the Active Directory Certificate Authority on the local area network. - - .PARAMETER CARootName - The name of the certificate authority, by default this will be in format domain-servername-ca. - - .PARAMETER KeyLength - The bit length of the encryption key to be used. - - .PARAMETER Exportable - The option to allow the certificate to be exportable, by default it will be true. - - .PARAMETER ProviderName - The selection of provider for the type of encryption to be used. - - .PARAMETER OID - The Object Identifier that is used to name the object. - - .PARAMETER KeyUsage - The Keyusage is a restriction method that determines what a certificate can be used for. - - .PARAMETER CertificateTemplate - The template used for the definiton of the certificate. - - .PARAMETER SubjectAltName - The subject alternative name used to createthe certificate. - - .PARAMETER Credential - The credentials that will be used to access the template in the Certificate Authority. - - .PARAMETER AutoRenew - Determines if the resource will also renew a certificate within 7 days of expiration. - - .PARAMETER CAType - The type of CA in use, Standalone/Enterprise. - - .PARAMETER CepURL - The URL to the Certification Enrollment Policy Service. - - .PARAMETER CesURL - The URL to the Certification Enrollment Service. - - .PARAMETER UseMachineContext - Determines if the machine should be impersonated for a request. Used for templates like Domain Controller Authentication - - .PARAMETER FriendlyName - Specifies a friendly name for the certificate. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Subject, - - [Parameter()] - [System.String] - $CAServerFQDN, - - [Parameter()] - [System.String] - $CARootName, - - [Parameter()] - [ValidateSet("1024", "2048", "4096", "8192")] - [System.String] - $KeyLength = '2048', - - [Parameter()] - [System.Boolean] - $Exportable = $true, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $ProviderName = '"Microsoft RSA SChannel Cryptographic Provider"', - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $OID = '1.3.6.1.5.5.7.3.1', - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $KeyUsage = '0xa0', - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $CertificateTemplate = 'WebServer', - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $SubjectAltName, - - [Parameter()] - [System.Management.Automation.PSCredential] - $Credential, - - [Parameter()] - [System.Boolean] - $AutoRenew, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $CAType = 'Enterprise', - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $CepURL, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $CesURL, - - [Parameter()] - [System.Boolean] - $UseMachineContext, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $FriendlyName - ) - - # The certificate authority, accessible on the local area network - if ([string]::IsNullOrWhiteSpace($CAServerFQDN) -or [string]::IsNullOrWhiteSpace($CARootName)) - { - $caObject = Find-CertificateAuthority - $CARootName = $caObject.CARootName - $CAServerFQDN = $caObject.CAServerFQDN - } - - $ca = "$CAServerFQDN\$CARootName" - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.GettingCertReqStatusMessage -f $Subject, $CA) - ) -join '' ) - - $cert = Get-Childitem -Path Cert:\LocalMachine\My | - Where-Object -FilterScript { - $_.Subject -eq "CN=$Subject" -and ` - $_.Issuer.split(',')[0] -eq "CN=$CARootName" - } - - # If multiple certs have the same subject and were issued by the CA, return the newest - $cert = $cert | - Sort-Object -Property NotBefore -Descending | - Select-Object -First 1 - - if ($cert) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.CertificateExistsMessage -f $Subject, $ca, $cert.Thumbprint) - ) -join '' ) - - $returnValue = @{ - Subject = $Cert.Subject.split(',')[0].replace('CN=', '') - CAServerFQDN = $caObject.CAServerFQDN - CARootName = $Cert.Issuer.split(',')[0].replace('CN=', '') - KeyLength = $Cert.Publickey.Key.KeySize - Exportable = $Cert.PrivateKey.CspKeyContainerInfo.Exportable - ProviderName = $Cert.PrivateKey.CspKeyContainerInfo.ProviderName - OID = $null # This value can't be determined from the cert - KeyUsage = $null # This value can't be determined from the cert - CertificateTemplate = Get-CertificateTemplateName -Certificate $Cert - SubjectAltName = Get-CertificateSan -Certificate $Cert - FriendlyName = $Cert.FriendlyName - } - } - else - { - $returnValue = @{} - } - - $returnValue -} # end function Get-TargetResource - -<# - .SYNOPSIS - Requests a new certificate based on the parameters provided. - - .PARAMETER Subject - Provide the text string to use as the subject of the certificate. - - .PARAMETER CAServerFQDN - The FQDN of the Active Directory Certificate Authority on the local area network. - - .PARAMETER CARootName - The name of the certificate authority, by default this will be in format domain-servername-ca. - - .PARAMETER KeyLength - The bit length of the encryption key to be used. - - .PARAMETER Exportable - The option to allow the certificate to be exportable, by default it will be true. - - .PARAMETER ProviderName - The selection of provider for the type of encryption to be used. - - .PARAMETER OID - The Object Identifier that is used to name the object. - - .PARAMETER KeyUsage - The Keyusage is a restriction method that determines what a certificate can be used for. - - .PARAMETER CertificateTemplate - The template used for the definiton of the certificate. - - .PARAMETER SubjectAltName - The subject alternative name used to createthe certificate. - - .PARAMETER Credential - The credentials that will be used to access the template in the Certificate Authority. - - .PARAMETER AutoRenew - Determines if the resource will also renew a certificate within 7 days of expiration. - - .PARAMETER CAType - The type of CA in use, Standalone/Enterprise. - - .PARAMETER CepURL - The URL to the Certification Enrollment Policy Service. - - .PARAMETER CesURL - The URL to the Certification Enrollment Service. - - .PARAMETER UseMachineContext - Determines if the machine should be impersonated for a request. Used for templates like Domain Controller Authentication - - .PARAMETER FriendlyName - Specifies a friendly name for the certificate. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Subject, - - [Parameter()] - [System.String] - $CAServerFQDN, - - [Parameter()] - [System.String] - $CARootName, - - [Parameter()] - [ValidateSet("1024", "2048", "4096", "8192")] - [System.String] - $KeyLength = '2048', - - [Parameter()] - [System.Boolean] - $Exportable = $true, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $ProviderName = '"Microsoft RSA SChannel Cryptographic Provider"', - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $OID = '1.3.6.1.5.5.7.3.1', - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $KeyUsage = '0xa0', - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $CertificateTemplate = 'WebServer', - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $SubjectAltName, - - [Parameter()] - [System.Management.Automation.PSCredential] - $Credential, - - [Parameter()] - [System.Boolean] - $AutoRenew, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $CAType = 'Enterprise', - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $CepURL, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $CesURL, - - [Parameter()] - [System.Boolean] - $UseMachineContext, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $FriendlyName - ) - - # The certificate authority, accessible on the local area network - if ([string]::IsNullOrWhiteSpace($CAServerFQDN) -or [string]::IsNullOrWhiteSpace($CARootName)) - { - $caObject = Find-CertificateAuthority - $CARootName = $caObject.CARootName - $CAServerFQDN = $caObject.CAServerFQDN - } - - $ca = "$CAServerFQDN\$CARootName" - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.StartingCertReqMessage -f $Subject, $ca) - ) -join '' ) - - # If the Subject does not contain a full X500 path, construct just the CN - if (($Subject.split('=').Count) -eq 1) - { - $Subject = "CN=$Subject" - } # if - - # If we should look for renewals, check for existing certs - if ($AutoRenew) - { - $certs = Get-Childitem -Path Cert:\LocalMachine\My | - Where-Object -FilterScript { - $_.Subject -eq $Subject -and ` - $_.Issuer.split(',')[0] -eq "CN=$CARootName" -and ` - $_.NotAfter -lt (Get-Date).AddDays(30) - } - - # If multiple certs have the same subject and were issued by the CA and are 30 days from expiration, return the newest - $firstCert = $certs | - Sort-Object -Property NotBefore -Descending | - Select-Object -First 1 - $thumbprint = $firstCert | - ForEach-Object -Process { $_.Thumbprint } - } # if - - <# - Information that will be used in the INF file to generate the certificate request - In future versions, select variables from the list below could be moved to parameters! - #> - $Subject = "`"$Subject`"" - $keySpec = '1' - $machineKeySet = 'TRUE' - $smime = 'FALSE' - $privateKeyArchive = 'FALSE' - $userProtected = 'FALSE' - $useExistingKeySet = 'FALSE' - $providerType = '12' - $requestType = 'CMC' - - # A unique identifier for temporary files that will be used when interacting with the command line utility - $guid = [system.guid]::NewGuid().guid - $workingPath = Join-Path -Path $env:Temp -ChildPath "xCertReq-$guid" - $infPath = [System.IO.Path]::ChangeExtension($workingPath, '.inf') - $reqPath = [System.IO.Path]::ChangeExtension($workingPath, '.req') - $cerPath = [System.IO.Path]::ChangeExtension($workingPath, '.cer') - $rspPath = [System.IO.Path]::ChangeExtension($workingPath, '.rsp') - - # Create INF file - $requestDetails = @" -[NewRequest] -Subject = $Subject -KeySpec = $keySpec -KeyLength = $KeyLength -Exportable = $($Exportable.ToString().ToUpper()) -MachineKeySet = $MachineKeySet -SMIME = $smime -PrivateKeyArchive = $privateKeyArchive -UserProtected = $userProtected -UseExistingKeySet = $useExistingKeySet -ProviderName = $ProviderName -ProviderType = $providerType -RequestType = $requestType -KeyUsage = $KeyUsage -"@ - if ($FriendlyName) - { - $requestDetails += @" - -FriendlyName = "$FriendlyName" -"@ - } - $requestDetails += @" - -[RequestAttributes] -CertificateTemplate = $CertificateTemplate -[EnhancedKeyUsageExtension] -OID = $OID -"@ - # If a standalone CA is used certificate templates are not used. - if ($CAType -ne 'Enterprise') - { - $requestDetails = $requestDetails.Replace(@" -[RequestAttributes] -CertificateTemplate = $CertificateTemplate -[EnhancedKeyUsageExtension] -"@, '[EnhancedKeyUsageExtension]') - } - - if ($PSBoundParameters.ContainsKey('SubjectAltName')) - { - # If a Subject Alt Name was specified, add it. - $requestDetails += @" - -[Extensions] -2.5.29.17 = `"{text}$SubjectAltName`" -"@ - } - if ($thumbprint) - { - $requestDetails += @" - -RenewalCert = $Thumbprint -"@ - } - Set-Content -Path $infPath -Value $requestDetails - - <# - Certreq.exe is used to handle the request of the new certificate - because of the lack of native PowerShell Certificate cmdlets. - Syntax: https://technet.microsoft.com/en-us/library/cc736326.aspx - Reference: https://support2.microsoft.com/default.aspx?scid=kb;EN-US;321051 - #> - - # NEW: Create a new request as directed by PolicyFileIn - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.CreateRequestCertificateMessage -f $infPath, $reqPath) - ) -join '' ) - - <# - If enrollment server is specified the request will be towards - the specified URLs instead, using credentials for authentication. - #> - if ($Credential -and $CepURL -and $CesURL) - { - $credPW = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($Credential.Password) - $createRequest = & certreq.exe @( - '-new', '-q', - '-username', $Credential.UserName, - '-p', [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($credPW), - '-PolicyServer', $CepURL, - '-config', $CesURL, - $infPath, - $reqPath - ) - } - else - { - $createRequest = & certreq.exe @('-new', '-q', $infPath, $reqPath) - } # if - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.CreateRequestResultCertificateMessage -f ($createRequest | Out-String)) - ) -join '' ) - - <# - SUBMIT: Submit a request to a Certification Authority. - DSC runs in the context of LocalSystem, which uses the Computer account in Active Directory - to authenticate to network resources - The Credential paramter with PDT is used to impersonate a user making the request - #> - if (Test-Path -Path $reqPath) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.SubmittingRequestCertificateMessage -f $reqPath, $cerPath, $ca) - ) -join '' ) - - if ($Credential) - { - <# - If enrollment server is specified the request will be towards - the specified URLs instead, using credentials for authentication. - #> - if ($CepURL -and $CesURL) - { - $credPW = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($Credential.Password) - $submitRequest = & certreq.exe @( - '-submit', '-q', - '-username', $Credential.UserName, - '-p', [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($credPW), - '-PolicyServer', $CepURL, - '-config', $CesURL, - $ReqPath, - $CerPath - ) - } - else - { - <# - Assemble the command and arguments to pass to the powershell process that - will request the certificate - #> - $certReqOutPath = [System.IO.Path]::ChangeExtension($workingPath, '.out') - $command = "$PSHOME\PowerShell.exe" - - if ($UseMachineContext) - { - $arguments = "-Command ""& $env:SystemRoot\system32\certreq.exe" + ` - " @('-submit','-q','-adminforcemachine','-config','$ca','$reqPath','$cerPath')" + ` - " | Set-Content -Path '$certReqOutPath'""" - } - else - { - $arguments = "-Command ""& $env:SystemRoot\system32\certreq.exe" + ` - " @('-submit','-q','-config','$ca','$reqPath','$cerPath')" + ` - " | Set-Content -Path '$certReqOutPath'""" - } - - <# - This may output a win32-process object, but it often does not because of - a timing issue in PDT (the process has often completed before the - process can be read in). - #> - $null = Start-Win32Process ` - -Path $command ` - -Arguments $arguments ` - -Credential $Credential - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.SubmittingRequestProcessCertificateMessage) - ) -join '' ) - - $null = Wait-Win32ProcessStop ` - -Path $command ` - -Arguments $arguments ` - -Credential $Credential - - if (Test-Path -Path $certReqOutPath) - { - $submitRequest = Get-Content -Path $certReqOutPath - Remove-Item -Path $certReqOutPath -Force - } - else - { - New-InvalidOperationException ` - -Message ($LocalizedData.CertReqOutNotFoundError -f $certReqOutPath) - } # if - } # if - } - else - { - $submitRequest = & certreq.exe @('-submit', '-q', '-config', $CA, $ReqPath, $CerPath) - } # if - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.SubmittingRequestResultCertificateMessage -f ($submitRequest | Out-String)) - ) -join '' ) - } - else - { - New-InvalidOperationException ` - -Message ($LocalizedData.CertificateReqNotFoundError -f $reqPath) - } # if - - # ACCEPT: Accept the request - if (Test-Path -Path $cerPath) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.AcceptingRequestCertificateMessage -f $cerPath, $ca) - ) -join '' ) - - $acceptRequest = & certreq.exe @('-accept', '-machine', '-q', $cerPath) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.AcceptingRequestResultCertificateMessage -f ($acceptRequest | Out-String)) - ) -join '' ) - } - else - { - New-InvalidOperationException ` - -Message ($LocalizedData.CertificateCerNotFoundError -f $cerPath) - } # if - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.CleaningUpRequestFilesMessage -f "$($workingPath).*") - ) -join '' ) - Remove-Item -Path "$($workingPath).*" -Force -} # end function Set-TargetResource - -<# - .SYNOPSIS - Tests if a new certificate should be requested. - - .PARAMETER Subject - Provide the text string to use as the subject of the certificate. - - .PARAMETER CAServerFQDN - The FQDN of the Active Directory Certificate Authority on the local area network. - - .PARAMETER CARootName - The name of the certificate authority, by default this will be in format domain-servername-ca. - - .PARAMETER KeyLength - The bit length of the encryption key to be used. - - .PARAMETER Exportable - The option to allow the certificate to be exportable, by default it will be true. - - .PARAMETER ProviderName - The selection of provider for the type of encryption to be used. - - .PARAMETER OID - The Object Identifier that is used to name the object. - - .PARAMETER KeyUsage - The Keyusage is a restriction method that determines what a certificate can be used for. - - .PARAMETER CertificateTemplate - The template used for the definiton of the certificate. - - .PARAMETER SubjectAltName - The subject alternative name used to createthe certificate. - - .PARAMETER Credential - The credentials that will be used to access the template in the Certificate Authority. - - .PARAMETER AutoRenew - Determines if the resource will also renew a certificate within 7 days of expiration. - - .PARAMETER CAType - The type of CA in use, Standalone/Enterprise. - - .PARAMETER CepURL - The URL to the Certification Enrollment Policy Service. - - .PARAMETER CesURL - The URL to the Certification Enrollment Service. - - .PARAMETER UseMachineContext - Determines if the machine should be impersonated for a request. Used for templates like Domain Controller Authentication - - .PARAMETER FriendlyName - Specifies a friendly name for the certificate. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Subject, - - [Parameter()] - [System.String] - $CAServerFQDN, - - [Parameter()] - [System.String] - $CARootName, - - [Parameter()] - [ValidateSet("1024", "2048", "4096", "8192")] - [System.String] - $KeyLength = '2048', - - [Parameter()] - [System.Boolean] - $Exportable = $true, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $ProviderName = '"Microsoft RSA SChannel Cryptographic Provider"', - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $OID = '1.3.6.1.5.5.7.3.1', - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $KeyUsage = '0xa0', - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $CertificateTemplate = 'WebServer', - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $SubjectAltName, - - [Parameter()] - [System.Management.Automation.PSCredential] - $Credential, - - [Parameter()] - [System.Boolean] - $AutoRenew, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $CAType = 'Enterprise', - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $CepURL, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $CesURL, - - [Parameter()] - [System.Boolean] - $UseMachineContext, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $FriendlyName - ) - - # The certificate authority, accessible on the local area network - if ([string]::IsNullOrWhiteSpace($CAServerFQDN) -or [string]::IsNullOrWhiteSpace($CARootName)) - { - $caObject = Find-CertificateAuthority - $CARootName = $caObject.CARootName - $CAServerFQDN = $caObject.CAServerFQDN - } - - $ca = "$CAServerFQDN\$CARootName" - - # If the Subject does not contain a full X500 path, construct just the CN - if (($Subject.split('=').count) -eq 1) - { - $Subject = "CN=$Subject" - } - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.TestingCertReqStatusMessage -f $Subject, $ca) - ) -join '' ) - - # Exception for standard template DomainControllerAuthentication - $cert = Get-Childitem -Path Cert:\LocalMachine\My | - Where-Object -FilterScript { - $_.Subject -eq $Subject -and ` - $_.Issuer.split(',')[0] -eq "CN=$CARootName" - } - - if ($CertificateTemplate -eq 'DomainControllerAuthentication') - { - $cert = Get-Childitem -Path Cert:\LocalMachine\My | - Where-Object -FilterScript { - (Get-CertificateTemplateName -Certificate $PSItem) -eq $CertificateTemplate -and ` - $_.Issuer.split(',')[0] -eq "CN=$CARootName" - } - } - - # If multiple certs have the same subject and were issued by the CA, return the newest - $cert = $cert | - Sort-Object -Property NotBefore -Descending | - Select-Object -First 1 - - if ($cert) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.CertificateExistsMessage -f $Subject, $ca, $cert.Thumbprint) - ) -join '' ) - - if ($AutoRenew) - { - if ($Cert.NotAfter -le (Get-Date).AddDays(-30)) - { - # The certificate was found but it is expiring within 30 days or has expired - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ExpiringCertificateMessage -f $Subject, $ca, $cert.Thumbprint) - ) -join '' ) - return $false - } # if - } - else - { - if ($cert.NotAfter -le (Get-Date)) - { - # The certificate has expired - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ExpiredCertificateMessage -f $Subject, $ca, $cert.Thumbprint) - ) -join '' ) - return $false - } # if - } # if - - if ($PSBoundParameters.ContainsKey('SubjectAltName')) - { - # Split the desired SANs into an array - $sanList = $SubjectAltName.Split('&') - $correctDNS = @() - - foreach ($san in $sanList) - { - if ($san -like 'dns*') - { - # This SAN is a DNS name - $correctDNS += $san.split('=')[1] - } - } - - # Find out what SANs are on the current cert - if ($cert.Extensions.Count -gt 0) - { - $currentSanList = ($cert.Extensions | Where-Object {$_.oid.FriendlyName -match 'Subject Alternative Name'}).Format(1).split("`n").TrimEnd() - $currentDNS = @() - foreach ($san in $currentSanList) - { - if ($san -like 'dns*') - { - # This SAN is a DNS name - $currentDNS += $san.split('=')[1] - } - } - - # Do the cert's DNS SANs and the desired DNS SANs match? - if (@(Compare-Object -ReferenceObject $currentDNS -DifferenceObject $correctDNS).Count -gt 0) - { - return $false - } - } - else - { - # There are no SANs and there should be - return $false - } - } - - if ($CertificateTemplate -ne (Get-CertificateTemplateName -Certificate $cert)) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.CertTemplateMismatch -f $Subject, $ca, $cert.Thumbprint, (Get-CertificateTemplateName -Certificate $cert)) - ) -join '' ) - return $false - } # if - - # Check the friendly name of the certificate matches - if ($FriendlyName -ne $cert.FriendlyName) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.CertFriendlyNameMismatch -f $Subject, $ca, $cert.Thumbprint, $cert.FriendlyName) - ) -join '' ) - return $false - } # if - - # The certificate was found and is OK - so no change required. - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ValidCertificateExistsMessage -f $Subject, $ca, $cert.Thumbprint) - ) -join '' ) - return $true - } # if - - # A valid certificate was not found - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NoValidCertificateMessage -f $Subject, $ca) - ) -join '' ) - return $false -} # end function Test-TargetResource diff --git a/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertReq/MSFT_xCertReq.schema.mof b/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertReq/MSFT_xCertReq.schema.mof deleted file mode 100644 index 133a57f1..00000000 --- a/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertReq/MSFT_xCertReq.schema.mof +++ /dev/null @@ -1,21 +0,0 @@ -[ClassVersion("0.1.0.0"), FriendlyName("xCertReq")] -class MSFT_xCertReq : OMI_BaseResource -{ - [Key, Description("Provide the text string to use as the subject of the certificate.")] String Subject; - [Write, Description("The type of CA in use, Standalone/Enterprise.")] String CAType; - [Write, Description("The FQDN of the Active Directory Certificate Authority on the local area network. Leave empty to automatically locate.")] String CAServerFQDN; - [Write, Description("The name of the certificate authority, by default this will be in format domain-servername-ca. Leave empty to automatically locate.")] String CARootName; - [Write, Description("The bit length of the encryption key to be used. Defaults to 2048."), ValueMap{"1024","2048","4096","8192"}, Values{"1024","2048","4096","8192"}] String KeyLength; - [Write, Description("The option to allow the certificate to be exportable, by default it will be true.")] Boolean Exportable; - [Write, Description("The selection of provider for the type of encryption to be used.")] String ProviderName; - [Write, Description("The Object Identifier that is used to name the object.")] String OID; - [Write, Description("The Keyusage is a restriction method that determines what a certificate can be used for.")] String KeyUsage; - [Write, Description("The template used for the definition of the certificate.")] String CertificateTemplate; - [Write, Description("The subject alternative name used to create the certificate.")] String SubjectAltName; - [Write, Description("The credentials that will be used to access the template in the Certificate Authority."), EmbeddedInstance("MSFT_Credential")] String Credential; - [Write, Description("Determines if the resource will also renew a certificate within 7 days of expiration.")] Boolean AutoRenew; - [Write, Description("The URL to the Certification Enrollment Policy Service.")] String CepURL; - [Write, Description("The URL to the Certification Enrollment Service.")] String CesURL; - [Write, Description("Indicates whether or not the flag -adminforcemachine will be used when requesting certificates. Necessary for certain templates like e.g. DomainControllerAuthentication")] Boolean UseMachineContext; - [Write, Description("Specifies a friendly name for the certificate.")] String FriendlyName; -}; diff --git a/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertReq/en-us/MSFT_xCertReq.strings.psd1 b/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertReq/en-us/MSFT_xCertReq.strings.psd1 deleted file mode 100644 index 89dbe23c..00000000 --- a/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertReq/en-us/MSFT_xCertReq.strings.psd1 +++ /dev/null @@ -1,24 +0,0 @@ -ConvertFrom-StringData @' - GettingCertReqStatusMessage = Getting Certificate with Subject '{0}' issued by {1}. - CertificateExistsMessage = Certificate with Subject '{0}' issued by {1} found with thumbprint '{2}'. - StartingCertReqMessage = Starting Certificate request with Subject '{0}' issued by {1}. - CreateRequestCertificateMessage = Creating certificate request '{1}' from '{0}'. - CreateRequestResultCertificateMessage = Create certificate request result: {0} - SubmittingRequestCertificateMessage = Submitting certificate request '{0}' returning '{1}' issued by {2}. - SubmittingRequestProcessCertificateMessage = Submitting certificate request using separate process. - SubmittingRequestResultCertificateMessage = Submitting certificate request result: {0} - AcceptingRequestCertificateMessage = Accepting certificate '{1}' issued by {0}. - AcceptingRequestResultCertificateMessage = Accepting certificate result: {0} - CleaningUpRequestFilesMessage = Cleaning up certificate request files '{0}'. - TestingCertReqStatusMessage = Testing Certificate with Subject '{0}' issued by {1}. - ExpiringCertificateMessage = The certificate found with subject '{0}' issued by {1} with thumbprint '{2}' is about to expire. - NoValidCertificateMessage = No valid certificate found with subject '{0}' issued by {1}. - ExpiredCertificateMessage = The certificate found with subject '{0}' issued by {1} with thumbprint '{2}' has expired. - InvalidCertificateMessage = The certificate found with subject '{0}' issued by {1} with thumbprint '{2}' is inavlid. - ValidCertificateExistsMessage = Valid certificate '{2}' found with subject '{0}' issued by {1}. - CertificateReqNotFoundError = Certificate Request file '{0}' not found. - CertificateCerNotFoundError = Certificate file '{0}' not found. - CertReqOutNotFoundError = CertReq.exe output file '{0}' not found. - CertTemplateMismatch = The certificate with subject '{0}' issued by '{1}' with thumbprint {2} has the wrong template {3}. - CertFriendlyNameMismatch = The certificate with subject '{0}' issued by '{1}' with thumbprint {2} has the wrong friendly name '{3}'. -'@ diff --git a/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertificateExport/MSFT_xCertificateExport.psm1 b/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertificateExport/MSFT_xCertificateExport.psm1 deleted file mode 100644 index 1b1d9f68..00000000 --- a/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertificateExport/MSFT_xCertificateExport.psm1 +++ /dev/null @@ -1,487 +0,0 @@ -#Requires -Version 4.0 - -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Certificate Common Modules -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'CertificateDsc.Common' ` - -ChildPath 'CertificateDsc.Common.psm1')) - -# Import the Certificate Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'CertificateDsc.ResourceHelper' ` - -ChildPath 'CertificateDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$localizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xCertificateExport' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# - .SYNOPSIS - Returns the current state of the exported certificate. - - .PARAMETER Path - The path to the file you that will contain the exported certificate. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Path - ) - - Write-Verbose -Message ( - @( - "$($MyInvocation.MyCommand): ", - $($LocalizedData.GettingCertificateExportMessage -f $Path) - ) -join '' ) - - $result = @{ - Path = $Path - IsExported = (Test-Path -Path $Path) - } - - return $result -} # end function Get-TargetResource - -<# - .SYNOPSIS - Exports the certificate. - - .PARAMETER Path - The path to the file you that will contain the exported certificate. - - .PARAMETER Thumbprint - The thumbprint of the certificate to export. - Certificate selector parameter. - - .PARAMETER FriendlyName - The friendly name of the certificate to export. - Certificate selector parameter. - - .PARAMETER Subject - The subject of the certificate to export. - Certificate selector parameter. - - .PARAMETER DNSName - The subject alternative name of the certificate to export must contain these values. - Certificate selector parameter. - - .PARAMETER Issuer - The issuer of the certificate to export. - Certificate selector parameter. - - .PARAMETER KeyUsage - The key usage of the certificate to export must contain these values. - Certificate selector parameter. - - .PARAMETER EnhancedKeyUsage - The enhanced key usage of the certificate to export must contain these values. - Certificate selector parameter. - - .PARAMETER Store - The Windows Certificate Store Name to search for the certificate to export from. - Certificate selector parameter. - Defaults to 'My'. - - .PARAMETER AllowExpired - Allow an expired certificate to be exported. - Certificate selector parameter. - - .PARAMETER MatchSource - Causes an existing exported certificate to be compared with the certificate identified for - export and re-exported if it does not match. - - .PARAMETER Type - Specifies the type of certificate to export. - Defaults to 'Cert'. - - .PARAMETER ChainOption - Specifies the options for building a chain when exporting a PFX certificate. - Defaults to 'BuildChain'. - - .PARAMETER Password - Specifies the password used to protect an exported PFX file. - - .PARAMETER ProtectTo - Specifies an array of strings for the username or group name that can access the private - key of an exported PFX file without any password. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Path, - - [Parameter()] - [System.String] - $Thumbprint, - - [Parameter()] - [System.String] - $FriendlyName, - - [Parameter()] - [System.String] - $Subject, - - [Parameter()] - [System.String[]] - $DNSName, - - [Parameter()] - [System.String] - $Issuer, - - [Parameter()] - [System.String[]] - $KeyUsage, - - [Parameter()] - [System.String[]] - $EnhancedKeyUsage, - - [Parameter()] - [System.String] - $Store = 'My', - - [Parameter()] - [System.Boolean] - $AllowExpired, - - [Parameter()] - [System.Boolean] - $MatchSource, - - [Parameter()] - [ValidateSet("Cert", "P7B", "SST", "PFX")] - [System.String] - $Type = 'Cert', - - [Parameter()] - [ValidateSet("BuildChain", "EndEntityCertOnly")] - [System.String] - $ChainOption = 'BuildChain', - - [Parameter()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Password, - - [Parameter()] - [System.String[]] - $ProtectTo - ) - - Write-Verbose -Message ( - @( - "$($MyInvocation.MyCommand): ", - $($LocalizedData.SettingCertificateExportMessage -f $Path) - ) -join '' ) - - $findCertificateParameters = @{} + $PSBoundParameters - $null = $findCertificateParameters.Remove('Path') - $null = $findCertificateParameters.Remove('MatchSource') - $null = $findCertificateParameters.Remove('Type') - $null = $findCertificateParameters.Remove('ChainOption') - $null = $findCertificateParameters.Remove('Password') - $null = $findCertificateParameters.Remove('ProtectTo') - $foundCertificates = @(Find-Certificate @findCertificateParameters) - - if ($foundCertificates.Count -eq 0) - { - # A certificate matching the specified certificate selector parameters could not be found - Write-Verbose -Message ( - @( - "$($MyInvocation.MyCommand): ", - $($LocalizedData.CertificateToExportNotFound -f $Path, $Type, $Store) - ) -join '' ) - } - else - { - $certificateToExport = $foundCertificates[0] - $certificateThumbprintToExport = $certificateToExport.Thumbprint - - Write-Verbose -Message ( - @( - "$($MyInvocation.MyCommand): ", - $($LocalizedData.CertificateToExportFound -f $certificateThumbprintToExport, $Path) - ) -join '' ) - - # Export the certificate - $exportCertificateParameters = @{ - FilePath = $Path - Cert = $certificateToExport - Force = $true - } - - if ($Type -in @('Cert', 'P7B', 'SST')) - { - $exportCertificateParameters += @{ - Type = $Type - } - Export-Certificate @exportCertificateParameters - } - elseif ($Type -eq 'PFX') - { - $exportCertificateParameters += @{ - Password = $Password.Password - ChainOption = $ChainOption - } - - if ($PSBoundParameters.ContainsKey('ProtectTo')) - { - $exportCertificateParameters += @{ - ProtectTo = $ProtectTo - } - } # if - Export-PfxCertificate @exportCertificateParameters - } # if - - Write-Verbose -Message ( - @( - "$($MyInvocation.MyCommand): ", - $($LocalizedData.CertificateExported -f $certificateThumbprintToExport, $Path, $Type) - ) -join '' ) - } # if -} # end function Set-TargetResource - -<# - .SYNOPSIS - Tests the state of the currently exported certificate. - - .PARAMETER Path - The path to the file you that will contain the exported certificate. - - .PARAMETER Thumbprint - The thumbprint of the certificate to export. - Certificate selector parameter. - - .PARAMETER FriendlyName - The friendly name of the certificate to export. - Certificate selector parameter. - - .PARAMETER Subject - The subject of the certificate to export. - Certificate selector parameter. - - .PARAMETER DNSName - The subject alternative name of the certificate to export must contain these values. - Certificate selector parameter. - - .PARAMETER Issuer - The issuer of the certificate to export. - Certificate selector parameter. - - .PARAMETER KeyUsage - The key usage of the certificate to export must contain these values. - Certificate selector parameter. - - .PARAMETER EnhancedKeyUsage - The enhanced key usage of the certificate to export must contain these values. - Certificate selector parameter. - - .PARAMETER Store - The Windows Certificate Store Name to search for the certificate to export from. - Certificate selector parameter. - Defaults to 'My'. - - .PARAMETER AllowExpired - Allow an expired certificate to be exported. - Certificate selector parameter. - - .PARAMETER MatchSource - Causes an existing exported certificate to be compared with the certificate identified for - export and re-exported if it does not match. - - .PARAMETER Type - Specifies the type of certificate to export. - Defaults to 'Cert'. - - .PARAMETER ChainOption - Specifies the options for building a chain when exporting a PFX certificate. - Defaults to 'BuildChain'. - - .PARAMETER Password - Specifies the password used to protect an exported PFX file. - - .PARAMETER ProtectTo - Specifies an array of strings for the username or group name that can access the private - key of an exported PFX file without any password. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Path, - - [Parameter()] - [System.String] - $Thumbprint, - - [Parameter()] - [System.String] - $FriendlyName, - - [Parameter()] - [System.String] - $Subject, - - [Parameter()] - [System.String] - $Issuer, - - [Parameter()] - [System.String[]] - $DNSName, - - [Parameter()] - [System.String[]] - $KeyUsage, - - [Parameter()] - [System.String[]] - $EnhancedKeyUsage, - - [Parameter()] - [System.String] - $Store = 'My', - - [Parameter()] - [System.Boolean] - $AllowExpired, - - [Parameter()] - [System.Boolean] - $MatchSource, - - [Parameter()] - [ValidateSet("Cert", "P7B", "SST", "PFX")] - [System.String] - $Type = 'Cert', - - [Parameter()] - [ValidateSet("BuildChain", "EndEntityCertOnly")] - [System.String] - $ChainOption = 'BuildChain', - - [Parameter()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Password, - - [Parameter()] - [System.String[]] - $ProtectTo - ) - - Write-Verbose -Message ( - @( - "$($MyInvocation.MyCommand): ", - $($LocalizedData.TestingCertificateExportMessage -f $Path) - ) -join '' ) - - $findCertificateParameters = @{} + $PSBoundParameters - $null = $findCertificateParameters.Remove('Path') - $null = $findCertificateParameters.Remove('MatchSource') - $null = $findCertificateParameters.Remove('Type') - $null = $findCertificateParameters.Remove('ChainOption') - $null = $findCertificateParameters.Remove('Password') - $null = $findCertificateParameters.Remove('ProtectTo') - $foundCertificates = @(Find-Certificate @findCertificateParameters) - - if ($foundCertificates.Count -eq 0) - { - # A certificate matching the specified certificate selector parameters could not be found - Write-Verbose -Message ( - @( - "$($MyInvocation.MyCommand): ", - $($LocalizedData.CertificateToExportNotFound -f $Path, $Type, $Store) - ) -join '' ) - - return $true - } - else - { - $certificateToExport = $foundCertificates[0] - $certificateThumbprintToExport = $certificateToExport.Thumbprint - - Write-Verbose -Message ( - @( - "$($MyInvocation.MyCommand): ", - $($LocalizedData.CertificateToExportFound -f $certificateThumbprintToExport, $Path) - ) -join '' ) - - if (Test-Path -Path $Path) - { - if ($MatchSource) - { - # The certificate has already been exported, but we need to make sure it matches - Write-Verbose -Message ( - @( - "$($MyInvocation.MyCommand): ", - $($LocalizedData.CertificateAlreadyExportedMatchSource -f $certificateThumbprintToExport, $Path) - ) -join '' ) - - # Need to now compare the existing exported cert content with the found cert - $exportedCertificate = New-Object -TypeName 'System.Security.Cryptography.X509Certificates.X509Certificate2Collection' - if ($Type -in @('Cert', 'P7B', 'SST')) - { - $exportedCertificate.Import($Path) - } - elseif ($Type -eq 'PFX') - { - $exportedCertificate.Import($Path, $Password, [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::PersistKeySet) - } # if - - if ($certificateThumbprintToExport -notin $exportedCertificate.Thumbprint) - { - Write-Verbose -Message ( - @( - "$($MyInvocation.MyCommand): ", - $($LocalizedData.CertificateAlreadyExportedNotMatchSource -f $certificateThumbprintToExport, $Path) - ) -join '' ) - - return $false - } # if - } - else - { - # This certificate is already exported and we don't want to check it is - # the right certificate. - Write-Verbose -Message ( - @( - "$($MyInvocation.MyCommand): ", - $($LocalizedData.CertificateAlreadyExported -f $certificateThumbprintToExport, $Path) - ) -join '' ) - } # if - - return $true - } - else - { - # The found certificate has not been exported yet - Write-Verbose -Message ( - @( - "$($MyInvocation.MyCommand): ", - $($LocalizedData.CertificateNotExported -f $certificateThumbprintToExport, $Path) - ) -join '' ) - - return $false - } # if - } # if -} # end function Test-TargetResource - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertificateExport/MSFT_xCertificateExport.schema.mof b/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertificateExport/MSFT_xCertificateExport.schema.mof deleted file mode 100644 index bca02e37..00000000 --- a/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertificateExport/MSFT_xCertificateExport.schema.mof +++ /dev/null @@ -1,20 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xCertificateExport")] -class MSFT_xCertificateExport : OMI_BaseResource -{ - [Key,Description("The path to the file you that will contain the exported certificate.")] string Path; - [Write,Description("The thumbprint of the certificate to export. Certificate selector parameter.")] string Thumbprint; - [Write,Description("The friendly name of the certificate to export. Certificate selector parameter.")] string FriendlyName; - [Write,Description("The subject of the certificate to export. Certificate selector parameter.")] string Subject; - [Write,Description("The subject alternative name of the certificate to export must contain these values. Certificate selector parameter.")] string DNSName[]; - [Write,Description("The issuer of the certificate to export. Certificate selector parameter.")] string Issuer; - [Write,Description("The key usage of the certificate to export must contain these values. Certificate selector parameter.")] string KeyUsage[]; - [Write,Description("The enhanced key usage of the certificate to export must contain these values. Certificate selector parameter.")] string EnhancedKeyUsage[]; - [Write,Description("The Windows Certificate Store Name to search for the certificate to export from. Certificate selector parameter. Defaults to 'My'.")] string Store; - [Write,Description("Allow an expired certificate to be exported. Certificate selector parameter.")] boolean AllowExpired; - [Write,Description("Causes an existing exported certificate to be compared with the certificate identified for export and re-exported if it does not match.")] boolean MatchSource; - [Write,Description("Specifies the type of certificate to export."),ValueMap{"Cert", "P7B", "SST", "PFX"},Values{"Cert", "P7B", "SST", "PFX"}] string Type; - [Write,Description("Specifies the options for building a chain when exporting a PFX certificate."),ValueMap{"BuildChain","EndEntityCertOnly"},Values{"BuildChain","EndEntityCertOnly"}] string ChainOption; - [Write,Description("Specifies the password used to protect an exported PFX file."),EmbeddedInstance("MSFT_Credential")] String Password; - [Write,Description("Specifies an array of strings for the username or group name that can access the private key of an exported PFX file without any password.")] string ProtectTo[]; - [Read,Description("Returns true if the certificate file already exists and therefore has been exported.")] boolean IsExported; -}; diff --git a/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertificateExport/en-us/MSFT_xCertificateExport.strings.psd1 b/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertificateExport/en-us/MSFT_xCertificateExport.strings.psd1 deleted file mode 100644 index 572932f8..00000000 --- a/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertificateExport/en-us/MSFT_xCertificateExport.strings.psd1 +++ /dev/null @@ -1,12 +0,0 @@ -ConvertFrom-StringData @' - GettingCertificateExportMessage = Getting certificate export status to '{0}'. - SettingCertificateExportMessage = Setting certificate export status to '{0}'. - TestingCertificateExportMessage = Testing certificate export status to '{0}'. - CertificateToExportNotFound = Could not find certificate to Export to '{0}' as '{1}' in LocalMachine '{2}' store. - CertificateToExportFound = Certificate to export with thumbprint '{0}' found to export to '{1}'. - CertificateAlreadyExported = Certificate to export with thumbprint '{0}' has already been exported to '{1}'. MatchSource set to false so not checking content match. Will not export. - CertificateAlreadyExportedMatchSource = Certificate to Export with thumbprint '{0}' has already been exported to '{1}'. MatchSource set to true so checking content match. - CertificateAlreadyExportedNotMatchSource = Certificate to Export with thumbprint '{0}' has already been exported to '{1}'. but exported certificate does not contain expected thumbprint. Will export. - CertificateNotExported = Certificate to export with thumbprint '{0}' has not yet been exported to '{1}'. Will export. - CertificateExported = Certificate to export as '{2}' with thumbprint '{0}' was exported to '{1}'. -'@ diff --git a/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertificateImport/MSFT_xCertificateImport.psm1 b/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertificateImport/MSFT_xCertificateImport.psm1 deleted file mode 100644 index 92ad255e..00000000 --- a/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertificateImport/MSFT_xCertificateImport.psm1 +++ /dev/null @@ -1,272 +0,0 @@ -#Requires -Version 4.0 - -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Certificate Common Modules -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'CertificateDsc.Common' ` - -ChildPath 'CertificateDsc.Common.psm1')) - -# Import the Certificate Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'CertificateDsc.ResourceHelper' ` - -ChildPath 'CertificateDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$localizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xCertificateImport' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# - .SYNOPSIS - Returns the current state of the CER Certificte file that should be imported. - - .PARAMETER Thumbprint - The thumbprint (unique identifier) of the certificate you're importing. - - .PARAMETER Path - The path to the CER file you want to import. - - .PARAMETER Location - The Windows Certificate Store Location to import the certificate to. - - .PARAMETER Store - The Windows Certificate Store Name to import the certificate to. - - .PARAMETER Ensure - Specifies whether the certificate should be present or absent. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateScript( { $_ | Test-Thumbprint } )] - [System.String] - $Thumbprint, - - [Parameter(Mandatory = $true)] - [ValidateScript( { $_ | Test-CertificatePath } )] - [System.String] - $Path, - - [Parameter(Mandatory = $true)] - [ValidateSet('CurrentUser', 'LocalMachine')] - [System.String] - $Location, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Store, - - [Parameter()] - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure = 'Present' - ) - - $certificateStore = 'Cert:' | - Join-Path -ChildPath $Location | - Join-Path -ChildPath $Store - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.GettingCertificateStatusMessage -f $Thumbprint,$certificateStore) - ) -join '' ) - - if ((Test-Path $certificateStore) -eq $false) - { - New-InvalidArgumentException ` - -Message ($LocalizedData.CertificateStoreNotFoundError -f $certificateStore) ` - -ArgumentName 'Store' - } - - $checkEnsure = [Bool] ( - $certificateStore | - Get-ChildItem | - Where-Object -FilterScript { $_.Thumbprint -ieq $Thumbprint } - ) - if ($checkEnsure) - { - $Ensure = 'Present' - } - else - { - $Ensure = 'Absent' - } - - @{ - Thumbprint = $Thumbprint - Path = $Path - Location = $Location - Store = $Store - Ensure = $Ensure - } -} # end function Get-TargetResource - -<# - .SYNOPSIS - Tests if the CER Certificate file needs to be imported or removed. - - .PARAMETER Thumbprint - The thumbprint (unique identifier) of the certificate you're importing. - - .PARAMETER Path - The path to the CER file you want to import. - - .PARAMETER Location - The Windows Certificate Store Location to import the certificate to. - - .PARAMETER Store - The Windows Certificate Store Name to import the certificate to. - - .PARAMETER Ensure - Specifies whether the certificate should be present or absent. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateScript( { $_ | Test-Thumbprint } )] - [System.String] - $Thumbprint, - - [Parameter(Mandatory = $true)] - [ValidateScript( { $_ | Test-CertificatePath } )] - [System.String] - $Path, - - [Parameter(Mandatory = $true)] - [ValidateSet('CurrentUser', 'LocalMachine')] - [System.String] - $Location, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Store, - - [Parameter()] - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure = 'Present' - ) - - $result = @(Get-TargetResource @PSBoundParameters) - - $certificateStore = 'Cert:' | - Join-Path -ChildPath $Location | - Join-Path -ChildPath $Store - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.TestingCertificateStatusMessage -f $Thumbprint,$CertificateStore) - ) -join '' ) - - if ($Ensure -ne $result.Ensure) - { - return $false - } - return $true -} # end function Test-TargetResource - -<# - .SYNOPSIS - Imports or removes the specified CER Certifiicate file. - - .PARAMETER Thumbprint - The thumbprint (unique identifier) of the certificate you're importing. - - .PARAMETER Path - The path to the CER file you want to import. - - .PARAMETER Location - The Windows Certificate Store Location to import the certificate to. - - .PARAMETER Store - The Windows Certificate Store Name to import the certificate to. - - .PARAMETER Ensure - Specifies whether the certificate should be present or absent. -#> -function Set-TargetResource -{ - [CmdletBinding(SupportsShouldProcess)] - param - ( - [Parameter(Mandatory = $true)] - [ValidateScript( { $_ | Test-Thumbprint } )] - [System.String] - $Thumbprint, - - [Parameter(Mandatory = $true)] - [ValidateScript( { $_ | Test-CertificatePath } )] - [System.String] - $Path, - - [Parameter(Mandatory = $true)] - [ValidateSet('CurrentUser', 'LocalMachine')] - [System.String] - $Location, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Store, - - [Parameter()] - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure = 'Present' - ) - - $certificateStore = 'Cert:' | - Join-Path -ChildPath $Location | - Join-Path -ChildPath $Store - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.SettingCertificateStatusMessage -f $Thumbprint,$certificateStore) - ) -join '' ) - - if ($Ensure -ieq 'Present') - { - if ($PSCmdlet.ShouldProcess(($LocalizedData.ImportingCertificateShould ` - -f $Path,$certificateStore))) - { - # Import the certificate into the Store - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ImportingCertficateMessage -f $Path,$certificateStore) - ) -join '' ) - - $param = @{ - CertStoreLocation = $certificateStore - FilePath = $Path - Verbose = $VerbosePreference - } - - Import-Certificate @param - } - } - elseif ($Ensure -ieq 'Absent') - { - # Remove the certificate from the Store - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.RemovingCertficateMessage -f $Thumbprint,$certificateStore) - ) -join '' ) - - Get-ChildItem -Path $certificateStore | - Where-Object { $_.Thumbprint -ieq $Thumbprint } | - Remove-Item -Force - } -} # end function Test-TargetResource - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertificateImport/MSFT_xCertificateImport.schema.mof b/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertificateImport/MSFT_xCertificateImport.schema.mof deleted file mode 100644 index a2b538d9..00000000 --- a/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertificateImport/MSFT_xCertificateImport.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("1.0"), FriendlyName("xCertificateImport")] -class MSFT_xCertificateImport : OMI_BaseResource -{ - [Key,Description("The thumbprint (unique identifier) of the certificate you're importing.")] string Thumbprint; - [Required,Description("The path to the CER file you want to import.")] string Path; - [Key,Description("The Windows Certificate Store Location to import the certificate to."),ValueMap{"LocalMachine", "CurrentUser"},Values{"LocalMachine", "CurrentUser"}] string Location; - [Key,Description("The Windows Certificate Store Name to import the certificate to.")] string Store; - [Write,Description("Specifies whether the certificate should be present or absent."),ValueMap{"Present", "Absent"},Values{"Present", "Absent"}] string Ensure; -}; diff --git a/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertificateImport/en-us/MSFT_xCertificateImport.strings.psd1 b/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertificateImport/en-us/MSFT_xCertificateImport.strings.psd1 deleted file mode 100644 index 13b0ef2d..00000000 --- a/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xCertificateImport/en-us/MSFT_xCertificateImport.strings.psd1 +++ /dev/null @@ -1,11 +0,0 @@ -ConvertFrom-StringData @' - GettingCertificateStatusMessage = Getting Certificate existence '{0}' in '{1}'. - TestingCertificateStatusMessage = Testing Certificate '{0}' existence in '{1}'. - SettingCertificateStatusMessage = Setting Certificate '{0}' existence in '{1}'. - ImportingCertficateMessage = Importing Certificate '{0}' into '{1}'. - RemovingCertficateMessage = Removing Certificate '{0}' from '{1}'. - - CertificateStoreNotFoundError = Certificate Store '{0}' not found. - - ImportingCertificateShould = Importing certificate '{0}' into '{1}' -'@ diff --git a/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xPfxImport/MSFT_xPfxImport.psm1 b/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xPfxImport/MSFT_xPfxImport.psm1 deleted file mode 100644 index 7e247d9a..00000000 --- a/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xPfxImport/MSFT_xPfxImport.psm1 +++ /dev/null @@ -1,319 +0,0 @@ -#Requires -Version 4.0 - -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Certificate Common Modules -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'CertificateDsc.Common' ` - -ChildPath 'CertificateDsc.Common.psm1')) - -# Import the Certificate Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'CertificateDsc.ResourceHelper' ` - -ChildPath 'CertificateDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$localizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xPfxImport' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# - .SYNOPSIS - Returns the current state of the PFX Certificte file that should be imported. - - .PARAMETER Thumbprint - The thumbprint (unique identifier) of the PFX file you're importing. - - .PARAMETER Path - The Windows Certificate Store Location to import the PFX file to. - - .PARAMETER Location - The Windows Certificate Store Location to import the PFX file to. - - .PARAMETER Store - The Windows Certificate Store Name to import the PFX file to. - - .PARAMETER Exportable - Determines whether the private key is exportable from the machine after it has been imported. - - .PARAMETER Credential - A [PSCredential] object that is used to decrypt the PFX file. Only the password is used, so any user name is valid. - - .PARAMETER Ensure - Specifies whether the PFX file should be present or absent. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateScript( { $_ | Test-Thumbprint } )] - [System.String] - $Thumbprint, - - [Parameter(Mandatory = $true)] - [ValidateScript( { $_ | Test-CertificatePath } )] - [System.String] - $Path, - - [Parameter(Mandatory = $true)] - [ValidateSet('CurrentUser', 'LocalMachine')] - [System.String] - $Location, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Store, - - [Parameter()] - [Boolean] - $Exportable = $false, - - [Parameter()] - [PSCredential] - $Credential, - - [Parameter()] - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure = 'Present' - ) - - $certificateStore = 'Cert:' | - Join-Path -ChildPath $Location | - Join-Path -ChildPath $Store - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.GettingPfxStatusMessage -f $Thumbprint, $certificateStore) - ) -join '' ) - - if ((Test-Path $certificateStore) -eq $false) - { - New-InvalidArgumentException ` - -Message ($LocalizedData.CertificateStoreNotFoundError -f $certificateStore) ` - -ArgumentName 'Store' - } - - $checkEnsure = [Bool]( - $certificateStore | - Get-ChildItem | - Where-Object -FilterScript {$_.Thumbprint -ieq $Thumbprint} - ) - if ($checkEnsure) - { - $Ensure = 'Present' - } - else - { - $Ensure = 'Absent' - } - - @{ - Thumbprint = $Thumbprint - Path = $Path - Location = $Location - Store = $Store - Exportable = $Exportable - Ensure = $Ensure - } -} # end function Get-TargetResource - -<# - .SYNOPSIS - Tests if the PFX Certificate file needs to be imported or removed. - - .PARAMETER Thumbprint - The thumbprint (unique identifier) of the PFX file you're importing. - - .PARAMETER Path - The Windows Certificate Store Location to import the PFX file to. - - .PARAMETER Location - The Windows Certificate Store Location to import the PFX file to. - - .PARAMETER Store - The Windows Certificate Store Name to import the PFX file to. - - .PARAMETER Exportable - Determines whether the private key is exportable from the machine after it has been imported. - - .PARAMETER Credential - A [PSCredential] object that is used to decrypt the PFX file. Only the password is used, so any user name is valid. - - .PARAMETER Ensure - Specifies whether the PFX file should be present or absent. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateScript( { $_ | Test-Thumbprint } )] - [System.String] - $Thumbprint, - - [Parameter(Mandatory = $true)] - [ValidateScript( { $_ | Test-CertificatePath } )] - [System.String] - $Path, - - [Parameter(Mandatory = $true)] - [ValidateSet('CurrentUser', 'LocalMachine')] - [System.String] - $Location, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Store, - - [Parameter()] - [Boolean] - $Exportable = $false, - - [Parameter()] - [PSCredential] - $Credential, - - [Parameter()] - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure = 'Present' - ) - - $result = @(Get-TargetResource @PSBoundParameters) - - $certificateStore = 'Cert:' | - Join-Path -ChildPath $Location | - Join-Path -ChildPath $Store - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.TestingPfxStatusMessage -f $Thumbprint, $certificateStore) - ) -join '' ) - - - if ($Ensure -ne $result.Ensure) - { - return $false - } - return $true -} # end function Test-TargetResource - -<# - .SYNOPSIS - Imports or removes the specified PFX Certifiicate file. - - .PARAMETER Thumbprint - The thumbprint (unique identifier) of the PFX file you're importing. - - .PARAMETER Path - The Windows Certificate Store Location to import the PFX file to. - - .PARAMETER Location - The Windows Certificate Store Location to import the PFX file to. - - .PARAMETER Store - The Windows Certificate Store Name to import the PFX file to. - - .PARAMETER Exportable - Determines whether the private key is exportable from the machine after it has been imported. - - .PARAMETER Credential - A [PSCredential] object that is used to decrypt the PFX file. Only the password is used, so any user name is valid. - - .PARAMETER Ensure - Specifies whether the PFX file should be present or absent. -#> -function Set-TargetResource -{ - [CmdletBinding(SupportsShouldProcess)] - param - ( - [Parameter(Mandatory = $true)] - [ValidateScript( { $_ | Test-Thumbprint } )] - [System.String] - $Thumbprint, - - [Parameter(Mandatory = $true)] - [ValidateScript( { $_ | Test-CertificatePath } )] - [System.String] - $Path, - - [Parameter(Mandatory = $true)] - [ValidateSet('CurrentUser', 'LocalMachine')] - [System.String] - $Location, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Store, - - [Parameter()] - [Boolean] - $Exportable = $false, - - [Parameter()] - [PSCredential] - $Credential, - - [Parameter()] - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure = 'Present' - ) - - $certificateStore = 'Cert:' | - Join-Path -ChildPath $Location | - Join-Path -ChildPath $Store - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.SettingPfxStatusMessage -f $Thumbprint, $certificateStore) - ) -join '' ) - - if ($Ensure -ieq 'Present') - { - if ($PSCmdlet.ShouldProcess(($LocalizedData.ImportingPfxShould ` - -f $Path, $certificateStore))) - { - # Import the certificate into the Store - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ImportingPfxMessage -f $Path, $certificateStore) - ) -join '' ) - - $param = @{ - Exportable = $Exportable - CertStoreLocation = $certificateStore - FilePath = $Path - } - if ($Credential) - { - $param['Password'] = $Credential.Password - } - Import-PfxCertificate @param - } - } - elseif ($Ensure -ieq 'Absent') - { - # Remove the certificate from the Store - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.RemovingPfxMessage -f $Thumbprint, $certificateStore) - ) -join '' ) - - Get-ChildItem -Path $certificateStore | - Where-Object { $_.Thumbprint -ieq $thumbprint } | - Remove-Item -Force - } -} # end function Set-TargetResource - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xPfxImport/MSFT_xPfxImport.schema.mof b/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xPfxImport/MSFT_xPfxImport.schema.mof deleted file mode 100644 index 761c4ede..00000000 --- a/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xPfxImport/MSFT_xPfxImport.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ -[ClassVersion("1.0"), FriendlyName("xPfxImport")] -class MSFT_xPfxImport : OMI_BaseResource -{ - [Key,Description("The thumbprint (unique identifier) of the PFX file you're importing.")] string Thumbprint; - [Required,Description("The path to the PFX file you want to import.")] string Path; - [Key,Description("The Windows Certificate Store Location to import the PFX file to."),ValueMap{"LocalMachine", "CurrentUser"},Values{"LocalMachine", "CurrentUser"}] string Location; - [Key,Description("The Windows Certificate Store Name to import the PFX file to.")] string Store; - [write,Description("Determines whether the private key is exportable from the machine after it has been imported")] boolean Exportable; - [write,Description("A [PSCredential] object that is used to decrypt the PFX file."),EmbeddedInstance("MSFT_Credential")] string Credential; - [Write,Description("Specifies whether the PFX file should be present or absent."),ValueMap{"Present", "Absent"},Values{"Present", "Absent"}] string Ensure; -}; diff --git a/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xPfxImport/en-us/MSFT_xPfxImport.strings.psd1 b/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xPfxImport/en-us/MSFT_xPfxImport.strings.psd1 deleted file mode 100644 index 4fe8418d..00000000 --- a/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xPfxImport/en-us/MSFT_xPfxImport.strings.psd1 +++ /dev/null @@ -1,11 +0,0 @@ -ConvertFrom-StringData @' - GettingPfxStatusMessage = Getting Pfx existence '{0}' in '{1}'. - TestingPfxStatusMessage = Testing Pfx '{0}' existence in '{1}'. - SettingPfxStatusMessage = Setting Pfx '{0}' existence in '{1}'. - ImportingPfxMessage = Importing Pfx '{0}' into '{1}'. - RemovingPfxMessage = Removing Pfx '{0}' from '{1}'. - - CertificateStoreNotFoundError = Certificate Store '{0}' not found. - - ImportingPfxShould = Importing Pfx '{0}' into '{1}' -'@ diff --git a/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xWaitForCertificateServices/MSFT_xWaitForCertificateServices.psm1 b/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xWaitForCertificateServices/MSFT_xWaitForCertificateServices.psm1 deleted file mode 100644 index 57cfc217..00000000 --- a/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xWaitForCertificateServices/MSFT_xWaitForCertificateServices.psm1 +++ /dev/null @@ -1,242 +0,0 @@ -# Suppressed as per PSSA Rule Severity guidelines for unit/integration tests: -# https://github.com/PowerShell/DscResources/blob/master/PSSARuleSeverities.md -#Requires -Version 4.0 - -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Certificate Common Modules -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'CertificateDsc.Common' ` - -ChildPath 'CertificateDsc.Common.psm1')) - -# Import the Certificate Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'CertificateDsc.ResourceHelper' ` - -ChildPath 'CertificateDsc.ResourceHelper.psm1')) - -# Import the Certificate PDT Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'CertificateDsc.PDT' ` - -ChildPath 'CertificateDsc.PDT.psm1')) - -# Import Localization Strings -$localizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xWaitForCertificateServices' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# - .SYNOPSIS - Returns the current state of the wait for Active Directory Certificate - Service Certificate Authority resource. - - .PARAMETER CAServerFQDN - The FQDN of the Active Directory Certificate Service Certificate Authority to wait - for. Leave empty to automatically detect. - - .PARAMETER CARootName - The name of the Active Directory Certificate Service Certificate Authority to wait - for. Leave empty to automatically detect. - - .PARAMETER RetryIntervalSeconds - Specifies the number of seconds to wait for the Active Directory Certificate - Service Certificate Authority to become available. Defaults to 10 seconds. - - .PARAMETER RetryCount - The number of times to loop the retry interval while waiting for the Active - Directory Certificate Service Certificate Authority. Defaults to 60 retries. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $CAServerFQDN, - - [Parameter(Mandatory = $true)] - [System.String] - $CARootName, - - [Parameter()] - [System.UInt32] - $RetryIntervalSeconds = 10, - - [Parameter()] - [System.UInt32] - $RetryCount = 60 - ) - - $certificateAuthorityFullName = "$CAServerFQDN\$CARootName" - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.GettingWaitForCertificateAuthorityStatusMessage -f $certificateAuthorityFullName) - ) -join '' ) - - $returnValue = @{ - CAServerFQDN = $CAServerFQDN - CARootName = $CARootName - RetryIntervalSeconds = $RetryIntervalSeconds - RetryCount = $RetryCount - } - return $returnValue -} # function Get-TargetResource - -<# - .SYNOPSIS - Waits for the Active Directory Certificate Service Certificate Authority to become - available or times out. - - .PARAMETER CAServerFQDN - The FQDN of the Active Directory Certificate Service Certificate Authority to wait - for. Leave empty to automatically detect. - - .PARAMETER CARootName - The name of the Active Directory Certificate Service Certificate Authority to wait - for. Leave empty to automatically detect. - - .PARAMETER RetryIntervalSeconds - Specifies the number of seconds to wait for the Active Directory Certificate - Service Certificate Authority to become available. Defaults to 10 seconds. - - .PARAMETER RetryCount - The number of times to loop the retry interval while waiting for the Active - Directory Certificate Service Certificate Authority. Defaults to 60 retries. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $CAServerFQDN, - - [Parameter(Mandatory = $true)] - [System.String] - $CARootName, - - [Parameter()] - [System.UInt32] - $RetryIntervalSeconds = 10, - - [Parameter()] - [System.UInt32] - $RetryCount = 60 - ) - - $certificateAuthorityFullName = "$CAServerFQDN\$CARootName" - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.CheckingForCertificateAuthorityStatusMessage -f $certificateAuthorityFullName) - ) -join '' ) - - $certificateAuthorityFound = $false - - for ($count = 0; $count -lt $RetryCount; $count++) - { - if (Test-CertificateAuthority ` - -CAServerFQDN $CAServerFQDN ` - -CARootName $CARootName) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.CertificateAuthorityFoundMessage -f $certificateAuthorityFullName) - ) -join '' ) - - $certificateAuthorityFound = $true - break - } - else - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.CertificateAuthorityNotFoundRetryingMessage -f $certificateAuthorityFullName, $RetryIntervalSeconds) - ) -join '' ) - - Start-Sleep -Seconds $RetryIntervalSeconds - } # if - } # for - - if (-not $certificateAuthorityFound) - { - New-InvalidOperationException ` - -Message $($localizedData.CertificateAuthorityNotFoundAfterError -f $certificateAuthorityFullName, $RetryCount) - } # if -} # function Set-TargetResource - -<# - .SYNOPSIS - Waits for the Active Directory Certificate Service Certificate Authority to - become available or times out. - - .PARAMETER CAServerFQDN - The FQDN of the Active Directory Certificate Service Certificate Authority to wait - for. Leave empty to automatically detect. - - .PARAMETER CARootName - The name of the Active Directory Certificate Service Certificate Authority to wait - for. Leave empty to automatically detect. - - .PARAMETER RetryIntervalSeconds - Specifies the number of seconds to wait for the Active Directory Certificate - Service Certificate Authority to become available. Defaults to 10 seconds. - - .PARAMETER RetryCount - The number of times to loop the retry interval while waiting for the Active - Directory Certificate Service Certificate Authority. Defaults to 60 retries. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $CAServerFQDN, - - [Parameter(Mandatory = $true)] - [System.String] - $CARootName, - - [Parameter()] - [System.UInt32] - $RetryIntervalSeconds = 10, - - [Parameter()] - [System.UInt32] - $RetryCount = 60 - ) - - $certificateAuthorityFullName = "$CAServerFQDN\$CARootName" - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.CheckingForCertificateAuthorityStatusMessage -f $certificateAuthorityFullName) - ) -join '' ) - - if (Test-CertificateAuthority ` - -CAServerFQDN $CAServerFQDN ` - -CARootName $CARootName) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.CertificateAuthorityFoundMessage -f $certificateAuthorityFullName) - ) -join '' ) - - return $true - } - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.CertificateAuthorityNotFoundMessage -f $certificateAuthorityFullName) - ) -join '' ) - - return $false -} # function Test-TargetResource - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xWaitForCertificateServices/MSFT_xWaitForCertificateServices.schema.mof b/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xWaitForCertificateServices/MSFT_xWaitForCertificateServices.schema.mof deleted file mode 100644 index d793a606..00000000 --- a/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xWaitForCertificateServices/MSFT_xWaitForCertificateServices.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xWaitForCertificateServices")] -class MSFT_xWaitForCertificateServices : OMI_BaseResource -{ - [Key, Description("The FQDN of the Active Directory Certificate Service Certificate Authority to wait for.")] String CAServerFQDN; - [Key, Description("The name of the Active Directory Certificate Service Certificate Authority to wait for.")] String CARootName; - [Write, Description("Specifies the number of seconds to wait for the Active Directory Certificate Service Certificate Authority to become available. Defaults to 10 seconds.")] Uint32 RetryIntervalSeconds; - [Write, Description("The number of times to loop the retry interval while waiting for the Active Directory Certificate Service Certificate Authority. Defaults to 60 retries.")] Uint32 RetryCount; -}; diff --git a/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xWaitForCertificateServices/en-us/MSFT_xWaitForCertificateServices.strings.psd1 b/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xWaitForCertificateServices/en-us/MSFT_xWaitForCertificateServices.strings.psd1 deleted file mode 100644 index 7106d629..00000000 --- a/lib/puppet_x/dsc_resources/xCertificate/DSCResources/MSFT_xWaitForCertificateServices/en-us/MSFT_xWaitForCertificateServices.strings.psd1 +++ /dev/null @@ -1,8 +0,0 @@ -ConvertFrom-StringData @' - GettingWaitForCertificateAuthorityStatusMessage = Getting Wait for status of Active Directory Certificate Services Certificate Authority '{0}'. - CheckingForCertificateAuthorityStatusMessage = Checking for Active Directory Certificate Services Certificate Authority '{0}' status. - CertificateAuthorityFoundMessage = Found Active Directory Certificate Services Certificate Authority '{0}'. - CertificateAuthorityNotFoundMessage = Active Directory Certificate Services Certificate Authority '{0}' not found. - CertificateAuthorityNotFoundRetryingMessage = Active Directory Certificate Services Certificate Authority '{0}' not found, retrying in {1} seconds. - CertificateAuthorityNotFoundAfterError = Active Directory Certificate Services Certificate Authority '{0}' not found after {1} tries. -'@ diff --git a/lib/puppet_x/dsc_resources/xCertificate/LICENSE b/lib/puppet_x/dsc_resources/xCertificate/LICENSE deleted file mode 100644 index 38c4c5d2..00000000 --- a/lib/puppet_x/dsc_resources/xCertificate/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2017 Microsoft Corporation - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - diff --git a/lib/puppet_x/dsc_resources/xCertificate/Modules/CertificateDsc.Common/CertificateDSc.Common.psm1 b/lib/puppet_x/dsc_resources/xCertificate/Modules/CertificateDsc.Common/CertificateDSc.Common.psm1 deleted file mode 100644 index c53fa345..00000000 --- a/lib/puppet_x/dsc_resources/xCertificate/Modules/CertificateDsc.Common/CertificateDSc.Common.psm1 +++ /dev/null @@ -1,587 +0,0 @@ -# Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` - -ChildPath (Join-Path -Path 'CertificateDsc.ResourceHelper' ` - -ChildPath 'CertificateDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$localizedData = Get-LocalizedData ` - -ResourceName 'CertificateDsc.Common' ` - -ResourcePath $PSScriptRoot - -<# - .SYNOPSIS - Validates the existence of a file at a specific path. - - .PARAMETER Path - The location of the file. Supports any path that Test-Path supports. - - .PARAMETER Quiet - Returns $false if the file does not exist. By default this function throws an exception if the - file is missing. - - .EXAMPLE - Test-CertificatePath -Path '\\server\share\Certificates\mycert.cer' - - .EXAMPLE - Test-CertificatePath -Path 'C:\certs\my_missing.cer' -Quiet - - .EXAMPLE - 'D:\CertRepo\a_cert.cer' | Test-CertificatePath - - .EXAMPLE - Get-ChildItem -Path D:\CertRepo\*.cer | - Test-CertificatePath -#> -function Test-CertificatePath -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true, - ValueFromPipeline)] - [String[]] - $Path, - - [Parameter()] - [Switch] - $Quiet - ) - - Process - { - foreach ($pathNode in $Path) - { - if ($pathNode | Test-Path -PathType Leaf) - { - $true - } - elseif ($Quiet) - { - $false - } - else - { - New-InvalidArgumentException ` - -Message ($LocalizedData.FileNotFoundError -f $pathNode) ` - -ArgumentName 'Path' - } - } - } -} # end function Test-CertificatePath - -<# - .SYNOPSIS - Validates whether a given certificate is valid based on the hash algoritms available on the - system. - - .PARAMETER Thumbprint - One or more thumbprints to Test. - - .PARAMETER Quiet - Returns $false if the thumbprint is not valid. By default this function throws an exception if - validation fails. - - .EXAMPLE - Test-Thumbprint fd94e3a5a7991cb6ed3cd5dd01045edf7e2284de - - .EXAMPLE - Test-Thumbprint ` - -Thumbprint fd94e3a5a7991cb6ed3cd5dd01045edf7e2284de,0000e3a5a7991cb6ed3cd5dd01045edf7e220000 ` - -Quiet - - .EXAMPLE - Get-ChildItem -Path Cert:\LocalMachine -Recurse | - Where-Object -FilterScript { $_.Thumbprint } | - Select-Object -Expression Thumbprint | - Test-Thumbprint -Verbose -#> -function Test-Thumbprint -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true, - ValueFromPipeline)] - [ValidateNotNullOrEmpty()] - [String[]] - $Thumbprint, - - [Parameter()] - [Switch] - $Quiet - ) - - Begin - { - # Get a list of Hash Providers - $hashProviders = [System.AppDomain]::CurrentDomain.GetAssemblies().GetTypes() | - Where-Object -FilterScript { - $_.BaseType.BaseType -eq [System.Security.Cryptography.HashAlgorithm] -and - ($_.Name -cmatch 'Managed$' -or $_.Name -cmatch 'Provider$') - } - - # Get a list of all Valid Hash types and lengths into an array - $validHashes = @() - foreach ($hashProvider in $hashProviders) - { - $bitSize = ( New-Object -TypeName $hashProvider ).HashSize - $validHash = New-Object ` - -TypeName PSObject ` - -Property @{ - Hash = $hashProvider.BaseType.Name - BitSize = $bitSize - HexLength = $bitSize / 4 - } - $validHashes += @( $validHash ) - } - } - - Process - { - foreach ($hash in $Thumbprint) - { - $isValid = $false - - foreach ($algorithm in $validHashes) - { - if ($hash -cmatch "^[a-fA-F0-9]{$($algorithm.HexLength)}$") - { - Write-Verbose ` - -Message ($LocalizedData.InvalidHashError -f $hash,$algorithm.Hash) ` - -Verbose - - $isValid = $true - } - } - - if ($Quiet -or $isValid) - { - $isValid - } - else - { - New-InvalidOperationException ` - -Message ($LocalizedData.InvalidHashError -f $hash) - } - } - } -} # end function Test-Thumbprint - -<# - .SYNOPSIS - Locates one or more certificates using the passed certificate selector parameters. - - If more than one certificate is found matching the selector criteria, they will be - returned in order of descending expiration date. - - .PARAMETER Thumbprint - The thumbprint of the certificate to find. - - .PARAMETER FriendlyName - The friendly name of the certificate to find. - - .PARAMETER Subject - The subject of the certificate to find. - - .PARAMETER DNSName - The subject alternative name of the certificate to export must contain these values. - - .PARAMETER Issuer - The issuer of the certificate to find. - - .PARAMETER KeyUsage - The key usage of the certificate to find must contain these values. - - .PARAMETER EnhancedKeyUsage - The enhanced key usage of the certificate to find must contain these values. - - .PARAMETER Store - The Windows Certificate Store Name to search for the certificate in. - Defaults to 'My'. - - .PARAMETER AllowExpired - Allows expired certificates to be returned. - -#> -function Find-Certificate -{ - [CmdletBinding()] - [OutputType([System.Security.Cryptography.X509Certificates.X509Certificate2[]])] - param - ( - [Parameter()] - [String] - $Thumbprint, - - [Parameter()] - [String] - $FriendlyName, - - [Parameter()] - [String] - $Subject, - - [Parameter()] - [String[]] - $DNSName, - - [Parameter()] - [String] - $Issuer, - - [Parameter()] - [String[]] - $KeyUsage, - - [Parameter()] - [String[]] - $EnhancedKeyUsage, - - [Parameter()] - [String] - $Store = 'My', - - [Parameter()] - [Boolean] - $AllowExpired = $false - ) - - $certPath = Join-Path -Path 'Cert:\LocalMachine' -ChildPath $Store - - if (-not (Test-Path -Path $certPath)) - { - # The Certificte Path is not valid - New-InvalidArgumentException ` - -Message ($LocalizedData.CertificatePathError -f $certPath) ` - -ArgumnentName 'Store' - } # if - - # Assemble the filter to use to select the certificate - $certFilters = @() - if ($PSBoundParameters.ContainsKey('Thumbprint')) - { - $certFilters += @('($_.Thumbprint -eq $Thumbprint)') - } # if - - if ($PSBoundParameters.ContainsKey('FriendlyName')) - { - $certFilters += @('($_.FriendlyName -eq $FriendlyName)') - } # if - - if ($PSBoundParameters.ContainsKey('Subject')) - { - $certFilters += @('($_.Subject -eq $Subject)') - } # if - - if ($PSBoundParameters.ContainsKey('Issuer')) - { - $certFilters += @('($_.Issuer -eq $Issuer)') - } # if - - if (-not $AllowExpired) - { - $certFilters += @('(((Get-Date) -le $_.NotAfter) -and ((Get-Date) -ge $_.NotBefore))') - } # if - - if ($PSBoundParameters.ContainsKey('DNSName')) - { - $certFilters += @('(@(Compare-Object -ReferenceObject $_.DNSNameList.Unicode -DifferenceObject $DNSName | Where-Object -Property SideIndicator -eq "=>").Count -eq 0)') - } # if - - if ($PSBoundParameters.ContainsKey('KeyUsage')) - { - $certFilters += @('(@(Compare-Object -ReferenceObject ($_.Extensions.KeyUsages -split ", ") -DifferenceObject $KeyUsage | Where-Object -Property SideIndicator -eq "=>").Count -eq 0)') - } # if - - if ($PSBoundParameters.ContainsKey('EnhancedKeyUsage')) - { - $certFilters += @('(@(Compare-Object -ReferenceObject ($_.EnhancedKeyUsageList.FriendlyName) -DifferenceObject $EnhancedKeyUsage | Where-Object -Property SideIndicator -eq "=>").Count -eq 0)') - } # if - - # Join all the filters together - $certFilterScript = '(' + ($certFilters -join ' -and ') + ')' - - Write-Verbose ` - -Message ($LocalizedData.SearchingForCertificateUsingFilters -f $store,$certFilterScript) ` - -Verbose - - $certs = Get-ChildItem -Path $certPath | - Where-Object -FilterScript ([ScriptBlock]::Create($certFilterScript)) - - # Sort the certificates - if ($certs.count -gt 1) - { - $certs = $certs | Sort-Object -Descending -Property 'NotAfter' - } # if - - return $certs -} # end function Find-Certificate - -<# -.SYNOPSIS - Get CDP container - -.DESCRIPTION - Gets the configuration data partition from the active directory configuration naming context - -.PARAMETER DomainName - The domain name -#> -function Get-CdpContainer -{ - [cmdletBinding()] - [OutputType([psobject])] - param( - [Parameter()] - [String] - $DomainName - ) - - if (-not $DomainName) - { - $configContext = ([ADSI]'LDAP://RootDSE').configurationNamingContext - - if (-not $configContext) - { - # The computer is not domain joined - New-InvalidOperationException ` - -Message ($LocalizedData.DomainNotJoinedError) - } - } - else - { - $ctx = New-Object -TypeName System.DirectoryServices.ActiveDirectory.DirectoryContext('Domain', $DomainName) - $configContext = 'CN=Configuration,{0}' -f ([System.DirectoryServices.ActiveDirectory.Domain]::GetDomain($ctx).GetDirectoryEntry().distinguishedName[0]) - } - - Write-Verbose ` - -Message ($LocalizedData.ConfigurationNamingContext -f $configContext.toString()) ` - -Verbose - - $cdpContainer = [ADSI]('LDAP://CN=CDP,CN=Public Key Services,CN=Services,{0}' -f $configContext.toString()) - - return $cdpContainer -} # end function Get-CdpContainer - -<# -.SYNOPSIS - Automatically locate a certificate authority in Active Directory - -.DESCRIPTION - Automatically locates a certificate autority in Active Directory environments by leveraging ADSI to look inside the container CDP and - subsequently trying to certutil -ping every located CA until one is found. - -.PARAMETER DomainName - The domain name of the domain that will be used to locate the CA. Can be left empty to use the current domain. -#> -function Find-CertificateAuthority -{ - [cmdletBinding()] - [OutputType([psobject])] - param( - [Parameter()] - [String] - $DomainName - ) - - Write-Verbose ` - -Message ($LocalizedData.StartLocateCAMessage) ` - -Verbose - - $cdpContainer = Get-CdpContainer @PSBoundParameters -ErrorAction Stop - - $caFound = $false - foreach ($item in $cdpContainer.Children) - { - if (-not $caFound) - { - $caServerFQDN = ($item.distinguishedName -split '=|,')[1] - $caRootName = ($item.Children.distinguishedName -split '=|,')[1] - - $certificateAuthority = [PSObject] @{ - CARootName = $caRootName - CAServerFQDN = $caServerFQDN - } - - if (Test-CertificateAuthority ` - -CARootName $caRootName ` - -CAServerFQDN $caServerFQDN) - { - $caFound = $true - break - } - } - } - - if ($caFound) - { - Write-Verbose ` - -Message ($LocalizedData.CaFoundMessage -f $certificateAuthority.CAServerFQDN, $certificateAuthority.CARootName) ` - -Verbose - - return $certificateAuthority - } - else - { - New-InvalidOperationException ` - -Message ($LocalizedData.NoCaFoundError) - } -} # end function Find-CertificateAuthority - -<# -.SYNOPSIS - Test to see if the specified ADCS CA is available. - -.PARAMETER CAServerFQDN - The FQDN of the ADCS CA to test for availability. - -.PARAMETER CARootName - The name of the ADCS CA to test for availability. -#> -function Test-CertificateAuthority -{ - [cmdletBinding()] - [OutputType([Boolean])] - param( - [Parameter()] - [System.String] - $CAServerFQDN, - - [Parameter()] - [System.String] - $CARootName - ) - - Write-Verbose ` - -Message ($LocalizedData.StartPingCAMessage) ` - -Verbose - - $locatorInfo = New-Object -TypeName System.Diagnostics.ProcessStartInfo - $locatorInfo.FileName = 'certutil.exe' - $locatorInfo.Arguments = ('-ping "{0}\{1}"' -f $CAServerFQDN,$CARootName) - - # Certutil does not make use of standard error stream - $locatorInfo.RedirectStandardError = $false - $locatorInfo.RedirectStandardOutput = $true - $locatorInfo.UseShellExecute = $false - $locatorInfo.CreateNoWindow = $true - - $locatorProcess = New-Object -TypeName System.Diagnostics.Process - $locatorProcess.StartInfo = $locatorInfo - - $null = $locatorProcess.Start() - $locatorOut = $locatorProcess.StandardOutput.ReadToEnd() - $null = $locatorProcess.WaitForExit() - - Write-Verbose ` - -Message ($LocalizedData.CaPingMessage -f $locatorProcess.ExitCode, $locatorOut) ` - -Verbose - - if ($locatorProcess.ExitCode -eq 0) - { - Write-Verbose ` - -Message ($LocalizedData.CaOnlineMessage -f $CAServerFQDN, $CARootName) ` - -Verbose - - return $true - } - else - { - Write-Verbose ` - -Message ($LocalizedData.CaOfflineMessage -f $CAServerFQDN, $CARootName) ` - -Verbose - - return $false - } -} # end function Test-CertificateAuthority - -<# -.SYNOPSIS - Get a certificate template name - -.DESCRIPTION - Gets the name of the template used for the certificate that is passed to this cmdlet by translating the OIDs "1.3.6.1.4.1.311.21.7" or "1.3.6.1.4.1.311.20.2" - -.PARAMETER Certificate - The certificate object the template name is needed for -#> -function Get-CertificateTemplateName -{ - [cmdletBinding()] - [OutputType([System.String])] - param - ( - # The certificate for which a template is needed - [Parameter(Mandatory = $true)] - [object] - $Certificate - ) - - if ($Certificate -isnot [System.Security.Cryptography.X509Certificates.X509Certificate2]) - { - return - } - - # Test the different OIDs - if ('1.3.6.1.4.1.311.21.7' -in $Certificate.Extensions.oid.Value) - { - $temp = $Certificate.Extensions | Where-Object { $PSItem.Oid.Value -eq '1.3.6.1.4.1.311.21.7' } - $null = $temp.Format(0) -match 'Template=(?.*)\(' - $templateName = $Matches.TemplateName -replace ' ' - } - - if ('1.3.6.1.4.1.311.20.2' -in $Certificate.Extensions.oid.Value) - { - $templateName = ($Certificate.Extensions | Where-Object { $PSItem.Oid.Value -eq '1.3.6.1.4.1.311.20.2' }).Format(0) - } - - return $templateName -} - -<# -.SYNOPSIS - Get certificate SAN - -.DESCRIPTION - Gets the first subject alternative name for the certificate that is passed to this cmdlet - -.PARAMETER Certificate - The certificate object the subject alternative name is needed for -#> -function Get-CertificateSan -{ - [cmdletBinding()] - [OutputType([System.String])] - param - ( - # The certificate for which the subject alternative names are needed - [Parameter(Mandatory = $true)] - [object] - $Certificate - ) - - if ($Certificate -isnot [System.Security.Cryptography.X509Certificates.X509Certificate2]) - { - return - } - - $subjectAlternativeName = $null - - $sanExtension = $Certificate.Extensions | Where-Object { $_.Oid.FriendlyName -match 'subject alternative name' } - - if ($null -eq $sanExtension) - { - return $subjectAlternativeName - } - - $sanObjects = New-Object -ComObject X509Enrollment.CX509ExtensionAlternativeNames - $altNamesStr = [System.Convert]::ToBase64String($sanExtension.RawData) - $sanObjects.InitializeDecode(1, $altNamesStr) - - if ($sanObjects.AlternativeNames.Count -gt 0) - { - $subjectAlternativeName = $sanObjects.AlternativeNames[0].strValue - } - - return $subjectAlternativeName -} diff --git a/lib/puppet_x/dsc_resources/xCertificate/Modules/CertificateDsc.Common/en-us/CertificateDsc.Common.strings.psd1 b/lib/puppet_x/dsc_resources/xCertificate/Modules/CertificateDsc.Common/en-us/CertificateDsc.Common.strings.psd1 deleted file mode 100644 index bca33123..00000000 --- a/lib/puppet_x/dsc_resources/xCertificate/Modules/CertificateDsc.Common/en-us/CertificateDsc.Common.strings.psd1 +++ /dev/null @@ -1,17 +0,0 @@ -ConvertFrom-StringData @' - FileNotFoundError = File '{0}' not found. - InvalidHashError = '{0}' is not a valid hash. - CertificatePathError = Certificate Path '{0}' is not valid. - SearchingForCertificateUsingFilters = Looking for certificate in Store '{0}' using filter '{1}'. - ConfigurationNamingContext = Using the following container to look for CA candidates: 'LDAP://CN=CDP,CN=Public Key Services,CN=Services,{0}' - ValidHashMessage = '{0}' is a valid {1} hash. - DomainNotJoinedError = The computer is not joined to a domain. - DomainContactError = The domain '{0}' could not be contacted. The following error was received: '{1}' - StartLocateCAMessage = Starting to locate CA. - StartPingCAMessage = Starting to ping CA. - NoCaFoundError = No Certificate Authority could be found. - CaPingMessage = certutil exited with code {0} and the following output: {1} - CaFoundMessage = Found certificate authority '{0}\{1}'. - CaOnlineMessage = Certificate authority '{0}\{1}' is online. - CaOfflineMessage = Certificate authority '{0}\{1}' is offline. -'@ diff --git a/lib/puppet_x/dsc_resources/xCertificate/Modules/CertificateDsc.PDT/CertificateDsc.PDT.psm1 b/lib/puppet_x/dsc_resources/xCertificate/Modules/CertificateDsc.PDT/CertificateDsc.PDT.psm1 deleted file mode 100644 index 58f15187..00000000 --- a/lib/puppet_x/dsc_resources/xCertificate/Modules/CertificateDsc.PDT/CertificateDsc.PDT.psm1 +++ /dev/null @@ -1,744 +0,0 @@ -# Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` - -ChildPath (Join-Path -Path 'CertificateDsc.ResourceHelper' ` - -ChildPath 'CertificateDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$localizedData = Get-LocalizedData ` - -ResourceName 'CertificateDsc.PDT' ` - -ResourcePath $PSScriptRoot - -<# - .SYNOPSIS - Extracts an array of arguments that were found in the Arguments list passed in. - It also optionally maps the arguments to a new name. - - .PARAMETER FunctionBoundParameters - The parameters that were passed to the calling function. - - .PARAMETER ArgumentNames - The array of arguments that should be extracted. - - .PARAMETER NewArgumentNames - An array of argument names to rename each argument to. -#> -function Get-Arguments -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - $FunctionBoundParameters, - - [Parameter(Mandatory = $true)] - [System.String[]] - $ArgumentNames, - - [Parameter()] - [System.String[]] - $NewArgumentNames - ) - - $returnValue=@{} - - for ($i=0;$i -lt $ArgumentNames.Count;$i++) - { - $argumentName = $ArgumentNames[$i] - - if ($NewArgumentNames -eq $null) - { - $newArgumentName = $argumentName - } - else - { - $newArgumentName = $NewArgumentNames[$i] - } - - if ($FunctionBoundParameters.ContainsKey($argumentName)) - { - $null = $returnValue.Add($NewArgumentName,$FunctionBoundParameters[$argumentName]) - } - } - - return $returnValue -} # end function Get-Arguments - -<# - .SYNOPSIS - Initialize the Win32 PInvoke wrapper. -#> -function Initialize-PInvoke -{ - $script:ProgramSource = @" -using System; -using System.Collections.Generic; -using System.Text; -using System.Security; -using System.Runtime.InteropServices; -using System.Diagnostics; -using System.Security.Principal; -using System.ComponentModel; -using System.IO; - -namespace Source -{ - [SuppressUnmanagedCodeSecurity] - public static class NativeMethods - { - //The following structs and enums are used by the various Win32 API's that are used in the code below - - [StructLayout(LayoutKind.Sequential)] - public struct STARTUPINFO - { - public Int32 cb; - public string lpReserved; - public string lpDesktop; - public string lpTitle; - public Int32 dwX; - public Int32 dwY; - public Int32 dwXSize; - public Int32 dwXCountChars; - public Int32 dwYCountChars; - public Int32 dwFillAttribute; - public Int32 dwFlags; - public Int16 wShowWindow; - public Int16 cbReserved2; - public IntPtr lpReserved2; - public IntPtr hStdInput; - public IntPtr hStdOutput; - public IntPtr hStdError; - } - - [StructLayout(LayoutKind.Sequential)] - public struct PROCESS_INFORMATION - { - public IntPtr hProcess; - public IntPtr hThread; - public Int32 dwProcessID; - public Int32 dwThreadID; - } - - [Flags] - public enum LogonType - { - LOGON32_LOGON_INTERACTIVE = 2, - LOGON32_LOGON_NETWORK = 3, - LOGON32_LOGON_BATCH = 4, - LOGON32_LOGON_SERVICE = 5, - LOGON32_LOGON_UNLOCK = 7, - LOGON32_LOGON_NETWORK_CLEARTEXT = 8, - LOGON32_LOGON_NEW_CREDENTIALS = 9 - } - - [Flags] - public enum LogonProvider - { - LOGON32_PROVIDER_DEFAULT = 0, - LOGON32_PROVIDER_WINNT35, - LOGON32_PROVIDER_WINNT40, - LOGON32_PROVIDER_WINNT50 - } - [StructLayout(LayoutKind.Sequential)] - public struct SECURITY_ATTRIBUTES - { - public Int32 Length; - public IntPtr lpSecurityDescriptor; - public bool bInheritHandle; - } - - public enum SECURITY_IMPERSONATION_LEVEL - { - SecurityAnonymous, - SecurityIdentification, - SecurityImpersonation, - SecurityDelegation - } - - public enum TOKEN_TYPE - { - TokenPrimary = 1, - TokenImpersonation - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - internal struct TokPriv1Luid - { - public int Count; - public long Luid; - public int Attr; - } - - public const int GENERIC_ALL_ACCESS = 0x10000000; - public const int CREATE_NO_WINDOW = 0x08000000; - internal const int SE_PRIVILEGE_ENABLED = 0x00000002; - internal const int TOKEN_QUERY = 0x00000008; - internal const int TOKEN_ADJUST_PRIVILEGES = 0x00000020; - internal const string SE_INCRASE_QUOTA = "SeIncreaseQuotaPrivilege"; - - [DllImport("kernel32.dll", - EntryPoint = "CloseHandle", SetLastError = true, - CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] - public static extern bool CloseHandle(IntPtr handle); - - [DllImport("advapi32.dll", - EntryPoint = "CreateProcessAsUser", SetLastError = true, - CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] - public static extern bool CreateProcessAsUser( - IntPtr hToken, - string lpApplicationName, - string lpCommandLine, - ref SECURITY_ATTRIBUTES lpProcessAttributes, - ref SECURITY_ATTRIBUTES lpThreadAttributes, - bool bInheritHandle, - Int32 dwCreationFlags, - IntPtr lpEnvrionment, - string lpCurrentDirectory, - ref STARTUPINFO lpStartupInfo, - ref PROCESS_INFORMATION lpProcessInformation - ); - - [DllImport("advapi32.dll", EntryPoint = "DuplicateTokenEx")] - public static extern bool DuplicateTokenEx( - IntPtr hExistingToken, - Int32 dwDesiredAccess, - ref SECURITY_ATTRIBUTES lpThreadAttributes, - Int32 ImpersonationLevel, - Int32 dwTokenType, - ref IntPtr phNewToken - ); - - [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] - public static extern Boolean LogonUser( - String lpszUserName, - String lpszDomain, - String lpszPassword, - LogonType dwLogonType, - LogonProvider dwLogonProvider, - out IntPtr phToken - ); - - [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)] - internal static extern bool AdjustTokenPrivileges( - IntPtr htok, - bool disall, - ref TokPriv1Luid newst, - int len, - IntPtr prev, - IntPtr relen - ); - - [DllImport("kernel32.dll", ExactSpelling = true)] - internal static extern IntPtr GetCurrentProcess(); - - [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)] - internal static extern bool OpenProcessToken( - IntPtr h, - int acc, - ref IntPtr phtok - ); - - [DllImport("advapi32.dll", SetLastError = true)] - internal static extern bool LookupPrivilegeValue( - string host, - string name, - ref long pluid - ); - - public static void CreateProcessAsUser(string strCommand, string strDomain, string strName, string strPassword) - { - var hToken = IntPtr.Zero; - var hDupedToken = IntPtr.Zero; - TokPriv1Luid tp; - var pi = new PROCESS_INFORMATION(); - var sa = new SECURITY_ATTRIBUTES(); - sa.Length = Marshal.SizeOf(sa); - Boolean bResult = false; - try - { - bResult = LogonUser( - strName, - strDomain, - strPassword, - LogonType.LOGON32_LOGON_BATCH, - LogonProvider.LOGON32_PROVIDER_DEFAULT, - out hToken - ); - if (!bResult) - { - throw new Win32Exception("The user could not be logged on. Ensure that the user has an existing profile on the machine and that correct credentials are provided. Logon error #" + Marshal.GetLastWin32Error().ToString()); - } - IntPtr hproc = GetCurrentProcess(); - IntPtr htok = IntPtr.Zero; - bResult = OpenProcessToken( - hproc, - TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, - ref htok - ); - if(!bResult) - { - throw new Win32Exception("Open process token error #" + Marshal.GetLastWin32Error().ToString()); - } - tp.Count = 1; - tp.Luid = 0; - tp.Attr = SE_PRIVILEGE_ENABLED; - bResult = LookupPrivilegeValue( - null, - SE_INCRASE_QUOTA, - ref tp.Luid - ); - if(!bResult) - { - throw new Win32Exception("Error in looking up privilege of the process. This should not happen if DSC is running as LocalSystem Lookup privilege error #" + Marshal.GetLastWin32Error().ToString()); - } - bResult = AdjustTokenPrivileges( - htok, - false, - ref tp, - 0, - IntPtr.Zero, - IntPtr.Zero - ); - if(!bResult) - { - throw new Win32Exception("Token elevation error #" + Marshal.GetLastWin32Error().ToString()); - } - - bResult = DuplicateTokenEx( - hToken, - GENERIC_ALL_ACCESS, - ref sa, - (int)SECURITY_IMPERSONATION_LEVEL.SecurityIdentification, - (int)TOKEN_TYPE.TokenPrimary, - ref hDupedToken - ); - if(!bResult) - { - throw new Win32Exception("Duplicate Token error #" + Marshal.GetLastWin32Error().ToString()); - } - var si = new STARTUPINFO(); - si.cb = Marshal.SizeOf(si); - si.lpDesktop = ""; - bResult = CreateProcessAsUser( - hDupedToken, - null, - strCommand, - ref sa, - ref sa, - false, - 0, - IntPtr.Zero, - null, - ref si, - ref pi - ); - if(!bResult) - { - throw new Win32Exception("The process could not be created. Create process as user error #" + Marshal.GetLastWin32Error().ToString()); - } - } - finally - { - if (pi.hThread != IntPtr.Zero) - { - CloseHandle(pi.hThread); - } - if (pi.hProcess != IntPtr.Zero) - { - CloseHandle(pi.hProcess); - } - if (hDupedToken != IntPtr.Zero) - { - CloseHandle(hDupedToken); - } - } - } - } -} - -"@ - Add-Type -TypeDefinition $ProgramSource -ReferencedAssemblies "System.ServiceProcess" -} # end function Initialize-PInvoke - -<# - .SYNOPSIS - Gets a Win32 process that matches the path, arguments and is user. - - .PARAMETER Path - The path to the executable running the process. - - .PARAMETER Arguments - The arguments of the running process to find. - - .PARAMETER Credential - The credentials of the account that the process is running under. -#> -function Get-Win32Process -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [Parameter()] - [String] - $Arguments, - - [Parameter()] - [PSCredential] - $Credential - ) - - $fileName = [io.path]::GetFileNameWithoutExtension($Path) - $getProcesses = @(Get-Process -Name $fileName -ErrorAction SilentlyContinue) - $processes = foreach ($process in $GetProcesses) - { - if ($process.Path -ieq $Path) - { - try - { - [wmi]"Win32_Process.Handle='$($process.Id)'" - } - catch - { - } - } - } - if ($PSBoundParameters.ContainsKey('Credential')) - { - $processes = $processes | - Where-Object -FilterScript { - (Get-Win32ProcessOwner $_) -eq $Credential.UserName - } - } - if ($Arguments -eq $null) - { - $Arguments = "" - } - $processes = $processes | - Where-Object -FilterScript { - (Get-Win32ProcessArgumentsFromCommandLine $_.CommandLine) -eq $Arguments - } - - return $processes -} # end function Get-Win32Process - -<# - .SYNOPSIS - Returns the Owner of a Win32 Process. - - .PARAMETER Process - The Win32 WMI process to get the owner for. -#> -function Get-Win32ProcessOwner -{ - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - $Process - ) - - try - { - $owner = $Process.GetOwner() - } - catch - { - } - if ($owner.Domain -ne $null) - { - return $owner.Domain + "\" + $owner.User - } - else - { - return $owner.User - } -} # end function Get-Win32ProcessOwner - -<# - .SYNOPSIS - Extracts the arguments from a complete command line - - .PARAMETER CommandLine - The complete command line to extract the arguments from. -#> -function Get-Win32ProcessArgumentsFromCommandLine -{ - param - ( - [Parameter()] - [String] - $CommandLine - ) - - if ($commandLine -eq $null) - { - return "" - } - $commandLine = $commandLine.Trim() - if ($commandLine.Length -eq 0) - { - return "" - } - if ($commandLine[0] -eq '"') - { - $charToLookfor = [char]'"' - } - else - { - $charToLookfor = [char]' ' - } - $endOfCommand = $commandLine.IndexOf($charToLookfor ,1) - if ($endOfCommand -eq -1) - { - return "" - } - return $commandLine.Substring($endOfCommand+1).Trim() -} # end funcion Get-Win32ProcessArgumentsFromCommandLine - -<# - .SYNOPSIS - Starts a Win32 Process using PInvoke. - - .PARAMETER Path - The full path to the executable to start the process with. - - .PARAMETER Arguments - The arguments to pass to the executable when starting the process. - - .PARAMETER Credential - The user account to start the process under. -#> -function Start-Win32Process -{ - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [Parameter()] - [String] - $Arguments, - - [Parameter()] - [PSCredential] - $Credential - ) - - $getArguments = Get-Arguments $PSBoundParameters ("Path","Arguments","Credential") - $processes = @(Get-Win32Process @getArguments) - if ($processes.Count -eq 0) - { - if($PSBoundParameters.ContainsKey("Credential")) - { - try - { - Initialize-PInvoke - [Source.NativeMethods]::CreateProcessAsUser(` - ("$Path " + $Arguments),` - $Credential.GetNetworkCredential().Domain,` - $Credential.GetNetworkCredential().UserName,` - $Credential.GetNetworkCredential().Password) - } - catch - { - try - { - Initialize-PInvoke - [Source.NativeMethods]::CreateProcessAsUser(` - ("$Path " + $Arguments),` - $Credential.GetNetworkCredential().Domain,` - $Credential.GetNetworkCredential().UserName,` - $Credential.GetNetworkCredential().Password) - } - catch - { - $exception = New-Object System.ArgumentException $_ - $errorCategory = [System.Management.Automation.ErrorCategory]::OperationStopped - $errorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord $exception, "Win32Exception", $errorCategory, $null - $err = $errorRecord - } - } - } - else - { - $startArguments = Get-Arguments $PSBoundParameters ` - ("Path", "Arguments", "Credential") ` - ("FilePath", "ArgumentList", "Credential") - if([string]::IsNullOrEmpty($Arguments)) - { - $null = $startArguments.Remove("ArgumentList") - } - $err = Start-Process @StartArguments - } - if($err -ne $null) - { - throw $err - } - Wait-Win32ProcessStart @GetArguments - } - else - { - return ($LocalizedData.ProcessAlreadyStarted -f $Path,$processes.ProcessId) - } - $processes = @(Get-Win32Process @getArguments) - return ($LocalizedData.ProcessStarted -f $Path,$processes.ProcessId) -} # end function Start-Win32Process - -<# - .SYNOPSIS - Wait for a Win32 process to start. - - .PARAMETER Path - The full path to the executable of the process to wait for. - - .PARAMETER Arguments - The arguments passed to the executable of the process to wait for. - - .PARAMETER Credential - The user account the process will be running under. - - .PARAMETER Timeout - The milliseconds to wait for the process to start. -#> -function Wait-Win32ProcessStart -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [Parameter()] - [String] - $Arguments, - - [Parameter()] - [PSCredential] - $Credential, - - [Parameter()] - [Int] - $Timeout = 5000 - ) - - $start = [DateTime]::Now - $getArguments = Get-Arguments $PSBoundParameters ("Path","Arguments","Credential") - $started = (@(Get-Win32Process @GetArguments).Count -ge 1) - While (-not $started -and ([DateTime]::Now - $start).TotalMilliseconds -lt $Timeout) - { - Start-Sleep -Seconds 1 - $started = @(Get-Win32Process @GetArguments).Count -ge 1 - } - return $started -} # end function Wait-Win32ProcessStart - -<# - .SYNOPSIS - Wait for a Win32 process to stop. This assumes the process was aleady confirmed to have been started by first - calling Wait-Win32ProcessStart. - - .PARAMETER Path - The full path to the executable of the process to wait for. - - .PARAMETER Arguments - The arguments passed to the executable of the process to wait for. - - .PARAMETER Credential - The user account the process will be running under. - - .PARAMETER Timeout - The milliseconds to wait for the process to stop. -#> -function Wait-Win32ProcessStop -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [Parameter()] - [String] - $Arguments, - - [Parameter()] - [PSCredential] - $Credential, - - [Parameter()] - [Int] - $Timeout = 30000 - ) - - $start = [DateTime]::Now - $getArguments = Get-Arguments $PSBoundParameters ("Path","Arguments","Credential") - $stopped = (@(Get-Win32Process @GetArguments).Count -eq 0) - While (-not $stopped -and ([DateTime]::Now - $start).TotalMilliseconds -lt $Timeout) - { - Start-Sleep -Seconds 1 - $stopped = (@(Get-Win32Process @GetArguments).Count -eq 0) - } - return $stopped -} # end function Wait-Win32ProcessStop - -<# - .SYNOPSIS - Wait for a Win32 process to complete. - - .PARAMETER Path - The full path to the executable of the process to wait for. - - .PARAMETER Arguments - The arguments passed to the executable of the process to wait for. - - .PARAMETER Credential - The user account the process will be running under. - - .PARAMETER Timeout - The amount of time to wait for the process to end. -#> -function Wait-Win32ProcessEnd -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [Parameter()] - [String] - $Arguments, - - [Parameter()] - [PSCredential] - $Credential - ) - - $getArguments = Get-Arguments $PSBoundParameters ("Path","Arguments","Credential") - # Wait for the process to start - if (-not (Wait-Win32ProcessStart @getArguments)) - { - New-InvalidOperationException ` - -Message ($LocalizedData.ProcessFailedToStartError -f $Path,$Arguments) - } - if (-not (Wait-Win32ProcessStop @getArguments)) - { - # The process did not stop. - New-InvalidOperationException ` - -Message ($LocalizedData.ProcessFailedToStopError -f $Path,$Arguments) - } -} # end function Wait-Win32ProcessEnd - -Export-ModuleMember Start-Win32Process,Wait-Win32ProcessStart,Wait-Win32ProcessStop,Wait-Win32ProcessEnd diff --git a/lib/puppet_x/dsc_resources/xCertificate/Modules/CertificateDsc.PDT/en-us/CertificateDsc.PDT.strings.psd1 b/lib/puppet_x/dsc_resources/xCertificate/Modules/CertificateDsc.PDT/en-us/CertificateDsc.PDT.strings.psd1 deleted file mode 100644 index 0e78778d..00000000 --- a/lib/puppet_x/dsc_resources/xCertificate/Modules/CertificateDsc.PDT/en-us/CertificateDsc.PDT.strings.psd1 +++ /dev/null @@ -1,10 +0,0 @@ -ConvertFrom-StringData @' - FileNotFound = File not found in the environment path - AbsolutePathOrFileName = Absolute path or file name expected - InvalidArgument = Invalid argument: '{0}' with value: '{1}' - InvalidArgumentAndMessage = {0} {1} - ProcessFailedToStartError = The process '{0}' with arguments '{1}' failed to start within the specified timeout. - ProcessStarted = Process matching path '{0}' started in process ID {1} - ProcessAlreadyStarted = Process matching path '{0}' already started in process ID {1} - ProcessFailedToStopError = The process '{0}' with arguments '{1}' failed to stop within the specified timeout. -'@ diff --git a/lib/puppet_x/dsc_resources/xCertificate/Modules/CertificateDsc.ResourceHelper/CertificateDsc.ResourceHelper.psm1 b/lib/puppet_x/dsc_resources/xCertificate/Modules/CertificateDsc.ResourceHelper/CertificateDsc.ResourceHelper.psm1 deleted file mode 100644 index 642687be..00000000 --- a/lib/puppet_x/dsc_resources/xCertificate/Modules/CertificateDsc.ResourceHelper/CertificateDsc.ResourceHelper.psm1 +++ /dev/null @@ -1,174 +0,0 @@ -<# - .SYNOPSIS - Tests if the current machine is a Nano server. -#> -function Test-IsNanoServer -{ - if (Test-Command -Name Get-ComputerInfo) - { - $computerInfo = Get-ComputerInfo - - if ("Server" -eq $computerInfo.OsProductType ` - -and "NanoServer" -eq $computerInfo.OsServerLevel) - { - return $true - } - } - - return $false -} - -<# - .SYNOPSIS - Tests if the the specified command is found. -#> -function Test-Command -{ - param - ( - [Parameter()] - [String] - $Name - ) - - return ($null -ne (Get-Command -Name $Name -ErrorAction Continue 2> $null)) -} - -<# - .SYNOPSIS - Creates and throws an invalid argument exception - - .PARAMETER Message - The message explaining why this error is being thrown - - .PARAMETER ArgumentName - The name of the invalid argument that is causing this error to be thrown -#> -function New-InvalidArgumentException -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Message, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $ArgumentName - ) - - $argumentException = New-Object -TypeName 'ArgumentException' -ArgumentList @( $Message, - $ArgumentName ) - $newObjectParams = @{ - TypeName = 'System.Management.Automation.ErrorRecord' - ArgumentList = @( $argumentException, $ArgumentName, 'InvalidArgument', $null ) - } - $errorRecord = New-Object @newObjectParams - - throw $errorRecord -} - -<# - .SYNOPSIS - Creates and throws an invalid operation exception - - .PARAMETER Message - The message explaining why this error is being thrown - - .PARAMETER ErrorRecord - The error record containing the exception that is causing this terminating error -#> -function New-InvalidOperationException -{ - [CmdletBinding()] - param - ( - [Parameter()] - [ValidateNotNullOrEmpty()] - [String] - $Message, - - [Parameter()] - [ValidateNotNull()] - [System.Management.Automation.ErrorRecord] - $ErrorRecord - ) - - if ($null -eq $Message) - { - $invalidOperationException = New-Object -TypeName 'InvalidOperationException' - } - elseif ($null -eq $ErrorRecord) - { - $invalidOperationException = - New-Object -TypeName 'InvalidOperationException' -ArgumentList @( $Message ) - } - else - { - $invalidOperationException = - New-Object -TypeName 'InvalidOperationException' -ArgumentList @( $Message, - $ErrorRecord.Exception ) - } - - $newObjectParams = @{ - TypeName = 'System.Management.Automation.ErrorRecord' - ArgumentList = @( $invalidOperationException.ToString(), 'MachineStateIncorrect', - 'InvalidOperation', $null ) - } - $errorRecordToThrow = New-Object @newObjectParams - throw $errorRecordToThrow -} - -<# - .SYNOPSIS - Retrieves the localized string data based on the machine's culture. - Falls back to en-US strings if the machine's culture is not supported. - - .PARAMETER ResourceName - The name of the resource as it appears before '.strings.psd1' of the localized string file. - - For example: - For WindowsOptionalFeature: MSFT_xWindowsOptionalFeature - For Service: MSFT_xServiceResource - For Registry: MSFT_xRegistryResource - - .PARAMETER ResourcePath - The path the resource file is located in. -#> -function Get-LocalizedData -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $ResourceName, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $ResourcePath - ) - - $localizedStringFileLocation = Join-Path -Path $ResourcePath -ChildPath $PSUICulture - - if (-not (Test-Path -Path $localizedStringFileLocation)) - { - # Fallback to en-US - $localizedStringFileLocation = Join-Path -Path $ResourcePath -ChildPath 'en-US' - } - - Import-LocalizedData ` - -BindingVariable 'localizedData' ` - -FileName "$ResourceName.strings.psd1" ` - -BaseDirectory $localizedStringFileLocation - - return $localizedData -} - -Export-ModuleMember -Function @( 'Test-IsNanoServer', 'New-InvalidArgumentException', - 'New-InvalidOperationException', 'Get-LocalizedData' ) diff --git a/lib/puppet_x/dsc_resources/xCertificate/xCertificate.psd1 b/lib/puppet_x/dsc_resources/xCertificate/xCertificate.psd1 deleted file mode 100644 index 36efb8c1..00000000 --- a/lib/puppet_x/dsc_resources/xCertificate/xCertificate.psd1 +++ /dev/null @@ -1,84 +0,0 @@ -@{ - # Version number of this module. - ModuleVersion = '3.0.0.0' - - # ID used to uniquely identify this module - GUID = '1b8d785e-79ae-4d95-ae58-b2460aec1031' - - # Author of this module - Author = 'Microsoft Corporation' - - # Company or vendor of this module - CompanyName = 'Microsoft Corporation' - - # Copyright statement for this module - Copyright = '(c) 2017 Microsoft Corporation. All rights reserved.' - - # Description of the functionality provided by this module - Description = 'This module includes DSC resources that simplify administration of certificates on a Windows Server' - - # Minimum version of the Windows PowerShell engine required by this module - PowerShellVersion = '4.0' - - # Minimum version of the common language runtime (CLR) required by this module - CLRVersion = '4.0' - - # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess - # NestedModules = @() - - # Functions to export from this module - FunctionsToExport = '*' - - # Cmdlets to export from this module - CmdletsToExport = '*' - - # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. - PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/xCertificate/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/xCertificate' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - ReleaseNotes = '- Add CodeCov.io code coverage reporting. -- Opted into "Common Tests - Validate Example Files". -- Fixed bugs in examples. -- Updated License and Manifest Copyright info to be 2017 Microsoft Corporation. -- xCertReq: - - BREAKING CHANGE: Changed default Keylength to 2048 bits to meet - [Microsoft Security Advisory](https://support.microsoft.com/en-us/help/2661254/microsoft-security-advisory-update-for-minimum-certificate-key-length). - - Fixed spelling mistakes in MOF files. -- Added .github support files: - - CONTRIBUTING.md - - ISSUE_TEMPLATE.md - - PULL_REQUEST_TEMPLATE.md -- Opted into Common Tests "Validate Module Files" and "Validate Script Files". -- Converted files with UTF8 with BOM over to UTF8 - fixes [Issue 87](https://github.com/PowerShell/xCertificate/issues/87). -- Converted to use auto-documentation/wiki format - fixes [Issue 84](https://github.com/PowerShell/xCertificate/issues/84). - -' - - } # End of PSData hashtable - - } # End of PrivateData hashtable - -} - - - - - - - - - diff --git a/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/CommonResourceHelper.psm1 b/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/CommonResourceHelper.psm1 deleted file mode 100644 index 7cdf9306..00000000 --- a/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/CommonResourceHelper.psm1 +++ /dev/null @@ -1,425 +0,0 @@ -<# - .SYNOPSIS - Retrieves the localized string data based on the machine's culture. - Falls back to en-US strings if the machine's culture is not supported. - - .PARAMETER ResourceName - The name of the resource as it appears before '.strings.psd1' of the localized string file. - For example: - xSQLServerEndpoint: MSFT_xSQLServerEndpoint - xSQLServerConfiguration: MSFT_xSQLServerConfiguration - xSQLServerRole: MSFT_xSQLServerRole -#> -function Get-LocalizedData -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $ResourceName - ) - - $resourceDirectory = Join-Path -Path $PSScriptRoot -ChildPath $ResourceName - $localizedStringFileLocation = Join-Path -Path $resourceDirectory -ChildPath $PSUICulture - - if (-not (Test-Path -Path $localizedStringFileLocation)) - { - # Fallback to en-US - $localizedStringFileLocation = Join-Path -Path $resourceDirectory -ChildPath 'en-US' - } - - Import-LocalizedData ` - -BindingVariable 'localizedData' ` - -FileName "$ResourceName.strings.psd1" ` - -BaseDirectory $localizedStringFileLocation - - return $localizedData -} - -<# -.SYNOPSIS - Removes common parameters from a hashtable -.DESCRIPTION - This function serves the purpose of removing common parameters and option common parameters from a parameter hashtable -.PARAMETER Hashtable - The parameter hashtable that should be pruned -#> -function Remove-CommonParameter -{ - [OutputType([System.Collections.Hashtable])] - [cmdletbinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.Collections.Hashtable] - $Hashtable - ) - - $inputClone = $Hashtable.Clone() - $commonParameters = [System.Management.Automation.PSCmdlet]::CommonParameters - $commonParameters += [System.Management.Automation.PSCmdlet]::OptionalCommonParameters - - $Hashtable.Keys | Where-Object { $_ -in $commonParameters } | ForEach-Object { - $inputClone.Remove($_) - } - - return $inputClone -} - -<# -.SYNOPSIS - Tests the status of DSC resource parameters -.DESCRIPTION - This function tests the parameter status of DSC resource parameters against the current values present on the system -.PARAMETER CurrentValues - A hashtable with the current values on the system, obtained by e.g. Get-TargetResource -.PARAMETER DesiredValues - The hashtable of desired values -.PARAMETER ValuesToCheck - The values to check if not all values should be checked -.PARAMETER TurnOffTypeChecking - Indicates that the type of the parameter should not be checked -#> -function Test-DscParameterState -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.Collections.Hashtable] - $CurrentValues, - - [Parameter(Mandatory = $true)] - [object] - $DesiredValues, - - [Parameter()] - [string[]] - $ValuesToCheck, - - [Parameter()] - [switch] - $TurnOffTypeChecking - ) - - $returnValue = $true - - $types = 'System.Management.Automation.PSBoundParametersDictionary', 'System.Collections.Hashtable', 'Microsoft.Management.Infrastructure.CimInstance' - - if ($DesiredValues.GetType().FullName -notin $types) - { - throw ("Property 'DesiredValues' in Test-DscParameterState must be either a Hashtable or CimInstance. Type detected was $($DesiredValues.GetType().FullName)") - } - - if ($DesiredValues -is [Microsoft.Management.Infrastructure.CimInstance] -and -not $ValuesToCheck) - { - throw ("If 'DesiredValues' is a CimInstance then property 'ValuesToCheck' must contain a value") - } - - $desiredValuesClean = Remove-CommonParameter -Hashtable $DesiredValues - - if (-not $ValuesToCheck) - { - $keyList = $desiredValuesClean.Keys - } - else - { - $keyList = $ValuesToCheck - } - - foreach ($key in $keyList) - { - if ($null -ne $desiredValuesClean.$key) - { - $desiredType = $desiredValuesClean.$key.GetType() - } - else - { - $desiredType = [psobject]@{ - Name = 'Unknown' - } - } - - if ($null -ne $CurrentValues.$key) - { - $currentType = $CurrentValues.$key.GetType() - } - else - { - $currentType = [psobject]@{ - Name = 'Unknown' - } - } - - if ($currentType.Name -ne 'Unknown' -and $desiredType.Name -eq 'PSCredential') - { - # This is a credential object. Compare only the user name - if ($currentType.Name -eq 'PSCredential' -and $CurrentValues.$key.UserName -eq $desiredValuesClean.$key.UserName) - { - Write-Verbose -Message ('MATCH: PSCredential username match. Current state is {0} and desired state is {1}' -f $CurrentValues.$key.UserName, $desiredValuesClean.$key.UserName) - continue - } - else - { - Write-Verbose -Message ('NOTMATCH: PSCredential username mismatch. Current state is {0} and desired state is {1}' -f $CurrentValues.$key.UserName, $desiredValuesClean.$key.UserName) - $returnValue = $false - } - - # Assume the string is our username when the matching desired value is actually a credential - if ($currentType.Name -eq 'string' -and $CurrentValues.$key -eq $desiredValuesClean.$key.UserName) - { - Write-Verbose -Message ('MATCH: PSCredential username match. Current state is {0} and desired state is {1}' -f $CurrentValues.$key, $desiredValuesClean.$key.UserName) - continue - } - else - { - Write-Verbose -Message ('NOTMATCH: PSCredential username mismatch. Current state is {0} and desired state is {1}' -f $CurrentValues.$key, $desiredValuesClean.$key.UserName) - $returnValue = $false - } - } - - if (-not $TurnOffTypeChecking) - { - if (($desiredType.Name -ne 'Unknown' -and $currentType.Name -ne 'Unknown') -and - $desiredType.FullName -ne $currentType.FullName) - { - Write-Verbose -Message "NOTMATCH: Type mismatch for property '$key' Current state type is '$($currentType.Name)' and desired type is '$($desiredType.Name)'" - continue - } - } - - if ($CurrentValues.$key -eq $desiredValuesClean.$key -and -not $desiredType.IsArray) - { - Write-Verbose -Message "MATCH: Value (type $($desiredType.Name)) for property '$key' does match. Current state is '$($CurrentValues.$key)' and desired state is '$($desiredValuesClean.$key)'" - continue - } - - if ($desiredValuesClean.GetType().Name -in 'HashTable', 'PSBoundParametersDictionary') - { - $checkDesiredValue = $desiredValuesClean.ContainsKey($key) - } - else - { - $checkDesiredValue = Test-DSCObjectHasProperty -Object $desiredValuesClean -PropertyName $key - } - - if (-not $checkDesiredValue) - { - Write-Verbose -Message "MATCH: Value (type $($desiredType.Name)) for property '$key' does match. Current state is '$($CurrentValues.$key)' and desired state is '$($desiredValuesClean.$key)'" - continue - } - - if ($desiredType.IsArray) - { - Write-Verbose -Message "Comparing values in property '$key'" - if (-not $CurrentValues.ContainsKey($key) -or -not $CurrentValues.$key) - { - Write-Verbose -Message "NOTMATCH: Value (type $($desiredType.Name)) for property '$key' does not match. Current state is '$($CurrentValues.$key)' and desired state is '$($desiredValuesClean.$key)'" - $returnValue = $false - continue - } - elseif ($CurrentValues.$key.Count -ne $DesiredValues.$key.Count) - { - Write-Verbose -Message "NOTMATCH: Value (type $($desiredType.Name)) for property '$key' does have a different count. Current state count is '$($CurrentValues.$key.Count)' and desired state count is '$($desiredValuesClean.$key.Count)'" - $returnValue = $false - continue - } - else - { - $desiredArrayValues = $DesiredValues.$key - $currentArrayValues = $CurrentValues.$key - - for ($i = 0; $i -lt $desiredArrayValues.Count; $i++) - { - if ($null -ne $desiredArrayValues[$i]) - { - $desiredType = $desiredArrayValues[$i].GetType() - } - else - { - $desiredType = [psobject]@{ - Name = 'Unknown' - } - } - - if ($null -ne $currentArrayValues[$i]) - { - $currentType = $currentArrayValues[$i].GetType() - } - else - { - $currentType = [psobject]@{ - Name = 'Unknown' - } - } - - if (-not $TurnOffTypeChecking) - { - if (($desiredType.Name -ne 'Unknown' -and $currentType.Name -ne 'Unknown') -and - $desiredType.FullName -ne $currentType.FullName) - { - Write-Verbose -Message "`tNOTMATCH: Type mismatch for property '$key' Current state type of element [$i] is '$($currentType.Name)' and desired type is '$($desiredType.Name)'" - $returnValue = $false - continue - } - } - - if ($desiredArrayValues[$i] -ne $currentArrayValues[$i]) - { - Write-Verbose -Message "`tNOTMATCH: Value [$i] (type $($desiredType.Name)) for property '$key' does match. Current state is '$($currentArrayValues[$i])' and desired state is '$($desiredArrayValues[$i])'" - $returnValue = $false - continue - } - else - { - Write-Verbose -Message "`tMATCH: Value [$i] (type $($desiredType.Name)) for property '$key' does match. Current state is '$($currentArrayValues[$i])' and desired state is '$($desiredArrayValues[$i])'" - continue - } - } - - } - } - else - { - if ($desiredValuesClean.$key -ne $CurrentValues.$key) - { - Write-Verbose -Message "NOTMATCH: Value (type $($desiredType.Name)) for property '$key' does not match. Current state is '$($CurrentValues.$key)' and desired state is '$($desiredValuesClean.$key)'" - $returnValue = $false - } - - } - } - - Write-Verbose -Message "Result is '$returnValue'" - return $returnValue -} - -<# -.SYNOPSIS - Tests of an object has a property -.PARAMETER Object - The object to test -.PARAMETER PropertyName - The property name -#> -function Test-DSCObjectHasProperty -{ - [CmdletBinding()] - [OutputType([bool])] - param - ( - [Parameter(Mandatory = $true)] - [object] - $Object, - - [Parameter(Mandatory = $true)] - [string] - $PropertyName - ) - - if ($Object.PSObject.Properties.Name -contains $PropertyName) - { - return [bool] $Object.$PropertyName - } - - return $false -} - -<# - .SYNOPSIS - Creates and throws an invalid argument exception - - .PARAMETER Message - The message explaining why this error is being thrown - - .PARAMETER ArgumentName - The name of the invalid argument that is causing this error to be thrown -#> -function New-InvalidArgumentException -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Message, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $ArgumentName - ) - - $argumentException = New-Object -TypeName 'ArgumentException' ` - -ArgumentList @($Message, $ArgumentName) - $newObjectParams = @{ - TypeName = 'System.Management.Automation.ErrorRecord' - ArgumentList = @($argumentException, $ArgumentName, 'InvalidArgument', $null) - } - $errorRecord = New-Object @newObjectParams - - throw $errorRecord -} - -<# - .SYNOPSIS - Creates and throws an invalid operation exception - - .PARAMETER Message - The message explaining why this error is being thrown - - .PARAMETER ErrorRecord - The error record containing the exception that is causing this terminating error -#> -function New-InvalidOperationException -{ - [CmdletBinding()] - param - ( - [Parameter()] - [ValidateNotNullOrEmpty()] - [String] - $Message, - - [Parameter()] - [ValidateNotNull()] - [System.Management.Automation.ErrorRecord] - $ErrorRecord - ) - - if ($null -eq $Message) - { - $invalidOperationException = New-Object -TypeName 'InvalidOperationException' - } - elseif ($null -eq $ErrorRecord) - { - $invalidOperationException = New-Object -TypeName 'InvalidOperationException' ` - -ArgumentList @($Message) - } - else - { - $invalidOperationException = New-Object -TypeName 'InvalidOperationException' ` - -ArgumentList @($Message, $ErrorRecord.Exception) - } - - $newObjectParams = @{ - TypeName = 'System.Management.Automation.ErrorRecord' - ArgumentList = @( $invalidOperationException.ToString(), 'MachineStateIncorrect', - 'InvalidOperation', $null ) - } - - $errorRecordToThrow = New-Object @newObjectParams - throw $errorRecordToThrow -} - -Export-ModuleMember -Function @( - 'Get-LocalizedData' - 'Remove-CommonParameter' - 'Test-DscParameterState' - 'Test-DSCObjectHasProperty' - 'New-InvalidOperationException' - 'New-InvalidArgumentException' -) diff --git a/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xComputer/MSFT_xComputer.psm1 b/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xComputer/MSFT_xComputer.psm1 deleted file mode 100644 index 772885c5..00000000 --- a/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xComputer/MSFT_xComputer.psm1 +++ /dev/null @@ -1,386 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidGlobalVars", "", Scope = "Function")] -param -( -) - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateLength(1, 15)] - [ValidateScript( {$_ -inotmatch '[\/\\:*?"<>|]' })] - [System.String] - $Name, - - [Parameter()] - [System.String] - $DomainName, - - [Parameter()] - [System.String] - $JoinOU, - - [Parameter()] - [System.Management.Automation.PSCredential] - $Credential, - - [Parameter()] - [System.Management.Automation.PSCredential] - $UnjoinCredential, - - [Parameter()] - [System.String] - $WorkGroupName - ) - - Write-Verbose -Message "Getting computer state for '$($Name)'." - - $convertToCimCredential = New-CimInstance ` - -ClassName MSFT_Credential ` - -Property @{ - Username = [System.String] $Credential.UserName - Password = [System.String] $null - } ` - -Namespace root/microsoft/windows/desiredstateconfiguration ` - -ClientOnly - - $convertToCimUnjoinCredential = New-CimInstance ` - -ClassName MSFT_Credential ` - -Property @{ - Username = [System.String] $UnjoinCredential.UserName - Password = [System.String]$null - } ` - -Namespace root/microsoft/windows/desiredstateconfiguration ` - -ClientOnly - - $returnValue = @{ - Name = $env:COMPUTERNAME - DomainName = Get-ComputerDomain - JoinOU = $JoinOU - CurrentOU = Get-ComputerOU - Credential = [ciminstance]$convertToCimCredential - UnjoinCredential = [ciminstance]$convertToCimUnjoinCredential - WorkGroupName = (Get-CimInstance -Class 'Win32_ComputerSystem').Workgroup - } - - $returnValue -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateLength(1, 15)] - [ValidateScript( {$_ -inotmatch '[\/\\:*?"<>|]' })] - [System.String] - $Name, - - [Parameter()] - [System.String] - $DomainName, - - [Parameter()] - [System.String] - $JoinOU, - - [Parameter()] - [System.Management.Automation.PSCredential] - $Credential, - - [Parameter()] - [System.Management.Automation.PSCredential] - $UnjoinCredential, - - [Parameter()] - [System.String] - $WorkGroupName - ) - - Assert-DomainOrWorkGroup -DomainName $DomainName -WorkGroupName $WorkGroupName - - if ($Name -eq 'localhost') - { - $Name = $env:COMPUTERNAME - } - - if ($Credential) - { - if ($DomainName) - { - if ($DomainName -eq (Get-ComputerDomain)) - { - # Rename the computer, but stay joined to the domain. - Rename-Computer -NewName $Name -DomainCredential $Credential -Force - Write-Verbose -Message "Renamed computer to '$($Name)'." - } - else - { - if ($Name -ne $env:COMPUTERNAME) - { - # Rename the computer, and join it to the domain. - if ($UnjoinCredential) - { - Add-Computer -DomainName $DomainName -Credential $Credential -NewName $Name -UnjoinDomainCredential $UnjoinCredential -Force - } - else - { - if ($JoinOU) - { - Add-Computer -DomainName $DomainName -Credential $Credential -NewName $Name -OUPath $JoinOU -Force - } - else - { - Add-Computer -DomainName $DomainName -Credential $Credential -NewName $Name -Force - } - } - Write-Verbose -Message "Renamed computer to '$($Name)' and added to the domain '$($DomainName)." - } - else - { - # Same computer name, and join it to the domain. - if ($UnjoinCredential) - { - Add-Computer -DomainName $DomainName -Credential $Credential -UnjoinDomainCredential $UnjoinCredential -Force - } - else - { - if ($JoinOU) - { - Add-Computer -DomainName $DomainName -Credential $Credential -OUPath $JoinOU -Force - } - else - { - Add-Computer -DomainName $DomainName -Credential $Credential -Force - } - } - Write-Verbose -Message "Added computer to domain '$($DomainName)." - } - } - } - elseif ($WorkGroupName) - { - if ($WorkGroupName -eq (Get-CimInstance -Class 'Win32_ComputerSystem').Workgroup) - { - # Rename the computer, but stay in the same workgroup. - Rename-Computer -NewName $Name - Write-Verbose -Message "Renamed computer to '$($Name)'." - } - else - { - if ($Name -ne $env:COMPUTERNAME) - { - # Rename the computer, and join it to the workgroup. - Add-Computer -NewName $Name -Credential $Credential -WorkgroupName $WorkGroupName -Force - Write-Verbose -Message "Renamed computer to '$($Name)' and addded to workgroup '$($WorkGroupName)'." - } - else - { - # Same computer name, and join it to the workgroup. - Add-Computer -WorkGroupName $WorkGroupName -Credential $Credential -Force - Write-Verbose -Message "Added computer to workgroup '$($WorkGroupName)'." - } - } - } - elseif ($Name -ne $env:COMPUTERNAME) - { - if (Get-ComputerDomain) - { - Rename-Computer -NewName $Name -DomainCredential $Credential -Force - Write-Verbose -Message "Renamed computer to '$($Name)'." - } - else - { - Rename-Computer -NewName $Name -Force - Write-Verbose -Message "Renamed computer to '$($Name)'." - } - } - } - else - { - if ($DomainName) - { - throw 'Missing domain join credentials.' - } - if ($WorkGroupName) - { - - if ($WorkGroupName -eq (Get-CimInstance -Class 'Win32_ComputerSystem').Workgroup) - { - # Same workgroup, new computer name - Rename-Computer -NewName $Name -force - Write-Verbose -Message "Renamed computer to '$($Name)'." - } - else - { - if ($name -ne $env:COMPUTERNAME) - { - # New workgroup, new computer name - Add-Computer -WorkgroupName $WorkGroupName -NewName $Name - Write-Verbose -Message "Renamed computer to '$($Name)' and added to workgroup '$($WorkGroupName)'." - } - else - { - # New workgroup, same computer name - Add-Computer -WorkgroupName $WorkGroupName - Write-Verbose -Message "Added computer to workgroup '$($WorkGroupName)'." - } - } - } - else - { - if ($Name -ne $env:COMPUTERNAME) - { - Rename-Computer -NewName $Name - Write-Verbose -Message "Renamed computer to '$($Name)'." - } - } - } - - $global:DSCMachineStatus = 1 -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateLength(1, 15)] - [ValidateScript( {$_ -inotmatch '[\/\\:*?"<>|]' })] - [System.String] - $Name, - - [Parameter()] - [System.String] - $JoinOU, - - [Parameter()] - [System.Management.Automation.PSCredential] - $Credential, - - [Parameter()] - [System.Management.Automation.PSCredential] - $UnjoinCredential, - - [Parameter()] - [System.String] - $DomainName, - - [Parameter()] - [System.String] - $WorkGroupName - ) - - Write-Verbose -Message 'Validate desired Name is a valid name' - - Write-Verbose -Message 'Checking if computer name is correct' - if (($Name -ne 'localhost') -and ($Name -ne $env:COMPUTERNAME)) - { - return $false - } - - Assert-DomainOrWorkGroup -DomainName $DomainName -WorkGroupName $WorkGroupName - - if ($DomainName) - { - if (-not ($Credential)) - { - throw 'Need to specify credentials with domain' - } - - try - { - Write-Verbose "Checking if the machine is a member of $DomainName." - - if ($DomainName.Contains('.')) - { - $getComputerDomainParameters = @{ - netbios = $false - } - } - else - { - $getComputerDomainParameters = @{ - netbios = $true - } - } - - return ($DomainName -eq (Get-ComputerDomain @getComputerDomainParameters)) - } - catch - { - Write-Verbose 'The machine is not a domain member.' - - return $false - } - } - elseif ($WorkGroupName) - { - Write-Verbose -Message "Checking if workgroup name is $WorkGroupName" - - return ($WorkGroupName -eq (Get-CimInstance -Class 'Win32_ComputerSystem').Workgroup) - } - else - { - # No Domain or Workgroup specified and computer name is correct - return $true - } -} - -function Assert-DomainOrWorkGroup($DomainName, $WorkGroupName) -{ - if ($DomainName -and $WorkGroupName) - { - throw 'Only DomainName or WorkGroupName can be specified at once.' - } -} - -function Get-ComputerDomain -{ - [CmdletBinding()] - param - ( - [Parameter()] - [Switch] - $NetBios - ) - - try - { - if ($NetBios) - { - $domainName = $ENV:USERDOMAIN - } - else - { - $domainName = ([System.DirectoryServices.ActiveDirectory.Domain]::GetComputerDomain()).Name - } - return $domainName - } - catch [System.Management.Automation.MethodInvocationException] - { - Write-Debug 'This machine is not a domain member.' - } -} - -function Get-ComputerOU -{ - $ou = $null - - if (Get-ComputerDomain) - { - $dn = $null - $dn = ([adsisearcher]"(&(objectCategory=computer)(objectClass=computer)(cn=$env:COMPUTERNAME))").FindOne().Properties.distinguishedname - $ou = $dn -replace '^(CN=.*?(?<=,))', '' - } - - return $ou -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xComputer/MSFT_xComputer.schema.mof b/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xComputer/MSFT_xComputer.schema.mof deleted file mode 100644 index 44bc6b97..00000000 --- a/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xComputer/MSFT_xComputer.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ -[ClassVersion("1.0.1.0"), FriendlyName("xComputer")] -class MSFT_xComputer : OMI_BaseResource -{ - [key] string Name; - [write] string DomainName; - [write] string JoinOU; - [read] string CurrentOU; - [write,EmbeddedInstance("MSFT_Credential")] String Credential; - [write,EmbeddedInstance("MSFT_Credential")] String UnjoinCredential; - [write] string WorkGroupName; -}; diff --git a/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xOfflineDomainJoin/MSFT_xOfflineDomainJoin.psm1 b/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xOfflineDomainJoin/MSFT_xOfflineDomainJoin.psm1 deleted file mode 100644 index 820f4925..00000000 --- a/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xOfflineDomainJoin/MSFT_xOfflineDomainJoin.psm1 +++ /dev/null @@ -1,224 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidGlobalVars", "", Scope="Function")] -param -( -) - -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` - -ChildPath 'CommonResourceHelper.psm1') -$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_xOfflineDomainJoin' - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [System.String] - $IsSingleInstance, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $RequestFile - ) - - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($script:localizedData.GettingOfflineDomainJoinMessage) - ) -join '') - - <# - It is not possible to read the ODJ file that was used to join a domain - So it has to always be returned as blank. - #> - $returnValue = @{ - IsSingleInstance = 'Yes' - RequestFile = '' - } - - return $returnValue -} # Get-TargetResource - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [System.String] - $IsSingleInstance, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $RequestFile - ) - - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($script:localizedData.ApplyingOfflineDomainJoinMessage) - ) -join '') - - # Check the ODJ Request file exists - if (-not (Test-Path -Path $RequestFile)) - { - $errorId = 'RequestFileNotFoundError' - $errorCategory = [System.Management.Automation.ErrorCategory]::ObjectNotFound - $errorMessage = $($script:localizedData.RequestFileNotFoundError) ` - -f $RequestFile - $exception = New-Object -TypeName System.ArgumentException ` - -ArgumentList $errorMessage - $errorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord ` - -ArgumentList $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord) - } # if - - <# - Don't need to check if the domain is already joined because - Set-TargetResource wouldn't fire unless it wasn't. - #> - Join-Domain -RequestFile $RequestFile -} # Set-TargetResource - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [System.String] - $IsSingleInstance, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $RequestFile - ) - - # Flag to signal whether settings are correct - [System.Boolean] $desiredConfigurationMatch = $true - - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($script:localizedData.CheckingOfflineDomainJoinMessage) - ) -join '') - - # Check the ODJ Request file exists - if (-not (Test-Path -Path $RequestFile)) - { - $errorId = 'RequestFileNotFoundError' - $errorCategory = [System.Management.Automation.ErrorCategory]::ObjectNotFound - $errorMessage = $($script:localizedData.RequestFileNotFoundError) ` - -f $RequestFile - $exception = New-Object -TypeName System.ArgumentException ` - -ArgumentList $errorMessage - $errorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord ` - -ArgumentList $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord) - } # if - - $CurrentDomainName = Get-DomainName - - if($CurrentDomainName) - { - # Domain is already joined. - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($script:localizedData.DomainAlreadyJoinedMessage) ` - -f $CurrentDomainName ` - ) -join '' ) - } - else - { - # Domain is not joined, so change is required. - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($script:localizedData.DomainNotJoinedMessage) - ) -join '') - - $desiredConfigurationMatch = $false - } # if - return $desiredConfigurationMatch -} # Test-TargetResource - -<# - .SYNOPSIS - Uses DJoin.exe to join a Domain using a ODJ Request File. -#> -function Join-Domain { - [CmdletBinding()] - param( - [Parameter(Mandatory=$true)] - [System.String] - $RequestFile - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($script:localizedData.AttemptingDomainJoinMessage) ` - -f $RequestFile ` - ) -join '' ) - - $Result = & djoin.exe @( - '/REQUESTODJ' - '/LOADFILE' - $RequestFile - '/WINDOWSPATH' - $ENV:SystemRoot - '/LOCALOS') - - if ($LASTEXITCODE -eq 0) - { - # Notify DSC that a reboot is required. - $global:DSCMachineStatus = 1 - } - else - { - Write-Verbose -Message $Result - - $errorId = 'DjoinError' - $errorCategory = [System.Management.Automation.ErrorCategory]::ObjectNotFound - $errorMessage = $($script:localizedData.DjoinError) ` - -f $LASTEXITCODE - $exception = New-Object -TypeName System.ArgumentException ` - -ArgumentList $errorMessage - $errorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord ` - -ArgumentList $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord) - } # if - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($script:localizedData.DomainJoinedMessage) ` - -f $RequestFile ` - ) -join '' ) -} # function Join-Domain - -<# - .SYNOPSIS - Returns the name of the Domain the computer is joined to or - $null if not domain joined. -#> -function Get-DomainName -{ - [CmdletBinding()] - [OutputType([System.String])] - param() - - # Use CIM to detect the domain name so that this will work on Nano Server. - $computerSystem = Get-CimInstance -ClassName 'Win32_ComputerSystem' -Namespace root\cimv2 - if ($computerSystem.Workgroup) - { - return $null - } - else - { - $computerSystem.Domain - } -} # function Get-DomainName - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xOfflineDomainJoin/MSFT_xOfflineDomainJoin.schema.mof b/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xOfflineDomainJoin/MSFT_xOfflineDomainJoin.schema.mof deleted file mode 100644 index 2ffc8b06..00000000 --- a/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xOfflineDomainJoin/MSFT_xOfflineDomainJoin.schema.mof +++ /dev/null @@ -1,6 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xOfflineDomainJoin")] -class MSFT_xOfflineDomainJoin : OMI_BaseResource -{ - [Key, Description("Specifies the resource is a single instance, the value must be 'Yes'"), ValueMap{"Yes"}, Values{"Yes"}] String IsSingleInstance; - [Required, Description("The full path to the Offline Domain Join Request file to use.")] String RequestFile; -}; diff --git a/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xOfflineDomainJoin/en-us/MSFT_xOfflineDomainJoin.strings.psd1 b/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xOfflineDomainJoin/en-us/MSFT_xOfflineDomainJoin.strings.psd1 deleted file mode 100644 index 75a4c4ee..00000000 --- a/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xOfflineDomainJoin/en-us/MSFT_xOfflineDomainJoin.strings.psd1 +++ /dev/null @@ -1,11 +0,0 @@ -ConvertFrom-StringData @' - GettingOfflineDomainJoinMessage=Getting the Offline Domain Join State. - ApplyingOfflineDomainJoinMessage=Applying the Offline Domain Join State. - AttemptingDomainJoinMessage=Attempting domain join using ODJ Request file '{0}'. - DomainJoinedMessage=Domain joined using ODJ Request file '{0}'. Reboot will be required. - CheckingOfflineDomainJoinMessage=Checking the Offline Domain Join State. - DomainAlreadyJoinedMessage=The computer is already joined to a domain '{0}'. Change not required. - DomainNotJoinedMessage=The computer is not joined to a domain. Change required. - RequestFileNotFoundError=The ODJ Request file '{0}' does not exist. - DjoinError=Error {0} occured requesting the Offline Domain Join. -'@ diff --git a/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xPowerPlan/MSFT_xPowerPlan.psm1 b/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xPowerPlan/MSFT_xPowerPlan.psm1 deleted file mode 100644 index f94c5561..00000000 --- a/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xPowerPlan/MSFT_xPowerPlan.psm1 +++ /dev/null @@ -1,176 +0,0 @@ -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` - -ChildPath 'CommonResourceHelper.psm1') -$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_xPowerPlan' - -<# - .SYNOPSIS - Returns the current state of the power plan. - - .PARAMETER IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes'. - - .PARAMETER Name - Specifies the name of the power plan to assign to the node. - - .EXAMPLE - Get-TargetResource -IsSingleInstance 'Yes' -Name 'High performance' -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - # This is best practice when writing a single-instance DSC resource. - [Parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [System.String] - $IsSingleInstance, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name - ) - - $arguments = @{ - Name = 'root\cimv2\power' - Class = 'Win32_PowerPlan' - Filter = "ElementName = '$Name'" - } - - try - { - $plan = Get-CimInstance @arguments - } - catch - { - throw ($script:localizedData.PowerPlanCIMError -f $($arguments.Class) ) - } - - if ($plan) - { - if ($plan.IsActive) - { - Write-Verbose -Message ($script:localizedData.PowerPlanIsActive -f $Name) - $activePlanName = $Name - } - else - { - Write-Verbose -Message ($script:localizedData.PowerPlanIsNotActive -f $Name) - $activePlanName = $null - } - } - else - { - throw ($script:localizedData.PowerPlanNotFound -f $Name) - } - - return @{ - IsSingleInstance = $IsSingleInstance - Name = $activePlanName - } -} - -<# - .SYNOPSIS - Assign the power plan to the node. - - .PARAMETER IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes'. - - .PARAMETER Name - Specifies the name of the power plan to assign to the node. - - .EXAMPLE - Set-TargetResource -IsSingleInstance 'Yes' -Name 'High performance' -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - # This is best practice when writing a single-instance DSC resource. - [Parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [System.String] - $IsSingleInstance, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name - ) - - Write-Verbose -Message ($script:localizedData.PowerPlanIsBeingActivated -f $Name) - - $arguments = @{ - Name = 'root\cimv2\power' - Class = 'Win32_PowerPlan' - Filter = "ElementName = '$Name'" - } - - try - { - $plan = Get-CimInstance @arguments - } - catch - { - throw ($script:localizedData.PowerPlanCIMError -f $($arguments.Class) ) - } - - try - { - $plan | Invoke-CimMethod -MethodName Activate - } - catch - { - throw ($script:localizedData.PowerPlanWasUnableToBeSet -f $Name, $($_.Exception.Message)) - } -} - -<# - .SYNOPSIS - Tests if the power plan is assigned to the node. - - .PARAMETER IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes'. - - .PARAMETER Name - Specifies the name of the power plan to assign to the node. - - .EXAMPLE - Test-TargetResource -IsSingleInstance 'Yes' -Name 'High performance' -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - # This is best practice when writing a single-instance DSC resource. - [Parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [System.String] - $IsSingleInstance, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name - ) - - $returnValue = $false - - Write-Verbose -Message ($script:localizedData.PowerPlanIsBeingValidated -f $Name) - - $getTargetResourceResult = Get-TargetResource -IsSingleInstance $IsSingleInstance -Name $Name - if ($getTargetResourceResult.Name -eq $Name) - { - $returnValue = $true - } - - return $returnValue -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xPowerPlan/MSFT_xPowerPlan.schema.mof b/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xPowerPlan/MSFT_xPowerPlan.schema.mof deleted file mode 100644 index 1bc57781..00000000 --- a/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xPowerPlan/MSFT_xPowerPlan.schema.mof +++ /dev/null @@ -1,6 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xPowerPlan")] -class MSFT_xPowerPlan : OMI_BaseResource -{ - [Key, Description("Specifies the resource is a single instance, the value must be 'Yes'"), ValueMap{"Yes"}, Values{"Yes"}] String IsSingleInstance; - [Required, Description("The name of the power plan to activate.")] String Name; -}; diff --git a/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xPowerPlan/en-US/MSFT_xPowerPlan.schema.mfl b/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xPowerPlan/en-US/MSFT_xPowerPlan.schema.mfl deleted file mode 100644 index 7151bc9d..00000000 --- a/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xPowerPlan/en-US/MSFT_xPowerPlan.schema.mfl +++ /dev/null @@ -1,6 +0,0 @@ -[Description("This resource is used to activate a power plan.") : Amended,AMENDMENT, LOCALE("MS_409")] -class MSFT_xPowerPlan : OMI_BaseResource -{ - [Key, Description("Specifies the resource is a single instance, the value must be 'Yes'") : Amended] String IsSingleInstance; - [Description("The name of the power plan to activate.") : Amended] String Name; -}; diff --git a/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xPowerPlan/en-US/MSFT_xPowerPlan.strings.psd1 b/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xPowerPlan/en-US/MSFT_xPowerPlan.strings.psd1 deleted file mode 100644 index 88dda318..00000000 --- a/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xPowerPlan/en-US/MSFT_xPowerPlan.strings.psd1 +++ /dev/null @@ -1,11 +0,0 @@ -# Localized resources for WindowsOptionalFeature - -ConvertFrom-StringData @' - PowerPlanIsActive = The power plan '{0}' is the active plan. - PowerPlanIsNotActive = The power plan '{0}' is not the active plan. - PowerPlanNotFound = Unable to find the power plan '{0}'. - PowerPlanIsBeingActivated = Activating power plan '{0}' - PowerPlanIsBeingValidated = Validating power plan '{0}' - PowerPlanWasUnableToBeSet = Unable to set the power plan '{0}' to the active plan. Error message: {1} - PowerPlanCIMError = Could not get the Common Information Model (CIM) instances of class {0} -'@ diff --git a/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xScheduledTask/MSFT_xScheduledTask.psm1 b/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xScheduledTask/MSFT_xScheduledTask.psm1 deleted file mode 100644 index 1d3c4f0e..00000000 --- a/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xScheduledTask/MSFT_xScheduledTask.psm1 +++ /dev/null @@ -1,1361 +0,0 @@ -Add-Type -TypeDefinition @' -namespace xScheduledTask -{ - public enum DaysOfWeek - { - Sunday = 1, - Monday = 2, - Tuesday = 4, - Wednesday = 8, - Thursday = 16, - Friday = 32, - Saturday = 64 - } -} -'@ - -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -ChildPath 'CommonResourceHelper.psm1') - -<# -.SYNOPSIS - Gets the current resource state -.PARAMETER TaskName - The name of the task -.PARAMETER TaskPath - The path to the task - defaults to the root directory -.PARAMETER Description - The task description -.PARAMETER ActionExecutable - The path to the .exe for this task -.PARAMETER ActionArguments - The arguments to pass the executable -.PARAMETER ActionWorkingPath - The working path to specify for the executable -.PARAMETER ScheduleType - When should the task be executed -.PARAMETER RepeatInterval - How many units (minutes, hours, days) between each run of this task? -.PARAMETER StartTime - The time of day this task should start at - defaults to 12:00 AM. Not valid for AtLogon and AtStartup tasks -.PARAMETER Ensure - Present if the task should exist, Absent if it should be removed -.PARAMETER Enable - True if the task should be enabled, false if it should be disabled -.PARAMETER ExecuteAsCredential - The credential this task should execute as. If not specified defaults to running as the local system account -.PARAMETER DaysInterval - Specifies the interval between the days in the schedule. An interval of 1 produces a daily schedule. An interval of 2 produces an every-other day schedule. -.PARAMETER RandomDelay - Specifies a random amount of time to delay the start time of the trigger. The delay time is a random time between the time the task triggers and the time that you specify in this setting. -.PARAMETER RepetitionDuration - Specifies how long the repetition pattern repeats after the task starts. -.PARAMETER DaysOfWeek - Specifies an array of the days of the week on which Task Scheduler runs the task. -.PARAMETER WeeksInterval - Specifies the interval between the weeks in the schedule. An interval of 1 produces a weekly schedule. An interval of 2 produces an every-other week schedule. -.PARAMETER User - Specifies the identifier of the user for a trigger that starts a task when a user logs on. -.PARAMETER DisallowDemandStart - Indicates whether the task is prohibited to run on demand or not. Defaults to $false -.PARAMETER DisallowHardTerminate - Indicates whether the task is prohibited to be terminated or not. Defaults to $false -.PARAMETER Compatibility - The task compatibility level. Defaults to Vista. -.PARAMETER AllowStartIfOnBatteries - Indicates whether the task should start if the machine is on batteries or not. Defaults to $false -.PARAMETER Hidden - Indicates that the task is hidden in the Task Scheduler UI. -.PARAMETER RunOnlyIfIdle - Indicates that Task Scheduler runs the task only when the computer is idle. -.PARAMETER IdleWaitTimeout - Specifies the amount of time that Task Scheduler waits for an idle condition to occur. -.PARAMETER NetworkName - Specifies the name of a network profile that Task Scheduler uses to determine if the task can run. - The Task Scheduler UI uses this setting for display purposes. Specify a network name if you specify the RunOnlyIfNetworkAvailable parameter. -.PARAMETER DisallowStartOnRemoteAppSession - Indicates that the task does not start if the task is triggered to run in a Remote Applications Integrated Locally (RAIL) session. -.PARAMETER StartWhenAvailable - Indicates that Task Scheduler can start the task at any time after its scheduled time has passed. -.PARAMETER DontStopIfGoingOnBatteries - Indicates that the task does not stop if the computer switches to battery power. -.PARAMETER WakeToRun - Indicates that Task Scheduler wakes the computer before it runs the task. -.PARAMETER IdleDuration - Specifies the amount of time that the computer must be in an idle state before Task Scheduler runs the task. -.PARAMETER RestartOnIdle - Indicates that Task Scheduler restarts the task when the computer cycles into an idle condition more than once. -.PARAMETER DontStopOnIdleEnd - Indicates that Task Scheduler does not terminate the task if the idle condition ends before the task is completed. -.PARAMETER ExecutionTimeLimit - Specifies the amount of time that Task Scheduler is allowed to complete the task. -.PARAMETER MultipleInstances - Specifies the policy that defines how Task Scheduler handles multiple instances of the task. -.PARAMETER Priority - Specifies the priority level of the task. Priority must be an integer from 0 (highest priority) to 10 (lowest priority). - The default value is 7. Priority levels 7 and 8 are used for background tasks. Priority levels 4, 5, and 6 are used for interactive tasks. -.PARAMETER RestartCount - Specifies the number of times that Task Scheduler attempts to restart the task. -.PARAMETER RestartInterval - Specifies the amount of time that Task Scheduler attempts to restart the task. -.PARAMETER RunOnlyIfNetworkAvailable - Indicates that Task Scheduler runs the task only when a network is available. Task Scheduler uses the NetworkID - parameter and NetworkName parameter that you specify in this cmdlet to determine if the network is available. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $TaskName, - - [Parameter()] - [System.String] - $TaskPath = '\', - - [Parameter()] - [System.String] - $Description, - - [Parameter(Mandatory = $true)] - [System.String] - $ActionExecutable, - - [Parameter()] - [System.String] - $ActionArguments, - - [Parameter()] - [System.String] - $ActionWorkingPath, - - [Parameter(Mandatory = $true)] - [System.String] - [ValidateSet('Once', 'Daily', 'Weekly', 'AtStartup', 'AtLogOn')] - $ScheduleType, - - [Parameter()] - [System.DateTime] - $RepeatInterval = [System.DateTime] '00:00:00', - - [Parameter()] - [System.DateTime] - $StartTime = [System.DateTime]::Today, - - [Parameter()] - [System.String] - [ValidateSet('Present', 'Absent')] - $Ensure = 'Present', - - [Parameter()] - [System.Boolean] - $Enable = $true, - - [Parameter()] - [System.Management.Automation.PSCredential] - $ExecuteAsCredential, - - [Parameter()] - [System.UInt32] - $DaysInterval = 1, - - [Parameter()] - [System.DateTime] - $RandomDelay = [System.DateTime] '00:00:00', - - [Parameter()] - [System.DateTime] - $RepetitionDuration = [System.DateTime] '00:00:00', - - [Parameter()] - [System.String[]] - $DaysOfWeek, - - [Parameter()] - [System.UInt32] - $WeeksInterval = 1, - - [Parameter()] - [System.String] - $User, - - [Parameter()] - [System.Boolean] - $DisallowDemandStart = $false, - - [Parameter()] - [System.Boolean] - $DisallowHardTerminate = $false, - - [Parameter()] - [ValidateSet('AT', 'V1', 'Vista', 'Win7', 'Win8')] - [System.String] - $Compatibility = 'Vista', - - [Parameter()] - [System.Boolean] - $AllowStartIfOnBatteries = $false, - - [Parameter()] - [System.Boolean] - $Hidden = $false, - - [Parameter()] - [System.Boolean] - $RunOnlyIfIdle = $false, - - [Parameter()] - [System.DateTime] - $IdleWaitTimeout = [System.DateTime] '02:00:00', - - [Parameter()] - [System.String] - $NetworkName, - - [Parameter()] - [System.Boolean] - $DisallowStartOnRemoteAppSession = $false, - - [Parameter()] - [System.Boolean] - $StartWhenAvailable = $false, - - [Parameter()] - [System.Boolean] - $DontStopIfGoingOnBatteries = $false, - - [Parameter()] - [System.Boolean] - $WakeToRun = $false, - - [Parameter()] - [System.DateTime] - $IdleDuration = [System.DateTime] '01:00:00', - - [Parameter()] - [System.Boolean] - $RestartOnIdle = $false, - - [Parameter()] - [System.Boolean] - $DontStopOnIdleEnd = $false, - - [Parameter()] - [System.DateTime] - $ExecutionTimeLimit = [System.DateTime] '8:00:00', - - [Parameter()] - [ValidateSet('IgnoreNew', 'Parallel', 'Queue')] - [System.String] - $MultipleInstances = 'Queue', - - [Parameter()] - [System.UInt32] - $Priority = 7, - - [Parameter()] - [System.UInt32] - $RestartCount = 0, - - [Parameter()] - [System.DateTime] - $RestartInterval = [System.DateTime] '00:00:00', - - [Parameter()] - [System.Boolean] - $RunOnlyIfNetworkAvailable = $false - ) - - $TaskPath = ConvertTo-NormalizedTaskPath -TaskPath $TaskPath - - Write-Verbose -Message ('Retrieving existing task ({0} in {1})' -f $TaskName, $TaskPath) - - $task = Get-ScheduledTask -TaskName $TaskName -TaskPath $TaskPath -ErrorAction SilentlyContinue - - if ($null -eq $task) - { - Write-Verbose -Message ('No task found. returning empty task {0} with Ensure = "Absent"' -f $Taskname) - return @{ - TaskName = $TaskName - ActionExecutable = $ActionExecutable - Ensure = 'Absent' - ScheduleType = $ScheduleType - } - } - else - { - Write-Verbose -Message ('Task {0} found in {1}. Retrieving settings, first action, first trigger and repetition settings' -f $TaskName, $TaskPath) - $action = $task.Actions | Select-Object -First 1 - $trigger = $task.Triggers | Select-Object -First 1 - $settings = $task.Settings - $returnScheduleType = 'Unknown' - $returnInveral = 0 - - switch ($trigger.CimClass.CimClassName) - { - 'MSFT_TaskTimeTrigger' - { - $returnScheduleType = 'Once' - break - } - 'MSFT_TaskDailyTrigger' - { - $returnScheduleType = 'Daily' - break - } - - 'MSFT_TaskWeeklyTrigger' - { - $returnScheduleType = 'Weekly' - break - } - - 'MSFT_TaskBootTrigger' - { - $returnScheduleType = 'AtStartup' - break - } - - 'MSFT_TaskLogonTrigger' - { - $returnScheduleType = 'AtLogon' - break - } - - default - { - New-InvalidArgumentException -Message "Trigger type $_ not recognized." -ArgumentName CimClassName - } - } - - Write-Verbose -Message ('Detected schedule type {0} for first trigger' -f $returnScheduleType) - - Write-Verbose -Message 'Calculating timespans/datetimes from trigger repetition settings' - - $repInterval = $trigger.Repetition.Interval - $Days = $Hours = $Minutes = $Seconds = 0 - - if ($repInterval -match 'P(?\d{0,3})D') - { - $Days = $matches.Days - } - - if ($repInterval -match '(?\d{0,2})H') - { - $Hours = $matches.Hours - } - - if ($repInterval -match '(?\d{0,2})M') - { - $Minutes = $matches.Minutes - } - - if ($repInterval -match '(?\d{0,2})S') - { - $Seconds = $matches.Seconds - } - - $returnInveral = New-TimeSpan -Days $Days -Hours $Hours -Minutes $Minutes -Seconds $seconds - - $repDuration = $trigger.Repetition.Duration - $Days = $Hours = $Minutes = $Seconds = 0 - - if ($repDuration -match 'P(?\d{0,3})D') - { - $Days = $matches.Days - } - - if ($repDuration -match '(?\d{0,2})H') - { - $Hours = $matches.Hours - } - - if ($repDuration -match '(?\d{0,2})M') - { - $Minutes = $matches.Minutes - } - - if ($repDuration -match '(?\d{0,2})S') - { - $Seconds = $matches.Seconds - } - - $repetitionDurationReturn = New-TimeSpan -Days $Days -Hours $Hours -Minutes $Minutes -Seconds $seconds - - $resInterval = $settings.RestartInterval - $Days = $Hours = $Minutes = $Seconds = 0 - - if ($resInterval -match 'P(?\d{0,3})D') - { - $Days = $matches.Days - } - - if ($resInterval -match '(?\d{0,2})H') - { - $Hours = $matches.Hours - } - - if ($resInterval -match '(?\d{0,2})M') - { - $Minutes = $matches.Minutes - } - - if ($resInterval -match '(?\d{0,2})S') - { - $Seconds = $matches.Seconds - } - - $restartIntervalReturn = New-TimeSpan -Days $Days -Hours $Hours -Minutes $Minutes -Seconds $seconds - - $exeLim = $settings.ExecutionTimeLimit - $Days = $Hours = $Minutes = $Seconds = 0 - - if ($exeLim -match 'P(?\d{0,3})D') - { - $Days = $matches.Days - } - - if ($exeLim -match '(?\d{0,2})H') - { - $Hours = $matches.Hours - } - - if ($exeLim -match '(?\d{0,2})M') - { - $Minutes = $matches.Minutes - } - - if ($exeLim -match '(?\d{0,2})S') - { - $Seconds = $matches.Seconds - } - - $executionTimeLimitReturn = New-TimeSpan -Days $Days -Hours $Hours -Minutes $Minutes -Seconds $seconds - - $idleDur = $settings.IdleSettings.IdleDuration - $Days = $Hours = $Minutes = $Seconds = 0 - - if ($idleDur -match 'P(?\d{0,3})D') - { - $Days = $matches.Days - } - - if ($idleDur -match '(?\d{0,2})H') - { - $Hours = $matches.Hours - } - - if ($idleDur -match '(?\d{0,2})M') - { - $Minutes = $matches.Minutes - } - - if ($idleDur -match '(?\d{0,2})S') - { - $Seconds = $matches.Seconds - } - - $idleDurationReturn = New-TimeSpan -Days $Days -Hours $Hours -Minutes $Minutes -Seconds $seconds - - $idleWait = $settings.IdleSettings.IdleWaitTimeout - $Days = $Hours = $Minutes = $Seconds = 0 - - if ($idleWait -match 'P(?\d{0,3})D') - { - $Days = $matches.Days - } - - if ($idleWait -match '(?\d{0,2})H') - { - $Hours = $matches.Hours - } - - if ($idleWait -match '(?\d{0,2})M') - { - $Minutes = $matches.Minutes - } - - if ($idleWait -match '(?\d{0,2})S') - { - $Seconds = $matches.Seconds - } - - $idleWaitTimeoutReturn = New-TimeSpan -Days $Days -Hours $Hours -Minutes $Minutes -Seconds $seconds - - $rndDelay = $trigger.RandomDelay - $Days = $Hours = $Minutes = $Seconds = 0 - - if ($rndDelay -match 'P(?\d{0,3})D') - { - $Days = $matches.Days - } - - if ($rndDelay -match '(?\d{0,2})H') - { - $Hours = $matches.Hours - } - - if ($rndDelay -match '(?\d{0,2})M') - { - $Minutes = $matches.Minutes - } - - if ($rndDelay -match '(?\d{0,2})S') - { - $Seconds = $matches.Seconds - } - - $randomDelayReturn = New-TimeSpan -Days $Days -Hours $Hours -Minutes $Minutes -Seconds $seconds - - $DaysOfWeek = @() - foreach ($binaryAdductor in 1, 2, 4, 8, 16, 32, 64) - { - $Day = $trigger.DaysOfWeek -band $binaryAdductor - if ($Day -ne 0) - { - $DaysOfWeek += [xScheduledTask.DaysOfWeek] $Day - } - } - - $startAt = $trigger.StartBoundary - - if ($startAt) - { - $startAt = [System.DateTime] $startAt - } - else - { - $startAt = $StartTime - } - - return @{ - TaskName = $task.TaskName - TaskPath = $task.TaskPath - StartTime = $startAt - Ensure = 'Present' - Description = $task.Description - ActionExecutable = $action.Execute - ActionArguments = $action.Arguments - ActionWorkingPath = $action.WorkingDirectory - ScheduleType = $returnScheduleType - RepeatInterval = [System.DateTime]::Today.Add($returnInveral) - ExecuteAsCredential = $task.Principal.UserId - Enable = $settings.Enabled - DaysInterval = $trigger.DaysInterval - RandomDelay = [System.DateTime]::Today.Add($randomDelayReturn) - RepetitionDuration = [System.DateTime]::Today.Add($repetitionDurationReturn) - DaysOfWeek = $DaysOfWeek - WeeksInterval = $trigger.WeeksInterval - User = $task.Principal.UserId - DisallowDemandStart = -not $settings.AllowDemandStart - DisallowHardTerminate = -not $settings.AllowHardTerminate - Compatibility = $settings.Compatibility - AllowStartIfOnBatteries = -not $settings.DisallowStartIfOnBatteries - Hidden = $settings.Hidden - RunOnlyIfIdle = $settings.RunOnlyIfIdle - IdleWaitTimeout = $idleWaitTimeoutReturn - NetworkName = $settings.NetworkSettings.Name - DisallowStartOnRemoteAppSession = $settings.DisallowStartOnRemoteAppSession - StartWhenAvailable = $settings.StartWhenAvailable - DontStopIfGoingOnBatteries = -not $settings.StopIfGoingOnBatteries - WakeToRun = $settings.WakeToRun - IdleDuration = [System.DateTime]::Today.Add($idleDurationReturn) - RestartOnIdle = $settings.IdleSettings.RestartOnIdle - DontStopOnIdleEnd = -not $settings.IdleSettings.StopOnIdleEnd - ExecutionTimeLimit = [System.DateTime]::Today.Add($executionTimeLimitReturn) - MultipleInstances = $settings.MultipleInstances - Priority = $settings.Priority - RestartCount = $settings.RestartCount - RestartInterval = [System.DateTime]::Today.Add($restartIntervalReturn) - RunOnlyIfNetworkAvailable = $settings.RunOnlyIfNetworkAvailable - } - } -} - -<# -.SYNOPSIS - Applies the desired resource state -.PARAMETER TaskName - The name of the task -.PARAMETER TaskPath - The path to the task - defaults to the root directory -.PARAMETER Description - The task description -.PARAMETER ActionExecutable - The path to the .exe for this task -.PARAMETER ActionArguments - The arguments to pass the executable -.PARAMETER ActionWorkingPath - The working path to specify for the executable -.PARAMETER ScheduleType - When should the task be executed -.PARAMETER RepeatInterval - How many units (minutes, hours, days) between each run of this task? -.PARAMETER StartTime - The time of day this task should start at - defaults to 12:00 AM. Not valid for AtLogon and AtStartup tasks -.PARAMETER Ensure - Present if the task should exist, Absent if it should be removed -.PARAMETER Enable - True if the task should be enabled, false if it should be disabled -.PARAMETER ExecuteAsCredential - The credential this task should execute as. If not specified defaults to running as the local system account -.PARAMETER DaysInterval - Specifies the interval between the days in the schedule. An interval of 1 produces a daily schedule. An interval of 2 produces an every-other day schedule. -.PARAMETER RandomDelay - Specifies a random amount of time to delay the start time of the trigger. The delay time is a random time between the time the task triggers and the time that you specify in this setting. -.PARAMETER RepetitionDuration - Specifies how long the repetition pattern repeats after the task starts. -.PARAMETER DaysOfWeek - Specifies an array of the days of the week on which Task Scheduler runs the task. -.PARAMETER WeeksInterval - Specifies the interval between the weeks in the schedule. An interval of 1 produces a weekly schedule. An interval of 2 produces an every-other week schedule. -.PARAMETER User - Specifies the identifier of the user for a trigger that starts a task when a user logs on. -.PARAMETER DisallowDemandStart - Indicates whether the task is prohibited to run on demand or not. Defaults to $false -.PARAMETER DisallowHardTerminate - Indicates whether the task is prohibited to be terminated or not. Defaults to $false -.PARAMETER Compatibility - The task compatibility level. Defaults to Vista. -.PARAMETER AllowStartIfOnBatteries - Indicates whether the task should start if the machine is on batteries or not. Defaults to $false -.PARAMETER Hidden - Indicates that the task is hidden in the Task Scheduler UI. -.PARAMETER RunOnlyIfIdle - Indicates that Task Scheduler runs the task only when the computer is idle. -.PARAMETER IdleWaitTimeout - Specifies the amount of time that Task Scheduler waits for an idle condition to occur. -.PARAMETER NetworkName - Specifies the name of a network profile that Task Scheduler uses to determine if the task can run. - The Task Scheduler UI uses this setting for display purposes. Specify a network name if you specify the RunOnlyIfNetworkAvailable parameter. -.PARAMETER DisallowStartOnRemoteAppSession - Indicates that the task does not start if the task is triggered to run in a Remote Applications Integrated Locally (RAIL) session. -.PARAMETER StartWhenAvailable - Indicates that Task Scheduler can start the task at any time after its scheduled time has passed. -.PARAMETER DontStopIfGoingOnBatteries - Indicates that the task does not stop if the computer switches to battery power. -.PARAMETER WakeToRun - Indicates that Task Scheduler wakes the computer before it runs the task. -.PARAMETER IdleDuration - Specifies the amount of time that the computer must be in an idle state before Task Scheduler runs the task. -.PARAMETER RestartOnIdle - Indicates that Task Scheduler restarts the task when the computer cycles into an idle condition more than once. -.PARAMETER DontStopOnIdleEnd - Indicates that Task Scheduler does not terminate the task if the idle condition ends before the task is completed. -.PARAMETER ExecutionTimeLimit - Specifies the amount of time that Task Scheduler is allowed to complete the task. -.PARAMETER MultipleInstances - Specifies the policy that defines how Task Scheduler handles multiple instances of the task. -.PARAMETER Priority - Specifies the priority level of the task. Priority must be an integer from 0 (highest priority) to 10 (lowest priority). - The default value is 7. Priority levels 7 and 8 are used for background tasks. Priority levels 4, 5, and 6 are used for interactive tasks. -.PARAMETER RestartCount - Specifies the number of times that Task Scheduler attempts to restart the task. -.PARAMETER RestartInterval - Specifies the amount of time that Task Scheduler attempts to restart the task. -.PARAMETER RunOnlyIfNetworkAvailable - Indicates that Task Scheduler runs the task only when a network is available. Task Scheduler uses the NetworkID - parameter and NetworkName parameter that you specify in this cmdlet to determine if the network is available. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $TaskName, - - [Parameter()] - [System.String] - $TaskPath = '\', - - [Parameter()] - [System.String] - $Description, - - [Parameter(Mandatory = $true)] - [System.String] - $ActionExecutable, - - [Parameter()] - [System.String] - $ActionArguments, - - [Parameter()] - [System.String] - $ActionWorkingPath, - - [Parameter(Mandatory = $true)] - [System.String] - [ValidateSet('Once', 'Daily', 'Weekly', 'AtStartup', 'AtLogOn')] - $ScheduleType, - - [Parameter()] - [System.DateTime] - $RepeatInterval = [System.DateTime] '00:00:00', - - [Parameter()] - [System.DateTime] - $StartTime = [System.DateTime]::Today, - - [Parameter()] - [System.String] - [ValidateSet('Present', 'Absent')] - $Ensure = 'Present', - - [Parameter()] - [System.Boolean] - $Enable = $true, - - [Parameter()] - [System.Management.Automation.PSCredential] - $ExecuteAsCredential, - - [Parameter()] - [System.UInt32] - $DaysInterval = 1, - - [Parameter()] - [System.DateTime] - $RandomDelay = [System.DateTime] '00:00:00', - - [Parameter()] - [System.DateTime] - $RepetitionDuration = [System.DateTime] '00:00:00', - - [Parameter()] - [System.String[]] - $DaysOfWeek, - - [Parameter()] - [System.UInt32] - $WeeksInterval = 1, - - [Parameter()] - [System.String] - $User, - - [Parameter()] - [System.Boolean] - $DisallowDemandStart = $false, - - [Parameter()] - [System.Boolean] - $DisallowHardTerminate = $false, - - [Parameter()] - [ValidateSet('AT', 'V1', 'Vista', 'Win7', 'Win8')] - [System.String] - $Compatibility = 'Vista', - - [Parameter()] - [System.Boolean] - $AllowStartIfOnBatteries = $false, - - [Parameter()] - [System.Boolean] - $Hidden = $false, - - [Parameter()] - [System.Boolean] - $RunOnlyIfIdle = $false, - - [Parameter()] - [System.DateTime] - $IdleWaitTimeout = [System.DateTime] '02:00:00', - - [Parameter()] - [System.String] - $NetworkName, - - [Parameter()] - [System.Boolean] - $DisallowStartOnRemoteAppSession = $false, - - [Parameter()] - [System.Boolean] - $StartWhenAvailable = $false, - - [Parameter()] - [System.Boolean] - $DontStopIfGoingOnBatteries = $false, - - [Parameter()] - [System.Boolean] - $WakeToRun = $false, - - [Parameter()] - [System.DateTime] - $IdleDuration = [System.DateTime] '01:00:00', - - [Parameter()] - [System.Boolean] - $RestartOnIdle = $false, - - [Parameter()] - [System.Boolean] - $DontStopOnIdleEnd = $false, - - [Parameter()] - [System.DateTime] - $ExecutionTimeLimit = [System.DateTime] '8:00:00', - - [Parameter()] - [ValidateSet('IgnoreNew', 'Parallel', 'Queue')] - [System.String] - $MultipleInstances = 'Queue', - - [Parameter()] - [System.UInt32] - $Priority = 7, - - [Parameter()] - [System.UInt32] - $RestartCount = 0, - - [Parameter()] - [System.DateTime] - $RestartInterval = [System.DateTime] '00:00:00', - - [Parameter()] - [System.Boolean] - $RunOnlyIfNetworkAvailable = $false - ) - - $TaskPath = ConvertTo-NormalizedTaskPath -TaskPath $TaskPath - - Write-Verbose -Message ('Entering Set-TargetResource for {0} in {1}' -f $TaskName, $TaskPath) - $currentValues = Get-TargetResource @PSBoundParameters - - if ($Ensure -eq 'Present') - { - if ($RepetitionDuration.TimeOfDay -lt $RepeatInterval.TimeOfDay) - { - $exceptionMessage = 'Repetition duration {0} is less than repetition interval {1}. Please set RepeatInterval to a value lower or equal to RepetitionDuration' -f $RepetitionDuration.TimeOfDay, $RepeatInterval.TimeOfDay - New-InvalidArgumentException -Message $exceptionMessage -ArgumentName RepeatInterval - } - - if ($ScheduleType -eq 'Daily' -and $DaysInterval -eq 0) - { - $exceptionMessage = 'Schedules of the type Daily must have a DaysInterval greater than 0 (value entered: {0})' -f $DaysInterval - New-InvalidArgumentException -Message $exceptionMessage -ArgumentName DaysInterval - } - - if ($ScheduleType -eq 'Weekly' -and $WeeksInterval -eq 0) - { - $exceptionMessage = 'Schedules of the type Weekly must have a WeeksInterval greater than 0 (value entered: {0})' -f $WeeksInterval - New-InvalidArgumentException -Message $exceptionMessage -ArgumentName WeeksInterval - } - - if ($ScheduleType -eq 'Weekly' -and $DaysOfWeek.Count -eq 0) - { - $exceptionMessage = 'Schedules of the type Weekly must have at least one weekday selected' - New-InvalidArgumentException -Message $exceptionMessage -ArgumentName DaysOfWeek - } - - $actionArgs = @{ - Execute = $ActionExecutable - } - - if ($ActionArguments) - { - $actionArgs.Add('Argument', $ActionArguments) - } - - if ($ActionWorkingPath) - { - $actionArgs.Add('WorkingDirectory', $ActionWorkingPath) - } - - $action = New-ScheduledTaskAction @actionArgs - - $settingArgs = @{ - DisallowDemandStart = $DisallowDemandStart - DisallowHardTerminate = $DisallowHardTerminate - Compatibility = $Compatibility - AllowStartIfOnBatteries = $AllowStartIfOnBatteries - Disable = -not $Enable - Hidden = $Hidden - RunOnlyIfIdle = $RunOnlyIfIdle - DisallowStartOnRemoteAppSession = $DisallowStartOnRemoteAppSession - StartWhenAvailable = $StartWhenAvailable - DontStopIfGoingOnBatteries = $DontStopIfGoingOnBatteries - WakeToRun = $WakeToRun - RestartOnIdle = $RestartOnIdle - DontStopOnIdleEnd = $DontStopOnIdleEnd - MultipleInstances = $MultipleInstances - Priority = $Priority - RestartCount = $RestartCount - RunOnlyIfNetworkAvailable = $RunOnlyIfNetworkAvailable - } - - if ($IdleDuration.TimeOfDay -gt [System.TimeSpan] '00:00:00') - { - $settingArgs.Add('IdleDuration', $IdleDuration.TimeOfDay) - } - - if ($IdleWaitTimeout.TimeOfDay -gt [System.TimeSpan] '00:00:00') - { - $settingArgs.Add('IdleWaitTimeout', $IdleWaitTimeout.TimeOfDay) - } - - if ($ExecutionTimeLimit.TimeOfDay -gt [System.TimeSpan] '00:00:00') - { - $settingArgs.Add('ExecutionTimeLimit', $ExecutionTimeLimit.TimeOfDay) - } - - if ($RestartInterval.TimeOfDay -gt [System.TimeSpan] '00:00:00') - { - $settingArgs.Add('RestartInterval', $RestartInterval.TimeOfDay) - } - - if (-not [System.String]::IsNullOrWhiteSpace($NetworkName)) - { - $setting.Add('NetworkName', $NetworkName) - } - $setting = New-ScheduledTaskSettingsSet @settingArgs - - $triggerArgs = @{} - if ($RandomDelay.TimeOfDay -gt [System.TimeSpan]::FromSeconds(0)) - { - $triggerArgs.Add('RandomDelay', $RandomDelay.TimeOfDay) - } - - switch ($ScheduleType) - { - 'Once' - { - $triggerArgs.Add('Once', $true) - $triggerArgs.Add('At', $StartTime) - break - } - 'Daily' - { - $triggerArgs.Add('Daily', $true) - $triggerArgs.Add('At', $StartTime) - $triggerArgs.Add('DaysInterval', $DaysInterval) - break - } - 'Weekly' - { - $triggerArgs.Add('Weekly', $true) - $triggerArgs.Add('At', $StartTime) - if ($DaysOfWeek.Count -gt 0) - { - $triggerArgs.Add('DaysOfWeek', $DaysOfWeek) - } - - if ($WeeksInterval -gt 0) - { - $triggerArgs.Add('WeeksInterval', $WeeksInterval) - } - break - } - 'AtStartup' - { - $triggerArgs.Add('AtStartup', $true) - break - } - 'AtLogOn' - { - $triggerArgs.Add('AtLogOn', $true) - if (-not [System.String]::IsNullOrWhiteSpace($User)) - { - $triggerArgs.Add('User', $User) - } - break - } - } - - $trigger = New-ScheduledTaskTrigger @triggerArgs -ErrorAction SilentlyContinue - if (-not $trigger) - { - New-InvalidOperationException -Message 'Error creating new scheduled task trigger' -ErrorRecord $_ - } - - # To overcome the issue of not being able to set the task repetition for tasks with a schedule type other than Once - if ($RepeatInterval.TimeOfDay -gt (New-TimeSpan -Seconds 0) -and $PSVersionTable.PSVersion.Major -gt 4) - { - if ($RepetitionDuration.TimeOfDay -le $RepeatInterval.TimeOfDay) - { - $exceptionMessage = 'Repetition interval is set to {0} but repetition duration is {1}' -f $RepeatInterval.TimeOfDay, $RepetitionDuration.TimeOfDay - New-InvalidArgumentException -Message $exceptionMessage -ArgumentName RepetitionDuration - } - - $tempTrigger = New-ScheduledTaskTrigger -Once -At 6:6:6 -RepetitionInterval $RepeatInterval.TimeOfDay -RepetitionDuration $RepetitionDuration.TimeOfDay - Write-Verbose -Message 'PS V5 Copying values from temporary trigger to property Repetition of $trigger.Repetition' - - try - { - $trigger.Repetition = $tempTrigger.Repetition - } - catch - { - $triggerRepetitionFailed = $true - } - } - - if ($currentValues.Ensure -eq 'Present') - { - Write-Verbose -Message ('Removing previous scheduled task {0}' -f $TaskName) - $null = Unregister-ScheduledTask -TaskName $TaskName -TaskPath $TaskPath -Confirm:$false - } - - Write-Verbose -Message ('Creating new scheduled task {0}' -f $TaskName) - - $scheduledTask = New-ScheduledTask -Action $action -Trigger $trigger -Settings $setting - - if ($RepeatInterval.TimeOfDay -gt (New-TimeSpan -Seconds 0) -and ($PSVersionTable.PSVersion.Major -eq 4 -or $triggerRepetitionFailed)) - { - if ($RepetitionDuration.TimeOfDay -le $RepeatInterval.TimeOfDay) - { - $exceptionMessage = 'Repetition interval is set to {0} but repetition duration is {1}' -f $RepeatInterval.TimeOfDay, $RepetitionDuration.TimeOfDay - New-InvalidArgumentException -Message $exceptionMessage -ArgumentName RepetitionDuration - } - - $tempTrigger = New-ScheduledTaskTrigger -Once -At 6:6:6 -RepetitionInterval $RepeatInterval.TimeOfDay -RepetitionDuration $RepetitionDuration.TimeOfDay - $tempTask = New-ScheduledTask -Trigger $tempTrigger -Action $action - Write-Verbose -Message 'PS V4 Copying values from temporary trigger to property Repetition of $trigger.Repetition' - - $scheduledTask.Triggers[0].Repetition = $tempTask.Triggers[0].Repetition - } - - if (-not [System.String]::IsNullOrWhiteSpace($Description)) - { - $scheduledTask.Description = $Description - } - - $registerArgs = @{ - TaskName = $TaskName - TaskPath = $TaskPath - InputObject = $scheduledTask - } - - if ($PSBoundParameters.ContainsKey('ExecuteAsCredential') -eq $true) - { - $registerArgs.Add('User', $ExecuteAsCredential.UserName) - $registerArgs.Add('Password', $ExecuteAsCredential.GetNetworkCredential().Password) - } - else - { - $registerArgs.Add('User', 'NT AUTHORITY\SYSTEM') - } - - $null = Register-ScheduledTask @registerArgs - } - - if ($Ensure -eq 'Absent') - { - Write-Verbose -Message ('Removing scheduled task {0}' -f $TaskName) - Unregister-ScheduledTask -TaskName $TaskName -TaskPath $TaskPath -Confirm:$false - } -} - -<# -.SYNOPSIS - Tests if the current resource state matches the desired resource state -.PARAMETER TaskName - The name of the task -.PARAMETER TaskPath - The path to the task - defaults to the root directory -.PARAMETER Description - The task description -.PARAMETER ActionExecutable - The path to the .exe for this task -.PARAMETER ActionArguments - The arguments to pass the executable -.PARAMETER ActionWorkingPath - The working path to specify for the executable -.PARAMETER ScheduleType - When should the task be executed -.PARAMETER RepeatInterval - How many units (minutes, hours, days) between each run of this task? -.PARAMETER StartTime - The time of day this task should start at - defaults to 12:00 AM. Not valid for AtLogon and AtStartup tasks -.PARAMETER Ensure - Present if the task should exist, Absent if it should be removed -.PARAMETER Enable - True if the task should be enabled, false if it should be disabled -.PARAMETER ExecuteAsCredential - The credential this task should execute as. If not specified defaults to running as the local system account -.PARAMETER DaysInterval - Specifies the interval between the days in the schedule. An interval of 1 produces a daily schedule. An interval of 2 produces an every-other day schedule. -.PARAMETER RandomDelay - Specifies a random amount of time to delay the start time of the trigger. The delay time is a random time between the time the task triggers and the time that you specify in this setting. -.PARAMETER RepetitionDuration - Specifies how long the repetition pattern repeats after the task starts. -.PARAMETER DaysOfWeek - Specifies an array of the days of the week on which Task Scheduler runs the task. -.PARAMETER WeeksInterval - Specifies the interval between the weeks in the schedule. An interval of 1 produces a weekly schedule. An interval of 2 produces an every-other week schedule. -.PARAMETER User - Specifies the identifier of the user for a trigger that starts a task when a user logs on. -.PARAMETER DisallowDemandStart - Indicates whether the task is prohibited to run on demand or not. Defaults to $false -.PARAMETER DisallowHardTerminate - Indicates whether the task is prohibited to be terminated or not. Defaults to $false -.PARAMETER Compatibility - The task compatibility level. Defaults to Vista. -.PARAMETER AllowStartIfOnBatteries - Indicates whether the task should start if the machine is on batteries or not. Defaults to $false -.PARAMETER Hidden - Indicates that the task is hidden in the Task Scheduler UI. -.PARAMETER RunOnlyIfIdle - Indicates that Task Scheduler runs the task only when the computer is idle. -.PARAMETER IdleWaitTimeout - Specifies the amount of time that Task Scheduler waits for an idle condition to occur. -.PARAMETER NetworkName - Specifies the name of a network profile that Task Scheduler uses to determine if the task can run. - The Task Scheduler UI uses this setting for display purposes. Specify a network name if you specify the RunOnlyIfNetworkAvailable parameter. -.PARAMETER DisallowStartOnRemoteAppSession - Indicates that the task does not start if the task is triggered to run in a Remote Applications Integrated Locally (RAIL) session. -.PARAMETER StartWhenAvailable - Indicates that Task Scheduler can start the task at any time after its scheduled time has passed. -.PARAMETER DontStopIfGoingOnBatteries - Indicates that the task does not stop if the computer switches to battery power. -.PARAMETER WakeToRun - Indicates that Task Scheduler wakes the computer before it runs the task. -.PARAMETER IdleDuration - Specifies the amount of time that the computer must be in an idle state before Task Scheduler runs the task. -.PARAMETER RestartOnIdle - Indicates that Task Scheduler restarts the task when the computer cycles into an idle condition more than once. -.PARAMETER DontStopOnIdleEnd - Indicates that Task Scheduler does not terminate the task if the idle condition ends before the task is completed. -.PARAMETER ExecutionTimeLimit - Specifies the amount of time that Task Scheduler is allowed to complete the task. -.PARAMETER MultipleInstances - Specifies the policy that defines how Task Scheduler handles multiple instances of the task. -.PARAMETER Priority - Specifies the priority level of the task. Priority must be an integer from 0 (highest priority) to 10 (lowest priority). - The default value is 7. Priority levels 7 and 8 are used for background tasks. Priority levels 4, 5, and 6 are used for interactive tasks. -.PARAMETER RestartCount - Specifies the number of times that Task Scheduler attempts to restart the task. -.PARAMETER RestartInterval - Specifies the amount of time that Task Scheduler attempts to restart the task. -.PARAMETER RunOnlyIfNetworkAvailable - Indicates that Task Scheduler runs the task only when a network is available. Task Scheduler uses the NetworkID - parameter and NetworkName parameter that you specify in this cmdlet to determine if the network is available. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $TaskName, - - [Parameter()] - [System.String] - $TaskPath = '\', - - [Parameter()] - [System.String] - $Description, - - [Parameter(Mandatory = $true)] - [System.String] - $ActionExecutable, - - [Parameter()] - [System.String] - $ActionArguments, - - [Parameter()] - [System.String] - $ActionWorkingPath, - - [Parameter(Mandatory = $true)] - [System.String] - [ValidateSet('Once', 'Daily', 'Weekly', 'AtStartup', 'AtLogOn')] - $ScheduleType, - - [Parameter()] - [System.DateTime] - $RepeatInterval = [System.DateTime] '00:00:00', - - [Parameter()] - [System.DateTime] - $StartTime = [System.DateTime]::Today, - - [Parameter()] - [System.String] - [ValidateSet('Present', 'Absent')] - $Ensure = 'Present', - - [Parameter()] - [System.Boolean] - $Enable = $true, - - [Parameter()] - [System.Management.Automation.PSCredential] - $ExecuteAsCredential, - - [Parameter()] - [System.UInt32] - $DaysInterval = 1, - - [Parameter()] - [System.DateTime] - $RandomDelay = [System.DateTime] '00:00:00', - - [Parameter()] - [System.DateTime] - $RepetitionDuration = [System.DateTime] '00:00:00', - - [Parameter()] - [System.String[]] - $DaysOfWeek, - - [Parameter()] - [System.UInt32] - $WeeksInterval = 1, - - [Parameter()] - [System.String] - $User, - - [Parameter()] - [System.Boolean] - $DisallowDemandStart = $false, - - [Parameter()] - [System.Boolean] - $DisallowHardTerminate = $false, - - [Parameter()] - [ValidateSet('AT', 'V1', 'Vista', 'Win7', 'Win8')] - [System.String] - $Compatibility = 'Vista', - - [Parameter()] - [System.Boolean] - $AllowStartIfOnBatteries = $false, - - [Parameter()] - [System.Boolean] - $Hidden = $false, - - [Parameter()] - [System.Boolean] - $RunOnlyIfIdle = $false, - - [Parameter()] - [System.DateTime] - $IdleWaitTimeout = [System.DateTime] '02:00:00', - - [Parameter()] - [System.String] - $NetworkName, - - [Parameter()] - [System.Boolean] - $DisallowStartOnRemoteAppSession = $false, - - [Parameter()] - [System.Boolean] - $StartWhenAvailable = $false, - - [Parameter()] - [System.Boolean] - $DontStopIfGoingOnBatteries = $false, - - [Parameter()] - [System.Boolean] - $WakeToRun = $false, - - [Parameter()] - [System.DateTime] - $IdleDuration = [System.DateTime] '01:00:00', - - [Parameter()] - [System.Boolean] - $RestartOnIdle = $false, - - [Parameter()] - [System.Boolean] - $DontStopOnIdleEnd = $false, - - [Parameter()] - [System.DateTime] - $ExecutionTimeLimit = [System.DateTime] '8:00:00', - - [Parameter()] - [ValidateSet('IgnoreNew', 'Parallel', 'Queue')] - [System.String] - $MultipleInstances = 'Queue', - - [Parameter()] - [System.UInt32] - $Priority = 7, - - [Parameter()] - [System.UInt32] - $RestartCount = 0, - - [Parameter()] - [System.DateTime] - $RestartInterval = [System.DateTime] '00:00:00', - - [Parameter()] - [System.Boolean] - $RunOnlyIfNetworkAvailable = $false - ) - - $TaskPath = ConvertTo-NormalizedTaskPath -TaskPath $TaskPath - - Write-Verbose -Message ('Testing scheduled task {0}' -f $TaskName) - - $CurrentValues = Get-TargetResource @PSBoundParameters - - Write-Verbose -Message 'Current values retrieved' - - if ($Ensure -eq 'Absent' -and $CurrentValues.Ensure -eq 'Absent') - { - return $true - } - - if ($null -eq $CurrentValues) - { - Write-Verbose -Message 'Current values were null' - return $false - } - - $desiredValues = $PSBoundParameters - $desiredValues.TaskPath = $TaskPath - - Write-Verbose -Message 'Testing DSC parameter state' - return Test-DscParameterState -CurrentValues $CurrentValues -DesiredValues $desiredValues -} - -<# -.SYNOPSIS -Helper function to convert TaskPath to the right form - -.PARAMETER TaskPath -The path to the task -#> - -function ConvertTo-NormalizedTaskPath -{ - [CmdletBinding()] - [OutputType([System.String])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $TaskPath - ) - - $pathArray = $TaskPath.Split('\').Where( {$_}) - if ($pathArray.Count -gt 0) - { - $TaskPath = "\$($pathArray -join '\')\" - } - - return $TaskPath -} diff --git a/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xScheduledTask/MSFT_xScheduledTask.schema.mof b/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xScheduledTask/MSFT_xScheduledTask.schema.mof deleted file mode 100644 index 3f1e1a69..00000000 --- a/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xScheduledTask/MSFT_xScheduledTask.schema.mof +++ /dev/null @@ -1,43 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xScheduledTask")] -class MSFT_xScheduledTask : OMI_BaseResource -{ - [Key, Description("The name of the task")] string TaskName; - [Write, Description("The path to the task - defaults to the root directory")] string TaskPath; - [Write, Description("The task description")] string Description; - [Required, Description("The path to the .exe for this task")] string ActionExecutable; - [Write, Description("The arguments to pass the executable")] string ActionArguments; - [Write, Description("The working path to specify for the executable")] string ActionWorkingPath; - [Required, Description("When should the task be executed"), ValueMap{"Once", "Daily", "Weekly", "AtStartup", "AtLogOn"}, Values{"Once", "Daily", "Weekly", "AtStartup", "AtLogOn"}] string ScheduleType; - [Write, Description("How many units (minutes, hours, days) between each run of this task?")] DateTime RepeatInterval; - [Write, Description("The time of day this task should start at - defaults to 12:00 AM. Not valid for AtLogon and AtStartup tasks")] DateTime StartTime; - [Write, Description("Present if the task should exist, Absent if it should be removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("True if the task should be enabled, false if it should be disabled")] boolean Enable; - [Write, Description("The credential this task should execute as. If not specified defaults to running as the local system account"), EmbeddedInstance("MSFT_Credential")] string ExecuteAsCredential; - [Write, Description("Specifies the interval between the days in the schedule. An interval of 1 produces a daily schedule. An interval of 2 produces an every-other day schedule.")] Uint32 DaysInterval; - [Write, Description("Specifies a random amount of time to delay the start time of the trigger. The delay time is a random time between the time the task triggers and the time that you specify in this setting.")] DateTime RandomDelay; - [Write, Description("Specifies how long the repetition pattern repeats after the task starts.")] DateTime RepetitionDuration; - [Write, Description("Specifies an array of the days of the week on which Task Scheduler runs the task.")] String DaysOfWeek[]; - [Write, Description("Specifies the interval between the weeks in the schedule. An interval of 1 produces a weekly schedule. An interval of 2 produces an every-other week schedule.")] Uint32 WeeksInterval; - [Write, Description("Specifies the identifier of the user for a trigger that starts a task when a user logs on.")] String User; - [Write, Description("Indicates whether the task is prohibited to run on demand or not. Defaults to $false")] Boolean DisallowDemandStart; - [Write, Description("Indicates whether the task is prohibited to be terminated or not. Defaults to $false")] Boolean DisallowHardTerminate; - [Write, Description("The task compatibility level. Defaults to Vista."), ValueMap{"AT","V1","Vista","Win7","Win8"}, Values{"AT","V1","Vista","Win7","Win8"}] String Compatibility; - [Write, Description("Indicates whether the task should start if the machine is on batteries or not. Defaults to $false")] Boolean AllowStartIfOnBatteries; - [Write, Description("Indicates that the task is hidden in the Task Scheduler UI.")] Boolean Hidden; - [Write, Description("Indicates that Task Scheduler runs the task only when the computer is idle.")] Boolean RunOnlyIfIdle; - [Write, Description("Specifies the amount of time that Task Scheduler waits for an idle condition to occur.")] DateTime IdleWaitTimeout; - [Write, Description("Specifies the name of a network profile that Task Scheduler uses to determine if the task can run. The Task Scheduler UI uses this setting for display purposes. Specify a network name if you specify the RunOnlyIfNetworkAvailable parameter.")] String NetworkName; - [Write, Description("Indicates that the task does not start if the task is triggered to run in a Remote Applications Integrated Locally (RAIL) session.")] Boolean DisallowStartOnRemoteAppSession; - [Write, Description("Indicates that Task Scheduler can start the task at any time after its scheduled time has passed.")] Boolean StartWhenAvailable; - [Write, Description("Indicates that the task does not stop if the computer switches to battery power.")] Boolean DontStopIfGoingOnBatteries; - [Write, Description("Indicates that Task Scheduler wakes the computer before it runs the task.")] Boolean WakeToRun; - [Write, Description("Specifies the amount of time that the computer must be in an idle state before Task Scheduler runs the task.")] DateTime IdleDuration; - [Write, Description("Indicates that Task Scheduler restarts the task when the computer cycles into an idle condition more than once.")] Boolean RestartOnIdle; - [Write, Description("Indicates that Task Scheduler does not terminate the task if the idle condition ends before the task is completed.")] Boolean DontStopOnIdleEnd; - [Write, Description("Specifies the amount of time that Task Scheduler is allowed to complete the task.")] DateTime ExecutionTimeLimit; - [Write, Description("Specifies the policy that defines how Task Scheduler handles multiple instances of the task."), ValueMap{"IgnoreNew","Parallel","Queue"}, Values{"IgnoreNew","Parallel","Queue"}] String MultipleInstances; - [Write, Description("Specifies the priority level of the task. Priority must be an integer from 0 (highest priority) to 10 (lowest priority). The default value is 7. Priority levels 7 and 8 are used for background tasks. Priority levels 4, 5, and 6 are used for interactive tasks.")] Uint32 Priority; - [Write, Description("Specifies the number of times that Task Scheduler attempts to restart the task.")] Uint32 RestartCount; - [Write, Description("Specifies the amount of time that Task Scheduler attempts to restart the task.")] DateTime RestartInterval; - [Write, Description("Indicates that Task Scheduler runs the task only when a network is available. Task Scheduler uses the NetworkID parameter and NetworkName parameter that you specify in this cmdlet to determine if the network is available.")] Boolean RunOnlyIfNetworkAvailable; -}; diff --git a/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xVirtualMemory/MSFT_xVirtualMemory.psm1 b/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xVirtualMemory/MSFT_xVirtualMemory.psm1 deleted file mode 100644 index 78515d07..00000000 --- a/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xVirtualMemory/MSFT_xVirtualMemory.psm1 +++ /dev/null @@ -1,428 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidGlobalVars", "", Scope = "Function")] -param -( -) - -<# - .SYNOPSIS - Returns the current state of the virtual memory configuration - - .PARAMETER Drive - The drive for which the virtual memory configuration needs to be returned - - .PARAMETER Type - The type of the virtual memory configuration -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Drive, - - [Parameter(Mandatory = $true)] - [ValidateSet('AutoManagePagingFile', 'CustomSize', 'SystemManagedSize', 'NoPagingFile')] - [System.String] - $Type - ) - - Write-Verbose -Message 'Getting current page file settings' - - $returnValue = @{ - Drive = [string]::Empty - Type = [string]::Empty - InitialSize = 0 - MaximumSize = 0 - } - - [bool] $isSystemManaged = (Get-CimInstance -ClassName Win32_ComputerSystem).AutomaticManagedPagefile - - if ($isSystemManaged) - { - $returnValue.Type = 'AutoManagePagingFile' - return $returnValue - } - - $driveItem = [System.IO.DriveInfo] $Drive - - Write-Verbose -Message "Pagefile was not automatically managed. Retrieving detailed page file settings with query Select * from Win32_PageFileSetting where SettingID='pagefile.sys @ $($driveItem.Name.Substring(0,2))'" - - # Find existing page file settings by drive letter - $virtualMemoryInstance = Get-CimInstance -Namespace root\cimv2 -Query "Select * from Win32_PageFileSetting where SettingID='pagefile.sys @ $($driveItem.Name.Substring(0,2))'" - - if (-not $virtualMemoryInstance) - { - $returnValue.Type = 'NoPagingFile' - return $returnValue - } - - if ($virtualMemoryInstance.InitialSize -eq 0 -and $virtualMemoryInstance.MaximumSize -eq 0) - { - $returnValue.Type = 'SystemManagedSize' - } - else - { - $returnValue.Type = 'CustomSize' - } - - $returnValue.Drive = $virtualMemoryInstance.Name.Substring(0, 3) - $returnValue.InitialSize = $virtualMemoryInstance.InitialSize - $returnValue.MaximumSize = $virtualMemoryInstance.MaximumSize - - $returnValue -} - -<# - .SYNOPSIS - Sets the virtual memory settings based on the parameters supplied - - .PARAMETER Drive - The drive for which the virtual memory configuration should be set. - - .PARAMETER Type - The paging type. When set to AutoManagePagingFile, drive letters are ignored - - .PARAMETER InitialSize - The initial page file size in megabyte - - .PARAMETER MaximumSize - The maximum page file size in megabyte. May not be smaller than InitialSize -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Drive, - - [Parameter(Mandatory = $true)] - [ValidateSet('AutoManagePagingFile', 'CustomSize', 'SystemManagedSize', 'NoPagingFile')] - [System.String] - $Type, - - [Parameter()] - [System.Int64] - $InitialSize, - - [Parameter()] - [System.Int64] - $MaximumSize - ) - - Write-Verbose -Message 'Setting page file' - - $SystemInfo = Get-CimInstance -Class Win32_ComputerSystem - - switch ($Type) - { - 'AutoManagePagingFile' - { - $setParams = @{ - Namespace = 'root\cimv2' - Query = 'Select * from Win32_ComputerSystem' - Property = @{AutomaticManagedPageFile = $true} - } - - Write-Verbose -Message 'Enabling AutoManagePagingFile' - - $null = Set-CimInstance @setParams - $global:DSCMachineStatus = 1 - break - } - - 'CustomSize' - { - if ($SystemInfo.AutomaticManagedPageFile) - { - # First set AutomaticManagedPageFile to $false to be able to set a custom one later - - $setParams = @{ - Namespace = 'root\cimv2' - Query = 'Select * from Win32_ComputerSystem' - Property = @{AutomaticManagedPageFile = $false} - } - - Write-Verbose -Message 'Disabling AutoManagePagingFile' - - $null = Set-CimInstance @setParams - } - - $driveInfo = [System.IO.DriveInfo] $Drive - - if (-not $driveInfo.IsReady) - { - throw "Drive $($driveInfo.Name) is not ready. Please ensure that the drive exists and is available" - } - - $pageFileName = Join-Path -Path $driveInfo.Name -ChildPath 'pagefile.sys' - - Write-Verbose -Message ('Checking if a paging file already exists at {0}' -f $pageFileName) - $existingPageFileSetting = Get-CimInstance ` - -Namespace root\cimv2 ` - -Query "Select * from Win32_PageFileSetting where SettingID='pagefile.sys @ $($driveInfo.Name.Substring(0,2))'" - - if (-not $existingPageFileSetting) - { - $null = New-CimInstance -Namespace 'root\cimv2' -ClassName 'Win32_PageFileSetting' -Property @{Name = $pageFileName} - } - - <# - New-CimInstance does not support properties InitialSize and MaximumSize. Therefore, create - a New-CimInstance with the page file name only if it does not exist and Set-CimInstance on the instance - #> - $setParams = @{ - Namespace = 'root\cimv2' - Query = "Select * from Win32_PageFileSetting where SettingID='pagefile.sys @ $($driveInfo.Name.Substring(0,2))'" - Property = @{ - InitialSize = $InitialSize - MaximumSize = $MaximumSize - } - } - - Write-Verbose -Message ("Setting page file to {0}. Initial size {1}MB, maximum size {2}MB" -f $pageFileName, $InitialSize, $MaximumSize) - - $null = Set-CimInstance @setParams - $global:DSCMachineStatus = 1 - break - } - - 'SystemManagedSize' - { - if ($SystemInfo.AutomaticManagedPageFile) - { - $setParams = @{ - Namespace = 'root\cimv2' - Query = 'Select * from Win32_ComputerSystem' - Property = @{AutomaticManagedPageFile = $false} - } - - Write-Verbose -Message 'Disabling AutoManagePagingFile' - - $null = Set-CimInstance @setParams - } - - $driveInfo = [System.IO.DriveInfo] $Drive - - if (-not $driveInfo.IsReady) - { - throw "Drive $($driveInfo.Name) is not ready. Please ensure that the drive exists and is available" - } - - $pageFileName = Join-Path -Path $driveInfo.Name -ChildPath 'pagefile.sys' - - Write-Verbose -Message ('Checking if a paging file already exists at {0}' -f $pageFileName) - - $existingPageFileSetting = Get-CimInstance ` - -Namespace root\cimv2 ` - -Query "Select * from Win32_PageFileSetting where SettingID='pagefile.sys @ $($driveInfo.Name.Substring(0,2))'" - - if (-not $existingPageFileSetting) - { - $null = New-CimInstance -Namespace 'root\cimv2' -ClassName 'Win32_PageFileSetting' -Property @{Name = $pageFileName} - } - - $setParams = @{ - Namespace = 'root\cimv2' - Query = "Select * from Win32_PageFileSetting where SettingID='pagefile.sys @ $($driveInfo.Name.Substring(0,2))'" - Property = @{ - InitialSize = 0 - MaximumSize = 0 - } - } - - Write-Verbose -Message "Enabling system-managed page file on $pageFileName" - - $null = Set-CimInstance @setParams - $global:DSCMachineStatus = 1 - break - } - - 'NoPagingFile' - { - if ($SystemInfo.AutomaticManagedPageFile) - { - $setParams = @{ - Namespace = 'root\cimv2' - Query = 'Select * from Win32_ComputerSystem' - Property = @{AutomaticManagedPageFile = $false} - } - - $null = Set-CimInstance @setParams - } - - $driveInfo = [System.IO.DriveInfo] $Drive - - if (-not $driveInfo.IsReady) - { - throw "Drive $($driveInfo.Name) is not ready. Please ensure that the drive exists and is available" - } - - $existingPageFileSetting = Get-CimInstance ` - -Namespace root\cimv2 ` - -Query "Select * from Win32_PageFileSetting where SettingID='pagefile.sys @ $($driveInfo.Name.Substring(0,2))'" - - if ($existingPageFileSetting) - { - Write-Verbose -Message "Removing existing page file $($existingPageFileSetting.Name)" - $null = Remove-CimInstance -InputObject $existingPageFileSetting - $global:DSCMachineStatus = 1 - } - - Write-Verbose -Message "Disabled page file for drive $Drive" - - break - } - - default - { - throw "A wrong type '$Type' has been selected." - } - } -} - -<# - .SYNOPSIS - Tests if virtual memory settings need to be applied based on the parameters supplied - - .PARAMETER Drive - The drive letter that should be tested - - .PARAMETER Type - The type of the virtual memory configuration - - .PARAMETER InitialSize - The initial page file size in megabyte - - .PARAMETER MaximumSize - The maximum page file size in megabyte -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Drive, - - [Parameter(Mandatory = $true)] - [ValidateSet('AutoManagePagingFile', 'CustomSize', 'SystemManagedSize', 'NoPagingFile')] - [System.String] - $Type, - - [Parameter()] - [System.Int64] - $InitialSize, - - [Parameter()] - [System.Int64] - $MaximumSize - ) - - Write-Verbose -Message 'Testing page file' - - $systemInfo = Get-CimInstance -Class Win32_ComputerSystem - $result = $false - - switch ($Type) - { - 'AutoManagePagingFile' - { - $result = $systemInfo.AutomaticManagedPagefile - break - } - - 'CustomSize' - { - if ($systemInfo.AutomaticManagedPageFile) - { - $result = $false - break - } - - $driveInfo = [System.IO.DriveInfo] $Drive - - $pageFile = Get-CimInstance -Class Win32_PageFileSetting -Filter "SettingID='pagefile.sys @ $($driveInfo.Name.Substring(0,2))'" - - if (-not $pageFile) - { - $result = $false - break - } - - if (-not ($pageFile.InitialSize -eq $InitialSize -and $pageFile.MaximumSize -eq $MaximumSize)) - { - $result = $false - break - } - - $result = $true - break - } - - 'SystemManagedSize' - { - if ($SystemInfo.AutomaticManagedPageFile) - { - $result = $false - break - } - - $driveInfo = [System.IO.DriveInfo] $Drive - - $pageFile = Get-CimInstance -Class Win32_PageFileSetting -Filter "SettingID='pagefile.sys @ $($driveInfo.Name.Substring(0,2))'" - - if (-not $pageFile) - { - $result = $false - break - } - - if (-not ($pageFile.InitialSize -eq 0 -and $pageFile.MaximumSize -eq 0)) - { - $result = $false - break - } - - $result = $true - break - } - - 'NoPagingFile' - { - if ($SystemInfo.AutomaticManagedPageFile) - { - $result = $false - break - } - - $driveInfo = [System.IO.DriveInfo] $Drive - - $pageFile = Get-CimInstance -Class Win32_PageFileSetting -Filter "SettingID='pagefile.sys @ $($driveInfo.Name.Substring(0,2))'" - - if ($pageFile) - { - $result = $false - break - } - - $result = $true - break - } - - default - { - break - } - } - - return $result -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xVirtualMemory/MSFT_xVirtualMemory.schema.mof b/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xVirtualMemory/MSFT_xVirtualMemory.schema.mof deleted file mode 100644 index 38651f9d..00000000 --- a/lib/puppet_x/dsc_resources/xComputerManagement/DSCResources/MSFT_xVirtualMemory/MSFT_xVirtualMemory.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xVirtualMemory")] -class MSFT_xVirtualMemory : OMI_BaseResource -{ - [Key, Description("The drive letter for which paging settings should be set. Can be letter only, letter and colon or letter with colon and trailing slash.")] String Drive; - [Key, Description("The type of the paging setting to use. If set to AutoManagePagingFile, the drive letter will be ignored. If set to SystemManagedSize, the values for InitialSize and MaximumSize will be ignored"), ValueMap{"AutoManagePagingFile","CustomSize","SystemManagedSize","NoPagingFile"}, Values{"AutoManagePagingFile","CustomSize","SystemManagedSize","NoPagingFile"}] String Type; - [Write, Description("The initial size of the page file in Megabyte")] Sint64 InitialSize; - [Write, Description("The maximum size of the page file in Megabyte")] Sint64 MaximumSize; -}; - diff --git a/lib/puppet_x/dsc_resources/xComputerManagement/LICENSE b/lib/puppet_x/dsc_resources/xComputerManagement/LICENSE deleted file mode 100644 index a1d2d916..00000000 --- a/lib/puppet_x/dsc_resources/xComputerManagement/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2017 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/lib/puppet_x/dsc_resources/xComputerManagement/xComputerManagement.psd1 b/lib/puppet_x/dsc_resources/xComputerManagement/xComputerManagement.psd1 deleted file mode 100644 index f6061013..00000000 --- a/lib/puppet_x/dsc_resources/xComputerManagement/xComputerManagement.psd1 +++ /dev/null @@ -1,95 +0,0 @@ -@{ -# Version number of this module. -ModuleVersion = '2.1.0.0' - -# ID used to uniquely identify this module -GUID = 'B5004952-489E-43EA-999C-F16A25355B89' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2017 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'The xComputerManagement module is originally part of the Windows PowerShell Desired State Configuration (DSC) Resource Kit. This version has been modified for use in Azure. This module contains the xComputer and xDisk resources. These DSC Resources allow you to perform computer management tasks, like joining a domain or initializing disks. - -All of the resources in the DSC Resource Kit are provided AS IS, and are not supported through any Microsoft standard support program or service.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Minimum version of the common language runtime (CLR) required by this module -CLRVersion = '4.0' - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/xComputerManagement/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/xComputerManagement' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - ReleaseNotes = '* xComputer: Changed comparison that validates if we are in the correct AD - Domain to work correctly if FQDN wasn"t used. -* Updated AppVeyor.yml to use AppVeyor.psm1 module in DSCResource.Tests. -* Removed Markdown.md errors. -* Added CodeCov.io support. -* xScheduledTask - * Fixed incorrect TaskPath handling - [Issue 45](https://github.com/PowerShell/xComputerManagement/issues/45) -* Change examples to meet HQRM standards and optin to Example validation - tests. -* Replaced examples in README.MD to links to Example files. -* Added the VS Code PowerShell extension formatting settings that cause PowerShell - files to be formatted as per the DSC Resource kit style guidelines - [Issue 91](https://github.com/PowerShell/xComputerManagement/issues/91). -* Opted into Common Tests "Validate Module Files" and "Validate Script Files". -* Converted files with UTF8 with BOM over to UTF8 - fixes [Issue 90](https://github.com/PowerShell/xComputerManagement/issues/90). -* Updated Year to 2017 in License and Manifest - fixes [Issue 87](https://github.com/PowerShell/xComputerManagement/issues/87). -* Added .github support files - fixes [Issue 88](https://github.com/PowerShell/xComputerManagement/issues/88): - * CONTRIBUTING.md - * ISSUE_TEMPLATE.md - * PULL_REQUEST_TEMPLATE.md -* Resolved all PSScriptAnalyzer warnings and style guide warnings. -* xOfflineDomainJoin: - * Changed to use CommonResourceHelper to load localization strings. - * Renamed en-US to be correct case so that localization strings can be loaded. - * Suppress PSScriptAnalyzer rule PSAvoidGlobalVars for - `$global:DSCMachineStatus = 1`. -* xComputer: - * Suppress PSScriptAnalyzer rule PSAvoidGlobalVars for - `$global:DSCMachineStatus = 1`. -* xVirtualMemory: - * Suppress PSScriptAnalyzer rule PSAvoidGlobalVars for - `$global:DSCMachineStatus = 1`. - -' - - } # End of PSData hashtable - -} # End of PrivateData hashtable -} - - - - - - diff --git a/lib/puppet_x/dsc_resources/xCredSSP/DSCResources/MSFT_xCredSSP/MSFT_xCredSSP.psm1 b/lib/puppet_x/dsc_resources/xCredSSP/DSCResources/MSFT_xCredSSP/MSFT_xCredSSP.psm1 deleted file mode 100644 index 11a9c7a7..00000000 --- a/lib/puppet_x/dsc_resources/xCredSSP/DSCResources/MSFT_xCredSSP/MSFT_xCredSSP.psm1 +++ /dev/null @@ -1,324 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Server","Client")] - [System.String] - $Role - ) - - #Check if GPO policy has been set - switch($Role) - { - "Server" - { - $RegKey = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WinRM\Service" - } - "Client" - { - $RegKey = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WinRM\Client" - } - } - $RegValueName = "AllowCredSSP" - - if (Test-RegistryValue -Path $RegKey -Name $RegValueName) - { - Write-Verbose -Message "CredSSP is configured via Group Policies" - } - else - { - # Check regular values - switch($Role) - { - "Server" - { - $RegKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WSMAN\Service" - } - "Client" - { - $RegKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WSMAN\Client" - } - } - $RegValueName = "auth_credssp" - } - - if(Test-RegistryValue -Path $RegKey -Name $RegValueName) - { - $Setting = (Get-ItemProperty -Path $RegKey -Name $RegValueName).$RegValueName - } - else - { - $Setting = 0 - } - - switch($Role) - { - "Server" - { - switch($Setting) - { - 1 - { - $returnValue = @{ - Ensure = "Present"; - Role = "Server" - } - } - 0 - { - $returnValue = @{ - Ensure = "Absent"; - Role = "Server" - } - } - } - } - "Client" - { - switch($Setting) - { - 1 - { - $key = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CredentialsDelegation\AllowFreshCredentials" - - $DelegateComputers = @() - - - Get-Item -Path $key -ErrorAction SilentlyContinue | - Select-Object -ExpandProperty Property | - ForEach-Object { - $DelegateComputer = ((Get-ItemProperty -Path $key -Name $_).$_).Split("/")[1] - $DelegateComputers += $DelegateComputer - } - $DelegateComputers = $DelegateComputers | Sort-Object -Unique - - $returnValue = @{ - Ensure = "Present"; - Role = "Client"; - DelegateComputers = @($DelegateComputers) - } - } - 0 - { - $returnValue = @{ - Ensure = "Absent"; - Role = "Client" - } - } - } - } - } - - return $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [ValidateSet("Server","Client")] - [System.String] - $Role, - - [System.String[]] - $DelegateComputers, - - [System.Boolean] - $SuppressReboot = $false - ) - - if ($Role -eq "Server" -and ($DelegateComputers)) - { - throw ("Cannot use the Role=Server parameter together with " + ` - "the DelegateComputers parameter") - } - - #Check if policy has been set - switch($Role) - { - "Server" - { - $RegKey = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WinRM\Service" - } - "Client" - { - $RegKey = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WinRM\Client" - } - } - $RegValueName = "AllowCredSSP" - - if (Test-RegistryValue -Path $RegKey -Name $RegValueName) - { - Throw "Cannot configure CredSSP. CredSSP is configured via Group Policies" - } - - switch($Role) - { - "Server" - { - switch($Ensure) - { - "Present" - { - Enable-WSManCredSSP -Role Server -Force | Out-Null - if ($SuppressReboot -eq $false) - { - $global:DSCMachineStatus = 1 - } - } - "Absent" - { - Disable-WSManCredSSP -Role Server | Out-Null - } - } - } - "Client" - { - switch($Ensure) - { - "Present" - { - if($DelegateComputers) - { - $key = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CredentialsDelegation\AllowFreshCredentials" - - if (!(test-path $key)) - { - New-Item $key -Force | out-null - } - - $CurrentDelegateComputers = @() - - Get-Item -Path $key | - Select-Object -ExpandProperty Property | - ForEach-Object { - $CurrentDelegateComputer = ((Get-ItemProperty -Path $key -Name $_).$_).Split("/")[1] - $CurrentDelegateComputers += $CurrentDelegateComputer - } - $CurrentDelegateComputers = $CurrentDelegateComputers | Sort-Object -Unique - - foreach($DelegateComputer in $DelegateComputers) - { - if(($CurrentDelegateComputers -eq $NULL) -or (!$CurrentDelegateComputers.Contains($DelegateComputer))) - { - Enable-WSManCredSSP -Role Client -DelegateComputer $DelegateComputer -Force | Out-Null - if ($SuppressReboot -eq $false) - { - $global:DSCMachineStatus = 1 - } - } - } - } - else - { - Throw "DelegateComputers is required!" - } - } - "Absent" - { - Disable-WSManCredSSP -Role Client | Out-Null - } - } - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [ValidateSet("Server","Client")] - [System.String] - $Role, - - [System.String[]] - $DelegateComputers, - - [System.Boolean] - $SuppressReboot = $false - ) - - if ($Role -eq "Server" -and $PSBoundParameters.ContainsKey("DelegateComputers")) - { - Write-Verbose -Message ("Cannot use the Role=Server parameter together with " + ` - "the DelegateComputers parameter") - } - - $CredSSP = Get-TargetResource -Role $Role - - switch($Role) - { - "Server" - { - return ($CredSSP.Ensure -eq $Ensure) - } - "Client" - { - switch($Ensure) - { - "Present" - { - $CorrectDelegateComputers = $true - if($DelegateComputers) - { - foreach($DelegateComputer in $DelegateComputers) - { - if(!($CredSSP.DelegateComputers | Where-Object {$_ -eq $DelegateComputer})) - { - $CorrectDelegateComputers = $false - } - } - } - $result = (($CredSSP.Ensure -eq $Ensure) -and $CorrectDelegateComputers) - } - "Absent" - { - $result = ($CredSSP.Ensure -eq $Ensure) - } - } - } - } - - return $result -} - - -Export-ModuleMember -Function *-TargetResource - - -function Test-RegistryValue -{ - param ( - [Parameter(Mandatory = $true)] - [String]$Path - , - [Parameter(Mandatory = $true)] - [String]$Name - ) - - if ($null -eq $Path) - { - return $false - } - - $itemProperties = Get-ItemProperty -Path $Path -ErrorAction SilentlyContinue - return ($null -ne $itemProperties -and $null -ne $itemProperties.$Name) -} diff --git a/lib/puppet_x/dsc_resources/xCredSSP/DSCResources/MSFT_xCredSSP/MSFT_xCredSSP.schema.mof b/lib/puppet_x/dsc_resources/xCredSSP/DSCResources/MSFT_xCredSSP/MSFT_xCredSSP.schema.mof deleted file mode 100644 index 80b73547..00000000 --- a/lib/puppet_x/dsc_resources/xCredSSP/DSCResources/MSFT_xCredSSP/MSFT_xCredSSP.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xCredSSP")] -class MSFT_xCredSSP : OMI_BaseResource -{ - [Key, Description("Specifies the CredSSP role.\nServer \nClient \n"), ValueMap{"Server","Client"}, Values{"Server","Client"}] String Role; - [Write, Description("An enumerated value that describes if the role is expected to be enabled on the machine.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, Description("Specifies the array of computers that CredSSP client can delegate to.")] String DelegateComputers[]; - [Write, Description("Specifies if a reboot should be supressed. Default is False")] Boolean SuppressReboot; -}; - diff --git a/lib/puppet_x/dsc_resources/xCredSSP/LICENSE b/lib/puppet_x/dsc_resources/xCredSSP/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xCredSSP/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xCredSSP/xCredSSP.psd1 b/lib/puppet_x/dsc_resources/xCredSSP/xCredSSP.psd1 deleted file mode 100644 index 5ceaf441..00000000 --- a/lib/puppet_x/dsc_resources/xCredSSP/xCredSSP.psd1 +++ /dev/null @@ -1,60 +0,0 @@ -@{ -# Version number of this module. -ModuleVersion = '1.3.0.0' - -# ID used to uniquely identify this module -GUID = '38e1ad0f-9b30-490a-a2b6-cc77765af4ec' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'Module with DSC Resources for WSMan CredSSP.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Minimum version of the common language runtime (CLR) required by this module -CLRVersion = '4.0' - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/xCredSSP/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/xCredSSP' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - ReleaseNotes = '* Added a fix to enable credSSP with a fresh server installation - -' - - } # End of PSData hashtable - -} # End of PrivateData hashtable -} - - - diff --git a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceFolder/MSFT_xDFSNamespaceFolder.psm1 b/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceFolder/MSFT_xDFSNamespaceFolder.psm1 deleted file mode 100644 index 7888191b..00000000 --- a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceFolder/MSFT_xDFSNamespaceFolder.psm1 +++ /dev/null @@ -1,696 +0,0 @@ -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Certificate Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'DFSDsc.ResourceHelper' ` - -ChildPath 'DFSDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$localizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xDFSNamespaceFolder' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# - .SYNOPSIS - Returns the current state of a DFS Namespace Folder. - - .PARAMETER Path - Specifies a path for the root of a DFS namespace. - - .PARAMETER TargetPath - Specifies a path for a root target of the DFS namespace. - - .PARAMETER Ensure - Specifies if the DFS Namespace root should exist. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Path, - - [Parameter(Mandatory = $true)] - [System.String] - $TargetPath, - - [Parameter(Mandatory = $true)] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.GettingNamespaceFolderMessage) ` - -f $Path,$TargetPath - ) -join '' ) - - # Generate the return object assuming absent. - $returnValue = @{ - Path = $Path - TargetPath = $TargetPath - Ensure = 'Absent' - } - - # Lookup the existing Namespace Folder - $folder = Get-Folder ` - -Path $Path - - if ($folder) - { - # The namespace folder exists - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceFolderExistsMessage) ` - -f $Path - ) -join '' ) - } - else - { - # The namespace folder does not exist - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceFolderDoesNotExistMessage) ` - -f $Path - ) -join '' ) - return $returnValue - } # if - - $returnValue += @{ - TimeToLiveSec = $folder.TimeToLiveSec - State = $folder.State - Description = $folder.Description - EnableInsiteReferrals = ($folder.Flags -contains 'Insite Referrals') - EnableTargetFailback = ($folder.Flags -contains 'Target Failback') - } - - # DFS Folder exists but does target exist? - $targetFolder = Get-FolderTarget ` - -Path $Path ` - -TargetPath $TargetPath - - if ($targetFolder) - { - # The target exists in this namespace - $returnValue.Ensure = 'Present' - $returnValue += @{ - ReferralPriorityClass = $targetFolder.ReferralPriorityClass - ReferralPriorityRank = $targetFolder.ReferralPriorityRank - } - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceFolderTargetExistsMessage) ` - -f $Path,$TargetPath - ) -join '' ) - } - else - { - # The target does not exist in this namespace - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceFolderTargetDoesNotExistMessage) ` - -f $Path,$TargetPath - ) -join '' ) - } # if - - return $returnValue -} # Get-TargetResource - -<# - .SYNOPSIS - Sets the current state of a DFS Namespace Folder. - - .PARAMETER Path - Specifies a path for the root of a DFS namespace. - - .PARAMETER TargetPath - Specifies a path for a root target of the DFS namespace. - - .PARAMETER Ensure - Specifies if the DFS Namespace root should exist. - - .PARAMETER Description - The description of the DFS Namespace. - - .PARAMETER TimeToLiveSec - Specifies a TTL interval, in seconds, for referrals. - - .PARAMETER EnableInsiteReferrals - Indicates whether a DFS namespace server provides a client only with referrals that are in the same site as the client. - - .PARAMETER EnableTargetFailback - Indicates whether a DFS namespace uses target failback. - - .PARAMETER ReferralPriorityClass - Specifies the target priority class for a DFS namespace root. - - .PARAMETER ReferralPriorityRank - Specifies the priority rank, as an integer, for a root target of the DFS namespace. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Path, - - [Parameter(Mandatory = $true)] - [System.String] - $TargetPath, - - [Parameter(Mandatory = $true)] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure, - - [Parameter()] - [System.String] - $Description, - - [Parameter()] - [System.UInt32] - $TimeToLiveSec, - - [Parameter()] - [System.Boolean] - $EnableInsiteReferrals, - - [Parameter()] - [System.Boolean] - $EnableTargetFailback, - - [Parameter()] - [ValidateSet('Global-High','SiteCost-High','SiteCost-Normal','SiteCost-Low','Global-Low')] - [System.String] - $ReferralPriorityClass, - - [Parameter()] - [System.UInt32] - $ReferralPriorityRank - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.SettingNamespaceFolderMessage) ` - -f $Path,$TargetPath - ) -join '' ) - - # Lookup the existing Namespace Folder - $folder = Get-Folder ` - -Path $Path - - if ($Ensure -eq 'Present') - { - # Set desired Configuration - if ($folder) - { - # Does the Folder need to be updated? - [System.Boolean] $folderChange = $false - - # The Folder properties that will be updated - $folderProperties = @{ - State = 'online' - } - - if (($Description) ` - -and ($folder.Description -ne $Description)) - { - $folderProperties += @{ - Description = $Description - } - $folderChange = $true - } - - if (($TimeToLiveSec) ` - -and ($folder.TimeToLiveSec -ne $TimeToLiveSec)) - { - $folderProperties += @{ - TimeToLiveSec = $TimeToLiveSec - } - $folderChange = $true - } - - if (($null -ne $EnableInsiteReferrals) ` - -and (($folder.Flags -contains 'Insite Referrals') -ne $EnableInsiteReferrals)) - { - $folderProperties += @{ - EnableInsiteReferrals = $EnableInsiteReferrals - } - $folderChange = $true - } - - if (($null -ne $EnableTargetFailback) ` - -and (($folder.Flags -contains 'Target Failback') -ne $EnableTargetFailback)) - { - $folderProperties += @{ - EnableTargetFailback = $EnableTargetFailback - } - $folderChange = $true - } - - if ($folderChange) - { - # Update Folder settings - $null = Set-DfsnFolder ` - -Path $Path ` - @FolderProperties ` - -ErrorAction Stop - - $folderProperties.GetEnumerator() | ForEach-Object -Process { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceFolderUpdateParameterMessage) ` - -f $Path,$_.name, $_.value - ) -join '' ) - } - } - - # Get target - $targetFolder = Get-FolderTarget ` - -Path $Path ` - -TargetPath $TargetPath - - # Does the target need to be updated? - [System.Boolean] $targetChange = $false - - # The Target properties that will be updated - $targetProperties = @{} - - # Check the target properties - if (($ReferralPriorityClass) ` - -and ($targetFolder.ReferralPriorityClass -ne $ReferralPriorityClass)) - { - $targetProperties += @{ - ReferralPriorityClass = ($ReferralPriorityClass -replace '-','') - } - $targetChange = $true - } - - if (($ReferralPriorityRank) ` - -and ($targetFolder.ReferralPriorityRank -ne $ReferralPriorityRank)) - { - $targetProperties += @{ - ReferralPriorityRank = $ReferralPriorityRank - } - $targetChange = $true - } - - # Is the target a member of the namespace? - if ($targetFolder) - { - # Does the target need to be changed? - if ($targetChange) - { - # Update target settings - $null = Set-DfsnFolderTarget ` - -Path $Path ` - -TargetPath $TargetPath ` - @TargetProperties ` - -ErrorAction Stop - } - } - else - { - # Add target to Namespace - $null = New-DfsnFolderTarget ` - -Path $Path ` - -TargetPath $TargetPath ` - @TargetProperties ` - -ErrorAction Stop - } - - # Output the target parameters that were changed/set - $targetProperties.GetEnumerator() | ForEach-Object -Process { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceFolderTargetUpdateParameterMessage) ` - -f $Path,$TargetPath,$_.name, $_.value - ) -join '' ) - } - } - else - { - <# - Prepare to use the PSBoundParameters as a splat to created - The new DFS Namespace Folder. - #> - $null = $PSBoundParameters.Remove('Ensure') - - # Correct the ReferralPriorityClass field - if ($ReferralPriorityClass) - { - $PSBoundParameters.ReferralPriorityClass = ($ReferralPriorityClass -replace '-','') - } - - # Create New-DfsnFolder - $null = New-DfsnFolder ` - @PSBoundParameters ` - -ErrorAction Stop - - $PSBoundParameters.GetEnumerator() | ForEach-Object -Process { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceFolderUpdateParameterMessage) ` - -f $Path,$TargetPath,$_.name, $_.value - ) -join '' ) - } - } - } - else - { - # The Namespace Folder Target should not exist - - # Get Folder target - $targetFolder = Get-FolderTarget ` - -Path $Path ` - -TargetPath $TargetPath - - if ($targetFolder) - { - # Remove the target from the Namespace Folder - $null = Remove-DfsnFolderTarget ` - -Path $Path ` - -TargetPath $TargetPath ` - -Confirm:$false ` - -ErrorAction Stop - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceFolderTargetRemovedMessage) ` - -f $Path,$TargetPath - ) -join '' ) - } - } -} # Set-TargetResource - -<# - .SYNOPSIS - Tests the current state of a DFS Namespace Folder. - - .PARAMETER Path - Specifies a path for the root of a DFS namespace. - - .PARAMETER TargetPath - Specifies a path for a root target of the DFS namespace. - - .PARAMETER Ensure - Specifies if the DFS Namespace root should exist. - - .PARAMETER Description - The description of the DFS Namespace. - - .PARAMETER TimeToLiveSec - Specifies a TTL interval, in seconds, for referrals. - - .PARAMETER EnableInsiteReferrals - Indicates whether a DFS namespace server provides a client only with referrals that are in the same site as the client. - - .PARAMETER EnableTargetFailback - Indicates whether a DFS namespace uses target failback. - - .PARAMETER ReferralPriorityClass - Specifies the target priority class for a DFS namespace root. - - .PARAMETER ReferralPriorityRank - Specifies the priority rank, as an integer, for a root target of the DFS namespace. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Path, - - [Parameter(Mandatory = $true)] - [System.String] - $TargetPath, - - [Parameter(Mandatory = $true)] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure, - - [Parameter()] - [System.String] - $Description, - - [Parameter()] - [System.UInt32] - $TimeToLiveSec, - - [Parameter()] - [System.Boolean] - $EnableInsiteReferrals, - - [Parameter()] - [System.Boolean] - $EnableTargetFailback, - - [Parameter()] - [ValidateSet('Global-High','SiteCost-High','SiteCost-Normal','SiteCost-Low','Global-Low')] - [System.String] - $ReferralPriorityClass, - - [Parameter()] - [System.UInt32] - $ReferralPriorityRank - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.TestingNamespaceFolderMessage) ` - -f $Path,$TargetPath - ) -join '' ) - - # Flag to signal whether settings are correct - [System.Boolean] $desiredConfigurationMatch = $true - - # Lookup the existing Namespace Folder - $folder = Get-Folder ` - -Path $Path - - if ($Ensure -eq 'Present') - { - # The Namespace Folder should exist - if ($folder) - { - # The Namespace Folder exists and should - - # Check the Namespace parameters - if (($Description) ` - -and ($folder.Description -ne $Description)) { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceFolderParameterNeedsUpdateMessage) ` - -f $Path,'Description' - ) -join '' ) - $desiredConfigurationMatch = $false - } - - if (($TimeToLiveSec) ` - -and ($folder.TimeToLiveSec -ne $TimeToLiveSec)) { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceFolderParameterNeedsUpdateMessage) ` - -f $Path,'TimeToLiveSec' - ) -join '' ) - $desiredConfigurationMatch = $false - } - - if (($null -ne $EnableInsiteReferrals) ` - -and (($folder.Flags -contains 'Insite Referrals') -ne $EnableInsiteReferrals)) { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceFolderParameterNeedsUpdateMessage) ` - -f $Path,'EnableInsiteReferrals' - ) -join '' ) - $desiredConfigurationMatch = $false - } - - if (($null -ne $EnableTargetFailback) ` - -and (($folder.Flags -contains 'Target Failback') -ne $EnableTargetFailback)) { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceFolderParameterNeedsUpdateMessage) ` - -f $Path,'EnableTargetFailback' - ) -join '' ) - $desiredConfigurationMatch = $false - } - - $targetFolder = Get-FolderTarget ` - -Path $Path ` - -TargetPath $TargetPath - - if ($targetFolder) - { - if (($ReferralPriorityClass) ` - -and ($targetFolder.ReferralPriorityClass -ne $ReferralPriorityClass)) { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceFolderTargetParameterNeedsUpdateMessage) ` - -f $Path,$TargetPath,'ReferralPriorityClass' - ) -join '' ) - $desiredConfigurationMatch = $false - } - - if (($ReferralPriorityRank) ` - -and ($targetFolder.ReferralPriorityRank -ne $ReferralPriorityRank)) { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceFolderTargetParameterNeedsUpdateMessage) ` - -f $Path,$TargetPath,'ReferralPriorityRank' - ) -join '' ) - $desiredConfigurationMatch = $false - } - } - else - { - # The Folder target does not exist but should - change required - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceFolderTargetDoesNotExistButShouldMessage) ` - -f $Path,$TargetPath - ) -join '' ) - $desiredConfigurationMatch = $false - } - } - else - { - # Ths Namespace Folder doesn't exist but should - change required - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceFolderDoesNotExistButShouldMessage) ` - -f $Path - ) -join '' ) - $desiredConfigurationMatch = $false - } - } - else - { - # The Namespace target should not exist - if ($folder) - { - $targetFolder = Get-FolderTarget ` - -Path $Path ` - -TargetPath $TargetPath - - if ($targetFolder) - { - # The Folder target exists but should not - change required - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceFolderTargetExistsButShouldNotMessage) ` - -f $Path,$TargetPath - ) -join '' ) - $desiredConfigurationMatch = $false - } - else - { - # The Namespace exists but the target doesn't - change not required - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceFolderTargetDoesNotExistAndShouldNotMessage) ` - -f $Path,$TargetPath - ) -join '' ) - } - } - else - { - # The Namespace does not exist (so neither does the target) - change not required - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceFolderDoesNotExistAndShouldNotMessage) ` - -f $Path - ) -join '' ) - } - } # if - - return $desiredConfigurationMatch - -} # Test-TargetResource - -<# - .SYNOPSIS - Lookup the DFSN Folder. - - .PARAMETER Path - Specifies a path for the root of a DFS namespace. -#> -Function Get-Folder -{ - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Path - ) - - try - { - $dfsnFolder = Get-DfsnFolder ` - -Path $Path ` - -ErrorAction Stop - } - catch [Microsoft.Management.Infrastructure.CimException] - { - $dfsnFolder = $null - } - catch - { - throw $_ - } - return $dfsnFolder -} - -<# - .SYNOPSIS - Lookup the DFSN Folder Target in a namespace. - - .PARAMETER Path - Specifies a path for the root of a DFS namespace. - - .PARAMETER TargetPath - Specifies a path for a root target of the DFS namespace. -#> -Function Get-FolderTarget -{ - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Path, - - [Parameter(Mandatory = $true)] - [System.String] - $TargetPath - ) - - try - { - $dfsnTarget = Get-DfsnFolderTarget ` - -Path $Path ` - -TargetPath $TargetPath ` - -ErrorAction Stop - } - catch [Microsoft.Management.Infrastructure.CimException] - { - $dfsnTarget = $null - } - catch - { - throw $_ - } - return $dfsnTarget -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceFolder/MSFT_xDFSNamespaceFolder.schema.mof b/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceFolder/MSFT_xDFSNamespaceFolder.schema.mof deleted file mode 100644 index ae786a9b..00000000 --- a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceFolder/MSFT_xDFSNamespaceFolder.schema.mof +++ /dev/null @@ -1,14 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xDFSNamespaceFolder")] -class MSFT_xDFSNamespaceFolder : OMI_BaseResource -{ - [Key, Description("Specifies a path for the root of a DFS namespace.")] String Path; - [Key, Description("Specifies a path for a root target of the DFS namespace.")] String TargetPath; - [Required, Description("Specifies if the DFS Namespace root should exist."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, Description("The description of the DFS Namespace.")] String Description; - [Write, Description("Indicates whether a DFS namespace server provides a client only with referrals that are in the same site as the client.")] Boolean EnableInsiteReferrals; - [Write, Description("Indicates whether a DFS namespace uses target failback.")] Boolean EnableTargetFailback; - [Write, Description("Specifies the target priority class for a DFS namespace root."), ValueMap{"Global-High","SiteCost-High","SiteCost-Normal","SiteCost-Low","Global-Low"}, Values{"Global-High","SiteCost-High","SiteCost-Normal","SiteCost-Low","Global-Low"}] String ReferralPriorityClass; - [Write, Description("Specifies the priority rank, as an integer, for a root target of the DFS namespace.")] Uint32 ReferralPriorityRank; - [Write, Description("Specifies a TTL interval, in seconds, for referrals.")] Uint32 TimeToLiveSec; - [Read] String State; -}; diff --git a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceFolder/en-us/MSFT_xDFSNamespaceFolder.strings.psd1 b/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceFolder/en-us/MSFT_xDFSNamespaceFolder.strings.psd1 deleted file mode 100644 index 71c77903..00000000 --- a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceFolder/en-us/MSFT_xDFSNamespaceFolder.strings.psd1 +++ /dev/null @@ -1,19 +0,0 @@ -ConvertFrom-StringData @' - GettingNamespaceFolderMessage = Getting DFS Namespace Folder "{0}" on target "{1}". - NamespaceFolderExistsMessage = DFS Namespace Folder "{0}" exists. - NamespaceFolderDoesNotExistMessage = DFS Namespace Folder "{0}" does not exist. - NamespaceFolderTargetExistsMessage = DFS Namespace Folder "{0}" on target "{1}" exists. - NamespaceFolderTargetDoesNotExistMessage = DFS Namespace Folder "{0}" on target "{1}" does not exist. - SettingNamespaceFolderMessage = Setting DFS Namespace Folder "{0}" on target "{1}". - NamespaceFolderUpdateParameterMessage = Setting DFS Namespace Folder "{0}" parameter {1} to "{2}". - NamespaceFolderTargetUpdateParameterMessage = Setting DFS Namespace Folder "{0}" on target "{1}" parameter {2} to "{3}". - NamespaceFolderTargetRemovedMessage = DFS Namespace Folder "{0}" on target "{1}" removed. - TestingNamespaceFolderMessage = Testing DFS Namespace Folder "{0}" on target "{1}". - NamespaceFolderParameterNeedsUpdateMessage = DFS Namespace Folder "{0}" parameter {1} is different. Change required. - NamespaceFolderTargetParameterNeedsUpdateMessage = DFS Namespace Folder "{0}" on target "{1}" parameter {2} is different. Change required. - NamespaceFolderDoesNotExistButShouldMessage = DFS Namespace Folder "{0}" does not exist but should. Change required. - NamespaceFolderTargetExistsButShouldNotMessage = DFS Namespace Folder "{0}" on target "{1}" exists but should not. Change required. - NamespaceFolderTargetDoesNotExistButShouldMessage = DFS Namespace Folder "{0}" on target "{1}" does not exist but should. Change required. - NamespaceFolderDoesNotExistAndShouldNotMessage = DFS Namespace Folder "{0}" does not exist and should not. Change not required. - NamespaceFolderTargetDoesNotExistAndShouldNotMessage = DFS Namespace Folder "{0}" on target "{1}" does not exist and should not. Change not required. -'@ diff --git a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceRoot/MSFT_xDFSNamespaceRoot.psm1 b/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceRoot/MSFT_xDFSNamespaceRoot.psm1 deleted file mode 100644 index cb21e41e..00000000 --- a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceRoot/MSFT_xDFSNamespaceRoot.psm1 +++ /dev/null @@ -1,840 +0,0 @@ -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Certificate Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'DFSDsc.ResourceHelper' ` - -ChildPath 'DFSDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$localizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xDFSNamespaceRoot' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# - .SYNOPSIS - Returns the current state of a DFS Namespace Root. - - .PARAMETER Path - Specifies a path for the root of a DFS namespace. - - .PARAMETER TargetPath - Specifies a path for a root target of the DFS namespace. - - .PARAMETER Ensure - Specifies if the DFS Namespace root should exist. - - .PARAMETER Type - Specifies the type of a DFS namespace as a Type object. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Path, - - [Parameter(Mandatory = $true)] - [System.String] - $TargetPath, - - [Parameter(Mandatory = $true)] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure, - - [Parameter(Mandatory = $true)] - [ValidateSet('Standalone','DomainV1','DomainV2')] - [System.String] - $Type - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.GettingNamespaceRootMessage) ` - -f $Type,$Path,$TargetPath - ) -join '' ) - - # Generate the return object assuming absent. - $returnValue = @{ - Path = $Path - TargetPath = $TargetPath - Ensure = 'Absent' - Type = $Type - } - - # Lookup the existing Namespace root - $root = Get-Root ` - -Path $Path - - if ($root) - { - # The namespace exists - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceRootExistsMessage) ` - -f $Type,$Path - ) -join '' ) - } - else - { - # The namespace does not exist - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceRootDoesNotExistMessage) ` - -f $Type,$Path - ) -join '' ) - return $returnValue - } # if - - $returnValue += @{ - TimeToLiveSec = $root.TimeToLiveSec - State = $root.State - Description = $root.Description - EnableSiteCosting = ($root.Flags -contains 'Site Costing') - EnableInsiteReferrals = ($root.Flags -contains 'Insite Referrals') - EnableAccessBasedEnumeration = ($root.Flags -contains 'AccessBased Enumeration') - EnableRootScalability = ($root.Flags -contains 'Root Scalability') - EnableTargetFailback = ($root.Flags -contains 'Target Failback') - } - - # DFS Root exists but does target exist? - $target = Get-RootTarget ` - -Path $Path ` - -TargetPath $TargetPath - - if ($target) - { - # The target exists in this namespace - $returnValue.Ensure = 'Present' - $returnValue += @{ - ReferralPriorityClass = $target.ReferralPriorityClass - ReferralPriorityRank = $target.ReferralPriorityRank - } - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceRootTargetExistsMessage) ` - -f $Type,$Path,$TargetPath - ) -join '' ) - } - else - { - # The target does not exist in this namespace - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceRootTargetDoesNotExistMessage) ` - -f $Type,$Path,$TargetPath - ) -join '' ) - } # if - - return $returnValue -} # Get-TargetResource - -<# - .SYNOPSIS - Sets the current state of a DFS Namespace Folder. - - .PARAMETER Path - Specifies a path for the root of a DFS namespace. - - .PARAMETER TargetPath - Specifies a path for a root target of the DFS namespace. - - .PARAMETER Ensure - Specifies if the DFS Namespace root should exist. - - .PARAMETER Type - Specifies the type of a DFS namespace as a Type object. - - .PARAMETER Description - The description of the DFS Namespace. - - .PARAMETER TimeToLiveSec - Specifies a TTL interval, in seconds, for referrals. - - .PARAMETER EnableSiteCosting - Indicates whether a DFS namespace uses cost-based selection. - - .PARAMETER EnableInsiteReferrals - Indicates whether a DFS namespace server provides a client only with referrals that are in the same site as the client. - - .PARAMETER EnableAccessBasedEnumeration - Indicates whether a DFS namespace uses access-based enumeration. - - .PARAMETER EnableRootScalability - Indicates whether a DFS namespace uses root scalability mode. - - .PARAMETER EnableTargetFailback - Indicates whether a DFS namespace uses target failback. - - .PARAMETER ReferralPriorityClass - Specifies the target priority class for a DFS namespace root. - - .PARAMETER ReferralPriorityRank - Specifies the priority rank, as an integer, for a root target of the DFS namespace. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Path, - - [Parameter(Mandatory = $true)] - [System.String] - $TargetPath, - - [Parameter(Mandatory = $true)] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure, - - [Parameter(Mandatory = $true)] - [ValidateSet('Standalone','DomainV1','DomainV2')] - [System.String] - $Type, - - [Parameter()] - [System.String] - $Description, - - [Parameter()] - [System.UInt32] - $TimeToLiveSec, - - [Parameter()] - [System.Boolean] - $EnableSiteCosting, - - [Parameter()] - [System.Boolean] - $EnableInsiteReferrals, - - [Parameter()] - [System.Boolean] - $EnableAccessBasedEnumeration, - - [Parameter()] - [System.Boolean] - $EnableRootScalability, - - [Parameter()] - [System.Boolean] - $EnableTargetFailback, - - [Parameter()] - [ValidateSet('Global-High','SiteCost-High','SiteCost-Normal','SiteCost-Low','Global-Low')] - [System.String] - $ReferralPriorityClass, - - [Parameter()] - [System.UInt32] - $ReferralPriorityRank - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.SettingNamespaceRootMessage) ` - -f $Type,$Path,$TargetPath - ) -join '' ) - - # Lookup the existing Namespace root - $root = Get-Root ` - -Path $Path - - if ($Ensure -eq 'Present') - { - # Set desired Configuration - if ($root) - { - # Does the root need to be updated? - [System.Boolean] $rootChange = $false - - # The root properties that will be updated - $rootProperties = @{ - State = 'online' - } - - if (($Description) ` - -and ($root.Description -ne $Description)) - { - $rootProperties += @{ - Description = $Description - } - $rootChange = $true - } # if - - if (($TimeToLiveSec) ` - -and ($root.TimeToLiveSec -ne $TimeToLiveSec)) - { - $rootProperties += @{ - TimeToLiveSec = $TimeToLiveSec - } - $rootChange = $true - } # if - - if (($null -ne $EnableSiteCosting) ` - -and (($root.Flags -contains 'Site Costing') -ne $EnableSiteCosting)) - { - $rootProperties += @{ - EnableSiteCosting = $EnableSiteCosting - } - $rootChange = $true - } # if - - if (($null -ne $EnableInsiteReferrals) ` - -and (($root.Flags -contains 'Insite Referrals') -ne $EnableInsiteReferrals)) - { - $rootProperties += @{ - EnableInsiteReferrals = $EnableInsiteReferrals - } - $rootChange = $true - } # if - - if (($null -ne $EnableAccessBasedEnumeration) ` - -and (($root.Flags -contains 'AccessBased Enumeration') -ne $EnableAccessBasedEnumeration)) - { - $rootProperties += @{ - EnableAccessBasedEnumeration = $EnableAccessBasedEnumeration - } - $rootChange = $true - } # if - - if (($null -ne $EnableRootScalability) ` - -and (($root.Flags -contains 'Root Scalability') -ne $EnableRootScalability)) - { - $rootProperties += @{ - EnableRootScalability = $EnableRootScalability - } - $rootChange = $true - } # if - - if (($null -ne $EnableTargetFailback) ` - -and (($root.Flags -contains 'Target Failback') -ne $EnableTargetFailback)) - { - $rootProperties += @{ - EnableTargetFailback = $EnableTargetFailback - } - $rootChange = $true - } # if - - if ($rootChange) - { - # Update root settings - $null = Set-DfsnRoot ` - -Path $Path ` - @RootProperties ` - -ErrorAction Stop - - $rootProperties.GetEnumerator() | ForEach-Object -Process { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceRootUpdateParameterMessage) ` - -f $Type,$Path,$_.name, $_.value - ) -join '' ) - } - } # if - - # Get target - $target = Get-RootTarget ` - -Path $Path ` - -TargetPath $TargetPath - - # Does the target need to be updated? - [System.Boolean] $targetChange = $false - - # The Target properties that will be updated - $targetProperties = @{} - - # Check the target properties - if (($ReferralPriorityClass) ` - -and ($target.ReferralPriorityClass -ne $ReferralPriorityClass)) - { - $targetProperties += @{ - ReferralPriorityClass = ($ReferralPriorityClass -replace '-','') - } - $targetChange = $true - } # if - - if (($ReferralPriorityRank) ` - -and ($target.ReferralPriorityRank -ne $ReferralPriorityRank)) - { - $targetProperties += @{ - ReferralPriorityRank = $ReferralPriorityRank - } - $targetChange = $true - } # if - - # Is the target a member of the namespace? - if ($target) - { - # Does the target need to be changed? - if ($targetChange) - { - # Update target settings - $null = Set-DfsnRootTarget ` - -Path $Path ` - -TargetPath $TargetPath ` - @TargetProperties ` - -ErrorAction Stop - } - } - else - { - # Add target to Namespace - $null = New-DfsnRootTarget ` - -Path $Path ` - -TargetPath $TargetPath ` - @TargetProperties ` - -ErrorAction Stop - } # if - - # Output the target parameters that were changed/set - $targetProperties.GetEnumerator() | ForEach-Object -Process { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceRootTargetUpdateParameterMessage) ` - -f $Type,$Path,$TargetPath,$_.name, $_.value - ) -join '' ) - } - } - else - { - <# - Prepare to use the PSBoundParameters as a splat to created - The new DFS Namespace root. - #> - $null = $PSBoundParameters.Remove('Ensure') - - # Correct the ReferralPriorityClass field - if ($ReferralPriorityClass) - { - $PSBoundParameters.ReferralPriorityClass = ($ReferralPriorityClass -replace '-','') - } # if - - # Create New-DfsnRoot - $null = New-DfsnRoot ` - @PSBoundParameters ` - -ErrorAction Stop - - $PSBoundParameters.GetEnumerator() | ForEach-Object -Process { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceRootUpdateParameterMessage) ` - -f $Type,$Path,$_.name, $_.value - ) -join '' ) - } - } # if - } - else - { - <# - The Namespace Target should not exist - Get root target - #> - $target = Get-RootTarget ` - -Path $Path ` - -TargetPath $TargetPath - - if ($target) - { - # Remove the target from the namespace - $null = Remove-DfsnRootTarget ` - -Path $Path ` - -TargetPath $TargetPath ` - -Confirm:$false ` - -ErrorAction Stop - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceRootTargetRemovedMessage) ` - -f $Type,$Path,$TargetPath - ) -join '' ) - } # if - } # if -} # Set-TargetResource - -<# - .SYNOPSIS - Tests the current state of a DFS Namespace Folder. - - .PARAMETER Path - Specifies a path for the root of a DFS namespace. - - .PARAMETER TargetPath - Specifies a path for a root target of the DFS namespace. - - .PARAMETER Ensure - Specifies if the DFS Namespace root should exist. - - .PARAMETER Type - Specifies the type of a DFS namespace as a Type object. - - .PARAMETER Description - The description of the DFS Namespace. - - .PARAMETER TimeToLiveSec - Specifies a TTL interval, in seconds, for referrals. - - .PARAMETER EnableSiteCosting - Indicates whether a DFS namespace uses cost-based selection. - - .PARAMETER EnableInsiteReferrals - Indicates whether a DFS namespace server provides a client only with referrals that are in the same site as the client. - - .PARAMETER EnableAccessBasedEnumeration - Indicates whether a DFS namespace uses access-based enumeration. - - .PARAMETER EnableRootScalability - Indicates whether a DFS namespace uses root scalability mode. - - .PARAMETER EnableTargetFailback - Indicates whether a DFS namespace uses target failback. - - .PARAMETER ReferralPriorityClass - Specifies the target priority class for a DFS namespace root. - - .PARAMETER ReferralPriorityRank - Specifies the priority rank, as an integer, for a root target of the DFS namespace. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Path, - - [Parameter(Mandatory = $true)] - [System.String] - $TargetPath, - - [Parameter(Mandatory = $true)] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure, - - [Parameter(Mandatory = $true)] - [ValidateSet('Standalone','DomainV1','DomainV2')] - [System.String] - $Type, - - [Parameter()] - [System.String] - $Description, - - [Parameter()] - [System.UInt32] - $TimeToLiveSec, - - [Parameter()] - [System.Boolean] - $EnableSiteCosting, - - [Parameter()] - [System.Boolean] - $EnableInsiteReferrals, - - [Parameter()] - [System.Boolean] - $EnableAccessBasedEnumeration, - - [Parameter()] - [System.Boolean] - $EnableRootScalability, - - [Parameter()] - [System.Boolean] - $EnableTargetFailback, - - [Parameter()] - [ValidateSet('Global-High','SiteCost-High','SiteCost-Normal','SiteCost-Low','Global-Low')] - [System.String] - $ReferralPriorityClass, - - [Parameter()] - [System.UInt32] - $ReferralPriorityRank - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.TestingNamespaceRootMessage) ` - -f $Type,$Path,$TargetPath - ) -join '' ) - - # Flag to signal whether settings are correct - [System.Boolean] $desiredConfigurationMatch = $true - - # Lookup the existing Namespace root - $root = Get-Root ` - -Path $Path - - if ($Ensure -eq 'Present') - { - # The Namespace root should exist - if ($root) - { - <# - The Namespace root exists and should - Changing the namespace type is not possible - the namespace - can only be recreated if the type should change. - #> - if (($root.Type -replace ' ','') -ne $Type) - { - New-InvalidOperationException ` - -Message ($($LocalizedData.NamespaceRootTypeConversionError) ` - -f $Type,($root.Type -replace ' ','')) - } # if - - # Check the Namespace parameters - if (($Description) ` - -and ($root.Description -ne $Description)) { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceRootParameterNeedsUpdateMessage) ` - -f $Type,$Path,'Description' - ) -join '' ) - - $desiredConfigurationMatch = $false - } # if - - if (($TimeToLiveSec) ` - -and ($root.TimeToLiveSec -ne $TimeToLiveSec)) { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceRootParameterNeedsUpdateMessage) ` - -f $Type,$Path,'TimeToLiveSec' - ) -join '' ) - - $desiredConfigurationMatch = $false - } # if - - if (($null -ne $EnableSiteCosting) ` - -and (($root.Flags -contains 'Site Costing') -ne $EnableSiteCosting)) { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceRootParameterNeedsUpdateMessage) ` - -f $Type,$Path,'EnableSiteCosting' - ) -join '' ) - - $desiredConfigurationMatch = $false - } # if - - if (($null -ne $EnableInsiteReferrals) ` - -and (($root.Flags -contains 'Insite Referrals') -ne $EnableInsiteReferrals)) { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceRootParameterNeedsUpdateMessage) ` - -f $Type,$Path,'EnableInsiteReferrals' - ) -join '' ) - - $desiredConfigurationMatch = $false - } # if - - if (($null -ne $EnableAccessBasedEnumeration) ` - -and (($root.Flags -contains 'AccessBased Enumeration') -ne $EnableAccessBasedEnumeration)) { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceRootParameterNeedsUpdateMessage) ` - -f $Type,$Path,'EnableAccessBasedEnumeration' - ) -join '' ) - - $desiredConfigurationMatch = $false - } # if - - if (($null -ne $EnableRootScalability) ` - -and (($root.Flags -contains 'Root Scalability') -ne $EnableRootScalability)) { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceRootParameterNeedsUpdateMessage) ` - -f $Type,$Path,'EnableRootScalability' - ) -join '' ) - - $desiredConfigurationMatch = $false - } # if - - if (($null -ne $EnableTargetFailback) ` - -and (($root.Flags -contains 'Target Failback') -ne $EnableTargetFailback)) { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceRootParameterNeedsUpdateMessage) ` - -f $Type,$Path,'EnableTargetFailback' - ) -join '' ) - - $desiredConfigurationMatch = $false - } # if - - $target = Get-RootTarget ` - -Path $Path ` - -TargetPath $TargetPath - - if ($target) - { - if (($ReferralPriorityClass) ` - -and ($target.ReferralPriorityClass -ne $ReferralPriorityClass)) { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceRootTargetParameterNeedsUpdateMessage) ` - -f $Type,$Path,$TargetPath,'ReferralPriorityClass' - ) -join '' ) - $desiredConfigurationMatch = $false - } # if - - if (($ReferralPriorityRank) ` - -and ($target.ReferralPriorityRank -ne $ReferralPriorityRank)) { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceRootTargetParameterNeedsUpdateMessage) ` - -f $Type,$Path,$TargetPath,'ReferralPriorityRank' - ) -join '' ) - $desiredConfigurationMatch = $false - } # if - } - else - { - # The Root target does not exist but should - change required - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceRootTargetDoesNotExistButShouldMessage) ` - -f $Type,$Path,$TargetPath - ) -join '' ) - $desiredConfigurationMatch = $false - } # if - } - else - { - # Ths Namespace root doesn't exist but should - change required - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceRootDoesNotExistButShouldMessage) ` - -f $Type,$Path - ) -join '' ) - $desiredConfigurationMatch = $false - } # if - } - else - { - # The Namespace target should not exist - if ($root) - { - $target = Get-RootTarget ` - -Path $Path ` - -TargetPath $TargetPath - - if ($target) - { - # The Root target exists but should not - change required - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceRootTargetExistsButShouldNotMessage) ` - -f $Type,$Path,$TargetPath - ) -join '' ) - $desiredConfigurationMatch = $false - } - else - { - # The Namespace exists but the target doesn't - change not required - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceRootTargetDoesNotExistAndShouldNotMessage) ` - -f $Type,$Path,$TargetPath - ) -join '' ) - } # if - } - else - { - # The Namespace does not exist (so neither does the target) - change not required - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceRootDoesNotExistAndShouldNotMessage) ` - -f $Type,$Path - ) -join '' ) - } # if - } # if - - return $desiredConfigurationMatch -} # Test-TargetResource - -<# - .SYNOPSIS - Lookup the DFSN Root. - - .PARAMETER Path - Specifies a path for the root of a DFS namespace. -#> -Function Get-Root -{ - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Path - ) - - try - { - $dfsnRoot = Get-DfsnRoot ` - -Path $Path ` - -ErrorAction Stop - } - catch [Microsoft.Management.Infrastructure.CimException] - { - $dfsnRoot = $null - } - catch - { - throw $_ - } - return $dfsnRoot -} - -<# - .SYNOPSIS - Lookup the DFSN Root Target in a namespace. - - .PARAMETER Path - Specifies a path for the root of a DFS namespace. - - .PARAMETER TargetPath - Specifies a path for a root target of the DFS namespace. -#> -Function Get-RootTarget -{ - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Path, - - [Parameter(Mandatory = $true)] - [System.String] - $TargetPath - ) - - try - { - $dfsnTarget = Get-DfsnRootTarget ` - -Path $Path ` - -TargetPath $TargetPath ` - -ErrorAction Stop - } - catch [Microsoft.Management.Infrastructure.CimException] - { - $dfsnTarget = $null - } - catch - { - throw $_ - } - return $dfsnTarget -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceRoot/MSFT_xDFSNamespaceRoot.schema.mof b/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceRoot/MSFT_xDFSNamespaceRoot.schema.mof deleted file mode 100644 index 98435b89..00000000 --- a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceRoot/MSFT_xDFSNamespaceRoot.schema.mof +++ /dev/null @@ -1,18 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xDFSNamespaceRoot")] -class MSFT_xDFSNamespaceRoot : OMI_BaseResource -{ - [Key, Description("Specifies a path for the root of a DFS namespace.")] String Path; - [Key, Description("Specifies a path for a root target of the DFS namespace.")] String TargetPath; - [Required, Description("Specifies if the DFS Namespace root should exist."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Required, Description("Specifies the type of a DFS namespace as a Type object."), ValueMap{"Standalone","DomainV1","DomainV2"}, Values{"Standalone","DomainV1","DomainV2"}] String Type; - [Write, Description("The description of the DFS Namespace.")] String Description; - [Write, Description("Indicates whether a DFS namespace uses cost-based selection.")] Boolean EnableSiteCosting; - [Write, Description("Indicates whether a DFS namespace server provides a client only with referrals that are in the same site as the client.")] Boolean EnableInsiteReferrals; - [Write, Description("Indicates whether a DFS namespace uses access-based enumeration.")] Boolean EnableAccessBasedEnumeration; - [Write, Description("Indicates whether a DFS namespace uses root scalability mode.")] Boolean EnableRootScalability; - [Write, Description("Indicates whether a DFS namespace uses target failback.")] Boolean EnableTargetFailback; - [Write, Description("Specifies the target priority class for a DFS namespace root."), ValueMap{"Global-High","SiteCost-High","SiteCost-Normal","SiteCost-Low","Global-Low"}, Values{"Global-High","SiteCost-High","SiteCost-Normal","SiteCost-Low","Global-Low"}] String ReferralPriorityClass; - [Write, Description("Specifies the priority rank, as an integer, for a root target of the DFS namespace.")] Uint32 ReferralPriorityRank; - [Write, Description("Specifies a TTL interval, in seconds, for referrals.")] Uint32 TimeToLiveSec; - [Read] String State; -}; diff --git a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceRoot/en-us/MSFT_xDFSNamespaceRoot.strings.psd1 b/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceRoot/en-us/MSFT_xDFSNamespaceRoot.strings.psd1 deleted file mode 100644 index c5b5066e..00000000 --- a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceRoot/en-us/MSFT_xDFSNamespaceRoot.strings.psd1 +++ /dev/null @@ -1,20 +0,0 @@ -ConvertFrom-StringData @' - GettingNamespaceRootMessage = Getting {0} DFS Namespace Root "{1}" on target "{2}". - NamespaceRootExistsMessage = {0} DFS Namespace Root "{1}" exists. - NamespaceRootDoesNotExistMessage = {0} DFS Namespace Root "{1}" does not exist. - NamespaceRootTargetExistsMessage = {0} DFS Namespace Root "{1}" on target "{2}" exists. - NamespaceRootTargetDoesNotExistMessage = {0} DFS Namespace Root "{1}" on target "{2}" does not exist. - SettingNamespaceRootMessage = Setting {0} DFS Namespace Root "{1}" on target "{2}". - NamespaceRootUpdateParameterMessage = Setting {0} DFS Namespace Root "{1}" parameter {2} to "{3}". - NamespaceRootTargetUpdateParameterMessage = Setting {0} DFS Namespace Root "{1}" on target "{2}" parameter {3} to "{4}". - NamespaceRootTargetRemovedMessage = {0} DFS Namespace Root "{1}" on target "{2}" removed. - TestingNamespaceRootMessage = Testing {0} DFS Namespace Root "{1}" on target "{2}". - NamespaceRootTypeConversionError = Error {0} DFS Namespace can not be added to a {1} DFS Namespace. - NamespaceRootParameterNeedsUpdateMessage = {0} DFS Namespace Root "{1}" parameter {2} is different. Change required. - NamespaceRootTargetParameterNeedsUpdateMessage = {0} DFS Namespace Root "{1}" on target "{2}" parameter {3} is different. Change required. - NamespaceRootDoesNotExistButShouldMessage = {0} DFS Namespace Root "{1}" does not exist but should. Change required. - NamespaceRootTargetExistsButShouldNotMessage = {0} DFS Namespace Root "{1}" on target "{2}" exists but should not. Change required. - NamespaceRootTargetDoesNotExistButShouldMessage = {0} DFS Namespace Root "{1}" on target "{2}" does not exist but should. Change required. - NamespaceRootDoesNotExistAndShouldNotMessage = {0} DFS Namespace Root "{1}" does not exist and should not. Change not required. - NamespaceRootTargetDoesNotExistAndShouldNotMessage = {0} DFS Namespace Root "{1}" on target "{2}" does not exist and should not. Change not required. -'@ diff --git a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceServerConfiguration/MSFT_xDFSNamespaceServerConfiguration.psm1 b/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceServerConfiguration/MSFT_xDFSNamespaceServerConfiguration.psm1 deleted file mode 100644 index cd8c171d..00000000 --- a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceServerConfiguration/MSFT_xDFSNamespaceServerConfiguration.psm1 +++ /dev/null @@ -1,267 +0,0 @@ -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Certificate Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'DFSDsc.ResourceHelper' ` - -ChildPath 'DFSDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$localizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xDFSNamespaceServerConfiguration' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# - This is an array of all the parameters used by this resource. - If the property Restart is true then when this property is updated the service - will be restarted. -#> -data parameterList -{ - @( - @{ - Name = 'LdapTimeoutSec' - Type = 'Uint32' - }, - @{ - Name = 'SyncIntervalSec' - Type = 'String' - }, - @{ - Name = 'UseFQDN' - Type = 'Uint32' - Restart = $True - } - ) -} - -<# - .SYNOPSIS - Returns the current state of a DFS Namespace Server Configuration. - - .PARAMETER IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes' -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [System.String] - $IsSingleInstance - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.GettingNamespaceServerConfigurationMessage) - ) -join '' ) - - # Get the current DFSN Server Configuration - $serverConfiguration = Get-DfsnServerConfiguration ` - -ComputerName $env:COMPUTERNAME ` - -ErrorAction Stop - - # Generate the return object. - $returnValue = @{ - IsSingleInstance = 'Yes' - } - - foreach ($parameter in $parameterList) - { - $returnValue += @{ - $parameter.Name = $serverConfiguration.$($parameter.name) - } - } # foreach - - return $returnValue -} # Get-TargetResource - -<# - .SYNOPSIS - Sets the DFS Namespace Server Configuration. - - .PARAMETER IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes'. - - .PARAMETER LdapTimeoutSec - Specifies a time-out value, in seconds, for Lightweight Directory - Access Protocol (LDAP) requests for the DFS namespace server. - - .PARAMETER SyncIntervalSec - This interval controls how often domain-based DFS namespace root - servers and domain controllers connect to the PDC emulator to get - updates of DFS namespace metadata. - - .PARAMETER UseFQDN - Indicates whether a DFS namespace server uses FQDNs in referrals. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [System.String] - $IsSingleInstance, - - [Parameter()] - [System.UInt32] - $LdapTimeoutSec, - - [Parameter()] - [System.UInt32] - $SyncIntervalSec, - - [Parameter()] - [System.Boolean] - $UseFQDN - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.SettingNamespaceServerConfigurationMessage) - ) -join '' ) - - # Get the current DFSN Server Configuration - $serverConfiguration = Get-DfsnServerConfiguration ` - -ComputerName $env:COMPUTERNAME ` - -ErrorAction Stop - - # Generate a list of parameters that will need to be changed. - $changeParameters = @{} - $restart = $False - - foreach ($parameter in $parameterList) - { - $parameterSource = $serverConfiguration.$($parameter.name) - $parameterNew = (Get-Variable -Name ($parameter.name)).Value - if ($PSBoundParameters.ContainsKey($parameter.Name) ` - -and ($parameterSource -ne $parameterNew)) - { - $changeParameters += @{ - $($parameter.name) = $parameterNew - } - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceServerConfigurationUpdateParameterMessage) ` - -f $parameter.Name,$parameterNew - ) -join '' ) - - if ($parameter.Restart) - { - $restart = $True - } # if - } # if - } # foreach - - if ($changeParameters.Count -gt 0) - { - # Update any parameters that were identified as different - $null = Set-DfsnServerConfiguration ` - -ComputerName $env:COMPUTERNAME ` - @changeParameters ` - -ErrorAction Stop - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceServerConfigurationUpdatedMessage) - ) -join '' ) - - if ($restart) - { - # Restart the DFS Service - $null = Restart-Service ` - -Name DFS ` - -Force ` - -ErrorAction Stop - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceServerConfigurationServiceRestartedMessage) - ) -join '' ) - } - } # if -} # Set-TargetResource - -<# - .SYNOPSIS - Tests the DFS Namespace Server Configuration. - - .PARAMETER IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes'. - - .PARAMETER LdapTimeoutSec - Specifies a time-out value, in seconds, for Lightweight Directory - Access Protocol (LDAP) requests for the DFS namespace server. - - .PARAMETER SyncIntervalSec - This interval controls how often domain-based DFS namespace root - servers and domain controllers connect to the PDC emulator to get - updates of DFS namespace metadata. - - .PARAMETER UseFQDN - Indicates whether a DFS namespace server uses FQDNs in referrals. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [System.String] - $IsSingleInstance, - - [Parameter()] - [System.UInt32] - $LdapTimeoutSec, - - [Parameter()] - [System.UInt32] - $SyncIntervalSec, - - [Parameter()] - [System.Boolean] - $UseFQDN - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.TestingNamespaceServerConfigurationMessage) - ) -join '' ) - - # Flag to signal whether settings are correct - [System.Boolean] $desiredConfigurationMatch = $true - - # Get the current DFSN Server Configuration - $serverConfiguration = Get-DfsnServerConfiguration ` - -ComputerName $env:COMPUTERNAME ` - -ErrorAction Stop - - # Check each parameter - foreach ($parameter in $parameterList) - { - $parameterSource = $serverConfiguration.$($parameter.name) - $parameterNew = (Get-Variable -Name ($parameter.name)).Value - - if ($PSBoundParameters.ContainsKey($parameter.Name) ` - -and ($parameterSource -ne $parameterNew)) { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NamespaceServerConfigurationParameterNeedsUpdateMessage) ` - -f $parameter.Name,$parameterSource,$parameterNew - ) -join '' ) - - $desiredConfigurationMatch = $false - } # if - } # foreach - - return $desiredConfigurationMatch -} # Test-TargetResource - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceServerConfiguration/MSFT_xDFSNamespaceServerConfiguration.schema.mof b/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceServerConfiguration/MSFT_xDFSNamespaceServerConfiguration.schema.mof deleted file mode 100644 index be71d22b..00000000 --- a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceServerConfiguration/MSFT_xDFSNamespaceServerConfiguration.schema.mof +++ /dev/null @@ -1,8 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xDFSNamespaceServerConfiguration")] -class MSFT_xDFSNamespaceServerConfiguration : OMI_BaseResource -{ - [Key, Description("Specifies the resource is a single instance, the value must be 'Yes'."), ValueMap{"Yes"}, Values{"Yes"}] String IsSingleInstance; - [Write, Description("Specifies a time-out value, in seconds, for Lightweight Directory Access Protocol (LDAP) requests for the DFS namespace server.")] Uint32 LdapTimeoutSec; - [Write, Description("This interval controls how often domain-based DFS namespace root servers and domain controllers connect to the PDC emulator to get updates of DFS namespace metadata.")] Uint32 SyncIntervalSec; - [Write, Description("Indicates whether a DFS namespace server uses FQDNs in referrals.")] Boolean UseFQDN; -}; diff --git a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceServerConfiguration/en-us/MSFT_xDFSNamespaceServerConfiguration.strings.psd1 b/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceServerConfiguration/en-us/MSFT_xDFSNamespaceServerConfiguration.strings.psd1 deleted file mode 100644 index deab384d..00000000 --- a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSNamespaceServerConfiguration/en-us/MSFT_xDFSNamespaceServerConfiguration.strings.psd1 +++ /dev/null @@ -1,9 +0,0 @@ -ConvertFrom-StringData @' - GettingNamespaceServerConfigurationMessage = Getting DFS Namespace Server Configuration. - SettingNamespaceServerConfigurationMessage = Setting DFS Namespace Server Configuration. - NamespaceServerConfigurationUpdateParameterMessage = Setting DFS Namespace Server Configuration parameter {0} to "{1}". - NamespaceServerConfigurationUpdatedMessage = Setting DFS Namespace Server Configuration updated. - NamespaceServerConfigurationServiceRestartedMessage = DFS Namespace Server restarted. - TestingNamespaceServerConfigurationMessage = Testing DFS Namespace Server Configuration. - NamespaceServerConfigurationParameterNeedsUpdateMessage = DFS Namespace Server Configuration parameter "{0}" is "{1}" but should be "{2}". Change required. -'@ diff --git a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroup/MSFT_xDFSReplicationGroup.psm1 b/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroup/MSFT_xDFSReplicationGroup.psm1 deleted file mode 100644 index efb65283..00000000 --- a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroup/MSFT_xDFSReplicationGroup.psm1 +++ /dev/null @@ -1,866 +0,0 @@ -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Certificate Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'DFSDsc.ResourceHelper' ` - -ChildPath 'DFSDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$localizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xDFSReplicationGroup' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# - .SYNOPSIS - Returns the current state of a DFS Replication Group. - - .PARAMETER GroupName - The name of the DFS Replication Group. - - .PARAMETER Ensure - Specifies whether the DSF Replication Group should exist. - - .PARAMETER DomainName - The AD domain the Replication Group should created in. -#> -function Get-TargetResource -{ - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $GroupName, - - [Parameter(Mandatory = $true)] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure, - - [Parameter()] - [System.String] - $DomainName - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.GettingReplicationGroupMessage) ` - -f $GroupName - ) -join '' ) - - # Lookup the existing Replication Group - $replicationGroupParameters = @{ - GroupName = $GroupName - } - - $returnValue = $replicationGroupParameters.Clone() - - if ($DomainName) - { - $replicationGroupParameters += @{ - DomainName = $DomainName - } - } # if - - $replicationGroup = Get-DfsReplicationGroup @replicationGroupParameters ` - -ErrorAction Stop - - if ($replicationGroup) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupExistsMessage) ` - -f $GroupName - ) -join '' ) - - <# - Array paramters are disabled until this issue is resolved: - https://windowsserver.uservoice.com/forums/301869-powershell/suggestions/11088807-get-dscconfiguration-fails-with-embedded-cim-type - When resolved these parameters can be added into return value - Members = @((Get-DfsrMember @replicationGroupParameters -ErrorAction Stop).ComputerName) - Folders = @((Get-DfsReplicatedFolder @replicationGroupParameters -ErrorAction Stop).FolderName) - #> - $returnValue += @{ - Ensure = 'Present' - Description = $replicationGroup.Description - DomainName = $replicationGroup.DomainName - Members = @() - Folders = @() - ContentPaths = @() - } - } - else - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupDoesNotExistMessage) ` - -f $GroupName - ) -join '' ) - - $returnValue += @{ - Ensure = 'Absent' - } - } # if - - return $returnValue -} # Get-TargetResource - -<# - .SYNOPSIS - Sets the current state of a DFS Replication Group. - - .PARAMETER GroupName - The name of the DFS Replication Group. - - .PARAMETER Ensure - Specifies whether the DSF Replication Group should exist. - - .PARAMETER Description - A description for the DFS Replication Group. - - .PARAMETER Members - A list of computers that are members of this Replication Group. - These can be specified using either the ComputerName or FQDN name - for each member. If an FQDN name is used and the DomainName - parameter is set, the FQDN domain name must match. - - .PARAMETER Folders - A list of folders that are replicated in this Replication Group. - - .PARAMETER Topology - This allows a replication topology to assign to the Replication Group. - It defaults to Manual, which will not automatically create a topology. - If set to Fullmesh, a full mesh topology between all members will be - created. - - .PARAMETER ContentPaths - An array of DFS Replication Group Content Paths to use for each of the - Folders. This can have one entry for each Folder in the Folders - parameter and should be set in th same order. If any entry is not blank - then the Content Paths will need to be set manually by - using the xDFSReplicationGroupMembership resource. - - .PARAMETER DomainName - The AD domain the Replication Group should created in. -#> -function Set-TargetResource -{ - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $GroupName, - - [Parameter(Mandatory = $true)] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure, - - [Parameter()] - [System.String] - $Description, - - [Parameter()] - [System.String[]] - $Members, - - [Parameter()] - [System.String[]] - $Folders, - - [Parameter()] - [ValidateSet('Fullmesh','Manual')] - [System.String] - $Topology = 'Manual', - - [Parameter()] - [System.String[]] - $ContentPaths, - - [Parameter()] - [System.String] - $DomainName - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.SettingRegGroupMessage) ` - -f $GroupName - ) -join '' ) - - # Lookup the existing Replication Group - $replicationGroupParameters = @{ - GroupName = $GroupName - } - - if ($DomainName) - { - $replicationGroupParameters += @{ - DomainName = $DomainName - } - } # if - - $replicationGroup = Get-DfsReplicationGroup @replicationGroupParameters ` - -ErrorAction Stop - - if ($Ensure -eq 'Present') - { - # The rep group should exist - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.EnsureReplicationGroupExistsMessage) ` - -f $GroupName - ) -join '' ) - - if ($Description) - { - $replicationGroupParameters += @{ - Description = $Description - } - } # if - - if ($replicationGroup) - { - # The RG exists already - Check the existing RG and members - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupExistsMessage) ` - -f $GroupName - ) -join '' ) - - # Check the description - if (($Description) -and ($replicationGroup.Description -ne $Description)) - { - Set-DfsReplicationGroup @replicationGroupParameters -ErrorAction Stop - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupDescriptionUpdatedMessage) ` - -f $GroupName - ) -join '' ) - } # if - } - else - { - # Ths Rep Groups doesn't exist - Create it - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupDoesNotExistMessage) ` - -f $GroupName - ) -join '' ) - - New-DfsReplicationGroup @replicationGroupParameters -ErrorAction Stop - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupCreatedMessage) ` - -f $GroupName - ) -join '' ) - } # if - - # Clean up the splat so we can use it in the next cmdlets - $replicationGroupParameters.Remove('Description') - - # Create an array of FQDN Members from the Members Array - $replicationGroupParameters += @{ - ComputerName = '' - } - - foreach ($member in $Members) - { - $replicationGroupParameters.ComputerName = $member - $fqdnMembers += @( - Get-FQDNMemberName @replicationGroupParameters - ) - } # foreach - - $replicationGroupParameters.Remove('ComputerName') - - # Get the existing members of this DFS Rep Group - $existingMembers = (Get-DfsrMember @replicationGroupParameters -ErrorAction Stop).DnsName - - # Add any missing members - foreach ($Member in $fqdnMembers) - { - if ($member -notin $existingMembers) - { - # Member is missing - add it - Add-DfsrMember @replicationGroupParameters ` - -ComputerName $member ` - -ErrorAction Stop - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupMemberAddedMessage) ` - -f $GroupName,$member - ) -join '' ) - } # if - } # foreach - - # Remove any members that shouldn't exist - foreach ($existingMember in $existingMembers) - { - if ($existingMember -notin $fqdnMembers) - { - # Member exists but shouldn't - remove it - Remove-DfsrMember @replicationGroupParameters ` - -ComputerName $existingMember ` - -Force ` - -ErrorAction Stop - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupMemberRemovedMessage) ` - -f $GroupName,$existingMember - ) -join '' ) - } # if - } # foreach - - # Get the existing folders of this DFS Rep Group - $existingFolders = (Get-DfsReplicatedFolder @replicationGroupParameters -ErrorAction Stop).FolderName - - # Add any missing folders - foreach ($folder in $Folders) - { - if ($folder -notin $existingFolders) - { - # Folder is missing - add it - New-DfsReplicatedFolder @replicationGroupParameters ` - -FolderName $folder ` - -ErrorAction Stop - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupFolderAddedMessage) ` - -f $GroupName,$folder - ) -join '' ) - } # if - } # foreach - - # Remove any folders that shouldn't exist - foreach ($existingFolder in $existingFolders) - { - if ($existingFolder -notin $Folders) - { - # Folder exists but shouldn't - remove it - Remove-DfsReplicatedFolder @replicationGroupParameters ` - -Folder $existingFolder ` - -Force ` - -ErrorAction Stop - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupFolderRemovedMessage) ` - -f $GroupName,$existingFolder - ) -join '' ) - } # if - } # foreach - - # Set the content paths (if any were passed in the array) - if ($ContentPaths) - { - # Get the current memberships for this rep group - $memberships = Get-DfsrMembership @replicationGroupParameters ` - -ErrorAction Stop - - # Scan through the content paths array - for ($i=0; $i -lt $Folders.Count; $i++) - { - $contentPath = $ContentPaths[$i] - if ($contentPath) - { - foreach ($membership in $memberships) - { - [System.String] $fqdnMemberName = Get-FQDNMemberName ` - @replicationGroupParameters ` - -ComputerName $membership.ComputerName - - [System.Boolean] $primaryMember = ($fqdnMemberName -eq $fqdnMembers[0]) - - if (($membership.FolderName -ne $Folders[$i]) ` - -or (($membership.ContentPath -eq $ContentPath) ` - -and ($membership.PrimaryMember -eq $primaryMember))) - { - # Don't update this membership - continue - } - - # The Content Path for this member needs to be set - Set-DfsrMembership @replicationGroupParameters ` - -FolderName $membership.FolderName ` - -ComputerName $membership.ComputerName ` - -PrimaryMember $primaryMember ` - -ContentPath $ContentPath - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupContentPathUpdatedMessage) ` - -f $GroupName,$membership.ComputerName - ) -join '' ) - } # foreach - } # if - } # foreach - } # if - - # If the topology is not manual, automatically configure the connections - switch ($Topology) - { - 'Fullmesh' - { - $replicationGroupParameters += @{ - SourceComputerName = '' - DestinationComputerName = '' - } - - # Scan through the combination of connections - foreach ($source in $fqdnMembers) - { - foreach ($destination in $fqdnMembers) - { - if ($source -eq $destination) - { - continue - } # if - - $replicationGroupParameters.SourceComputerName = $source - $replicationGroupParameters.DestinationComputerName = $destination - - $replicationGroupConnection = Get-DfsrConnection @replicationGroupParameters ` - -ErrorAction Stop - - if ($replicationGroupConnection) { - if (-not $replicationGroupConnection.Enabled) { - Set-DfsrConnection @replicationGroupParameters ` - -DisableConnection $false ` - -ErrorAction Stop - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupFullMeshConnectionUpdatedMessage) ` - -f $GroupName,$source,$destination - ) -join '' ) - } # if - } - else - { - Add-DfsrConnection @replicationGroupParameters ` - -ErrorAction Stop - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupFullMeshConnectionAddedMessage) ` - -f $GroupName,$source,$destination - ) -join '' ) - } # if - } # foreach - } # foreach - } # 'Fullmesh' - } # swtich - } - else - { - # The Rep Group should not exist - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.EnsureReplicationGroupDoesNotExistMessage) ` - -f $GroupName - ) -join '' ) - - if ($replicationGroup) - { - # Remove the replication group - Remove-DfsReplicationGroup @replicationGroupParameters ` - -RemoveReplicatedFolders ` - -Force ` - -ErrorAction Stop - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupExistsRemovedMessage) ` - -f $GroupName - ) -join '' ) - } - } # if -} # Set-TargetResource - -<# - .SYNOPSIS - Tests the current state of a DFS Replication Group. - - .PARAMETER GroupName - The name of the DFS Replication Group. - - .PARAMETER Ensure - Specifies whether the DSF Replication Group should exist. - - .PARAMETER Description - A description for the DFS Replication Group. - - .PARAMETER Members - A list of computers that are members of this Replication Group. - These can be specified using either the ComputerName or FQDN name - for each member. If an FQDN name is used and the DomainName - parameter is set, the FQDN domain name must match. - - .PARAMETER Folders - A list of folders that are replicated in this Replication Group. - - .PARAMETER Topology - This allows a replication topology to assign to the Replication Group. - It defaults to Manual, which will not automatically create a topology. - If set to Fullmesh, a full mesh topology between all members will be - created. - - .PARAMETER ContentPaths - An array of DFS Replication Group Content Paths to use for each of the - Folders. This can have one entry for each Folder in the Folders - parameter and should be set in th same order. If any entry is not blank - then the Content Paths will need to be set manually by - using the xDFSReplicationGroupMembership resource. - - .PARAMETER DomainName - The AD domain the Replication Group should created in. -#> -function Test-TargetResource -{ - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $GroupName, - - [Parameter(Mandatory = $true)] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure, - - [Parameter()] - [System.String] - $Description, - - [Parameter()] - [System.String[]] - $Members, - - [Parameter()] - [System.String[]] - $Folders, - - [Parameter()] - [ValidateSet('Fullmesh','Manual')] - [System.String] - $Topology = 'Manual', - - [Parameter()] - [System.String[]] - $ContentPaths, - - [Parameter()] - [System.String] - $DomainName - ) - - # Flag to signal whether settings are correct - [System.Boolean] $desiredConfigurationMatch = $true - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.TestingRegGroupMessage) ` - -f $GroupName - ) -join '' ) - - # Lookup the existing Replication Group - $replicationGroupParameters = @{ - GroupName = $GroupName - } - - if ($DomainName) - { - $replicationGroupParameters += @{ - DomainName = $DomainName - } - } # if - - $replicationGroup = Get-DFSReplicationGroup @replicationGroupParameters ` - -ErrorAction Stop - - if ($Ensure -eq 'Present') - { - # The RG should exist - if ($replicationGroup) - { - # The RG exists already - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupExistsMessage) ` - -f $GroupName - ) -join '' ) - - # Check the description - if (($Description) -and ($replicationGroup.Description -ne $Description)) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupDescriptionNeedsUpdateMessage) ` - -f $GroupName - ) -join '' ) - - $desiredConfigurationMatch = $false - } # if - - # Create an array of FQDN Members from the Members Array - $replicationGroupParameters += @{ - ComputerName = '' - } - - foreach ($member in $Members) - { - $replicationGroupParameters.ComputerName = $member - $fqdnMembers += @( Get-FQDNMemberName @replicationGroupParameters ) - } # foreach - - $replicationGroupParameters.Remove('ComputerName') - - # Compare the Members - $existingMembers = @((Get-DfsrMember @replicationGroupParameters -ErrorAction Stop).DnsName) - if ((Compare-Object ` - -ReferenceObject $fqdnMembers ` - -DifferenceObject $existingMembers).Count -ne 0) - { - # There is a member different of some kind. - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupMembersNeedUpdateMessage) ` - -f $GroupName - ) -join '' ) - - $desiredConfigurationMatch = $false - } # if - - # Compare the Folders - $existingFolders = @((Get-DfsReplicatedFolder @replicationGroupParameters -ErrorAction Stop).FolderName) - - if ((Compare-Object ` - -ReferenceObject $Folders ` - -DifferenceObject $existingFolders).Count -ne 0) - { - # There is a folder different of some kind. - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupFoldersNeedUpdateMessage) ` - -f $GroupName - ) -join '' ) - - $desiredConfigurationMatch = $false - } - - # Get the content paths (if any were passed in the array) - if ($ContentPaths) - { - # Get the current memberships for this rep group - $memberships = Get-DfsrMembership @replicationGroupParameters ` - -ErrorAction Stop - - # Scan through the content paths array - for ($i=0; $i -lt $Folders.Count; $i++) - { - $contentPath = $ContentPaths[$i] - - if ($contentPath) - { - foreach ($membership in $memberships) - { - [System.Boolean] $primaryMember = ($membership.ComputerName -eq $Members[0]) - - if (($membership.FolderName -ne $Folders[$i]) ` - -or (($membership.ContentPath -eq $contentPath) ` - -and ($membership.PrimaryMember -eq $primaryMember))) - { - # This membership is in the correct state. - continue - } - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupContentPathNeedUpdateMessage) ` - -f $GroupName,$membership.ComputerName - ) -join '' ) - - $desiredConfigurationMatch = $false - } # if - } # if - } # foreach - } # if - - # If the topology is not manual, check the connections are configured - switch ($Topology) - { - 'Fullmesh' - { - $replicationGroupParameters += @{ - SourceComputerName = '' - DestinationComputerName = '' - } - - # Scan through the combination of connections - foreach ($source in $fqdnMembers) - { - foreach ($destination in $fqdnMembers) - { - if ($source -eq $destination) - { - continue - } # if - - $replicationGroupParameters.SourceComputerName = $source - $replicationGroupParameters.DestinationComputerName = $destination - - $replicationGroupConnection = Get-DfsrConnection @replicationGroupParameters ` - -ErrorAction Stop - - if ($replicationGroupConnection) - { - if (-not $replicationGroupConnection.Enabled) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupFullMeshDisabledConnectionMessage) ` - -f $GroupName,$source,$destination - ) -join '' ) - - $desiredConfigurationMatch = $false - } # if - } - else - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupFullMeshMissingConnectionMessage) ` - -f $GroupName,$source,$destination - ) -join '' ) - - $desiredConfigurationMatch = $false - } # if - } # foreach - } # foreach - } # 'fullmesh' - } # switch - } - else - { - # Ths RG doesn't exist but should - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupDoesNotExistButShouldMessage) ` - -f $GroupName - ) -join '' ) - - $desiredConfigurationMatch = $false - } # if - } - else - { - # The RG should not exist - if ($replicationGroup) - { - # The RG exists but should not - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupExistsButShouldNotMessage) ` - -f $GroupName - ) -join '' ) - - $desiredConfigurationMatch = $false - } - else - { - # The RG does not exist and should not - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupDoesNotExistAndShouldNotMessage) ` - -f $GroupName - ) -join '' ) - } # if - } # if - - return $desiredConfigurationMatch -} # Test-TargetResource - -<# -.SYNOPSIS - Returns the FQDN Member name based on the ComputerName and DomainName that are provided. - - If the ComputerName is already an FQDN but the domain in the FQDN does not match the - value passed in DomainName then throw an exception. - - If the ComputerName is already an FQDN and the domain in the FQDN does match the value - passed in DomainName then the existing ComputerName is returned. - - If the ComputerName is not already an FQDN and the DomainName passed is not empty then - the ComputerName and DomainName are combined and returned. - - If the ComputerName is not already an FQDN and the DomainName passed is empty then - the ComputerName is returned. - - .PARAMETER GroupName - The name of the DFS Replication Group. - - .PARAMETER ComputerName - The computer name of the DFS Replication Group member. - - .PARAMETER DomainName - The AD domain the Replication Group should created in. -#> -function Get-FQDNMemberName -{ - [OutputType([System.String])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $GroupName, - - [Parameter(Mandatory = $true)] - [System.String] - $ComputerName, - - [Parameter()] - [System.String] - $DomainName - ) - - if ($ComputerName.Contains('.')) - { - if (($null -ne $DomainName) -and ($DomainName -ne '')) - { - if ($ComputerName -like "*.$DomainName") - { - return $ComputerName.ToLower() - } - else - { - New-InvalidOperationException ` - -Message ($($LocalizedData.ReplicationGroupDomainMismatchError ` - -f $GroupName,$ComputerName,$DomainName)) - } # if - } - else - { - return $ComputerName.ToLower() - } - } - else - { - if (($null -ne $DomainName) -and ($DomainName -ne '')) - { - return "$ComputerName.$DomainName".ToLower() - } - else - { - return $ComputerName.ToLower() - } # if - } # if -} # Get-FQDNMemberName - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroup/MSFT_xDFSReplicationGroup.schema.mof b/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroup/MSFT_xDFSReplicationGroup.schema.mof deleted file mode 100644 index ba3b60b4..00000000 --- a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroup/MSFT_xDFSReplicationGroup.schema.mof +++ /dev/null @@ -1,12 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xDFSReplicationGroup")] -class MSFT_xDFSReplicationGroup : OMI_BaseResource -{ - [Key, Description("The name of the DFS Replication Group.")] String GroupName; - [Required, Description("Specifies whether the DSF Replication Group should exist."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, Description("A description for the DFS Replication Group.")] String Description; - [Write, Description("A list of computers that are members of this Replication Group. These can be specified using either the ComputerName or FQDN name for each member. If an FQDN name is used and the DomainName parameter is set, the FQDN domain name must match.")] String Members[]; - [Write, Description("A list of folders that are replicated in this Replication Group.")] String Folders[]; - [Write, Description("This allows a replication topology to assign to the Replication Group. It defaults to Manual, which will not automatically create a topology. If set to Fullmesh, a full mesh topology between all members will be created."), ValueMap{"Fullmesh","Manual"}, Values{"Fullmesh","Manual"}] String Topology; - [Write, Description("An array of DFS Replication Group Content Paths to use for each of the Folders. This can have one entry for each Folder in the Folders parameter and should be set in th same order. If any entry is not blank then the Content Paths will need to be set manually by using the xDFSReplicationGroupMembership resource.")] String ContentPaths[]; - [Write, Description("The AD domain the Replication Group should created in.")] String DomainName; -}; diff --git a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroup/en-us/MSFT_xDFSReplicationGroup.strings.psd1 b/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroup/en-us/MSFT_xDFSReplicationGroup.strings.psd1 deleted file mode 100644 index 5a18c62f..00000000 --- a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroup/en-us/MSFT_xDFSReplicationGroup.strings.psd1 +++ /dev/null @@ -1,29 +0,0 @@ -ConvertFrom-StringData @' - GettingReplicationGroupMessage = Getting DFS Replication Group "{0}". - ReplicationGroupExistsMessage = DFS Replication Group "{0}" exists. - ReplicationGroupDoesNotExistMessage = DFS Replication Group "{0}" does not exist. - SettingRegGroupMessage = Setting DFS Replication Group "{0}". - EnsureReplicationGroupExistsMessage = Ensuring DFS Replication Group "{0}" exists. - EnsureReplicationGroupDoesNotExistMessage = Ensuring DFS Replication Group "{0}" does not exist. - ReplicationGroupCreatedMessage = DFS Replication Group "{0}" has been created. - ReplicationGroupDescriptionUpdatedMessage = DFS Replication Group "{0}" description has been updated. - ReplicationGroupMemberAddedMessage = DFS Replication Group "{0}" added member "{1}". - ReplicationGroupMemberRemovedMessage = DFS Replication Group "{0}" removed member "{1}". - ReplicationGroupFolderAddedMessage = DFS Replication Group "{0}" added folder "{1}". - ReplicationGroupFolderRemovedMessage = DFS Replication Group "{0}" removed folder "{1}". - ReplicationGroupContentPathUpdatedMessage = DFS Replication Group "{0}" Content Path for "{1}" updated. - ReplicationGroupExistsRemovedMessage = DFS Replication Group "{0}" existed, but has been removed. - ReplicationGroupFullMeshConnectionAddedMessage = DFS Replication Group "{0}" Fullmesh Connection from "{1}" to "{2}" added. - ReplicationGroupFullMeshConnectionUpdatedMessage = DFS Replication Group "{0}" Fullmesh Connection from "{1}" to "{2}" updated. - TestingRegGroupMessage = Testing DFS Replication Group "{0}". - ReplicationGroupDescriptionNeedsUpdateMessage = DFS Replication Group "{0}" description is different. Change required. - ReplicationGroupMembersNeedUpdateMessage = DFS Replication Group "{0}" members are different. Change required. - ReplicationGroupFoldersNeedUpdateMessage = DFS Replication Group "{0}" folders are different. Change required. - ReplicationGroupContentPathNeedUpdateMessage = DFS Replication Group "{0}" Content Path for "{1}" is different. Change required. - ReplicationGroupDoesNotExistButShouldMessage = DFS Replication Group "{0}" does not exist but should. Change required. - ReplicationGroupExistsButShouldNotMessage = DFS Replication Group "{0}" exists but should not. Change required. - ReplicationGroupDoesNotExistAndShouldNotMessage = DFS Replication Group "{0}" does not exist and should not. Change not required. - ReplicationGroupFullMeshMissingConnectionMessage = DFS Replication Group "{0}" Fullmesh Connection from "{1}" to "{2}" does not exist. Change required. - ReplicationGroupFullMeshDisabledConnectionMessage = DFS Replication Group "{0}" Fullmesh Connection from "{1}" to "{2}" is disabled. Change required. - ReplicationGroupDomainMismatchError = DFS Replication Group "{0}" Domain name in Member "{1}" does not match DomainName "{2}". Configuration correction required. -'@ diff --git a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupConnection/MSFT_xDFSReplicationGroupConnection.psm1 b/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupConnection/MSFT_xDFSReplicationGroupConnection.psm1 deleted file mode 100644 index 200b424a..00000000 --- a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupConnection/MSFT_xDFSReplicationGroupConnection.psm1 +++ /dev/null @@ -1,513 +0,0 @@ -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Certificate Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'DFSDsc.ResourceHelper' ` - -ChildPath 'DFSDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$localizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xDFSReplicationGroupConnection' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# - .SYNOPSIS - Returns the current state of a DFS Replication Group Connection. - - .PARAMETER GroupName - The name of the DFS Replication Group. - - .PARAMETER SourceComputerName - The name of the Replication Group source computer for the - connection. This can be specified using either the ComputerName - or FQDN name for the member. If an FQDN name is used and the - DomainName parameter is set, the FQDN domain name must match. - - .PARAMETER DestinationComputerName - The name of the Replication Group destination computer for the - connection. This can be specified using either the ComputerName - or FQDN name for the member. If an FQDN name is used and the - DomainName parameter is set, the FQDN domain name must match. - - .PARAMETER Ensure - Specifies whether the DSF Replication Group should exist. - - .PARAMETER DomainName - The name of the AD Domain the DFS Replication Group connection should be in. -#> -function Get-TargetResource -{ - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $GroupName, - - [Parameter(Mandatory = $true)] - [System.String] - $SourceComputerName, - - [Parameter(Mandatory = $true)] - [System.String] - $DestinationComputerName, - - [Parameter(Mandatory = $true)] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure, - - [Parameter()] - [System.String] - $DomainName - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.GettingReplicationGroupConnectionMessage) ` - -f $GroupName,$SourceComputerName,$DestinationComputerName - ) -join '' ) - - # Lookup the existing Replication Group Connection - $connectionParameters = @{ - GroupName = $GroupName - SourceComputerName = $SourceComputerName - DestinationComputerName = $DestinationComputerName - } - - $returnValue = $connectionParameters.Clone() - - if ($PSBoundParameters.ContainsKey('DomainName')) - { - $connectionParameters += @{ - DomainName = $DomainName - } - } # if - - $replicationGroupConnection = Get-DfsrConnection @connectionParameters ` - -ErrorAction Stop - - if ($replicationGroupConnection) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupConnectionExistsMessage) ` - -f $GroupName,$SourceComputerName,$DestinationComputerName - ) -join '' ) - - $returnValue.SourceComputerName = $replicationGroupConnection.SourceComputerName - $returnValue.DestinationComputerName = $replicationGroupConnection.DestinationComputerName - - if ($replicationGroupConnection.Enabled) - { - $ensureEnabled = 'Enabled' - } - else - { - $ensureEnabled = 'Disabled' - } # if - - if ($replicationGroupConnection.RdcEnabled) - { - $ensureRDCEnabled = 'Enabled' - } - else - { - $ensureRDCEnabled = 'Disabled' - } # if - - $returnValue += @{ - Ensure = 'Present' - Description = $replicationGroupConnection.Description - DomainName = $replicationGroupConnection.DomainName - EnsureEnabled = $ensureEnabled - EnsureRDCEnabled = $ensureRDCEnabled - } - } - else - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupConnectionDoesNotExistMessage) ` - -f $GroupName,$SourceComputerName,$DestinationComputerName - ) -join '' ) - - $returnValue += @{ - Ensure = 'Absent' - } - } # if - - return $returnValue -} # Get-TargetResource - -<# - .SYNOPSIS - Sets the current state of a DFS Replication Group Connection. - - .PARAMETER GroupName - The name of the DFS Replication Group. - - .PARAMETER SourceComputerName - The name of the Replication Group source computer for the - connection. This can be specified using either the ComputerName - or FQDN name for the member. If an FQDN name is used and the - DomainName parameter is set, the FQDN domain name must match. - - .PARAMETER DestinationComputerName - The name of the Replication Group destination computer for the - connection. This can be specified using either the ComputerName - or FQDN name for the member. If an FQDN name is used and the - DomainName parameter is set, the FQDN domain name must match. - - .PARAMETER Ensure - Specifies whether the DSF Replication Group should exist. - - .PARAMETER Description - A description for the DFS Replication Group connection. - - .PARAMETER EnsureEnabled - Ensures that connection is either Enabled or Disabled. - - .PARAMETER EnsureRDCEnabled - Ensures remote differential compression is Enabled or Disabled. - - .PARAMETER DomainName - The name of the AD Domain the DFS Replication Group connection should be in. -#> -function Set-TargetResource -{ - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $GroupName, - - [Parameter(Mandatory = $true)] - [System.String] - $SourceComputerName, - - [Parameter(Mandatory = $true)] - [System.String] - $DestinationComputerName, - - [Parameter(Mandatory = $true)] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure, - - [Parameter()] - [System.String] - $Description, - - [Parameter()] - [ValidateSet('Enabled','Disabled')] - [System.String] - $EnsureEnabled = 'Enabled', - - [Parameter()] - [ValidateSet('Enabled','Disabled')] - [System.String] - $EnsureRDCEnabled = 'Enabled', - - [Parameter()] - [System.String] - $DomainName - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.SettingReplicationGroupConnectionMessage) ` - -f $GroupName,$SourceComputerName,$DestinationComputerName - ) -join '' ) - - # Remove Ensure so the PSBoundParameters can be used to splat - $null = $PSBoundParameters.Remove('Ensure') - $null = $PSBoundParameters.Remove('EnsureEnabled') - $null = $PSBoundParameters.Remove('EnsureRDCEnabled') - - # Lookup the existing Replication Group Connection - $connectionParameters = @{ - GroupName = $GroupName - SourceComputerName = $SourceComputerName - DestinationComputerName = $DestinationComputerName - } - - if ($PSBoundParameters.ContainsKey('DomainName')) - { - $connectionParameters += @{ - DomainName = $DomainName - } - } # if - - $replicationGroupConnection = Get-DfsrConnection @connectionParameters -ErrorAction Stop - - if ($Ensure -eq 'Present') - { - # The rep group connection should exist - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.EnsureReplicationGroupConnectionExistsMessage) ` - -f $GroupName,$SourceComputerName,$DestinationComputerName - ) -join '' ) - - $null = $PSBoundParameters.Add('DisableConnection',($EnsureEnabled -eq 'Disabled')) - $null = $PSBoundParameters.Add('DisableRDC',($EnsureRDCEnabled -eq 'Disabled')) - - if ($replicationGroupConnection) - { - # The RG connection exists already - update it - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupConnectionExistsMessage) ` - -f $GroupName,$SourceComputerName,$DestinationComputerName - ) -join '' ) - - Set-DfsrConnection @PSBoundParameters ` - -ErrorAction Stop - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupConnectionUpdatedMessage) ` - -f $GroupName,$SourceComputerName,$DestinationComputerName - ) -join '' ) - } - else - { - # Ths Rep Groups doesn't exist - Create it - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupConnectionDoesNotExistMessage) ` - -f $GroupName,$SourceComputerName,$DestinationComputerName - ) -join '' ) - - Add-DfsrConnection @PSBoundParameters ` - -ErrorAction Stop - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupConnectionCreatedMessage) ` - -f $GroupName,$SourceComputerName,$DestinationComputerName - ) -join '' ) - } # if - } - else - { - # The Rep Group should not exist - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.EnsureReplicationGroupConnectionDoesNotExistMessage) ` - -f $GroupName,$SourceComputerName,$DestinationComputerName - ) -join '' ) - - if ($replicationGroupConnection) - { - # Remove the replication group - Remove-DfsrConnection @connectionParameters -Force -ErrorAction Stop - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupConnectionExistsRemovedMessage) ` - -f $GroupName,$SourceComputerName,$DestinationComputerName - ) -join '' ) - } - } # if -} # Set-TargetResource - -<# - .SYNOPSIS - Tests the current state of a DFS Replication Group Connection. - - .PARAMETER GroupName - The name of the DFS Replication Group. - - .PARAMETER SourceComputerName - The name of the Replication Group source computer for the - connection. This can be specified using either the ComputerName - or FQDN name for the member. If an FQDN name is used and the - DomainName parameter is set, the FQDN domain name must match. - - .PARAMETER DestinationComputerName - The name of the Replication Group destination computer for the - connection. This can be specified using either the ComputerName - or FQDN name for the member. If an FQDN name is used and the - DomainName parameter is set, the FQDN domain name must match. - - .PARAMETER Ensure - Specifies whether the DSF Replication Group should exist. - - .PARAMETER Description - A description for the DFS Replication Group connection. - - .PARAMETER EnsureEnabled - Ensures that connection is either Enabled or Disabled. - - .PARAMETER EnsureRDCEnabled - Ensures remote differential compression is Enabled or Disabled. - - .PARAMETER DomainName - The name of the AD Domain the DFS Replication Group connection should be in. -#> -function Test-TargetResource -{ - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $GroupName, - - [Parameter(Mandatory = $true)] - [System.String] - $SourceComputerName, - - [Parameter(Mandatory = $true)] - [System.String] - $DestinationComputerName, - - [Parameter(Mandatory = $true)] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure, - - [Parameter()] - [System.String] - $Description, - - [Parameter()] - [ValidateSet('Enabled','Disabled')] - [System.String] - $EnsureEnabled = 'Enabled', - - [Parameter()] - [ValidateSet('Enabled','Disabled')] - [System.String] - $EnsureRDCEnabled = 'Enabled', - - [Parameter()] - [System.String] - $DomainName - ) - - # Flag to signal whether settings are correct - [System.Boolean] $desiredConfigurationMatch = $true - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.TestingReplicationGroupConnectionMessage) ` - -f $GroupName,$SourceComputerName,$DestinationComputerName - ) -join '' ) - - # Remove Ensure so the PSBoundParameters can be used to splat - $null = $PSBoundParameters.Remove('Ensure') - - # Lookup the existing Replication Group Connection - $connectionParameters = @{ - GroupName = $GroupName - SourceComputerName = $SourceComputerName - DestinationComputerName = $DestinationComputerName - } - - if ($PSBoundParameters.ContainsKey('DomainName')) - { - $connectionParameters += @{ - DomainName = $DomainName - } - } - - $replicationGroupConnection = Get-DfsrConnection @connectionParameters ` - -ErrorAction Stop - - if ($Ensure -eq 'Present') - { - # The RG should exist - if ($replicationGroupConnection) - { - # The RG exists already - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupConnectionExistsMessage) ` - -f $GroupName,$SourceComputerName,$DestinationComputerName - ) -join '' ) - - # Check if any of the non-key paramaters are different. - if (($PSBoundParameters.ContainsKey('Description')) -and ` - ($replicationGroupConnection.Description -ne $Description)) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupConnectionNeedsUpdateMessage) ` - -f $GroupName,$SourceComputerName,$DestinationComputerName,'Description' - ) -join '' ) - - $desiredConfigurationMatch = $false - } # if - - if (($EnsureEnabled -eq 'Enabled') ` - -and (-not $replicationGroupConnection.Enabled) ` - -or ($EnsureEnabled -eq 'Disabled') ` - -and ($replicationGroupConnection.Enabled)) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupConnectionNeedsUpdateMessage) ` - -f $GroupName,$SourceComputerName,$DestinationComputerName,'Enabled' - ) -join '' ) - - $desiredConfigurationMatch = $false - } # if - - if (($EnsureRDCEnabled -eq 'Enabled') ` - -and (-not $replicationGroupConnection.RDCEnabled) ` - -or ($EnsureRDCEnabled -eq 'Disabled') ` - -and ($replicationGroupConnection.RDCEnabled)) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupConnectionNeedsUpdateMessage) ` - -f $GroupName,$SourceComputerName,$DestinationComputerName,'RDC Enabled' - ) -join '' ) - - $desiredConfigurationMatch = $false - } # if - } - else - { - # Ths RG doesn't exist but should - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupConnectionDoesNotExistButShouldMessage) ` - -f $GroupName,$SourceComputerName,$DestinationComputerName - ) -join '' ) - - $desiredConfigurationMatch = $false - } # if - } - else - { - # The RG should not exist - if ($replicationGroupConnection) - { - # The RG exists but should not - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupConnectionExistsButShouldNotMessage) ` - -f $GroupName,$SourceComputerName,$DestinationComputerName - ) -join '' ) - - $desiredConfigurationMatch = $false - } - else - { - # The RG does not exist and should not - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupConnectionDoesNotExistAndShouldNotMessage) ` - -f $GroupName,$SourceComputerName,$DestinationComputerName - ) -join '' ) - } # if - } # if - - return $desiredConfigurationMatch -} # Test-TargetResource - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupConnection/MSFT_xDFSReplicationGroupConnection.schema.mof b/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupConnection/MSFT_xDFSReplicationGroupConnection.schema.mof deleted file mode 100644 index f762c512..00000000 --- a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupConnection/MSFT_xDFSReplicationGroupConnection.schema.mof +++ /dev/null @@ -1,12 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xDFSReplicationGroupConnection")] -class MSFT_xDFSReplicationGroupConnection : OMI_BaseResource -{ - [Key, Description("The name of the DFS Replication Group.")] String GroupName; - [Key, Description("The name of the Replication Group source computer for the connection. This can be specified using either the ComputerName or FQDN name for the member. If an FQDN name is used and the DomainName parameter is set, the FQDN domain name must match.")] String SourceComputerName; - [Key, Description("The name of the Replication Group destination computer for the connection. This can be specified using either the ComputerName or FQDN name for the member. If an FQDN name is used and the DomainName parameter is set, the FQDN domain name must match.")] String DestinationComputerName; - [Required, Description("Specifies whether the DSF Replication Group connection should exist."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, Description("A description for the DFS Replication Group connection.")] String Description; - [Write, Description("Ensures that connection is either Enabled or Disabled."),ValueMap{"Enabled","Disabled"}, Values{"Enabled","Disabled"}] String EnsureEnabled; - [Write, Description("Ensures remote differential compression is Enabled or Disabled."),ValueMap{"Enabled","Disabled"}, Values{"Enabled","Disabled"}] String EnsureRDCEnabled; - [Write, Description("The name of the AD Domain the DFS Replication Group connection should be in.")] String DomainName; -}; diff --git a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupConnection/en-us/MSFT_xDFSReplicationGroupConnection.strings.psd1 b/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupConnection/en-us/MSFT_xDFSReplicationGroupConnection.strings.psd1 deleted file mode 100644 index 00d8626b..00000000 --- a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupConnection/en-us/MSFT_xDFSReplicationGroupConnection.strings.psd1 +++ /dev/null @@ -1,16 +0,0 @@ -ConvertFrom-StringData @' - GettingReplicationGroupConnectionMessage = Getting DFS Replication Group Connection "{0}" from "{1}" to "{2}". - ReplicationGroupConnectionExistsMessage = DFS Replication Group Connection "{0}" from "{1}" to "{2}" exists. - ReplicationGroupConnectionDoesNotExistMessage = DFS Replication Group Connection "{0}" from "{1}" to "{2}" does not exist. - SettingReplicationGroupConnectionMessage = Setting DFS Replication Group Connection "{0}" from "{1}" to "{2}". - EnsureReplicationGroupConnectionExistsMessage = Ensuring DFS Replication Group "{0}" from "{1}" to "{2}" exists. - EnsureReplicationGroupConnectionDoesNotExistMessage = Ensuring DFS Replication Group "{0}" from "{1}" to "{2}" does not exist. - ReplicationGroupConnectionCreatedMessage = DFS Replication Group Connection "{0}" from "{1}" to "{2}" has been created. - ReplicationGroupConnectionUpdatedMessage = DFS Replication Group Connection "{0}" from "{1}" to "{2}" description has been updated. - ReplicationGroupConnectionExistsRemovedMessage = DFS Replication Group Connection "{0}" from "{1}" to "{2}" existed, but has been removed. - TestingReplicationGroupConnectionMessage = Testing DFS Replication Group Connection "{0}" from "{1}" to "{2}". - ReplicationGroupConnectionNeedsUpdateMessage = DFS Replication Group Connection "{0}" from "{1}" to "{2}" {3} is different. Change required. - ReplicationGroupConnectionDoesNotExistButShouldMessage = DFS Replication Group Connection "{0}" from "{1}" to "{2}" does not exist but should. Change required. - ReplicationGroupConnectionExistsButShouldNotMessage = DFS Replication Group Connection "{0}" from "{1}" to "{2}" exists but should not. Change required. - ReplicationGroupConnectionDoesNotExistAndShouldNotMessage = DFS Replication Group Connection "{0}" from "{1}" to "{2}" does not exist and should not. Change not required. -'@ diff --git a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupFolder/MSFT_xDFSReplicationGroupFolder.psm1 b/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupFolder/MSFT_xDFSReplicationGroupFolder.psm1 deleted file mode 100644 index 1cd1b58f..00000000 --- a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupFolder/MSFT_xDFSReplicationGroupFolder.psm1 +++ /dev/null @@ -1,339 +0,0 @@ -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Certificate Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'DFSDsc.ResourceHelper' ` - -ChildPath 'DFSDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$localizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xDFSReplicationGroupFolder' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# - .SYNOPSIS - Returns the current state of a DFS Replication Group Folder. - - .PARAMETER GroupName - The name of the DFS Replication Group. - - .PARAMETER FolderName - The name of the DFS Replication Group Folder. - - .PARAMETER DomainName - The name of the AD Domain the DFS Replication Group Folder will be in. -#> -function Get-TargetResource -{ - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $GroupName, - - [Parameter(Mandatory = $true)] - [System.String] - $FolderName, - - [Parameter()] - [System.String] - $DomainName - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.GettingReplicationGroupFolderMessage) ` - -f $GroupName,$FolderName - ) -join '' ) - - # Lookup the existing Replication Group - $replicatedFolderParameters = @{ - GroupName = $GroupName - FolderName = $FolderName - } - - $returnValue = $replicatedFolderParameters.Clone() - - if ($DomainName) - { - $replicatedFolderParameters += @{ - DomainName = $DomainName - } - } # if - - $replicationGroupFolder = Get-DfsReplicatedFolder @replicatedFolderParameters ` - -ErrorAction Stop - - if ($replicationGroupFolder) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupFolderExistsMessage) ` - -f $GroupName,$FolderName - ) -join '' ) - - <# - Array paramters are disabled until this issue is resolved: - https://windowsserver.uservoice.com/forums/301869-powershell/suggestions/11088807-get-dscconfiguration-fails-with-embedded-cim-type - FilenameToExclude = $ReplicationGroupFolder.FilenameToExclude - DirectoryNameToExclude = $ReplicationGroupFolder.DirectoryNameToExclude - #> - $returnValue += @{ - Description = $replicationGroupFolder.Description - FilenameToExclude = '' - DirectoryNameToExclude = '' - DfsnPath = $replicationGroupFolder.DfsnPath - DomainName = $replicationGroupFolder.DomainName - } - } - else - { - # The Rep Group folder doesn't exist - New-InvalidOperationException ` - -Message ($($LocalizedData.ReplicationGroupFolderMissingError) ` - -f $GroupName,$FolderName) - } - - return $returnValue -} # Get-TargetResource - -<# - .SYNOPSIS - Sets the current state of a DFS Replication Group Folder. - - .PARAMETER GroupName - The name of the DFS Replication Group. - - .PARAMETER FolderName - The name of the DFS Replication Group Folder. - - .PARAMETER Description - A description for the DFS Replication Group Folder. - - .PARAMETER FileNameToExclude - An array of file names to exclude from replication. - - .PARAMETER DirectoryNameToExclude - An array of directory names to exclude from replication. - - .PARAMETER DfsnPath - The DFS Namespace Path to this Replication Group folder is mapped to. - This does NOT create the Namespace folders, it only sets the name in - the folder object. - - .PARAMETER DomainName - The name of the AD Domain the DFS Replication Group Folder will be in. -#> -function Set-TargetResource -{ - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $GroupName, - - [Parameter(Mandatory = $true)] - [System.String] - $FolderName, - - [Parameter()] - [System.String] - $Description, - - [Parameter()] - [System.String[]] - $FileNameToExclude, - - [Parameter()] - [System.String[]] - $DirectoryNameToExclude, - - [Parameter()] - [System.String] - $DfsnPath, - - [Parameter()] - [System.String] - $DomainName - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.SettingReplicationGroupFolderMessage) ` - -f $GroupName,$FolderName - ) -join '' ) - - # Now apply the changes - Set-DfsReplicatedFolder @PSBoundParameters ` - -ErrorAction Stop - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupFolderUpdatedMessage) ` - -f $GroupName,$FolderName - ) -join '' ) -} # Set-TargetResource - -<# - .SYNOPSIS - Tests the current state of a DFS Replication Group Folder. - - .PARAMETER GroupName - The name of the DFS Replication Group. - - .PARAMETER FolderName - The name of the DFS Replication Group Folder. - - .PARAMETER Description - A description for the DFS Replication Group Folder. - - .PARAMETER FileNameToExclude - An array of file names to exclude from replication. - - .PARAMETER DirectoryNameToExclude - An array of directory names to exclude from replication. - - .PARAMETER DfsnPath - The DFS Namespace Path to this Replication Group folder is mapped to. - This does NOT create the Namespace folders, it only sets the name in - the folder object. - - .PARAMETER DomainName - The name of the AD Domain the DFS Replication Group Folder will be in. -#> -function Test-TargetResource -{ - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $GroupName, - - [Parameter(Mandatory = $true)] - [System.String] - $FolderName, - - [Parameter()] - [System.String] - $Description, - - [Parameter()] - [System.String[]] - $FileNameToExclude, - - [Parameter()] - [System.String[]] - $DirectoryNameToExclude, - - [Parameter()] - [System.String] - $DfsnPath, - - [Parameter()] - [System.String] - $DomainName - ) - - # Flag to signal whether settings are correct - [System.Boolean] $desiredConfigurationMatch = $true - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.TestingReplicationGroupFolderMessage) ` - -f $GroupName,$FolderName - ) -join '' ) - - # Lookup the existing Replication Group Folder - $replicatedFolderParameters = @{ - GroupName = $GroupName - FolderName = $FolderName - } - - if ($DomainName) - { - $replicatedFolderParameters += @{ - DomainName = $DomainName - } - } # if - - $replicationGroupFolder = Get-DfsReplicatedFolder @replicatedFolderParameters ` - -ErrorAction Stop - - if ($replicationGroupFolder) - { - # The rep group folder is found - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupFolderExistsMessage) ` - -f $GroupName,$FolderName - ) -join '' ) - - # Check the description - if (($PSBoundParameters.ContainsKey('Description')) ` - -and ($replicationGroupFolder.Description -ne $Description)) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupFolderDescriptionMismatchMessage) ` - -f $GroupName,$FolderName - ) -join '' ) - - $desiredConfigurationMatch = $false - } # if - - # Check the FileNameToExclude - if (($PSBoundParameters.ContainsKey('FileNameToExclude')) ` - -and ((Compare-Object ` - -ReferenceObject $replicationGroupFolder.FileNameToExclude ` - -DifferenceObject $FileNameToExclude).Count -ne 0)) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupFolderFileNameToExcludeMismatchMessage) ` - -f $GroupName,$FolderName - ) -join '' ) - - $desiredConfigurationMatch = $false - } # if - - # Check the DirectoryNameToExclude - if (($PSBoundParameters.ContainsKey('DirectoryNameToExclude')) ` - -and ((Compare-Object ` - -ReferenceObject $replicationGroupFolder.DirectoryNameToExclude ` - -DifferenceObject $DirectoryNameToExclude).Count -ne 0)) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupFolderDirectoryNameToExcludeMismatchMessage) ` - -f $GroupName,$FolderName - ) -join '' ) - - $desiredConfigurationMatch = $false - } # if - - if (($PSBoundParameters.ContainsKey('DfsnPath')) ` - -and ($replicationGroupFolder.DfsnPath -ne $DfsnPath)) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupFolderDfsnPathMismatchMessage) ` - -f $GroupName,$FolderName - ) -join '' ) - - $desiredConfigurationMatch = $false - } # if - } - else - { - # The Rep Group folder doesn't exist - New-InvalidOperationException ` - -Message ($($LocalizedData.ReplicationGroupFolderMissingError) ` - -f $GroupName,$FolderName) - } # if - - return $desiredConfigurationMatch -} # Test-TargetResource - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupFolder/MSFT_xDFSReplicationGroupFolder.schema.mof b/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupFolder/MSFT_xDFSReplicationGroupFolder.schema.mof deleted file mode 100644 index 0a8a3132..00000000 --- a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupFolder/MSFT_xDFSReplicationGroupFolder.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xDFSReplicationGroupFolder")] -class MSFT_xDFSReplicationGroupFolder : OMI_BaseResource -{ - [Key, Description("The name of the DFS Replication Group.")] String GroupName; - [Key, Description("The name of the DFS Replication Group Folder.")] String FolderName; - [Write, Description("A description for the DFS Replication Group Folder.")] String Description; - [Write, Description("An array of file names to exclude from replication.")] String FilenameToExclude[]; - [Write, Description("An array of directory names to exclude from replication.")] String DirectoryNameToExclude[]; - [Write, Description("The DFS Namespace Path to this Replication Group folder is mapped to. This does NOT create the Namespace folders, it only sets the name in the folder object.")] String DfsnPath; - [Write, Description("The name of the AD Domain the DFS Replication Group Folder will be in.")] String DomainName; -}; diff --git a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupFolder/en-us/MSFT_xDFSReplicationGroupFolder.strings.psd1 b/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupFolder/en-us/MSFT_xDFSReplicationGroupFolder.strings.psd1 deleted file mode 100644 index e4220838..00000000 --- a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupFolder/en-us/MSFT_xDFSReplicationGroupFolder.strings.psd1 +++ /dev/null @@ -1,12 +0,0 @@ -ConvertFrom-StringData @' - GettingReplicationGroupFolderMessage = Getting DFS Replication Group "{0}" folder "{1}". - ReplicationGroupFolderExistsMessage = DFS Replication Group "{0}" folder "{1}" exists. - ReplicationGroupFolderMissingError = DFS Replication Group "{0}" folder "{1}" is missing. - SettingReplicationGroupFolderMessage = Setting DFS Replication Group "{0}" folder "{1}". - ReplicationGroupFolderUpdatedMessage = DFS Replication Group "{0}" folder "{1}" has has been updated. - TestingReplicationGroupFolderMessage = Testing DFS Replication Group "{0}" folder "{1}". - ReplicationGroupFolderDescriptionMismatchMessage = DFS Replication Group "{0}" folder "{1}" has incorrect Description. Change required. - ReplicationGroupFolderFileNameToExcludeMismatchMessage = DFS Replication Group "{0}" folder "{1}" has incorrect FileNameToExclude. Change required. - ReplicationGroupFolderDirectoryNameToExcludeMismatchMessage = DFS Replication Group "{0}" folder "{1}" has incorrect DirectoryNameToExclude. Change required. - ReplicationGroupFolderDfsnPathMismatchMessage = DFS Replication Group "{0}" folder "{1}" has incorrect DfsnPath. Change required. -'@ diff --git a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupMembership/MSFT_xDFSReplicationGroupMembership.psm1 b/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupMembership/MSFT_xDFSReplicationGroupMembership.psm1 deleted file mode 100644 index 82583991..00000000 --- a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupMembership/MSFT_xDFSReplicationGroupMembership.psm1 +++ /dev/null @@ -1,372 +0,0 @@ -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Certificate Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'DFSDsc.ResourceHelper' ` - -ChildPath 'DFSDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$localizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xDFSReplicationGroupMembership' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# - .SYNOPSIS - Returns the current state of a DFS Replication Group Membership. - - .PARAMETER GroupName - The name of the DFS Replication Group. - - .PARAMETER FolderName - The name of the DFS Replication Group Folder. - - .PARAMETER ComputerName - The computer name of the Replication Group member. This can be - specified using either the ComputerName or FQDN name for the member. - If an FQDN name is used and the DomainName parameter is set, the FQDN - domain name must match. - - .PARAMETER DomainName - The name of the AD Domain the DFS Replication Group this replication - group is in. -#> -function Get-TargetResource -{ - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $GroupName, - - [Parameter(Mandatory = $true)] - [System.String] - $FolderName, - - [Parameter(Mandatory = $true)] - [System.String] - $ComputerName, - - [Parameter()] - [System.String] - $DomainName - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.GettingReplicationGroupMembershipMessage) ` - -f $GroupName,$FolderName,$ComputerName - ) -join '' ) - - # Lookup the existing Replication Group - $membershipParameters = @{ - GroupName = $GroupName - ComputerName = $ComputerName - } - - $returnValue = $membershipParameters - - if ($DomainName) - { - $membershipParameters += @{ - DomainName = $DomainName - } - } - - $returnValue += @{ - FolderName = $FolderName - } - - $replicationGroupMembership = Get-DfsrMembership @membershipParameters ` - -ErrorAction Stop ` - | Where-Object { $_.FolderName -eq $FolderName } - - if ($replicationGroupMembership) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupMembershipExistsMessage) ` - -f $GroupName,$FolderName,$ComputerName - ) -join '' ) - - $returnValue.ComputerName = $replicationGroupMembership.ComputerName - - $returnValue += @{ - ContentPath = $replicationGroupMembership.ContentPath - StagingPath = $replicationGroupMembership.StagingPath - ConflictAndDeletedPath = $replicationGroupMembership.ConflictAndDeletedPath - ReadOnly = $replicationGroupMembership.ReadOnly - PrimaryMember = $replicationGroupMembership.PrimaryMember - DomainName = $replicationGroupMembership.DomainName - } - } - else - { - # The Rep Group membership doesn't exist - New-InvalidOperationException ` - -Message ($($LocalizedData.ReplicationGroupMembershipMissingError) ` - -f $GroupName,$FolderName,$ComputerName) - } - - return $returnValue -} # Get-TargetResource - -<# - .SYNOPSIS - Sets DFS Replication Group Membership. - - .PARAMETER GroupName - The name of the DFS Replication Group. - - .PARAMETER FolderName - The name of the DFS Replication Group Folder. - - .PARAMETER ComputerName - The computer name of the Replication Group member. This can be - specified using either the ComputerName or FQDN name for the member. - If an FQDN name is used and the DomainName parameter is set, the FQDN - domain name must match. - - .PARAMETER ContentPath - The local content path for the DFS Replication Group Folder. - - .PARAMETER StagingPath - The local staging path for the DFS Replication Group Folder. - - .PARAMETER ReadOnly - Specify if this content path should be read only. - - .PARAMETER PrimaryMember - Used to configure this as the Primary Member. Every folder must - have at least one primary member for initial replication to take - place. - - .PARAMETER DomainName - The name of the AD Domain the DFS Replication Group this replication - group is in. -#> -function Set-TargetResource -{ - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $GroupName, - - [Parameter(Mandatory = $true)] - [System.String] - $FolderName, - - [Parameter(Mandatory = $true)] - [System.String] - $ComputerName, - - [Parameter()] - [System.String] - $ContentPath, - - [Parameter()] - [System.String] - $StagingPath, - - [Parameter()] - [System.Boolean] - $ReadOnly, - - [Parameter()] - [System.Boolean] - $PrimaryMember, - - [Parameter()] - [System.String] - $DomainName - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.SettingRegGroupMembershipMessage) ` - -f $GroupName,$FolderName,$ComputerName - ) -join '' ) - - # Now apply the changes - Set-DfsrMembership @PSBoundParameters ` - -ErrorAction Stop - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupMembershipUpdatedMessage) ` - -f $GroupName,$FolderName,$ComputerName - ) -join '' ) -} # Set-TargetResource - -<# - .SYNOPSIS - Tests DFS Replication Group Membership. - - .PARAMETER GroupName - The name of the DFS Replication Group. - - .PARAMETER FolderName - The name of the DFS Replication Group Folder. - - .PARAMETER ComputerName - The computer name of the Replication Group member. This can be - specified using either the ComputerName or FQDN name for the member. - If an FQDN name is used and the DomainName parameter is set, the FQDN - domain name must match. - - .PARAMETER ContentPath - The local content path for the DFS Replication Group Folder. - - .PARAMETER StagingPath - The local staging path for the DFS Replication Group Folder. - - .PARAMETER ReadOnly - Specify if this content path should be read only. - - .PARAMETER PrimaryMember - Used to configure this as the Primary Member. Every folder must - have at least one primary member for initial replication to take - place. - - .PARAMETER DomainName - The name of the AD Domain the DFS Replication Group this replication - group is in. -#> -function Test-TargetResource -{ - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $GroupName, - - [Parameter(Mandatory = $true)] - [System.String] - $FolderName, - - [Parameter(Mandatory = $true)] - [System.String] - $ComputerName, - - [Parameter()] - [System.String] - $ContentPath, - - [Parameter()] - [System.String] - $StagingPath, - - [Parameter()] - [System.Boolean] - $ReadOnly, - - [Parameter()] - [System.Boolean] - $PrimaryMember, - - [Parameter()] - [System.String] - $DomainName - ) - - # Flag to signal whether settings are correct - [System.Boolean] $desiredConfigurationMatch = $true - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.TestingRegGroupMembershipMessage) ` - -f $GroupName,$FolderName,$ComputerName - ) -join '' ) - - # Lookup the existing Replication Group - $membershipParameters = @{ - GroupName = $GroupName - ComputerName = $ComputerName - } - - if ($DomainName) - { - $membershipParameters += @{ - DomainName = $DomainName - } - } - - $replicationGroupMembership = Get-DfsrMembership @membershipParameters ` - -ErrorAction Stop ` - | Where-Object { $_.FolderName -eq $FolderName } - - if ($replicationGroupMembership) - { - # The rep group folder is found - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupMembershipExistsMessage) ` - -f $GroupName,$FolderName,$ComputerName - ) -join '' ) - - # Check the ContentPath - if (($PSBoundParameters.ContainsKey('ContentPath')) ` - -and ($replicationGroupMembership.ContentPath -ne $ContentPath)) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupMembershipContentPathMismatchMessage) ` - -f $GroupName,$FolderName,$ComputerName - ) -join '' ) - - $desiredConfigurationMatch = $false - } # if - - # Check the StagingPath - if (($PSBoundParameters.ContainsKey('StagingPath')) ` - -and ($replicationGroupMembership.StagingPath -ne $StagingPath)) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupMembershipStagingPathMismatchMessage) ` - -f $GroupName,$FolderName,$ComputerName - ) -join '' ) - - $desiredConfigurationMatch = $false - } # if - - # Check the ReadOnly - if (($PSBoundParameters.ContainsKey('ReadOnly')) ` - -and ($replicationGroupMembership.ReadOnly -ne $ReadOnly)) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupMembershipReadOnlyMismatchMessage) ` - -f $GroupName,$FolderName,$ComputerName - ) -join '' ) - - $desiredConfigurationMatch = $false - } # if - - # Check the PrimaryMember - if (($PSBoundParameters.ContainsKey('PrimaryMember')) ` - -and ($replicationGroupMembership.PrimaryMember -ne $PrimaryMember)) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.ReplicationGroupMembershipPrimaryMemberMismatchMessage) ` - -f $GroupName,$FolderName,$ComputerName - ) -join '' ) - - $desiredConfigurationMatch = $false - } # if - } - else - { - # The Rep Group membership doesn't exist - New-InvalidOperationException ` - -Message ($($LocalizedData.ReplicationGroupMembershipMissingError) ` - -f $GroupName,$FolderName,$ComputerName) - } # if - - return $desiredConfigurationMatch -} # Test-TargetResource - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupMembership/MSFT_xDFSReplicationGroupMembership.schema.mof b/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupMembership/MSFT_xDFSReplicationGroupMembership.schema.mof deleted file mode 100644 index 89771cc5..00000000 --- a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupMembership/MSFT_xDFSReplicationGroupMembership.schema.mof +++ /dev/null @@ -1,13 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xDFSReplicationGroupMembership")] -class MSFT_xDFSReplicationGroupMembership : OMI_BaseResource -{ - [Key, Description("The name of the DFS Replication Group.")] String GroupName; - [Key, Description("The name of the DFS Replication Group Folder.")] String FolderName; - [Key, Description("The computer name of the Replication Group member. This can be specified using either the ComputerName or FQDN name for the member. If an FQDN name is used and the DomainName parameter is set, the FQDN domain name must match.")] String ComputerName; - [Write, Description("The local content path for the DFS Replication Group Folder.")] String ContentPath; - [Write, Description("The local staging path for the DFS Replication Group Folder.")] String StagingPath; - [Read, Description("The local content and deleted path for the DFS Replication Group Folder.")] String ConflictAndDeletedPath; - [Write, Description("Specify if this content path should be read only.")] Boolean ReadOnly; - [Write, Description("Used to configure this as the Primary Member. Every folder must have at least one primary member for initial replication to take place.")] Boolean PrimaryMember; - [Write, Description("The name of the AD Domain the DFS Replication Group this replication group is in.")] String DomainName; -}; diff --git a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupMembership/en-us/MSFT_xDFSReplicationGroupMembership.strings.psd1 b/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupMembership/en-us/MSFT_xDFSReplicationGroupMembership.strings.psd1 deleted file mode 100644 index 120e7809..00000000 --- a/lib/puppet_x/dsc_resources/xDFS/DSCResources/MSFT_xDFSReplicationGroupMembership/en-us/MSFT_xDFSReplicationGroupMembership.strings.psd1 +++ /dev/null @@ -1,12 +0,0 @@ -ConvertFrom-StringData @' - GettingReplicationGroupMembershipMessage = Getting DFS Replication Group "{0}" folder "{1}" on "{2}". - ReplicationGroupMembershipExistsMessage = DFS Replication Group "{0}" folder "{1}" on "{2}" exists. - ReplicationGroupMembershipMissingError = DFS Replication Group "{0}" folder "{1}" on "{2}" is missing. - SettingRegGroupMembershipMessage = Setting DFS Replication Group "{0}" folder "{1}" on "{2}". - ReplicationGroupMembershipUpdatedMessage = DFS Replication Group "{0}" folder "{1}" on "{2}" has has been updated. - TestingRegGroupMembershipMessage = Testing DFS Replication Group "{0}" folder "{1}" on "{2}". - ReplicationGroupMembershipContentPathMismatchMessage = DFS Replication Group "{0}" folder "{1}" on "{2}" has incorrect ContentPath. Change required. - ReplicationGroupMembershipStagingPathMismatchMessage = DFS Replication Group "{0}" folder "{1}" on "{2}" has incorrect StagingPath. Change required. - ReplicationGroupMembershipReadOnlyMismatchMessage = DFS Replication Group "{0}" folder "{1}" on "{2}" has incorrect ReadOnly. Change required. - ReplicationGroupMembershipPrimaryMemberMismatchMessage = DFS Replication Group "{0}" folder "{1}" on "{2}" has incorrect PrimaryMember. Change required. -'@ diff --git a/lib/puppet_x/dsc_resources/xDFS/LICENSE b/lib/puppet_x/dsc_resources/xDFS/LICENSE deleted file mode 100644 index cec380d8..00000000 --- a/lib/puppet_x/dsc_resources/xDFS/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/lib/puppet_x/dsc_resources/xDFS/Modules/DFSDsc.ResourceHelper/DFSDsc.ResourceHelper.psm1 b/lib/puppet_x/dsc_resources/xDFS/Modules/DFSDsc.ResourceHelper/DFSDsc.ResourceHelper.psm1 deleted file mode 100644 index 5ac299a7..00000000 --- a/lib/puppet_x/dsc_resources/xDFS/Modules/DFSDsc.ResourceHelper/DFSDsc.ResourceHelper.psm1 +++ /dev/null @@ -1,181 +0,0 @@ -<# - .SYNOPSIS - Tests if the current machine is a Nano server. -#> -function Test-IsNanoServer -{ - if (Test-Command -Name Get-ComputerInfo) - { - $computerInfo = Get-ComputerInfo - - if ('Server' -eq $computerInfo.OsProductType ` - -and 'NanoServer' -eq $computerInfo.OsServerLevel) - { - return $true - } - } - - return $false -} - -<# - .SYNOPSIS - Tests if the the specified command is found. - - .PARAMETER Name - The name of the command to find. -#> -function Test-Command -{ - param - ( - [Parameter()] - [System.String] - $Name - ) - - return ($null -ne (Get-Command -Name $Name -ErrorAction Continue 2> $null)) -} - -<# - .SYNOPSIS - Creates and throws an invalid argument exception - - .PARAMETER Message - The message explaining why this error is being thrown - - .PARAMETER ArgumentName - The name of the invalid argument that is causing this error to be thrown -#> -function New-InvalidArgumentException -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Message, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $ArgumentName - ) - - $argumentException = New-Object -TypeName 'ArgumentException' -ArgumentList @( $Message, - $ArgumentName ) - $newObjectParams = @{ - TypeName = 'System.Management.Automation.ErrorRecord' - ArgumentList = @( $argumentException, $ArgumentName, 'InvalidArgument', $null ) - } - $errorRecord = New-Object @newObjectParams - - throw $errorRecord -} - -<# - .SYNOPSIS - Creates and throws an invalid operation exception - - .PARAMETER Message - The message explaining why this error is being thrown - - .PARAMETER ErrorRecord - The error record containing the exception that is causing this terminating error -#> -function New-InvalidOperationException -{ - [CmdletBinding()] - param - ( - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $Message, - - [Parameter()] - [ValidateNotNull()] - [System.Management.Automation.ErrorRecord] - $ErrorRecord - ) - - if ($null -eq $Message) - { - $invalidOperationException = New-Object -TypeName 'InvalidOperationException' - } - elseif ($null -eq $ErrorRecord) - { - $invalidOperationException = - New-Object -TypeName 'InvalidOperationException' -ArgumentList @( $Message ) - } - else - { - $invalidOperationException = - New-Object -TypeName 'InvalidOperationException' -ArgumentList @( $Message, - $ErrorRecord.Exception ) - } - - $newObjectParams = @{ - TypeName = 'System.Management.Automation.ErrorRecord' - ArgumentList = @( $invalidOperationException.ToString(), 'MachineStateIncorrect', - 'InvalidOperation', $null ) - } - $errorRecordToThrow = New-Object @newObjectParams - throw $errorRecordToThrow -} - -<# - .SYNOPSIS - Retrieves the localized string data based on the machine's culture. - Falls back to en-US strings if the machine's culture is not supported. - - .PARAMETER ResourceName - The name of the resource as it appears before '.strings.psd1' of the localized string file. - - For example: - For WindowsOptionalFeature: MSFT_xWindowsOptionalFeature - For Service: MSFT_xServiceResource - For Registry: MSFT_xRegistryResource - - .PARAMETER ResourcePath - The path the resource file is located in. -#> -function Get-LocalizedData -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $ResourceName, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $ResourcePath - ) - - $localizedStringFileLocation = Join-Path -Path $ResourcePath -ChildPath $PSUICulture - - if (-not (Test-Path -Path $localizedStringFileLocation)) - { - # Fallback to en-US - $localizedStringFileLocation = Join-Path -Path $ResourcePath -ChildPath 'en-US' - } - - Import-LocalizedData ` - -BindingVariable 'localizedData' ` - -FileName "$ResourceName.strings.psd1" ` - -BaseDirectory $localizedStringFileLocation - - return $localizedData -} - -Export-ModuleMember -Function @( - 'Test-IsNanoServer' - 'New-InvalidArgumentException' - 'New-InvalidOperationException' - 'Get-LocalizedData' - ) diff --git a/lib/puppet_x/dsc_resources/xDFS/xDFS.psd1 b/lib/puppet_x/dsc_resources/xDFS/xDFS.psd1 deleted file mode 100644 index 50f913b4..00000000 --- a/lib/puppet_x/dsc_resources/xDFS/xDFS.psd1 +++ /dev/null @@ -1,75 +0,0 @@ -@{ - # Version number of this module. - ModuleVersion = '3.2.0.0' - - # ID used to uniquely identify this module - GUID = '3bcb9c66-ea0b-4675-bd46-c390a382c388' - - # Author of this module - Author = 'Microsoft Corporation' - - # Company or vendor of this module - CompanyName = 'Microsoft Corporation' - - # Copyright statement for this module - Copyright = '(c) 2015 Microsoft Corporation. All rights reserved.' - - # Description of the functionality provided by this module - Description = 'DSC resources for configuring Distributed File System Replication and Namespaces.' - - # Minimum version of the Windows PowerShell engine required by this module - PowerShellVersion = '5.0' - - # Minimum version of the common language runtime (CLR) required by this module - CLRVersion = '4.0' - - # Processor architecture (None, X86, Amd64) required by this module - ProcessorArchitecture = 'None' - - # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess - # NestedModules = @() - - # Functions to export from this module - FunctionsToExport = '*' - - # Cmdlets to export from this module - CmdletsToExport = '*' - - # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. - PrivateData = @{ - PSData = @{ - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @( 'DSC','DesiredStateConfiguration','DSCResourceKit','DSCResource','DFS','DistributedFileSystem' ) - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/xDFS/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/xDFS' - - # ReleaseNotes of this module - ReleaseNotes = '- Converted AppVeyor.yml to pull Pester from PSGallery instead of Chocolatey. -- Changed AppVeyor.yml to use default image. -- Converted AppVeyor build process to use AppVeyor.psm1. -- Resolved PSSA violations. -- Resolved Readme.md style violations. -- Converted Integration Tests to use Test Drive and stop using Invoke-Pester. -- Move strings into separate language files. -- Added CodeCov support. -- Clean up manifest file by removing commented out sections. -- Convert Examples to pass tests and meet minimum standards. -- Convert to Wiki and auto-documentation generation. -- Convert to TestHarness test execution method. -- Correct parameter block format to meet guidelines. -- Replaced all type accelerators with full type names. -- Updated Readme.md to contain resource list. -- Fixed xDFSNamespaceServerConfiguration by converting LocalHost to ComputerName - instead. -- Added integration test to test for conflicts with other common resource kit modules. -- Prevented ResourceHelper and Common module cmdlets from being exported to resolve - conflicts with other resource modules. -' - } # End of PSData hashtable - } # End of PrivateData hashtable -} - diff --git a/lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDBPackage/MSFT_xDBPackage.psm1 b/lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDBPackage/MSFT_xDBPackage.psm1 deleted file mode 100644 index dd2cb8b7..00000000 --- a/lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDBPackage/MSFT_xDBPackage.psm1 +++ /dev/null @@ -1,242 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $true)] - [System.String] - $SqlServer, - - [parameter(Mandatory = $true)] - [System.String] - $Path, - - [parameter(Mandatory = $true)] - [ValidateSet("DACPAC","BACPAC")] - [System.String] - $Type, - - [parameter(Mandatory = $true)] - [ValidateSet("2008-R2","2012","2014")] - [System.String] - $SqlServerVersion - ) -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [System.Management.Automation.PSCredential] - $Credentials, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $true)] - [System.String] - $SqlServer, - - [parameter(Mandatory = $true)] - [System.String] - $Path, - - [parameter(Mandatory = $true)] - [ValidateSet("DACPAC","BACPAC")] - [System.String] - $Type, - - [parameter(Mandatory = $true)] - [ValidateSet("2008-R2","2012","2014")] - [System.String] - $SqlServerVersion - ) - - $connectionString = Construct-ConnectionString -sqlServer $SqlServer -credentials $Credentials - - switch($Type) - { - "DACPAC" - { - Extract-DacPacForDb -connectionString $connectionString -sqlServerVersion $SqlServerVersion -databaseName $DatabaseName -dacpacPath $Path - } - "BACPAC" - { - Import-BacPacForDb -connectionString $connectionString -sqlServerVersion $SqlServerVersion -databaseName $DatabaseName -bacpacPath $Path - } - } - -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [System.Management.Automation.PSCredential] - $Credentials, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $true)] - [System.String] - $SqlServer, - - [parameter(Mandatory = $true)] - [System.String] - $Path, - - [parameter(Mandatory = $true)] - [ValidateSet("DACPAC","BACPAC")] - [System.String] - $Type, - - [parameter(Mandatory = $true)] - [ValidateSet("2008-R2","2012","2014")] - [System.String] - $SqlServerVersion - ) - - $connectionString = Construct-ConnectionString -sqlServer $SqlServer -credentials $Credentials - - $dbExists = CheckIfDbExists -connectionString $connectionString -databaseName $DatabaseName - - if($dbExists) - { - return $false - } - - return $true -} - -function Check-IfDbExists([string]$databaseName, [string]$connectionString) -{ - $connectionString = "$connectionString database=$databaseName;" - - $connection = New-Object system.Data.SqlClient.SqlConnection - - $connection.connectionstring = $connectionString - - try - { - $connection.Open() - } - catch - { - return $false - } - - $connection.Close() - - return $true -} - -function Construct-ConnectionString([string]$sqlServer, [System.Management.Automation.PSCredential]$credentials) -{ - $uid = $credentials.UserName - $pwd = $credentials.GetNetworkCredential().Password - $server = "Server=$sqlServer;" - - if($PSBoundParameters.ContainsKey('credentials')) - { - $integratedSecurity = "Integrated Security=False;" - $userName = "uid=$uid;pwd=$pwd;" - } - else - { - $integratedSecurity = "Integrated Security=SSPI;" - } - - $connectionString = "$server$userName$integratedSecurity" - - return $connectionString -} - -function Extract-DacPacForDb([string]$connectionString, [string]$sqlServerVersion, [string]$databaseName, [string]$dacpacPath) -{ - Load-DacFx -sqlserverVersion $sqlServerVersion - - $dacService = new-object Microsoft.SqlServer.Dac.DacServices($connectionString) - - try - { - $dacService.Extract($dacpacPath, $databaseName, "MyApplication", "1.0.0.0") - } - catch - { - Write-Verbose -Message "Extracting DacPac failed" - } -} - -function Import-BacPacForDb([string]$connectionString, [string]$sqlServerVersion, [string]$databaseName, [string]$bacpacPath) -{ - Write-Verbose "Importing bacpac" - - Load-DacFx -sqlserverVersion $sqlServerVersion - - Write-Verbose $connectionString - - $dacServiceInstance = new-object Microsoft.SqlServer.Dac.DacServices ($connectionString) - - Write-Verbose $dacServiceInstance - - try - { - $dacServiceInstance.ExportBacpac($bacpacPath, $databaseName) - } - catch - { - Write-Verbose -Message "Importing BacPac failed" - } -} - -function Load-DacFx([string]$sqlserverVersion) -{ - $majorVersion = Get-SqlServerMajoreVersion -sqlServerVersion $sqlserverVersion - - $DacFxLocation = "${env:ProgramFiles(x86)}\Microsoft SQL Server\$majorVersion\DAC\bin\Microsoft.SqlServer.Dac.dll" - - try - { - [System.Reflection.Assembly]::LoadFrom($DacFxLocation) | Out-Null - } - catch - { - Throw "Loading DacFx Failed" - } -} - -function Get-SqlServerMajoreVersion([string]$sqlServerVersion) -{ - switch($sqlserverVersion) - { - "2008-R2" - { - $majorVersion = 100 - } - "2012" - { - $majorVersion = 110 - } - "2014" - { - $majorVersion = 120 - } - } - - return $majorVersion -} - -Export-ModuleMember -Function *-TargetResource - - diff --git a/lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDBPackage/MSFT_xDBPackage.schema.mof b/lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDBPackage/MSFT_xDBPackage.schema.mof deleted file mode 100644 index 808c75e7..00000000 --- a/lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDBPackage/MSFT_xDBPackage.schema.mof +++ /dev/null @@ -1,13 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xDBPackage")] -class MSFT_xDBPackage : OMI_BaseResource -{ - [Write, EmbeddedInstance("MSFT_Credential"), Description("Credentials to Connect to the sql server")] String Credentials; - [Key, Description("Name of the Database")] String DatabaseName; - [Required, Description("Sql Server Name")] String SqlServer; - [Required, Description("Path to BacPac/DacPac")] String Path; - [Required, Description("Type for backup(Extract id done for DACPAC and Import for BACPAC)"), ValueMap{"DACPAC","BACPAC"}, Values{"DACPAC","BACPAC"}] String Type; - [Required, ValueMap{"2008-R2","2012","2014"}, Values{"2008-R2","2012","2014"}, Description("Sql Server Version For DacFx")] String SqlServerVersion; -}; - - diff --git a/lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDatabase/MSFT_xDatabase.psm1 b/lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDatabase/MSFT_xDatabase.psm1 deleted file mode 100644 index ade1e057..00000000 --- a/lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDatabase/MSFT_xDatabase.psm1 +++ /dev/null @@ -1,224 +0,0 @@ -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData @' -DacFxInstallationError=Please ensure that DacFx is installed. -SmoFxInstallationError=Please ensure that Smo is installed. -DacPacExtractionError=Extracting DacPac for Db failed, continuing with Dac Deployment. -'@ -} - -Import-Module -DisableNameChecking $PSScriptRoot\..\xDatabase_Common - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [System.Management.Automation.PSCredential] - $Credentials, - - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [System.String] - $SqlServer, - - [parameter(Mandatory = $true)] - [ValidateSet("2008-R2","2012","2014")] - [System.String] - $SqlServerVersion, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseName - ) - - if($PSBoundParameters.ContainsKey('Credentials')) - { - $ConnectionString = Construct-ConnectionString -sqlServer $SqlServer -credentials $Credentials - } - else - { - $ConnectionString = Construct-ConnectionString -sqlServer $SqlServer - } - - $dbExists = CheckIfDbExists $ConnectionString $DatabaseName - $Ensure = if ($dbExists) { "Present" } else { "Absent" } - - $result = @{ - Ensure = $Ensure - DatabaseName = $DatabaseName - SqlServer = $SqlServer - SqlServerVersion = $SqlServerVersion - } - return $result -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [System.Management.Automation.PSCredential] - $Credentials, - - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [System.String] - $SqlServer, - - [parameter(Mandatory = $true)] - [ValidateSet("2008-R2","2012","2014")] - [System.String] - $SqlServerVersion, - - [System.String] - $BacPacPath, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseName, - - [System.String] - $DacPacPath, - - [System.String] - $DacPacApplicationName, - - [System.String] - $DacPacApplicationVersion - ) - - if($PSBoundParameters.ContainsKey('Credentials')) - { - $ConnectionString = Construct-ConnectionString -sqlServer $SqlServer -credentials $Credentials - } - else - { - $ConnectionString = Construct-ConnectionString -sqlServer $SqlServer - } - - if($Ensure -eq "Present") - { - if($PSBoundParameters.ContainsKey('BacPacPath')) - { - Perform-Restore -DbName $DatabaseName -connectionString $ConnectionString -sqlserverVersion $SqlServerVersion -bacpacFilePath $BacPacPath - } - elseif($PSBoundParameters.ContainsKey('DacPacPath')) - { - if(!$PSBoundParameters.ContainsKey('DacPacApplicationName')) - { - Throw "Application Name Needed for DAC Registration, else upgrade is unsupported" - } - DeployDac -databaseName $DatabaseName -connectionString $ConnectionString -sqlserverVersion $SqlServerVersion -dacpacPath $DacPacPath -dacpacApplicationName $DacPacApplicationName -dacpacApplicationVersion $DacPacApplicationVersion - } - else - { - CreateDb -databaseName $DatabaseName -connectionString $ConnectionString - } - } - else - { - DeleteDb -databaseName $DatabaseName -connectionString $ConnectionString -sqlServerVersion $SqlServerVersion - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [System.Management.Automation.PSCredential] - $Credentials, - - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [System.String] - $SqlServer, - - [parameter(Mandatory = $true)] - [ValidateSet("2008-R2","2012","2014")] - [System.String] - $SqlServerVersion, - - [System.String] - $BacPacPath, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseName, - - [System.String] - $DacPacPath, - - [System.String] - $DacPacApplicationName, - - [System.String] - $DacPacApplicationVersion - ) - - if($PSBoundParameters.ContainsKey('DacPacPath') -and $PSBoundParameters.ContainsKey('BacPacPath')) - { - throw "Specify only one out of dacpac or bacpac" - } - - if($PSBoundParameters.ContainsKey('Credentials')) - { - $ConnectionString = Construct-ConnectionString -sqlServer $SqlServer -credentials $Credentials - } - else - { - $ConnectionString = Construct-ConnectionString -sqlServer $SqlServer - } - - $dbExists = CheckIfDbExists $ConnectionString $DatabaseName - - if($Ensure -eq "Present") - { - if($PSBoundParameters.ContainsKey('BacPacPath')) - { - if($dbExists) - { - return $true - } - - return $false - } - if($dbExists -eq $false) - { - return $false - } - if($dbExists -eq $true -and !$PSBoundParameters.ContainsKey('DacPacPath')) - { - return $true - } - else - { - return $false - } - } - else - { - if($dbExists) - { - return $false - } - - return $true - } -} - -Export-ModuleMember -Function *-TargetResource - diff --git a/lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDatabase/MSFT_xDatabase.schema.mof b/lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDatabase/MSFT_xDatabase.schema.mof deleted file mode 100644 index eb8843c1..00000000 --- a/lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDatabase/MSFT_xDatabase.schema.mof +++ /dev/null @@ -1,16 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xDatabase")] -class MSFT_xDatabase : OMI_BaseResource -{ - [Write, EmbeddedInstance("MSFT_Credential"), Description("Credentials to Connect to the sql server")] String Credentials; - [Required, ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, Description("Sql Server Name")] String SqlServer; - [Required, ValueMap{"2008-R2","2012","2014"}, Values{"2008-R2","2012","2014"}, Description("Sql Server Version For DacFx")] String SqlServerVersion; - [Write, Description("Path to BacPac, if this is specified resore is performed")] String BacPacPath; - [Key, Description("Name of the Database")] String DatabaseName; - [Write, Description("Path to DacPac, if this is specified dacpac deployment is performed")] String DacPacPath; - [Write, Description("DacPac Application Name for Registration")] String DacPacApplicationName; - [Write, Description("DacPac Application Version for Registration")] String DacPacApplicationVersion; -}; - - diff --git a/lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDatabaseLogin/MSFT_xDatabaseLogin.psm1 b/lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDatabaseLogin/MSFT_xDatabaseLogin.psm1 deleted file mode 100644 index eb1e4abb..00000000 --- a/lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDatabaseLogin/MSFT_xDatabaseLogin.psm1 +++ /dev/null @@ -1,239 +0,0 @@ -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData @' - CreateDatabaseLoginError=Failed to create SQL Login '{0}'. - TestDatabaseLoginError=Failed to test SQL Login '{0}'. - CreateDatabaseLoginSuccess=Success: SQL Login '{0}' either already existed or has been successfully created. - RemoveDatabaseLoginError=Failed to remove SQL Login '{0}'. - RemoveDatabaseLoginSuccess=Success: SQL Login '{0}' either does not existed or has been successfully removed. -'@ -} - -Import-Module $PSScriptRoot\..\xDatabase_Common - -function Get-TargetResource #Not yet working -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $LoginName, - - [System.String] - $LoginPassword, - - [System.Management.Automation.PSCredential] - $SqlConnectionCredential, - - [parameter(Mandatory = $true)] - [string] - [ValidateSet("SQL","Windows")] - $SqlAuthType, - - [parameter(Mandatory = $true)] - [System.String] - $SqlServer - - ) - - if($SqlAuthType -eq "SQL") - { - $ConnectionString = Construct-ConnectionString -sqlServer $SqlServer -credentials $SqlConnectionCredential - } - else - { - $ConnectionString = Construct-ConnectionString -sqlServer $SqlServer - } - - [string]$loginNameQuery = "SELECT * from sys.sql_logins where name='$LoginName'" - - $PresentValue = $false - - if((ReturnSqlQuery -sqlConnection $connectionString -SqlQuery $loginNameQuery)[0] -gt 0) - { - $PresentValue = $true - } - - - $returnValue = @{ - Ensure = $PresentValue - LoginName = $LoginName - SqlServer = $SqlServer - } - - $returnValue - -} - -#TODO: handle absent case. example "DROP Login Toothy" - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $LoginName, - - [System.String] - $LoginPassword, - - [System.Management.Automation.PSCredential] - $SqlConnectionCredential, - - [parameter(Mandatory = $true)] - [string] - [ValidateSet("SQL","Windows")] - $SqlAuthType, - - [parameter(Mandatory = $true)] - [System.String] - $SqlServer - ) - - if($SqlAuthType -eq "SQL") - { - $ConnectionString = Construct-ConnectionString -sqlServer $SqlServer -credentials $SqlConnectionCredential - } - else - { - $ConnectionString = Construct-ConnectionString -sqlServer $SqlServer - } - - if($Ensure -eq "Present") - { - try - { - # Create login if it does not already exist. - [string]$SqlQuery = "if not exists(SELECT name FROM sys.sql_logins WHERE name='$LoginName') Begin create login $LoginName with password='$LoginPassword' END" - - $supressReturn = ExecuteSqlQuery -sqlConnection $connectionString -SqlQuery $SqlQuery - - Write-Verbose $($LocalizedData.CreateDatabaseLoginSuccess -f ${LoginName}) - - } - catch - { - $errorId = "CreateDatabaseLogin"; - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidResult - $errorMessage = $($LocalizedData.CreateDatabaseLoginError -f ${LoginName}) - $exception = New-Object System.InvalidOperationException $errorMessage - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord); - } - } - else # Ensure is absent so remove login. - { - try - { - # Create login if it does not already exist. - [string]$SqlQuery = "if exists(SELECT name FROM sys.sql_logins WHERE name='$LoginName') Begin DROP LOGIN $LoginName END" - - $supressReturn = ExecuteSqlQuery -sqlConnection $connectionString -SqlQuery $SqlQuery - - Write-Verbose $($LocalizedData.RemoveDatabaseLoginSuccess -f ${LoginName}) - } - catch - { - $errorId = "RemoveDatabaseLogin"; - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidResult - $errorMessage = $($LocalizedData.RemoveDatabaseLoginError -f ${LoginName}) - $exception = New-Object System.InvalidOperationException $errorMessage - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord); - } - } -} - - -function Test-TargetResource #Not yet working -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $LoginName, - - [System.String] - $LoginPassword, - - [System.Management.Automation.PSCredential] - $SqlConnectionCredential, - - [parameter(Mandatory = $true)] - [string] - [ValidateSet("SQL","Windows")] - $SqlAuthType, - - [parameter(Mandatory = $true)] - [System.String] - $SqlServer - ) - - try - { - if($SqlAuthType -eq "SQL") - { - $ConnectionString = Construct-ConnectionString -sqlServer $SqlServer -credentials $SqlConnectionCredential - } - else - { - $ConnectionString = Construct-ConnectionString -sqlServer $SqlServer - } - - [string]$SqlQuery = "SELECT * from sys.sql_logins where name='$LoginName'" - - $LoginsReturnedByQuery = (ReturnSqlQuery -sqlConnection $connectionString -SqlQuery $SqlQuery)[0] - - if((($LoginsReturnedByQuery -gt 0) -and ($Ensure -eq "Present")) -or (($LoginsReturnedByQuery -eq 0) -and ($Ensure -eq "absent"))) - { - $result = $true - } - else - { - $result = $false - } - - return $result - - } - catch - { - $errorId = "TestDatabaseLogin"; - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidResult - $errorMessage = $($LocalizedData.TestDatabaseLoginError -f ${LoginName}) - $exception = New-Object System.InvalidOperationException $errorMessage - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord); - } - -} - - -Export-ModuleMember -Function *-TargetResource - - - - diff --git a/lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDatabaseLogin/MSFT_xDatabaseLogin.schema.mof b/lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDatabaseLogin/MSFT_xDatabaseLogin.schema.mof deleted file mode 100644 index 1b74e7eb..00000000 --- a/lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDatabaseLogin/MSFT_xDatabaseLogin.schema.mof +++ /dev/null @@ -1,15 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xDatabaseLogin")] -class MSFT_xDatabaseLogin : OMI_BaseResource -{ - [Write, ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Key] String LoginName; - [Write] String LoginPassword; - [Required, ValueMap{"Windows","SQL"}, Values{"Windows","SQL"}] string SqlAuthType; - [Required, Description("Sql Server Name")] String SqlServer; - [Write, EmbeddedInstance("MSFT_Credential")] String SqlConnectionCredential; -}; - - - - diff --git a/lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDatabaseLogin/MSFT_xDatabaseLoginWithDefaultDB.psm1 b/lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDatabaseLogin/MSFT_xDatabaseLoginWithDefaultDB.psm1 deleted file mode 100644 index 2a8435a9..00000000 --- a/lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDatabaseLogin/MSFT_xDatabaseLoginWithDefaultDB.psm1 +++ /dev/null @@ -1,210 +0,0 @@ -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData @' - CreateDatabaseLoginError=Failed to create SQL Login '{0}'. - TestDatabaseLoginError=Failed to test SQL Login '{0}'. - CreateDatabaseLoginSuccess=Success: SQL Login '{0}' either already existed or has been successfully created. - AlterDefaultDatabaseLoginSuccess=Successfully set the default database for '{0}' to '{1}'. - RemoveDatabaseLoginError=Failed to remove SQL Login '{0}'. - RemoveDatabaseLoginSuccess=Success: SQL Login '{0}' either does not existed or has been successfully removed. -'@ -} - -Import-Module $PSScriptRoot\..\xDatabase_Common - -function Get-TargetResource #Not yet working -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $LoginName, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SqlConnectionCredentials - ) - - $Connection = Construct-SqlConnection -credentials $SqlConnectionCredentials - - [string]$loginNameQuery = "SELECT * from sys.sql_logins where name='$LoginName'" - [string]$DBNameQuery = "Select default_database_name from sys.sql_logins where name='$LoginName'" - - $PresentValue = $false - - if((ReturnSqlQuery -sqlConnection $connection -SqlQuery $loginNameQuery)[0] -gt 0) - { - $PresentValue = $true - } - - - $returnValue = @{ - Ensure = $PresentValue - LoginName = $LoginName - DefaultDatabaseName = (ReturnSqlQuery -sqlConnection $connection -SqlQuery $DBNameQuery).default_database_name - } - - $returnValue - -} - -#TODO: handle absent case. example "DROP Login Toothy" - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $LoginName, - - [System.String] - $LoginPassword, - - [System.String] - $DefaultDatabaseName, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SqlConnectionCredentials - ) - - $Connection = Construct-SqlConnection -Credentials $SqlConnectionCredentials - - if($Ensure -eq "Present") - { - try - { - # Create login if it does not already exist. - [string]$SqlQuery = "if not exists(SELECT name FROM sys.sql_logins WHERE name='$LoginName') Begin create login $LoginName with password='$LoginPassword' END" - - $supressReturn = ExecuteSqlQuery -sqlConnection $connection -SqlQuery $SqlQuery - - Write-Verbose $($LocalizedData.CreateDatabaseLoginSuccess -f ${LoginName}) - - # Set the default database if it is not already set correctly. - - if($PSBoundParameters.ContainsKey("DefaultDatabaseName")) - { - [string]$SqlQuery = "if not exists(SELECT name FROM sys.sql_logins WHERE name='$LoginName' AND default_database_name='$DefaultDatabaseName') BEGIN ALTER LOGIN $LoginName with default_database=$DefaultDatabaseName End" - - $supressReturn = ExecuteSqlQuery -sqlConnection $connection -SqlQuery $SqlQuery - - Write-Verbose $($LocalizedData.AlterDefaultDatabaseLoginSuccess -f ${LoginName}, ${DefaultDatabaseName}) - } - - } - catch - { - $errorId = "CreateDatabaseLogin"; - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidResult - $errorMessage = $($LocalizedData.CreateDatabaseLoginError -f ${LoginName}) - $exception = New-Object System.InvalidOperationException $errorMessage - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord); - } - } - else # Ensure is absent so remove login. - { - try - { - # Create login if it does not already exist. - [string]$SqlQuery = "if exists(SELECT name FROM sys.sql_logins WHERE name='$LoginName') Begin DROP LOGIN $LoginName END" - - $supressReturn = ExecuteSqlQuery -sqlConnection $connection -SqlQuery $SqlQuery - - Write-Verbose $($LocalizedData.RemoveDatabaseLoginSuccess -f ${LoginName}) - } - catch - { - $errorId = "RemoveDatabaseLogin"; - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidResult - $errorMessage = $($LocalizedData.RemoveDatabaseLoginError -f ${LoginName}) - $exception = New-Object System.InvalidOperationException $errorMessage - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord); - } - } -} - - -function Test-TargetResource #Not yet working -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $LoginName, - - [System.String] - $LoginPassword, - - [System.String] - $DefaultDatabaseName, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SqlConnectionCredentials - ) - - try - { - $Connection = Construct-SqlConnection -Credentials $SqlConnectionCredentials - - [string]$SqlLoginQuery = "SELECT * from sys.sql_logins where name='$LoginName'" - if($PSBoundParameters.ContainsKey("DefaultDatabaseName")) - { - $SqlDBQuery = " AND default_database_name='$DefaultDatabaseName'" - } - - [string]$SqlQuery = "$SqlLoginQuery$SqlDBQuery" - - $LoginsReturnedByQuery = (ReturnSqlQuery -sqlConnection $connection -SqlQuery $SqlQuery)[0] - - if((($LoginsReturnedByQuery -gt 0) -and ($Ensure -eq "Present")) -or (($LoginsReturnedByQuery -eq 0) -and ($Ensure -eq "absent"))) - { - $result = $true - } - else - { - $result = $false - } - - return $result - - } - catch - { - $errorId = "TestDatabaseLogin"; - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidResult - $errorMessage = $($LocalizedData.TestDatabaseLoginError -f ${LoginName}) - $exception = New-Object System.InvalidOperationException $errorMessage - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord); - } - -} - - -Export-ModuleMember -Function *-TargetResource - - - - diff --git a/lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDatabaseServer/MSFT_xDatabaseServer.psm1 b/lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDatabaseServer/MSFT_xDatabaseServer.psm1 deleted file mode 100644 index 5a4db66e..00000000 --- a/lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDatabaseServer/MSFT_xDatabaseServer.psm1 +++ /dev/null @@ -1,155 +0,0 @@ -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData @' - LoginModeSuccess=Successfully set loginMode to '{0}'. - LoginModeError=Failed to set loginMode to '{0}'. Ensure SQL Server is properly installed. - LoginModeTestError=Failed to find current loginMode. Ensure SQL Server is properly installed. - LoginModeTestTrue=The current LoginMode value '{0}' matches the desired loginMode value '{1}'. - LoginModeTestFalse=The current LoginMode value '{0}' does NOT match the desired loginMode value '{1}'. -'@ -} - -Import-Module $PSScriptRoot\..\xDatabase_Common - - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Windows","Mixed")] - [System.String] - $LoginMode - ) - - try - { - $RegPath = (dir 'HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\' -Recurse | where property -eq "LoginMode").PSPath - $ActualLoginModeValue = (Get-ItemProperty $RegPath -Name LoginMode).LoginMode - $ActualLoginMode = if($ActualLoginModeValue -eq 1){"Windows"}else{"Mixed"} - } - catch - { - $errorId = "LoginModeTest"; - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidResult - $errorMessage = $($LocalizedData.LoginModeTestError) - $exception = New-Object System.InvalidOperationException $errorMessage - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord); - } - - $returnValue = - @{ - LoginMode = $ActualLoginMode - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Windows","Mixed")] - [System.String] - $LoginMode - ) - - - if($PSBoundParameters.ContainsKey('LoginMode')) # Set SQL authentication to Mixed: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQLServer\LoginMode - { - try - { - $RegPath = (dir 'HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\' -Recurse | where property -eq "LoginMode").PSPath - - $LoginModeValue = if($LoginMode -eq "Windows"){1}else{2} - - set-itemproperty $RegPath LoginMode $LoginModeValue - - # restart SQL instance for above to take affect: - net stop MSSQLServer - net start MSSQLServer - - Write-Verbose $($LocalizedData.LoginModeSuccess -f $LoginMode) - } - catch - { - $errorId = "LoginMode"; - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidResult - $errorMessage = $($LocalizedData.LoginModeError) -f ${LoginMode} - $exception = New-Object System.InvalidOperationException $errorMessage - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord); - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Windows","Mixed")] - [System.String] - $LoginMode - ) - - $ReturnValue = $true - - if($PSBoundParameters.ContainsKey('LoginMode')) - { - $LoginModeValue = if($LoginMode -eq "Windows"){1}else{2} - - try - { - $RegPath = (dir 'HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\' -Recurse | where property -eq "LoginMode").PSPath - - $ActualLoginModeValue = (Get-ItemProperty $RegPath -Name LoginMode).LoginMode - - $ActualLoginMode = if($ActualLoginModeValue -eq 1){"Windows"}else{"Mixed"} - - } - catch - { - $errorId = "LoginModeTest"; - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidResult - $errorMessage = $($LocalizedData.LoginModeTestError) - $exception = New-Object System.InvalidOperationException $errorMessage - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord); - } - - if ($ActualLoginModeValue -ne $LoginModeValue) - { - $ReturnValue = $false - - Write-Verbose $($LocalizedData.LoginModeTestFalse -f $ActualLoginMode, $LoginMode) - } - else - { - Write-Verbose $($LocalizedData.LoginModeTestTrue -f $ActualLoginMode, $LoginMode) - } - } - - return $ReturnValue - -} - - -Export-ModuleMember -Function *-TargetResource - - - - diff --git a/lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDatabaseServer/MSFT_xDatabaseServer.schema.mof b/lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDatabaseServer/MSFT_xDatabaseServer.schema.mof deleted file mode 100644 index 387c5ed9..00000000 --- a/lib/puppet_x/dsc_resources/xDatabase/DSCResources/MSFT_xDatabaseServer/MSFT_xDatabaseServer.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xDatabaseServer")] -class MSFT_xDatabaseServer : OMI_BaseResource -{ - [Key, ValueMap{"Windows","Mixed"}, Values{"Windows","Mixed"}] String LoginMode; -}; - - - - diff --git a/lib/puppet_x/dsc_resources/xDatabase/DSCResources/xDatabase_Common/xDatabase_Common.psm1 b/lib/puppet_x/dsc_resources/xDatabase/DSCResources/xDatabase_Common/xDatabase_Common.psm1 deleted file mode 100644 index 86ad0cd2..00000000 --- a/lib/puppet_x/dsc_resources/xDatabase/DSCResources/xDatabase_Common/xDatabase_Common.psm1 +++ /dev/null @@ -1,282 +0,0 @@ -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData @' -DacFxInstallationError=Please ensure that DacFx is installed. -SmoFxInstallationError=Please ensure that Smo is installed. -'@ -} - -function CheckIfDbExists([string]$connectionString, [string]$databaseName) -{ - Write-Verbose("Inside CheckIfDbExists") - $connectionString = "$connectionString database=$databaseName;" - - $connection = New-Object system.Data.SqlClient.SqlConnection - - $connection.connectionstring = $connectionString - - Write-Verbose($connectionString) - - try - { - $connection.Open() - } - catch - { - Write-Verbose("Db does not exist") - return $false - } - - $connection.Close() - - return $true -} - -function DeployDac([string] $databaseName, [string]$connectionString, [string]$sqlserverVersion, - [string]$dacpacPath, [string]$dacpacApplicationName, [string]$dacpacApplicationVersion) -{ - $defaultDacPacApplicationVersion = "1.0.0.0" - - if($PSBoundParameters.ContainsKey('dacpacApplicationVersion')) - { - $defaultDacPacApplicationVersion = $defaultDacPacApplicationVersion - } - - try - { - Load-DacFx -sqlserverVersion $sqlserverVersion - } - catch - { - Throw "$LocalizedData.DacFxInstallationError" - } - - $dacServicesObject = new-object Microsoft.SqlServer.Dac.DacServices ($connectionString) - - $dacpacInstance = [Microsoft.SqlServer.Dac.DacPackage]::Load($dacpacPath) - - try - { - $dacServicesObject.Deploy($dacpacInstance, $databaseName,$true) - - $dacServicesObject.Register($databaseName, $dacpacApplicationName,$defaultDacPacApplicationVersion) - - Write-Verbose("Dac Deployed") - } - catch - { - $errorMessage = $_.Exception.Message - Write-Verbose('Dac Deploy Failed: ''{0}''' -f $errorMessage) - } -} - -function CreateDb([string] $databaseName, [string]$connectionString) -{ - $sqlConnection = new-object system.data.SqlClient.SQLConnection($connectionString); - - $query = "if not exists(SELECT name FROM sys.databases WHERE name='$databaseName') BEGIN create database $databaseName END" - - ExecuteSqlQuery -sqlConnection $sqlConnection -sqlQuery $query - - $sqlConnection.Close() -} - -function DeleteDb([string] $databaseName, [string]$connectionString, [string]$sqlServerVersion) -{ - <# - Load-SmoAssembly -sqlserverVersion $sqlServerVersion - - $smo = New-Object Microsoft.SqlServer.Management.Smo.Server $sqlConnection.DataSource - - $smo.KillAllProcesses($databaseName) - - $query = "drop database $databaseName" - #> - - $sqlConnection = new-object system.data.SqlClient.SQLConnection($connectionString); - - #Forcibly drop database - $Query = "If EXISTS(SELECT * FROM sys.databases WHERE name='$databaseName') - BEGIN - EXEC msdb.dbo.sp_delete_database_backuphistory @database_name = N'$databaseName' - ALTER DATABASE [$databaseName] SET SINGLE_USER WITH ROLLBACK IMMEDIATE - USE [master] - DROP DATABASE [$databaseName] - END" - - $result = ExecuteSqlQuery -sqlConnection $sqlConnection -sqlQuery $query - - $sqlConnection.Close() -} - -function ExecuteSqlQuery([system.data.SqlClient.SQLConnection]$sqlConnection, [string]$SqlQuery) -{ - $sqlCommand = new-object system.data.sqlclient.sqlcommand($SqlQuery, $sqlConnection); - - $sqlConnection.Open() - $queryResult = $sqlCommand.ExecuteNonQuery() - $sqlConnection.Close() - - if ($queryResult -ne -1) - { - return $true - } - - return $false -} - -function ReturnSqlQuery([system.data.SqlClient.SQLConnection]$sqlConnection, [string]$SqlQuery) -{ - $sqlCommand = new-object system.data.sqlclient.sqlcommand($SqlQuery, $sqlConnection) - $sqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter($sqlCommand) - $dataSet = New-Object System.Data.DataSet - $sqlAdapter.Fill($dataSet) - - return $dataSet.Tables -} - -function Construct-ConnectionString([string]$sqlServer, [System.Management.Automation.PSCredential]$credentials) -{ - - $server = "Server=$sqlServer;" - - if($PSBoundParameters.ContainsKey('credentials')) - { - $uid = $credentials.UserName - $pwd = $credentials.GetNetworkCredential().Password - $integratedSecurity = "Integrated Security=False;" - $userName = "uid=$uid;pwd=$pwd;" - } - else - { - $integratedSecurity = "Integrated Security=SSPI;" - } - - $connectionString = "$server$userName$integratedSecurity" - - return $connectionString -} - -function Perform-Restore([string]$DbName, [string]$connectionString, [string]$sqlserverVersion, [string]$bacpacFilePath) -{ - Load-DacFx -sqlserverVersion $sqlserverVersion - - $dacServiceInstance = new-object Microsoft.SqlServer.Dac.DacServices ($connectionString) - - $bacpacPackageInstance = [Microsoft.SqlServer.Dac.BacPackage]::Load($bacpacFilePath) - - try - { - $dacServiceInstance.ImportBacpac($bacpacPackageInstance, $DbName) - } - catch - { - Throw "Restore Failed Exception: $_" - } -} - -function Load-DacFx([string]$sqlserverVersion) -{ - $majorVersion = Get-SqlServerMajoreVersion -sqlServerVersion $sqlserverVersion - - $DacFxLocation = "${env:ProgramFiles(x86)}\Microsoft SQL Server\$majorVersion\DAC\bin\Microsoft.SqlServer.Dac.dll" - - try - { - [System.Reflection.Assembly]::LoadFrom($DacFxLocation) | Out-Null - } - catch - { - Throw "$LocalizedData.DacFxInstallationError" - } -} - -function Load-SmoAssembly([string]$sqlserverVersion) -{ - $majorVersion = Get-SqlServerMajoreVersion -sqlServerVersion $sqlserverVersion - - $SmoLocation = "${env:ProgramFiles(x86)}\Microsoft SQL Server\$majorVersion\SDK\Assemblies\Microsoft.SqlServer.Smo.dll" - try - { - [System.Reflection.Assembly]::LoadFrom($SmoLocation) | Out-Null - } - catch - { - Throw "$LocalizedData.SmoFxInstallationError" - } -} - -function Get-SqlServerMajoreVersion([string]$sqlServerVersion) -{ - switch($sqlserverVersion) - { - "2008-R2" - { - $majorVersion = 100 - } - "2012" - { - $majorVersion = 110 - } - "2014" - { - $majorVersion = 120 - } - } - - return $majorVersion -} - -function Get-SqlDatabaseOwner([string]$DatabaseName, [string]$connectionString) -{ - - [string]$SqlQuery = "SELECT SUSER_SNAME(owner_sid) [OwnerName] FROM sys.databases where name = '$DatabaseName'" - - $sqlConnection = new-object system.data.SqlClient.SQLConnection($connectionString) - - - return (ReturnSqlQuery -sqlConnection $sqlConnection -SqlQuery $SqlQuery).OwnerName - - -} - -function Extract-DacPacForDb([string]$connectionString, [string]$sqlServerVersion, [string]$databaseName, [string]$dacpacPath) -{ - Load-DacFx -sqlserverVersion $sqlServerVersion - - $dacService = new-object Microsoft.SqlServer.Dac.DacServices($connectionString) - - try - { - $dacService.Extract($dacpacPath, $databaseName, "MyApplication", "1.0.0.0") - } - catch - { - Write-Verbose -Message "Extracting DacPac failed" - } -} - -function Import-BacPacForDb([string]$connectionString, [string]$sqlServerVersion, [string]$databaseName, [string]$bacpacPath) -{ - Write-Verbose "Importing bacpac" - - Load-DacFx -sqlserverVersion $sqlServerVersion - - Write-Verbose $connectionString - - $dacServiceInstance = new-object Microsoft.SqlServer.Dac.DacServices ($connectionString) - - Write-Verbose $dacServiceInstance - - try - { - $dacServiceInstance.ExportBacpac($bacpacPath, $databaseName) - } - catch - { - Write-Verbose -Message "Importing BacPac failed" - } -} - - diff --git a/lib/puppet_x/dsc_resources/xDatabase/LICENSE b/lib/puppet_x/dsc_resources/xDatabase/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xDatabase/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xDatabase/xDatabase.psd1 b/lib/puppet_x/dsc_resources/xDatabase/xDatabase.psd1 deleted file mode 100644 index bd4909f1..00000000 --- a/lib/puppet_x/dsc_resources/xDatabase/xDatabase.psd1 +++ /dev/null @@ -1,68 +0,0 @@ -@{ - -# Script module or binary module file associated with this manifest. -# RootModule = '' - -# Version number of this module. -ModuleVersion = '1.6.0.0' - -# ID used to uniquely identify this module -GUID = '8ad956dd-4a36-4767-9725-ed0466893edb' - -# Author of this module -Author = 'Microsoft' - -# Company or vendor of this module -CompanyName = 'Microsoft' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'This module contains 2 resources. xDatabase allows to create and deploy databases using DAC or connection string, restore a database using BACPAC and delete a database. The xDBPackage resource allows extracting a database to a DACPAC or exporting to a BACPAC' - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Variables to export from this module -VariablesToExport = '*' - -# Aliases to export from this module -AliasesToExport = '*' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/xDatabase/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/xDatabase' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - ReleaseNotes = '* Moved internal functions to a common helper module - -' - - } # End of PSData hashtable - -} # End of PrivateData hashtable -} - - - - diff --git a/lib/puppet_x/dsc_resources/xDefender/DSCResources/MSFT_xMpPreference/MSFT_xMpPreference.psm1 b/lib/puppet_x/dsc_resources/xDefender/DSCResources/MSFT_xMpPreference/MSFT_xMpPreference.psm1 deleted file mode 100644 index 20c642ac..00000000 --- a/lib/puppet_x/dsc_resources/xDefender/DSCResources/MSFT_xMpPreference/MSFT_xMpPreference.psm1 +++ /dev/null @@ -1,702 +0,0 @@ -<# - .SYNOPSIS Get state of the resource - .EXAMPLE - Get-TargetResource -Name DefenderPreferences -HighThreatDefaultAction Quarantine -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [System.String[]] - $ExclusionPath, - - [System.String[]] - $ExclusionExtension, - - [System.String[]] - $ExclusionProcess, - - [ValidateSet("Both","Incoming","Outgoing")] - [System.String] - $RealTimeScanDirection, - - [System.UInt32] - $QuarantinePurgeItemsAfterDelay, - - [ValidateSet("Everyday","Never","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday")] - [System.String] - $RemediationScheduleDay, - - [System.DateTime] - $RemediationScheduleTime, - - [System.UInt32] - $ReportingAdditionalActionTimeOut, - - [System.UInt32] - $ReportingNonCriticalTimeOut, - - [System.UInt32] - $ReportingCriticalFailureTimeOut, - - [System.UInt32] - $ScanAvgCPULoadFactor, - - [System.Boolean] - $CheckForSignaturesBeforeRunningScan, - - [System.UInt32] - $ScanPurgeItemsAfterDelay, - - [System.Boolean] - $ScanOnlyIfIdleEnabled, - - [ValidateSet("FullSCan","QuickScan")] - [System.String] - $ScanParameters, - - [ValidateSet("Everyday","Never","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday")] - [System.String] - $ScanScheduleDay, - - [System.DateTime] - $ScanScheduleQuickScanTime, - - [System.DateTime] - $ScanScheduleTime, - - [System.UInt32] - $SignatureFirstAuGracePeriod, - - [System.UInt32] - $SignatureAuGracePeriod, - - [System.String] - $SignatureDefinitionUpdateFileSharesSources, - - [System.Boolean] - $SignatureDisableUpdateOnStartupWithoutEngine, - - [System.String] - $SignatureFallbackOrder, - - [ValidateSet("Everyday","Never","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday")] - [System.String] - $SignatureScheduleDay, - - [System.DateTime] - $SignatureScheduleTime, - - [System.UInt32] - $SignatureUpdateCatchupInterval, - - [System.UInt32] - $SignatureUpdateInterval, - - [ValidateSet("Advanced","Basic","Disabled")] - [System.String] - $MAPSReporting, - - [System.Boolean] - $DisablePrivacyMode, - - [System.Boolean] - $RandomizeScheduleTaskTimes, - - [System.Boolean] - $DisableBehaviorMonitoring, - - [System.Boolean] - $DisableIntrusionPreventionSystem, - - [System.Boolean] - $DisableIOAVProtection, - - [System.Boolean] - $DisableRealtimeMonitoring, - - [System.Boolean] - $DisableScriptScanning, - - [System.Boolean] - $DisableArchiveScanning, - - [System.Boolean] - $DisableAutoExclusions, - - [System.Boolean] - $DisableCatchupFullScan, - - [System.Boolean] - $DisableCatchupQuickScan, - - [System.Boolean] - $DisableEmailScanning, - - [System.Boolean] - $DisableRemovableDriveScanning, - - [System.Boolean] - $DisableRestorePoint, - - [System.Boolean] - $DisableScanningMappedNetworkDrivesForFullScan, - - [System.Boolean] - $DisableScanningNetworkFiles, - - [System.Boolean] - $UILockdown, - - [System.UInt64] - $ThreatIDDefaultAction_Ids, - - [ValidateSet("Allow","Block","Clean","NoAction","Quarantine","Remove","UserDefined")] - [System.String] - $ThreatIDDefaultAction_Actions, - - [ValidateSet("Allow","Block","Clean","NoAction","Quarantine","Remove","UserDefined")] - [System.String] - $UnknownThreatDefaultAction, - - [ValidateSet("Allow","Block","Clean","NoAction","Quarantine","Remove","UserDefined")] - [System.String] - $LowThreatDefaultAction, - - [ValidateSet("Allow","Block","Clean","NoAction","Quarantine","Remove","UserDefined")] - [System.String] - $ModerateThreatDefaultAction, - - [ValidateSet("Allow","Block","Clean","NoAction","Quarantine","Remove","UserDefined")] - [System.String] - $HighThreatDefaultAction, - - [ValidateSet("Allow","Block","Clean","NoAction","Quarantine","Remove","UserDefined")] - [System.String] - $SevereThreatDefaultAction, - - [ValidateSet("Allways Prompt","Send safe samples automatically","Never send","Send all samples automatically")] - [System.String] - $SubmitSamplesConsent - ) - - $mpp = Get-MpPreference - $exclude = 'PSComputerName','ComputerID' - $MPPreference = $mpp | Get-Member -MemberType Property | ? {$_.Name -notin $exclude} | % Name - - foreach ($pref in $MPPreference) - { - $value = switch ($pref) { - 'RealTimeScanDirection' {Convert-ScanDirectionText $mpp.$pref} - {$_ -in 'RemediationScheduleDay','ScanScheduleDay','SignatureScheduleDay'} {Convert-ScheduleDayText $mpp.$pref} - 'ScanParameters' {Convert-ScanParametersText $mpp.$pref} - 'MAPSReporting' {Convert-ReportingText $mpp.$pref} - 'SubmitSamplesConsent' {Convert-SubmitSamplesConsentText $mpp.$pref} - {$_ -in 'ThreatIDDefaultAction_Actions','UnknownThreatDefaultAction','LowThreatDefaultAction','ModerateThreatDefaultAction','HighThreatDefaultAction','SevereThreatDefaultAction'} {Convert-ActionText $mpp.$pref} - Default {$mpp.$pref} - } - $return += @{$pref = $value} - } - $return += @{Name = $Name} - - $return -} - -<# - .SYNOPSIS Set state of the resource - .EXAMPLE - Set-TargetResource -Name DefenderPreferences -HighThreatDefaultAction Quarantine -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [System.String[]] - $ExclusionPath, - - [System.String[]] - $ExclusionExtension, - - [System.String[]] - $ExclusionProcess, - - [ValidateSet("Both","Incoming","Outgoing")] - [System.String] - $RealTimeScanDirection, - - [System.UInt32] - $QuarantinePurgeItemsAfterDelay, - - [ValidateSet("Everyday","Never","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday")] - [System.String] - $RemediationScheduleDay, - - [System.DateTime] - $RemediationScheduleTime, - - [System.UInt32] - $ReportingAdditionalActionTimeOut, - - [System.UInt32] - $ReportingNonCriticalTimeOut, - - [System.UInt32] - $ReportingCriticalFailureTimeOut, - - [System.UInt32] - $ScanAvgCPULoadFactor, - - [System.Boolean] - $CheckForSignaturesBeforeRunningScan, - - [System.UInt32] - $ScanPurgeItemsAfterDelay, - - [System.Boolean] - $ScanOnlyIfIdleEnabled, - - [ValidateSet("FullSCan","QuickScan")] - [System.String] - $ScanParameters, - - [ValidateSet("Everyday","Never","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday")] - [System.String] - $ScanScheduleDay, - - [System.DateTime] - $ScanScheduleQuickScanTime, - - [System.DateTime] - $ScanScheduleTime, - - [System.UInt32] - $SignatureFirstAuGracePeriod, - - [System.UInt32] - $SignatureAuGracePeriod, - - [System.String] - $SignatureDefinitionUpdateFileSharesSources, - - [System.Boolean] - $SignatureDisableUpdateOnStartupWithoutEngine, - - [System.String] - $SignatureFallbackOrder, - - [ValidateSet("Everyday","Never","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday")] - [System.String] - $SignatureScheduleDay, - - [System.DateTime] - $SignatureScheduleTime, - - [System.UInt32] - $SignatureUpdateCatchupInterval, - - [System.UInt32] - $SignatureUpdateInterval, - - [ValidateSet("Advanced","Basic","Disabled")] - [System.String] - $MAPSReporting, - - [System.Boolean] - $DisablePrivacyMode, - - [System.Boolean] - $RandomizeScheduleTaskTimes, - - [System.Boolean] - $DisableBehaviorMonitoring, - - [System.Boolean] - $DisableIntrusionPreventionSystem, - - [System.Boolean] - $DisableIOAVProtection, - - [System.Boolean] - $DisableRealtimeMonitoring, - - [System.Boolean] - $DisableScriptScanning, - - [System.Boolean] - $DisableArchiveScanning, - - [System.Boolean] - $DisableAutoExclusions, - - [System.Boolean] - $DisableCatchupFullScan, - - [System.Boolean] - $DisableCatchupQuickScan, - - [System.Boolean] - $DisableEmailScanning, - - [System.Boolean] - $DisableRemovableDriveScanning, - - [System.Boolean] - $DisableRestorePoint, - - [System.Boolean] - $DisableScanningMappedNetworkDrivesForFullScan, - - [System.Boolean] - $DisableScanningNetworkFiles, - - [System.Boolean] - $UILockdown, - - [System.UInt64] - $ThreatIDDefaultAction_Ids, - - [ValidateSet("Allow","Block","Clean","NoAction","Quarantine","Remove","UserDefined")] - [System.String] - $ThreatIDDefaultAction_Actions, - - [ValidateSet("Allow","Block","Clean","NoAction","Quarantine","Remove","UserDefined")] - [System.String] - $UnknownThreatDefaultAction, - - [ValidateSet("Allow","Block","Clean","NoAction","Quarantine","Remove","UserDefined")] - [System.String] - $LowThreatDefaultAction, - - [ValidateSet("Allow","Block","Clean","NoAction","Quarantine","Remove","UserDefined")] - [System.String] - $ModerateThreatDefaultAction, - - [ValidateSet("Allow","Block","Clean","NoAction","Quarantine","Remove","UserDefined")] - [System.String] - $HighThreatDefaultAction, - - [ValidateSet("Allow","Block","Clean","NoAction","Quarantine","Remove","UserDefined")] - [System.String] - $SevereThreatDefaultAction, - - [ValidateSet("Allways Prompt","Send safe samples automatically","Never send","Send all samples automatically")] - [System.String] - $SubmitSamplesConsent - ) - - $Params = $PSBoundParameters - $output = $Params.Remove('Name') - $output = $Params.Remove('Debug') - $output = $Params.Remove('Verbose') - - Set-MpPreference @Params -} - -<# - .SYNOPSIS Test state of the resource - .EXAMPLE - Test-TargetResource -Name DefenderPreferences -HighThreatDefaultAction Quarantine -Verbose -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [System.String[]] - $ExclusionPath, - - [System.String[]] - $ExclusionExtension, - - [System.String[]] - $ExclusionProcess, - - [ValidateSet("Both","Incoming","Outgoing")] - [System.String] - $RealTimeScanDirection, - - [System.UInt32] - $QuarantinePurgeItemsAfterDelay, - - [ValidateSet("Everyday","Never","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday")] - [System.String] - $RemediationScheduleDay, - - [System.DateTime] - $RemediationScheduleTime, - - [System.UInt32] - $ReportingAdditionalActionTimeOut, - - [System.UInt32] - $ReportingNonCriticalTimeOut, - - [System.UInt32] - $ReportingCriticalFailureTimeOut, - - [System.UInt32] - $ScanAvgCPULoadFactor, - - [System.Boolean] - $CheckForSignaturesBeforeRunningScan, - - [System.UInt32] - $ScanPurgeItemsAfterDelay, - - [System.Boolean] - $ScanOnlyIfIdleEnabled, - - [ValidateSet("FullSCan","QuickScan")] - [System.String] - $ScanParameters, - - [ValidateSet("Everyday","Never","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday")] - [System.String] - $ScanScheduleDay, - - [System.DateTime] - $ScanScheduleQuickScanTime, - - [System.DateTime] - $ScanScheduleTime, - - [System.UInt32] - $SignatureFirstAuGracePeriod, - - [System.UInt32] - $SignatureAuGracePeriod, - - [System.String] - $SignatureDefinitionUpdateFileSharesSources, - - [System.Boolean] - $SignatureDisableUpdateOnStartupWithoutEngine, - - [System.String] - $SignatureFallbackOrder, - - [ValidateSet("Everyday","Never","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday")] - [System.String] - $SignatureScheduleDay, - - [System.DateTime] - $SignatureScheduleTime, - - [System.UInt32] - $SignatureUpdateCatchupInterval, - - [System.UInt32] - $SignatureUpdateInterval, - - [ValidateSet("Advanced","Basic","Disabled")] - [System.String] - $MAPSReporting, - - [System.Boolean] - $DisablePrivacyMode, - - [System.Boolean] - $RandomizeScheduleTaskTimes, - - [System.Boolean] - $DisableBehaviorMonitoring, - - [System.Boolean] - $DisableIntrusionPreventionSystem, - - [System.Boolean] - $DisableIOAVProtection, - - [System.Boolean] - $DisableRealtimeMonitoring, - - [System.Boolean] - $DisableScriptScanning, - - [System.Boolean] - $DisableArchiveScanning, - - [System.Boolean] - $DisableAutoExclusions, - - [System.Boolean] - $DisableCatchupFullScan, - - [System.Boolean] - $DisableCatchupQuickScan, - - [System.Boolean] - $DisableEmailScanning, - - [System.Boolean] - $DisableRemovableDriveScanning, - - [System.Boolean] - $DisableRestorePoint, - - [System.Boolean] - $DisableScanningMappedNetworkDrivesForFullScan, - - [System.Boolean] - $DisableScanningNetworkFiles, - - [System.Boolean] - $UILockdown, - - [System.UInt64] - $ThreatIDDefaultAction_Ids, - - [ValidateSet("Allow","Block","Clean","NoAction","Quarantine","Remove","UserDefined")] - [System.String] - $ThreatIDDefaultAction_Actions, - - [ValidateSet("Allow","Block","Clean","NoAction","Quarantine","Remove","UserDefined")] - [System.String] - $UnknownThreatDefaultAction, - - [ValidateSet("Allow","Block","Clean","NoAction","Quarantine","Remove","UserDefined")] - [System.String] - $LowThreatDefaultAction, - - [ValidateSet("Allow","Block","Clean","NoAction","Quarantine","Remove","UserDefined")] - [System.String] - $ModerateThreatDefaultAction, - - [ValidateSet("Allow","Block","Clean","NoAction","Quarantine","Remove","UserDefined")] - [System.String] - $HighThreatDefaultAction, - - [ValidateSet("Allow","Block","Clean","NoAction","Quarantine","Remove","UserDefined")] - [System.String] - $SevereThreatDefaultAction, - - [ValidateSet("Allways Prompt","Send safe samples automatically","Never send","Send all samples automatically")] - [System.String] - $SubmitSamplesConsent - ) - $Params = $PSBoundParameters - $output = $Params.Remove('Debug') - $output = $Params.Remove('Verbose') - - $Get = Get-TargetResource @Params - $Keys = $Get.Keys | ? {$_ -in $Params.Keys} - - $return = $True - - foreach ($key in $Keys) { - - $input = $Params.$key - $current = $Get.$key - - if ($input -ne $current){ - $return = $False - Write-Verbose "$input not equal to $current for value $key" - } - - } - - $return -} - -Export-ModuleMember -Function *-TargetResource - - -# Helper Functions - -function Convert-ScanDirectionText { - param( - [parameter(ValueFromPipeline=$true,Mandatory=$true)][Byte]$Num - ) - switch ($Num) - { - 0 {'Both'} - 1 {'Incoming'} - 2 {'Outgoing'} - } -} - -function Convert-ScheduleDayText { - param( - [parameter(ValueFromPipeline=$true,Mandatory=$true)][Byte]$Num - ) - switch ($Num) - { - 0 {'Everyday'} - 1 {'Sunday'} - 2 {'Monday'} - 3 {'Tuesday'} - 4 {'Wednesday'} - 5 {'Thursday'} - 6 {'Friday'} - 7 {'Saturday'} - 8 {'Never'} - } -} - -function Convert-ScanParametersText { - param( - [parameter(ValueFromPipeline=$true,Mandatory=$true)][Byte]$Num - ) - switch ($Num) - { - 1 {'Quick scan'} - 2 {'Full scan'} - } -} - -function Convert-ReportingText { - param( - [parameter(ValueFromPipeline=$true,Mandatory=$true)][Byte]$Num - ) - switch ($Num) - { - 0 {'Disabled'} - 1 {'Basic'} - 2 {'Advanced'} - } -} - -function Convert-SubmitSamplesConsentText { - param( - [parameter(ValueFromPipeline=$true,Mandatory=$true)][Byte]$Num - ) - switch ($Num) - { - 0 {'Always prompt'} - 1 {'Send safe samples automatically'} - 2 {'Never send'} - 3 {'Send all samples automatically'} - } -} - -function Convert-ActionText { - param( - [parameter(ValueFromPipeline=$true,Mandatory=$true)][Byte]$Num - ) - switch ($Num) - { - 1 {'Clean'} - 2 {'Quarantine'} - 3 {'Remove'} - 4 {'Allow'} - 8 {'UserDefined'} - 9 {'NoAction'} - 10 {'Block'} - } -} diff --git a/lib/puppet_x/dsc_resources/xDefender/DSCResources/MSFT_xMpPreference/MSFT_xMpPreference.schema.mof b/lib/puppet_x/dsc_resources/xDefender/DSCResources/MSFT_xMpPreference/MSFT_xMpPreference.schema.mof deleted file mode 100644 index a439a1dd..00000000 --- a/lib/puppet_x/dsc_resources/xDefender/DSCResources/MSFT_xMpPreference/MSFT_xMpPreference.schema.mof +++ /dev/null @@ -1,60 +0,0 @@ - -[ClassVersion("0.1.0.0"), FriendlyName("xMpPreference")] -class MSFT_xMpPreference : OMI_BaseResource -{ - [Key, Description("Provide the text string to uniquely identify this group of settings")] String Name; - [Write, Description("Specifies an array of file paths to exclude from scheduled and real-time scanning. You can specify a folder to exclude all the files under the folder.")] String ExclusionPath[]; - [Write, Description("Specifies an array of file name extensions, such as obj or lib, to exclude from scheduled, custom, and real-time scanning.")] String ExclusionExtension[]; - [Write, Description("Specifies an array of processes, as paths to process images. The cmdlet excludes any files opened by the processes that you specify from scheduled and real-time scanning. Specifying this parameter excludes files opened by executable programs only. The cmdlet does not exclude the processes themselves. To exclude a process, specify it by using the ExclusionPath parameter.")] String ExclusionProcess[]; - [Write, Description("Specifies scanning configuration for incoming and outgoing files on NTFS volumes. Specify a value for this parameter to enhance performance on servers which have a large number of file transfers, but need scanning for either incoming or outgoing files. Evaluate this configuration based on the server role. For non-NTFS volumes, Windows Defender performs full monitoring of file and program activity."), ValueMap{"Both","Incoming","Outgoing"}, Values{"Both","Incoming","Outgoing"}] String RealTimeScanDirection; - [Write, Description("Specifies the number of days to keep items in the Quarantine folder. If you specify a value of zero or do not specify a value for this parameter, items stay in the Quarantine folder indefinitely.")] uint32 QuarantinePurgeItemsAfterDelay; - [Write, Description("Specifies the day of the week on which to perform a scheduled full scan in order to complete remediation. Alternatively, specify everyday for this full scan or never. The default value is Never. If you specify a value of Never or do not specify a value, Windows Defender performs a scheduled full scan to complete remediation by using a default frequency."), ValueMap{"Everyday","Never","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"}, Values{"Everyday","Never","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"}] String RemediationScheduleDay; - [Write, Description("Specifies the time of day, as the number of minutes after midnight, to perform a scheduled scan. The time refers to the local time on the computer. If you do not specify a value for this parameter, a scheduled scan runs at the default time of two hours after midnight.")] DateTime RemediationScheduleTime; - [Write, Description("Specifies the number of minutes before a detection in the additional action state changes to the cleared state.")] uint32 ReportingAdditionalActionTimeOut; - [Write, Description("Specifies the number of minutes before a detection in the non-critically failed state changes to the cleared state.")] uint32 ReportingNonCriticalTimeOut; - [Write, Description("Specifies the number of minutes before a detection in the critically failed state changes to either the additional action state or the cleared state.")] uint32 ReportingCriticalFailureTimeOut; - [Write, Description("Specifies the maxium percentage CPU usage for a scan. The acceptable values for this parameter are: integers from 5 through 100, and the value 0, which disables CPU throttling. Windows Defender does not exceed the percentage of CPU usage that you specify. The default value is 50.")] uint32 ScanAvgCPULoadFactor; - [Write, Description("Indicates whether to check for new virus and spyware definitions before Windows Defender runs a scan. If you specify a value of $True, Windows Defender checks for new definitions. If you specify $False or do not specify a value, the scan begins with existing definitions. This value applies to scheduled scans and to scans that you start from the command line, but it does not affect scans that you start from the user interface.")] boolean CheckForSignaturesBeforeRunningScan; - [Write, Description("Specifies the number of days to keep items in the scan history folder. After this time, Windows Defender removes the items. If you specify a value of zero, Windows Defender does not remove items. If you do not specify a value, Windows Defender removes items from the scan history folder after the default length of time, which is 30 days.")] uint32 ScanPurgeItemsAfterDelay; - [Write, Description("Indicates whether to start scheduled scans only when the computer is not in use. If you specify a value of $True or do not specify a value, Windows Defender runs schedules scans when the computer is on, but not in use.")] boolean ScanOnlyIfIdleEnabled; - [Write, Description("Specifies the scan type to use during a scheduled scan. If you do not specify this parameter, Windows Defender uses the default value of quick scan."), ValueMap{"FullSCan","QuickScan"}, Values{"FullSCan","QuickScan"}] String ScanParameters; - [Write, Description("Specifies the day of the week on which to perform a scheduled scan. Alternatively, specify everyday for a scheduled scan or never. If you specify a value of Never or do not specify a value, Windows Defender performs a scheduled scan by using a default frequency."), ValueMap{"Everyday","Never","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"}, Values{"Everyday","Never","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"}] String ScanScheduleDay; - [Write, Description("Specifies the time of day, as the number of minutes after midnight, to perform a scheduled quick scan. The time refers to the local time on the computer. If you do not specify a value for this parameter, a scheduled quick scan runs at the time specified by the ScanScheduleTime parameter. That parameter has a default time of two hours after midnight.")] DateTime ScanScheduleQuickScanTime; - [Write, Description("Specifies the time of day, as the number of minutes after midnight, to perform a scheduled scan. The time refers to the local time on the computer. If you do not specify a value for this parameter, a scheduled scan runs at a default time of two hours after midnight.")] DateTime ScanScheduleTime; - [Write, Description("Specifies a grace period, in minutes, for the definition. If a definition successfully updates within this period, Windows Defender abandons any service initiated updates. This parameter overrides the value of the CheckForSignaturesBeforeRunningScan parameter.")] uint32 SignatureFirstAuGracePeriod; - [Write, Description("Specifies a grace period, in minutes, for the definition. If a definition successfully updates within this period, Windows Defender abandons any service initiated updates.")] uint32 SignatureAuGracePeriod; - [Write, Description("Specifies file-share sources for definition updates. Specify sources as a bracketed sequence of Universal Naming Convention (UNC) locations, separated by the pipeline symbol. If you specify a value for this parameter, Windows Defender attempts to connect to the shares in the order that you specify. After Windows Defender updates a definition, it stops attempting to connect to shares on the list. If you do not specify a value for this parameter, the list is empty.")] String SignatureDefinitionUpdateFileSharesSources; - [Write, Description("Indicates whether to initiate definition updates even if no antimalware engine is present. If you specify a value of $True or do not specify a value, Windows Defender initiates definition updates on startup. If you specify a value of $False, and if no antimalware engine is present, Windows Defender does not initiate definition updates on startup.")] boolean SignatureDisableUpdateOnStartupWithoutEngine; - [Write, Description("Specifies the order in which to contact different definition update sources. Specify the types of update sources in the order in which you want Windows Defender to contact them, enclosed in braces and separated by the pipeline symbol.")] String SignatureFallbackOrder; - [Write, Description("Specifies the day of the week on which to check for definition updates. Alternatively, specify everyday for a scheduled scan or never. If you specify a value of Never or do not specify a value, Windows Defender checks for definition updates by using a default frequency."), ValueMap{"Everyday","Never","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"}, Values{"Everyday","Never","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"}] String SignatureScheduleDay; - [Write, Description("Specifies the time of day, as the number of minutes after midnight, to check for definition updates. The time refers to the local time on the computer. If you do not specify a value for this parameter, Windows Defender checks for definition updates at the default time of 15 minutes before the scheduled scan time.")] DateTime SignatureScheduleTime; - [Write, Description("Specifies the number of days after which Windows Defender requires a catch-up definition update. If you do not specify a value for this parameter, Windows Defender requires a catch-up definition update after the default value of one day.")] uint32 SignatureUpdateCatchupInterval; - [Write, Description("Specifies the interval, in hours, at which to check for definition updates. The acceptable values for this parameter are: integers from 1 through 24. If you do not specify a value for this parameter, Windows Defender checks at the default interval. You can use this parameter instead of the SignatureScheduleDay parameter and SignatureScheduleTime parameter. ")] uint32 SignatureUpdateInterval; - [Write, Description("Specifies the type of membership in Microsoft Active Protection Service. Microsoft Active Protection Service is an online community that helps you choose how to respond to potential threats. The community also helps prevent the spread of new malicious software. If you join this community, you can choose to automatically send basic or additional information about detected software. Additional information helps Microsoft create new definitions. In some instances, personal information might unintentionally be sent to Microsoft. However, Microsoft will not use this information to identify you or contact you."), ValueMap{"Advanced","Basic","Disabled"}, Values{"Advanced","Basic","Disabled"}] String MAPSReporting; - [Write, Description("Indicates whether to disable privacy mode. Privacy mode prevents users, other than administrators, from displaying threat history.")] boolean DisablePrivacyMode; - [Write, Description("Indicates whether to select a random time for the scheduled start and scheduled update for definitions. If you specify a value of $True or do not specify a value, scheduled tasks begin within 30 minutes, before or after, the scheduled time. If you randomize the start times, it can distribute the impact of scanning. For example, if several virtual machines share the same host, randomized start times prevents all the hosts from starting the scheduled tasks at the same time.")] boolean RandomizeScheduleTaskTimes; - [Write, Description("Indicates whether to enable behavior monitoring. If you specify a value of $True or do not specify a value, Windows Defender enables behavior monitoring")] boolean DisableBehaviorMonitoring; - [Write, Description("Indicates whether to configure network protection against exploitation of known vulnerabilities. If you specify a value of $True or do not specify a value, network protection is enabled")] boolean DisableIntrusionPreventionSystem; - [Write, Description("Indicates whether Windows Defender scans all downloaded files and attachments. If you specify a value of $True or do not specify a value, scanning downloaded files and attachments is enabled. ")] boolean DisableIOAVProtection; - [Write, Description("Indicates whether to use real-time protection. If you specify a value of $True or do not specify a value, Windows Defender uses real-time protection. We recommend that you enable Windows Defender to use real-time protection.")] boolean DisableRealtimeMonitoring; - [Write, Description("Specifies whether to disable the scanning of scripts during malware scans.")] boolean DisableScriptScanning; - [Write, Description("Indicates whether to scan archive files, such as .zip and .cab files, for malicious and unwanted software. If you specify a value of $True or do not specify a value, Windows Defender scans archive files.")] boolean DisableArchiveScanning; - [Write, Description("Indicates whether to disable the Automatic Exclusions feature for the server.")] boolean DisableAutoExclusions; - [Write, Description("Indicates whether Windows Defender runs catch-up scans for scheduled full scans. A computer can miss a scheduled scan, usually because the computer is turned off at the scheduled time. If you specify a value of $True, after the computer misses two scheduled full scans, Windows Defender runs a catch-up scan the next time someone logs on to the computer. If you specify a value of $False or do not specify a value, the computer does not run catch-up scans for scheduled full scans.")] boolean DisableCatchupFullScan; - [Write, Description("Indicates whether Windows Defender runs catch-up scans for scheduled quick scans. A computer can miss a scheduled scan, usually because the computer is off at the scheduled time. If you specify a value of $True, after the computer misses two scheduled quick scans, Windows Defender runs a catch-up scan the next time someone logs onto the computer. If you specify a value of $False or do not specify a value, the computer does not run catch-up scans for scheduled quick scans. ")] boolean DisableCatchupQuickScan; - [Write, Description("Indicates whether Windows Defender parses the mailbox and mail files, according to their specific format, in order to analyze mail bodies and attachments. Windows Defender supports several formats, including .pst, .dbx, .mbx, .mime, and .binhex. If you specify a value of $True, Windows Defender performs email scanning. If you specify a value of $False or do not specify a value, Windows Defender does not perform email scanning. ")] boolean DisableEmailScanning; - [Write, Description("Indicates whether to scan for malicious and unwanted software in removable drives, such as flash drives, during a full scan. If you specify a value of $True, Windows Defender scans removable drives during any type of scan. If you specify a value of $False or do not specify a value, Windows Defender does not scan removable drives during a full scan. Windows Defender can still scan removable drives during quick scans or custom scans.")] boolean DisableRemovableDriveScanning; - [Write, Description("Indicates whether to disable scanning of restore points.")] boolean DisableRestorePoint; - [Write, Description("Indicates whether to scan mapped network drives. If you specify a value of $True, Windows Defender scans mapped network drives. If you specify a value of $False or do not specify a value, Windows Defender does not scan mapped network drives.")] boolean DisableScanningMappedNetworkDrivesForFullScan; - [Write, Description("Indicates whether to scan for network files. If you specify a value of $True, Windows Defender scans network files. If you specify a value of $False or do not specify a value, Windows Defender does not scan network files. We do not recommend that you scan network files.")] boolean DisableScanningNetworkFiles; - [Write, Description("Indicates whether to disable UI lockdown mode. If you specify a value of $True, Windows Defender disables UI lockdown mode. If you specify $False or do not specify a value, UI lockdown mode is enabled.")] boolean UILockdown; - [Write, Description("Specifies an array of the actions to take for the IDs specified by using the ThreatIDDefaultAction_Ids parameter.")] uint64 ThreatIDDefaultAction_Ids; - [Write, Description("Specifies which automatic remediation action to take for an unknonwn level threat."), ValueMap{"Allow","Block","Clean","NoAction","Quarantine","Remove","UserDefined"}, Values{"Allow","Block","Clean","NoAction","Quarantine","Remove","UserDefined"}] String ThreatIDDefaultAction_Actions; - [Write, Description("Specifies which automatic remediation action to take for a low level threat."), ValueMap{"Allow","Block","Clean","NoAction","Quarantine","Remove","UserDefined"}, Values{"Allow","Block","Clean","NoAction","Quarantine","Remove","UserDefined"}] String UnknownThreatDefaultAction; - [Write, Description("Specifies which automatic remediation action to take for a low level threat."), ValueMap{"Allow","Block","Clean","NoAction","Quarantine","Remove","UserDefined"}, Values{"Allow","Block","Clean","NoAction","Quarantine","Remove","UserDefined"}] String LowThreatDefaultAction; - [Write, Description("Specifies which automatic remediation action to take for a moderate level threat."), ValueMap{"Allow","Block","Clean","NoAction","Quarantine","Remove","UserDefined"}, Values{"Allow","Block","Clean","NoAction","Quarantine","Remove","UserDefined"}] String ModerateThreatDefaultAction; - [Write, Description("Specifies which automatic remediation action to take for a high level threat."), ValueMap{"Allow","Block","Clean","NoAction","Quarantine","Remove","UserDefined"}, Values{"Allow","Block","Clean","NoAction","Quarantine","Remove","UserDefined"}] String HighThreatDefaultAction; - [Write, Description("Specifies which automatic remediation action to take for a severe level threat."), ValueMap{"Allow","Block","Clean","NoAction","Quarantine","Remove","UserDefined"}, Values{"Allow","Block","Clean","NoAction","Quarantine","Remove","UserDefined"}] String SevereThreatDefaultAction; - [Write, Description("Specifies how Windows Defender checks for user consent for certain samples. If consent has previously been granted, Windows Defender submits the samples. Otherwise, if the MAPSReporting parameter does not have a value of Disabled, Windows Defender prompts the user for consent."), ValueMap{"Allways Prompt","Send safe samples automatically","Never send","Send all samples automatically"}, Values{"Allways Prompt","Send safe samples automatically","Never send","Send all samples automatically"}] String SubmitSamplesConsent; -}; - diff --git a/lib/puppet_x/dsc_resources/xDefender/LICENSE b/lib/puppet_x/dsc_resources/xDefender/LICENSE deleted file mode 100644 index 906b0f7ec6c1cab9307b658c87749eedb4d91f8b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2210 zcmai#OHUg?5QO_2DgR;R6G(_Wq+D_{2Fxmc$qxuejJ@EI$)xG0aqD08r zotf_H>Z;!1*UzCn+SD>@TW&+1Et}arJI}WA{iEvS*xuS3|23?%h5fK4kq>0A$vPtE znCC}(Zy)TF;|b@{?m(HdZW2Fr-023X$9ic`;H>zYf%{CPR++O>#+XVOb(SDKQ)_Ay zJ7K4&@G`Or)=_Io}Q^%{DoIqRTWB5*PP8j)bGI~g%O>p(?DIrBlsw{AnTPp z@e1sTKgGTzd&XHX%wVaV7rK*{s(<<3yhN%huL#Zse?oPwn$0)n4i#Kf12cBbo>hEk`Djni@K421^kzAjZQVw2}N@w=B4)^eSU+r zTuU*DcR`f;E8XvyWA!NwT+~!(3gQOPS0>B_9G5#?{?FCZ9Tl$Z0)&Be z?UGyX#_HDhot(YQdaSy3&5d}@?m0U(B6Onjnmcpj_vICFBfmETqfcCi^)0c&&U~%a z7vei$X|^uxtJk;yO{iV!sr#I}w#N;edsRg$r@_vMOuaYRJF6;o$cr0WdAhxW>yZ77 zRrI*eOUO}C+}f=A;9pg&>tN?zUmct{r%Olfc%CvZovr$kPSR~iL<3GOUuk#5ZjZPD zS)qV56yFZ99WeU-Y;rCRQtXrnokg59x~@*-lNh%6OMOYLy6YeZ`WqE9m~^Rq>lK>h zNg>6w+{=hO16lv+axl(#YPIdFgK*qgBj{_)8B>l1?=Ra#T9Ur0mw!6iQ`9$qTL0oJi%a^Oss_PNRzO5|^kb phj-be`A&-e?Q02?G-)Ge@+Zg4m6w0PO!|e>ktueEU*h&#{SDhITFw9f diff --git a/lib/puppet_x/dsc_resources/xDefender/xDefender.psd1 b/lib/puppet_x/dsc_resources/xDefender/xDefender.psd1 deleted file mode 100644 index d62ffe2d..00000000 --- a/lib/puppet_x/dsc_resources/xDefender/xDefender.psd1 +++ /dev/null @@ -1,120 +0,0 @@ -# -# Module manifest for module 'xDefender' -# -# Generated by: PowerShell DSC -# -# Generated on: 6/18/2015 -# - -@{ - -# Script module or binary module file associated with this manifest. -# RootModule = '' - -# Version number of this module. -ModuleVersion = '0.2.0.0' - -# ID used to uniquely identify this module -GUID = '9d8abe0d-ef91-44ca-98e3-0580c595fd6d' - -# Author of this module -Author = 'PowerShell DSC' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '2015' - -# Description of the functionality provided by this module -Description = 'The xDefender allows you to configure Windows Defender preferences.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Name of the Windows PowerShell host required by this module -# PowerShellHostName = '' - -# Minimum version of the Windows PowerShell host required by this module -# PowerShellHostVersion = '' - -# Minimum version of Microsoft .NET Framework required by this module -# DotNetFrameworkVersion = '' - -# Minimum version of the common language runtime (CLR) required by this module -# CLRVersion = '' - -# Processor architecture (None, X86, Amd64) required by this module -# ProcessorArchitecture = '' - -# Modules that must be imported into the global environment prior to importing this module -# RequiredModules = @() - -# Assemblies that must be loaded prior to importing this module -# RequiredAssemblies = @() - -# Script files (.ps1) that are run in the caller's environment prior to importing this module. -# ScriptsToProcess = @() - -# Type files (.ps1xml) to be loaded when importing this module -# TypesToProcess = @() - -# Format files (.ps1xml) to be loaded when importing this module -# FormatsToProcess = @() - -# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess -# NestedModules = @() - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Variables to export from this module -VariablesToExport = '*' - -# Aliases to export from this module -AliasesToExport = '*' - -# DSC resources to export from this module -# DscResourcesToExport = @() - -# List of all modules packaged with this module -# ModuleList = @() - -# List of all files packaged with this module -# FileList = @() - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - # Tags = @() - - # A URL to the license for this module. - # LicenseUri = '' - - # A URL to the main website for this project. - # ProjectUri = '' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - # ReleaseNotes = '' - - } # End of PSData hashtable - -} # End of PrivateData hashtable - -# HelpInfo URI of this module -# HelpInfoURI = '' - -# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. -# DefaultCommandPrefix = '' - -} - diff --git a/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/Helper.psm1 b/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/Helper.psm1 deleted file mode 100644 index 826afac1..00000000 --- a/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/Helper.psm1 +++ /dev/null @@ -1,141 +0,0 @@ -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData @' -RoleNotFound = Please ensure that the PowerShell module for role {0} is installed -InvalidIPAddressFormat = Value of {0} property is not in a valid IP address format. Specify a valid IP address format and try again. -InvalidIPAddressFamily = The IP address {0} is not a valid {1} address. Specify a valid IP addess in {1} format and try again. -InvalidTimeSpanFormat = Value of {0} property is not in a valid timespan format. Specify the timespan in days.hrs:mins:secs format and try again. -'@ -} - -# Internal function to throw terminating error with specified errroCategory, errorId and errorMessage -function New-TerminatingError -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory)] - [String]$errorId, - - [Parameter(Mandatory)] - [String]$errorMessage, - - [Parameter(Mandatory)] - [System.Management.Automation.ErrorCategory]$errorCategory - ) - - $exception = New-Object System.InvalidOperationException $errorMessage - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - throw $errorRecord -} - -# Internal function to translate a string to valid IPAddress format -function Get-ValidIPAddress -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory)] - [string]$ipString, - - [Parameter(Mandatory)] - [ValidateSet('IPv4')] - [String]$AddressFamily, - - [Parameter(Mandatory)] - [string]$parameterName - ) - - $ipAddressFamily = '' - if($AddressFamily -eq 'IPv4') - { - $ipAddressFamily = 'InterNetwork' - } - else - { - $ipAddressFamily = 'InterNetworkV6' - } - - [System.Net.IPAddress]$ipAddress = $null - $result = [System.Net.IPAddress]::TryParse($ipString, [ref]$ipAddress) - if(-not $result) - { - $errorMsg = $($LocalizedData.InvalidIPAddressFormat) -f $parameterName - New-TerminatingError -errorId 'NotValidIPAddress' -errorMessage $errorMsg -errorCategory InvalidType - } - - if($ipAddress.AddressFamily -ne $ipAddressFamily) - { - $errorMsg = $($LocalizedData.InvalidIPAddressFamily) -f $ipAddress,$AddressFamily - New-TerminatingError -errorId 'InvalidIPAddressFamily' -errorMessage $errorMsg -errorCategory SyntaxError - } - - $ipAddress -} - -# Internal function to assert if the role specific module is installed or not -function Assert-Module -{ - [CmdletBinding()] - param - ( - [string]$moduleName = 'DHCPServer' - ) - - if(! (Get-Module -Name $moduleName -ListAvailable)) - { - $errorMsg = $($LocalizedData.RoleNotFound) -f $moduleName - New-TerminatingError -errorId 'ModuleNotFound' -errorMessage $errorMsg -errorCategory ObjectNotFound - } -} - -# Internal function to write verbose messages for collection of properties -function Write-PropertyMessage -{ - param - ( - [Parameter(Mandatory)] - [Hashtable]$Parameters, - - [Parameter(Mandatory)] - [String[]]$KeysToSkip, - - [Parameter(Mandatory)] - [String]$MessageTemplate - ) - - foreach($key in $parameters.keys) - { - if($keysToSkip -notcontains $key) - { - $msg = $MessageTemplate -f $key,$parameters[$key] - Write-Verbose -Message $msg - } - } -} - -# Internal function to translate a string to valid IPAddress format -function Get-ValidTimeSpan -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory)] - [string]$tsString, - - [Parameter(Mandatory)] - [string]$parameterName - ) - - [System.TimeSpan]$timeSpan = New-TimeSpan - $result = [System.TimeSpan]::TryParse($tsString, [ref]$timeSpan) - if(-not $result) - { - $errorMsg = $($LocalizedData.InvalidTimeSpanFormat) -f $parameterName - New-TerminatingError -errorId 'NotValidTimeSpan' -errorMessage $errorMsg -errorCategory InvalidType - } - - $timeSpan -} diff --git a/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerAuthorization/MSFT_xDhcpServerAuthorization.psm1 b/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerAuthorization/MSFT_xDhcpServerAuthorization.psm1 deleted file mode 100644 index 71be251b..00000000 --- a/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerAuthorization/MSFT_xDhcpServerAuthorization.psm1 +++ /dev/null @@ -1,171 +0,0 @@ -Import-Module $PSScriptRoot\..\Helper.psm1 -Verbose:$false - -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData @' -ResolvingIPv4Address = Resolving first local IPv4 IP address ... -ResolvingHostname = Resolving local hostname ... -AuthorizingServer = Authorizing DHCP Server '{0}' with IP address '{1}' -UnauthorizingServer = Unauthorizing DHCP Server '{0}' with IP address '{1}' -ServerIsAuthorized = DHCP Server '{0}' with IP address '{1}' IS authorized -ServerNotAuthorized = DHCP Server '{0}' with IP address '{1}' is NOT authorized -IncorrectPropertyValue = Property '{0}' is incorrect. Expected '{1}', actual '{2}' -ResourceInDesiredState = DHCP Server '{0}' is in the desired state -ResourceNotInDesiredState = DHCP Server '{0}' is NOT in the desired state -'@ -} - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory)] - [ValidateSet('Present','Absent')] - [System.String] $Ensure, - - [ValidateNotNullOrEmpty()] - [System.String] $DnsName = ( Get-Hostname ), - - [ValidateNotNullOrEmpty()] - [System.String] $IPAddress = ( Get-IPv4Address | Select-Object -First 1 ) - ) - Assert-Module -ModuleName 'DHCPServer'; - $IPAddress = Get-ValidIPAddress -IPString $IPAddress -AddressFamily 'IPv4' -ParameterName 'IPAddress' - $dhcpServer = Get-DhcpServerInDC | Where-Object { ($_.DnsName -eq $DnsName) -and ($_.IPAddress -eq $IPAddress) } - $targetResource = @{ - DnsName = $dhcpServer.DnsName - IPAddress = $dhcpServer.IPAddress - } - if ($dhcpServer) - { - Write-Verbose ($LocalizedData.ServerIsAuthorized -f $DnsName, $IPAddress) - $targetResource['Ensure'] = 'Present' - } - else - { - Write-Verbose ($LocalizedData.ServerNotAuthorized -f $DnsName, $IPAddress) - $targetResource['Ensure'] = 'Absent' - } - return $targetResource -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory)] - [ValidateSet('Present','Absent')] - [System.String] $Ensure, - - [ValidateNotNullOrEmpty()] - [System.String] $DnsName = ( Get-Hostname ), - - [ValidateNotNullOrEmpty()] - [System.String] $IPAddress = ( Get-IPv4Address | Select-Object -First 1 ) - ) - Assert-Module -ModuleName 'DHCPServer' - $IPAddress = Get-ValidIPAddress -IPString $IPAddress -AddressFamily 'IPv4' -ParameterName 'IPAddress' - if ($Ensure -eq 'Present') - { - Write-Verbose ($LocalizedData.AuthorizingServer -f $DnsName, $IPAddress) - Add-DhcpServerInDc -DnsName $DnsName -IPAddress $IPAddress - } - elseif ($Ensure -eq 'Absent') - { - Write-Verbose ($LocalizedData.UnauthorizingServer -f $DnsName, $IPAddress) - Get-DhcpServerInDC | Where-Object { ($_.DnsName -eq $DnsName) -and ($_.IPAddress -eq $IPAddress) } | Remove-DhcpServerInDc - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory)] - [ValidateSet('Present','Absent')] - [System.String] $Ensure, - - [ValidateNotNullOrEmpty()] - [System.String] $DnsName = ( Get-Hostname ), - - [ValidateNotNullOrEmpty()] - [System.String] $IPAddress = ( Get-IPv4Address | Select-Object -First 1 ) - ) - $targetResource = Get-TargetResource @PSBoundParameters - $isCompliant = $true - - if ($targetResource.Ensure -ne $Ensure) - { - Write-Verbose ($LocalizedData.IncorrectPropertyValue -f 'Ensure', $Ensure, $targetResource.Ensure) - $isCompliant = $false - - } - elseif ($Ensure -eq 'Present') - { - if ($targetResource.DnsName -ne $DnsName) - { - Write-Verbose ($LocalizedData.IncorrectPropertyValue -f 'DnsName', $DnsName, $targetResource.DnsName) - $isCompliant = $false - } - if ($targetResource.IPAddress -ne $IPAddress) - { - Write-Verbose ($LocalizedData.IncorrectPropertyValue -f 'IPAddress', $IPAddress, $targetResource.IPAddress) - $isCompliant = $false - } - } - - if ($isCompliant) - { - Write-Verbose ($LocalizedData.ResourceInDesiredState -f $DnsName) - } - else { - Write-Verbose ($LocalizedData.ResourceNotInDesiredState -f $DnsName) - } - return $isCompliant -} - -## Internal function used to return all IPv4 addresses -function Get-IPv4Address -{ - [CmdletBinding()] - [OutputType([System.String])] - param ( ) - process - { - Write-Verbose $LocalizedData.ResolvingIPv4Address - Get-WmiObject Win32_NetworkAdapterConfiguration -Namespace 'root\CIMV2' | - Where-Object IPEnabled -eq 'True' | - ForEach-Object { - Write-Output ($_.IPAddress -notmatch ':') - } - } #end process -} #end function Get-IPv4Address - -## Internal function used to resolve the local hostname -function Get-Hostname { - [CmdletBinding()] - [OutputType([System.String])] - param ( ) - process - { - Write-Verbose $LocalizedData.ResolvingHostname; - $globalIpProperties = [System.Net.NetworkInformation.IPGlobalProperties]::GetIPGlobalProperties(); - if ($globalIpProperties.DomainName) - { - return '{0}.{1}' -f $globalIpProperties.HostName, $globalIpProperties.DomainName - } - else - { - return $globalIpProperties.HostName - } - } #end process -} #end function Get-Hostname - -Export-ModuleMember -Function *-TargetResource; diff --git a/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerAuthorization/MSFT_xDhcpServerAuthorization.schema.mof b/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerAuthorization/MSFT_xDhcpServerAuthorization.schema.mof deleted file mode 100644 index 61b7b64d..00000000 --- a/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerAuthorization/MSFT_xDhcpServerAuthorization.schema.mof +++ /dev/null @@ -1,7 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xDhcpServerAuthorization")] -class MSFT_xDhcpServerAuthorization : OMI_BaseResource -{ - [Write, Description("DHCP Server FQDN")] String DnsName; - [Write, Description("DHCP Server IP Address")] String IPAddress; - [Key, Description("Whether the DHCP server should be authorised within Active Directory"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; -}; diff --git a/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerClass/MSFT_xDhcpServerClass.psm1 b/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerClass/MSFT_xDhcpServerClass.psm1 deleted file mode 100644 index dfcc9667..00000000 --- a/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerClass/MSFT_xDhcpServerClass.psm1 +++ /dev/null @@ -1,187 +0,0 @@ -Import-Module $PSScriptRoot\..\Helper.psm1 -Verbose:$false - -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData @' - SettingClassIDMessage = Setting DHCP Server Class {0} - AddingClassIDMessage = Adding DHCP Server Class {0} - RemovingClassIDMessage = Removing DHCP Server Class {0} -'@ -} - -function Get-TargetResource -{ - param - ( - [Parameter(Mandatory)][ValidateSet('Present','Absent')] - [System.String] $Ensure, - - [parameter(Mandatory)] [ValidateNotNullOrEmpty()] - [String]$Name, - - [parameter(Mandatory)][ValidateSet('Vendor','User')] - [String]$Type, - - [parameter(Mandatory)][ValidateNotNullOrEmpty()] - [string] $AsciiData, - - [AllowEmptyString()] - [string]$Description = '', - - [parameter(Mandatory)][ValidateSet('IPv4')] - [String]$AddressFamily - ) - -#region Input Validation - - # Check for DhcpServer module/role - Assert-Module -moduleName DHCPServer - -#endregion Input Validation - - $DhcpServerClass = Get-DhcpServerv4Class -Name $Name -ErrorAction SilentlyContinue - - if ($DhcpServerClass) - { - $HashTable = @{ - 'Name'=$DhcpServerClass.Name - 'Type'=$DhcpServerClass.Type - 'AsciiData' = $DhcpServerClass.AsciiData - 'Description' = $DhcpServerClass.Description - 'AddressFamily' = 'IPv4' - } - } - else - { - $HashTable = @{ - 'Name' = '' - 'Type' = '' - 'AsciiData' = '' - 'Description' = '' - 'AddressFamily' = '' - } - } - $HashTable -} - -function Set-TargetResource -{ - param - ( - [Parameter(Mandatory)][ValidateSet('Present','Absent')] - [System.String] $Ensure, - - [parameter(Mandatory)] [ValidateNotNullOrEmpty()] - [String]$Name, - - [parameter(Mandatory)][ValidateSet('Vendor','User')] - [String]$Type, - - [parameter(Mandatory)][ValidateNotNullOrEmpty()] - [string] $AsciiData, - - [AllowEmptyString()] - [string]$Description = '', - - [parameter(Mandatory)][ValidateSet('IPv4')] - [String]$AddressFamily - ) - - $DhcpServerClass = Get-DhcpServerv4Class $Name -ErrorAction SilentlyContinue - - #testing for ensure = present - if ($Ensure -eq 'Present') - { - #testing if class exists - if ($DhcpServerClass) - { - #if it exists we use the set verb - $scopeIDMessage = $($LocalizedData.SettingClassIDMessage) -f $Name - Write-Verbose -Message $scopeIDMessage - set-DhcpServerv4Class -Name $Name -Type $Type -Data $AsciiData -Description $Description - } - - #class not exists - else - { - $scopeIDMessage = $($LocalizedData.AddingClassIDMessage) -f $Name - Write-Verbose -Message $scopeIDMessage - Add-DhcpServerv4Class -Name $Name -Type $Type -Data $AsciiData -Description $Description - } - } - - #ensure = absent - else - { - $scopeIDMessage = $($LocalizedData.RemovingClassIDMessage) -f $Name - Write-Verbose -Message $scopeIDMessage - Remove-DhcpServerv4Class -Name $Name -Type $Type - } -} -function Test-TargetResource -{ - param - ( - [Parameter(Mandatory)][ValidateSet('Present','Absent')] - [System.String] $Ensure, - - [parameter(Mandatory)] [ValidateNotNullOrEmpty()] - [String]$Name, - - [parameter(Mandatory)][ValidateSet('Vendor','User')] - [String]$Type, - - [parameter(Mandatory)][ValidateNotNullOrEmpty()] - [string] $AsciiData, - - [AllowEmptyString()] - [string]$Description = '', - - [parameter(Mandatory)][ValidateSet('IPv4')] - [String]$AddressFamily - ) - - $DhcpServerClass = Get-DhcpServerv4Class -Name $Name -ErrorAction SilentlyContinue - - #testing for ensure = present - if ($Ensure -eq 'Present') - { - #testing if $DhcpServerClass is not null - if ($DhcpServerClass) - { - #since $DhcpServerClass is not null compare the values - if (($DhcpServerClass.Type -eq $Type) -and ($DhcpServerClass.asciiData -eq $AsciiData) -and ($DhcpServerClass.Description -eq $Description)) - { - $result = $true - } - - else - { - $result = $false - } - } - #if $DhcpServerClass return false - else - { - $result = $false - } - } - - #ensure = absent - else - { - #testing if $DhcpServerClass is not null, if it exists return false - if ($DhcpServerClass) - { - $result = $false - } - #if it not exists return true - else - { - $result = $true - } - } - $result -} diff --git a/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerClass/MSFT_xDhcpServerClass.schema.mof b/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerClass/MSFT_xDhcpServerClass.schema.mof deleted file mode 100644 index 09cbb37f..00000000 --- a/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerClass/MSFT_xDhcpServerClass.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xDhcpServerClass")] -class MSFT_xDhcpServerClass : OMI_BaseResource -{ - [key, Description("Class Name")] String Name; - [key, Description("Class Type, Vendor or User"), ValueMap{"Vendor","User"}, Values{"Vendor","User"}] String Type; - [key, Description("Class Data, in ASCII format")] String AsciiData; - [Write, Description("Class Description")] String Description; - [key, Description("Class address family. Currently needs to be IPv4"), ValueMap{"IPv4"}, Values{"IPv4"}] String AddressFamily; - [Key, Description("Whether the DHCP server Class should exist"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; -}; diff --git a/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerOption/MSFT_xDhcpServerOption.psm1 b/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerOption/MSFT_xDhcpServerOption.psm1 deleted file mode 100644 index 34e033e0..00000000 --- a/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerOption/MSFT_xDhcpServerOption.psm1 +++ /dev/null @@ -1,428 +0,0 @@ -Import-Module $PSScriptRoot\..\Helper.psm1 -Verbose:$false - -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData @' -InvalidScopeIDMessage = DHCP server scopeID {0} is not valid. Supply a valid scopeID and try again -CheckScopeIDMessage = Checking DHCP server options for scopeID {0} ... -AddingScopeIDMessage = Adding DHCP server options for scopeID {0} ... -SetScopeIDMessage = DHCP server options is set for scopeID {0}. -FoundScopeIDMessage = Found DHCP server options for scopeID {0} and they should be {1} -NotFoundScopeIDMessage = Can not find DHCP server options for scopeID {0} and they should be {1} -RemovingScopeOptions = Removing DHCP Server options for scopeID {0}... -ScopeOptionsRemoved = DHCP Server options are removed. - -CheckPropertyMessage = Checking {0} option ... -NotDesiredPropertyMessage = {0} is not correct. Expected {1}, actual {2} -DesiredPropertyMessage = {0} option is correct. - -SettingPropertyMessage = Setting {0} option ... -SetPropertyMessage = {0} option is set to {1}. -'@ -} - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [String]$ScopeID, - - [Parameter()] [ValidateNotNullOrEmpty()] - [String[]]$DnsServerIPAddress, - - [Parameter()] [ValidateSet('IPv4')] - [String]$AddressFamily = 'IPv4' - ) - -#region Input Validation - - # Check for DhcpServer module/role - Assert-Module -moduleName DHCPServer - - # Convert the ScopeID to be a valid IPAddress - $ScopeID = (Get-ValidIpAddress -ipString $ScopeID -AddressFamily $AddressFamily -parameterName 'ScopeID').ToString() - - # Test if the ScopeID is valid - $null = Get-DhcpServerv4Scope -ScopeId $ScopeID -ErrorAction SilentlyContinue -ErrorVariable err - if($err) - { - $errorMsg = $($LocalizedData.InvalidScopeIdMessage) -f $ScopeID - New-TerminatingError -errorId ScopeIdNotFound -errorMessage $errorMsg -errorCategory InvalidOperation - } - -#endregion Input Validation - - $ensure = 'Absent' - try - { - $dhcpOption = Get-DhcpServerv4OptionValue -ScopeID $ScopeID - if($dhcpOption) - { - $dnsDomain = (($dhcpOption | Where-Object Name -like 'DNS Domain Name').value)[0] - $ensure = 'Present' - $dnsServerIP = ($dhcpOption | Where-Object Name -like 'DNS Servers').value - $Router = ($dhcpOption | Where-Object OptionId -Like 3).value - } - } - catch - { - } - - @{ - ScopeID = $ScopeID - DnsDomain = $dnsDomain - AddressFamily = 'IPv4' - Ensure = $ensure - DnsServerIPAddress = $dnsServerIP - Router = $Router - } -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [String]$ScopeID, - - [Parameter()] [ValidateNotNullOrEmpty()] - [String[]]$DnsServerIPAddress, - - [Parameter()] [ValidateNotNullOrEmpty()] - [String[]]$Router, - - [Parameter()] [ValidateNotNullOrEmpty()] - [String]$DnsDomain, - - [ValidateSet('IPv4')] - [String]$AddressFamily = 'IPv4', - - [ValidateSet('Present','Absent')] - [String]$Ensure = 'Present' - ) - -#region Input Validation - - # Array of valid IP Address - [String[]]$validDnSServer = @() - - # Convert the ScopeID to be a valid IPAddress - $ScopeID = (Get-ValidIpAddress -ipString $ScopeID -AddressFamily $AddressFamily -parameterName 'ScopeID').ToString() - - # Convert the input to be valid IPAddress - foreach ($dnsServerIp in $DnsServerIPAddress) - { - $validDnSServer += (Get-ValidIpAddress -ipString $dnsServerIp -AddressFamily $AddressFamily -parameterName 'DnsServerIPAddress').ToString() - } - $DnsServerIPAddress = $validDnSServer - - # Array of valid IP Address - [String[]]$validRouter = @() - - # Convert the input to be valid IPAddress - foreach ($routerIp in $Router) - { - $validRouter += (Get-ValidIpAddress -ipString $routerIp -AddressFamily $AddressFamily -parameterName 'Router').ToString() - } - $Router = $validRouter - -#endregion Input Validation - - # Remove $AddressFamily and $debug from PSBoundParameters and pass it to validate-properties helper function - If($PSBoundParameters['Debug']) {$null = $PSBoundParameters.Remove('Debug')} - If($PSBoundParameters['AddressFamily']){$null = $PSBoundParameters.Remove('AddressFamily')} - - ValidateResourceProperties @PSBoundParameters -Apply -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [String]$ScopeID, - - [Parameter()] [ValidateNotNullOrEmpty()] - [String[]]$DnsServerIPAddress, - - [Parameter()] [ValidateNotNullOrEmpty()] - [String[]]$Router, - - [Parameter()] [ValidateNotNullOrEmpty()] - [String]$DnsDomain, - - [ValidateSet('IPv4')] - [String]$AddressFamily = 'IPv4', - - [ValidateSet('Present','Absent')] - [String]$Ensure = 'Present' - ) - -#region Input Validation - - # Array of valid IP Address - [String[]]$validDnSServer = @() - - # Check for DhcpServer module/role - Assert-Module -moduleName DHCPServer - - # Convert the ScopeID to be a valid IPAddress - $ScopeID = (Get-ValidIpAddress -ipString $ScopeID -AddressFamily $AddressFamily -parameterName 'ScopeID').ToString() - - # Array of valid IP Address - [String[]]$validDnSServer = @() - - # Convert the input to be valid IPAddress - foreach ($dnsServerIp in $DnsServerIPAddress) - { - $validDnSServer += (Get-ValidIpAddress -ipString $dnsServerIp -AddressFamily $AddressFamily -parameterName 'DnsServerIPAddress').ToString() - } - $DnsServerIPAddress = $validDnSServer - - # Array of valid IP Address - [String[]]$validRouter = @() - - # Convert the input to be valid IPAddress - foreach ($routerIp in $Router) - { - $validRouter += (Get-ValidIpAddress -ipString $routerIp -AddressFamily $AddressFamily -parameterName 'Router').ToString() - } - $Router = $validRouter - - # Test if the ScopeID is valid - $null = Get-DhcpServerv4Scope -ScopeId $ScopeID -ErrorAction SilentlyContinue -ErrorVariable err - if($err) - { - $errorMsg = $($LocalizedData.InvalidScopeIdMessage) -f $ScopeID - New-TerminatingError -errorId ScopeIdNotFound -errorMessage $errorMsg -errorCategory InvalidOperation - } - -#endregion Input Validation - - # Remove $AddressFamily and $debug from PSBoundParameters and pass it to validateProperties helper function - If($PSBoundParameters['Debug']) {$null = $PSBoundParameters.Remove('Debug')} - If($PSBoundParameters['AddressFamily']){$null = $PSBoundParameters.Remove('AddressFamily')} - - ValidateResourceProperties @PSBoundParameters -} - -#region Helper function - -# Internal function to validate dhcpOptions properties -function ValidateResourceProperties -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory)] - [string]$ScopeID, - - [Parameter()] [ValidateNotNullOrEmpty()] - [String[]]$DnsServerIPAddress, - - [Parameter()] [ValidateNotNullOrEmpty()] - [String]$DnsDomain, - - [Parameter()] [ValidateNotNullOrEmpty()] - [String[]]$Router, - - [ValidateSet('Present','Absent')] - [String]$Ensure = 'Present', - - [switch]$Apply - ) - - $scopeIDMessage = $($LocalizedData.CheckScopeIDMessage) -f $ScopeID - Write-Verbose -Message $scopeIDMessage - - $dhcpOption = Get-DhcpServerv4OptionValue -ScopeID $ScopeID - - # Found DHCPOption - if($dhcpOption) - { - $foundScopeIdMessage = $($LocalizedData.FoundScopeIDMessage) -f $ScopeID, $Ensure - Write-Verbose -Message $foundScopeIdMessage - - # If Options should be present, check other properties - if($Ensure -eq 'Present') - { - - if($PSBoundParameters.ContainsKey('DnsServerIPAddress')) - { - # Test the DNS Server IPs - $checkPropertyMessage = $($LocalizedData.CheckPropertyMessage) -f 'Dns server ip' - Write-Verbose -Message $checkPropertyMessage - - $dnsServerIP = ($DhcpOption | Where-Object OptionId -eq 6).Value - # If comparison return something, they are not equal - if((-not $dnsServerIP) -or (Compare-Object $dnsServerIP $DnsServerIPAddress)) - { - $notDesiredPropertyMessage = $($LocalizedData.NotDesiredPropertyMessage) -f 'DNS server ip', ($DnsServerIPAddress -join ', '), ($dnsServerIP -join ', ') - Write-Verbose -Message $notDesiredPropertyMessage - if($Apply) - { - $settingPropertyMessage = $($LocalizedData.SettingPropertyMessage) -f 'DNS server ip' - Write-Verbose -Message $settingPropertyMessage - - Set-DhcpServerv4OptionValue -ScopeId $ScopeID -DnsServer $DnsServerIPAddress -Force - - $setPropertyMessage = $($LocalizedData.SetPropertyMessage) -f 'DNS server ip', ($DnsServerIPAddress -join ', ') - Write-Verbose -Message $setPropertyMessage - - } # end $Apply - else - { - return $false - } - } # end Compare-object - else - { - $desiredPropertyMessage = $($LocalizedData.DesiredPropertyMessage) -f 'DNS server ip' - Write-Verbose -Message $desiredPropertyMessage - } - } - - # If DNS Domain is specified, test that - if($PSBoundParameters.ContainsKey('DnsDomain')) - { - $checkPropertyMessage = $($LocalizedData.CheckPropertyMessage) -f 'Dns domain name' - Write-Verbose -Message $checkPropertyMessage - - $dnsDomainName = ($DhcpOption | Where-Object OptionId -eq 15).Value - if($dnsDomainName -ne $DnsDomain) - { - $notDesiredPropertyMessage = $($LocalizedData.NotDesiredPropertyMessage) -f 'DNS domain name', $DnsDomain, ($dnsDomainName -join ', ') - Write-Verbose -Message $notDesiredPropertyMessage - - if($Apply) - { - $settingPropertyMessage = $($LocalizedData.SettingPropertyMessage) -f 'DNS domain name' - Write-Verbose -Message $settingPropertyMessage - - Set-DhcpServerv4OptionValue -ScopeId $ScopeID -DnsDomain $DnsDomain - - $setPropertyMessage = $($LocalizedData.SetPropertyMessage) -f 'DNS domain name', ($DnsDomain -join ', ') - Write-Verbose -Message $setPropertyMessage - } # end $Apply - else - { - return $false - } - } # end $dnsDomainName -ne $DnsDomain - else - { - $desiredPropertyMessage = $($LocalizedData.DesiredPropertyMessage) -f 'DNS domain name' - Write-Verbose -Message $desiredPropertyMessage - } - } # end $PSBoundParameters.ContainsKey('DnsDomain') - - # If Router is specified, test that - if($PSBoundParameters.ContainsKey('Router')) - { - $propertyName = 'Router ip addresses' - $checkPropertyMessage = $($LocalizedData.CheckPropertyMessage) -f 'Router ip addresses' - Write-Verbose -Message $checkPropertyMessage - - $routerIP = ($DhcpOption | Where-Object OptionId -eq 3).Value - - if((-not $routerIP) -or (Compare-Object $routerIP $Router)) - { - $notDesiredPropertyMessage = $($LocalizedData.NotDesiredPropertyMessage) -f $propertyName, ($Router -join ', '), ($routerIP -join ', ') - Write-Verbose -Message $notDesiredPropertyMessage - - if($Apply) - { - $settingPropertyMessage = $($LocalizedData.SettingPropertyMessage) -f $propertyName - Write-Verbose -Message $settingPropertyMessage - - Set-DhcpServerv4OptionValue -ScopeId $ScopeID -Router $Router - - $setPropertyMessage = $($LocalizedData.SetPropertyMessage) -f $propertyName, ($Router -join ', ') - Write-Verbose -Message $setPropertyMessage - } # end $Apply - else - { - return $false - } - } # end $routerIP -ne $Router - else - { - $desiredPropertyMessage = $($LocalizedData.DesiredPropertyMessage) -f $propertyName - Write-Verbose -Message $desiredPropertyMessage - } - } # end $PSBoundParameters.ContainsKey('Router') - - if(-not $Apply) - { - return $true - } - } # end $Ensure -eq 'Present' - - # If Options should be absent, return False or remove it - else - { - if($Apply) - { - Write-Verbose -Message ($LocalizedData.RemovingScopeOptions -f $ScopeID) - foreach($option in $dhcpOption.OptionID) - { - Remove-DhcpServerv4OptionValue -ScopeId $ScopeID -OptionId $option - } - Write-Verbose -Message ($LocalizedData.ScopeOptionsRemoved) - } # end if $Apply - else {return $false} - } - } - else - { - $notFoundScopeIdMessage = $($LocalizedData.NotFoundScopeIDMessage) -f $ScopeID, $Ensure - Write-Verbose -Message $notFoundScopeIdMessage - - if($Apply) - { - # If Options should be present, create those - if($Ensure -eq 'Present') - { - $addingScopeIdMessage = $($LocalizedData.AddingScopeIDMessage) -f $ScopeID - Write-Verbose -Message $addingScopeIdMessage - - $parameters = @{ScopeID = $ScopeID;} - - ## If DnsServer(s) specified, pass it - if ($PSBoundParameters.ContainsKey('DnsServerIPAddress')) - { - $parameters['DnsServer'] = $DnsServerIPAddress - } - - # If Dns domain is specified pass it - if($PSBoundParameters.ContainsKey('DnsDomain')) - { - $parameters['DnsDomain'] = $DnsDomain - } - - Set-DhcpServerv4OptionValue @parameters -Force - - $setScopeIdMessage = $($LocalizedData.SetScopeIDMessage) -f $ScopeID - Write-Verbose -Message $setScopeIdMessage - } # end Ensure -eq 'Present - } # end if $Apply - else - { - # If Options should be present, return false else true - return ($Ensure -eq 'Absent') - } - } -} -#endregion Helper function -if($global:DhpcOptionTest -ne $true) -{ - Export-ModuleMember -Function *-TargetResource -} diff --git a/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerOption/MSFT_xDhcpServerOption.schema.mof b/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerOption/MSFT_xDhcpServerOption.schema.mof deleted file mode 100644 index 642c9ed5..00000000 --- a/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerOption/MSFT_xDhcpServerOption.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xDhcpServerOption")] -class MSFT_xDhcpServerOption : OMI_BaseResource -{ - [Key, Description("ScopeId for which options are set")] String ScopeID; - [Write, Description("IP address of DNS Servers")] String DnsServerIPAddress[]; - [Write, Description("Domain name of DNS Server")] String DnsDomain; - [Write, Description("IP address of the router/default gateway.")] String Router[]; - [Write, Description("Address family type"), ValueMap{"IPv4"}, Values{"IPv4"}] String AddressFamily; - [Write, Description("Whether option should be set or removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; -}; - diff --git a/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerOptionDefinition/MSFT_xDhcpServerOptionDefinition.psm1 b/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerOptionDefinition/MSFT_xDhcpServerOptionDefinition.psm1 deleted file mode 100644 index aeecc124..00000000 --- a/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerOptionDefinition/MSFT_xDhcpServerOptionDefinition.psm1 +++ /dev/null @@ -1,171 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(mandatory)] [ValidateNotNullOrEmpty()] - [UInt32]$OptionID, - - [Parameter()] [ValidateSet('IPv4')] - [String]$AddressFamily = 'IPv4' - ) - - -#region Input Validation - -#endregion Input Validation - - - $ensure = 'Absent' - - $dhcpServerOptionDefinition = Get-DhcpServerv4OptionDefinition -OptionId $OptionID -ErrorAction SilentlyContinue - - @{ - OptionId = $OptionID - Name = $dhcpServerOptionDefinition.Name - AddressFamily = 'IPv4' - Ensure = $ensure - Description = $dhcpServerOptionDefinition.Description - Type = $dhcpServerOptionDefinition.Type - DefaultValue = $dhcpServerOptionDefinition.DefaultValue - VendorClass = $dhcpServerOptionDefinition.VendorClass - MultiValued = $dhcpServerOptionDefinition.MultiValued - } - -} -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory)] [ValidateNotNullOrEmpty()] - [String]$Name, - - [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] - [UInt32]$OptionID, - - [ValidateSet('Byte','Word','DWord','DWordDWord','IPv4Address','String','BinaryData','EncapsulatedData')] - [String]$Type, - - [ValidateNotNullOrEmpty()] - [string]$Description, - - [switch]$MultiValued, - - [ValidateSet('IPv4')] - [String]$AddressFamily = 'IPv4', - - [ValidateSet('Present','Absent')] - [String]$Ensure = 'Present', - - [ValidateNotNullOrEmpty()] - [string]$Vendorclass - - ) - - #reading the dhcp option - $dhcpServerOptionDefinition = Get-DhcpServerv4OptionDefinition -OptionId $OptionID -ErrorAction SilentlyContinue - - #testing for present - if ($Ensure -eq 'Present') - { - #testing if exists - if ($dhcpServerOptionDefinition) - { - #if it exists and any of multivalued or type is being changed remote then re-add the option - if (($dhcpServerOptionDefinition.type -ne $Type) -or ($dhcpServerOptionDefinition.MultiValued -ne $MultiValued) -or ($dhcpServerOptionDefinition.VendorClass -ne $Vendorclass)) - { - Write-Verbose "Recreating option $OptionID because of changed type or multivalued" - Remove-DhcpServerv4OptionDefinition -OptionId $OptionID - Add-DhcpServerv4OptionDefinition -OptionId $OptionID -name $Name -Type $Type -Description $Description -MultiValued:$MultiValued -VendorClass $Vendorclass - } - else - { - #if option exists we need only to adjust the parameters - Write-Verbose "Modifying DHCP Option Definition $OptionID" - set-DhcpServerv4OptionDefinition -OptionId $OptionID -name $Name -Description $Description - } - } - - #if option does not exist we need to add it - else - { - write-verbose "Adding DHCP Option Definition $OptionID" - Add-DhcpServerv4OptionDefinition -OptionId $OptionID -name $Name -Type $Type -Description $Description -MultiValued:$MultiValued -VendorClass $Vendorclass - } - } - - #testing for 'absent' - else - { - if ($dhcpServerOptionDefinition) - { - Write-Verbose "Removing option $OptionID" - Remove-DhcpServerv4OptionDefinition -OptionId $OptionID - } - - } -} -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter()] [ValidateNotNullOrEmpty()] - [String]$Name, - - [Parameter()] [ValidateNotNullOrEmpty()] - [UInt32]$OptionID, - - [Parameter()] [ValidateSet('Byte,Word,DWord,DWordDWord,IPv4Address,String,BinaryData,EncapsulatedData')] - [String]$Type, - - [Parameter()] - [string]$Description, - - [Parameter()] - [bool]$MultiValued = $false, - - [Parameter()] [ValidateSet('IPv4')] - [String]$AddressFamily = 'IPv4', - - [ValidateSet('Present','Absent')] - [String]$Ensure = 'Present' - ) -#region Input Validation - - # Check for DhcpServer module/role - #Assert-Module -moduleName DHCPServer -#endregion Input Validation - -try -{ - #geting the dhcp option definition - Write-Verbose "Getting DHCP ServerOptionDefinition $OptionID" - $dhcpServerOptionDefinition = Get-DhcpServerv4OptionDefinition -OptionId $OptionID -ErrorAction SilentlyContinue -ErrorVariable err - - #testing for Present - if ($Ensure -eq 'Present') - { - if ($dhcpServerOptionDefinition) - { - #dhcp server option # exists - $Result = $true - } - } - # If option # not exists return false. - else - { - $Result = $false - } - - -} -catch -{ -} - -$Result -} diff --git a/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerReservation/MSFT_xDhcpServerReservation.psm1 b/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerReservation/MSFT_xDhcpServerReservation.psm1 deleted file mode 100644 index 640c7b56..00000000 --- a/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerReservation/MSFT_xDhcpServerReservation.psm1 +++ /dev/null @@ -1,354 +0,0 @@ -Import-Module $PSScriptRoot\..\Helper.psm1 -Verbose:$false - -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData @' -InvalidScopeIDMessage = DHCP server scopeID {0} is not valid. Supply a valid scopeID and try again -CheckingReservationMessage = Checking DHCP server reservation in scope id {0} for IP address {1} ... -TestReservationMessage = DHCP server reservation in the given scope id for the IP address is {0} and it should be {1} -RemovingReservationMessage = Removing DHCP server reservation from scope id {0} for MAC address {1} ... -DeleteReservationMessage = DHCP server reservation for the given MAC address is now absent -AddingReservationMessage = Adding DHCP server reservation with the given IP address ... -SetReservationMessage = DHCP server reservation in the given scope id for the IP address {0} is now present - -CheckPropertyMessage = Checking DHCP server reservation {0} for the given ipaddress ... -NotDesiredPropertyMessage = DHCP server reservation for the given ipaddress doesn't have correct {0}. Expected {1}, actual {2} -DesiredPropertyMessage = DHCP server reservation {0} for the given ipaddress is correct. -SetPropertyMessage = DHCP server reservation {0} for the given ipaddress is set. -'@ -} - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory)] - [String]$ScopeID, - - [parameter(Mandatory)] - [String]$ClientMACAddress, - - [parameter(Mandatory)] - [String]$IPAddress, - - [ValidateSet("IPv4")] - [String]$AddressFamily = 'IPv4' - ) - -#region input validation - # Check for DhcpServer module/role - Assert-Module -moduleName DHCPServer - - # Convert the ScopeID to be a valid IPAddress - $ScopeID = (Get-ValidIpAddress -ipString $ScopeID -AddressFamily $AddressFamily -parameterName 'ScopeID').ToString() - - # Test if the ScopeID is valid - $null = Get-DhcpServerv4Scope -ScopeId $ScopeID -ErrorAction SilentlyContinue -ErrorVariable err - if($err) - { - $errorMsg = $($LocalizedData.InvalidScopeIdMessage) -f $ScopeID - New-TerminatingError -errorId ScopeIdNotFound -errorMessage $errorMsg -errorCategory InvalidOperation - } - - # Convert the Start Range to be a valid IPAddress - $IPAddress = (Get-ValidIpAddress -ipString $IPAddress -AddressFamily $AddressFamily -parameterName 'IPAddress').ToString() - -#endregion input validation - - $reservation = Get-DhcpServerv4Reservation -ScopeID $ScopeID | Where-Object IPAddress -eq $IPAddress - - if($reservation) - { - $ensure = 'Present' - } - else - { - $ensure = 'Absent' - } - - @{ - ScopeID = $ScopeID - IPAddress = $IPAddress - ClientMACAddress = $reservation.ClientId - Name = $reservation.Name - AddressFamily = $AddressFamily - Ensure = $Ensure - } - -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory)] - [String]$ScopeID, - - [parameter(Mandatory)] - [String]$ClientMACAddress, - - [parameter(Mandatory)] - [String]$IPAddress, - - [String]$Name, - - [ValidateSet("IPv4")] - [String]$AddressFamily = 'IPv4', - - [ValidateSet("Present","Absent")] - [String]$Ensure = 'Present' - ) - - if($PSBoundParameters.ContainsKey('Debug')){ $null = $PSBoundParameters.Remove('Debug')} - if($PSBoundParameters.ContainsKey('AddressFamily')) {$null = $PSBoundParameters.Remove('AddressFamily')} - - Validate-ResourceProperties @PSBoundParameters -Apply -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory)] - [String]$ScopeID, - - [parameter(Mandatory)] - [String]$ClientMACAddress, - - [parameter(Mandatory)] - [String]$IPAddress, - - [String]$Name, - - [ValidateSet("IPv4")] - [String]$AddressFamily = 'IPv4', - - [ValidateSet("Present","Absent")] - [String]$Ensure = 'Present' - ) - -#region input validation - # Check for DhcpServer module/role - Assert-Module -moduleName DHCPServer - - # Convert the ScopeID to be a valid IPAddress - $ScopeID = (Get-ValidIpAddress -ipString $ScopeID -AddressFamily $AddressFamily -parameterName 'ScopeID').ToString() - - # Test if the ScopeID is valid - $null = Get-DhcpServerv4Scope -ScopeId $ScopeID -ErrorAction SilentlyContinue -ErrorVariable err - if($err) - { - $errorMsg = $($LocalizedData.InvalidScopeIdMessage) -f $ScopeID - New-TerminatingError -errorId ScopeIdNotFound -errorMessage $errorMsg -errorCategory InvalidOperation - } - - # Convert the Start Range to be a valid IPAddress - $IPAddress = (Get-ValidIpAddress -ipString $IPAddress -AddressFamily $AddressFamily -parameterName 'IPAddress').ToString() - - #Convert the MAC Address into normalized form for comparison - $ClientMACAddress = $ClientMACAddress.Replace('-','') - -#endregion input validation - - if($PSBoundParameters.ContainsKey('Debug')){ $null = $PSBoundParameters.Remove('Debug')} - if($PSBoundParameters.ContainsKey('AddressFamily')) {$null = $PSBoundParameters.Remove('AddressFamily')} - - Validate-ResourceProperties @PSBoundParameters -} - -#region Helper function - -# Internal function to validate dhcpOptions properties -function Validate-ResourceProperties -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory)] - [String]$ScopeID, - - [parameter(Mandatory)] - [String]$ClientMACAddress, - - [parameter(Mandatory)] - [String]$IPAddress, - - [String]$Name, - - [ValidateSet("IPv4")] - [String]$AddressFamily = 'IPv4', - - [ValidateSet("Present","Absent")] - [String]$Ensure = 'Present', - - [Switch]$Apply - ) - - $reservationMessage = $($LocalizedData.CheckingReservationMessage) -f $ScopeID, $IPAddress - Write-Verbose -Message $reservationMessage - - $reservation = Get-DhcpServerv4Reservation -ScopeID $ScopeID | Where-Object IPAddress -eq $IPAddress - - # Initialize the parameter collection - if($Apply) - { - $parameters = @{IPAddress = $IPAddress} - } - # Found DHCP reservation - if($reservation) - { - $TestReservationMessage = $($LocalizedData.TestReservationMessage) -f 'present', $Ensure - Write-Verbose -Message $TestReservationMessage - - # if it should be present, test individual properties to match parameter values - if($Ensure -eq 'Present') - { - #Convert the MAC Address into normalized form for comparison - $normalizedClientID = $reservation.ClientId.Replace('-','') - - #region Test MAC address - $checkPropertyMsg = $($LocalizedData.CheckPropertyMessage) -f 'client MAC address' - Write-Verbose -Message $checkPropertyMsg - - if($normalizedClientID -ne $ClientMACAddress) - { - $notDesiredPropertyMsg = $($LocalizedData.NotDesiredPropertyMessage) -f 'client MAC address',$ClientMACAddress,$normalizedClientID - Write-Verbose -Message $notDesiredPropertyMsg - - if($Apply) - { - $parameters['ClientID'] = $ClientMACAddress - } - else - { - return $false - } - } # end ClientID ne ClientMACAddress - else - { - $desiredPropertyMsg = $($LocalizedData.DesiredPropertyMessage) -f 'client MAC address' - Write-Verbose -Message $desiredPropertyMsg - } - #endregion Test MAC address - - #region Test reservation name - $checkPropertyMsg = $($LocalizedData.CheckPropertyMessage) -f 'name' - Write-Verbose -Message $checkPropertyMsg - - if($reservation.Name -ne $Name) - { - $notDesiredPropertyMsg = $($LocalizedData.NotDesiredPropertyMessage) -f 'name',$Name,$($reservation.Name) - Write-Verbose -Message $notDesiredPropertyMsg - - if($Apply) - { - $parameters['Name'] = $Name - } - else - { - return $false - } - } # end reservation.Name -ne Name - else - { - $desiredPropertyMsg = $($LocalizedData.DesiredPropertyMessage) -f 'name' - Write-Verbose -Message $desiredPropertyMsg - } - #endregion Test reservation name - - if($Apply) - { - # If parameters contains more than 1 key, set the DhcpServer reservation - if($parameters.Count -gt 1) - { - Set-DhcpServerv4Reservation @parameters - - Write-PropertyMessage -Parameters $parameters -keysToSkip IPAddress ` - -Message $($LocalizedData.SetPropertyMessage) -Verbose - } - } # end Apply - else - { - return $true - } - } # end ensure -eq present - - # If dhcpreservation should be absent - else - { - if($Apply) - { - $removingReservationMsg = $($LocalizedData.RemovingReservationMessage) -f $ScopeID,$ClientMACAddress - Write-Verbose -Message $removingReservationMsg - - # Remove the reservation - Remove-DhcpServerv4Reservation -ScopeId $ScopeID -ClientId $ClientMACAddress - - $deleteReservationMsg = $LocalizedData.deleteReservationMessage - Write-Verbose -Message $deleteReservationMsg - } - else - { - return $false - } - } # end ensure -eq absent - } # end found resevation - - else - { - $TestReservationMessage = $($LocalizedData.TestReservationMessage) -f 'absent', $Ensure - Write-Verbose -Message $TestReservationMessage - - if($Ensure -eq 'Present') - { - if($Apply) - { - # Add other mandatory parameters - $parameters['ScopeId'] = $ScopeID - $parameters['ClientId'] = $ClientMACAddress - - # Check if reservation name is specified, add to parameter collection - if($PSBoundParameters.ContainsKey('Name')) - { - $parameters['Name'] = $Name - } - - $addingReservationeMessage = $LocalizedData.AddingReservationMessage - Write-Verbose -Message $addingReservationeMessage - - try - { - # Create a new scope with specified properties - Add-DhcpServerv4Reservation @parameters - - $setReservationMessage = $($LocalizedData.SetReservationMessage) -f $Name - Write-Verbose -Message $setReservationMessage - } - catch - { - New-TerminatingError -errorId DhcpServerReservationFailure -errorMessage $_.Exception.Message -errorCategory InvalidOperation - } - }# end Apply - else - { - return $false - } - } # end Ensure -eq Present - else - { - return $true - } - } # end ! reservation -} - -#endregion - -Export-ModuleMember -Function *-TargetResource - diff --git a/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerReservation/MSFT_xDhcpServerReservation.schema.mof b/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerReservation/MSFT_xDhcpServerReservation.schema.mof deleted file mode 100644 index c1d6c0ea..00000000 --- a/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerReservation/MSFT_xDhcpServerReservation.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xDhcpServerReservation")] -class MSFT_xDhcpServerReservation : OMI_BaseResource -{ - [Key, Description("ScopeId for which reservations are set")] String ScopeID; - [Key, Description("IP address of the reservation for which the properties are modified")] String IPAddress; - [Required, Description("Client MAC Address to set on the reservation")] String ClientMACAddress; - [Write, Description("Reservation name")] String Name; - [Write, Description("Address family type"), ValueMap{"IPv4"}, Values{"IPv4"}] String AddressFamily; - [Write, Description("Whether option should be set or removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; -}; - diff --git a/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerScope/MSFT_xDhcpServerScope.psm1 b/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerScope/MSFT_xDhcpServerScope.psm1 deleted file mode 100644 index eea9a1f8..00000000 --- a/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerScope/MSFT_xDhcpServerScope.psm1 +++ /dev/null @@ -1,461 +0,0 @@ -Import-Module $PSScriptRoot\..\Helper.psm1 -Verbose:$false - -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData @' -AddingScopeMessage = Adding DHCP server scope with the given IP address range ... -CheckScopeMessage = Checking DHCP server scope with the given IP address range ... -SetScopeMessage = DHCP server scope with name '{0}' is now present. -RemovingScopeMessage = Removing DHCP server scope with the given IP address range ... -DeleteScopeMessage = DHCP server scope with the given IP address range is now absent. -TestScopeMessage = DHCP server scope with the given IP address range is '{0}' and it should be '{1}'. - -CheckPropertyMessage = Checking DHCP server scope '{0}' ... -NotDesiredPropertyMessage = DHCP server scope '{0}' is not correct; expected '{1}', actual '{2}'. -DesiredPropertyMessage = DHCP server scope '{0}' is correct. -SetPropertyMessage = DHCP server scope '{0}' is set to '{1}'. -'@ -} - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory)] - [String]$Name, - - [parameter(Mandatory)] - [String]$IPStartRange, - - [parameter(Mandatory)] - [String]$IPEndRange, - - [parameter(Mandatory)] - [String]$SubnetMask, - - [ValidateSet('IPv4')] - [String]$AddressFamily = 'IPv4' - - ) -#region Input Validation - - # Check for DhcpServer module/role - Assert-Module -moduleName DHCPServer - - # Convert the Start Range to be a valid IPAddress - $IPStartRange = (Get-ValidIpAddress -ipString $IPStartRange -AddressFamily $AddressFamily -parameterName 'IPStartRange').ToString() - - # Convert the End Range to be a valid IPAddress - $IPEndRange = (Get-ValidIpAddress -ipString $IPEndRange -AddressFamily $AddressFamily -parameterName 'IPEndRange').ToString() - - # Convert the Subnet Mask to be a valid IPAddress - $SubnetMask = (Get-ValidIpAddress -ipString $SubnetMask -AddressFamily $AddressFamily -parameterName 'SubnetMask').ToString() - - # Check to ensure startRange is smaller than endRange - if($IPEndRange.Address -lt $IPStartRange.Address) - { - $errorMsg = $LocalizedData.InvalidStartAndEndRangeMessage - New-TerminatingError -errorId RangeNotCorrect -errorMessage $errorMsg -errorCategory InvalidArgument - } - -#endregion Input Validation - - $dhcpScope = Get-DhcpServerv4Scope | Where-Object {($_.StartRange -eq $IPStartRange) -and ($_.EndRange -eq $IPEndRange)} - if($dhcpScope) - { - $ensure = 'Present' - } - else - { - $ensure = 'Absent' - } - - return @{ - ScopeID = $dhcpScope.ScopeId - Name = $dhcpScope.Name - IPStartRange = $dhcpScope.StartRane - IPEndRange = $dhcpScope.EndRange - SubnetMask = $dhcpScope.SubnetMask - LeaseDuration = $dhcpScope.LeaseDuration.ToString() - State = $dhcpScope.State - AddressFamily = 'IPv4' - Ensure = $Ensure - } -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory)] - [String]$Name, - - [parameter(Mandatory)] - [String]$IPStartRange, - - [parameter(Mandatory)] - [String]$IPEndRange, - - [parameter(Mandatory)] - [String]$SubnetMask, - - [Parameter()] [ValidateNotNullOrEmpty()] - [String]$LeaseDuration, - - [ValidateSet('IPv4')] - [String]$AddressFamily = 'IPv4', - - [ValidateSet('Active','Inactive')] - [String]$State = 'Active', - - [ValidateSet('Present','Absent')] - [String]$Ensure = 'Present' - ) - - - if($PSBoundParameters.ContainsKey('Debug')){ $null = $PSBoundParameters.Remove('Debug')} - if($PSBoundParameters.ContainsKey('AddressFamily')) {$null = $PSBoundParameters.Remove('AddressFamily')} - - Validate-ResourceProperties @PSBoundParameters -Apply - -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory)] - [String]$Name, - - [parameter(Mandatory)] - [String]$IPStartRange, - - [parameter(Mandatory)] - [String]$IPEndRange, - - [parameter(Mandatory)] - [String]$SubnetMask, - - [Parameter()] [ValidateNotNullOrEmpty()] - [String]$LeaseDuration, - - [ValidateSet('IPv4')] - [String]$AddressFamily = 'IPv4', - - [ValidateSet('Active','Inactive')] - [String]$State = 'Active', - - [ValidateSet('Present','Absent')] - [String]$Ensure = 'Present' - ) - -#region Input Validation - - # Check for DhcpServer module/role - Assert-Module -moduleName DHCPServer - - # Convert the Start Range to be a valid IPAddress - $IPStartRange = (Get-ValidIpAddress -ipString $IPStartRange -AddressFamily $AddressFamily -parameterName 'IPStartRange').ToString() - - # Convert the End Range to be a valid IPAddress - $IPEndRange = (Get-ValidIpAddress -ipString $IPEndRange -AddressFamily $AddressFamily -parameterName 'IPEndRange').ToString() - - # Convert the Subnet Mask to be a valid IPAddress - $SubnetMask = (Get-ValidIpAddress -ipString $SubnetMask -AddressFamily $AddressFamily -parameterName 'SubnetMask').ToString() - - # Check to ensure startRange is smaller than endRange - if($IPEndRange.Address -lt $IPStartRange.Address) - { - $errorMsg = $LocalizedData.InvalidStartAndEndRangeMessage - New-TerminatingError -errorId RangeNotCorrect -errorMessage $errorMsg -errorCategory InvalidArgument - } - -#endregion Input Validation - - if($PSBoundParameters.ContainsKey('Debug')){ $null = $PSBoundParameters.Remove('Debug')} - if($PSBoundParameters.ContainsKey('AddressFamily')) {$null = $PSBoundParameters.Remove('AddressFamily')} - - Validate-ResourceProperties @PSBoundParameters - -} - -function Validate-ResourceProperties -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory)] - [String]$Name, - - [parameter(Mandatory)] - [String]$IPStartRange, - - [parameter(Mandatory)] - [String]$IPEndRange, - - [parameter(Mandatory)] - [String]$SubnetMask, - - [Parameter()] [ValidateNotNullOrEmpty()] - [String]$LeaseDuration, - - [ValidateSet('Active','Inactive')] - [String]$State = 'Active', - - [ValidateSet('Present','Absent')] - [String]$Ensure = 'Present', - - [Switch]$Apply - ) - - # Convert the Lease duration to be a valid timespan - if($LeaseDuration) - { - $LeaseDuration = (Get-ValidTimeSpan -tsString $LeaseDuration -parameterName 'Leaseduration').ToString() - } - - $checkScopeMessage = $LocalizedData.CheckScopeMessage - Write-Verbose -Message $checkScopeMessage - - $dhcpScope = Get-DhcpServerv4Scope | Where-Object {($_.StartRange -eq $IPStartRange) -and ($_.EndRange -eq $IPEndRange)} - # Initialize the parameter collection - if($Apply) - { - $parameters = @{} - } - - # dhcpScope is set - if($dhcpScope) - { - $TestScopeMessage = $($LocalizedData.TestScopeMessage) -f 'present', $Ensure - Write-Verbose -Message $TestScopeMessage - - # if it should be present, test individual properties to match parameter values - if($Ensure -eq 'Present') - { - #region Test the Scope Name - $checkPropertyMsg = $($LocalizedData.CheckPropertyMessage) -f 'name' - Write-Verbose -Message $checkPropertyMsg - - if($dhcpScope.Name -ne $Name) - { - $notDesiredPropertyMsg = $($LocalizedData.NotDesiredPropertyMessage) -f 'name',$Name,$($dhcpScope.Name) - Write-Verbose -Message $notDesiredPropertyMsg - - if($Apply) - { - $parameters['Name'] = $Name - } - else - { - return $false - } - } - else - { - $desiredPropertyMsg = $($LocalizedData.DesiredPropertyMessage) -f 'name' - Write-Verbose -Message $desiredPropertyMsg - } - #endregion scope name - - #region Test the Lease duration - if($PSBoundParameters.ContainsKey('LeaseDuration')) - { - $checkPropertyMsg = $($LocalizedData.CheckPropertyMessage) -f 'lease duration' - Write-Verbose -Message $checkPropertyMsg - - if($dhcpScope.LeaseDuration -ne $LeaseDuration) - { - $notDesiredPropertyMsg = $($LocalizedData.NotDesiredPropertyMessage) -f 'lease duration',$LeaseDuration,$($dhcpScope.LeaseDuration) - Write-Verbose -Message $notDesiredPropertyMsg - - if($Apply) - { - $parameters['LeaseDuration'] = $LeaseDuration - } - else - { - return $false - } - } - else - { - $desiredPropertyMsg = $($LocalizedData.DesiredPropertyMessage) -f 'lease duration' - Write-Verbose -Message $desiredPropertyMsg - } - } - #endregion lease duration - - #region Test the Scope State - if($PSBoundParameters.ContainsKey('State')) - { - $checkPropertyMsg = $($LocalizedData.CheckPropertyMessage) -f 'state' - Write-Verbose -Message $checkPropertyMsg - - if($dhcpScope.State -ne $State) - { - $notDesiredPropertyMsg = $($LocalizedData.NotDesiredPropertyMessage) -f 'state',$State,$($dhcpScope.State) - Write-Verbose -Message $notDesiredPropertyMsg - - if($Apply) - { - $parameters['State'] = $State - } - else - { - return $false - } - } - else - { - $desiredPropertyMsg = $($LocalizedData.DesiredPropertyMessage) -f 'state' - Write-Verbose -Message $desiredPropertyMsg - } - } - #endregion scope state - - #region Test the Subnet Mask - $checkPropertyMsg = $($LocalizedData.CheckPropertyMessage) -f 'subnet mask' - Write-Verbose -Message $checkPropertyMsg - - if($dhcpScope.SubnetMask -ne $SubnetMask) - { - $notDesiredPropertyMsg = $($LocalizedData.NotDesiredPropertyMessage) -f 'subnet mask',$SubnetMask,$($dhcpScope.SubnetMask) - Write-Verbose -Message $notDesiredPropertyMsg - - if($Apply) - { - try - { - # To set the subnet mask scope, the only ways is to remove the old scope and add a new scope - Remove-DhcpServerv4Scope -ScopeId $dhcpScope.ScopeId - ## We can't splat two hashtables and $parameters may be empty, so just clone the existing one - $addDhcpServerv4ScopeParams = $parameters.Clone(); - $addDhcpServerv4ScopeParams['Type'] = 'Dhcp'; - $addDhcpServerv4ScopeParams['StartRange'] = $IPStartRange; - $addDhcpServerv4ScopeParams['EndRange'] = $IPEndRange; - $addDhcpServerv4ScopeParams['Name'] = $Name; - $addDhcpServerv4ScopeParams['SubnetMask'] = $SubnetMask; - Add-DhcpServerv4Scope @addDhcpServerv4ScopeParams; - } - catch - { - New-TerminatingError -errorId DhcpServerScopeFailure -errorMessage $_.Exception.Message -errorCategory InvalidOperation - } - - $setPropertyMsg = $($LocalizedData.SetPropertyMessage) -f 'subnet mask',$SubnetMask - Write-Verbose -Message $setPropertyMsg - } - else - { - return $false - } - } - else - { - $desiredPropertyMsg = $($LocalizedData.DesiredPropertyMessage) -f 'subnet mask' - Write-Verbose -Message $desiredPropertyMsg - } - #endregion subnet mask - - if($Apply) - { - # If parameters contains more than 0 key, set the DhcpServer scope - if($parameters.Count -gt 0) - { - Set-DhcpServerv4Scope @parameters -ScopeId $dhcpScope.ScopeId - Write-PropertyMessage -Parameters $parameters -keysToSkip ScopeId ` - -Message $($LocalizedData.SetPropertyMessage) -Verbose - } - } # end Apply - else - { - return $true - } - } # end ensure eq present - - # If dhcpscope should be absent - else - { - if($Apply) - { - $removingScopeMsg = $LocalizedData.RemovingScopeMessage - Write-Verbose -Message $removingScopeMsg - - # Remove the scope - Remove-DhcpServerv4Scope -ScopeId $dhcpScope.ScopeId - - $deleteScopeMsg = $LocalizedData.deleteScopeMessage - Write-Verbose -Message $deleteScopeMsg - } - else - { - return $false - } - }# end ensure -eq 'Absent' - } # if $dhcpScope - - #If dhcpScope is not set, create it if needed - else - { - $TestScopeMessage = $($LocalizedData.TestScopeMessage) -f 'absent', $Ensure - Write-Verbose -Message $TestScopeMessage - - if($Ensure -eq 'Present') - { - if($Apply) - { - # Add mandatory parameters - $parameters['Name'] = $Name - $parameters['StartRange'] = $IPStartRange - $parameters['EndRange'] = $IPEndRange - $parameters['SubnetMask'] = $SubnetMask - - # Check if Lease duration is specified, add to parameter collection - if($PSBoundParameters.ContainsKey('LeaseDuration')) - { - $parameters['LeaseDuration'] = $LeaseDuration - } - - # Check if State is specified, add to parameter collection - if($PSBoundParameters.ContainsKey('State')) - { - $parameters['State'] = $State - } - - $addingScopeMessage = $LocalizedData.AddingScopeMessage - Write-Verbose -Message $addingScopeMessage - - try - { - # Create a new scope with specified properties - Add-DhcpServerv4Scope @parameters -Type dhcp - - $setScopeMessage = $($LocalizedData.SetScopeMessage) -f $Name - Write-Verbose -Message $setScopeMessage - } - catch - { - New-TerminatingError -errorId DhcpServerScopeFailure -errorMessage $_.Exception.Message -errorCategory InvalidOperation - } - }# end Apply - else - { - return $false - } - } # end Ensure -eq Present - else - { - return $true - } - } # else !dhcpscope -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerScope/MSFT_xDhcpServerScope.schema.mof b/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerScope/MSFT_xDhcpServerScope.schema.mof deleted file mode 100644 index 45c66aab..00000000 --- a/lib/puppet_x/dsc_resources/xDhcpServer/DSCResources/MSFT_xDhcpServerScope/MSFT_xDhcpServerScope.schema.mof +++ /dev/null @@ -1,14 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xDhcpServerScope")] -class MSFT_xDhcpServerScope : OMI_BaseResource -{ - [Key, Description("Starting address to set for this scope")] String IPStartRange; - [Key, Description("Ending address to set for this scope")] String IPEndRange; - [Required, Description("Name of DHCP Scope")] String Name; - [Required, Description("Subnet mask for the scope specified in IP address format")] String SubnetMask; - [Write, Description("Time interval for which an IP address should be leased")] String LeaseDuration; - [Write, Description("Whether scope should be active or inactive"), ValueMap{"Active","Inactive"}, Values{"Active","Inactive"}] String State; - [Write, Description("Address family type"), ValueMap{"IPv4"}, Values{"IPv4"}] String AddressFamily; - [Write, Description("Whether scope should be set or removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Read, Description("ScopeId for the given scope")] String ScopeID; -}; - diff --git a/lib/puppet_x/dsc_resources/xDhcpServer/LICENSE b/lib/puppet_x/dsc_resources/xDhcpServer/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xDhcpServer/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xDhcpServer/Misc/New-DhcpServerOptionResource.ps1 b/lib/puppet_x/dsc_resources/xDhcpServer/Misc/New-DhcpServerOptionResource.ps1 deleted file mode 100644 index 678623c5..00000000 --- a/lib/puppet_x/dsc_resources/xDhcpServer/Misc/New-DhcpServerOptionResource.ps1 +++ /dev/null @@ -1,17 +0,0 @@ -$Properties = @{ - DnsServer = New-xDscResourceProperty -Name DnsServerIPAddress -Type String[] -Attribute Required ` - -Description 'IP address of DNS Servers' - Router = New-xDscResourceProperty -Name Router -Type String[] -Attribute Required ` - -Description 'IP address of the router/default gateway.' - DnsDomain = New-xDscResourceProperty -Name DnsDomain -Type String -Attribute Write ` - -Description 'Domain name of DNS Server' - AddressFamily = New-xDscResourceProperty -Name AddressFamily -Type String -Attribute Write ` - -ValidateSet 'IPv4' -Description 'Address family type' - ScopeID = New-xDscResourceProperty -Name ScopeID -Type String -Attribute Key ` - -Description 'ScopeId for which options are set' - Ensure = New-xDscResourceProperty -Name Ensure -Type String -Attribute Write ` - -ValidateSet 'Present','Absent' ` - -Description 'Whether option should be set or removed' -} - -New-xDscResource -Name MSFT_xDhcpServerOption -Property $Properties.Values -ModuleName xDhcpServer -FriendlyName xDhcpServerOption diff --git a/lib/puppet_x/dsc_resources/xDhcpServer/Misc/New-DhcpServerReservationResource.ps1 b/lib/puppet_x/dsc_resources/xDhcpServer/Misc/New-DhcpServerReservationResource.ps1 deleted file mode 100644 index dd0850ce..00000000 --- a/lib/puppet_x/dsc_resources/xDhcpServer/Misc/New-DhcpServerReservationResource.ps1 +++ /dev/null @@ -1,17 +0,0 @@ -$Properties = @{ - ScopeID = New-xDscResourceProperty -Name ScopeID -Type String -Attribute Key ` - -Description 'ScopeId for which reservations are set' - IPAddress = New-xDscResourceProperty -Name IPAddress -Type String -Attribute Required ` - -Description 'IP address of the reservation for which the properties are modified' - ClientMACAddress = New-xDscResourceProperty -Name ClientMACAddress -Type String -Attribute Required ` - -Description 'Client ID to set on the reservation For Windows clients it is the MAC address' - Name = New-xDscResourceProperty -Name Name -Type String -Attribute Write ` - -Description 'Reservation name' - AddressFamily = New-xDscResourceProperty -Name AddressFamily -Type String -Attribute Write ` - -ValidateSet 'IPv4' -Description 'Address family type' - Ensure = New-xDscResourceProperty -Name Ensure -Type String -Attribute Write ` - -ValidateSet 'Present','Absent' ` - -Description 'Whether option should be set or removed' -} - -New-xDscResource -Name MSFT_xDhcpServerReservation -Property $Properties.Values -ModuleName xDhcpServer -FriendlyName xDhcpServerReservation diff --git a/lib/puppet_x/dsc_resources/xDhcpServer/Misc/New-DhcpServerScopeResource.ps1 b/lib/puppet_x/dsc_resources/xDhcpServer/Misc/New-DhcpServerScopeResource.ps1 deleted file mode 100644 index a2eadb00..00000000 --- a/lib/puppet_x/dsc_resources/xDhcpServer/Misc/New-DhcpServerScopeResource.ps1 +++ /dev/null @@ -1,24 +0,0 @@ -$Properties = @{ - ScopeID = New-xDscResourceProperty -Name ScopeID -Type String -Attribute Read ` - -Description 'ScopeId for which properties are set' - Name = New-xDscResourceProperty -Name Name -Type String -Attribute Required ` - -Description 'Name of DHCP Scope' - AddressFamily = New-xDscResourceProperty -Name AddressFamily -Type String -Attribute Write ` - -ValidateSet 'IPv4' -Description 'Address family type' - IPStartRange = New-xDscResourceProperty -Name IPStartRange -Type String -Attribute Key ` - -Description 'Starting address to set for this scope' - IPEndRange = New-xDscResourceProperty -Name IPEndRange -Type String -Attribute Key ` - -Description 'Ending address to set for this scope' - SubnetMask = New-xDscResourceProperty -Name SubnetMask -Type String -Attribute Write ` - -Description 'Subnet mask for the scope specified in IP address format' - LeaseDuration = New-xDscResourceProperty -Name LeaseDuration -Type String -Attribute Write ` - -Description 'Time interval for which an IP address should be leased' - State = New-xDscResourceProperty -Name State -Type String -Attribute Write ` - -ValidateSet 'Active','Inactive' ` - -Description 'Whether scope should be active or inactive' - Ensure = New-xDscResourceProperty -Name Ensure -Type String -Attribute Write ` - -ValidateSet 'Present','Absent' ` - -Description 'Whether scope should be set or removed' -} - -New-xDscResource -Name MSFT_xDhcpServerScope -Property $Properties.Values -ModuleName xDhcpServer -FriendlyName xDhcpServerScope diff --git a/lib/puppet_x/dsc_resources/xDhcpServer/xDhcpServer.psd1 b/lib/puppet_x/dsc_resources/xDhcpServer/xDhcpServer.psd1 deleted file mode 100644 index 47f8982a..00000000 --- a/lib/puppet_x/dsc_resources/xDhcpServer/xDhcpServer.psd1 +++ /dev/null @@ -1,63 +0,0 @@ -@{ -# Version number of this module. -ModuleVersion = '1.6.0.0' - -# ID used to uniquely identify this module -GUID = '286890c9-a6c3-4605-9cd5-03c8413c8325' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'Module with DSC Resources for DHCP Server area' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Minimum version of the common language runtime (CLR) required by this module -# CLRVersion = '4.0' - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/xDhcpServer/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/xDhcpServer' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - ReleaseNotes = 'added xDhcpServerClass - - -' - - } # End of PSData hashtable - -} # End of PrivateData hashtable -} - - - - - diff --git a/lib/puppet_x/dsc_resources/xDismFeature/DSCResources/MSFT_xDismFeature/MSFT_xDismFeature.psm1 b/lib/puppet_x/dsc_resources/xDismFeature/DSCResources/MSFT_xDismFeature/MSFT_xDismFeature.psm1 deleted file mode 100644 index fcca07bf..00000000 --- a/lib/puppet_x/dsc_resources/xDismFeature/DSCResources/MSFT_xDismFeature/MSFT_xDismFeature.psm1 +++ /dev/null @@ -1,135 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name - ) - - $DismFeatures = Get-DismFeatures - - if($DismFeatures."$Name" -eq $null) - { - Throw "Unknown feature!" - } - - if($DismFeatures."$Name" -eq "Enabled") - { - $returnValue = @{ - Ensure = "Present" - Name = $Name - } - } - else - { - $returnValue = @{ - Ensure = "Absent" - Name = $Name - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $Source - ) - - switch($Ensure) - { - "Present" - { - $dismParameters = @("/Online", "/Enable-Feature", "/FeatureName:$Name", "/Quiet", "/NoRestart") - - # Include sources directory if present - if ($Source) - { - Write-Verbose "Source location set: ${Source}" - - $dismParameters += "/Source:${Source}" - $dismParameters += "/LimitAccess" - } - - & dism.exe $dismParameters - } - "Absent" - { - & dism.exe /Online /Disable-Feature /FeatureName:$Name /quiet /norestart - } - } - - if(Test-Path -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending') - { - $global:DSCMachineStatus = 1 - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $Source = $null - ) - - $result = ((Get-TargetResource -Name $Name).Ensure -eq $Ensure) - - $result -} - - -function Get-DismFeatures -{ - $DismGetFeatures = & dism.exe /Online /Get-Features - $DismFeatures = @{} - foreach($Line in $DismGetFeatures) - { - switch($Line.Split(":")[0].Trim()) - { - "Feature Name" - { - $FeatureName = $Line.Split(":")[1].Trim() - } - "State" - { - $DismFeatures += @{$FeatureName = $Line.Split(":")[1].Trim()} - } - } - } - - $DismFeatures -} - - -Export-ModuleMember -Function *-TargetResource - diff --git a/lib/puppet_x/dsc_resources/xDismFeature/DSCResources/MSFT_xDismFeature/MSFT_xDismFeature.schema.mof b/lib/puppet_x/dsc_resources/xDismFeature/DSCResources/MSFT_xDismFeature/MSFT_xDismFeature.schema.mof deleted file mode 100644 index 1e3ce0e3..00000000 --- a/lib/puppet_x/dsc_resources/xDismFeature/DSCResources/MSFT_xDismFeature/MSFT_xDismFeature.schema.mof +++ /dev/null @@ -1,7 +0,0 @@ -[ClassVersion("1.1.0.0"), FriendlyName("xDismFeature")] -class MSFT_xDismFeature : OMI_BaseResource -{ - [Write, Description("An enumerated value that describes if the feature is expected to be enabled on the machine.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Key, Description("Name of the feature.")] String Name; - [Write, Description("Optional location of Source.")] String Source; -}; diff --git a/lib/puppet_x/dsc_resources/xDismFeature/LICENSE b/lib/puppet_x/dsc_resources/xDismFeature/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xDismFeature/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xDismFeature/xDismFeature.psd1 b/lib/puppet_x/dsc_resources/xDismFeature/xDismFeature.psd1 deleted file mode 100644 index d1d99a0a..00000000 --- a/lib/puppet_x/dsc_resources/xDismFeature/xDismFeature.psd1 +++ /dev/null @@ -1,60 +0,0 @@ -@{ -# Version number of this module. -ModuleVersion = '1.2.0.0' - -# ID used to uniquely identify this module -GUID = '55f4b4c2-eec6-412c-823b-9d6d549a25dc' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'Module with DSC Resources for Deployment Image Servicing and Management features.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Minimum version of the common language runtime (CLR) required by this module -CLRVersion = '4.0' - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/xDismFeature/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/xDismFeature' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - ReleaseNotes = '* xDismFeature: Resource no longer includes the Source parameter when it is not specified -* Converted appveyor.yml to install Pester from PSGallery instead of from Chocolatey. - -' - - } # End of PSData hashtable - -} # End of PrivateData hashtable -} - - diff --git a/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/Helper.psm1 b/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/Helper.psm1 deleted file mode 100644 index e0b96b98..00000000 --- a/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/Helper.psm1 +++ /dev/null @@ -1,45 +0,0 @@ -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData @' -RoleNotFound = Please ensure that the PowerShell module for role {0} is installed -'@ -} - -# Internal function to throw terminating error with specified errroCategory, errorId and errorMessage -function New-TerminatingError -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory)] - [String]$errorId, - - [Parameter(Mandatory)] - [String]$errorMessage, - - [Parameter(Mandatory)] - [System.Management.Automation.ErrorCategory]$errorCategory - ) - - $exception = New-Object System.InvalidOperationException $errorMessage - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - throw $errorRecord -} - -# Internal function to assert if the role specific module is installed or not -function Assert-Module -{ - [CmdletBinding()] - param - ( - [string]$moduleName = 'DnsServer' - ) - - if(! (Get-Module -Name $moduleName -ListAvailable)) - { - $errorMsg = $($LocalizedData.RoleNotFound) -f $moduleName - New-TerminatingError -errorId 'ModuleNotFound' -errorMessage $errorMsg -errorCategory ObjectNotFound - } -} diff --git a/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsARecord/MSFT_xDnsARecord.psm1 b/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsARecord/MSFT_xDnsARecord.psm1 deleted file mode 100644 index 0267c935..00000000 --- a/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsARecord/MSFT_xDnsARecord.psm1 +++ /dev/null @@ -1,108 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $Zone, - - [parameter(Mandatory = $true)] - [System.String] - $Target, - - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present' - ) - Write-Warning -Message "DSC Resource xDnsARecord has been replaced by xDNSRecord, and will be removed in a future version" - Write-Verbose "Looking up DNS record for $Name in $Zone" - $record = Get-DnsServerResourceRecord -ZoneName $Zone -Name $Name -ErrorAction SilentlyContinue - if ($record -eq $null) { - return @{ - Name = $Name; - Zone = $Zone; - Target = $Target; - Ensure = 'Absent'; - } - } - else { - return @{ - Name = $record.HostName; - Zone = $Zone; - Target = $record.RecordData.IPv4Address.ToString(); - Ensure = 'Present'; - } - } -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $Zone, - - [parameter(Mandatory = $true)] - [System.String] - $Target, - - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present' - ) - if ($Ensure -eq 'Present') { - Write-Verbose "Creating for DNS $Target in $Zone" - Add-DnsServerResourceRecordA -IPv4Address $Target -Name $Name -ZoneName $Zone - } - elseif ($Ensure -eq 'Absent') { - Write-Verbose "Removing DNS $Target in $Zone" - Remove-DnsServerResourceRecord -Name $Name -ZoneName $Zone -RRType A - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $Zone, - - [parameter(Mandatory = $true)] - [System.String] - $Target, - - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present' - ) - - Write-Verbose "Testing for DNS $Name in $Zone" - $result = @(Get-TargetResource @PSBoundParameters) - if ($Ensure -ne $result.Ensure) { return $false } - elseif ($Ensure -eq 'Present' -and ($result.Target -ne $Target)) { return $false } - return $true -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsARecord/MSFT_xDnsARecord.schema.mof b/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsARecord/MSFT_xDnsARecord.schema.mof deleted file mode 100644 index 8e141c0c..00000000 --- a/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsARecord/MSFT_xDnsARecord.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xDnsARecord")] -class MSFT_xDnsARecord : OMI_BaseResource -{ - [Key] string Name; - [Key] string Zone; - [Required] string Target; - [Write, Description("Should this DNS resource record be present or absent"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; -}; - diff --git a/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsRecord/MSFT_xDnsRecord.psm1 b/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsRecord/MSFT_xDnsRecord.psm1 deleted file mode 100644 index 24e1bb24..00000000 --- a/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsRecord/MSFT_xDnsRecord.psm1 +++ /dev/null @@ -1,190 +0,0 @@ -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData @' - GettingDnsRecordMessage = Getting DNS record '{0}' ({1}) in zone '{2}'. - CreatingDnsRecordMessage = Creating DNS record '{0}' for target '{1}' in zone '{2}'. - RemovingDnsRecordMessage = Removing DNS record '{0}' for target '{1}' in zone '{2}'. - NotDesiredPropertyMessage = DNS record property '{0}' is not correct. Expected '{1}', actual '{2}' - InDesiredStateMessage = DNS record '{0}' is in the desired state. - NotInDesiredStateMessage = DNS record '{0}' is NOT in the desired state. -'@ -} - - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $Zone, - - [parameter(Mandatory = $true)] - [ValidateSet("ARecord", "CName")] - [System.String] - $Type, - - [parameter(Mandatory = $true)] - [System.String] - $Target, - - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present' - ) - - Write-Verbose -Message ($LocalizedData.GettingDnsRecordMessage -f $Name, $Type, $Zone) - $record = Get-DnsServerResourceRecord -ZoneName $Zone -Name $Name -ErrorAction SilentlyContinue - - if ($record -eq $null) - { - return @{ - Name = $Name.HostName; - Zone = $Zone; - Target = $Target; - Ensure = 'Absent'; - } - } - if ($Type -eq "CName") - { - $recordData = ($record.RecordData.hostnamealias).TrimEnd('.') - } - if ($Type -eq "ARecord") - { - $recordData = $record.RecordData.IPv4address.IPAddressToString - } - - return @{ - Name = $record.HostName; - Zone = $Zone; - Target = $recordData; - Ensure = 'Present'; - } -} #end function Get-TargetResource - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $Zone, - - [parameter(Mandatory = $true)] - [ValidateSet("ARecord", "CName")] - [System.String] - $Type, - - [parameter(Mandatory = $true)] - [System.String] - $Target, - - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present' - ) - - $DNSParameters = @{ Name = $Name; ZoneName = $Zone; } - - if ($Ensure -eq 'Present') - { - if ($Type -eq "ARecord") - { - $DNSParameters.Add('A',$true) - $DNSParameters.Add('IPv4Address',$target) - } - if ($Type -eq "CName") - { - $DNSParameters.Add('CName',$true) - $DNSParameters.Add('HostNameAlias',$Target) - } - Write-Verbose -Message ($LocalizedData.CreatingDnsRecordMessage -f $Type, $Target, $Zone) - Add-DnsServerResourceRecord @DNSParameters - } - elseif ($Ensure -eq 'Absent') - { - - $DNSParameters.Add('Computername','localhost') - $DNSParameters.Add('Force',$true) - - if ($Type -eq "ARecord") - { - $DNSParameters.Add('RRType','A') - } - if ($Type -eq "CName") - { - $DNSParameters.Add('RRType','CName') - } - Write-Verbose -Message ($LocalizedData.RemovingDnsRecordMessage -f $Type, $Target, $Zone) - Remove-DnsServerResourceRecord @DNSParameters - } -} #end function Set-TargetResource - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $Zone, - - [parameter(Mandatory = $true)] - [ValidateSet("ARecord", "CName")] - [System.String] - $Type, - - [parameter(Mandatory = $true)] - [System.String] - $Target, - - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present' - ) - - $result = @(Get-TargetResource @PSBoundParameters) - if ($Ensure -ne $result.Ensure) - { - Write-Verbose -Message ($LocalizedData.NotDesiredPropertyMessage -f 'Ensure', $Ensure, $result.Ensure) - Write-Verbose -Message ($LocalizedData.NotInDesiredStateMessage -f $Name) - return $false - } - elseif ($Ensure -eq 'Present') - { - if ($result.Target -notcontains $Target) - { - $resultTargetString = $result.Target - if ($resultTargetString -is [System.Array]) - { - ## We have an array, create a single string for verbose output - $resultTargetString = $result.Target -join ',' - } - Write-Verbose -Message ($LocalizedData.NotDesiredPropertyMessage -f 'Target', $Target, $resultTargetString) - Write-Verbose -Message ($LocalizedData.NotInDesiredStateMessage -f $Name) - return $false - } - } - Write-Verbose -Message ($LocalizedData.InDesiredStateMessage -f $Name) - return $true -} #end function Test-TargetResource - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsRecord/MSFT_xDnsRecord.schema.mof b/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsRecord/MSFT_xDnsRecord.schema.mof deleted file mode 100644 index aef202aa..00000000 --- a/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsRecord/MSFT_xDnsRecord.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xDnsRecord")] -class MSFT_xDnsRecord : OMI_BaseResource -{ - [Key] string Name; - [Key] string Zone; - [Required, ValueMap{"ARecord","CName"}, Values{"ARecord","CName"}] string Type; - [Key] string Target; - [Write, Description("Should this DNS resource record be present or absent"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; -}; - diff --git a/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerADZone/Helper.psm1 b/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerADZone/Helper.psm1 deleted file mode 100644 index e0b96b98..00000000 --- a/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerADZone/Helper.psm1 +++ /dev/null @@ -1,45 +0,0 @@ -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData @' -RoleNotFound = Please ensure that the PowerShell module for role {0} is installed -'@ -} - -# Internal function to throw terminating error with specified errroCategory, errorId and errorMessage -function New-TerminatingError -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory)] - [String]$errorId, - - [Parameter(Mandatory)] - [String]$errorMessage, - - [Parameter(Mandatory)] - [System.Management.Automation.ErrorCategory]$errorCategory - ) - - $exception = New-Object System.InvalidOperationException $errorMessage - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - throw $errorRecord -} - -# Internal function to assert if the role specific module is installed or not -function Assert-Module -{ - [CmdletBinding()] - param - ( - [string]$moduleName = 'DnsServer' - ) - - if(! (Get-Module -Name $moduleName -ListAvailable)) - { - $errorMsg = $($LocalizedData.RoleNotFound) -f $moduleName - New-TerminatingError -errorId 'ModuleNotFound' -errorMessage $errorMsg -errorCategory ObjectNotFound - } -} diff --git a/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerADZone/MSFT_xDnsServerADZone.psm1 b/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerADZone/MSFT_xDnsServerADZone.psm1 deleted file mode 100644 index 859b1671..00000000 --- a/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerADZone/MSFT_xDnsServerADZone.psm1 +++ /dev/null @@ -1,221 +0,0 @@ -Import-Module $PSScriptRoot\Helper.psm1 -Verbose:$false - -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData @' -CheckingZoneMessage = Checking DNS server zone with name '{0}' is '{1}'... -AddingZoneMessage = Adding DNS server zone '{0}' ... -RemovingZoneMessage = Removing DNS server zone '{0}' ... - -CheckPropertyMessage = Checking DNS server zone property '{0}' ... -NotDesiredPropertyMessage = DNS server zone property '{0}' is not correct. Expected '{1}', actual '{2}' -SetPropertyMessage = DNS server zone property '{0}' is set -'@ -} - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [System.String]$Name, - - [ValidateSet('None','NonsecureAndSecure','Secure')] - [System.String]$DynamicUpdate = 'Secure', - - [Parameter(Mandatory)] - [ValidateSet('Custom','Domain','Forest','Legacy')] - [System.String]$ReplicationScope, - - [System.String]$DirectoryPartitionName, - - [System.String]$ComputerName, - - [pscredential]$Credential, - - [ValidateSet('Present','Absent')] - [System.String]$Ensure = 'Present' - ) - Assert-Module -ModuleName 'DNSServer' - Write-Verbose ($LocalizedData.CheckingZoneMessage -f $Name, $Ensure) - $cimSessionParams = @{ErrorAction = 'SilentlyContinue'} - if ($ComputerName) - { - $cimSessionParams += @{ComputerName = $ComputerName} - } - else - { - $cimSessionParams += @{ComputerName = $env:COMPUTERNAME} - } - if ($Credential) - { - $cimSessionParams += @{Credential = $Credential} - } - $cimSession = New-CimSession @cimSessionParams - $getParams = @{ - Name = $Name - CimSession = $cimSession - ErrorAction = 'SilentlyContinue' - } - $dnsServerZone = Get-DnsServerZone @getParams - $targetResource = @{ - Name = $dnsServerZone.ZoneName - DynamicUpdate = $dnsServerZone.DynamicUpdate - ReplicationScope = $dnsServerZone.ReplicationScope - DirectoryPartitionName = $dnsServerZone.DirectoryPartitionName - Ensure = if ($dnsServerZone -eq $null) { 'Absent' } else { 'Present' } - } - return $targetResource -} #end function Get-TargetResource - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [System.String]$Name, - - [ValidateSet('None','NonsecureAndSecure','Secure')] - [System.String]$DynamicUpdate = 'Secure', - - [Parameter(Mandatory)] - [ValidateSet('Custom','Domain','Forest','Legacy')] - [System.String]$ReplicationScope, - - [System.String]$DirectoryPartitionName, - - [System.String]$ComputerName, - - [pscredential]$Credential, - - [ValidateSet('Present','Absent')] - [System.String]$Ensure = 'Present' - ) - $targetResource = Get-TargetResource @PSBoundParameters - $targetResourceInCompliance = $true - if ($Ensure -eq 'Present') - { - if ($targetResource.Ensure -eq 'Present') - { - if ($targetResource.DynamicUpdate -ne $DynamicUpdate) - { - Write-Verbose ($LocalizedData.NotDesiredPropertyMessage -f 'DynamicUpdate', $DynamicUpdate, $targetResource.DynamicUpdate) - $targetResourceInCompliance = $false - } - if ($targetResource.ReplicationScope -ne $ReplicationScope) - { - Write-Verbose ($LocalizedData.NotDesiredPropertyMessage -f 'ReplicationScope', $ReplicationScope, $targetResource.ReplicationScope) - $targetResourceInCompliance = $false - } - if ($DirectoryPartitionName -and $targetResource.DirectoryPartitionName -ne $DirectoryPartitionName) - { - Write-Verbose ($LocalizedData.NotDesiredPropertyMessage -f 'DirectoryPartitionName', $DirectoryPartitionName, $targetResource.DirectoryPartitionName) - $targetResourceInCompliance = $false - } - } - else - { - # Dns zone is present and needs removing - Write-Verbose ($LocalizedData.NotDesiredPropertyMessage -f 'Ensure', 'Present', 'Absent') - $targetResourceInCompliance = $false - } - } - else - { - if ($targetResource.Ensure -eq 'Present') - { - ## Dns zone is absent and should be present - Write-Verbose ($LocalizedData.NotDesiredPropertyMessage -f 'Ensure', 'Absent', 'Present') - $targetResourceInCompliance = $false - } - } - return $targetResourceInCompliance -} #end function Test-TargetResource - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [System.String]$Name, - - [ValidateSet('None','NonsecureAndSecure','Secure')] - [System.String]$DynamicUpdate = 'Secure', - - [Parameter(Mandatory)] - [ValidateSet('Custom','Domain','Forest','Legacy')] - [System.String]$ReplicationScope, - - [System.String]$DirectoryPartitionName, - - [System.String]$ComputerName, - - [pscredential]$Credential, - - [ValidateSet('Present','Absent')] - [System.String]$Ensure = 'Present' - ) - Assert-Module -ModuleName 'DNSServer' - $targetResource = Get-TargetResource @PSBoundParameters - if ($Ensure -eq 'Present') - { - if ($targetResource.Ensure -eq 'Present') - { - ## Update the existing zone - $updateParams = @{ - Name = $targetResource.Name - CimSession = $targetResource.CimSession - } - if ($targetResource.DynamicUpdate -ne $DynamicUpdate) - { - $updateParams += @{DynamicUpdate = $DynamicUpdate} - Write-Verbose ($LocalizedData.SetPropertyMessage -f 'DynamicUpdate') - } - if ($targetResource.ReplicationScope -ne $ReplicationScope) - { - $updateParams += @{ReplicationScope = $ReplicationScope} - Write-Verbose ($LocalizedData.SetPropertyMessage -f 'ReplicationScope') - } - if ($DirectoryPartitionName -and $targetResource.DirectoryPartitionName -ne $DirectoryPartitionName) - { - $updateParams += @{DirectoryPartitionName = $DirectoryPartitionName} - Write-Verbose ($LocalizedData.SetPropertyMessage -f 'DirectoryPartitionName') - } - Set-DnsServerPrimaryZone @updateParams - } - elseif ($targetResource.Ensure -eq 'Absent') - { - ## Create the zone - Write-Verbose ($LocalizedData.AddingZoneMessage -f $targetResource.Name) - $addParams = @{ - Name = $Name - DynamicUpdate = $DynamicUpdate - ReplicationScope = $ReplicationScope - CimSession = $targetResource.CimSession - } - if ($DirectoryPartitionName) - { - $addParams += @{ - DirectoryPartitionName = $DirectoryPartitionName - } - } - Add-DnsServerPrimaryZone @addParams - } - } - elseif ($Ensure -eq 'Absent') - { - # Remove the DNS Server zone - Write-Verbose ($LocalizedData.RemovingZoneMessage -f $targetResource.Name) - Remove-DnsServerZone -Name $targetResource.Name -ComputerName $ComputerName -Force - } -} #end function Set-TargetResource diff --git a/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerADZone/MSFT_xDnsServerADZone.schema.mof b/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerADZone/MSFT_xDnsServerADZone.schema.mof deleted file mode 100644 index e5f68745..00000000 --- a/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerADZone/MSFT_xDnsServerADZone.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xDnsServerADZone")] -class MSFT_xDnsServerADZone : OMI_BaseResource -{ - [Key, Description("DNS Server zone name")] String Name; - [Write, Description("Dynamic zone update option"), ValueMap{"None","NonsecureAndSecure","Secure"}, Values{"None","NonsecureAndSecure","Secure"}] String DynamicUpdate; - [Required, Description("Replication scope option"), ValueMap{"Custom","Domain","Forest","Legacy"}, Values{"Custom","Domain","Forest","Legacy"}] String ReplicationScope; - [Write, Description("Directory partition name")] String DirectoryPartitionName; - [Write, Description("DNS Server name")] String ComputerName; - [Write, Description("Credential used to set zone"), EmbeddedInstance("MSFT_Credential")] String Credential; - [Write, Description("Whether the DNS zone should be available or removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; -}; diff --git a/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerForwarder/MSFT_xDnsServerForwarder.psm1 b/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerForwarder/MSFT_xDnsServerForwarder.psm1 deleted file mode 100644 index 636d6d87..00000000 --- a/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerForwarder/MSFT_xDnsServerForwarder.psm1 +++ /dev/null @@ -1,69 +0,0 @@ -function Get-TargetResource -{ - [OutputType([Hashtable])] - param - ( - [Parameter(Mandatory)] - [ValidateSet('Yes')] - [string]$IsSingleInstance, - [string[]]$IPAddresses - ) - Write-Verbose 'Getting current DNS forwarders.' - [array]$currentIPs = (Get-CimInstance -Namespace root\MicrosoftDNS -ClassName microsoftdns_server).Forwarders - $targetResource = @{ - IsSingleInstance = $IsSingleInstance - IPAddresses = @() - } - if ($currentIPs) - { - $targetResource.IPAddresses = $currentIPs - } - Write-Output $targetResource -} - -function Set-TargetResource -{ - param - ( - [Parameter(Mandatory)] - [ValidateSet('Yes')] - [string]$IsSingleInstance, - [string[]]$IPAddresses - ) - if (!$IPAddresses) - { - $IPAddresses = @() - } - Write-Verbose 'Setting DNS forwarders.' - $setParams = @{ - Namespace = 'root\MicrosoftDNS' - Query = 'select * from microsoftdns_server' - Property = @{Forwarders = $IPAddresses} - } - Set-CimInstance @setParams -} - -function Test-TargetResource -{ - [OutputType([Bool])] - param - ( - [Parameter(Mandatory)] - [ValidateSet('Yes')] - [string]$IsSingleInstance, - [string[]]$IPAddresses - ) - [array]$currentIPs = (Get-TargetResource @PSBoundParameters).IPAddresses - if ($currentIPs.Count -ne $IPAddresses.Count) - { - return $false - } - foreach ($ip in $IPAddresses) - { - if ($ip -notin $currentIPs) - { - return $false - } - } - return $true -} diff --git a/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerForwarder/MSFT_xDnsServerForwarder.schema.mof b/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerForwarder/MSFT_xDnsServerForwarder.schema.mof deleted file mode 100644 index 1afe74ba..00000000 --- a/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerForwarder/MSFT_xDnsServerForwarder.schema.mof +++ /dev/null @@ -1,6 +0,0 @@ -[ClassVersion("1.0.0"), FriendlyName("xDnsServerForwarder")] -class MSFT_xDnsServerForwarder : OMI_BaseResource -{ - [Key, Description("Specifies the resource is a single instance, the value must be 'Yes'"), ValueMap{"Yes"}, Values{"Yes"}] String IsSingleInstance; - [Write] String IPAddresses[]; -}; diff --git a/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerPrimaryZone/MSFT_xDnsServerPrimaryZone.psm1 b/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerPrimaryZone/MSFT_xDnsServerPrimaryZone.psm1 deleted file mode 100644 index e6c940a1..00000000 --- a/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerPrimaryZone/MSFT_xDnsServerPrimaryZone.psm1 +++ /dev/null @@ -1,164 +0,0 @@ -Import-Module $PSScriptRoot\..\Helper.psm1 -Verbose:$false - -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData @' -CheckingZoneMessage = Checking DNS server zone with name '{0}' is '{1}'... -AddingZoneMessage = Adding DNS server zone '{0}' ... -RemovingZoneMessage = Removing DNS server zone '{0}' ... - -CheckPropertyMessage = Checking DNS server zone property '{0}' ... -NotDesiredPropertyMessage = DNS server zone property '{0}' is not correct. Expected '{1}', actual '{2}' -SetPropertyMessage = DNS server zone property '{0}' is set -'@ -} - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [System.String]$Name, - - [ValidateNotNullOrEmpty()] - [System.String]$ZoneFile = "$Name.dns", - - [ValidateSet('None','NonsecureAndSecure')] - [System.String]$DynamicUpdate = 'None', - - [ValidateSet('Present','Absent')] - [System.String]$Ensure = 'Present' - ) - - Assert-Module -ModuleName 'DNSServer'; - Write-Verbose ($LocalizedData.CheckingZoneMessage -f $Name, $Ensure); - $dnsServerZone = Get-DnsServerZone -Name $Name -ErrorAction SilentlyContinue; - - $targetResource = @{ - Name = $dnsServerZone.Name; - ZoneFile = $dnsServerZone.ZoneFile; - DynamicUpdate = $dnsServerZone.DynamicUpdate; - Ensure = if ($dnsServerZone -eq $null) { 'Absent' } else { 'Present' }; - } - - return $targetResource; - -} #end function Get-TargetResource - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [System.String]$Name, - - [ValidateNotNullOrEmpty()] - [System.String]$ZoneFile = "$Name.dns", - - [ValidateSet('None','NonsecureAndSecure')] - [System.String]$DynamicUpdate = 'None', - - [ValidateSet('Present','Absent')] - [System.String]$Ensure = 'Present' - ) - - $targetResource = Get-TargetResource @PSBoundParameters; - $targetResourceInCompliance = $true; - - if ($Ensure -eq 'Present') - { - if ($targetResource.Ensure -eq 'Present') - { - if ($targetResource.ZoneFile -ne $ZoneFile) - { - Write-Verbose ($LocalizedData.NotDesiredPropertyMessage -f 'ZoneFile', $targetResource.ZoneFile, $ZoneFile); - $targetResourceInCompliance = $false; - } - elseif ($targetResource.DynamicUpdate -ne $DynamicUpdate) - { - Write-Verbose ($LocalizedData.NotDesiredPropertyMessage -f 'DynamicUpdate', $targetResource.DynamicUpdate, $DynamicUpdate); - $targetResourceInCompliance = $false; - } - } - else - { - # Dns zone is present and needs removing - Write-Verbose ($LocalizedData.NotDesiredPropertyMessage -f 'Ensure', 'Absent', 'Present'); - $targetResourceInCompliance = $false; - } - } - else - { - if ($targetResource.Ensure -eq 'Present') - { - ## Dns zone is absent and should be present - Write-Verbose ($LocalizedData.NotDesiredPropertyMessage -f 'Ensure', 'Absent', 'Present'); - $targetResourceInCompliance = $false; - } - } - - return $targetResourceInCompliance; - -} #end function Test-TargetResource - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [System.String]$Name, - - [ValidateNotNullOrEmpty()] - [System.String]$ZoneFile = "$Name.dns", - - [ValidateSet('None','NonsecureAndSecure')] - [System.String]$DynamicUpdate = 'None', - - [ValidateSet('Present','Absent')] - [System.String]$Ensure = 'Present' - ) - - Assert-Module -ModuleName 'DNSServer'; - - if ($Ensure -eq 'Present') { - Write-Verbose ($LocalizedData.CheckingZoneMessage -f $Name, $Ensure); - $dnsServerZone = Get-DnsServerZone -Name $Name -ErrorAction SilentlyContinue; - if ($dnsServerZone) - { - ## Update the existing zone - if ($dnsServerZone.ZoneFile -ne $ZoneFile) - { - $dnsServerZone | Set-DnsServerPrimaryZone -ZoneFile $ZoneFile; - Write-Verbose ($LocalizedData.SetPropertyMessage -f 'ZoneFile'); - } - if ($dnsServerZone.DynamicUpdate -ne $DynamicUpdate) - { - $dnsServerZone | Set-DnsServerPrimaryZone -DynamicUpdate $DynamicUpdate; - Write-Verbose ($LocalizedData.SetPropertyMessage -f 'DynamicUpdate'); - } - } - elseif (-not $dnsServerZone) - { - ## Create the zone - Write-Verbose ($LocalizedData.AddingZoneMessage -f $Name); - Add-DnsServerPrimaryZone -Name $Name -ZoneFile $ZoneFile -DynamicUpdate $DynamicUpdate; - } - } - elseif ($Ensure -eq 'Absent') - { - # Remove the DNS Server zone - Write-Verbose ($LocalizedData.RemovingZoneMessage -f $Name); - Get-DnsServerZone -Name $Name | Remove-DnsServerZone -Force; - } - -} #end function Set-TargetResource diff --git a/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerPrimaryZone/MSFT_xDnsServerPrimaryZone.schema.mof b/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerPrimaryZone/MSFT_xDnsServerPrimaryZone.schema.mof deleted file mode 100644 index a7dd56bc..00000000 --- a/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerPrimaryZone/MSFT_xDnsServerPrimaryZone.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xDnsServerPrimaryZone")] -class MSFT_xDnsServerPrimaryZone : OMI_BaseResource -{ - [Key, Description("DNS Server primary zone name")] String Name; - [Write, Description("DNS Server primary zone file")] String ZoneFile; - [Write, Description("Dynamic zone update option"), ValueMap{"None","NonsecureAndSecure"}, Values{"None","NonsecureAndSecure"}] String DynamicUpdate; - [Write, Description("Whether the DNS zone should be available or removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; -}; - - diff --git a/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerSecondaryZone/MSFT_xDnsServerSecondaryZone.psm1 b/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerSecondaryZone/MSFT_xDnsServerSecondaryZone.psm1 deleted file mode 100644 index c1d6ad7a..00000000 --- a/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerSecondaryZone/MSFT_xDnsServerSecondaryZone.psm1 +++ /dev/null @@ -1,271 +0,0 @@ -Import-Module $PSScriptRoot\..\Helper.psm1 -Verbose:$false - -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData @' -CheckingZoneMessage = Checking DNS server zone with name {0} ... -TestZoneMessage = Named DNS server zone is {0} and it should be {1} -RemovingZoneMessage = Removing DNS server zone ... -DeleteZoneMessage = DNS server zone {0} is now absent - -CheckingSecondaryZoneMessage = Checking if the DNS server zone is a secondary zone ... -AlreadySecondaryZoneMessage = DNS server zone {0} is already a secondary zone -NotSecondaryZoneMessage = DNS server zone {0} is not a secondary zone but {1} zone -AddingSecondaryZoneMessage = Adding secondary DNS server zone ... -NewSecondaryZoneMessage = DNS server secondary zone {0} is now present -SetSecondaryZoneMessage = DNS server zone {0} is now a secondary zone - -CheckPropertyMessage = Checking DNS secondary server {0} ... -NotDesiredPropertyMessage = DNS server secondary zone {0} is not correct. Expected {1}, actual {2} -DesiredPropertyMessage = DNS server secondary zone {0} is correct -SetPropertyMessage = DNS server secondary zone {0} is set -'@ -} - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory)] - [String]$Name, - - [parameter(Mandatory)] - [String[]]$MasterServers - ) - -#region Input Validation - - # Check for DnsServer module/role - Assert-Module -moduleName DnsServer - -#endregion - - $dnsZone = Get-DnsServerZone -Name $Name -ErrorAction SilentlyContinue - if($dnsZone) - { - $Ensure = 'Present' - } - else - { - $Ensure = 'Absent' - } - - @{ - Name = $Name - Ensure = $Ensure - MasterServers = [string[]]$($dnsZone.MasterServers.IPAddressToString) - Type = $dnsZone.ZoneType - } -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory)] - [String]$Name, - - [parameter(Mandatory)] - [String[]]$MasterServers, - - [ValidateSet("Present","Absent")] - [String]$Ensure = 'Present' - ) - - if($PSBoundParameters.ContainsKey('Debug')){$null = $PSBoundParameters.Remove('Debug')} - Validate-ResourceProperties @PSBoundParameters -Apply - - # Restart the DNS service - Restart-Service DNS -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory)] - [String]$Name, - - [parameter(Mandatory)] - [String[]]$MasterServers, - - [ValidateSet("Present","Absent")] - [String]$Ensure = 'Present' - ) - -#region Input Validation - - # Check for DnsServer module/role - Assert-Module -moduleName DnsServer - -#endregion - - if($PSBoundParameters.ContainsKey('Debug')){$null = $PSBoundParameters.Remove('Debug')} - Validate-ResourceProperties @PSBoundParameters - -} - -#region Helper Functions -function Validate-ResourceProperties -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory)] - [String]$Name, - - [parameter(Mandatory)] - [String[]]$MasterServers, - - [ValidateSet("Present","Absent")] - [String]$Ensure = 'Present', - - [Switch]$Apply - ) - - $zoneMessage = $($LocalizedData.CheckingZoneMessage) -f $Name - Write-Verbose -Message $zoneMessage - - $dnsZone = Get-DnsServerZone -Name $Name -ErrorAction SilentlyContinue - - # Found DNS Zone - if($dnsZone) - { - $testZoneMessage = $($LocalizedData.TestZoneMessage) -f 'present', $Ensure - Write-Verbose -Message $testZoneMessage - - # If the zone should be present - if($Ensure -eq 'Present') - { - # Check if the zone is secondary - $secondaryZoneMessage = $LocalizedData.CheckingSecondaryZoneMessage - Write-Verbose -Message $secondaryZoneMessage - - # If the zone is already secondary zone - if($dnsZone.ZoneType -eq "Secondary") - { - $correctZoneMessage = $($LocalizedData.AlreadySecondaryZoneMessage) -f $Name - Write-Verbose -Message $correctZoneMessage - - # Check the master server property - $checkPropertyMessage = $($LocalizedData.CheckPropertyMessage) -f 'master servers' - Write-Verbose -Message $checkPropertyMessage - - # Compare the master server property - if((-not $dnsZone.MasterServers) -or (Compare-Object $($dnsZone.MasterServers.IPAddressToString) $MasterServers)) - { - $notDesiredPropertyMessage = $($LocalizedData.NotDesiredPropertyMessage) -f 'master servers',$MasterServers,$dnsZone.MasterServers - Write-Verbose -Message $notDesiredPropertyMessage - - if($Apply) - { - Set-DnsServerSecondaryZone -Name $Name -MasterServers $MasterServers - - $setPropertyMessage = $($LocalizedData.SetPropertyMessage) -f 'master servers' - Write-Verbose -Message $setPropertyMessage - } - else - { - return $false - } - } # end master server mismatch - else - { - $desiredPropertyMessage = $($LocalizedData.DesiredPropertyMessage) -f 'master servers' - Write-Verbose -Message $desiredPropertyMessage - if(-not $Apply) - { - return $true - } - } # end master servers match - - } # end zone is already secondary - - # If the zone is not secondary, make it so - else - { - $notCorrectZoneMessage = $($LocalizedData.NotSecondaryZoneMessage) -f $Name,$dnsZone.ZoneType - Write-Verbose -Message $notCorrectZoneMessage - - # Convert the zone to Secondary zone - if($Apply) - { - ConvertTo-DnsServerSecondaryZone -Name $Name -MasterServers $MasterServers -ZoneFile $Name -Force - - $setZoneMessage = $($LocalizedData.SetSecondaryZoneMessage) -f $Name - Write-Verbose -Message $setZoneMessage - } - else - { - return $false - } - } # end zone is not secondary - - }# end ensure -eq present - - # If zone should be absent - else - { - if($Apply) - { - $removingZoneMessage = $LocalizedData.RemovingZoneMessage - Write-Verbose -Message $removingZoneMessage - - Remove-DnsServerZone -Name $Name -Force - - $deleteZoneMessage = $($LocalizedData.DeleteZoneMessage) -f $Name - Write-Verbose -Message $deleteZoneMessage - } - else - { - return $false - } - } # end ensure -eq absent - - } # end found dns zone - - # Not found DNS Zone - else - { - $testZoneMessage = $($LocalizedData.TestZoneMessage) -f 'absent', $Ensure - Write-Verbose -Message $testZoneMessage - - if($Ensure -eq 'Present') - { - if($Apply) - { - $addingSecondaryZoneMessage = $LocalizedData.AddingSecondaryZoneMessage - Write-Verbose -Message $addingSecondaryZoneMessage - - # Add the zone and start the transfer - Add-DnsServerSecondaryZone -Name $Name -MasterServers $MasterServers -ZoneFile $Name - Start-DnsServerZoneTransfer -Name $Name -FullTransfer - - $newSecondaryZoneMessage = $($LocalizedData.NewSecondaryZoneMessage) -f $Name - Write-Verbose -Message $newSecondaryZoneMessage - } - else - { - return $false - } - } # end ensure -eq Present - else - { - if(-not $Apply) - { - return $true - } - } # end ensure -eq Absent - } -} -#endregion - -Export-ModuleMember -Function *-TargetResource - diff --git a/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerSecondaryZone/MSFT_xDnsServerSecondaryZone.schema.mof b/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerSecondaryZone/MSFT_xDnsServerSecondaryZone.schema.mof deleted file mode 100644 index f7e6213d..00000000 --- a/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerSecondaryZone/MSFT_xDnsServerSecondaryZone.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xDnsServerSecondaryZone")] -class MSFT_xDnsServerSecondaryZone : OMI_BaseResource -{ - [Key, Description("Name of the secondary zone")] String Name; - [Required, Description("IP address or DNS name of the secondary DNS servers")] String MasterServers[]; - [Write, Description("Should this resource be present or absent"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Read, Description("Type of the DNS server zone")] String Type; -}; - diff --git a/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerZoneTransfer/MSFT_xDnsServerZoneTransfer.psm1 b/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerZoneTransfer/MSFT_xDnsServerZoneTransfer.psm1 deleted file mode 100644 index 35278ca0..00000000 --- a/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerZoneTransfer/MSFT_xDnsServerZoneTransfer.psm1 +++ /dev/null @@ -1,232 +0,0 @@ -Import-Module $PSScriptRoot\..\Helper.psm1 -Verbose:$false - -# Allow transfer to any server use 0, to one in name tab 1, specific one 2, no transfer 3 -$XferId2Name= @('Any','Named','Specific','None') - -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData @' -CheckingZoneMessage = Checking the current zone transfer for DNS server zone {0} ... -DesiredZoneMessage = Current zone transfer settings for the given DNS server zone is correctly set to {0} -NotDesiredZoneMessage = DNS server zone transfer settings is not correct. Expected {0}, actual {1} -SetZoneMessage = Current zone transfer setting for DNS server zone {0} is set to {1} - -NotDesiredPropertyMessage = DNS server zone transfer secondary servers are not correct. Expected {0}, actual {1} -SettingPropertyMessage = Setting DNS server zone transfer secondary servers to {0} ... -SetPropertyMessage = DNS server zone transfer secondary servers are set -'@ -} - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory)] - [String]$Name, - - [parameter(Mandatory)] - [ValidateSet("None","Any","Named","Specific")] - [String]$Type - ) - -#region Input Validation - - # Check for DnsServer module/role - Assert-Module -moduleName DnsServer - -#endregion - - $currentZone = Get-CimInstance ` - -ClassName MicrosoftDNS_Zone ` - -Namespace root\MicrosoftDNS ` - -Verbose:$false | Where-Object {$_.Name -eq $Name} - - @{ - Name = $Name - Type = $XferId2Name[$currentZone.SecureSecondaries] - SecondaryServer = $currentZone.SecondaryServers - } -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory)] - [String]$Name, - - [parameter(Mandatory)] - [ValidateSet("None","Any","Named","Specific")] - [String]$Type, - - [String[]]$SecondaryServer - ) - - if($PSBoundParameters.ContainsKey('Debug')) - { - $null = $PSBoundParameters.Remove('Debug') - } - Validate-ResourceProperties @PSBoundParameters -Apply - - # Restart the DNS service - Restart-Service -Name DNS -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory)] - [String]$Name, - - [parameter(Mandatory)] - [ValidateSet("None","Any","Named","Specific")] - [String]$Type, - - [String[]]$SecondaryServer - ) - -#region Input Validation - - # Check for DnsServer module/role - Assert-Module -moduleName DnsServer - -#endregion - - if($PSBoundParameters.ContainsKey('Debug')) - { - $null = $PSBoundParameters.Remove('Debug') - } - Validate-ResourceProperties @PSBoundParameters -} - -function Validate-ResourceProperties -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory)] - [String]$Name, - - [parameter(Mandatory)] - [ValidateSet("None","Any","Named","Specific")] - [String]$Type, - - [String[]]$SecondaryServer, - - [Switch]$Apply - ) - - $checkZoneMessage = $($LocalizedData.CheckingZoneMessage) ` - -f $Name - Write-Verbose -Message $checkZoneMessage - - # Get the current value of transfer zone - $currentZone = Get-CimInstance ` - -ClassName MicrosoftDNS_Zone ` - -Namespace root\MicrosoftDNS ` - -Verbose:$false | Where-Object {$_.Name -eq $Name} - $currentZoneTransfer = $currentZone.SecureSecondaries - - # Hashtable with 2 keys: SecureSecondaries,SecondaryServers - $Arguments = @{} - - switch ($Type) - { - 'None' - { - $Arguments['SecureSecondaries'] = 3 - } - 'Any' - { - $Arguments['SecureSecondaries'] = 0 - } - 'Named' - { - $Arguments['SecureSecondaries'] = 1 - } - 'Specific' - { - $Arguments['SecureSecondaries'] = 2 - $Arguments['SecondaryServers']=$SecondaryServer - } - } - - # Check the current value against expected value - if($currentZoneTransfer -eq $Arguments.SecureSecondaries) - { - $desiredZoneMessage = ($LocalizedData.DesiredZoneMessage) ` - -f $XferId2Name[$currentZoneTransfer] - Write-Verbose -Message $desiredZoneMessage - - # If the Type is specific, and SecondaryServer doesn't match - if(($currentZoneTransfer -eq 2) ` - -and (Compare-Object $currentZone.SecondaryServers $SecondaryServer)) - { - $notDesiredPropertyMessage = ($LocalizedData.NotDesiredPropertyMessage) ` - -f ($SecondaryServer -join ','),($currentZone.SecondaryServers -join ',') - Write-Verbose -Message $notDesiredPropertyMessage - - # Set the SecondaryServer property - if($Apply) - { - $settingPropertyMessage = ($LocalizedData.SettingPropertyMessage) ` - -f ($SecondaryServer -join ',') - Write-Verbose -Message $settingPropertyMessage - - $null = Invoke-CimMethod ` - -InputObject $currentZone ` - -MethodName ResetSecondaries ` - -Arguments $Arguments ` - -Verbose:$false - - $setPropertyMessage = $LocalizedData.SetPropertyMessage - Write-Verbose -Message $setPropertyMessage - } - else - { - return $false - } - } # end SecondaryServer match - - if(-not $Apply) - { - return $true - } - } # end currentZoneTransfer -eq ExpectedZoneTransfer - else - { - $notDesiredZoneMessage = $($LocalizedData.NotDesiredZoneMessage) ` - -f $XferId2Name[$Arguments.SecureSecondaries], ` - $XferId2Name[$currentZoneTransfer] - Write-Verbose -Message $notDesiredZoneMessage - - if($Apply) - { - $null = Invoke-CimMethod ` - -InputObject $currentZone ` - -MethodName ResetSecondaries ` - -Arguments $Arguments ` - -Verbose:$false - - $setZoneMessage = $($LocalizedData.SetZoneMessage) ` - -f $Name,$XferId2Name[$Arguments.SecureSecondaries] - Write-Verbose -Message $setZoneMessage - } - else - { - return $false - } - } # end currentZoneTransfer -ne ExpectedZoneTransfer -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerZoneTransfer/MSFT_xDnsServerZoneTransfer.schema.mof b/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerZoneTransfer/MSFT_xDnsServerZoneTransfer.schema.mof deleted file mode 100644 index 64a53ddf..00000000 --- a/lib/puppet_x/dsc_resources/xDnsServer/DSCResources/MSFT_xDnsServerZoneTransfer/MSFT_xDnsServerZoneTransfer.schema.mof +++ /dev/null @@ -1,8 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xDnsServerZoneTransfer")] -class MSFT_xDnsServerZoneTransfer : OMI_BaseResource -{ - [Key, Description("Name of the DNS zone")] String Name; - [Required, Description("Type of transfer allowed"), ValueMap{"None","Any","Named","Specific"}, Values{"None","Any","Named","Specific"}] String Type; - [Write, Description("IP address or DNS name of DNS servers where zone information can be transfered")] String SecondaryServer[]; -}; - diff --git a/lib/puppet_x/dsc_resources/xDnsServer/LICENSE b/lib/puppet_x/dsc_resources/xDnsServer/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xDnsServer/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xDnsServer/Misc/New-DnsServerSecondaryZone.ps1 b/lib/puppet_x/dsc_resources/xDnsServer/Misc/New-DnsServerSecondaryZone.ps1 deleted file mode 100644 index 3ba12e24..00000000 --- a/lib/puppet_x/dsc_resources/xDnsServer/Misc/New-DnsServerSecondaryZone.ps1 +++ /dev/null @@ -1,10 +0,0 @@ -$Properties = @{ - Name = New-xDscResourceProperty -Name Name -Type String -Attribute Key ` - -Description 'Name of the secondary zone' - DnsServer = New-xDscResourceProperty -Name MasterServerIPAddress -Type String[] -Attribute Required ` - -Description 'IP address of secondary DNS servers' - Ensure = New-xDscResourceProperty -Name Ensure -Type String -Attribute Write -ValidateSet 'Present','Absent' ` - -Description 'Should this resource be present or absent' - - } -New-xDscResource -Name MSFT_xDnsServerSecondaryZone -Property $Properties.Values -Path . -ModuleName xDnsServer -FriendlyName xDnsServerSecondaryZone -Force diff --git a/lib/puppet_x/dsc_resources/xDnsServer/Misc/New-DnsServerZoneTransfer.ps1 b/lib/puppet_x/dsc_resources/xDnsServer/Misc/New-DnsServerZoneTransfer.ps1 deleted file mode 100644 index df45e3c6..00000000 --- a/lib/puppet_x/dsc_resources/xDnsServer/Misc/New-DnsServerZoneTransfer.ps1 +++ /dev/null @@ -1,12 +0,0 @@ -$Properties = @{ - Name = New-xDscResourceProperty -Name Name -Type String -Attribute Key ` - -Description 'Name of the secondary zone' - Type = New-xDscResourceProperty -Name Type -Type String -Attribute Required -ValidateSet 'Any', 'Named', 'Specific' ` - -Description 'Type of transfer allowed' - SecondaryServer = New-xDscResourceProperty -Name SecondaryServerIPAddress -Type String[] -Attribute Write ` - -Description 'IP address of DNS servers where zone information can be sent' - Ensure = New-xDscResourceProperty -Name Ensure -Type String -Attribute Write -ValidateSet 'Present','Absent' ` - -Description 'Should this resource be present or absent' - - } -New-xDscResource -Name MSFT_xDnsServerZoneTransfer -Property $Properties.Values -Path . -ModuleName xDnsServer -FriendlyName xDnsServerZoneTransfer -Force diff --git a/lib/puppet_x/dsc_resources/xDnsServer/xDnsServer.psd1 b/lib/puppet_x/dsc_resources/xDnsServer/xDnsServer.psd1 deleted file mode 100644 index 50d6c6ae..00000000 --- a/lib/puppet_x/dsc_resources/xDnsServer/xDnsServer.psd1 +++ /dev/null @@ -1,62 +0,0 @@ -@{ -# Version number of this module. -ModuleVersion = '1.8.0.0' - -# ID used to uniquely identify this module -GUID = '5f70e6a1-f1b2-4ba0-8276-8967d43a7ec2' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'Module with DSC Resources for DNS Server area' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Minimum version of the common language runtime (CLR) required by this module -# CLRVersion = '4.0' - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/xDnsServer/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/xDnsServer' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - ReleaseNotes = '* Converted AppVeyor.yml to pull Pester from PSGallery instead of Chocolatey -* Fixed bug in xDnsServerADZone causing Get-TargetResource to fail with an extra property. - -' - - } # End of PSData hashtable - -} # End of PrivateData hashtable -} - - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchActiveSyncVirtualDirectory/MSFT_xExchActiveSyncVirtualDirectory.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchActiveSyncVirtualDirectory/MSFT_xExchActiveSyncVirtualDirectory.psm1 deleted file mode 100644 index ea00d037..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchActiveSyncVirtualDirectory/MSFT_xExchActiveSyncVirtualDirectory.psm1 +++ /dev/null @@ -1,663 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscTestsPresent", "")] -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscExamplesPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $AutoCertBasedAuth = $false, - - [System.String] - $AutoCertBasedAuthThumbprint, - - [System.String[]] - $AutoCertBasedAuthHttpsBindings = @("0.0.0.0:443", "127.0.0.1:443"), - - [System.Boolean] - $BasicAuthEnabled, - - [ValidateSet("Ignore", "Accepted", "Required")] - [System.String] - $ClientCertAuth, - - [System.Boolean] - $CompressionEnabled, - - [System.String] - $DomainController, - - [System.String[]] - $ExternalAuthenticationMethods, - - [System.String] - $ExternalUrl, - - [System.String[]] - $InternalAuthenticationMethods, - - [System.String] - $InternalUrl, - - [System.Boolean] - $WindowsAuthEnabled - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad 'Get-ActiveSyncVirtualDirectory' -VerbosePreference $VerbosePreference - - $easVdir = Get-ActiveSyncVirtualDirectoryInternal @PSBoundParameters - - if ($null -ne $easVdir) - { - $returnValue = @{ - Identity = $Identity - InternalUrl = $easVdir.InternalUrl.AbsoluteUri - ExternalUrl = $easVdir.ExternalUrl.AbsoluteUri - BasicAuthEnabled = $easVdir.BasicAuthEnabled - WindowsAuthEnabled = $easVdir.WindowsAuthEnabled - CompressionEnabled = $easVdir.CompressionEnabled - ClientCertAuth = $easVdir.ClientCertAuth - } - } - - $returnValue -} - -function Set-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")] - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $AutoCertBasedAuth = $false, - - [System.String] - $AutoCertBasedAuthThumbprint, - - [System.String[]] - $AutoCertBasedAuthHttpsBindings = @("0.0.0.0:443", "127.0.0.1:443"), - - [System.Boolean] - $BasicAuthEnabled, - - [ValidateSet("Ignore", "Accepted", "Required")] - [System.String] - $ClientCertAuth, - - [System.Boolean] - $CompressionEnabled, - - [System.String] - $DomainController, - - [System.String[]] - $ExternalAuthenticationMethods, - - [System.String] - $ExternalUrl, - - [System.String[]] - $InternalAuthenticationMethods, - - [System.String] - $InternalUrl, - - [System.Boolean] - $WindowsAuthEnabled - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad 'Set-ActiveSyncVirtualDirectory' -VerbosePreference $VerbosePreference - - #Ensure an empty string is $null and not a string - SetEmptyStringParamsToNull -PSBoundParametersIn $PSBoundParameters - - #Remove Credential and AllowServiceRestart because those parameters do not exist on Set-ActiveSyncVirtualDirectory - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove 'Credential','AllowServiceRestart','AutoCertBasedAuth','AutoCertBasedAuthThumbprint','AutoCertBasedAuthHttpsBindings' - - #Configure everything but CBA - Set-ActiveSyncVirtualDirectory @PSBoundParameters - - if ($AutoCertBasedAuth) #Need to configure CBA - { - Test-PreReqsForCertBasedAuth - - if (-not ([string]::IsNullOrEmpty($AutoCertBasedAuthThumbprint))) - { - Enable-CertBasedAuth -AutoCertBasedAuthThumbprint $AutoCertBasedAuthThumbprint -AutoCertBasedAuthHttpsBindings $AutoCertBasedAuthHttpsBindings - } - else - { - throw "AutoCertBasedAuthThumbprint must be specified when AutoCertBasedAuth is set to `$true" - } - - if($AllowServiceRestart) #Need to restart all of IIS for auth settings to stick - { - Write-Verbose "Restarting IIS" - - iisreset /noforce /timeout:300 - } - else - { - Write-Warning "The configuration will not take effect until 'IISReset /noforce' is run." - } - } - - #Only bounce the app pool if we didn't already restart IIS for CBA - if (-not $AutoCertBasedAuth) - { - if($AllowServiceRestart) - { - Write-Verbose "Recycling MSExchangeSyncAppPool" - - RestartAppPoolIfExists -Name MSExchangeSyncAppPool - } - else - { - Write-Warning "The configuration will not take effect until MSExchangeSyncAppPool is manually recycled." - } - } -} - -function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $AutoCertBasedAuth = $false, - - [System.String] - $AutoCertBasedAuthThumbprint, - - [System.String[]] - $AutoCertBasedAuthHttpsBindings = @("0.0.0.0:443", "127.0.0.1:443"), - - [System.Boolean] - $BasicAuthEnabled, - - [ValidateSet("Ignore", "Accepted", "Required")] - [System.String] - $ClientCertAuth, - - [System.Boolean] - $CompressionEnabled, - - [System.String] - $DomainController, - - [System.String[]] - $ExternalAuthenticationMethods, - - [System.String] - $ExternalUrl, - - [System.String[]] - $InternalAuthenticationMethods, - - [System.String] - $InternalUrl, - - [System.Boolean] - $WindowsAuthEnabled - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad 'Get-ActiveSyncVirtualDirectory' -VerbosePreference $VerbosePreference - - #Ensure an empty string is $null and not a string - SetEmptyStringParamsToNull -PSBoundParametersIn $PSBoundParameters - - $easVdir = Get-ActiveSyncVirtualDirectoryInternal @PSBoundParameters - - if ($null -eq $easVdir) - { - return $false - } - else - { - if (-not (VerifySetting -Name "InternalUrl" -Type "String" -ExpectedValue $InternalUrl -ActualValue $easVdir.InternalUrl.AbsoluteUri -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (-not (VerifySetting -Name "ExternalUrl" -Type "String" -ExpectedValue $ExternalUrl -ActualValue $easVdir.ExternalUrl.AbsoluteUri -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (-not (VerifySetting -Name "BasicAuthEnabled" -Type "Boolean" -ExpectedValue $BasicAuthEnabled -ActualValue $easVdir.BasicAuthEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (-not (VerifySetting -Name "WindowsAuthEnabled" -Type "Boolean" -ExpectedValue $WindowsAuthEnabled -ActualValue $easVdir.WindowsAuthEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (-not (VerifySetting -Name "CompressionEnabled" -Type "Boolean" -ExpectedValue $CompressionEnabled -ActualValue $easVdir.CompressionEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (-not (VerifySetting -Name "ClientCertAuth" -Type "String" -ExpectedValue $ClientCertAuth -ActualValue $easVdir.ClientCertAuth -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (-not (VerifySetting -Name "ExternalAuthenticationMethods" -Type "Array" -ExpectedValue $ExternalAuthenticationMethods -ActualValue $easVdir.ExternalAuthenticationMethods -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (-not (VerifySetting -Name "InternalAuthenticationMethods" -Type "Array" -ExpectedValue $InternalAuthenticationMethods -ActualValue $easVdir.InternalAuthenticationMethods -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if ($AutoCertBasedAuth) - { - Test-PreReqsForCertBasedAuth - - if ([string]::IsNullOrEmpty($AutoCertBasedAuthThumbprint)) - { - ReportBadSetting -SettingName "AutoCertBasedAuthThumbprint" -ExpectedValue "Not null or empty" -ActualValue "" -VerbosePreference $VerbosePreference - return $false - } - elseif ($null -eq $AutoCertBasedAuthHttpsBindings -or $AutoCertBasedAuthHttpsBindings.Count -eq 0) - { - ReportBadSetting -SettingName "AutoCertBasedAuthHttpsBindings" -ExpectedValue "Not null or empty" -ActualValue "" -VerbosePreference $VerbosePreference - return $false - } - elseif ((Test-CertBasedAuth -AutoCertBasedAuthThumbprint $AutoCertBasedAuthThumbprint -AutoCertBasedAuthHttpsBindings $AutoCertBasedAuthHttpsBindings) -eq $false) - { - ReportBadSetting -SettingName "TestCertBasedAuth" -ExpectedValue $true -ActualValue $false -VerbosePreference $VerbosePreference - return $false - } - } - } - - #If the code got to this point, all conditions are true - return $true -} - -function Get-ActiveSyncVirtualDirectoryInternal -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $AutoCertBasedAuth = $false, - - [System.String] - $AutoCertBasedAuthThumbprint, - - [System.String[]] - $AutoCertBasedAuthHttpsBindings = @("0.0.0.0:443", "127.0.0.1:443"), - - [System.Boolean] - $BasicAuthEnabled, - - [ValidateSet("Ignore", "Accepted", "Required")] - [System.String] - $ClientCertAuth, - - [System.Boolean] - $CompressionEnabled, - - [System.String] - $DomainController, - - [System.String[]] - $ExternalAuthenticationMethods, - - [System.String] - $ExternalUrl, - - [System.String[]] - $InternalAuthenticationMethods, - - [System.String] - $InternalUrl, - - [System.Boolean] - $WindowsAuthEnabled - ) - - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Identity","DomainController" - - return (Get-ActiveSyncVirtualDirectory @PSBoundParameters) -} - -function Enable-CertBasedAuth -{ - param - ( - [System.String] - $AutoCertBasedAuthThumbprint, - - [System.String[]] - $AutoCertBasedAuthHttpsBindings = @("0.0.0.0:443", "127.0.0.1:443") - ) - - $appCmdExe = "$($env:SystemRoot)\System32\inetsrv\appcmd.exe" - - #Enable cert auth in IIS, and require SSL on the AS vdir - $output = &$appCmdExe set config -section:system.webServer/security/authentication/clientCertificateMappingAuthentication /enabled:"True" /commit:apphost - Write-Verbose "$output" - - $output = &$appCmdExe set config "Default Web Site" -section:system.webServer/security/authentication/clientCertificateMappingAuthentication /enabled:"True" /commit:apphost - Write-Verbose "$output" - - $output = &$appCmdExe set config "Default Web Site/Microsoft-Server-ActiveSync" /section:access /sslFlags:"Ssl, SslNegotiateCert, SslRequireCert, Ssl128" /commit:apphost - Write-Verbose "$output" - - $output = &$appCmdExe set config "Default Web Site/Microsoft-Server-ActiveSync" -section:system.webServer/security/authentication/clientCertificateMappingAuthentication /enabled:"True" /commit:apphost - Write-Verbose "$output" - - #Set DSMapperUsage to enabled on all the required SSL bindings - $appId = "{4dc3e181-e14b-4a21-b022-59fc669b0914}" #The appId of all IIS applications - - foreach ($binding in $AutoCertBasedAuthHttpsBindings) - { - Enable-DSMapperUsage -IpPortCombo $binding -CertThumbprint $AutoCertBasedAuthThumbprint -AppId $appId - } -} - -function Test-CertBasedAuth -{ - param - ( - [System.String] - $AutoCertBasedAuthThumbprint, - - [System.String[]] - $AutoCertBasedAuthHttpsBindings = @("0.0.0.0:443", "127.0.0.1:443") - ) - - $appCmdExe = "$($env:SystemRoot)\System32\inetsrv\appcmd.exe" - - $serverWideClientCertMappingAuth = &$appCmdExe list config -section:system.webServer/security/authentication/clientCertificateMappingAuthentication - - if (-not (Test-AppCmdOutputContainsString -AppCmdOutput $serverWideClientCertMappingAuth -SearchString "clientCertificateMappingAuthentication enabled=`"true`"")) - { - return $false - } - - $clientCertMappingAuth = &$appCmdExe list config "Default Web Site" -section:system.webServer/security/authentication/clientCertificateMappingAuthentication - - if (-not (Test-AppCmdOutputContainsString -AppCmdOutput $clientCertMappingAuth -SearchString "clientCertificateMappingAuthentication enabled=`"true`"")) - { - return $false - } - - $asClientCertMappingAuth = &$appCmdExe list config "Default Web Site/Microsoft-Server-ActiveSync" -section:system.webServer/security/authentication/clientCertificateMappingAuthentication - - if (-not (Test-AppCmdOutputContainsString -appCmdOutput $asClientCertMappingAuth -searchString "clientCertificateMappingAuthentication enabled=`"true`"")) - { - return $false - } - - $sslFlags = &$appCmdExe list config "Default Web Site/Microsoft-Server-ActiveSync" /section:access - - if (-not (Test-AppCmdOutputContainsString -appCmdOutput $sslFlags -searchString "access sslFlags=`"Ssl, SslNegotiateCert, SslRequireCert, Ssl128`"")) - { - return $false - } - - $netshOutput = netsh http show sslcert - - foreach ($binding in $AutoCertBasedAuthHttpsBindings) - { - if (-not (Test-NetshSslCertSetting -IpPort $binding -NetshSslCertOutput $netshOutput -SettingName "DS Mapper Usage" -SettingValue "Enabled")) - { - return $false - } - - if (-not (Test-NetshSslCertSetting -IpPort $binding -NetshSslCertOutput $netshOutput -SettingName "Certificate Hash" -SettingValue $AutoCertBasedAuthThumbprint)) - { - return $false - } - - if (-not (Test-NetshSslCertSetting -IpPort $binding -NetshSslCertOutput $netshOutput -SettingName "Certificate Store Name" -SettingValue "MY")) - { - return $false - } - } - - return $true -} - -function Test-IsSslBinding -{ - param - ( - $NetshOutput - ) - - if ($null -ne $NetshOutput -and $NetshOutput.GetType().Name -eq "Object[]") - { - for ($i = 0; $i -lt $NetshOutput.Count; $i++) - { - if ($NetshOutput[$i].Contains("IP:port")) - { - return $true - } - } - } - - return $false -} - -function Enable-DSMapperUsage -{ - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $IpPortCombo, - - [Parameter(Mandatory = $true)] - [System.String] - $CertThumbprint, - - [Parameter(Mandatory = $true)] - [System.String] - $AppId - ) - #See if a binding already exists, and if so, delete it - $bindingOutput = netsh http show sslcert ipport=$($IpPortCombo) - - if (Test-IsSslBinding $bindingOutput) - { - $output = netsh http delete sslcert ipport=$($IpPortCombo) - Write-Verbose "$output" - } - - #Add the binding back with new settings - $output = netsh http add sslcert ipport=$($IpPortCombo) certhash=$($CertThumbprint) appid=$($AppId) dsmapperusage=enable certstorename=MY - Write-Verbose "$output" -} - -function Test-AppCmdOutputContainsString -{ - param - ( - $AppCmdOutput, - - [Parameter(Mandatory = $true)] - [System.String] - $SearchString - ) - - if ($null -ne $AppCmdOutput -and $AppCmdOutput.GetType().Name -eq "Object[]") - { - foreach ($line in $AppCmdOutput) - { - if ($line.ToLower().Contains($SearchString.ToLower())) - { - return $true - } - } - } - - return $false -} - -function Test-NetshSslCertSetting -{ - param - ( - $NetshSslCertOutput, - - [Parameter(Mandatory = $true)] - [System.String] - $IpPort, - - [Parameter(Mandatory = $true)] - [System.String] - $SettingName, - - [Parameter(Mandatory = $true)] - [System.String] - $SettingValue - ) - - $SettingName = $SettingName.ToLower() - $SettingValue = $SettingValue.ToLower() - - if ($null -ne $NetshSslCertOutput -and $NetshSslCertOutput.GetType().Name -eq "Object[]") - { - $foundSetting = $false - for ($i = 0; $i -lt $NetshSslCertOutput.Count -and -not $foundSetting; $i++) - { - if ($NetshSslCertOutput[$i].ToLower().Contains("ip:port") -and $NetshSslCertOutput[$i].Contains($IpPort)) - { - $i++ - - while (-not $NetshSslCertOutput[$i].ToLower().Contains("ip:port") -and -not $foundSetting) - { - if ($NetshSslCertOutput[$i].ToLower().Contains($SettingName)) - { - $foundSetting = $true - - if ($NetshSslCertOutput[$i].ToLower().Contains($SettingValue)) - { - return $true - } - } - - $i++ - } - } - } - } - - return $false -} - -#Ensures that required uto Certification Based Authentication prereqs are installed -function Test-PreReqsForCertBasedAuth -{ - $hasAllPreReqs = $true - - $webClientAuth = Get-WindowsFeature Web-Client-Auth - $webCertAuth = Get-WindowsFeature Web-Cert-Auth - - if ($webClientAuth.InstallState -ne "Installed") - { - $hasAllPreReqs = $false - - Write-Error "The Web-Client-Auth feature needs to be installed before the Auto Certification Based Authentication feature can be used" - } - - if ($webCertAuth.InstallState -ne "Installed") - { - $hasAllPreReqs = $false - - Write-Error "The Web-Cert-Auth feature needs to be installed before the Auto Certification Based Authentication feature can be used" - } - - if ($hasAllPreReqs -eq $false) - { - throw "Required Windows features need to be installed before the Auto Certification Based Authentication feature can be used" - } -} - -Export-ModuleMember -Function *-TargetResource - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchActiveSyncVirtualDirectory/MSFT_xExchActiveSyncVirtualDirectory.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchActiveSyncVirtualDirectory/MSFT_xExchActiveSyncVirtualDirectory.schema.mof deleted file mode 100644 index a2ee0daa..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchActiveSyncVirtualDirectory/MSFT_xExchActiveSyncVirtualDirectory.schema.mof +++ /dev/null @@ -1,25 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xExchActiveSyncVirtualDirectory")] -class MSFT_xExchActiveSyncVirtualdirectory : OMI_BaseResource -{ - [Key] String Identity; //The Identity of the ActiveSync Virtual Directory - [Required, EmbeddedInstance("MSFT_Credential")] String Credential; //Credentials used to establish a remote Powershell session to Exchange - [Write] Boolean AllowServiceRestart; //Whether it is OK to recycle the app pool, or restart IIS after making changes. Defaults to $true. - [Write] Boolean AutoCertBasedAuth; //Automates the IIS configuration portion of certificate based authentication. Only works against the Default Web Site. Does not configure ClientCertAuth parameter, which must be specified separately. Does not install ‘Client Certificate Mapping Authentication’ or ‘IIS Client Certificate Mapping Authentication’ roles of IIS, which also must be configured separately. - [Write] String AutoCertBasedAuthThumbprint; //The thumbprint of the in use Exchange certificate for IIS - [Write] String AutoCertBasedAuthHttpsBindings[]; //The (IP:PORT)'s of the HTTPS bindings on the Default Web Site. Defaults to "0.0.0.0:443","127.0.0.1:443" - - //Remaining properties correspond directly to Set-ActiveSyncVirtualDirectory parameters - //http://technet.microsoft.com/en-us/library/bb123679(v=exchg.150).aspx - [Write] Boolean BasicAuthEnabled; - [Write, ValueMap{"Ignore","Accepted","Required"}, Values{"Ignore","Accepted","Required"}] String ClientCertAuth; - [Write] Boolean CompressionEnabled; - [Write] String DomainController; - [Write] String ExternalAuthenticationMethods[]; - [Write] String ExternalUrl; - [Write] String InternalAuthenticationMethods[]; - [Write] String InternalUrl; - [Write] Boolean WindowsAuthEnabled; -}; - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchAntiMalwareScanning/MSFT_xExchAntiMalwareScanning.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchAntiMalwareScanning/MSFT_xExchAntiMalwareScanning.psm1 deleted file mode 100644 index 1f764f3b..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchAntiMalwareScanning/MSFT_xExchAntiMalwareScanning.psm1 +++ /dev/null @@ -1,145 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscTestsPresent", "")] -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscExamplesPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.Boolean] - $Enabled, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Enabled" = $Enabled} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad 'Get-TransportAgent' -VerbosePreference $VerbosePreference - - $agent = Get-TransportAgent -Identity "Malware Agent" - - if ($null -ne $agent) - { - $returnValue = @{ - Enabled = $agent.Enabled - } - } - - $returnValue -} - -function Set-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.Boolean] - $Enabled, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Enabled" = $Enabled} -VerbosePreference $VerbosePreference - - $scriptsRoot = Join-Path -Path ((Get-ItemProperty HKLM:\SOFTWARE\Microsoft\ExchangeServer\v15\Setup).MsiInstallPath) -ChildPath "Scripts" - - - if ($Enabled -eq $true) - { - $scriptPath = Join-Path -Path "$($scriptsRoot)" -ChildPath "Enable-AntimalwareScanning.ps1" - } - else - { - $scriptPath = Join-Path -Path "$($scriptsRoot)" -ChildPath "Disable-AntimalwareScanning.ps1" - } - - #Override Write-Host, as it is used by the target scripts, and causes a DSC error since the session is not interactive - New-Alias Write-Host Write-Verbose - - if($AllowServiceRestart -eq $true) - { - . $scriptPath -ForceRestart - } - else - { - . $scriptPath - - Write-Warning "The configuration will not take effect until the MSExchangeTransport service is manually restarted." - } - - Remove-Item Alias:Write-Host -} - - -function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.Boolean] - $Enabled, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Enabled" = $Enabled} -VerbosePreference $VerbosePreference - - $agentStatus = Get-TargetResource @PSBoundParameters - - if ($null -eq $agentStatus) - { - return $false - } - else - { - if (!(VerifySetting -Name "Enabled" -Type "Boolean" -ExpectedValue $Enabled -ActualValue $agentStatus.Enabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - } - - #If the code made it this for all properties are in a desired state - return $true -} - -Export-ModuleMember -Function *-TargetResource - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchAntiMalwareScanning/MSFT_xExchAntiMalwareScanning.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchAntiMalwareScanning/MSFT_xExchAntiMalwareScanning.schema.mof deleted file mode 100644 index 5cf64ef2..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchAntiMalwareScanning/MSFT_xExchAntiMalwareScanning.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xExchAntiMalwareScanning")] -class MSFT_xExchAntiMalwareScanning : OMI_BaseResource -{ - [Key, Description("Whether Exchange Anti-malware scanning should be Enabled")] Boolean Enabled; - [Required, Description("Credentials used to establish a remote Powershell session to Exchange"), EmbeddedInstance("MSFT_Credential")] String Credential; - [Write, Description("Whether the Transport services should be automatically restarted after a status change")] Boolean AllowServiceRestart; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchAutoMountPoint/MSFT_xExchAutoMountPoint.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchAutoMountPoint/MSFT_xExchAutoMountPoint.psm1 deleted file mode 100644 index 28b239dd..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchAutoMountPoint/MSFT_xExchAutoMountPoint.psm1 +++ /dev/null @@ -1,918 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscExamplesPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.String] - $AutoDagDatabasesRootFolderPath, - - [parameter(Mandatory = $true)] - [System.String] - $AutoDagVolumesRootFolderPath, - - [parameter(Mandatory = $true)] - [System.String[]] - $DiskToDBMap, - - [parameter(Mandatory = $true)] - [System.UInt32] - $SpareVolumeCount, - - [System.Boolean] - $EnsureExchangeVolumeMountPointIsLast = $false, - - [System.Boolean] - $CreateSubfolders = $false, - - [ValidateSet("NTFS","REFS")] - [System.String] - $FileSystem = "NTFS", - - [System.String] - $MinDiskSize = "", - - [ValidateSet("MBR","GPT")] - [System.String] - $PartitioningScheme = "GPT", - - [System.String] - $UnitSize = "64K", - - [System.String] - $VolumePrefix = "EXVOL" - ) - - #Load helper modules - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeDiskPart.psm1" -Verbose:0 - - LogFunctionEntry -VerbosePreference $VerbosePreference - - GetDiskInfo - - $dbMap = GetDiskToDBMap -AutoDagDatabasesRootFolderPath $AutoDagDatabasesRootFolderPath - - $returnValue = @{ - Identity = $Identity - DiskToDBMap = $dbMap - SpareVolumeCount = $SpareVolumeCount - AutoDagDatabasesRootFolderPath = $AutoDagDatabasesRootFolderPath - AutoDagVolumesRootFolderPath = $AutoDagVolumesRootFolderPath - VolumePrefix = $VolumePrefix - MinDiskSize = $MinDiskSize - UnitSize = $UnitSize - PartitioningScheme = $PartitioningScheme - FileSystem = $FileSystem - } - - $returnValue -} - -function Set-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.String] - $AutoDagDatabasesRootFolderPath, - - [parameter(Mandatory = $true)] - [System.String] - $AutoDagVolumesRootFolderPath, - - [parameter(Mandatory = $true)] - [System.String[]] - $DiskToDBMap, - - [parameter(Mandatory = $true)] - [System.UInt32] - $SpareVolumeCount, - - [System.Boolean] - $EnsureExchangeVolumeMountPointIsLast = $false, - - [System.Boolean] - $CreateSubfolders = $false, - - [ValidateSet("NTFS","REFS")] - [System.String] - $FileSystem = "NTFS", - - [System.String] - $MinDiskSize = "", - - [ValidateSet("MBR","GPT")] - [System.String] - $PartitioningScheme = "GPT", - - [System.String] - $UnitSize = "64K", - - [System.String] - $VolumePrefix = "EXVOL" - ) - - #Load helper modules - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeDiskPart.psm1" -Verbose:0 - - LogFunctionEntry -VerbosePreference $VerbosePreference - - #First see if we need to assign any disks to ExVol's - GetDiskInfo - - $exVolCount = GetInUseMountPointCount -RootFolder $AutoDagVolumesRootFolderPath - $requiredVolCount = $DiskToDBMap.Count + $SpareVolumeCount - - if ($exVolCount -lt $requiredVolCount) - { - CreateMissingExVolumes @PSBoundParameters -CurrentVolCount $exVolCount -RequiredVolCount $requiredVolCount - } - - #Now see if we need any DB mount points - GetDiskInfo - - $exDbCount = GetInUseMountPointCount -RootFolder $AutoDagDatabasesRootFolderPath - $requiredDbCount = GetDesiredDatabaseCount -DiskToDBMap $DiskToDBMap - - if ($exDbCount -lt $requiredDbCount) - { - CreateMissingExDatabases @PSBoundParameters - } - - #Now see if any Mount Points are ordered incorrectly. Jetstress wants ExchangeDatabase mount points to be listed before ExchangeVolume mount points - GetDiskInfo - - if ($EnsureExchangeVolumeMountPointIsLast -eq $true) - { - while($true) - { - $volNum = VolumeMountPointNotLastInList -AutoDagVolumesRootFolderPath $AutoDagVolumesRootFolderPath - - if ($volNum -ne -1) - { - SendVolumeMountPointToEndOfList -AutoDagVolumesRootFolderPath $AutoDagVolumesRootFolderPath -VolumeNumber $volNum - - #Update DiskInfo for next iteration - GetDiskInfo - } - else - { - break - } - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.String] - $AutoDagDatabasesRootFolderPath, - - [parameter(Mandatory = $true)] - [System.String] - $AutoDagVolumesRootFolderPath, - - [parameter(Mandatory = $true)] - [System.String[]] - $DiskToDBMap, - - [parameter(Mandatory = $true)] - [System.UInt32] - $SpareVolumeCount, - - [System.Boolean] - $EnsureExchangeVolumeMountPointIsLast = $false, - - [System.Boolean] - $CreateSubfolders = $false, - - [ValidateSet("NTFS","REFS")] - [System.String] - $FileSystem = "NTFS", - - [System.String] - $MinDiskSize = "", - - [ValidateSet("MBR","GPT")] - [System.String] - $PartitioningScheme = "GPT", - - [System.String] - $UnitSize = "64K", - - [System.String] - $VolumePrefix = "EXVOL" - ) - - #Load helper modules - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeDiskPart.psm1" -Verbose:0 - - LogFunctionEntry -VerbosePreference $VerbosePreference - - GetDiskInfo - - #Check if the number of assigned EXVOL's is less than the requested number of DB disks plus spares - $mountPointCount = GetInUseMountPointCount -RootFolder $AutoDagVolumesRootFolderPath - - if ($mountPointCount -lt ($DiskToDBMap.Count + $SpareVolumeCount)) - { - ReportBadSetting -SettingName "MountPointCount" -ExpectedValue ($DiskToDBMap.Count + $SpareVolumeCount) -ActualValue $mountPointCount -VerbosePreference $VerbosePreference - return $false - } - else #Loop through all requested DB's and see if they have a mount point yet - { - foreach ($value in $DiskToDBMap) - { - foreach ($db in $value.Split(',')) - { - if ((DBHasMountPoint -AutoDagDatabasesRootFolderPath $AutoDagDatabasesRootFolderPath -DB $db) -eq $false) - { - ReportBadSetting -SettingName "DB '$($db)' Has Mount Point" -ExpectedValue $true -ActualValue $false -VerbosePreference $VerbosePreference - return $false - } - } - } - } - - #Now check if any ExchangeVolume mount points are higher ordered than ExchangeDatabase mount points. ExchangeDatabase MP's must be listed first for logical disk counters to function properly - if ($EnsureExchangeVolumeMountPointIsLast -eq $true -and (VolumeMountPointNotLastInList -AutoDagVolumesRootFolderPath $AutoDagVolumesRootFolderPath) -ne -1) - { - Write-Verbose "One or more volumes have an $($AutoDagVolumesRootFolderPath) mount point ordered before a $($AutoDagDatabasesRootFolderPath) mount point" - return $false - } - - return $true -} - -#Creates mount points for any Exchange Volumes we are missing -function CreateMissingExVolumes -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.String] - $AutoDagDatabasesRootFolderPath, - - [parameter(Mandatory = $true)] - [System.String] - $AutoDagVolumesRootFolderPath, - - [parameter(Mandatory = $true)] - [System.String[]] - $DiskToDBMap, - - [parameter(Mandatory = $true)] - [System.UInt32] - $SpareVolumeCount, - - [System.Boolean] - $CreateSubfolders = $false, - - [ValidateSet("NTFS","REFS")] - [System.String] - $FileSystem = "NTFS", - - [System.String] - $MinDiskSize = "", - - [ValidateSet("MBR","GPT")] - [System.String] - $PartitioningScheme = "GPT", - - [System.String] - $UnitSize = "64K", - - [System.String] - $VolumePrefix = "EXVOL", - - [System.Int32] - $CurrentVolCount, - - [System.Int32] - $RequiredVolCount - ) - - for ($i = $CurrentVolCount; $i -lt $RequiredVolCount; $i++) - { - if ($i -ne $CurrentVolCount) #Need to update disk info if we've gone through the loop already - { - GetDiskInfo - } - - $firstDisk = FindFirstAvailableDisk -MinDiskSize $MinDiskSize - - if ($firstDisk -ne -1) - { - $firstVolume = FindFirstAvailableVolumeNumber -AutoDagVolumesRootFolderPath $AutoDagVolumesRootFolderPath -VolumePrefix $VolumePrefix - - if ($firstVolume -ne -1) - { - $volPath = Join-Path -Path "$($AutoDagVolumesRootFolderPath)" -ChildPath "$($VolumePrefix)$($firstVolume)" - - PrepareVolume -DiskNumber $firstDisk -Folder $volPath -FileSystem $FileSystem -UnitSize $UnitSize -PartitioningScheme $PartitioningScheme -Label "$($VolumePrefix)$($firstVolume)" - } - else - { - throw "Unable to find a free volume number to use when naming the volume folder" - } - } - else - { - throw "No available disks to assign an Exchange Volume mount point to" - } - } -} - -#Looks for databases that have never had a mount point created, and gives them a mount point -function CreateMissingExDatabases -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.String] - $AutoDagDatabasesRootFolderPath, - - [parameter(Mandatory = $true)] - [System.String] - $AutoDagVolumesRootFolderPath, - - [parameter(Mandatory = $true)] - [System.String[]] - $DiskToDBMap, - - [parameter(Mandatory = $true)] - [System.UInt32] - $SpareVolumeCount, - - [System.Boolean] - $CreateSubfolders = $false, - - [ValidateSet("NTFS","REFS")] - [System.String] - $FileSystem = "NTFS", - - [System.String] - $MinDiskSize = "", - - [ValidateSet("MBR","GPT")] - [System.String] - $PartitioningScheme = "GPT", - - [System.String] - $UnitSize = "64K", - - [System.String] - $VolumePrefix = "EXVOL" - ) - - for ($i = 0; $i -lt $DiskToDBMap.Count; $i++) - { - if ($i -gt 0) #Need to refresh current disk info - { - GetDiskInfo - } - - [string[]]$dbsNeedingMountPoints = @() - - [string[]]$allDBsRequestedForDisk = $DiskToDBMap[$i].Split(',') - - for ($j = 0; $j -lt $allDBsRequestedForDisk.Count; $j++) - { - $current = $allDBsRequestedForDisk[$j] - - $path = Join-Path -Path "$($AutoDagDatabasesRootFolderPath)" -ChildPath "$($current)" - - #We only want to touch datases who have never had a mount point created. After that, AutoReseed will handle it. - if ((Test-Path -Path "$($path)") -eq $false) - { - $dbsNeedingMountPoints += $current - } - else #Since the folder already exists, need to check and error if the mount point doesn't - { - if ((MountPointExists -Path $path) -eq -1) - { - throw "Database '$($current)' already has a folder on disk at '$($path)', but does not have a mount point. This must be manually corrected for xAutoMountPoint to proceed." - } - } - } - - if ($dbsNeedingMountPoints.Count -eq $allDBsRequestedForDisk.Count) #No DB mount points for this disk have been created yet - { - $targetVolume = GetExchangeVolume -AutoDagDatabasesRootFolderPath $AutoDagDatabasesRootFolderPath -AutoDagVolumesRootFolderPath $AutoDagVolumesRootFolderPath -DBsPerDisk $allDBsRequestedForDisk.Count -VolumePrefix $VolumePrefix - } - elseif ($dbsNeedingMountPoints.Count -gt 0) #We just need to create some mount points - { - $existingDB = "" - - #Find a DB that's already had its mount point created - foreach ($db in $allDBsRequestedForDisk) - { - if (($dbsNeedingMountPoints.Contains($db) -eq $false)) - { - $existingDB = $db - break - } - } - - if ($existingDB -ne "") - { - $targetVolume = GetExchangeVolume -AutoDagDatabasesRootFolderPath $AutoDagDatabasesRootFolderPath -AutoDagVolumesRootFolderPath $AutoDagVolumesRootFolderPath -ExistingDB $existingDB -DBsPerDisk $allDBsRequestedForDisk.Count -DBsToCreate $dbsNeedingMountPoints.Count -VolumePrefix $VolumePrefix - } - } - else #All DB's requested for this disk are good. Just continue on in the loop - { - continue - } - - if ($null -ne $targetVolume) - { - if ($targetVolume -ne -1) - { - foreach ($db in $dbsNeedingMountPoints) - { - $path = Join-Path -Path "$($AutoDagDatabasesRootFolderPath)" -ChildPath "$($db)" - - AddMountPoint -VolumeNumber $targetVolume -Folder $path - - if ($CreateSubfolders -eq $true) - { - $dbFolder = Join-Path -Path "$($path)" -ChildPath "$($db).db" - $logFolder = Join-Path -Path "$($path)" -ChildPath "$($db).log" - - if ((Test-Path -LiteralPath "$($dbFolder)") -eq $false) - { - mkdir -Path "$($dbFolder)" - } - - if ((Test-Path -LiteralPath "$($logFolder)") -eq $false) - { - mkdir -Path "$($logFolder)" - } - } - } - } - else - { - throw "Unable to find a volume to place mount points for the following databases: '$($dbsNeedingMountPoints)'" - } - } - } -} - -#Builds a map of the DBs that already exist on disk -function GetDiskToDBMap -{ - param([string]$AutoDagDatabasesRootFolderPath) - - #Get the DB path to a point where we know there will be a trailing \ - $dbpath = Join-Path -Path "$($AutoDagDatabasesRootFolderPath)" -ChildPath "" - - #Will be the return value for DiskToDBMap - [string[]]$dbMap = @() - - #Loop through all existing mount points and figure out which ones are for DB's - foreach ($key in $global:VolumeToMountPointMap.Keys) - { - [string]$mountPoints = "" - - foreach ($mountPoint in $global:VolumeToMountPointMap[$key]) - { - if ($mountPoint.StartsWith($dbpath)) - { - $startIndex = $dbpath.Length - $endIndex = $mountPoint.IndexOf("\", $startIndex) - $dbName = $mountPoint.Substring($startIndex, $endIndex - $startIndex) - - if ($mountPoints -eq "") - { - $mountPoints = $dbName - } - else - { - $mountPoints += ",$($dbName)" - } - } - } - - if ($mountPoints.Length -gt 0) - { - $dbMap += $mountPoints - } - } - - return $dbMap -} - -#Looks for a volume where an Exchange Volume or Database mount point can be added. -#If ExistingDB is not specified, looks for a spare volume that has no mount points yet. -#If ExistingDB is specified, finds the volume number where that DB exists, only if there is room to -#create the requested database mount points. -function GetExchangeVolume -{ - param([string]$AutoDagDatabasesRootFolderPath, [string]$AutoDagVolumesRootFolderPath, [string]$ExistingDB = "", [Uint32]$DBsPerDisk, [Uint32]$DBsToCreate, [string]$VolumePrefix = "EXVOL") - - $targetVol = -1 #Our return variable - - [object[]]$keysSorted = GetSortedExchangeVolumeKeys -AutoDagDatabasesRootFolderPath $AutoDagDatabasesRootFolderPath -AutoDagVolumesRootFolderPath $AutoDagVolumesRootFolderPath -VolumePrefix $VolumePrefix - - #Loop through every volume - foreach ($key in $keysSorted) - { - [int]$intKey = $key - - #Get mount points for this volume - [string[]]$mountPoints = $global:VolumeToMountPointMap[$intKey] - - $hasExVol = $false #Whether any ExVol mount points exist on this disk - $hasExDb = $false #Whether any ExDB mount points exist on this disk - $hasExistingDB = $false #Whether $ExistingDB exists as a mount point on this disk - - #Inspect each individual mount point - foreach($mountPoint in $mountPoints) - { - if ($mountPoint.StartsWith($AutoDagVolumesRootFolderPath)) - { - $hasExVol = $true - } - elseif ($mountPoint.StartsWith($AutoDagDatabasesRootFolderPath)) - { - $hasExDb = $true - - $path = Join-Path -Path "$($AutoDagDatabasesRootFolderPath)" -ChildPath "$($ExistingDB)" - - if ($mountPoint.StartsWith($path)) - { - $hasExistingDB = $true - } - } - } - - if ($ExistingDB -eq "") - { - if ($hasExVol -eq $true -and $hasExDb -eq $false) - { - $targetVol = $intKey - break - } - } - else - { - if ($hasExVol -eq $true -and $hasExistingDB -eq $true) - { - if (($mountPoints.Count + $DBsToCreate) -le ($DBsPerDisk + 1)) - { - $targetVol = $intKey - } - - break - } - } - } - - return $targetVol -} - -function GetSortedExchangeVolumeKeys -{ - param([string]$AutoDagDatabasesRootFolderPath, [string]$AutoDagVolumesRootFolderPath, [string]$VolumePrefix = "EXVOL") - - [string[]]$sortedKeys = @() #The return value - - [string]$pathBeforeVolumeNumber = Join-Path -Path $AutoDagVolumesRootFolderPath -ChildPath $VolumePrefix - - #First extract the actual volume number as an Int from the volume path, then add it to a new hashtable with the same key value - [Hashtable]$tempVolumeToMountPointMap = @{} - - foreach ($key in $global:VolumeToMountPointMap.Keys) - { - $volPath = "" - - #Loop through each mount point on this volume and find the EXVOL mount point - foreach ($value in $VolumeToMountPointMap[$key]) - { - if ($value.StartsWith($pathBeforeVolumeNumber)) - { - $volPath = $value - break - } - } - - if ($volPath.StartsWith($pathBeforeVolumeNumber)) - { - if ($volPath.EndsWith("\") -or $volPath.EndsWith("/")) - { - [string]$exVolNumberStr = $volPath.Substring($pathBeforeVolumeNumber.Length, ($volPath.Length - $pathBeforeVolumeNumber.Length - 1)) - } - else - { - [string]$exVolNumberStr = $volPath.Substring($pathBeforeVolumeNumber.Length, ($volPath.Length - $pathBeforeVolumeNumber.Length)) - } - - [int]$exVolNumber = [int]::Parse($exVolNumberStr) - $tempVolumeToMountPointMap.Add($key, $exVolNumber) - } - } - - #Now go through the volume numbers, and add the keys to the return array in sorted value order - while ($tempVolumeToMountPointMap.Count -gt 0) - { - [object[]]$keys = $tempVolumeToMountPointMap.Keys - [int]$lowestKey = $keys[0] - [int]$lowestValue = $tempVolumeToMountPointMap[$keys[0]] - - for ($i = 1; $i -lt $tempVolumeToMountPointMap.Count; $i++) - { - [int]$currentValue = $tempVolumeToMountPointMap[$keys[$i]] - - if ($currentValue -lt $lowestValue) - { - $lowestKey = $keys[$i] - $lowestValue = $currentValue - } - } - - $sortedKeys += $lowestKey - $tempVolumeToMountPointMap.Remove($lowestKey) - } - - return $sortedKeys -} - -#Finds the lowest disk number that doesn't have any volumes associated, and is larger than the requested size -function FindFirstAvailableDisk -{ - param([string]$MinDiskSize = "") - - $diskNum = -1 - - foreach ($key in $global:DiskToVolumeMap.Keys) - { - if ($global:DiskToVolumeMap[$key].Count -eq 0 -and ($key -lt $diskNum -or $diskNum -eq -1)) - { - if ($MinDiskSize -ne "") - { - [Uint64]$minSize = 0 + $MinDiskSize.Replace(" ", "") - [Uint64]$actualSize = 0 + $global:DiskSizeMap[$key].Replace(" ", "") - - if ($actualSize -gt $minSize) - { - $diskNum = $key - } - } - else - { - $diskNum = $key - } - } - } - - return $diskNum -} - -#Looks in the volumes root folder and finds the first number we can give to a volume folder -#based off of what folders have already been created -function FindFirstAvailableVolumeNumber -{ - param([string]$AutoDagVolumesRootFolderPath, [string]$VolumePrefix) - - if((Test-Path -LiteralPath "$($AutoDagVolumesRootFolderPath)") -eq $false) #If the ExVol folder doesn't already exist, then we can start with 1 - { - return 1 - } - - $currentFolders = Get-ChildItem -LiteralPath "$($AutoDagVolumesRootFolderPath)" | Where-Object {$_.GetType().Name -eq "DirectoryInfo"} | Sort-Object - - for ($i = 1; $i -lt 999; $i++) - { - $existing = $null - $existing = $currentFolders | Where-Object {$_.Name -eq "$($VolumePrefix)$($i)"} - - if ($null -eq $existing) - { - return $i - } - } - - return -1 -} - -#Counts and returns the number of DB's in the disk to db map -function GetDesiredDatabaseCount -{ - param([string[]]$DiskToDBMap) - - $count = 0 - - foreach ($value in $DiskToDBMap) - { - $count += $value.Split(',').Count - } - - return $count -} - -#Checks if a database already has a mountpoint created -function DBHasMountPoint -{ - param([string]$AutoDagDatabasesRootFolderPath, [string]$DB) - - $dbPath = Join-Path -Path "$($AutoDagDatabasesRootFolderPath)" -ChildPath "$($DB)" - - foreach ($key in $global:VolumeToMountPointMap.Keys) - { - foreach ($mountPoint in $global:VolumeToMountPointMap[$key]) - { - if ($mountPoint.StartsWith($dbPath)) - { - return $true - } - } - } - - return $false -} - -#Gets the count of in use mount points matching the given critera -function GetInUseMountPointCount -{ - param([string]$RootFolder) - - $count = 0 - - foreach ($key in $global:VolumeToMountPointMap.Keys) - { - foreach ($mountPoint in $global:VolumeToMountPointMap[$key]) - { - if ($mountPoint.StartsWith($RootFolder)) - { - $count++ - } - } - } - - return $count -} - -#Checks all volumes, and sees if any of them have ExchangeVolume mount points that show up before other (like ExchangeDatabase) mount points. -#If so, it returns the volume number. If not, it returns -1 -function VolumeMountPointNotLastInList -{ - param([string]$AutoDagVolumesRootFolderPath) - - foreach ($key in $global:VolumeToMountPointMap.Keys) - { - $values = $global:VolumeToMountPointMap[$key] - - if ($null -ne $values) - { - for ($i = 0; $i -lt $values.Count; $i++) - { - if ($values[$i].StartsWith($AutoDagVolumesRootFolderPath) -eq $true -and $i -lt ($values.Count - 1)) - { - return $key - } - } - } - } - - return -1 -} - -#For volumes that have multiple mount points including an ExchangeVolume mount point, sends removes and re-adds the ExchangeVolume -#mount point so that it is at the end of the list of mount points -function SendVolumeMountPointToEndOfList -{ - [CmdletBinding()] - param([string]$AutoDagVolumesRootFolderPath, [Int32]$VolumeNumber) - - $values = $global:VolumeToMountPointMap[$VolumeNumber] - - foreach ($folderName in $values) - { - if ($folderName.StartsWith($AutoDagVolumesRootFolderPath)) - { - if ($folderName.EndsWith("\")) - { - $folderName = $folderName.Substring(0, $folderName.Length - 1) - } - - StartDiskpart -Commands "select volume $($VolumeNumber)","remove mount=`"$($folderName)`"","assign mount=`"$($folderName)`"" -VerbosePreference $VerbosePreference | Out-Null - break - } - } -} - -#Takes an empty disk, initalizes and formats it, and gives it an ExchangeVolume mount point -function PrepareVolume -{ - [CmdletBinding()] - param([int]$DiskNumber, [string]$Folder, [ValidateSet("NTFS","REFS")][string]$FileSystem = "NTFS", [string]$UnitSize, [string]$PartitioningScheme, [string]$Label) - - #Initialize the disk and put in MBR format - StartDiskpart -Commands "select disk $($DiskNumber)","clean" -VerbosePreference $VerbosePreference | Out-Null - StartDiskpart -Commands "select disk $($DiskNumber)","online disk" -VerbosePreference $VerbosePreference | Out-Null - StartDiskpart -Commands "select disk $($DiskNumber)","attributes disk clear readonly","convert MBR" -VerbosePreference $VerbosePreference | Out-Null - StartDiskpart -Commands "select disk $($DiskNumber)","offline disk" -VerbosePreference $VerbosePreference | Out-Null - - #Online the disk - StartDiskpart -Commands "select disk $($DiskNumber)","attributes disk clear readonly","online disk" -VerbosePreference $VerbosePreference | Out-Null - - #Convert to GPT if requested - if ($PartitioningScheme -eq "GPT") - { - StartDiskpart -Commands "select disk $($DiskNumber)","convert GPT noerr" -VerbosePreference $VerbosePreference | Out-Null - } - - #Create the directory if it doesn't exist - if ((Test-Path $Folder) -eq $False) - { - mkdir -Path "$($Folder)" | Out-Null - } - - #Create the partition and format the drive - if ($FileSystem -eq "NTFS") - { - $formatString = "Format FS=$($FileSystem) UNIT=$($UnitSize) Label=$($Label) QUICK" - - StartDiskpart -Commands "select disk $($DiskNumber)","create partition primary","$($formatString)","assign mount=`"$($Folder)`"" -VerbosePreference $VerbosePreference | Out-Null - } - else #if ($FileSystem -eq "REFS") - { - StartDiskpart -Commands "select disk $($DiskNumber)","create partition primary" -VerbosePreference $VerbosePreference | Out-Null - - if ($UnitSize.ToLower().EndsWith("k")) - { - $UnitSizeBytes = [UInt64]::Parse($UnitSize.Substring(0, $UnitSize.Length - 1)) * 1024 - } - else - { - $UnitSizeBytes = $UnitSize - } - - Write-Verbose "Sleeping for 15 seconds after partition creation." - - Start-Sleep -Seconds 15 - - Get-Partition -DiskNumber $DiskNumber -PartitionNumber 2| Format-Volume -AllocationUnitSize $UnitSizeBytes -FileSystem REFS -NewFileSystemLabel $Label -SetIntegrityStreams:$false -Confirm:$false - Add-PartitionAccessPath -DiskNumber $DiskNumber -PartitionNumber 2 -AccessPath $Folder -PassThru | Set-Partition -NoDefaultDriveLetter $true - } -} - -#Adds a mount point to an existing volume -function AddMountPoint -{ - [CmdletBinding()] - param([int]$VolumeNumber, [string]$Folder) - - #Create the directory if it doesn't exist - if ((Test-Path $Folder) -eq $False) - { - mkdir -Path "$($Folder)" | Out-Null - } - - StartDiskpart -Commands "select volume $($VolumeNumber)","assign mount=`"$($Folder)`"" -VerbosePreference $VerbosePreference | Out-Null -} - - -Export-ModuleMember -Function *-TargetResource - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchAutoMountPoint/MSFT_xExchAutoMountPoint.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchAutoMountPoint/MSFT_xExchAutoMountPoint.schema.mof deleted file mode 100644 index 75555379..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchAutoMountPoint/MSFT_xExchAutoMountPoint.schema.mof +++ /dev/null @@ -1,20 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xExchAutoMountPoint")] -class MSFT_xExchAutoMountPoint : OMI_BaseResource -{ - [Key] String Identity; //The name of the server. Not actually used for anything - [Required] String AutoDagDatabasesRootFolderPath; //The parent folder for Exchange database mount point folders - [Required] String AutoDagVolumesRootFolderPath; //The parent folder for Exchange volume mount point folders - [Required] String DiskToDBMap[]; //An array of strings containing the databases for each disk. Databases on the same disk should be in the same string, and comma separated. Example: "DB1,DB2","DB3,DB4". This puts DB1 and DB2 on one disk, and DB3 and DB4 on another. - [Required] Uint32 SpareVolumeCount; //How many spare volumes will be available - [Write] Boolean EnsureExchangeVolumeMountPointIsLast; - [Write] Boolean CreateSubfolders; //Defaults to $false. If $true, specifies that DBNAME.db and DBNAME.log subfolders should be automatically created underneath the ExchangeDatabase mount points - [Write, ValueMap{"NTFS","REFS"}, Values{"NTFS","REFS"}] String FileSystem; //The file system to use when formatting the volume. Defaults to NTFS. - [Write] String MinDiskSize; //The minimum size of a disk to consider using. Defaults to none. Should be in a format like "1024MB" or "1TB". - [Write, ValueMap{"MBR","GPT"}, Values{"MBR","GPT"}] String PartitioningScheme; //The partitioning scheme for the volume. Defaults to GPT. - [Write] String UnitSize; //The unit size to use when formatting the disk. Defaults to 64k. - [Write] String VolumePrefix; //The prefix to give to Exchange Volume folders. Defaults to EXVOL -}; - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchAutodiscoverVirtualDirectory/MSFT_xExchAutodiscoverVirtualDirectory.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchAutodiscoverVirtualDirectory/MSFT_xExchAutodiscoverVirtualDirectory.psm1 deleted file mode 100644 index b460f6e6..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchAutodiscoverVirtualDirectory/MSFT_xExchAutodiscoverVirtualDirectory.psm1 +++ /dev/null @@ -1,246 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscTestsPresent", "")] -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscExamplesPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Identity, - - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $BasicAuthentication, - - [System.Boolean] - $DigestAuthentication, - - [System.String] - $DomainController, - - [System.Boolean] - $WindowsAuthentication, - - [System.Boolean] - $WSSecurityAuthentication - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad 'Get-AutodiscoverVirtualDirectory' -VerbosePreference $VerbosePreference - - $autoDVdir = Get-AutodiscoverVirtualDirectoryWithCorrectParams @PSBoundParameters - - if ($null -ne $autoDVdir) - { - $returnValue = @{ - Identity = $Identity - BasicAuthentication = $autoDVdir.BasicAuthentication - DigestAuthentication = $autoDVdir.DigestAuthentication - WindowsAuthentication = $autoDVdir.WindowsAuthentication - WSSecurityAuthentication = $autoDVdir.WSSecurityAuthentication - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Identity, - - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $BasicAuthentication, - - [System.Boolean] - $DigestAuthentication, - - [System.String] - $DomainController, - - [System.Boolean] - $WindowsAuthentication, - - [System.Boolean] - $WSSecurityAuthentication - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad 'Set-AutodiscoverVirtualDirectory' -VerbosePreference $VerbosePreference - - #Ensure an empty string is $null and not a string - SetEmptyStringParamsToNull -PSBoundParametersIn $PSBoundParameters - - #Remove Credential parameter does not exist on Set-OwaVirtualDirectory - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove 'Credential','AllowServiceRestart' - - Set-AutodiscoverVirtualDirectory @PSBoundParameters - - if ($AllowServiceRestart) - { - Write-Verbose "Recycling MSExchangeAutodiscoverAppPool" - RestartAppPoolIfExists -Name MSExchangeAutodiscoverAppPool - } - else - { - Write-Warning "The configuration will not take effect until MSExchangeAutodiscoverAppPool is manually recycled." - } -} - - -function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Identity, - - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $BasicAuthentication, - - [System.Boolean] - $DigestAuthentication, - - [System.String] - $DomainController, - - [System.Boolean] - $WindowsAuthentication, - - [System.Boolean] - $WSSecurityAuthentication - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad 'Get-AutodiscoverVirtualDirectory' -VerbosePreference $VerbosePreference - - #Ensure an empty string is $null and not a string - SetEmptyStringParamsToNull -PSBoundParametersIn $PSBoundParameters - - $autoDVdir = Get-AutodiscoverVirtualDirectoryWithCorrectParams @PSBoundParameters - - if ($null -eq $autoDVdir) - { - return $false - } - else - { - if (!(VerifySetting -Name "BasicAuthentication" -Type "Boolean" -ExpectedValue $BasicAuthentication -ActualValue $autoDVdir.BasicAuthentication -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "DigestAuthentication" -Type "Boolean" -ExpectedValue $DigestAuthentication -ActualValue $autoDVdir.DigestAuthentication -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "WindowsAuthentication" -Type "Boolean" -ExpectedValue $WindowsAuthentication -ActualValue $autoDVdir.WindowsAuthentication -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "WSSecurityAuthentication" -Type "Boolean" -ExpectedValue $WSSecurityAuthentication -ActualValue $autoDVdir.WSSecurityAuthentication -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - } - - #If the code made it this far all properties are in a desired state - return $true -} - -function Get-AutodiscoverVirtualDirectoryWithCorrectParams -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "")] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Identity, - - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $BasicAuthentication, - - [System.Boolean] - $DigestAuthentication, - - [System.String] - $DomainController, - - [System.Boolean] - $WindowsAuthentication, - - [System.Boolean] - $WSSecurityAuthentication - ) - - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Identity","DomainController" - - return (Get-AutodiscoverVirtualDirectory @PSBoundParameters) -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchAutodiscoverVirtualDirectory/MSFT_xExchAutodiscoverVirtualDirectory.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchAutodiscoverVirtualDirectory/MSFT_xExchAutodiscoverVirtualDirectory.schema.mof deleted file mode 100644 index 0746340c..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchAutodiscoverVirtualDirectory/MSFT_xExchAutodiscoverVirtualDirectory.schema.mof +++ /dev/null @@ -1,19 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xExchAutodiscoverVirtualDirectory")] -class MSFT_xExchAutodiscoverVirtualDirectory : OMI_BaseResource -{ - [Key] String Identity; //The Identity of the Autodiscover Virtual Directory - [Required, EmbeddedInstance("MSFT_Credential")] String Credential; //Credentials used to establish a remote Powershell session to Exchange - [Write] Boolean AllowServiceRestart; //Whether it is OK to recycle the app pool after making changes. Defaults to $true. - - //Remaining properties correspond directly to Set-AutodiscoverVirtualDirectory parameters - //http://technet.microsoft.com/en-us/library/aa998601(v=exchg.150).aspx - [Write] Boolean BasicAuthentication; - [Write] Boolean DigestAuthentication; - [Write] String DomainController; - [Write] Boolean WindowsAuthentication; - [Write] Boolean WSSecurityAuthentication; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchClientAccessServer/MSFT_xExchClientAccessServer.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchClientAccessServer/MSFT_xExchClientAccessServer.psm1 deleted file mode 100644 index 561e158c..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchClientAccessServer/MSFT_xExchClientAccessServer.psm1 +++ /dev/null @@ -1,291 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscTestsPresent", "")] -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscExamplesPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - [ValidateNotNullOrEmpty()] - $AlternateServiceAccountCredential, - - [System.String] - $AutoDiscoverServiceInternalUri, - - [System.String[]] - $AutoDiscoverSiteScope, - - [System.Boolean] - $CleanUpInvalidAlternateServiceAccountCredentials, - - [System.String] - $DomainController, - - [System.Boolean] - $RemoveAlternateServiceAccountCredentials - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-ClientAccessServ*" -VerbosePreference $VerbosePreference - - $cas = GetClientAccessServer @PSBoundParameters - - if ($null -ne $cas) - { - if ($null -ne $cas.AutoDiscoverSiteScope) - { - $sites = $cas.AutoDiscoverSiteScope.ToArray() - } - $returnValue = @{ - Identity = $Identity - AutoDiscoverServiceInternalUri = $cas.AutoDiscoverServiceInternalUri - AutoDiscoverSiteScope = $sites - CleanUpInvalidAlternateServiceAccountCredentials = $CleanUpInvalidAlternateServiceAccountCredentials - DomainController = $DomainController - RemoveAlternateServiceAccountCredentials = $RemoveAlternateServiceAccountCredentials - } - if ($cas.AlternateServiceAccountConfiguration.EffectiveCredentials.Count -gt 0) - { - $UserName = ($cas.AlternateServiceAccountConfiguration.EffectiveCredentials | sort WhenAddedUTC | select -Last 1).Credential.UserName - $PassWord = ($cas.AlternateServiceAccountConfiguration.EffectiveCredentials | sort WhenAddedUTC | select -Last 1).Credential.GetNetworkCredential().Password - $returnValue.Add("AlternateServiceAccountCredential","UserName:$UserName Password:$PassWord") - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - [ValidateNotNullOrEmpty()] - $AlternateServiceAccountCredential, - - [System.String] - $AutoDiscoverServiceInternalUri, - - [System.String[]] - $AutoDiscoverSiteScope, - - [System.Boolean] - $CleanUpInvalidAlternateServiceAccountCredentials, - - [System.String] - $DomainController, - - [System.Boolean] - $RemoveAlternateServiceAccountCredentials - ) - - #check for ambiguous parameter - if (($AlternateServiceAccountCredential -and $RemoveAlternateServiceAccountCredentials) -or ($CleanUpInvalidAlternateServiceAccountCredentials -and $RemoveAlternateServiceAccountCredentials)) - { - throw "Ambiguous parameter detected! Don't combine AlternateServiceAccountCredential with RemoveAlternateServiceAccountCredentials or CleanUpInvalidAlternateServiceAccountCredentials with RemoveAlternateServiceAccountCredentials!" - } - #check if credentials are in correct format DOMAIN\USERNAME - $parts = @($AlternateServiceAccountCredential.Username.Split('\')) - if ($parts.Count -ne 2 -or $parts[0] -eq '') - { - throw "The username must be fully qualified!" - } - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Set-ClientAccessServ*" -VerbosePreference $VerbosePreference - - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "Credential" - - SetEmptyStringParamsToNull -PSBoundParametersIn $PSBoundParameters - - $serverVersion = GetExchangeVersion -ThrowIfUnknownVersion $true - - if ($serverVersion -eq "2016") - { - Set-ClientAccessService @PSBoundParameters - } - elseif ($serverVersion -eq "2013") - { - Set-ClientAccessServer @PSBoundParameters - } -} - - -function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - [ValidateNotNullOrEmpty()] - $AlternateServiceAccountCredential, - - [System.String] - $AutoDiscoverServiceInternalUri, - - [System.String[]] - $AutoDiscoverSiteScope, - - [System.Boolean] - $CleanUpInvalidAlternateServiceAccountCredentials, - - [System.String] - $DomainController, - - [System.Boolean] - $RemoveAlternateServiceAccountCredentials - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-ClientAccessServ*" -VerbosePreference $VerbosePreference - - $cas = GetClientAccessServer @PSBoundParameters - - $serverVersion = GetExchangeVersion -ThrowIfUnknownVersion $true - - if ($null -eq $cas) - { - return $false - } - else - { - if (!(VerifySetting -Name "AutoDiscoverServiceInternalUri" -Type "String" -ExpectedValue $AutoDiscoverServiceInternalUri -ActualValue $cas.AutoDiscoverServiceInternalUri.AbsoluteUri -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "AutoDiscoverSiteScope" -Type "Array" -ExpectedValue $AutoDiscoverSiteScope -ActualValue $cas.AutoDiscoverSiteScope -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "AlternateServiceAccountCredential" -Type "PSCredential" -ExpectedValue $AlternateServiceAccountCredential -ActualValue ($cas.AlternateServiceAccountConfiguration.EffectiveCredentials | sort WhenAddedUTC | select -Last 1).Credential $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - if ($CleanUpInvalidAlternateServiceAccountCredentials) - { - return $false - } - if ($RemoveAlternateServiceAccountCredentials -and ($cas.AlternateServiceAccountConfiguration.EffectiveCredentials.Count -gt 0)) - { - return $false - } - } - - return $true -} - -#Runs Get-ClientAcccessServer, only specifying Identity, and optionally DomainController -function GetClientAccessServer -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - [ValidateNotNullOrEmpty()] - $AlternateServiceAccountCredential, - - [System.String] - $AutoDiscoverServiceInternalUri, - - [System.String[]] - $AutoDiscoverSiteScope, - - [System.Boolean] - $CleanUpInvalidAlternateServiceAccountCredentials, - - [System.String] - $DomainController, - - [System.Boolean] - $RemoveAlternateServiceAccountCredentials - ) - - #Remove params we don't want to pass into the next command - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Identity","DomainController" - - $serverVersion = GetExchangeVersion -ThrowIfUnknownVersion $true - if (($null -ne $AlternateServiceAccountCredential) -or ($RemoveAlternateServiceAccountCredentials)) - { - $PSBoundParameters.Add('IncludeAlternateServiceAccountCredentialPassword',$true) - } - - if ($serverVersion -eq "2016") - { - return (Get-ClientAccessService @PSBoundParameters) - } - elseif ($serverVersion -eq "2013") - { - return (Get-ClientAccessServer @PSBoundParameters) - } -} - - -Export-ModuleMember -Function *-TargetResource - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchClientAccessServer/MSFT_xExchClientAccessServer.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchClientAccessServer/MSFT_xExchClientAccessServer.schema.mof deleted file mode 100644 index bf9e8415..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchClientAccessServer/MSFT_xExchClientAccessServer.schema.mof +++ /dev/null @@ -1,19 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xExchClientAccessServer")] -class MSFT_xExchClientAccessServer : OMI_BaseResource -{ - [Key] String Identity; //The hostname of the Client Access Server - [Required, EmbeddedInstance("MSFT_Credential")] String Credential; //Credentials used to establish a remote Powershell session to Exchange - - //Remaining properties correspond directly to Set-ClientAccessServer parameters - //http://technet.microsoft.com/en-us/library/bb125157(v=exchg.150).aspx - [Write] String AutoDiscoverServiceInternalUri; - [Write] String AutoDiscoverSiteScope[]; - [Write] String DomainController; - [Write, EmbeddedInstance("MSFT_Credential")] String AlternateServiceAccountCredential; - [Write] Boolean CleanUpInvalidAlternateServiceAccountCredentials; - [Write] Boolean RemoveAlternateServiceAccountCredentials; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchDatabaseAvailabilityGroup/MSFT_xExchDatabaseAvailabilityGroup.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchDatabaseAvailabilityGroup/MSFT_xExchDatabaseAvailabilityGroup.psm1 deleted file mode 100644 index 940a3f35..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchDatabaseAvailabilityGroup/MSFT_xExchDatabaseAvailabilityGroup.psm1 +++ /dev/null @@ -1,675 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscTestsPresent", "")] -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscExamplesPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [System.Int32] - $AutoDagTotalNumberOfServers, - - [System.String] - $AlternateWitnessDirectory, - - [System.String] - $AlternateWitnessServer, - - [System.Boolean] - $AutoDagAutoRedistributeEnabled, - - [System.Boolean] - $AutoDagAutoReseedEnabled, - - [System.Int32] - $AutoDagDatabaseCopiesPerDatabase, - - [System.Int32] - $AutoDagDatabaseCopiesPerVolume, - - [System.String] - $AutoDagDatabasesRootFolderPath, - - [System.Boolean] - $AutoDagDiskReclaimerEnabled, - - [System.Int32] - $AutoDagTotalNumberOfDatabases, - - [System.String] - $AutoDagVolumesRootFolderPath, - - [System.String[]] - $DatabaseAvailabilityGroupIpAddresses, - - [ValidateSet("Off","DagOnly")] - [System.String] - $DatacenterActivationMode, - - [System.String] - $DomainController, - - [ValidateSet("NTFS","ReFS")] - [System.String] - $FileSystem, - - [System.Boolean] - $ManualDagNetworkConfiguration, - - [ValidateSet("Disabled","Enabled","InterSubnetOnly","SeedOnly")] - [System.String] - $NetworkCompression, - - [ValidateSet("Disabled","Enabled","InterSubnetOnly","SeedOnly")] - [System.String] - $NetworkEncryption, - - [System.String] - $PreferenceMoveFrequency, - - [System.Boolean] - $ReplayLagManagerEnabled, - - [System.UInt16] - $ReplicationPort, - - [System.Boolean] - $SkipDagValidation, - - [System.String] - $WitnessDirectory, - - [System.String] - $WitnessServer - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Name" = $Name} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-DatabaseAvailabilityGroup" -VerbosePreference $VerbosePreference - - $dag = GetDatabaseAvailabilityGroup @PSBoundParameters - - if ($null -ne $dag) - { - $returnValue = @{ - Name = $Name - AlternateWitnessDirectory = $dag.AlternateWitnessDirectory - AlternateWitnessServer = $dag.AlternateWitnessServer - AutoDagAutoReseedEnabled = $dag.AutoDagAutoReseedEnabled - AutoDagDatabaseCopiesPerDatabase = $dag.AutoDagDatabaseCopiesPerDatabase - AutoDagDatabaseCopiesPerVolume = $dag.AutoDagDatabaseCopiesPerVolume - AutoDagDatabasesRootFolderPath = $dag.AutoDagDatabasesRootFolderPath - AutoDagDiskReclaimerEnabled = $dag.AutoDagDiskReclaimerEnabled - AutoDagTotalNumberOfDatabases = $dag.AutoDagTotalNumberOfDatabases - AutoDagTotalNumberOfServers = $dag.AutoDagTotalNumberOfServers - AutoDagVolumesRootFolderPath = $dag.AutoDagVolumesRootFolderPath - DatabaseAvailabilityGroupIpAddresses = $dag.DatabaseAvailabilityGroupIpAddresses - DatacenterActivationMode = $dag.DatacenterActivationMode - ManualDagNetworkConfiguration = $dag.ManualDagNetworkConfiguration - NetworkCompression = $dag.NetworkCompression - NetworkEncryption = $dag.NetworkEncryption - ReplayLagManagerEnabled = $dag.ReplayLagManagerEnabled - ReplicationPort = $dag.ReplicationPort - WitnessDirectory = $dag.WitnessDirectory - WitnessServer = $dag.WitnessServer - } - - $serverVersion = GetExchangeVersion - - if ($serverVersion -eq "2016") - { - $returnValue.Add("AutoDagAutoRedistributeEnabled", $dag.AutoDagAutoRedistributeEnabled) - $returnValue.Add("FileSystem", $dag.FileSystem) - $returnValue.Add("PreferenceMoveFrequency", $dag.PreferenceMoveFrequency) - } - } - - $returnValue -} - -function Set-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [System.Int32] - $AutoDagTotalNumberOfServers, - - [System.String] - $AlternateWitnessDirectory, - - [System.String] - $AlternateWitnessServer, - - [System.Boolean] - $AutoDagAutoRedistributeEnabled, - - [System.Boolean] - $AutoDagAutoReseedEnabled, - - [System.Int32] - $AutoDagDatabaseCopiesPerDatabase, - - [System.Int32] - $AutoDagDatabaseCopiesPerVolume, - - [System.String] - $AutoDagDatabasesRootFolderPath, - - [System.Boolean] - $AutoDagDiskReclaimerEnabled, - - [System.Int32] - $AutoDagTotalNumberOfDatabases, - - [System.String] - $AutoDagVolumesRootFolderPath, - - [System.String[]] - $DatabaseAvailabilityGroupIpAddresses, - - [ValidateSet("Off","DagOnly")] - [System.String] - $DatacenterActivationMode, - - [System.String] - $DomainController, - - [ValidateSet("NTFS","ReFS")] - [System.String] - $FileSystem, - - [System.Boolean] - $ManualDagNetworkConfiguration, - - [ValidateSet("Disabled","Enabled","InterSubnetOnly","SeedOnly")] - [System.String] - $NetworkCompression, - - [ValidateSet("Disabled","Enabled","InterSubnetOnly","SeedOnly")] - [System.String] - $NetworkEncryption, - - [System.String] - $PreferenceMoveFrequency, - - [System.Boolean] - $ReplayLagManagerEnabled, - - [System.UInt16] - $ReplicationPort, - - [System.Boolean] - $SkipDagValidation, - - [System.String] - $WitnessDirectory, - - [System.String] - $WitnessServer - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Name" = $Name} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-DatabaseAvailabilityGroup","Set-DatabaseAvailabilityGroup","New-DatabaseAvailabilityGroup" -VerbosePreference $VerbosePreference - - #create array of Exchange 2016 only parameters - [array]$Exchange2016Only = 'AutoDagAutoRedistributeEnabled','FileSystem','PreferenceMoveFrequency' - - $serverVersion = GetExchangeVersion - - if ($serverVersion -eq '2013') - { - foreach ($Exchange2016Parameter in $Exchange2016Only) - { - #Check for non-existent parameters in Exchange 2013 - RemoveVersionSpecificParameters -PSBoundParametersIn $PSBoundParameters -ParamName "$($Exchange2016Parameter)" -ResourceName "xExchDatabaseAvailabilityGroup" -ParamExistsInVersion "2016" - } - } - elseif ($serverVersion -eq '2016') - { - Write-Verbose -Message "No need to remove parameters" - } - else - { - Write-Verbose -Message "Could not detect Exchange version" - } - - SetEmptyStringParamsToNull -PSBoundParametersIn $PSBoundParameters - - $dag = GetDatabaseAvailabilityGroup @PSBoundParameters - - #We need to create the DAG - if ($null -eq $dag) - { - #Create a copy of the original parameters - $originalPSBoundParameters = @{} + $PSBoundParameters - - #Remove parameters that don't exist in New-DatabaseAvailabilityGroup - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Name","DatabaseAvailabilityGroupIpAddresses","WitnessDirectory","WitnessServer","DomainController" - - #Create the DAG - $dag = New-DatabaseAvailabilityGroup @PSBoundParameters - - if ($null -ne $dag) - { - #Add original props back - AddParameters -PSBoundParametersIn $PSBoundParameters -ParamsToAdd $originalPSBoundParameters - } - else - { - throw "Failed to create new DAG." - } - } - - #Modify existing DAG - if ($null -ne $dag) - { - #convert Name to Identity, and Remove Credential - AddParameters -PSBoundParametersIn $PSBoundParameters -ParamsToAdd @{"Identity" = $PSBoundParameters["Name"]} - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "Name","Credential" - - #If not all members are in DAG yet, remove params that require them to be - if ($dag.Servers.Count -lt $AutoDagTotalNumberOfServers) - { - if ($PSBoundParameters.ContainsKey("DatacenterActivationMode") -and $DatacenterActivationMode -like "DagOnly") - { - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "DatacenterActivationMode" - } - } - - Set-DatabaseAvailabilityGroup @PSBoundParameters - } -} - - -function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [System.Int32] - $AutoDagTotalNumberOfServers, - - [System.String] - $AlternateWitnessDirectory, - - [System.String] - $AlternateWitnessServer, - - [System.Boolean] - $AutoDagAutoRedistributeEnabled, - - [System.Boolean] - $AutoDagAutoReseedEnabled, - - [System.Int32] - $AutoDagDatabaseCopiesPerDatabase, - - [System.Int32] - $AutoDagDatabaseCopiesPerVolume, - - [System.String] - $AutoDagDatabasesRootFolderPath, - - [System.Boolean] - $AutoDagDiskReclaimerEnabled, - - [System.Int32] - $AutoDagTotalNumberOfDatabases, - - [System.String] - $AutoDagVolumesRootFolderPath, - - [System.String[]] - $DatabaseAvailabilityGroupIpAddresses, - - [ValidateSet("Off","DagOnly")] - [System.String] - $DatacenterActivationMode, - - [System.String] - $DomainController, - - [ValidateSet("NTFS","ReFS")] - [System.String] - $FileSystem, - - [System.Boolean] - $ManualDagNetworkConfiguration, - - [ValidateSet("Disabled","Enabled","InterSubnetOnly","SeedOnly")] - [System.String] - $NetworkCompression, - - [ValidateSet("Disabled","Enabled","InterSubnetOnly","SeedOnly")] - [System.String] - $NetworkEncryption, - - [System.String] - $PreferenceMoveFrequency, - - [System.Boolean] - $ReplayLagManagerEnabled, - - [System.UInt16] - $ReplicationPort, - - [System.Boolean] - $SkipDagValidation, - - [System.String] - $WitnessDirectory, - - [System.String] - $WitnessServer - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Name" = $Name} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-DatabaseAvailabilityGroup" -VerbosePreference $VerbosePreference - - #create array of Exchange 2016 only parameters - [array]$Exchange2016Only = 'AutoDagAutoRedistributeEnabled','FileSystem','PreferenceMoveFrequency' - - $serverVersion = GetExchangeVersion - - if ($serverVersion -eq '2013') - { - foreach ($Exchange2016Parameter in $Exchange2016Only) - { - #Check for non-existent parameters in Exchange 2013 - RemoveVersionSpecificParameters -PSBoundParametersIn $PSBoundParameters -ParamName "$($Exchange2016Parameter)" -ResourceName "xExchDatabaseAvailabilityGroup" -ParamExistsInVersion "2016" - } - } - elseif ($serverVersion -eq '2016') - { - Write-Verbose -Message "No need to remove parameters" - } - else - { - Write-Verbose -Message "Could not detect Exchange version" - } - - $dag = GetDatabaseAvailabilityGroup @PSBoundParameters - - if ($null -eq $dag) - { - return $false - } - else - { - if (!(VerifySetting -Name "AlternateWitnessDirectory" -Type "String" -ExpectedValue $AlternateWitnessDirectory -ActualValue $dag.AlternateWitnessDirectory -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "AlternateWitnessServer" -Type "String" -ExpectedValue $AlternateWitnessServer -ActualValue $dag.AlternateWitnessServer -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "AutoDagAutoRedistributeEnabled" -Type "Boolean" -ExpectedValue $AutoDagAutoRedistributeEnabled -ActualValue $dag.AutoDagAutoRedistributeEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "AutoDagAutoReseedEnabled" -Type "Boolean" -ExpectedValue $AutoDagAutoReseedEnabled -ActualValue $dag.AutoDagAutoReseedEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "AutoDagDatabaseCopiesPerDatabase" -Type "Int" -ExpectedValue $AutoDagDatabaseCopiesPerDatabase -ActualValue $dag.AutoDagDatabaseCopiesPerDatabase -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "AutoDagDatabaseCopiesPerVolume" -Type "Int" -ExpectedValue $AutoDagDatabaseCopiesPerVolume -ActualValue $dag.AutoDagDatabaseCopiesPerVolume -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "AutoDagDatabasesRootFolderPath" -Type "String" -ExpectedValue $AutoDagDatabasesRootFolderPath -ActualValue $dag.AutoDagDatabasesRootFolderPath -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "AutoDagDiskReclaimerEnabled" -Type "Boolean" -ExpectedValue $AutoDagDiskReclaimerEnabled -ActualValue $dag.AutoDagDiskReclaimerEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "AutoDagTotalNumberOfDatabases" -Type "Int" -ExpectedValue $AutoDagTotalNumberOfDatabases -ActualValue $dag.AutoDagTotalNumberOfDatabases -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "AutoDagTotalNumberOfServers" -Type "Int" -ExpectedValue $AutoDagTotalNumberOfServers -ActualValue $dag.AutoDagTotalNumberOfServers -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "AutoDagVolumesRootFolderPath" -Type "String" -ExpectedValue $AutoDagVolumesRootFolderPath -ActualValue $dag.AutoDagVolumesRootFolderPath -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "DatabaseAvailabilityGroupIpAddresses" -Type "Array" -ExpectedValue $DatabaseAvailabilityGroupIpAddresses -ActualValue $dag.DatabaseAvailabilityGroupIpAddresses -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "FileSystem" -Type "String" -ExpectedValue $FileSystem -ActualValue $dag.FileSystem -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ManualDagNetworkConfiguration" -Type "Boolean" -ExpectedValue $ManualDagNetworkConfiguration -ActualValue $dag.ManualDagNetworkConfiguration -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "NetworkCompression" -Type "String" -ExpectedValue $NetworkCompression -ActualValue $dag.NetworkCompression -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "NetworkEncryption" -Type "String" -ExpectedValue $NetworkEncryption -ActualValue $dag.NetworkEncryption -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "NetworkEncryption" -Type "String" -ExpectedValue $NetworkEncryption -ActualValue $dag.NetworkEncryption -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "PreferenceMoveFrequency" -Type "Timespan" -ExpectedValue $PreferenceMoveFrequency -ActualValue $dag.PreferenceMoveFrequency -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - #Replication port only comes back correctly from Get-DatabaseAvailabilityGroup if it has been set when there is 1 or more servers in the DAG - if ($dag.Servers.Count -gt 0) - { - if (!(VerifySetting -Name "ReplicationPort" -Type "Int" -ExpectedValue $ReplicationPort -ActualValue $dag.ReplicationPort -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - } - - if (!(VerifySetting -Name "WitnessDirectory" -Type "String" -ExpectedValue $WitnessDirectory -ActualValue $dag.WitnessDirectory -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "WitnessServer" -Type "String" -ExpectedValue $WitnessServer -ActualValue $dag.WitnessServer -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - #Verify these props only if all members are in the DAG - if ($dag.Servers.Count -ge $AutoDagTotalNumberOfServers) - { - if (!(VerifySetting -Name "DatacenterActivationMode" -Type "String" -ExpectedValue $DatacenterActivationMode -ActualValue $dag.DatacenterActivationMode -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - } - } - - return $true -} - -#Runs Get-DatabaseAvailabilityGroup, only specifying Identity, ErrorAction, and optionally DomainController -function GetDatabaseAvailabilityGroup -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [System.Int32] - $AutoDagTotalNumberOfServers, - - [System.String] - $AlternateWitnessDirectory, - - [System.String] - $AlternateWitnessServer, - - [System.Boolean] - $AutoDagAutoRedistributeEnabled, - - [System.Boolean] - $AutoDagAutoReseedEnabled, - - [System.Int32] - $AutoDagDatabaseCopiesPerDatabase, - - [System.Int32] - $AutoDagDatabaseCopiesPerVolume, - - [System.String] - $AutoDagDatabasesRootFolderPath, - - [System.Boolean] - $AutoDagDiskReclaimerEnabled, - - [System.Int32] - $AutoDagTotalNumberOfDatabases, - - [System.String] - $AutoDagVolumesRootFolderPath, - - [System.String[]] - $DatabaseAvailabilityGroupIpAddresses, - - [ValidateSet("Off","DagOnly")] - [System.String] - $DatacenterActivationMode, - - [System.String] - $DomainController, - - [ValidateSet("NTFS","ReFS")] - [System.String] - $FileSystem, - - [System.Boolean] - $ManualDagNetworkConfiguration, - - [ValidateSet("Disabled","Enabled","InterSubnetOnly","SeedOnly")] - [System.String] - $NetworkCompression, - - [ValidateSet("Disabled","Enabled","InterSubnetOnly","SeedOnly")] - [System.String] - $NetworkEncryption, - - [System.String] - $PreferenceMoveFrequency, - - [System.Boolean] - $ReplayLagManagerEnabled, - - [System.UInt16] - $ReplicationPort, - - [System.Boolean] - $SkipDagValidation, - - [System.String] - $WitnessDirectory, - - [System.String] - $WitnessServer - ) - - AddParameters -PSBoundParametersIn $PSBoundParameters -ParamsToAdd @{"Identity" = $PSBoundParameters["Name"]; "ErrorAction" = "SilentlyContinue"} - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Identity","ErrorAction","DomainController" - - return (Get-DatabaseAvailabilityGroup @PSBoundParameters -Status) -} - -Export-ModuleMember -Function *-TargetResource - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchDatabaseAvailabilityGroup/MSFT_xExchDatabaseAvailabilityGroup.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchDatabaseAvailabilityGroup/MSFT_xExchDatabaseAvailabilityGroup.schema.mof deleted file mode 100644 index d482cef4..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchDatabaseAvailabilityGroup/MSFT_xExchDatabaseAvailabilityGroup.schema.mof +++ /dev/null @@ -1,37 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xExchDatabaseAvailabilityGroup")] -class MSFT_xExchDatabaseAvailabilityGroup : OMI_BaseResource -{ - [Key] String Name; //The name of the DAG - [Required, EmbeddedInstance("MSFT_Credential")] String Credential; //Credentials used to establish a remote Powershell session to Exchange - - //Remaining properties correspond directly to Set-DatabaseAvailabilityGroup parameters - //http://technet.microsoft.com/en-us/library/dd297934(v=exchg.150).aspx - [Required] SInt32 AutoDagTotalNumberOfServers; //Required so that we can determine when all DAG members have been added - [Write] String AlternateWitnessDirectory; - [Write] String AlternateWitnessServer; - [Write] Boolean AutoDagAutoRedistributeEnabled; - [Write] Boolean AutoDagAutoReseedEnabled; - [Write] SInt32 AutoDagDatabaseCopiesPerDatabase; - [Write] SInt32 AutoDagDatabaseCopiesPerVolume; - [Write] String AutoDagDatabasesRootFolderPath; - [Write] Boolean AutoDagDiskReclaimerEnabled; - [Write] SInt32 AutoDagTotalNumberOfDatabases; - [Write] String AutoDagVolumesRootFolderPath; - [Write] String DatabaseAvailabilityGroupIpAddresses[]; - [Write, ValueMap{"Off","DagOnly"}, Values{"Off","DagOnly"}] String DatacenterActivationMode; - [Write] String DomainController; - [Write, ValueMap{"NTFS","ReFS"}, Values{"NTFS","ReFS"}] String FileSystem; - [Write] Boolean ManualDagNetworkConfiguration; - [Write, ValueMap{"Disabled","Enabled","InterSubnetOnly","SeedOnly"}, Values{"Disabled","Enabled","InterSubnetOnly","SeedOnly"}] String NetworkCompression; - [Write, ValueMap{"Disabled","Enabled","InterSubnetOnly","SeedOnly"}, Values{"Disabled","Enabled","InterSubnetOnly","SeedOnly"}] String NetworkEncryption; - [Write] String PreferenceMoveFrequency; - [Write] Boolean ReplayLagManagerEnabled; - [Write] Uint16 ReplicationPort; - [Write] Boolean SkipDagValidation; - [Write] String WitnessDirectory; - [Write] String WitnessServer; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchDatabaseAvailabilityGroupMember/MSFT_xExchDatabaseAvailabilityGroupMember.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchDatabaseAvailabilityGroupMember/MSFT_xExchDatabaseAvailabilityGroupMember.psm1 deleted file mode 100644 index 1ff49bcd..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchDatabaseAvailabilityGroupMember/MSFT_xExchDatabaseAvailabilityGroupMember.psm1 +++ /dev/null @@ -1,178 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscTestsPresent", "")] -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscExamplesPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $MailboxServer, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [System.String] - $DAGName, - - [System.String] - $DomainController, - - [System.Boolean] - $SkipDagValidation - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"MailboxServer" = $MailboxServer;"DAGName" = $DAGName} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-DatabaseAvailabilityGroup" -VerbosePreference $VerbosePreference - - #Setup params - AddParameters -PSBoundParametersIn $PSBoundParameters -ParamsToAdd @{"Identity" = $PSBoundParameters["DAGName"]} - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Identity","DomainController" - - $dag = Get-DatabaseAvailabilityGroup @PSBoundParameters -Status -ErrorAction SilentlyContinue - - if ($null -ne $dag -and $null -ne $dag.Servers) - { - #See if this server is already in the DAG - $server = $dag.Servers | Where-Object {$_.Name -eq "$($MailboxServer)"} - - if ($null -ne $server) - { - $returnValue = @{ - MailboxServer = $MailboxServer - DAGName = $dag.Name - } - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $MailboxServer, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [System.String] - $DAGName, - - [System.String] - $DomainController, - - [System.Boolean] - $SkipDagValidation - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"MailboxServer" = $MailboxServer;"DAGName" = $DAGName} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Add-DatabaseAvailabilityGroupServer" -VerbosePreference $VerbosePreference - - #Setup params - AddParameters -PSBoundParametersIn $PSBoundParameters -ParamsToAdd @{"Identity" = $PSBoundParameters["DAGName"]} - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "DAGName","Credential" - - $failoverClusteringRole = Get-WindowsFeature -Name Failover-Clustering -ErrorAction SilentlyContinue - - #Make sure the Failover-Clustering role is installed before trying to add the member to the DAG - if ($null -eq $failoverClusteringRole -or !$failoverClusteringRole.Installed) - { - Write-Error "The Failover-Clustering role must be fully installed before the server can be added to the cluster." - return - } - #Force a reboot if the cluster is in an InstallPending state - elseif ($failoverClusteringRole.InstallState -like "InstallPending") - { - Write-Warning "A reboot is required to finish installing the Failover-Clustering role. This must occur before the server can be added to the DAG." - $global:DSCMachineStatus = 1 - return - } - - Add-DatabaseAvailabilityGroupServer @PSBoundParameters -} - - -function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $MailboxServer, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [System.String] - $DAGName, - - [System.String] - $DomainController, - - [System.Boolean] - $SkipDagValidation - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"MailboxServer" = $MailboxServer;"DAGName" = $DAGName} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-DatabaseAvailabilityGroup" -VerbosePreference $VerbosePreference - - #Setup params - AddParameters -PSBoundParametersIn $PSBoundParameters -ParamsToAdd @{"Identity" = $PSBoundParameters["DAGName"]} - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Identity","DomainController" - - $dag = Get-DatabaseAvailabilityGroup @PSBoundParameters -Status -ErrorAction SilentlyContinue - - if ($null -ne $dag -and $dag.Name -like "$($DAGName)") - { - $server = $dag.Servers | Where-Object {$_.Name -eq "$($MailboxServer)"} - - return ($null -ne $server) - } - - return $false -} - - -Export-ModuleMember -Function *-TargetResource - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchDatabaseAvailabilityGroupMember/MSFT_xExchDatabaseAvailabilityGroupMember.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchDatabaseAvailabilityGroupMember/MSFT_xExchDatabaseAvailabilityGroupMember.schema.mof deleted file mode 100644 index bb42164f..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchDatabaseAvailabilityGroupMember/MSFT_xExchDatabaseAvailabilityGroupMember.schema.mof +++ /dev/null @@ -1,13 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xExchDatabaseAvailabilityGroupMember")] -class MSFT_xExchDatabaseAvailabilityGroupMember : OMI_BaseResource -{ - [Key] String MailboxServer; //Must be Hostname of Server, not FQDN - [Required, EmbeddedInstance("MSFT_Credential")] String Credential; //Credentials used to establish a remote Powershell session to Exchange - [Required] String DAGName; //Name of DAG to add member to - [Write] String DomainController; //Domain controller to talk to when running Add-DatabaseAvailabilityGroupMember - [Write] Boolean SkipDagValidation; //Whether SkipDagValidation should be passed to Add-DatabaseAvailabilityGroupMember -}; - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchDatabaseAvailabilityGroupNetwork/MSFT_xExchDatabaseAvailabilityGroupNetwork.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchDatabaseAvailabilityGroupNetwork/MSFT_xExchDatabaseAvailabilityGroupNetwork.psm1 deleted file mode 100644 index c6be4a4a..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchDatabaseAvailabilityGroupNetwork/MSFT_xExchDatabaseAvailabilityGroupNetwork.psm1 +++ /dev/null @@ -1,312 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscTestsPresent", "")] -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscExamplesPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseAvailabilityGroup, - - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [System.String] - $DomainController, - - [System.Boolean] - $IgnoreNetwork, - - [System.Boolean] - $ReplicationEnabled, - - [System.String[]] - $Subnets - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Name" = $Name; "DatabaseAvailabilityGroup" = $DatabaseAvailabilityGroup} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-DatabaseAvailabilityGroupNetwork" -VerbosePreference $VerbosePreference - - $dagNet = GetDatabaseAvailabilityGroupNetwork @PSBoundParameters - - if ($null -ne $dagNet) - { - $returnValue = @{ - Name = $Name - DatabaseAvailabilityGroup = $DatabaseAvailabilityGroup - IgnoreNetwork = $dagNet.IgnoreNetwork - ReplicationEnabled = $dagNet.ReplicationEnabled - Subnets = $dagNet.Subnets - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseAvailabilityGroup, - - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [System.String] - $DomainController, - - [System.Boolean] - $IgnoreNetwork, - - [System.Boolean] - $ReplicationEnabled, - - [System.String[]] - $Subnets - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Name" = $Name; "DatabaseAvailabilityGroup" = $DatabaseAvailabilityGroup} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "*DatabaseAvailabilityGroup*" -VerbosePreference $VerbosePreference - - $dagId = "$($DatabaseAvailabilityGroup)\$($Name)" - - $dagNet = GetDatabaseAvailabilityGroupNetwork @PSBoundParameters - - if ($Ensure -eq "Absent") - { - #Only try to remove the network if it has 0 associated subnets - if ($null -ne $dagNet) - { - if ($null -eq $dagNet.Subnets -or $dagNet.Subnets.Count -eq 0) - { - Remove-DatabaseAvailabilityGroupNetwork -Identity "$($dagId)" -Confirm:$false - } - else - { - throw "Unable to remove network, as it still has associated subnets." - } - } - } - else - { - #Remove Credential and Ensure so we don't pass it into the next command - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "Credential","Ensure" - - SetEmptyStringParamsToNull -PSBoundParametersIn $PSBoundParameters - - if ($null -eq $dagNet) #Need to create a new network - { - $dagNet = New-DatabaseAvailabilityGroupNetwork @PSBoundParameters - Set-DatabaseAvailabilityGroup -Identity $DatabaseAvailabilityGroup -DiscoverNetworks - } - else #Set props on the existing network - { - AddParameters -PSBoundParametersIn $PSBoundParameters -ParamsToAdd @{"Identity" = $dagId} - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "Name","DatabaseAvailabilityGroup" - - Set-DatabaseAvailabilityGroupNetwork @PSBoundParameters - } - } -} - - -function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseAvailabilityGroup, - - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [System.String] - $DomainController, - - [System.Boolean] - $IgnoreNetwork, - - [System.Boolean] - $ReplicationEnabled, - - [System.String[]] - $Subnets - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Name" = $Name; "DatabaseAvailabilityGroup" = $DatabaseAvailabilityGroup} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-DatabaseAvailabilityGroupNetwork" -VerbosePreference $VerbosePreference - - $dagNet = GetDatabaseAvailabilityGroupNetwork @PSBoundParameters - - if ($null -eq $dagNet) - { - if ($Ensure -eq "Present") - { - ReportBadSetting -SettingName "Ensure" -ExpectedValue "Present" -ActualValue "Absent" -VerbosePreference $VerbosePreference - return $false - } - else - { - return $true - } - } - else - { - if ($Ensure -eq "Absent") - { - ReportBadSetting -SettingName "Ensure" -ExpectedValue "Absent" -ActualValue "Present" -VerbosePreference $VerbosePreference - return $false - } - else - { - if (!(VerifySetting -Name "IgnoreNetwork" -Type "Boolean" -ExpectedValue $IgnoreNetwork -ActualValue $dagNet.IgnoreNetwork -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ReplicationEnabled" -Type "Boolean" -ExpectedValue $ReplicationEnabled -ActualValue $dagNet.ReplicationEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "Subnets" -Type "Array" -ExpectedValue $Subnets -ActualValue (SubnetsToArray -Subnets $dagNet.Subnets) -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - } - } - - #If we made it here, all tests passed - return $true -} - -#Runs Get-DatabaseAvailabilityGroupNetwork, only specifying Identity, and optionally DomainController -function GetDatabaseAvailabilityGroupNetwork -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseAvailabilityGroup, - - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [System.String] - $DomainController, - - [System.Boolean] - $IgnoreNetwork, - - [System.Boolean] - $ReplicationEnabled, - - [System.String[]] - $Subnets - ) - - AddParameters -PSBoundParametersIn $PSBoundParameters -ParamsToAdd @{"Identity" = "$($DatabaseAvailabilityGroup)\$($Name)"; "ErrorAction" = "SilentlyContinue"} - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Identity","ErrorAction","DomainController" - - return (Get-DatabaseAvailabilityGroupNetwork @PSBoundParameters) -} - - -#Takes an array of Microsoft.Exchange.Data.DatabaseAvailabilityGroupNetworkSubnet objects and converts the SubnetId props to a string[] -function SubnetsToArray -{ - param ($Subnets) - - if ($null -ne $Subnets -and $Subnets.Count -gt 0) - { - [string[]]$SubnetsOut = $Subnets[0].SubnetId - - for ($i = 1; $i -lt $Subnets.Count; $i++) - { - $SubnetsOut += $Subnets[$i].SubnetId - } - } - - return $SubnetsOut -} - - -Export-ModuleMember -Function *-TargetResource - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchDatabaseAvailabilityGroupNetwork/MSFT_xExchDatabaseAvailabilityGroupNetwork.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchDatabaseAvailabilityGroupNetwork/MSFT_xExchDatabaseAvailabilityGroupNetwork.schema.mof deleted file mode 100644 index c9ee17ae..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchDatabaseAvailabilityGroupNetwork/MSFT_xExchDatabaseAvailabilityGroupNetwork.schema.mof +++ /dev/null @@ -1,19 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xExchDatabaseAvailabilityGroupNetwork")] -class MSFT_xExchDatabaseAvailabilityGroupNetwork : OMI_BaseResource -{ - [Key] String Name; //The name of the DAG network - [Required, EmbeddedInstance("MSFT_Credential")] String Credential; //Credentials used to establish a remote Powershell session to Exchange - [Required] String DatabaseAvailabilityGroup; //The DAG where the network will live - [Required, ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; //Whethe the DAG network should exist or not - - //Remaining properties correspond directly to Set-DatabaseAvailabilityGroupNetwork parameters - //http://technet.microsoft.com/en-us/library/dd298008(v=exchg.150).aspx - [Write] String DomainController; - [Write] Boolean IgnoreNetwork; - [Write] Boolean ReplicationEnabled; - [Write] String Subnets[]; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchEcpVirtualDirectory/MSFT_xExchEcpVirtualDirectory.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchEcpVirtualDirectory/MSFT_xExchEcpVirtualDirectory.psm1 deleted file mode 100644 index e9c67cda..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchEcpVirtualDirectory/MSFT_xExchEcpVirtualDirectory.psm1 +++ /dev/null @@ -1,321 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscTestsPresent", "")] -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscExamplesPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $AdfsAuthentication, - - [System.Boolean] - $BasicAuthentication, - - [System.Boolean] - $DigestAuthentication, - - [System.String] - $DomainController, - - [System.String[]] - $ExternalAuthenticationMethods, - - [System.String] - $ExternalUrl, - - [System.Boolean] - $FormsAuthentication, - - [System.String] - $InternalUrl, - - [System.Boolean] - $WindowsAuthentication - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad 'Get-EcpVirtualDirectory' -VerbosePreference $VerbosePreference - - $EcpVdir = GetEcpVirtualDirectory @PSBoundParameters - - if ($null -ne $EcpVdir) - { - $returnValue = @{ - DigestAuthentication = $EcpVdir.DigestAuthentication - AdfsAuthentication = $EcpVdir.AdfsAuthentication - ExternalAuthenticationMethods = $EcpVdir.ExternalAuthenticationMethods - Identity = $Identity - InternalUrl = $EcpVdir.InternalUrl - ExternalUrl = $EcpVdir.ExternalUrl - FormsAuthentication = $EcpVdir.FormsAuthentication - WindowsAuthentication = $EcpVdir.WindowsAuthentication - BasicAuthentication = $EcpVdir.BasicAuthentication - - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $AdfsAuthentication, - - [System.Boolean] - $BasicAuthentication, - - [System.Boolean] - $DigestAuthentication, - - [System.String] - $DomainController, - - [System.String[]] - $ExternalAuthenticationMethods, - - [System.String] - $ExternalUrl, - - [System.Boolean] - $FormsAuthentication, - - [System.String] - $InternalUrl, - - [System.Boolean] - $WindowsAuthentication - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad 'Set-EcpVirtualDirectory' -VerbosePreference $VerbosePreference - - #Ensure an empty string is $null and not a string - SetEmptyStringParamsToNull -PSBoundParametersIn $PSBoundParameters - - #Remove Credential and AllowServiceRestart because those parameters do not exist on Set-OwaVirtualDirectory - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove 'Credential','AllowServiceRestart' - - Set-EcpVirtualDirectory @PSBoundParameters - - If($AllowServiceRestart -eq $true) - { - Write-Verbose "Recycling MSExchangeECPAppPool" - - RestartAppPoolIfExists -Name MSExchangeECPAppPool - } - else - { - Write-Warning "The configuration will not take effect until MSExchangeECPAppPool is manually recycled." - } -} - -function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $AdfsAuthentication, - - [System.Boolean] - $BasicAuthentication, - - [System.Boolean] - $DigestAuthentication, - - [System.String] - $DomainController, - - [System.String[]] - $ExternalAuthenticationMethods, - - [System.String] - $ExternalUrl, - - [System.Boolean] - $FormsAuthentication, - - [System.String] - $InternalUrl, - - [System.Boolean] - $WindowsAuthentication - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad 'Get-EcpVirtualDirectory' -VerbosePreference $VerbosePreference - - #Ensure an empty string is $null and not a string - SetEmptyStringParamsToNull -PSBoundParametersIn $PSBoundParameters - - $EcpVdir = GetEcpVirtualDirectory @PSBoundParameters - - if ($null -eq $EcpVdir) - { - return $false - } - else - { - if (!(VerifySetting -Name "InternalUrl" -Type "String" -ExpectedValue $InternalUrl -ActualValue $EcpVdir.InternalUrl.AbsoluteUri -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ExternalUrl" -Type "String" -ExpectedValue $ExternalUrl -ActualValue $EcpVdir.ExternalUrl.AbsoluteUri -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "FormsAuthentication" -Type "Boolean" -ExpectedValue $FormsAuthentication -ActualValue $EcpVdir.FormsAuthentication -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "WindowsAuthentication" -Type "Boolean" -ExpectedValue $WindowsAuthentication -ActualValue $EcpVdir.WindowsAuthentication -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "BasicAuthentication" -Type "Boolean" -ExpectedValue $BasicAuthentication -ActualValue $EcpVdir.BasicAuthentication -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "DigestAuthentication" -Type "Boolean" -ExpectedValue $DigestAuthentication -ActualValue $EcpVdir.DigestAuthentication -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "AdfsAuthentication" -Type "Boolean" -ExpectedValue $AdfsAuthentication -ActualValue $EcpVdir.AdfsAuthentication -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ExternalAuthenticationMethods" -Type "Array" -ExpectedValue $ExternalAuthenticationMethods -ActualValue $EcpVdir.ExternalAuthenticationMethods -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - } - - #If the code made it this for all properties are in a desired state - return $true -} - -function GetEcpVirtualDirectory -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $AdfsAuthentication, - - [System.Boolean] - $BasicAuthentication, - - [System.Boolean] - $DigestAuthentication, - - [System.String] - $DomainController, - - [System.String[]] - $ExternalAuthenticationMethods, - - [System.String] - $ExternalUrl, - - [System.Boolean] - $FormsAuthentication, - - [System.String] - $InternalUrl, - - [System.Boolean] - $WindowsAuthentication - ) - - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Identity","DomainController" - - return (Get-EcpVirtualDirectory @PSBoundParameters) -} - - -Export-ModuleMember -Function *-TargetResource - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchEcpVirtualDirectory/MSFT_xExchEcpVirtualDirectory.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchEcpVirtualDirectory/MSFT_xExchEcpVirtualDirectory.schema.mof deleted file mode 100644 index 4ffd73ea..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchEcpVirtualDirectory/MSFT_xExchEcpVirtualDirectory.schema.mof +++ /dev/null @@ -1,23 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xExchEcpVirtualDirectory")] -class MSFT_xExchEcpVirtualDirectory : OMI_BaseResource -{ - [Key] String Identity; //The Identity of the ECP Virtual Directory - [Required, EmbeddedInstance("MSFT_Credential")] String Credential; //Credentials used to establish a remote Powershell session to Exchange - [Write] Boolean AllowServiceRestart; //Whether it is OK to recycle the app pool after making changes. Defaults to $true. - - //Remaining properties correspond directly to Set-EcpVirtualDirectory parameters - //http://technet.microsoft.com/en-us/library/dd297991(v=exchg.150).aspx - [Write] Boolean AdfsAuthentication; - [Write] Boolean BasicAuthentication; - [Write] Boolean DigestAuthentication; - [Write] String DomainController; - [Write] String ExternalAuthenticationMethods[]; - [Write] Boolean FormsAuthentication; - [Write] String ExternalUrl; - [Write] String InternalUrl; - [Write] Boolean WindowsAuthentication; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchEventLogLevel/MSFT_xExchEventLogLevel.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchEventLogLevel/MSFT_xExchEventLogLevel.psm1 deleted file mode 100644 index 1ee3762f..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchEventLogLevel/MSFT_xExchEventLogLevel.psm1 +++ /dev/null @@ -1,133 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscTestsPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [ValidateSet("Lowest","Low","Medium","High","Expert")] - [System.String] - $Level - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-EventLogLevel" -VerbosePreference $VerbosePreference - - $eventLogLevel = Get-EventLogLevel -Identity "$($env:COMPUTERNAME)\$($Identity)" - - if ($null -ne $eventLogLevel) - { - $returnValue = @{ - Identity = $Identity - Level = $eventLogLevel.EventLevel - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [ValidateSet("Lowest","Low","Medium","High","Expert")] - [System.String] - $Level - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Set-EventLogLevel" -VerbosePreference $VerbosePreference - - Set-EventLogLevel -Identity "$($env:COMPUTERNAME)\$($Identity)" -Level $Level -} - - -function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [ValidateSet("Lowest","Low","Medium","High","Expert")] - [System.String] - $Level - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-EventLogLevel" -VerbosePreference $VerbosePreference - - $eventLogLevel = Get-EventLogLevel -Identity "$($env:COMPUTERNAME)\$($Identity)" - - if ($null -eq $eventLogLevel) - { - Write-Error "Failed to retrieve any objects with specified Identity." - - return $false - } - else - { - if (!(VerifySetting -Name "Level" -Type "String" -ExpectedValue $Level -ActualValue $eventLogLevel.EventLevel -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - } - - return $true -} - - -Export-ModuleMember -Function *-TargetResource - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchEventLogLevel/MSFT_xExchEventLogLevel.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchEventLogLevel/MSFT_xExchEventLogLevel.schema.mof deleted file mode 100644 index b0b755d6..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchEventLogLevel/MSFT_xExchEventLogLevel.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xExchEventLogLevel")] -class MSFT_xExchEventLogLevel : OMI_BaseResource -{ - [Key, Description("The Identity parameter specifies the name of the event logging category for which you want to set the event logging level.")] String Identity; - [Required, Description("Credentials used to establish a remote Powershell session to Exchange"), EmbeddedInstance("MSFT_Credential")] String Credential; - [Required, Description("The Level parameter specifies the log level for the specific event logging category."), ValueMap{"Lowest","Low","Medium","High","Expert"}, Values{"Lowest","Low","Medium","High","Expert"}] String Level; -}; - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchExchangeCertificate/MSFT_xExchExchangeCertificate.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchExchangeCertificate/MSFT_xExchExchangeCertificate.psm1 deleted file mode 100644 index 74c67bee..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchExchangeCertificate/MSFT_xExchExchangeCertificate.psm1 +++ /dev/null @@ -1,349 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscTestsPresent", "")] -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscExamplesPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Thumbprint, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - #Only used by Test-TargetResource - [System.Boolean] - $AllowExtraServices = $false, - - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $CertCreds, - - [System.String] - $CertFilePath, - - [System.String] - $DomainController, - - [System.String[]] - $Services - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Thumbprint" = $Thumbprint} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-ExchangeCertificate" -VerbosePreference $VerbosePreference - - $cert = GetExchangeCertificate @PSBoundParameters - - if ($null -ne $cert) - { - $returnValue = @{ - Thumbprint = $Thumbprint - Services = $cert.Services.ToString() - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")] - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Thumbprint, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - #Only used by Test-TargetResource - [System.Boolean] - $AllowExtraServices = $false, - - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $CertCreds, - - [System.String] - $CertFilePath, - - [System.String] - $DomainController, - - [System.String[]] - $Services - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Thumbprint" = $Thumbprint} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "*ExchangeCertificate" -VerbosePreference $VerbosePreference - - $cert = GetExchangeCertificate @PSBoundParameters - - #Check whether any UM services are being enabled, and if they weren't enable before. If so, we should stop those services, enable the cert, then start them up - $needUMServiceReset = $false - $needUMCallRouterServiceReset = $false - - if ($null -ne $cert) - { - $currentServices = StringToArray -StringIn $cert.Services -Separator ',' - } - - if ((Array2ContainsArray1Contents -Array2 $Services -Array1 "UM" -IgnoreCase $true) -eq $true) - { - if ($null -eq $cert -or (Array2ContainsArray1Contents -Array2 $currentServices -Array1 "UM" -IgnoreCase $true) -eq $false) - { - $needUMServiceReset = $true - } - } - - if ((Array2ContainsArray1Contents -Array2 $Services -Array1 "UMCallRouter" -IgnoreCase $true) -eq $true) - { - if ($null -eq $cert -or (Array2ContainsArray1Contents -Array2 $currentServices -Array1 "UMCallRouter" -IgnoreCase $true) -eq $false) - { - $needUMCallRouterServiceReset = $true - } - } - - #Stop required services before working with the cert - if ($needUMServiceReset -eq $true) - { - Write-Verbose "Stopping service MSExchangeUM before enabling the UM service on the certificate" - Stop-Service -Name MSExchangeUM -Confirm:$false - } - - if ($needUMCallRouterServiceReset -eq $true) - { - Write-Verbose "Stopping service MSExchangeUMCR before enabling the UMCallRouter service on the certificate" - Stop-Service -Name MSExchangeUMCR -Confirm:$false - } - - #The desired cert is not present. Deal with that scenario. - if ($null -eq $cert) - { - #If the cert is null and it's supposed to be present, then we need to import one - if ($Ensure -eq "Present") - { - $cert = Import-ExchangeCertificate -FileData ([Byte[]]$(Get-Content -Path "$($CertFilePath)" -Encoding Byte -ReadCount 0)) -Password:$CertCreds.Password -Server $env:COMPUTERNAME - } - } - else - { - #cert is present and it shouldn't be. Remove it - if ($Ensure -eq "Absent") - { - Remove-ExchangeCertificate -Thumbprint $Thumbprint -Confirm:$false -Server $env:COMPUTERNAME - } - } - - #Cert is present. Set props on it - if ($Ensure -eq "Present") - { - if ($null -ne $cert) - { - NotePreviousError - - Enable-ExchangeCertificate -Thumbprint $Thumbprint -Services $Services -Force -Server $env:COMPUTERNAME - - ThrowIfNewErrorsEncountered -CmdletBeingRun "Enable-ExchangeCertificate" -VerbosePreference $VerbosePreference - } - else - { - Write-Error "Failed to install certificate" - } - } - - #Start UM services that we started - if ($needUMServiceReset -eq $true) - { - Write-Verbose "Starting service MSExchangeUM" - Start-Service -Name MSExchangeUM -Confirm:$false - } - - if ($needUMCallRouterServiceReset -eq $true) - { - Write-Verbose "Starting service MSExchangeUMCR" - Start-Service -Name MSExchangeUMCR -Confirm:$false - } -} - - -function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Thumbprint, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - #Only used by Test-TargetResource - [System.Boolean] - $AllowExtraServices = $false, - - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $CertCreds, - - [System.String] - $CertFilePath, - - [System.String] - $DomainController, - - [System.String[]] - $Services - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Thumbprint" = $Thumbprint} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-ExchangeCertificate" -VerbosePreference $VerbosePreference - - $cert = GetExchangeCertificate @PSBoundParameters - - $result = $false - - if ($null -ne $cert) - { - if ($Ensure -eq "Present") - { - $result = CompareCertServices -ServicesActual $cert.Services -ServicesDesired $Services -AllowExtraServices $AllowExtraServices - } - } - elseif ($Ensure -eq "Absent") - { - $result = $true - } - - $result -} - -#Runs Get-ExchangeCertificate, only specifying Thumbprint, ErrorAction, and optionally DomainController -function GetExchangeCertificate -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Thumbprint, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - #Only used by Test-TargetResource - [System.Boolean] - $AllowExtraServices = $false, - - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $CertCreds, - - [System.String] - $CertFilePath, - - [System.String] - $DomainController, - - [System.String[]] - $Services - ) - - #Remove params we don't want to pass into the next command - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Thumbprint","DomainController" - - return (Get-ExchangeCertificate @PSBoundParameters -ErrorAction SilentlyContinue -Server $env:COMPUTERNAME) -} - -<# -.Synopsis -Compares whether services from a certificate object match the services that were requested. -If AllowsExtraServices is true, it is OK for more services to be on the cert than were requested, -as long as the requested services are present. -#> - -function CompareCertServices -{ - param([string]$ServicesActual, [string[]]$ServicesDesired, [boolean]$AllowExtraServices) - - $actual = StringToArray -StringIn $ServicesActual -Separator ',' - - if ($AllowExtraServices -eq $true) - { - if (!([string]::IsNullOrEmpty($ServicesDesired)) -and $ServicesDesired.Contains("NONE")) - { - $result = $true - } - else - { - $result = Array2ContainsArray1Contents -Array1 $ServicesDesired -Array2 $actual -IgnoreCase - } - } - else - { - $result = CompareArrayContents -Array1 $actual -Array2 $ServicesDesired -IgnoreCase - } - - return $result -} - - -Export-ModuleMember -Function *-TargetResource -Export-ModuleMember -Function CompareCertServices - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchExchangeCertificate/MSFT_xExchExchangeCertificate.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchExchangeCertificate/MSFT_xExchExchangeCertificate.schema.mof deleted file mode 100644 index 6d8e2d6b..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchExchangeCertificate/MSFT_xExchExchangeCertificate.schema.mof +++ /dev/null @@ -1,16 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xExchExchangeCertificate")] -class MSFT_xExchExchangeCertificate : OMI_BaseResource -{ - [Key] String Thumbprint; //Thumbprint of the certificate to work on - [Required, EmbeddedInstance("MSFT_Credential")] String Credential; //Credentials used to establish a remote Powershell session to Exchange - [Required, ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; //Whether the certificate should be present or not - [Write] Boolean AllowExtraServices; //Get-ExchangeCertificate sometimes displays more services than are actually enabled. Setting this to true allows tests to pass in that situation as long as the requested services are present. - [Write, EmbeddedInstance("MSFT_Credential")] String CertCreds; //Credentials containing the password to the .pfx file in CertFilePath - [Write] String CertFilePath; //The file path to the certificate .pfx file that should be imported - [Write] String DomainController; //Domain Controller to talk to - [Write] String Services[]; //Services to enable on the certificate. See: http://technet.microsoft.com/en-us/library/aa997231(v=exchg.150).aspx -}; - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchExchangeServer/MSFT_xExchExchangeServer.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchExchangeServer/MSFT_xExchExchangeServer.psm1 deleted file mode 100644 index 395fac16..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchExchangeServer/MSFT_xExchExchangeServer.psm1 +++ /dev/null @@ -1,309 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscTestsPresent", "")] -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscExamplesPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $CustomerFeedbackEnabled, - - [System.String] - $DomainController, - - [System.String] - $InternetWebProxy, - - [System.String] - $MonitoringGroup, - - [System.String] - $ProductKey, - - [System.String] - $WorkloadManagementPolicy - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-ExchangeServer","Set-ExchangeServer" -VerbosePreference $VerbosePreference - - if ($PSBoundParameters.ContainsKey("WorkloadManagementPolicy") -and (CheckForCmdletParameter -CmdletName "Set-ExchangeServer" -ParameterName "WorkloadManagementPolicy") -eq $false) - { - Write-Warning "WorkloadManagementPolicy has been removed from the Set-ExchangeServer cmdlet. This parameter will be ignored." - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "WorkloadManagementPolicy" - } - - $server = GetExchangeServer @PSBoundParameters - - if ($null -ne $server) - { - #There's no way to read the product key that was sent in, so just mark it is "Licensed" if it is - if ($server.IsExchangeTrialEdition -eq $false) - { - $ProductKey = "Licensed" - } - else - { - $ProductKey = "" - } - - $returnValue = @{ - Identity = $Identity - CustomerFeedbackEnabled = $server.CustomerFeedbackEnabled - InternetWebProxy = $server.InternetWebProxy.AbsoluteUri - MonitoringGroup = $server.MonitoringGroup - ProductKey = $ProductKey - WorkloadManagementPolicy = $server.WorkloadManagementPolicy - } - } - - $returnValue -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $CustomerFeedbackEnabled, - - [System.String] - $DomainController, - - [System.String] - $InternetWebProxy, - - [System.String] - $MonitoringGroup, - - [System.String] - $ProductKey, - - [System.String] - $WorkloadManagementPolicy - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-ExchangeServer","Set-ExchangeServer" -VerbosePreference $VerbosePreference - - if ($PSBoundParameters.ContainsKey("WorkloadManagementPolicy") -and (CheckForCmdletParameter -CmdletName "Set-ExchangeServer" -ParameterName "WorkloadManagementPolicy") -eq $false) - { - Write-Warning "WorkloadManagementPolicy has been removed from the Set-ExchangeServer cmdlet. This parameter will be ignored." - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "WorkloadManagementPolicy" - } - - #Check existing config first to see if we are currently licensing a server - $server = GetExchangeServer @PSBoundParameters - - $needRestart = $false - - if ($PSBoundParameters.ContainsKey("ProductKey") -and !([string]::IsNullOrEmpty($ProductKey)) -and $null -ne $server -and $server.IsExchangeTrialEdition -eq $true) - { - $needRestart = $true - } - - #Setup params for next command - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "Credential","AllowServiceRestart" - - SetEmptyStringParamsToNull -PSBoundParametersIn $PSBoundParameters - - Set-ExchangeServer @PSBoundParameters - - #Restart service if needed - if ($needRestart) - { - if ($AllowServiceRestart -eq $true) - { - Write-Verbose "Restarting Information Store" - - Restart-Service MSExchangeIS - } - else - { - Write-Warning "The configuration will not take effect until MSExchangeIS is manually restarted." - } - } -} - - -function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $CustomerFeedbackEnabled, - - [System.String] - $DomainController, - - [System.String] - $InternetWebProxy, - - [System.String] - $MonitoringGroup, - - [System.String] - $ProductKey, - - [System.String] - $WorkloadManagementPolicy - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-ExchangeServer","Set-ExchangeServer" -VerbosePreference $VerbosePreference - - if ($PSBoundParameters.ContainsKey("WorkloadManagementPolicy") -and (CheckForCmdletParameter -CmdletName "Set-ExchangeServer" -ParameterName "WorkloadManagementPolicy") -eq $false) - { - Write-Warning "WorkloadManagementPolicy has been removed from the Set-ExchangeServer cmdlet. This parameter will be ignored." - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "WorkloadManagementPolicy" - } - - $server = GetExchangeServer @PSBoundParameters - - if ($null -eq $server) #Couldn't find the server, which is bad - { - return $false - } - else #Validate server params - { - if (!(VerifySetting -Name "CustomerFeedbackEnabled" -Type "Boolean" -ExpectedValue $CustomerFeedbackEnabled -ActualValue $server.CustomerFeedbackEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if ($PSBoundParameters.ContainsKey("InternetWebProxy") -and !(CompareStrings -String1 $InternetWebProxy -String2 $server.InternetWebProxy.AbsoluteUri -IgnoreCase)) - { - #The AbsolueUri that comes back from the server can have a trailing slash. Check if the AbsoluteUri at least contains the requested Uri - if (($null -ne $server.InternetWebProxy -and $null -ne $server.InternetWebProxy.AbsoluteUri -and $server.InternetWebProxy.AbsoluteUri.Contains($InternetWebProxy)) -eq $false) - { - ReportBadSetting -SettingName "InternetWebProxy" -ExpectedValue $InternetWebProxy -ActualValue $server.InternetWebProxy -VerbosePreference $VerbosePreference - return $false - } - } - - if (!(VerifySetting -Name "MonitoringGroup" -Type "String" -ExpectedValue $MonitoringGroup -ActualValue $server.MonitoringGroup -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if ($PSBoundParameters.ContainsKey("ProductKey") -and !([string]::IsNullOrEmpty($ProductKey)) -and $server.IsExchangeTrialEdition -eq $true) - { - ReportBadSetting -SettingName "ProductKey" -ExpectedValue $ProductKey -ActualValue $server.ProductKey -VerbosePreference $VerbosePreference - return $false - } - - if (!(VerifySetting -Name "WorkloadManagementPolicy" -Type "String" -ExpectedValue $WorkloadManagementPolicy -ActualValue $server.WorkloadManagementPolicy -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - } - - return $true -} - -#Runs Get-ExchangeServer, only specifying Identity, and optionally DomainController -function GetExchangeServer -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [System.Boolean] - $CustomerFeedbackEnabled, - - [System.String] - $DomainController, - - [System.String] - $InternetWebProxy, - - [System.String] - $MonitoringGroup, - - [System.String] - $ProductKey, - - [System.String] - $WorkloadManagementPolicy, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false - ) - - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Identity","DomainController" - - return (Get-ExchangeServer @PSBoundParameters) -} - -Export-ModuleMember -Function *-TargetResource - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchExchangeServer/MSFT_xExchExchangeServer.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchExchangeServer/MSFT_xExchExchangeServer.schema.mof deleted file mode 100644 index d8092614..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchExchangeServer/MSFT_xExchExchangeServer.schema.mof +++ /dev/null @@ -1,20 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xExchExchangeServer")] -class MSFT_xExchExchangeServer : OMI_BaseResource -{ - [Key] String Identity; //The hostname of the Exchange Server to configure - [Required, EmbeddedInstance("MSFT_Credential")] String Credential; //Credentials used to establish a remote Powershell session to Exchange - [Write] Boolean AllowServiceRestart; - - //Remaining properties correspond directly to Set-ExchangeServer parameters - //http://technet.microsoft.com/en-us/library/bb123716(v=exchg.150).aspx - [Write] Boolean CustomerFeedbackEnabled; - [Write] String DomainController; - [Write] String InternetWebProxy; - [Write] String MonitoringGroup; - [Write] String ProductKey; - [Write] String WorkloadManagementPolicy; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchImapSettings/MSFT_xExchImapSettings.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchImapSettings/MSFT_xExchImapSettings.psm1 deleted file mode 100644 index 83bbad2b..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchImapSettings/MSFT_xExchImapSettings.psm1 +++ /dev/null @@ -1,228 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscTestsPresent", "")] -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscExamplesPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Server, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.String] - $DomainController, - - [ValidateSet("PlainTextLogin","PlainTextAuthentication","SecureLogin")] - [System.String] - $LoginType, - - [System.String[]] - $ExternalConnectionSettings, - - [System.String] - $X509CertificateName - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Server" = $Server} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-ImapSettings" -VerbosePreference $VerbosePreference - - $imap = GetImapSettings @PSBoundParameters - - if ($null -ne $imap) - { - $returnValue = @{ - Server = $Identity - LoginType = $imap.LoginType - ExternalConnectionSettings = $imap.ExternalConnectionSettings - X509CertificateName = $imap.X509CertificateName - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Server, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.String] - $DomainController, - - [ValidateSet("PlainTextLogin","PlainTextAuthentication","SecureLogin")] - [System.String] - $LoginType, - - [System.String[]] - $ExternalConnectionSettings, - - [System.String] - $X509CertificateName - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Server" = $Server} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Set-ImapSettings" -VerbosePreference $VerbosePreference - - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "Credential","AllowServiceRestart" - - Set-ImapSettings @PSBoundParameters - - if ($AllowServiceRestart -eq $true) - { - Write-Verbose "Restarting IMAP Services" - - Get-Service MSExchangeIMAP4* | Restart-Service - } - else - { - Write-Warning "The configuration will not take effect until MSExchangeIMAP4 services are manually restarted." - } -} - - -function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Server, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.String] - $DomainController, - - [ValidateSet("PlainTextLogin","PlainTextAuthentication","SecureLogin")] - [System.String] - $LoginType, - - [System.String[]] - $ExternalConnectionSettings, - - [System.String] - $X509CertificateName - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Server" = $Server} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-ImapSettings" -VerbosePreference $VerbosePreference - - SetEmptyStringParamsToNull -PSBoundParametersIn $PSBoundParameters - - $imap = GetImapSettings @PSBoundParameters - - if ($null -eq $imap) - { - return $false - } - else - { - if (!(VerifySetting -Name "LoginType" -Type "String" -ExpectedValue $LoginType -ActualValue $imap.LoginType -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ExternalConnectionSettings" -Type "Array" -ExpectedValue $ExternalConnectionSettings -ActualValue $imap.ExternalConnectionSettings -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "X509CertificateName" -Type "String" -ExpectedValue $X509CertificateName -ActualValue $imap.X509CertificateName -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - } - - return $true -} - -function GetImapSettings -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Server, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.String] - $DomainController, - - [ValidateSet("PlainTextLogin","PlainTextAuthentication","SecureLogin")] - [System.String] - $LoginType, - - [System.String[]] - $ExternalConnectionSettings, - - [System.String] - $X509CertificateName - ) - - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Server","DomainController" - - return (Get-ImapSettings @PSBoundParameters) -} - -Export-ModuleMember -Function *-TargetResource - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchImapSettings/MSFT_xExchImapSettings.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchImapSettings/MSFT_xExchImapSettings.schema.mof deleted file mode 100644 index 98b6d6d2..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchImapSettings/MSFT_xExchImapSettings.schema.mof +++ /dev/null @@ -1,15 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xExchImapSettings")] -class MSFT_xExchImapSettings : OMI_BaseResource -{ - [Key] String Server; //The IMAP server to configure - [Required, EmbeddedInstance("MSFT_Credential")] String Credential; //Credentials used to establish a remote Powershell session to Exchange - [Write] Boolean AllowServiceRestart; //Whether it is OK to restart the IMAP services after making changes. Defaults to $false. - [Write] String DomainController; //Optional Domain Controller to connect to - [Write, ValueMap{"PlainTextLogin","PlainTextAuthentication","SecureLogin"}, Values{"PlainTextLogin","PlainTextAuthentication","SecureLogin"}] String LoginType; //The LoginType to be used for IMAP - [Write] String ExternalConnectionSettings[]; //Specifies the host name, port, and encryption type that Exchange uses when IMAP clients connect to their email from the outside - [Write] String X509CertificateName; //Specifies the host name in the SSL certificate from the Associated Subject field. -}; - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchInstall/MSFT_xExchInstall.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchInstall/MSFT_xExchInstall.psm1 deleted file mode 100644 index 67273dab..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchInstall/MSFT_xExchInstall.psm1 +++ /dev/null @@ -1,282 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscExamplesPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory=$true)] - [System.String] - $Path, - - [Parameter(Mandatory=$true)] - [System.String] - $Arguments, - - [Parameter(Mandatory=$true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Path" = $Path; "Arguments" = $Arguments} -VerbosePreference $VerbosePreference - - $returnValue = @{ - Path = $Path - Arguments = $Arguments - } - - $returnValue -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory=$true)] - [System.String] - $Path, - - [Parameter(Mandatory=$true)] - [System.String] - $Arguments, - - [Parameter(Mandatory=$true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential - ) - - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Path" = $Path; "Arguments" = $Arguments} -VerbosePreference $VerbosePreference - - $installStatus = GetInstallStatus -Arguments $Arguments - - if ($installStatus.ShouldStartInstall -eq $true) - { - #Check if WSMan needs to be configured, as it will require an immediate reboot - $needReboot = CheckWSManConfig - - if ($needReboot -eq $true) - { - Write-Warning "Server needs a reboot before the installation of Exchange can begin." - return - } - - Write-Verbose "Initiating Exchange Setup. Command: $($Path) $($Arguments)" - - StartScheduledTask -Path "$($Path)" -Arguments "$($Arguments)" -Credential $Credential -TaskName "Install Exchange" -VerbosePreference $VerbosePreference - - $detectedExsetup = $false - - Write-Verbose "Waiting up to 60 seconds before exiting to give time for ExSetup.exe to start" - - for ($i = 0; $i -lt 60; $i++) - { - if ($null -eq (Get-Process -Name ExSetup -ErrorAction SilentlyContinue)) - { - Start-Sleep -Seconds 1 - } - else - { - Write-Verbose "Detected that ExSetup.exe is running" - $detectedExsetup = $true - break - } - } - - if ($detectedExsetup -eq $false) - { - throw "Waited 60 seconds, but was unable to detect that ExSetup.exe was started" - } - - #Now wait for setup to finish - while ($null -ne (Get-Process -Name ExSetup -ErrorAction SilentlyContinue)) - { - Write-Verbose "Setup is still running at $([DateTime]::Now). Sleeping for 1 minute." - Start-Sleep -Seconds 60 - } - } - else - { - if ($installStatus.SetupComplete) - { - Write-Verbose "Exchange setup has already successfully completed." - } - else - { - Write-Verbose "Exchange setup is already in progress." - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory=$true)] - [System.String] - $Path, - - [Parameter(Mandatory=$true)] - [System.String] - $Arguments, - - [Parameter(Mandatory=$true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential - ) - - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Path" = $Path; "Arguments" = $Arguments} -VerbosePreference $VerbosePreference - - $installStatus = GetInstallStatus -Arguments $Arguments - - if ($installStatus.ShouldStartInstall -eq $true) - { - if($installStatus.ShouldInstallLanguagePack -eq $true) - { - Write-Verbose "Language pack will be installed" - } - else - { - Write-Verbose "Exchange is either not installed, or a previous install only partially completed." - } - } - else - { - if ($installStatus.SetupComplete) - { - Write-Verbose "Exchange setup has already successfully completed." - } - else - { - Write-Verbose "Exchange setup is already in progress." - } - } - - return (!($installStatus.ShouldStartInstall)) -} - -#Checks for the exact status of Exchange setup and returns the results in a Hashtable -function GetInstallStatus -{ - param - ( - $Arguments - ) - - $shouldStartInstall = $false - - $shouldInstallLanguagePack = ShouldInstallLanguagePack -Arguments $Arguments - $setupRunning = IsSetupRunning - $setupComplete = IsSetupComplete - $exchangePresent = IsExchangePresent - $setupPartiallyComplete = IsSetupPartiallyCompleted - - if ($setupRunning -eq $true -or $setupComplete -eq $true) - { - if($shouldInstallLanguagePack -eq $true -and $setupComplete -eq $true) - { - $shouldStartInstall = $true - } - else - { - #Do nothing. Either Install is already running, or it's already finished successfully - } - } - elseif ($exchangePresent -eq $false -or $setupPartiallyComplete -eq $true) - { - $shouldStartInstall = $true - } - - $returnValue = @{ - ShouldInstallLanguagePack = $shouldInstallLanguagePack - SetupRunning = $setupRunning - SetupComplete = $setupComplete - ExchangePresent = $exchangePresent - SetupPartiallyComplete = $setupPartiallyComplete - ShouldStartInstall = $shouldStartInstall - } - - $returnValue -} - -#Check for missing registry keys that may cause Exchange setup to try to restart WinRM mid setup , which will in turn cause the DSC resource to fail -#If any required keys are missing, configure WinRM, then force a reboot -function CheckWSManConfig -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseDeclaredVarsMoreThanAssignments", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - () - - $needReboot = $false - - $wsmanKey = Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WSMAN" -ErrorAction SilentlyContinue - - if ($null -ne $wsmanKey) - { - if ($null -eq $wsmanKey.UpdatedConfig) - { - $needReboot = $true - - Write-Verbose "Value 'UpdatedConfig' missing from registry key HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WSMAN. Running: winrm i restore winrm/config" - - Set-Location "$($env:windir)\System32\inetsrv" - Invoke-Expression -Command "winrm i restore winrm/config" | Out-Null - - Write-Verbose "Machine needs to be rebooted before Exchange setup can proceed" - - $global:DSCMachineStatus = 1 - } - } - else - { - throw "Unable to find registry key: HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WSMAN" - } - - return $needReboot -} - -function ShouldInstallLanguagePack -{ - param - ( - [System.String] - $Arguments - ) - - if($Arguments -match '(?<=/AddUMLanguagePack:)(([a-z]{2}-[A-Z]{2},?)+)(?=\s)') - { - $Cultures = $Matches[0] - Write-Verbose "AddUMLanguagePack parameters detected: $Cultures" - $Cultures = $Cultures -split "," - - foreach($Culture in $Cultures) - { - if((IsUMLanguagePackInstalled -Culture $Culture) -eq $false) - { - Write-Verbose "UM Language Pack: $Culture is not installed" - return $true - } - } - } - return $false -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchInstall/MSFT_xExchInstall.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchInstall/MSFT_xExchInstall.schema.mof deleted file mode 100644 index 82fdc55e..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchInstall/MSFT_xExchInstall.schema.mof +++ /dev/null @@ -1,8 +0,0 @@ -[ClassVersion("1.0.0"), FriendlyName("xExchInstall")] -class MSFT_xExchInstall : OMI_BaseResource -{ - [Key, Description("Full path to setup.exe in the Exchange 2013 setup directory")] String Path; - [Key, Description("Command line arguments to pass to setup.exe")] String Arguments; - [Required, Description("The credentials to use to perform the installation"), EmbeddedInstance("MSFT_Credential")] String Credential; -}; - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchJetstress/MSFT_xExchJetstress.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchJetstress/MSFT_xExchJetstress.psm1 deleted file mode 100644 index cf450fcc..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchJetstress/MSFT_xExchJetstress.psm1 +++ /dev/null @@ -1,399 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscExamplesPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Performance","Stress","DatabaseBackup","SoftRecovery")] - [System.String] - $Type, - - [parameter(Mandatory = $true)] - [System.String] - $JetstressPath, - - [parameter(Mandatory = $true)] - [System.String] - $JetstressParams, - - [System.UInt32] - $MaxWaitMinutes = 0, - - [System.UInt32] - $MinAchievedIOPS = 0 - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"JetstressPath" = $JetstressPath; "JetstressParams" = $JetstressParams} -VerbosePreference $VerbosePreference - - $returnValue = @{ - Type = $Type - JetstressPath = $JetstressPath - JetstressParams = $JetstressParams - MaxWaitMinutes = $MaxWaitMinutes - } - - $returnValue -} - -function Set-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseDeclaredVarsMoreThanAssignments", "")] - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Performance","Stress","DatabaseBackup","SoftRecovery")] - [System.String] - $Type, - - [parameter(Mandatory = $true)] - [System.String] - $JetstressPath, - - [parameter(Mandatory = $true)] - [System.String] - $JetstressParams, - - [System.UInt32] - $MaxWaitMinutes = 0, - - [System.UInt32] - $MinAchievedIOPS = 0 - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"JetstressPath" = $JetstressPath; "JetstressParams" = $JetstressParams} -VerbosePreference $VerbosePreference - - $jetstressRunning = IsJetstressRunning - $jetstressSuccessful = JetstressTestSuccessful @PSBoundParameters - - if ($jetstressSuccessful -eq $false -and (Get-ChildItem -LiteralPath "$($JetstressPath)" | Where-Object {$null -ne $_.Name -like "$($Type)*.html"})) - { - throw "Jetstress was previously executed and resulted in a failed run. Clean up any $($Type)*.html files in the Jetstress install directory before trying to run this resource again." - } - - if ($jetstressRunning -eq $false) #Jetstress isn't running. Kick it off - { - $initializingESE = $false - - #If the ESE counters haven't been registered for Perfmon, Jetstress is going to need to initialize ESE and restart the process. - if ((Test-Path -LiteralPath "$($env:SystemRoot)\Inf\ESE\eseperf.ini") -eq $false) - { - $initializingESE = $true - } - - #Create and start the Jetstress scheduled task - StartJetstress @PSBoundParameters - - #Give an additional 60 seconds if ESE counters were just initialized. - if ($initializingESE -eq $true) - { - Write-Verbose "Jetstress has never initialized performance counters for ESE. Waiting a full 60 seconds for this to occurr" - - Start-Sleep -Seconds 5 - - for ($i = 55; $i -gt 0; $i--) - { - $jetstressRunning = IsJetstressRunning - - if ($jetstressRunning -eq $false) - { - break - } - else - { - Start-Sleep -Seconds 1 - } - } - - #I've found that Jetstress doesn't always restart after loading ESE when running as local system in a scheduled task in the background - #If Jetstress isn't running at this point, but the perf counters were registered, we probably need to reboot the server - #If Jetstress isn't running and ESE is not registered, something failed. - if ($jetstressRunning -eq $false) - { - if ((Test-Path -LiteralPath "$($env:SystemRoot)\Inf\ESE\eseperf.ini") -eq $true) - { - Write-Verbose "ESE performance counters were registered. Need to reboot server." - - $global:DSCMachineStatus = 1 - return - } - else - { - throw "Jetstress failed to register MSExchange Database performance counters" - } - } - else - { - #Looks like Jetstress restarted itself successfully. Let's let it run. - } - } - else - { - $jetstressRunning = IsJetstressRunning - } - - #Wait up to a minute for Jetstress to start. If it hasn't started by then, something went wrong - $checkMaxTime = [DateTime]::Now.AddMinutes(1) - - while ($jetstressRunning -eq $false -and $checkMaxTime -gt [DateTime]::Now) - { - $jetstressRunning = IsJetstressRunning - - if ($jetstressRunning -eq $false) - { - Start-Sleep -Seconds 1 - } - } - - if ($jetstressRunning -eq $false) - { - throw "Waited 60 seconds after launching the Jetstress scheduled task, but failed to detect that JetstressCmd.exe is running" - } - } - - while ($jetstressRunning -eq $true) - { - Write-Verbose "Jetstress is still running at '$([DateTime]::Now)'." - - #Wait for 5 minutes before logging to the screen again, but actually check every 5 seconds whether Jetstress has completed. - for ($i = 0; $i -lt 300 -and $jetstressRunning -eq $true; $i += 5) - { - $jetstressRunning = IsJetstressRunning - - if ($jetstressRunning -eq $true) - { - Start-Sleep -Seconds 5 - } - } - } - - #Check the final status on the Jetstress run - if ($jetstressRunning -eq $false) - { - Write-Verbose "Jetstress testing finished at '$([DateTime]::Now)'." - - $overallTestSuccessful = JetstressTestSuccessful @PSBoundParameters - - if ($overallTestSuccessful -eq $false) - { - throw "Jetstress finished running, but the test did not complete successfully" - } - else - { - Write-Verbose "Jetstress finished, and the configured test passed" - } - } - else - { - throw "Jetstress is still running after waiting $($MaxWaitMinutes) minutes" - } -} - - -function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Performance","Stress","DatabaseBackup","SoftRecovery")] - [System.String] - $Type, - - [parameter(Mandatory = $true)] - [System.String] - $JetstressPath, - - [parameter(Mandatory = $true)] - [System.String] - $JetstressParams, - - [System.UInt32] - $MaxWaitMinutes = 0, - - [System.UInt32] - $MinAchievedIOPS = 0 - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"JetstressPath" = $JetstressPath; "JetstressParams" = $JetstressParams} -VerbosePreference $VerbosePreference - - $jetstressRunning = IsJetstressRunning -MaximumWaitSeconds 1 - - if ($jetstressRunning -eq $true) - { - return $false - } - else - { - $jetstressSuccessful = JetstressTestSuccessful @PSBoundParameters - - return $jetstressSuccessful - } -} - -#Checks whether the JetstressCmd.exe process is currently running -function IsJetstressRunning -{ - $process = Get-Process -Name JetstressCmd -ErrorAction SilentlyContinue - - return ($null -ne $process) -} - -#Used to create a scheduled task which will initiate the Jetstress run -function StartJetstress -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Performance","Stress","DatabaseBackup","SoftRecovery")] - [System.String] - $Type, - - [parameter(Mandatory = $true)] - [System.String] - $JetstressPath, - - [parameter(Mandatory = $true)] - [System.String] - $JetstressParams, - - [System.UInt32] - $MaxWaitMinutes = 0, - - [System.UInt32] - $MinAchievedIOPS = 0 - ) - - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - $fullPath = Join-Path -Path "$($JetstressPath)" -ChildPath "JetstressCmd.exe" - - StartScheduledTask -Path "$($fullPath)" -Arguments "$($JetstressParams)" -WorkingDirectory "$($JetstressPath)" -TaskName "Jetstress" -MaxWaitMinutes $MaxWaitMinutes -VerbosePreference $VerbosePreference -TaskPriority 1 -} - -#Looks in the latest Type*.html file to determine whether the last Jetstress run passed -function JetstressTestSuccessful -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Performance","Stress","DatabaseBackup","SoftRecovery")] - [System.String] - $Type, - - [parameter(Mandatory = $true)] - [System.String] - $JetstressPath, - - [parameter(Mandatory = $true)] - [System.String] - $JetstressParams, - - [System.UInt32] - $MaxWaitMinutes = 0, - - [System.UInt32] - $MinAchievedIOPS = 0 - ) - - $overallTestSuccessful = $false - $achievedIOPSTarget = $false - - $outputFiles = Get-ChildItem -LiteralPath "$($JetstressPath)" | Where-Object {$_.Name -like "$($Type)*.html"} - - if ($null -ne $outputFiles -and $outputFiles.Count -ge 1) - { - $outputFiles = $outputFiles | Sort-Object -Property LastWriteTime -Descending - - $latest = $outputFiles[0] - - $content = Get-Content -LiteralPath "$($latest.FullName)" - - $foundOverallResults = $false - $foundAchievedIOPS = $false - - for ($i = 0; $i -lt $content.Length -and ($foundOverallResults -eq $false -or $foundAchievedIOPS -eq $false); $i++) - { - if ($content[$i].Contains("Overall Test Result") -or $content[$i].Contains("Achieved Transactional I/O per Second")) - { - $resultStart = $content[$i + 1].IndexOf('>') + 1 - $resultEnd = $content[$i + 1].LastIndexOf('<') - - $result = $content[$i + 1].Substring($resultStart, $resultEnd - $resultStart) - - if ($content[$i].Contains("Overall Test Result")) - { - $foundOverallResults = $true - - Write-Verbose "File $($latest.FullName)'' has an 'Overall Test Result' of '$($result)'" - - if ($result -like "Pass") - { - $overallTestSuccessful = $true - } - } - else - { - $foundAchievedIOPS = $true - - if ([string]::IsNullOrEmpty($result) -eq $false) - { - Write-Verbose "File $($latest.FullName)'' has an 'Achieved Transactional I/O per Second' value of '$($result)'" - - [Decimal]$decResult = [Decimal]::Parse($result) - - if ($decResult -ge $MinAchievedIOPS) - { - $achievedIOPSTarget = $true - } - } - else - { - Write-Verbose "Value for 'Achieved Transactional I/O per Second' is empty" - } - } - } - } - - if ($foundOverallResults -eq $false) - { - Write-Verbose "Unable to find 'Overall Test Result' in file '$($latest.FullName)'" - } - - if ($foundAchievedIOPS -eq $false) - { - Write-Verbose "Unable to find 'Achieved Transactional I/O per Second' in file '$($latest.FullName)'" - } - } - else - { - Write-Verbose "Unable to find any files matching '$($Type)*.html' in folder '$($JetstressPath)'" - } - - return ($overallTestSuccessful -eq $true -and $achievedIOPSTarget -eq $true) -} - -Export-ModuleMember -Function *-TargetResource - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchJetstress/MSFT_xExchJetstress.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchJetstress/MSFT_xExchJetstress.schema.mof deleted file mode 100644 index cf7d002d..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchJetstress/MSFT_xExchJetstress.schema.mof +++ /dev/null @@ -1,13 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xExchJetstress")] -class MSFT_xExchJetstress : OMI_BaseResource -{ - [Key, Description("Specifies the Type which was defined in the JetstressConfig.xml file. Valid values are Performance, Stress, DatabaseBackup, or SoftRecovery. Defaults to Performance."), ValueMap{"Performance","Stress","DatabaseBackup","SoftRecovery"}, Values{"Performance","Stress","DatabaseBackup","SoftRecovery"}] String Type; - [Required, Description("The path to the folder where Jetstress is installed, and which contains JetstressCmd.exe")] String JetstressPath; - [Required, Description("Command line parameters to pass into JetstressCmd.exe")] String JetstressParams; - [Write, Description("The maximum amount of time that the Scheduled Task which runs Jetstress can execute for. Defaults to 0, which means there is no time limit.")] Uint32 MaxWaitMinutes; - [Write, Description("The minimum value reported in the Achieved Transactional I/O per Second section of the Jetstress report for the run to be considered successful. Defaults to 0.")] Uint32 MinAchievedIOPS; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchJetstressCleanup/MSFT_xExchJetstressCleanup.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchJetstressCleanup/MSFT_xExchJetstressCleanup.psm1 deleted file mode 100644 index 73a5056d..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchJetstressCleanup/MSFT_xExchJetstressCleanup.psm1 +++ /dev/null @@ -1,440 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscExamplesPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $JetstressPath, - - [System.String] - $ConfigFilePath, - - [System.String[]] - $DatabasePaths, - - [System.Boolean] - $DeleteAssociatedMountPoints, - - [System.String[]] - $LogPaths, - - [System.String] - $OutputSaveLocation, - - [System.Boolean] - $RemoveBinaries - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"JetstressPath" = $JetstressPath} -VerbosePreference $VerbosePreference - - $returnValue = @{ - JetstressPath = $JetstressPath - } - - $returnValue -} - -function Set-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseDeclaredVarsMoreThanAssignments", "")] - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $JetstressPath, - - [System.String] - $ConfigFilePath, - - [System.String[]] - $DatabasePaths, - - [System.Boolean] - $DeleteAssociatedMountPoints, - - [System.String[]] - $LogPaths, - - [System.String] - $OutputSaveLocation, - - [System.Boolean] - $RemoveBinaries - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeDiskPart.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"JetstressPath" = $JetstressPath} -VerbosePreference $VerbosePreference - - VerifyParameters @PSBoundParameters - - $jetstressInstalled = IsJetstressInstalled - - if ($jetstressInstalled) - { - throw "Jetstress must be uninstalled before using the xExchJetstressCleanup resource" - } - - #If a config file was specified, pull the database and log paths out and put them into $DatabasePaths and $LogPaths - if ($PSBoundParameters.ContainsKey("ConfigFilePath")) - { - [xml]$configFile = LoadConfigXml -ConfigFilePath "$($ConfigFilePath)" - - [string[]]$DatabasePaths = $configFile.configuration.ExchangeProfile.EseInstances.EseInstance.DatabasePaths.Path - [string[]]$LogPaths = $configFile.configuration.ExchangeProfile.EseInstances.EseInstance.LogPath - } - - [string[]]$FoldersToRemove = $DatabasePaths + $LogPaths - - #Now delete the specified directories - [Hashtable]$ParentFoldersToRemove = @{} #Only used if $DeleteAssociatedMountPoints is $true - - foreach ($path in $FoldersToRemove) - { - #Get the parent folder for the specified path - $parent = GetParentFolderFromString -Folder "$($path)" - - if (([string]::IsNullOrEmpty($parent) -eq $false -and $ParentFoldersToRemove.ContainsKey($parent) -eq $false)) - { - $ParentFoldersToRemove.Add($parent, $null) - } - - RemoveFolder -Path "$($path)" - } - - #Delete associated mount points if requested - if ($DeleteAssociatedMountPoints -eq $true -and $ParentFoldersToRemove.Count -gt 0) - { - GetDiskInfo - - foreach ($parent in $ParentFoldersToRemove.Keys) - { - if ($null -eq (Get-ChildItem -LiteralPath "$($parent)" -ErrorAction SilentlyContinue)) - { - $volNum = MountPointExists -Path "$($parent)" - - if ($volNum -ge 0) - { - StartDiskpart -Commands "select volume $($volNum)","remove mount=`"$($parent)`"" -VerbosePreference $VerbosePreference | Out-Null - - RemoveFolder -Path "$($parent)" - } - else - { - Write-Warning "Folder '$($parent)' does not have an associated mount point." - } - } - else - { - Write-Warning "Folder '$($parent)' still has child items. Skipping removing mount point." - } - } - } - - #Clean up binaries if requested - if ($RemoveBinaries -eq $true -and (Test-Path -LiteralPath "$($JetstressPath)") -eq $true) - { - #Move output files if requested - if ([string]::IsNullOrEmpty($OutputSaveLocation) -eq $false) - { - if ((Test-Path -LiteralPath "$($OutputSaveLocation)") -eq $false) - { - mkdir -Path "$($OutputSaveLocation)" - } - - $outputFiles = Get-ChildItem -LiteralPath "$($JetstressPath)" | ` - Where-Object {$_.Name -like "Performance*" -or $_.Name -like "Stress*" -or $_.Name -like "DBChecksum*" -or $_.Name -like "XmlConfig*" -or $_.Name -like "*.evt" -or $_.Name -like "*.log"} - - $outputFiles | Move-Item -Destination "$($OutputSaveLocation)" -Confirm:$false -Force - } - - #Now remove the Jetstress folder - - #If the config file is in the Jetstress directory, remove everything but the config file, or else running Test-TargetResource after removing the directory will fail - if ((GetFolderNoTrailingSlash -Folder "$($JetstressPath)") -like (GetParentFolderFromString -Folder "$($ConfigFilePath)")) - { - Get-ChildItem -LiteralPath "$($JetstressPath)" | Where-Object {$_.FullName -notlike "$($ConfigFilePath)"} | Remove-Item -Recurse -Confirm:$false -Force - } - else #No config file in this directory. Remove the whole thing - { - RemoveFolder -Path "$($JetstressPath)" - } - } - - #Test if we successfully cleaned up Jetstress. If so, flag or initiate a reboot - $cleanedUp = Test-TargetResource @PSBoundParameters - - if ($cleanedUp -eq $true) - { - Write-Verbose "Jetstress was successfully cleaned up. A reboot must occur to finish the cleanup." - - $global:DSCMachineStatus = 1 - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $JetstressPath, - - [System.String] - $ConfigFilePath, - - [System.String[]] - $DatabasePaths, - - [System.Boolean] - $DeleteAssociatedMountPoints, - - [System.String[]] - $LogPaths, - - [System.String] - $OutputSaveLocation, - - [System.Boolean] - $RemoveBinaries - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeDiskPart.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"JetstressPath" = $JetstressPath} -VerbosePreference $VerbosePreference - - VerifyParameters @PSBoundParameters - - $jetstressInstalled = IsJetstressInstalled - - if ($jetstressInstalled) - { - Write-Verbose "Jetstress is still installed" - return $false - } - else - { - #If a config file was specified, pull the database and log paths out and put them into $DatabasePaths and $LogPaths - if ($PSBoundParameters.ContainsKey("ConfigFilePath")) - { - [xml]$configFile = LoadConfigXml -ConfigFilePath "$($ConfigFilePath)" - - [string[]]$FoldersToRemove = $configFile.configuration.ExchangeProfile.EseInstances.EseInstance.DatabasePaths.Path + $configFile.configuration.ExchangeProfile.EseInstances.EseInstance.LogPath - } - else - { - [string[]]$FoldersToRemove = $DatabasePaths + $LogPaths - } - - #First make sure DB and log folders were cleaned up - GetDiskInfo - - foreach ($folder in $FoldersToRemove) - { - #If DeleteAssociatedMountPoints was requested, make sure the parent folder doesn't have a mount point - if ($DeleteAssociatedMountPoints -eq $true) - { - $parent = GetParentFolderFromString -Folder "$($folder)" - - if ((MountPointExists -Path "$($parent)") -ge 0) - { - Write-Verbose "Folder '$($parent)' still has a mount point associated with it." - return $false - } - } - - #Now check the folder itself - if ((Test-Path -LiteralPath "$($folder)") -eq $true) - { - Write-Verbose "Folder '$($folder)' still exists." - return $false - } - } - - #Now check for binaries - if ($RemoveBinaries -eq $true -and (Test-Path -LiteralPath "$($JetstressPath)") -eq $true) - { - if ((GetFolderNoTrailingSlash -Folder "$($JetstressPath)") -like (GetParentFolderFromString -Folder "$($ConfigFilePath)")) - { - $items = Get-ChildItem -LiteralPath "$($JetstressPath)" | Where-Object {$_.FullName -notlike "$($ConfigFilePath)"} - - if ($null -ne $items -or $items.Count -gt 0) - { - Write-Verbose "Folder '$($JetstressPath)' still exists and contains items that are not the config file." - return $false - } - } - else - { - Write-Verbose "Folder '$($JetstressPath)' still exists." - return $false - } - } - } - - Write-Verbose "Jetstress has been successfully cleaned up." - - return $true -} - -#Verifies that parameters for Jetstress were passed in correctly. Throws an exception if not. -function VerifyParameters -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $JetstressPath, - - [System.String] - $ConfigFilePath, - - [System.String[]] - $DatabasePaths, - - [System.Boolean] - $DeleteAssociatedMountPoints, - - [System.String[]] - $LogPaths, - - [System.String] - $OutputSaveLocation, - - [System.Boolean] - $RemoveBinaries - ) - - if ($PSBoundParameters.ContainsKey("ConfigFilePath") -eq $false -and ($PSBoundParameters.ContainsKey("DatabasePaths") -eq $false -or $PSBoundParameters.ContainsKey("LogPaths") -eq $false)) - { - throw "Either the ConfigFilePath parameter must be specified, or DatabasePaths and LogPaths must be specified." - } - - if ($PSBoundParameters.ContainsKey("ConfigFilePath") -eq $true) - { - if ([string]::IsNullOrEmpty($ConfigFilePath) -or ((Test-Path -LiteralPath "$($ConfigFilePath)") -eq $false)) - { - throw "The path specified for ConfigFilePath, '$($ConfigFilePath)', is either invalid or inaccessible" - } - } - else - { - if ($null -eq $DatabasePaths -or $DatabasePaths.Count -eq 0) - { - throw "No paths were specified in the DatabasePaths parameter" - } - - if ($null -eq $LogPaths -or $LogPaths.Count -eq 0) - { - throw "No paths were specified in the LogPaths parameter" - } - } -} - -#Get a string for a folder without the trailing slash -function GetFolderNoTrailingSlash -{ - param([string]$Folder) - - if ($Folder.EndsWith('\')) - { - $Folder = $Folder.Substring(0, $Folder.Length - 1) - } - - return $Folder -} - -#Simple string parsing method to determine what the parent folder of a folder is given the child folder's path -function GetParentFolderFromString -{ - param([string]$Folder) - - $Folder = GetFolderNoTrailingSlash -Folder "$($Folder)" - - $parent = $Folder.Substring(0, $Folder.LastIndexOf('\')) - - return $parent -} - -#Removes the specified folder, if it exists, and all subdirectories -function RemoveFolder -{ - [CmdletBinding()] - param([string]$Path) - - if ((Test-Path -LiteralPath "$($Path)") -eq $true) - { - Write-Verbose "Attempting to remove folder '$($Path)' and all subfolders" - Remove-Item -LiteralPath "$($Path)" -Recurse -Confirm:$false -Force - } - else - { - Write-Verbose "Folder '$($Path)' does not exist. Skipping." - } -} - -#Loads the specified JetstressConfig.xml file and puts it into an [xml] variable -function LoadConfigXml -{ - [CmdletBinding()] - [OutputType([Xml])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $ConfigFilePath - ) - - [xml]$configFile = Get-Content -LiteralPath "$($ConfigFilePath)" - - if ($null -ne $configFile) - { - [string[]]$DatabasePaths = $configFile.configuration.ExchangeProfile.EseInstances.EseInstance.DatabasePaths.Path - [string[]]$LogPaths = $configFile.configuration.ExchangeProfile.EseInstances.EseInstance.LogPath - - if ($null -eq $DatabasePaths -or $DatabasePaths.Count -eq 0) - { - throw "Failed to read any database paths out of config file '$($ConfigFilePath)'" - } - elseif ($null -eq $LogPaths -or $LogPaths.Count -eq 0) - { - throw "Failed to read any log paths out of config file '$($ConfigFilePath)'" - } - } - else - { - throw "Failed to read config file at '$($ConfigFilePath)'" - } - - return $configFile -} - -#Checks whether Jetstress is installed by looking for Jetstress 2013's Product GUID -function IsJetstressInstalled -{ - return ($null -ne (Get-CimInstance -ClassName Win32_Product -Filter "IdentifyingNumber = '{75189587-0D84-4404-8F02-79C39728FA64}'")) -} - - -Export-ModuleMember -Function *-TargetResource - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchJetstressCleanup/MSFT_xExchJetstressCleanup.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchJetstressCleanup/MSFT_xExchJetstressCleanup.schema.mof deleted file mode 100644 index e3224b0d..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchJetstressCleanup/MSFT_xExchJetstressCleanup.schema.mof +++ /dev/null @@ -1,15 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xExchJetstressCleanup")] -class MSFT_xExchJetstressCleanup : OMI_BaseResource -{ - [Key, Description("The path to the folder where Jetstress is installed, and which contains JetstressCmd.exe")] String JetstressPath; - [Write, Description("Either ConfigFilePath, or DatabasePaths AND LogPaths MUST be specified. ConfigFilePath takes precedence. This is the full path to the JetstressConfig.xml file. If ConfigFilePath is specified, the config file will be used to determine the database and log folders that need to be removed")] String ConfigFilePath; - [Write, Description("Either ConfigFilePath, or DatabasePaths AND LogPaths MUST be specified. DatabasePaths specifies the paths to database directories that should be cleaned up.")] String DatabasePaths[]; - [Write, Description("Defaults to $false. If specified, indicates that mount points associated with the Jetstress database and log paths should be removed")] Boolean DeleteAssociatedMountPoints; - [Write, Description("Either ConfigFilePath, or DatabasePaths AND LogPaths MUST be specified. LogPaths specifies the paths to log directories that should be cleaned up.")] String LogPaths[]; - [Write, Description("If RemoveBinaries is set to $true and Jetstress output was saved to the default location (the installation path of Jetstress), specifies the folder path to copy the Jetstress output files to.")] String OutputSaveLocation; - [Write, Description("Specifies that the files in the Jetstress installation directory should be removed")] Boolean RemoveBinaries; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMailboxDatabase/MSFT_xExchMailboxDatabase.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMailboxDatabase/MSFT_xExchMailboxDatabase.psm1 deleted file mode 100644 index 6895f852..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMailboxDatabase/MSFT_xExchMailboxDatabase.psm1 +++ /dev/null @@ -1,992 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscTestsPresent", "")] -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscExamplesPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [System.UInt32] - $DatabaseCopyCount, - - [parameter(Mandatory = $true)] - [System.String] - $EdbFilePath, - - [parameter(Mandatory = $true)] - [System.String] - $LogFolderPath, - - [parameter(Mandatory = $true)] - [System.String] - $Server, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $AutoDagExcludeFromMonitoring, - - [System.Boolean] - $BackgroundDatabaseMaintenance, - - [System.String] - $CalendarLoggingQuota, - - [System.Boolean] - $CircularLoggingEnabled, - - [ValidateSet("None","SecondCopy","SecondDatacenter","AllDatacenters","AllCopies")] - [System.String] - $DataMoveReplicationConstraint, - - [System.String] - $DeletedItemRetention, - - [System.String] - $DomainController, - - [System.String] - $EventHistoryRetentionPeriod, - - [System.Boolean] - $IndexEnabled, - - [System.Boolean] - $IsExcludedFromProvisioning, - - [System.String] - $IsExcludedFromProvisioningReason, - - [System.String] - $IssueWarningQuota, - - [System.Boolean] - $IsSuspendedFromProvisioning, - - [System.String] - $JournalRecipient, - - [System.String] - $MailboxRetention, - - [System.Boolean] - $MountAtStartup, - - [System.String] - $OfflineAddressBook, - - [System.String] - $ProhibitSendQuota, - - [System.String] - $ProhibitSendReceiveQuota, - - [System.String] - $RecoverableItemsQuota, - - [System.String] - $RecoverableItemsWarningQuota, - - [System.Boolean] - $RetainDeletedItemsUntilBackup, - - [System.String] - $AdServerSettingsPreferredServer, - - [System.Boolean] - $SkipInitialDatabaseMount - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Name" = $Name} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-MailboxDatabase","Set-AdServerSettings" -VerbosePreference $VerbosePreference - - if ($PSBoundParameters.ContainsKey("AdServerSettingsPreferredServer") -and ![string]::IsNullOrEmpty($AdServerSettingsPreferredServer)) - { - Set-ADServerSettings –PreferredServer "$($AdServerSettingsPreferredServer)" - } - - $db = GetMailboxDatabase @PSBoundParameters - - if ($null -ne $db) - { - $returnValue = @{ - Name = $Name - Server = $Server - EdbFilePath = $EdbFilePath - LogFolderPath = $LogFolderPath - DatabaseCopyCount = $DatabaseCopyCount - AutoDagExcludeFromMonitoring = $db.AutoDagExcludeFromMonitoring - BackgroundDatabaseMaintenance = $db.BackgroundDatabaseMaintenance - CalendarLoggingQuota = $db.CalendarLoggingQuota - CircularLoggingEnabled = $db.CircularLoggingEnabled - DataMoveReplicationConstraint = $db.DataMoveReplicationConstraint - DeletedItemRetention = $db.DeletedItemRetention - EventHistoryRetentionPeriod = $db.EventHistoryRetentionPeriod - IndexEnabled = $db.IndexEnabled - IsExcludedFromProvisioning = $db.IsExcludedFromProvisioning - IssueWarningQuota = $db.IssueWarningQuota - IsSuspendedFromProvisioning = $db.IsSuspendedFromProvisioning - JournalRecipient = $db.JournalRecipient - MailboxRetention = $db.MailboxRetention - MountAtStartup = $db.MountAtStartup - OfflineAddressBook = $db.OfflineAddressBook - ProhibitSendQuota = $db.ProhibitSendQuota - ProhibitSendReceiveQuota = $db.ProhibitSendReceiveQuota - RecoverableItemsQuota = $db.RecoverableItemsQuota - RecoverableItemsWarningQuota = $db.RecoverableItemsWarningQuota - RetainDeletedItemsUntilBackup = $db.RetainDeletedItemsUntilBackup - } - - $serverVersion = GetExchangeVersion - - if ($serverVersion -eq "2016") - { - $returnValue.Add("IsExcludedFromProvisioningReason", $db.IsExcludedFromProvisioningReason) - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [System.UInt32] - $DatabaseCopyCount, - - [parameter(Mandatory = $true)] - [System.String] - $EdbFilePath, - - [parameter(Mandatory = $true)] - [System.String] - $LogFolderPath, - - [parameter(Mandatory = $true)] - [System.String] - $Server, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $AutoDagExcludeFromMonitoring, - - [System.Boolean] - $BackgroundDatabaseMaintenance, - - [System.String] - $CalendarLoggingQuota, - - [System.Boolean] - $CircularLoggingEnabled, - - [ValidateSet("None","SecondCopy","SecondDatacenter","AllDatacenters","AllCopies")] - [System.String] - $DataMoveReplicationConstraint, - - [System.String] - $DeletedItemRetention, - - [System.String] - $DomainController, - - [System.String] - $EventHistoryRetentionPeriod, - - [System.Boolean] - $IndexEnabled, - - [System.Boolean] - $IsExcludedFromProvisioning, - - [System.String] - $IsExcludedFromProvisioningReason, - - [System.String] - $IssueWarningQuota, - - [System.Boolean] - $IsSuspendedFromProvisioning, - - [System.String] - $JournalRecipient, - - [System.String] - $MailboxRetention, - - [System.Boolean] - $MountAtStartup, - - [System.String] - $OfflineAddressBook, - - [System.String] - $ProhibitSendQuota, - - [System.String] - $ProhibitSendReceiveQuota, - - [System.String] - $RecoverableItemsQuota, - - [System.String] - $RecoverableItemsWarningQuota, - - [System.Boolean] - $RetainDeletedItemsUntilBackup, - - [System.String] - $AdServerSettingsPreferredServer, - - [System.Boolean] - $SkipInitialDatabaseMount - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Name" = $Name} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "*MailboxDatabase","Move-DatabasePath","Mount-Database","Set-AdServerSettings" -VerbosePreference $VerbosePreference - - #Check for non-existent parameters in Exchange 2013 - RemoveVersionSpecificParameters -PSBoundParametersIn $PSBoundParameters -ParamName "IsExcludedFromProvisioningReason" -ResourceName "xExchMailboxDatabase" -ParamExistsInVersion "2016" - - if ($PSBoundParameters.ContainsKey("AdServerSettingsPreferredServer") -and ![string]::IsNullOrEmpty($AdServerSettingsPreferredServer)) - { - Set-ADServerSettings –PreferredServer "$($AdServerSettingsPreferredServer)" - } - - $db = GetMailboxDatabase @PSBoundParameters - - if ($null -eq $db) #Need to create a new DB - { - #Create a copy of the original parameters - $originalPSBoundParameters = @{} + $PSBoundParameters - - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Name","Server","EdbFilePath","LogFolderPath","DomainController" - - #Create the database - $db = New-MailboxDatabase @PSBoundParameters - - if ($null -ne $db) - { - #Add original props back - AddParameters -PSBoundParametersIn $PSBoundParameters -ParamsToAdd $originalPSBoundParameters - - if ($AllowServiceRestart -eq $true) - { - Write-Verbose "Restarting Information Store" - - Restart-Service MSExchangeIS - } - else - { - Write-Warning "The configuration will not take effect until MSExchangeIS is manually restarted." - } - - #If MountAtStartup is not explicitly set to $false, mount the new database - if ($PSBoundParameters.ContainsKey("SkipInitialDatabaseMount") -eq $true -and $SkipInitialDatabaseMount -eq $true) - { - #Don't mount the DB, regardless of what else is set. - } - elseif ($PSBoundParameters.ContainsKey("MountAtStartup") -eq $false -or $MountAtStartup -eq $true) - { - Write-Verbose "Attempting to mount database." - - MountDatabase @PSBoundParameters - } - } - else - { - throw "Failed to create new Mailbox Database" - } - } - - if ($null -ne $db) #Set props on existing DB - { - #First check if a DB or log move is required - if (($PSBoundParameters.ContainsKey("EdbFilePath") -and (CompareStrings -String1 $db.EdbFilePath.PathName -String2 $EdbFilePath -IgnoreCase) -eq $false) -or - ($PSBoundParameters.ContainsKey("LogFolderPath") -and (CompareStrings -String1 $db.LogFolderPath.PathName -String2 $LogFolderPath -IgnoreCase) -eq $false)) - { - if ($db.DatabaseCopies.Count -le 1) - { - Write-Verbose "Moving database and/or log path" - - MoveDatabaseOrLogPath @PSBoundParameters - } - else - { - throw "Database must have only a single copy for the DB path or log path to be moved" - } - } - - #setup params - AddParameters -PSBoundParametersIn $PSBoundParameters -ParamsToAdd @{"Identity" = $Name} - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "Name","Server","DatabaseCopyCount","AllowServiceRestart","EdbFilePath","LogFolderPath","Credential","AdServerSettingsPreferredServer","SkipInitialDatabaseMount" - - #Remove parameters that depend on all copies being added - if ($db.DatabaseCopies.Count -lt $DatabaseCopyCount) - { - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "CircularLoggingEnabled","DataMoveReplicationConstraint" - } - - Set-MailboxDatabase @PSBoundParameters - } -} - - -function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [System.UInt32] - $DatabaseCopyCount, - - [parameter(Mandatory = $true)] - [System.String] - $EdbFilePath, - - [parameter(Mandatory = $true)] - [System.String] - $LogFolderPath, - - [parameter(Mandatory = $true)] - [System.String] - $Server, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $AutoDagExcludeFromMonitoring, - - [System.Boolean] - $BackgroundDatabaseMaintenance, - - [System.String] - $CalendarLoggingQuota, - - [System.Boolean] - $CircularLoggingEnabled, - - [ValidateSet("None","SecondCopy","SecondDatacenter","AllDatacenters","AllCopies")] - [System.String] - $DataMoveReplicationConstraint, - - [System.String] - $DeletedItemRetention, - - [System.String] - $DomainController, - - [System.String] - $EventHistoryRetentionPeriod, - - [System.Boolean] - $IndexEnabled, - - [System.Boolean] - $IsExcludedFromProvisioning, - - [System.String] - $IsExcludedFromProvisioningReason, - - [System.String] - $IssueWarningQuota, - - [System.Boolean] - $IsSuspendedFromProvisioning, - - [System.String] - $JournalRecipient, - - [System.String] - $MailboxRetention, - - [System.Boolean] - $MountAtStartup, - - [System.String] - $OfflineAddressBook, - - [System.String] - $ProhibitSendQuota, - - [System.String] - $ProhibitSendReceiveQuota, - - [System.String] - $RecoverableItemsQuota, - - [System.String] - $RecoverableItemsWarningQuota, - - [System.Boolean] - $RetainDeletedItemsUntilBackup, - - [System.String] - $AdServerSettingsPreferredServer, - - [System.Boolean] - $SkipInitialDatabaseMount - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Name" = $Name} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-MailboxDatabase","Get-Mailbox","Set-AdServerSettings" -VerbosePreference $VerbosePreference - - #Check for non-existent parameters in Exchange 2013 - RemoveVersionSpecificParameters -PSBoundParametersIn $PSBoundParameters -ParamName "IsExcludedFromProvisioningReason" -ResourceName "xExchMailboxDatabase" -ParamExistsInVersion "2016" - - if ($PSBoundParameters.ContainsKey("AdServerSettingsPreferredServer") -and ![string]::IsNullOrEmpty($AdServerSettingsPreferredServer)) - { - Set-ADServerSettings –PreferredServer "$($AdServerSettingsPreferredServer)" - } - - $db = GetMailboxDatabase @PSBoundParameters - - if ($null -eq $db) - { - return $false - } - else - { - if (!(VerifySetting -Name "AutoDagExcludeFromMonitoring" -Type "Boolean" -ExpectedValue $AutoDagExcludeFromMonitoring -ActualValue $db.AutoDagExcludeFromMonitoring -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "BackgroundDatabaseMaintenance" -Type "Boolean" -ExpectedValue $BackgroundDatabaseMaintenance -ActualValue $db.BackgroundDatabaseMaintenance -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "CalendarLoggingQuota" -Type "Unlimited" -ExpectedValue $CalendarLoggingQuota -ActualValue $db.CalendarLoggingQuota -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - #Only check these if all copies have been added - if ($db.DatabaseCopies.Count -ge $DatabaseCopyCount) - { - if (!(VerifySetting -Name "CircularLoggingEnabled" -Type "Boolean" -ExpectedValue $CircularLoggingEnabled -ActualValue $db.CircularLoggingEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "DataMoveReplicationConstraint" -Type "Boolean" -ExpectedValue $DataMoveReplicationConstraint -ActualValue $db.DataMoveReplicationConstraint -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - } - - if (!(VerifySetting -Name "DeletedItemRetention" -Type "Timespan" -ExpectedValue $DeletedItemRetention -ActualValue $db.DeletedItemRetention -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "EdbFilePath" -Type "String" -ExpectedValue $EdbFilePath -ActualValue $db.EdbFilePath.PathName -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "EventHistoryRetentionPeriod" -Type "Timespan" -ExpectedValue $EventHistoryRetentionPeriod -ActualValue $db.EventHistoryRetentionPeriod -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "IndexEnabled" -Type "Boolean" -ExpectedValue $IndexEnabled -ActualValue $db.IndexEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "IsExcludedFromProvisioning" -Type "Boolean" -ExpectedValue $IsExcludedFromProvisioning -ActualValue $db.IsExcludedFromProvisioning -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "IssueWarningQuota" -Type "Unlimited" -ExpectedValue $IssueWarningQuota -ActualValue $db.IssueWarningQuota -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "IsSuspendedFromProvisioning" -Type "Boolean" -ExpectedValue $IsSuspendedFromProvisioning -ActualValue $db.IsSuspendedFromProvisioning -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "JournalRecipient" -Type "ADObjectID" -ExpectedValue $JournalRecipient -ActualValue $db.JournalRecipient -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "LogFolderPath" -Type "String" -ExpectedValue $LogFolderPath -ActualValue $db.LogFolderPath.PathName -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MailboxRetention" -Type "Timespan" -ExpectedValue $MailboxRetention -ActualValue $db.MailboxRetention -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MountAtStartup" -Type "Boolean" -ExpectedValue $MountAtStartup -ActualValue $db.MountAtStartup -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - #Strip leading slash off the OAB now so it's easier to check - if ($PSBoundParameters.ContainsKey("OfflineAddressBook")) - { - if ($OfflineAddressBook.StartsWith('\')) - { - $OfflineAddressBook = $OfflineAddressBook.Substring(1) - } - - if ($db.OfflineAddressBook.Name.StartsWith('\')) - { - $dbOab = $db.OfflineAddressBook.Name.Substring(1) - } - else - { - $dbOab = $db.OfflineAddressBook.Name - } - } - - if (!(VerifySetting -Name "OfflineAddressBook" -Type "String" -ExpectedValue $OfflineAddressBook -ActualValue $dbOab -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ProhibitSendQuota" -Type "Unlimited" -ExpectedValue $ProhibitSendQuota -ActualValue $db.ProhibitSendQuota -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ProhibitSendReceiveQuota" -Type "Unlimited" -ExpectedValue $ProhibitSendReceiveQuota -ActualValue $db.ProhibitSendReceiveQuota -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "RecoverableItemsQuota" -Type "Unlimited" -ExpectedValue $RecoverableItemsQuota -ActualValue $db.RecoverableItemsQuota -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "RecoverableItemsWarningQuota" -Type "Unlimited" -ExpectedValue $RecoverableItemsWarningQuota -ActualValue $db.RecoverableItemsWarningQuota -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "RetainDeletedItemsUntilBackup" -Type "Boolean" -ExpectedValue $RetainDeletedItemsUntilBackup -ActualValue $db.RetainDeletedItemsUntilBackup -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - } - - return $true -} - -#Runs Get-MailboxDatabase, only specifying Identity and optionally DomainController -function GetMailboxDatabase -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [System.UInt32] - $DatabaseCopyCount, - - [parameter(Mandatory = $true)] - [System.String] - $EdbFilePath, - - [parameter(Mandatory = $true)] - [System.String] - $LogFolderPath, - - [parameter(Mandatory = $true)] - [System.String] - $Server, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $AutoDagExcludeFromMonitoring, - - [System.Boolean] - $BackgroundDatabaseMaintenance, - - [System.String] - $CalendarLoggingQuota, - - [System.Boolean] - $CircularLoggingEnabled, - - [ValidateSet("None","SecondCopy","SecondDatacenter","AllDatacenters","AllCopies")] - [System.String] - $DataMoveReplicationConstraint, - - [System.String] - $DeletedItemRetention, - - [System.String] - $DomainController, - - [System.String] - $EventHistoryRetentionPeriod, - - [System.Boolean] - $IndexEnabled, - - [System.Boolean] - $IsExcludedFromProvisioning, - - [System.String] - $IsExcludedFromProvisioningReason, - - [System.String] - $IssueWarningQuota, - - [System.Boolean] - $IsSuspendedFromProvisioning, - - [System.String] - $JournalRecipient, - - [System.String] - $MailboxRetention, - - [System.Boolean] - $MountAtStartup, - - [System.String] - $OfflineAddressBook, - - [System.String] - $ProhibitSendQuota, - - [System.String] - $ProhibitSendReceiveQuota, - - [System.String] - $RecoverableItemsQuota, - - [System.String] - $RecoverableItemsWarningQuota, - - [System.Boolean] - $RetainDeletedItemsUntilBackup, - - [System.String] - $AdServerSettingsPreferredServer, - - [System.Boolean] - $SkipInitialDatabaseMount - ) - - AddParameters -PSBoundParametersIn $PSBoundParameters -ParamsToAdd @{"Identity" = $Name} - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Identity","DomainController" - - return (Get-MailboxDatabase @PSBoundParameters -ErrorAction SilentlyContinue) -} - -#Moves the database or log path. Doesn't validate that the DB is in a good condition to move. Caller should do that. -function MoveDatabaseOrLogPath -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [System.UInt32] - $DatabaseCopyCount, - - [parameter(Mandatory = $true)] - [System.String] - $EdbFilePath, - - [parameter(Mandatory = $true)] - [System.String] - $LogFolderPath, - - [parameter(Mandatory = $true)] - [System.String] - $Server, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $AutoDagExcludeFromMonitoring, - - [System.Boolean] - $BackgroundDatabaseMaintenance, - - [System.String] - $CalendarLoggingQuota, - - [System.Boolean] - $CircularLoggingEnabled, - - [ValidateSet("None","SecondCopy","SecondDatacenter","AllDatacenters","AllCopies")] - [System.String] - $DataMoveReplicationConstraint, - - [System.String] - $DeletedItemRetention, - - [System.String] - $DomainController, - - [System.String] - $EventHistoryRetentionPeriod, - - [System.Boolean] - $IndexEnabled, - - [System.Boolean] - $IsExcludedFromProvisioning, - - [System.String] - $IsExcludedFromProvisioningReason, - - [System.String] - $IssueWarningQuota, - - [System.Boolean] - $IsSuspendedFromProvisioning, - - [System.String] - $JournalRecipient, - - [System.String] - $MailboxRetention, - - [System.Boolean] - $MountAtStartup, - - [System.String] - $OfflineAddressBook, - - [System.String] - $ProhibitSendQuota, - - [System.String] - $ProhibitSendReceiveQuota, - - [System.String] - $RecoverableItemsQuota, - - [System.String] - $RecoverableItemsWarningQuota, - - [System.Boolean] - $RetainDeletedItemsUntilBackup, - - [System.String] - $AdServerSettingsPreferredServer, - - [System.Boolean] - $SkipInitialDatabaseMount - ) - - AddParameters -PSBoundParametersIn $PSBoundParameters -ParamsToAdd @{"Identity" = $Name} - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Identity","DomainController","EdbFilePath","LogFolderPath" - - Move-DatabasePath @PSBoundParameters -Confirm:$false -Force -} - -#Mounts the specified database -function MountDatabase -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [System.UInt32] - $DatabaseCopyCount, - - [parameter(Mandatory = $true)] - [System.String] - $EdbFilePath, - - [parameter(Mandatory = $true)] - [System.String] - $LogFolderPath, - - [parameter(Mandatory = $true)] - [System.String] - $Server, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $AutoDagExcludeFromMonitoring, - - [System.Boolean] - $BackgroundDatabaseMaintenance, - - [System.String] - $CalendarLoggingQuota, - - [System.Boolean] - $CircularLoggingEnabled, - - [ValidateSet("None","SecondCopy","SecondDatacenter","AllDatacenters","AllCopies")] - [System.String] - $DataMoveReplicationConstraint, - - [System.String] - $DeletedItemRetention, - - [System.String] - $DomainController, - - [System.String] - $EventHistoryRetentionPeriod, - - [System.Boolean] - $IndexEnabled, - - [System.Boolean] - $IsExcludedFromProvisioning, - - [System.String] - $IsExcludedFromProvisioningReason, - - [System.String] - $IssueWarningQuota, - - [System.Boolean] - $IsSuspendedFromProvisioning, - - [System.String] - $JournalRecipient, - - [System.String] - $MailboxRetention, - - [System.Boolean] - $MountAtStartup, - - [System.String] - $OfflineAddressBook, - - [System.String] - $ProhibitSendQuota, - - [System.String] - $ProhibitSendReceiveQuota, - - [System.String] - $RecoverableItemsQuota, - - [System.String] - $RecoverableItemsWarningQuota, - - [System.Boolean] - $RetainDeletedItemsUntilBackup, - - [System.String] - $AdServerSettingsPreferredServer, - - [System.Boolean] - $SkipInitialDatabaseMount - ) - - AddParameters -PSBoundParametersIn $PSBoundParameters -ParamsToAdd @{"Identity" = $Name} - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Identity","DomainController" - - NotePreviousError - - Mount-Database @PSBoundParameters - - ThrowIfNewErrorsEncountered -CmdletBeingRun "Mount-Database" -VerbosePreference $VerbosePreference -} - -Export-ModuleMember -Function *-TargetResource - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMailboxDatabase/MSFT_xExchMailboxDatabase.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMailboxDatabase/MSFT_xExchMailboxDatabase.schema.mof deleted file mode 100644 index 67b6f980..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMailboxDatabase/MSFT_xExchMailboxDatabase.schema.mof +++ /dev/null @@ -1,42 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xExchMailboxDatabase")] -class MSFT_xExchMailboxDatabase : OMI_BaseResource -{ - [Key] String Name; //Name of the database - [Required, EmbeddedInstance("MSFT_Credential")] String Credential; //Credentials used to establish a remote Powershell session to Exchange - [Required] Uint32 DatabaseCopyCount; //The number of copies that the database will have once fully configured - [Required] String Server; //Server to create the database on - [Required] String EdbFilePath; //Full path to where the database file will be located - [Required] String LogFolderPath; //Folder where logs for the DB will exist - [Write] String AdServerSettingsPreferredServer; //An optional domain controller to pass to Set-AdServerSettings -PreferredServer - [Write] Boolean SkipInitialDatabaseMount; //Whether the initial mount of databases should be skipped after database creation - - //Remaining props correspond to Set-MailboxDatabase parameters - //http://technet.microsoft.com/en-us/library/bb123971%28v=exchg.150%29.aspx - [Write] Boolean AllowServiceRestart; - [Write] Boolean AutoDagExcludeFromMonitoring; - [Write] Boolean BackgroundDatabaseMaintenance; - [Write] String CalendarLoggingQuota; - [Write] Boolean CircularLoggingEnabled; //Will not be enabled until all copies have been added - [Write, ValueMap{"None","SecondCopy","SecondDatacenter","AllDatacenters","AllCopies"}, Values{"None","SecondCopy","SecondDatacenter","AllDatacenters","AllCopies"}] String DataMoveReplicationConstraint; - [Write] String DeletedItemRetention; - [Write] String DomainController; - [Write] String EventHistoryRetentionPeriod; - [Write] Boolean IndexEnabled; - [Write] Boolean IsExcludedFromProvisioning; - [Write] String IsExcludedFromProvisioningReason; - [Write] String IssueWarningQuota; - [Write] Boolean IsSuspendedFromProvisioning; - [Write] String JournalRecipient; - [Write] String MailboxRetention; - [Write] Boolean MountAtStartup; - [Write] String OfflineAddressBook; - [Write] String ProhibitSendQuota; - [Write] String ProhibitSendReceiveQuota; - [Write] String RecoverableItemsQuota; - [Write] String RecoverableItemsWarningQuota; - [Write] Boolean RetainDeletedItemsUntilBackup; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMailboxDatabaseCopy/MSFT_xExchMailboxDatabaseCopy.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMailboxDatabaseCopy/MSFT_xExchMailboxDatabaseCopy.psm1 deleted file mode 100644 index 3105adf5..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMailboxDatabaseCopy/MSFT_xExchMailboxDatabaseCopy.psm1 +++ /dev/null @@ -1,383 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscTestsPresent", "")] -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscExamplesPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [System.String] - $MailboxServer, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.UInt32] - $ActivationPreference, - - [System.String] - $DomainController, - - [System.String] - $ReplayLagTime, - - [System.Boolean] - $SeedingPostponed, - - [System.String] - $TruncationLagTime, - - [System.String] - $AdServerSettingsPreferredServer - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-MailboxDatabase","*DatabaseCopy*","Set-AdServerSettings" -VerbosePreference $VerbosePreference - - if ($PSBoundParameters.ContainsKey("AdServerSettingsPreferredServer") -and ![string]::IsNullOrEmpty($AdServerSettingsPreferredServer)) - { - Set-ADServerSettings –PreferredServer "$($AdServerSettingsPreferredServer)" - } - - $db = GetMailboxDatabase @PSBoundParameters - - $serverHasCopy = $false - - #First figure out if this server has a copy - foreach ($copy in $db.DatabaseCopies) - { - if ($copy.HostServerName -like $MailboxServer) - { - $serverHasCopy = $true - break - } - } - - #If we have a copy, parse out the values - if ($serverHasCopy -eq $true) - { - foreach ($pref in $db.ActivationPreference) - { - if ($pref.Key.Name -like $MailboxServer) - { - $ActivationPreference = $pref.Value - break - } - } - - foreach ($rlt in $db.ReplayLagTimes) - { - if ($rlt.Key.Name -like $MailboxServer) - { - $ReplayLagTime = $rlt.Value - break - } - } - - foreach ($tlt in $db.TruncationLagTimes) - { - if ($tlt.Key.Name -like $MailboxServer) - { - $TruncationLagTime = $tlt.Value - break - } - } - - $returnValue = @{ - Identity = $Identity - MailboxServer = $MailboxServer - ActivationPreference = $ActivationPreference - ReplayLagTime = $ReplayLagTime - TruncationLagTime = $TruncationLagTime - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [System.String] - $MailboxServer, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.UInt32] - $ActivationPreference, - - [System.String] - $DomainController, - - [System.String] - $ReplayLagTime, - - [System.Boolean] - $SeedingPostponed, - - [System.String] - $TruncationLagTime, - - [System.String] - $AdServerSettingsPreferredServer - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Don't need to establish remote session, as Get-TargetResource will do it - $copy = Get-TargetResource @PSBoundParameters - - $copyCount = 0 - $existingDb = GetMailboxDatabase @PSBoundParameters -ErrorAction SilentlyContinue - - if ($null -ne $existingDb) - { - $copyCount = $existingDb.DatabaseCopies.Count - } - - if ($null -eq $copy) #We need to add a new copy - { - Write-Verbose "A copy of database '$($Identity)' does not exist on server '$($MailboxServer)'. Adding." - - #Increment the copy count to what it will be when this copy is added - $copyCount++ - - #Create a copy of the original parameters - $originalPSBoundParameters = @{} + $PSBoundParameters - - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "Credential","AllowServiceRestart","AdServerSettingsPreferredServer" - - #Only send in ActivationPreference if it is less than or equal to the future copy count after adding this copy - if ($PSBoundParameters.ContainsKey("ActivationPreference") -and $ActivationPreference -gt $copyCount) - { - Write-Warning "Desired activation preference '$($ActivationPreference)' is higher than the future copy count '$($copyCount)'. Skipping setting ActivationPreference at this point." - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "ActivationPreference" - } - - #If SeedingPostponed was passed, turn it into a switch parameter instead of a bool - if ($PSBoundParameters.ContainsKey("SeedingPostponed")) - { - if ($SeedingPostponed -eq $true) - { - $PSBoundParameters.Remove("SeedingPostponed") - $PSBoundParameters.Add("SeedingPostponed", $null) - } - else - { - $PSBoundParameters.Remove("SeedingPostponed") - } - } - - #Create the database - NotePreviousError - - Add-MailboxDatabaseCopy @PSBoundParameters - - ThrowIfNewErrorsEncountered -CmdletBeingRun "Add-MailboxDatabaseCopy" -VerbosePreference $VerbosePreference - - #Increment the copy count, as if we made it here, we didn't fail - $copyCount++ - - #Add original props back - AddParameters -PSBoundParametersIn $PSBoundParameters -ParamsToAdd $originalPSBoundParameters - - #See if we can find the new copy - $copy = Get-TargetResource @PSBoundParameters - - if ($null -ne $copy) - { - #Again, add original props back - AddParameters -PSBoundParametersIn $PSBoundParameters -ParamsToAdd $originalPSBoundParameters - - if ($AllowServiceRestart -eq $true) - { - Write-Verbose "Restarting Information Store" - - Restart-Service MSExchangeIS - } - else - { - Write-Warning "The configuration will not take effect until MSExchangeIS is manually restarted." - } - } - else - { - throw "Failed to find database copy after running Add-MailboxDatabaseCopy" - } - } - else #($null -ne $copy) #Need to set props on copy - { - AddParameters -PSBoundParametersIn $PSBoundParameters -ParamsToAdd @{"Identity" = "$($Identity)\$($MailboxServer)"} - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "Credential","AllowServiceRestart","MailboxServer","AdServerSettingsPreferredServer","SeedingPostponed" - - if ($PSBoundParameters.ContainsKey("ActivationPreference") -and $ActivationPreference -gt $copyCount) - { - Write-Warning "Desired activation preference '$($ActivationPreference)' is higher than current copy count '$($copyCount)'. Skipping setting ActivationPreference at this point." - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "ActivationPreference" - } - - Set-MailboxDatabaseCopy @PSBoundParameters - } -} - - -function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [System.String] - $MailboxServer, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.UInt32] - $ActivationPreference, - - [System.String] - $DomainController, - - [System.String] - $ReplayLagTime, - - [System.Boolean] - $SeedingPostponed, - - [System.String] - $TruncationLagTime, - - [System.String] - $AdServerSettingsPreferredServer - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Don't need to establish remote session, as Get-TargetResource will do it - $copy = Get-TargetResource @PSBoundParameters - - if ($null -eq $copy) - { - return $false - } - else - { - if (!(VerifySetting -Name "ActivationPreference" -Type "Int" -ExpectedValue $ActivationPreference -ActualValue $copy.ActivationPreference -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ReplayLagTime" -Type "Timespan" -ExpectedValue $ReplayLagTime -ActualValue $copy.ReplayLagTime -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "TruncationLagTime" -Type "Timespan" -ExpectedValue $TruncationLagTime -ActualValue $copy.TruncationLagTime -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - } - - return $true -} - -function GetMailboxDatabase -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [System.String] - $MailboxServer, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.UInt32] - $ActivationPreference, - - [System.String] - $DomainController, - - [System.String] - $ReplayLagTime, - - [System.Boolean] - $SeedingPostponed, - - [System.String] - $TruncationLagTime, - - [System.String] - $AdServerSettingsPreferredServer - ) - - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Identity","DomainController" - - return (Get-MailboxDatabase @PSBoundParameters -Status -ErrorAction SilentlyContinue) -} - -Export-ModuleMember -Function *-TargetResource - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMailboxDatabaseCopy/MSFT_xExchMailboxDatabaseCopy.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMailboxDatabaseCopy/MSFT_xExchMailboxDatabaseCopy.schema.mof deleted file mode 100644 index e2d05a85..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMailboxDatabaseCopy/MSFT_xExchMailboxDatabaseCopy.schema.mof +++ /dev/null @@ -1,21 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xExchMailboxDatabaseCopy")] -class MSFT_xExchMailboxDatabaseCopy : OMI_BaseResource -{ - [Key] String Identity; //Name of database - [Required, EmbeddedInstance("MSFT_Credential")] String Credential; //Credentials used to establish a remote Powershell session to Exchange - [Required] String MailboxServer; //Server to add copy to. Should be the host name, not the FQDN. - [Write] String AdServerSettingsPreferredServer; //An optional domain controller to pass to Set-AdServerSettings -PreferredServer - [Write] Boolean AllowServiceRestart; //Whether it is OK to restart Information Store after adding copy - - //Remaing props, and some of the above, correspond directly to Add-MailboxDatabaseCopy parameters - //http://technet.microsoft.com/en-us/library/dd298105(v=exchg.150).aspx - [Write] Uint32 ActivationPreference; - [Write] String DomainController; - [Write] String ReplayLagTime; - [Write] Boolean SeedingPostponed; - [Write] String TruncationLagTime; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMailboxServer/MSFT_xExchMailboxServer.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMailboxServer/MSFT_xExchMailboxServer.psm1 deleted file mode 100644 index 3bf9f078..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMailboxServer/MSFT_xExchMailboxServer.psm1 +++ /dev/null @@ -1,1072 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscTestsPresent", "")] -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscExamplesPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [ValidateSet("BestAvailability","GoodAvailability","Lossless")] - [System.String] - $AutoDatabaseMountDial, - - [System.Int32] - $CalendarRepairIntervalEndWindow, - - [System.String] - $CalendarRepairLogDirectorySizeLimit, - - [System.Boolean] - $CalendarRepairLogEnabled, - - [System.String] - $CalendarRepairLogFileAgeLimit, - - [System.String] - $CalendarRepairLogPath, - - [System.Boolean] - $CalendarRepairLogSubjectLoggingEnabled, - - [System.Boolean] - $CalendarRepairMissingItemFixDisabled, - - [ValidateSet("ValidateOnly","RepairAndValidate")] - [System.String] - $CalendarRepairMode, - - [System.String] - $CalendarRepairWorkCycle, - - [System.String] - $CalendarRepairWorkCycleCheckpoint, - - [System.Boolean] - $DatabaseCopyActivationDisabledAndMoveNow, - - [ValidateSet("Blocked","IntrasiteOnly","Unrestricted")] - [System.String] - $DatabaseCopyAutoActivationPolicy, - - [System.String] - $DomainController, - - [System.Boolean] - $FolderLogForManagedFoldersEnabled, - - [System.Boolean] - $ForceGroupMetricsGeneration, - - [System.Boolean] - $IsExcludedFromProvisioning, - - [System.Boolean] - $JournalingLogForManagedFoldersEnabled, - - [System.String[]] - $Locale, - - [System.String] - $LogDirectorySizeLimitForManagedFolders, - - [System.String] - $LogFileAgeLimitForManagedFolders, - - [System.String] - $LogFileSizeLimitForManagedFolders, - - [System.String] - $LogPathForManagedFolders, - - [System.String] - $MailboxProcessorWorkCycle, - - [System.String[]] - $ManagedFolderAssistantSchedule, - - [System.String] - $ManagedFolderWorkCycle, - - [System.String] - $ManagedFolderWorkCycleCheckpoint, - - [System.Boolean] - $MAPIEncryptionRequired, - - [System.String] - $MaximumActiveDatabases, - - [System.String] - $MaximumPreferredActiveDatabases, - - [System.String] - $OABGeneratorWorkCycle, - - [System.String] - $OABGeneratorWorkCycleCheckpoint, - - [System.String] - $PublicFolderWorkCycle, - - [System.String] - $PublicFolderWorkCycleCheckpoint, - - [System.Boolean] - $RetentionLogForManagedFoldersEnabled, - - [System.String[]] - $SharingPolicySchedule, - - [System.String] - $SharingPolicyWorkCycle, - - [System.String] - $SharingPolicyWorkCycleCheckpoint, - - [System.String] - $SharingSyncWorkCycle, - - [System.String] - $SharingSyncWorkCycleCheckpoint, - - [System.String] - $SiteMailboxWorkCycle, - - [System.String] - $SiteMailboxWorkCycleCheckpoint, - - [System.Boolean] - $SubjectLogForManagedFoldersEnabled, - - [System.String] - $TopNWorkCycle, - - [System.String] - $TopNWorkCycleCheckpoint, - - [System.String] - $UMReportingWorkCycle, - - [System.String] - $UMReportingWorkCycleCheckpoint, - - [System.String] - $WacDiscoveryEndpoint - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-MailboxServer" -VerbosePreference $VerbosePreference - - $server = GetMailboxServer @PSBoundParameters - - if ($null -ne $server) - { - $returnValue = @{ - Identity = $Identity - AutoDatabaseMountDial = $server.AutoDatabaseMountDial - CalendarRepairIntervalEndWindow = $server.CalendarRepairIntervalEndWindow - CalendarRepairLogDirectorySizeLimit = $server.CalendarRepairLogDirectorySizeLimit - CalendarRepairLogEnabled = $server.CalendarRepairLogEnabled - CalendarRepairLogFileAgeLimit = $server.CalendarRepairLogFileAgeLimit - CalendarRepairLogPath = $server.CalendarRepairLogPath - CalendarRepairLogSubjectLoggingEnabled = $server.CalendarRepairLogSubjectLoggingEnabled - CalendarRepairMissingItemFixDisabled = $server.CalendarRepairMissingItemFixDisabled - CalendarRepairMode = $server.CalendarRepairMode - FolderLogForManagedFoldersEnabled = $server.FolderLogForManagedFoldersEnabled - ForceGroupMetricsGeneration = $server.ForceGroupMetricsGeneration - IsExcludedFromProvisioning = $server.IsExcludedFromProvisioning - JournalingLogForManagedFoldersEnabled = $server.JournalingLogForManagedFoldersEnabled - Locale = $Server.Locale - LogDirectorySizeLimitForManagedFolders = $server.LogDirectorySizeLimitForManagedFolders - LogFileAgeLimitForManagedFolders = $server.LogFileAgeLimitForManagedFolders - LogFileSizeLimitForManagedFolders = $server.LogFileSizeLimitForManagedFolders - LogPathForManagedFolders = $server.LogPathForManagedFolders - DatabaseCopyActivationDisabledAndMoveNow = $server.DatabaseCopyActivationDisabledAndMoveNow - DatabaseCopyAutoActivationPolicy = $server.DatabaseCopyAutoActivationPolicy - MAPIEncryptionRequired = $server.MAPIEncryptionRequired - MaximumActiveDatabases = $server.MaximumActiveDatabases - MaximumPreferredActiveDatabases = $server.MaximumPreferredActiveDatabases - RetentionLogForManagedFoldersEnabled = $server.RetentionLogForManagedFoldersEnabled - SharingPolicySchedule = $server.SharingPolicySchedule - SubjectLogForManagedFoldersEnabled = $server.SubjectLogForManagedFoldersEnabled - } - - $serverVersion = GetExchangeVersion - - if ($serverVersion -eq "2016") - { - $returnValue.Add("WacDiscoveryEndpoint", $server.WacDiscoveryEndpoint) - } - elseif ($serverVersion -eq "2013") - { - $returnValue.Add("CalendarRepairWorkCycle", $server.CalendarRepairWorkCycle) - $returnValue.Add("CalendarRepairWorkCycleCheckpoint", $server.CalendarRepairWorkCycleCheckpoint) - $returnValue.Add("MailboxProcessorWorkCycle", $server.MailboxProcessorWorkCycle) - $returnValue.Add("ManagedFolderAssistantSchedule", $server.ManagedFolderAssistantSchedule) - $returnValue.Add("ManagedFolderWorkCycle", $server.ManagedFolderWorkCycle) - $returnValue.Add("ManagedFolderWorkCycleCheckpoint", $server.ManagedFolderWorkCycleCheckpoint) - $returnValue.Add("OABGeneratorWorkCycle", $server.OABGeneratorWorkCycle) - $returnValue.Add("OABGeneratorWorkCycleCheckpoint", $server.OABGeneratorWorkCycleCheckpoint) - $returnValue.Add("PublicFolderWorkCycle", $server.PublicFolderWorkCycle) - $returnValue.Add("PublicFolderWorkCycleCheckpoint", $server.PublicFolderWorkCycleCheckpoint) - $returnValue.Add("SharingPolicyWorkCycle", $server.SharingPolicyWorkCycle) - $returnValue.Add("SharingPolicyWorkCycleCheckpoint", $server.SharingPolicyWorkCycleCheckpoint) - $returnValue.Add("SharingSyncWorkCycle", $server.SharingSyncWorkCycle) - $returnValue.Add("SharingSyncWorkCycleCheckpoint", $server.SharingSyncWorkCycleCheckpoint) - $returnValue.Add("SiteMailboxWorkCycle", $server.SiteMailboxWorkCycle) - $returnValue.Add("SiteMailboxWorkCycleCheckpoint", $server.SiteMailboxWorkCycleCheckpoint) - $returnValue.Add("TopNWorkCycle", $server.TopNWorkCycle) - $returnValue.Add("TopNWorkCycleCheckpoint", $server.TopNWorkCycleCheckpoint) - $returnValue.Add("UMReportingWorkCycle", $server.UMReportingWorkCycle) - $returnValue.Add("UMReportingWorkCycleCheckpoint", $server.UMReportingWorkCycleCheckpoint) - } - else - { - Write-Verbose -Message "Could not detect Exchange version" - } - } - - $returnValue -} - -function Set-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [ValidateSet("BestAvailability","GoodAvailability","Lossless")] - [System.String] - $AutoDatabaseMountDial, - - [System.Int32] - $CalendarRepairIntervalEndWindow, - - [System.String] - $CalendarRepairLogDirectorySizeLimit, - - [System.Boolean] - $CalendarRepairLogEnabled, - - [System.String] - $CalendarRepairLogFileAgeLimit, - - [System.String] - $CalendarRepairLogPath, - - [System.Boolean] - $CalendarRepairLogSubjectLoggingEnabled, - - [System.Boolean] - $CalendarRepairMissingItemFixDisabled, - - [ValidateSet("ValidateOnly","RepairAndValidate")] - [System.String] - $CalendarRepairMode, - - [System.String] - $CalendarRepairWorkCycle, - - [System.String] - $CalendarRepairWorkCycleCheckpoint, - - [System.Boolean] - $DatabaseCopyActivationDisabledAndMoveNow, - - [ValidateSet("Blocked","IntrasiteOnly","Unrestricted")] - [System.String] - $DatabaseCopyAutoActivationPolicy, - - [System.String] - $DomainController, - - [System.Boolean] - $FolderLogForManagedFoldersEnabled, - - [System.Boolean] - $ForceGroupMetricsGeneration, - - [System.Boolean] - $IsExcludedFromProvisioning, - - [System.Boolean] - $JournalingLogForManagedFoldersEnabled, - - [System.String[]] - $Locale, - - [System.String] - $LogDirectorySizeLimitForManagedFolders, - - [System.String] - $LogFileAgeLimitForManagedFolders, - - [System.String] - $LogFileSizeLimitForManagedFolders, - - [System.String] - $LogPathForManagedFolders, - - [System.String] - $MailboxProcessorWorkCycle, - - [System.String[]] - $ManagedFolderAssistantSchedule, - - [System.String] - $ManagedFolderWorkCycle, - - [System.String] - $ManagedFolderWorkCycleCheckpoint, - - [System.Boolean] - $MAPIEncryptionRequired, - - [System.String] - $MaximumActiveDatabases, - - [System.String] - $MaximumPreferredActiveDatabases, - - [System.String] - $OABGeneratorWorkCycle, - - [System.String] - $OABGeneratorWorkCycleCheckpoint, - - [System.String] - $PublicFolderWorkCycle, - - [System.String] - $PublicFolderWorkCycleCheckpoint, - - [System.Boolean] - $RetentionLogForManagedFoldersEnabled, - - [System.String[]] - $SharingPolicySchedule, - - [System.String] - $SharingPolicyWorkCycle, - - [System.String] - $SharingPolicyWorkCycleCheckpoint, - - [System.String] - $SharingSyncWorkCycle, - - [System.String] - $SharingSyncWorkCycleCheckpoint, - - [System.String] - $SiteMailboxWorkCycle, - - [System.String] - $SiteMailboxWorkCycleCheckpoint, - - [System.Boolean] - $SubjectLogForManagedFoldersEnabled, - - [System.String] - $TopNWorkCycle, - - [System.String] - $TopNWorkCycleCheckpoint, - - [System.String] - $UMReportingWorkCycle, - - [System.String] - $UMReportingWorkCycleCheckpoint, - - [System.String] - $WacDiscoveryEndpoint - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Set-MailboxServer" -VerbosePreference $VerbosePreference - - #Setup params for next command - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "Credential" - - #create array of Exchange 2013 only parameters - [array]$Exchange2013Only = 'CalendarRepairWorkCycle','CalendarRepairWorkCycleCheckpoint','MailboxProcessorWorkCycle','ManagedFolderAssistantSchedule','ManagedFolderWorkCycle', - 'ManagedFolderWorkCycleCheckpoint','OABGeneratorWorkCycle','OABGeneratorWorkCycleCheckpoint','PublicFolderWorkCycle','PublicFolderWorkCycleCheckpoint','SharingPolicyWorkCycle', - 'SharingPolicyWorkCycleCheckpoint','SharingSyncWorkCycle','SharingSyncWorkCycleCheckpoint','SiteMailboxWorkCycle','SiteMailboxWorkCycleCheckpoint','TopNWorkCycle','TopNWorkCycleCheckpoint', - 'UMReportingWorkCycle','UMReportingWorkCycleCheckpoint' - - $serverVersion = GetExchangeVersion - if ($serverVersion -eq '2013') - { - #Check for non-existent parameters in Exchange 2013 - RemoveVersionSpecificParameters -PSBoundParametersIn $PSBoundParameters -ParamName "WacDiscoveryEndpoint" -ResourceName "xExchMailboxServer" -ParamExistsInVersion "2016" - } - elseif ($serverVersion -eq '2016') - { - foreach ($Exchange2013Parameter in $Exchange2013Only) - { - #Check for non-existent parameters in Exchange 2016 - RemoveVersionSpecificParameters -PSBoundParametersIn $PSBoundParameters -ParamName "$($Exchange2013Parameter)" -ResourceName "xExchMailboxServer" -ParamExistsInVersion "2013" - } - } - else - { - Write-Verbose -Message "Could not detect Exchange version" - } - - #Ensure an empty string is $null and not a string - SetEmptyStringParamsToNull -PSBoundParametersIn $PSBoundParameters - - Set-MailboxServer @PSBoundParameters - -} - - -function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [ValidateSet("BestAvailability","GoodAvailability","Lossless")] - [System.String] - $AutoDatabaseMountDial, - - [System.Int32] - $CalendarRepairIntervalEndWindow, - - [System.String] - $CalendarRepairLogDirectorySizeLimit, - - [System.Boolean] - $CalendarRepairLogEnabled, - - [System.String] - $CalendarRepairLogFileAgeLimit, - - [System.String] - $CalendarRepairLogPath, - - [System.Boolean] - $CalendarRepairLogSubjectLoggingEnabled, - - [System.Boolean] - $CalendarRepairMissingItemFixDisabled, - - [ValidateSet("ValidateOnly","RepairAndValidate")] - [System.String] - $CalendarRepairMode, - - [System.String] - $CalendarRepairWorkCycle, - - [System.String] - $CalendarRepairWorkCycleCheckpoint, - - [System.Boolean] - $DatabaseCopyActivationDisabledAndMoveNow, - - [ValidateSet("Blocked","IntrasiteOnly","Unrestricted")] - [System.String] - $DatabaseCopyAutoActivationPolicy, - - [System.String] - $DomainController, - - [System.Boolean] - $FolderLogForManagedFoldersEnabled, - - [System.Boolean] - $ForceGroupMetricsGeneration, - - [System.Boolean] - $IsExcludedFromProvisioning, - - [System.Boolean] - $JournalingLogForManagedFoldersEnabled, - - [System.String[]] - $Locale, - - [System.String] - $LogDirectorySizeLimitForManagedFolders, - - [System.String] - $LogFileAgeLimitForManagedFolders, - - [System.String] - $LogFileSizeLimitForManagedFolders, - - [System.String] - $LogPathForManagedFolders, - - [System.String] - $MailboxProcessorWorkCycle, - - [System.String[]] - $ManagedFolderAssistantSchedule, - - [System.String] - $ManagedFolderWorkCycle, - - [System.String] - $ManagedFolderWorkCycleCheckpoint, - - [System.Boolean] - $MAPIEncryptionRequired, - - [System.String] - $MaximumActiveDatabases, - - [System.String] - $MaximumPreferredActiveDatabases, - - [System.String] - $OABGeneratorWorkCycle, - - [System.String] - $OABGeneratorWorkCycleCheckpoint, - - [System.String] - $PublicFolderWorkCycle, - - [System.String] - $PublicFolderWorkCycleCheckpoint, - - [System.Boolean] - $RetentionLogForManagedFoldersEnabled, - - [System.String[]] - $SharingPolicySchedule, - - [System.String] - $SharingPolicyWorkCycle, - - [System.String] - $SharingPolicyWorkCycleCheckpoint, - - [System.String] - $SharingSyncWorkCycle, - - [System.String] - $SharingSyncWorkCycleCheckpoint, - - [System.String] - $SiteMailboxWorkCycle, - - [System.String] - $SiteMailboxWorkCycleCheckpoint, - - [System.Boolean] - $SubjectLogForManagedFoldersEnabled, - - [System.String] - $TopNWorkCycle, - - [System.String] - $TopNWorkCycleCheckpoint, - - [System.String] - $UMReportingWorkCycle, - - [System.String] - $UMReportingWorkCycleCheckpoint, - - [System.String] - $WacDiscoveryEndpoint - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-MailboxServer","Set-MailboxServer" -VerbosePreference $VerbosePreference - - #create array of Exchange 2013 only parameters - [array]$Exchange2013Only = 'CalendarRepairWorkCycle','CalendarRepairWorkCycleCheckpoint','MailboxProcessorWorkCycle','ManagedFolderAssistantSchedule','ManagedFolderWorkCycle', - 'ManagedFolderWorkCycleCheckpoint','OABGeneratorWorkCycle','OABGeneratorWorkCycleCheckpoint','PublicFolderWorkCycle','PublicFolderWorkCycleCheckpoint','SharingPolicyWorkCycle', - 'SharingPolicyWorkCycleCheckpoint','SharingSyncWorkCycle','SharingSyncWorkCycleCheckpoint','SiteMailboxWorkCycle','SiteMailboxWorkCycleCheckpoint','TopNWorkCycle','TopNWorkCycleCheckpoint', - 'UMReportingWorkCycle','UMReportingWorkCycleCheckpoint' - - $serverVersion = GetExchangeVersion - if ($serverVersion -eq '2013') - { - #Check for non-existent parameters in Exchange 2013 - RemoveVersionSpecificParameters -PSBoundParametersIn $PSBoundParameters -ParamName "WacDiscoveryEndpoint" -ResourceName "xExchMailboxServer" -ParamExistsInVersion "2016" - } - elseif ($serverVersion -eq '2016') - { - foreach ($Exchange2013Parameter in $Exchange2013Only) - { - #Check for non-existent parameters in Exchange 2016 - RemoveVersionSpecificParameters -PSBoundParametersIn $PSBoundParameters -ParamName "$($Exchange2013Parameter)" -ResourceName "xExchMailboxServer" -ParamExistsInVersion "2013" - } - } - else - { - Write-Verbose -Message "Could not detect Exchange version" - } - - $server = GetMailboxServer @PSBoundParameters - - if ($null -eq $server) #Couldn't find the server, which is bad - { - return $false - } - else #Validate server params - { - if (!(VerifySetting -Name "AutoDatabaseMountDial" -Type "String" -ExpectedValue $AutoDatabaseMountDial -ActualValue $server.AutoDatabaseMountDial -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "CalendarRepairIntervalEndWindow" -Type "Int" -ExpectedValue $CalendarRepairIntervalEndWindow -ActualValue $server.CalendarRepairIntervalEndWindow -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "CalendarRepairLogDirectorySizeLimit" -Type "Unlimited" -ExpectedValue $CalendarRepairLogDirectorySizeLimit -ActualValue $server.CalendarRepairLogDirectorySizeLimit -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - - if (!(VerifySetting -Name "CalendarRepairLogEnabled" -Type "Boolean" -ExpectedValue $CalendarRepairLogEnabled -ActualValue $server.CalendarRepairLogEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - - if (!(VerifySetting -Name "CalendarRepairLogFileAgeLimit" -Type "TimeSpan" -ExpectedValue $CalendarRepairLogFileAgeLimit -ActualValue $server.CalendarRepairLogFileAgeLimit -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "CalendarRepairLogPath" -Type "String" -ExpectedValue $CalendarRepairLogPath -ActualValue $server.CalendarRepairLogPath -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "CalendarRepairLogSubjectLoggingEnabled" -Type "Boolean" -ExpectedValue $CalendarRepairLogSubjectLoggingEnabled -ActualValue $server.CalendarRepairLogSubjectLoggingEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "CalendarRepairMissingItemFixDisabled" -Type "Boolean" -ExpectedValue $CalendarRepairMissingItemFixDisabled -ActualValue $server.CalendarRepairMissingItemFixDisabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "CalendarRepairMode" -Type "String" -ExpectedValue $CalendarRepairMode -ActualValue $server.CalendarRepairMode -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "CalendarRepairWorkCycle" -Type "TimeSpan" -ExpectedValue $CalendarRepairWorkCycle -ActualValue $server.CalendarRepairWorkCycle -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "CalendarRepairWorkCycleCheckpoint" -Type "TimeSpan" -ExpectedValue $CalendarRepairWorkCycleCheckpoint -ActualValue $server.CalendarRepairWorkCycleCheckpoint -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "DatabaseCopyActivationDisabledAndMoveNow" -Type "Boolean" -ExpectedValue $DatabaseCopyActivationDisabledAndMoveNow -ActualValue $server.DatabaseCopyActivationDisabledAndMoveNow -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "DatabaseCopyAutoActivationPolicy" -Type "String" -ExpectedValue $DatabaseCopyAutoActivationPolicy -ActualValue $server.DatabaseCopyAutoActivationPolicy -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "FolderLogForManagedFoldersEnabled" -Type "Boolean" -ExpectedValue $FolderLogForManagedFoldersEnabled -ActualValue $server.FolderLogForManagedFoldersEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ForceGroupMetricsGeneration" -Type "Boolean" -ExpectedValue $ForceGroupMetricsGeneration -ActualValue $server.ForceGroupMetricsGeneration -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "IsExcludedFromProvisioning" -Type "Boolean" -ExpectedValue $IsExcludedFromProvisioning -ActualValue $server.IsExcludedFromProvisioning -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "JournalingLogForManagedFoldersEnabled" -Type "Boolean" -ExpectedValue $JournalingLogForManagedFoldersEnabled -ActualValue $server.JournalingLogForManagedFoldersEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "Locale" -Type "Array" -ExpectedValue $Locale -ActualValue $server.Locale -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "LogDirectorySizeLimitForManagedFolders" -Type "Unlimited" -ExpectedValue $LogDirectorySizeLimitForManagedFolders -ActualValue $server.LogDirectorySizeLimitForManagedFolders -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "LogFileAgeLimitForManagedFolders" -Type "TimeSpan" -ExpectedValue $LogFileAgeLimitForManagedFolders -ActualValue $server.LogFileAgeLimitForManagedFolders -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "LogFileSizeLimitForManagedFolders" -Type "Unlimited" -ExpectedValue $LogFileSizeLimitForManagedFolders -ActualValue $server.LogFileSizeLimitForManagedFolders -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "LogPathForManagedFolders" -Type "String" -ExpectedValue $LogPathForManagedFolders -ActualValue $server.LogPathForManagedFolders -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MailboxProcessorWorkCycle" -Type "TimeSpan" -ExpectedValue $MailboxProcessorWorkCycle -ActualValue $server.MailboxProcessorWorkCycle -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ManagedFolderAssistantSchedule" -Type "Array" -ExpectedValue $ManagedFolderAssistantSchedule -ActualValue $server.ManagedFolderAssistantSchedule -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ManagedFolderWorkCycle" -Type "TimeSpan" -ExpectedValue $ManagedFolderWorkCycle -ActualValue $server.ManagedFolderWorkCycle -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ManagedFolderWorkCycleCheckpoint" -Type "TimeSpan" -ExpectedValue $ManagedFolderWorkCycleCheckpoint -ActualValue $server.ManagedFolderWorkCycleCheckpoint -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MAPIEncryptionRequired" -Type "Boolean" -ExpectedValue $MAPIEncryptionRequired -ActualValue $server.MAPIEncryptionRequired -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MaximumActiveDatabases" -Type "String" -ExpectedValue $MaximumActiveDatabases -ActualValue $server.MaximumActiveDatabases -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MaximumPreferredActiveDatabases" -Type "String" -ExpectedValue $MaximumPreferredActiveDatabases -ActualValue $server.MaximumPreferredActiveDatabases -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "OABGeneratorWorkCycle" -Type "TimeSpan" -ExpectedValue $OABGeneratorWorkCycle -ActualValue $server.OABGeneratorWorkCycle -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "OABGeneratorWorkCycleCheckpoint" -Type "TimeSpan" -ExpectedValue $OABGeneratorWorkCycleCheckpoint -ActualValue $server.OABGeneratorWorkCycleCheckpoint -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "PublicFolderWorkCycle" -Type "TimeSpan" -ExpectedValue $PublicFolderWorkCycle -ActualValue $server.PublicFolderWorkCycle -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "PublicFolderWorkCycleCheckpoint" -Type "TimeSpan" -ExpectedValue $PublicFolderWorkCycleCheckpoint -ActualValue $server.PublicFolderWorkCycleCheckpoint -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "RetentionLogForManagedFoldersEnabled" -Type "Boolean" -ExpectedValue $RetentionLogForManagedFoldersEnabled -ActualValue $server.RetentionLogForManagedFoldersEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "SharingPolicySchedule" -Type "Array" -ExpectedValue $SharingPolicySchedule -ActualValue $server.SharingPolicySchedule -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "SharingPolicyWorkCycle" -Type "TimeSpan" -ExpectedValue $SharingPolicyWorkCycle -ActualValue $server.SharingPolicyWorkCycle -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "SharingPolicyWorkCycleCheckpoint" -Type "TimeSpan" -ExpectedValue $SharingPolicyWorkCycleCheckpoint -ActualValue $server.SharingPolicyWorkCycleCheckpoint -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "SharingSyncWorkCycle" -Type "TimeSpan" -ExpectedValue $SharingSyncWorkCycle -ActualValue $server.SharingSyncWorkCycle -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "SharingSyncWorkCycleCheckpoint" -Type "TimeSpan" -ExpectedValue $SharingSyncWorkCycleCheckpoint -ActualValue $server.SharingSyncWorkCycleCheckpoint -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "SiteMailboxWorkCycle" -Type "TimeSpan" -ExpectedValue $SiteMailboxWorkCycle -ActualValue $server.SiteMailboxWorkCycle -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "SiteMailboxWorkCycleCheckpoint" -Type "TimeSpan" -ExpectedValue $SiteMailboxWorkCycleCheckpoint -ActualValue $server.SiteMailboxWorkCycleCheckpoint -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "SubjectLogForManagedFoldersEnabled" -Type "Boolean" -ExpectedValue $SubjectLogForManagedFoldersEnabled -ActualValue $server.SubjectLogForManagedFoldersEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "TopNWorkCycle" -Type "TimeSpan" -ExpectedValue $TopNWorkCycle -ActualValue $server.TopNWorkCycle -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "TopNWorkCycleCheckpoint" -Type "TimeSpan" -ExpectedValue $TopNWorkCycleCheckpoint -ActualValue $server.TopNWorkCycleCheckpoint -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "UMReportingWorkCycle" -Type "TimeSpan" -ExpectedValue $UMReportingWorkCycle -ActualValue $server.UMReportingWorkCycle -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "UMReportingWorkCycleCheckpoint" -Type "TimeSpan" -ExpectedValue $UMReportingWorkCycleCheckpoint -ActualValue $server.UMReportingWorkCycleCheckpoint -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "WacDiscoveryEndpoint" -Type "String" -ExpectedValue $WacDiscoveryEndpoint -ActualValue $server.WacDiscoveryEndpoint -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - } - - return $true -} - -#Runs Get-MailboxServer, only specifying Identity, and optionally DomainController -function GetMailboxServer -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [ValidateSet("BestAvailability","GoodAvailability","Lossless")] - [System.String] - $AutoDatabaseMountDial, - - [System.Int32] - $CalendarRepairIntervalEndWindow, - - [System.String] - $CalendarRepairLogDirectorySizeLimit, - - [System.Boolean] - $CalendarRepairLogEnabled, - - [System.String] - $CalendarRepairLogFileAgeLimit, - - [System.String] - $CalendarRepairLogPath, - - [System.Boolean] - $CalendarRepairLogSubjectLoggingEnabled, - - [System.Boolean] - $CalendarRepairMissingItemFixDisabled, - - [ValidateSet("ValidateOnly","RepairAndValidate")] - [System.String] - $CalendarRepairMode, - - [System.String] - $CalendarRepairWorkCycle, - - [System.String] - $CalendarRepairWorkCycleCheckpoint, - - [System.Boolean] - $DatabaseCopyActivationDisabledAndMoveNow, - - [ValidateSet("Blocked","IntrasiteOnly","Unrestricted")] - [System.String] - $DatabaseCopyAutoActivationPolicy, - - [System.String] - $DomainController, - - [System.Boolean] - $FolderLogForManagedFoldersEnabled, - - [System.Boolean] - $ForceGroupMetricsGeneration, - - [System.Boolean] - $IsExcludedFromProvisioning, - - [System.Boolean] - $JournalingLogForManagedFoldersEnabled, - - [System.String[]] - $Locale, - - [System.String] - $LogDirectorySizeLimitForManagedFolders, - - [System.String] - $LogFileAgeLimitForManagedFolders, - - [System.String] - $LogFileSizeLimitForManagedFolders, - - [System.String] - $LogPathForManagedFolders, - - [System.String] - $MailboxProcessorWorkCycle, - - [System.String[]] - $ManagedFolderAssistantSchedule, - - [System.String] - $ManagedFolderWorkCycle, - - [System.String] - $ManagedFolderWorkCycleCheckpoint, - - [System.Boolean] - $MAPIEncryptionRequired, - - [System.String] - $MaximumActiveDatabases, - - [System.String] - $MaximumPreferredActiveDatabases, - - [System.String] - $OABGeneratorWorkCycle, - - [System.String] - $OABGeneratorWorkCycleCheckpoint, - - [System.String] - $PublicFolderWorkCycle, - - [System.String] - $PublicFolderWorkCycleCheckpoint, - - [System.Boolean] - $RetentionLogForManagedFoldersEnabled, - - [System.String[]] - $SharingPolicySchedule, - - [System.String] - $SharingPolicyWorkCycle, - - [System.String] - $SharingPolicyWorkCycleCheckpoint, - - [System.String] - $SharingSyncWorkCycle, - - [System.String] - $SharingSyncWorkCycleCheckpoint, - - [System.String] - $SiteMailboxWorkCycle, - - [System.String] - $SiteMailboxWorkCycleCheckpoint, - - [System.Boolean] - $SubjectLogForManagedFoldersEnabled, - - [System.String] - $TopNWorkCycle, - - [System.String] - $TopNWorkCycleCheckpoint, - - [System.String] - $UMReportingWorkCycle, - - [System.String] - $UMReportingWorkCycleCheckpoint, - - [System.String] - $WacDiscoveryEndpoint - ) - - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Identity","DomainController" - - return (Get-MailboxServer @PSBoundParameters) -} - -Export-ModuleMember -Function *-TargetResource - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMailboxServer/MSFT_xExchMailboxServer.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMailboxServer/MSFT_xExchMailboxServer.schema.mof deleted file mode 100644 index 995432dc..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMailboxServer/MSFT_xExchMailboxServer.schema.mof +++ /dev/null @@ -1,56 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xExchMailboxServer")] -class MSFT_xExchMailboxServer : OMI_BaseResource -{ - [Key, Description("The Identity parameter specifies the Mailbox server that you want to modify.")] String Identity; - [Required, Description("Credentials used to establish a remote Powershell session to Exchange"), EmbeddedInstance("MSFT_Credential")] String Credential; - [Write, Description("The AutoDatabaseMountDial parameter specifies the automatic database mount behavior for a continuous replication environment after a database failover."), ValueMap{"BestAvailability","GoodAvailability","Lossless"}, Values{"BestAvailability","GoodAvailability","Lossless"}] String AutoDatabaseMountDial; - [Write, Description("The CalendarRepairIntervalEndWindow parameter specifies the number of days into the future to repair calendars. For example, if this parameter is set to 90, the Calendar Repair Assistant repairs calendars on this Mailbox server 90 days from now.")] SInt32 CalendarRepairIntervalEndWindow; - [Write, Description("The CalendarRepairLogDirectorySizeLimit parameter specifies the size limit for all log files for the Calendar Repair Assistant. After the limit is reached, the oldest files are deleted.")] String CalendarRepairLogDirectorySizeLimit; - [Write, Description("The CalendarRepairLogEnabled parameter specifies whether the Calendar Repair Attendant logs items that it repairs. The repair log doesn't contain failed repair attempts.")] Boolean CalendarRepairLogEnabled; - [Write, Description("The CalendarRepairLogFileAgeLimit parameter specifies how long to retain calendar repair logs. Log files that exceed the maximum retention period are deleted.")] String CalendarRepairLogFileAgeLimit; - [Write, Description("The CalendarRepairLogPath parameter specifies the location of the calendar repair log files on the Mailbox server.")] String CalendarRepairLogPath; - [Write, Description("The CalendarRepairLogSubjectLoggingEnabled parameter specifies that the subject of the repaired calendar item is logged in the calendar repair log.")] Boolean CalendarRepairLogSubjectLoggingEnabled; - [Write, Description("The CalendarRepairMissingItemFixDisabled parameter specifies that the Calendar Repair Assistant won't fix missing attendee calendar items for mailboxes homed on this Mailbox server.")] Boolean CalendarRepairMissingItemFixDisabled; - [Write, Description("The CalendarRepairMode parameter specifies the mode that the Calendar Repair Assistant will run in."), ValueMap{"ValidateOnly","RepairAndValidate"}, Values{"ValidateOnly","RepairAndValidate"}] String CalendarRepairMode; - [Write, Description("The CalendarRepairWorkCycle parameter specifies the time span in which all mailboxes on the specified server will be scanned by the Calendar Repair Assistant. Calendars that have inconsistencies will be flagged and repaired according to the interval specified by the CalendarRepairWorkCycleCheckpoint parameter.")] String CalendarRepairWorkCycle; - [Write, Description("The CalendarRepairWorkCycleCheckpoint parameter specifies the time span at which all mailboxes will be identified as needing work completed on them.")] String CalendarRepairWorkCycleCheckpoint; - [Write, Description("The DomainController parameter specifies the fully qualified domain name (FQDN) of the domain controller that writes this configuration change to Active Directory.")] String DomainController; - [Write, Description("The DatabaseCopyActivationDisabledAndMoveNow parameter specifies whether to prevent databases from being mounted on this Mailbox server if there are other healthy copies of the databases on other Mailbox servers. It will also immediately move any mounted databases on the server to other servers if copies exist and are healthy.")] Boolean DatabaseCopyActivationDisabledAndMoveNow; - [Write, Description("The DatabaseCopyAutoActivationPolicy parameter specifies the type of automatic activation available for mailbox database copies on the specified Mailbox server. Valid values are Blocked, IntrasiteOnly, and Unrestricted."), ValueMap{"Blocked","IntrasiteOnly","Unrestricted"}, Values{"Blocked","IntrasiteOnly","Unrestricted"}] String DatabaseCopyAutoActivationPolicy; - [Write, Description("The FolderLogForManagedFoldersEnabled parameter specifies whether the folder log for managed folders is enabled for messages that were moved to managed folders.")] Boolean FolderLogForManagedFoldersEnabled; - [Write, Description("The ForceGroupMetricsGeneration parameter specifies that group metrics information must be generated on the Mailbox server regardless of whether that server generates an offline address book (OAB). By default, group metrics are generated only on servers that generate OABs. Group metrics information is used by MailTips to inform senders about how many recipients their messages will be sent to. You need to use this parameter if your organization doesn't generate OABs and you want the group metrics data to be available.")] Boolean ForceGroupMetricsGeneration; - [Write, Description("The IsExcludedFromProvisioning parameter specifies that the Mailbox server isn't considered by the OAB provisioning load balancer. If the IsExcludedFromProvisioning parameter is set to $true, the server won't be used for provisioning a new OAB or for moving existing OABs.")] Boolean IsExcludedFromProvisioning; - [Write, Description("The JournalingLogForManagedFoldersEnabled parameter specifies whether the log for managed folders is enabled for journaling. The two possible values for this parameter are $true or $false. If you specify $true, information about messages that were journaled is logged. The logs are located at the location you specify with the LogPathForManagedFolders parameter.")] Boolean JournalingLogForManagedFoldersEnabled; - [Write, Description("The Locale parameter specifies the locale. A locale is a collection of language-related user preferences such as writing system, calendar, and date format.")] String Locale []; - [Write, Description("The LogDirectorySizeLimitForManagedFolders parameter specifies the size limit for all managed folder log files from a single message database. After the limit is reached for a set of managed folder log files from a message database, the oldest files are deleted to make space for new files.")] String LogDirectorySizeLimitForManagedFolders; - [Write, Description("The LogFileAgeLimitForManagedFolders parameter specifies how long to retain managed folder logs. Log files that exceed the maximum retention period are deleted.")] String LogFileAgeLimitForManagedFolders; - [Write, Description("The LogFileSizeLimitForManagedFolders parameter specifies the maximum size for each managed folder log file. When the log file size limit is reached, a new log file is created.")] String LogFileSizeLimitForManagedFolders; - [Write, Description("The LogPathForManagedFolders parameter specifies the path to the directory that stores the managed folder log files.")] String LogPathForManagedFolders; - [Write, Description("The MailboxProcessorWorkCycle parameter specifies how often to scan for locked mailboxes.")] String MailboxProcessorWorkCycle; - [Write, Description("The ManagedFolderAssistantSchedule parameter specifies the intervals each week during which the Managed Folder Assistant applies messaging records management (MRM) settings to managed folders. The format is StartDay.Time-EndDay.")] String ManagedFolderAssistantSchedule[]; - [Write, Description("The ManagedFolderWorkCycle parameter specifies the time span in which all mailboxes on the specified server will be processed by the Managed Folder Assistant. The Managed Folder Assistant applies retention policies according to the ManagedFolderWorkCycleCheckpoint interval.")] String ManagedFolderWorkCycle; - [Write, Description("The ManagedFolderWorkCycleCheckpoint parameter specifies the time span at which to refresh the list of mailboxes so that new mailboxes that have been created or moved will be part of the work queue. Also, as mailboxes are prioritized, existing mailboxes that haven't been successfully processed for a long time will be placed higher in the queue and will have a greater chance of being processed again in the same work cycle.")] String ManagedFolderWorkCycleCheckpoint; - [Write, Description("The MAPIEncryptionRequired parameter specifies whether Exchange blocks MAPI clients that don't use encrypted remote procedure calls (RPCs).")] Boolean MAPIEncryptionRequired; - [Write, Description("The MaximumActiveDatabases parameter specifies the number of databases that can be mounted on this Mailbox server. This parameter accepts numeric values.")] String MaximumActiveDatabases; - [Write, Description("The MaximumPreferredActiveDatabases parameter specifies a preferred maximum number of databases that a server should have. This value is different from the actual maximum, which is configured using the MaximumActiveDatabases parameter. The value of MaximumPreferredActiveDatabases is only honored during best copy and server selection, database and server switchovers, and when rebalancing the DAG.")] String MaximumPreferredActiveDatabases; - [Write, Description("The OABGeneratorWorkCycle parameter specifies the time span in which the OAB generation on the specified server will be processed.")] String OABGeneratorWorkCycle; - [Write, Description("The OABGeneratorWorkCycleCheckpoint parameter specifies the time span at which to run OAB generation.")] String OABGeneratorWorkCycleCheckpoint; - [Write, Description("The PublicFolderWorkCycle parameter is used by the public folder assistant to determine how often the mailboxes in a database are processed by the assistant.")] String PublicFolderWorkCycle; - [Write, Description("The PublicFolderWorkCycleCheckpoint determines how often the mailbox list for a database is evaluated. The processing speed is also calculated.")] String PublicFolderWorkCycleCheckpoint; - [Write, Description("The RetentionLogForManagedFoldersEnabled parameter specifies whether the Managed Folder Assistant logs information about messages that have reached their retention limits.")] Boolean RetentionLogForManagedFoldersEnabled; - [Write, Description("The SharingPolicySchedule parameter specifies the intervals each week during which the sharing policy runs. The Sharing Policy Assistant checks permissions on shared calendar items and contact folders in users' mailboxes against the assigned sharing policy. The assistant lowers or removes permissions according to the policy. The format is StartDay.Time-EndDay.Time.")] String SharingPolicySchedule[]; - [Write, Description("The SharingPolicyWorkCycle parameter specifies the time span in which all mailboxes on the specified server will be scanned by the Sharing Policy Assistant. The Sharing Policy Assistant scans all mailboxes and enables or disables sharing polices according to the interval specified by the SharingPolicyWorkCycle.")] String SharingPolicyWorkCycle; - [Write, Description("The SharingPolicyWorkCycleCheckpoint parameter specifies the time span at which to refresh the list of mailboxes so that new mailboxes that have been created or moved will be part of the work queue. Also, as mailboxes are prioritized, existing mailboxes that haven't been successfully processed for a long time will be placed higher in the queue and will have a greater chance of being processed again in the same work cycle.")] String SharingPolicyWorkCycleCheckpoint; - [Write, Description("The SharingSyncWorkCycle parameter specifies the time span in which all mailboxes on the specified server will be synced to the cloud-based service by the Sharing Sync Assistant. Mailboxes that require syncing will be synced according to the interval specified by the SharingSyncWorkCycleCheckpoint parameter.")] String SharingSyncWorkCycle; - [Write, Description("The SharingSyncWorkCycleCheckpoint parameter specifies the time span at which to refresh the list of mailboxes so that new mailboxes that have been created or moved will be part of the work queue. Also, as mailboxes are prioritized, existing mailboxes that haven't been successfully processed for a long time will be placed higher in the queue and will have a greater chance of being processed again in the same work cycle.")] String SharingSyncWorkCycleCheckpoint; - [Write, Description("The SiteMailboxWorkCycle parameter specifies the time span in which the site mailbox information on the specified server will be processed.")] String SiteMailboxWorkCycle; - [Write, Description("The SiteMailboxWorkCycleCheckpoint parameter specifies the time span at which to refresh the site mailbox workcycle.")] String SiteMailboxWorkCycleCheckpoint; - [Write, Description("The SubjectLogForManagedFoldersEnabled parameter specifies whether the subject of messages is displayed in managed folder logs.")] Boolean SubjectLogForManagedFoldersEnabled; - [Write, Description("The TopNWorkCycle parameter specifies the time span in which all mailboxes that have Unified Messaging on the specified server will be scanned by the TopN Words Assistant. The TopN Words Assistant scans voice mail for the most frequently used words to aid in transcription.")] String TopNWorkCycle; - [Write, Description("The TopNWorkCycleCheckpoint parameter specifies the time span at which to refresh the list of mailboxes so that new mailboxes that have been created or moved will be part of the work queue. Also, as mailboxes are prioritized, existing mailboxes that haven't been successfully processed for a long time will be placed higher in the queue and will have a greater chance of being processed again in the same work cycle.")] String TopNWorkCycleCheckpoint; - [Write, Description("The UMReportingWorkCycle parameter specifies the time span in which the arbitration mailbox named SystemMailbox{e0dc1c29-89c3-4034-b678-e6c29d823ed9} on the specified server will be scanned by the Unified Messaging Reporting Assistant. The Unified Messaging Reporting Assistant updates the Call Statistics reports by reading Unified Messaging call data records for an organization on a regular basis.")] String UMReportingWorkCycle; - [Write, Description("The UMReportingWorkCycleCheckpoint parameter specifies the time span at which the arbitration mailbox named SystemMailbox{e0dc1c29-89c3-4034-b678-e6c29d823ed9} will be marked by processing.")] String UMReportingWorkCycleCheckpoint; - [Write, Description("The WacDiscoveryEndpoint parameter specifies the Office Online Server endpoint to use. Exchange 2016 only.")] String WacDiscoveryEndpoint; -}; - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMailboxTransportService/MSFT_xExchMailboxTransportService.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMailboxTransportService/MSFT_xExchMailboxTransportService.psm1 deleted file mode 100644 index 666185fa..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMailboxTransportService/MSFT_xExchMailboxTransportService.psm1 +++ /dev/null @@ -1,450 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscTestsPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Identity, - - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $ConnectivityLogEnabled, - - [System.String] - $ConnectivityLogMaxAge, - - [System.String] - $ConnectivityLogMaxDirectorySize, - - [System.String] - $ConnectivityLogMaxFileSize, - - [System.String] - $ConnectivityLogPath, - - [System.Boolean] - $ContentConversionTracingEnabled, - - [System.Int32] - $MaxConcurrentMailboxDeliveries, - - [System.Int32] - $MaxConcurrentMailboxSubmissions, - - [System.Boolean] - $PipelineTracingEnabled, - - [System.String] - $PipelineTracingPath, - - [System.String] - $PipelineTracingSenderAddress, - - [System.String] - $ReceiveProtocolLogMaxAge, - - [System.String] - $ReceiveProtocolLogMaxDirectorySize, - - [System.String] - $ReceiveProtocolLogMaxFileSize, - - [System.String] - $ReceiveProtocolLogPath, - - [System.String] - $RoutingTableLogMaxAge, - - [System.String] - $RoutingTableLogMaxDirectorySize, - - [System.String] - $RoutingTableLogPath, - - [System.String] - $SendProtocolLogMaxAge, - - [System.String] - $SendProtocolLogMaxDirectorySize, - - [System.String] - $SendProtocolLogMaxFileSize, - - [System.String] - $SendProtocolLogPath - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath $PSScriptRoot).Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-MailboxTransportService" -VerbosePreference $VerbosePreference - - #Remove Credential and Ensure so we don't pass it into the next command - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "Credential","AllowServiceRestart" - - $mbxTransportService = Get-MailboxTransportService $Identity -ErrorAction SilentlyContinue - - if ($null -ne $mbxTransportService) - { - $returnValue = @{ - Identity = $Identity - ConnectivityLogEnabled = $mbxTransportService.ConnectivityLogEnabled - ConnectivityLogMaxAge = $mbxTransportService.ConnectivityLogMaxAge - ConnectivityLogMaxDirectorySize = $mbxTransportService.ConnectivityLogMaxDirectorySize - ConnectivityLogMaxFileSize = $mbxTransportService.ConnectivityLogMaxFileSize - ConnectivityLogPath = $mbxTransportService.ConnectivityLogPath - ContentConversionTracingEnabled = $mbxTransportService.ContentConversionTracingEnabled - MaxConcurrentMailboxDeliveries = $mbxTransportService.MaxConcurrentMailboxDeliveries - MaxConcurrentMailboxSubmissions = $mbxTransportService.MaxConcurrentMailboxSubmissions - PipelineTracingEnabled = $mbxTransportService.PipelineTracingEnabled - PipelineTracingPath = $mbxTransportService.PipelineTracingPath - PipelineTracingSenderAddress = $mbxTransportService.PipelineTracingSenderAddress - ReceiveProtocolLogMaxAge = $mbxTransportService.ReceiveProtocolLogMaxAge - ReceiveProtocolLogMaxDirectorySize = $mbxTransportService.ReceiveProtocolLogMaxDirectorySize - ReceiveProtocolLogMaxFileSize = $mbxTransportService.ReceiveProtocolLogMaxFileSize - ReceiveProtocolLogPath = $mbxTransportService.ReceiveProtocolLogPath - SendProtocolLogMaxAge = $mbxTransportService.SendProtocolLogMaxAge - SendProtocolLogMaxDirectorySize = $mbxTransportService.SendProtocolLogMaxDirectorySize - SendProtocolLogMaxFileSize = $mbxTransportService.SendProtocolLogMaxFileSize - SendProtocolLogPath = $mbxTransportService.SendProtocolLogPath - } - } - - $returnValue -} - -function Set-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Identity, - - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $ConnectivityLogEnabled, - - [System.String] - $ConnectivityLogMaxAge, - - [System.String] - $ConnectivityLogMaxDirectorySize, - - [System.String] - $ConnectivityLogMaxFileSize, - - [System.String] - $ConnectivityLogPath, - - [System.Boolean] - $ContentConversionTracingEnabled, - - [System.Int32] - $MaxConcurrentMailboxDeliveries, - - [System.Int32] - $MaxConcurrentMailboxSubmissions, - - [System.Boolean] - $PipelineTracingEnabled, - - [System.String] - $PipelineTracingPath, - - [System.String] - $PipelineTracingSenderAddress, - - [System.String] - $ReceiveProtocolLogMaxAge, - - [System.String] - $ReceiveProtocolLogMaxDirectorySize, - - [System.String] - $ReceiveProtocolLogMaxFileSize, - - [System.String] - $ReceiveProtocolLogPath, - - [System.String] - $RoutingTableLogMaxAge, - - [System.String] - $RoutingTableLogMaxDirectorySize, - - [System.String] - $RoutingTableLogPath, - - [System.String] - $SendProtocolLogMaxAge, - - [System.String] - $SendProtocolLogMaxDirectorySize, - - [System.String] - $SendProtocolLogMaxFileSize, - - [System.String] - $SendProtocolLogPath - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath $PSScriptRoot).Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Set-MailboxTransportService" -VerbosePreference $VerbosePreference - - #Remove Credential and Ensure so we don't pass it into the next command - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "Credential","AllowServiceRestart" - - #if PipelineTracingSenderAddress exists and is empty, set it to $null so Set-MailboxTransportService nulls out the stored value - if ($PSBoundParameters.ContainsKey('PipelineTracingSenderAddress') -and [string]::IsNullOrEmpty($PipelineTracingSenderAddress)) - { - $PSBoundParameters['PipelineTracingSenderAddress'] = $null - } - - Set-MailboxTransportService @PSBoundParameters - - if ($AllowServiceRestart -eq $true) - { - Write-Verbose "Restart service MSExchangeDelivery" - Restart-Service -Name MSExchangeDelivery -WarningAction SilentlyContinue - - Write-Verbose "Restart service MSExchangeSubmission" - Restart-Service -Name MSExchangeSubmission -WarningAction SilentlyContinue - } - else - { - Write-Warning "The configuration will not take effect until the MSExchangeDelivery and/or MSExchangeSubmission services are manually restarted." - } -} - -function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Identity, - - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $ConnectivityLogEnabled, - - [System.String] - $ConnectivityLogMaxAge, - - [System.String] - $ConnectivityLogMaxDirectorySize, - - [System.String] - $ConnectivityLogMaxFileSize, - - [System.String] - $ConnectivityLogPath, - - [System.Boolean] - $ContentConversionTracingEnabled, - - [System.Int32] - $MaxConcurrentMailboxDeliveries, - - [System.Int32] - $MaxConcurrentMailboxSubmissions, - - [System.Boolean] - $PipelineTracingEnabled, - - [System.String] - $PipelineTracingPath, - - [System.String] - $PipelineTracingSenderAddress, - - [System.String] - $ReceiveProtocolLogMaxAge, - - [System.String] - $ReceiveProtocolLogMaxDirectorySize, - - [System.String] - $ReceiveProtocolLogMaxFileSize, - - [System.String] - $ReceiveProtocolLogPath, - - [System.String] - $RoutingTableLogMaxAge, - - [System.String] - $RoutingTableLogMaxDirectorySize, - - [System.String] - $RoutingTableLogPath, - - [System.String] - $SendProtocolLogMaxAge, - - [System.String] - $SendProtocolLogMaxDirectorySize, - - [System.String] - $SendProtocolLogMaxFileSize, - - [System.String] - $SendProtocolLogPath - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath $PSScriptRoot).Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-MailboxTransportService" -VerbosePreference $VerbosePreference - - $mbxTransportService = Get-MailboxTransportService $Identity -ErrorAction SilentlyContinue - - if ($null -ne $mbxTransportService) - { - if (!(VerifySetting -Name "ConnectivityLogEnabled" -Type "Boolean" -ExpectedValue $ConnectivityLogEnabled -ActualValue $mbxTransportService.ConnectivityLogEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ConnectivityLogMaxAge" -Type "Timespan" -ExpectedValue $ConnectivityLogMaxAge -ActualValue $mbxTransportService.ConnectivityLogMaxAge -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ConnectivityLogMaxDirectorySize" -Type "Unlimited" -ExpectedValue $ConnectivityLogMaxDirectorySize -ActualValue $mbxTransportService.ConnectivityLogMaxDirectorySize -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ConnectivityLogMaxFileSize" -Type "Unlimited" -ExpectedValue $ConnectivityLogMaxFileSize -ActualValue $mbxTransportService.ConnectivityLogMaxFileSize -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ConnectivityLogPath" -Type "String" -ExpectedValue $ConnectivityLogPath -ActualValue $mbxTransportService.ConnectivityLogPath -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ContentConversionTracingEnabled" -Type "Boolean" -ExpectedValue $ContentConversionTracingEnabled -ActualValue $mbxTransportService.ContentConversionTracingEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MaxConcurrentMailboxDeliveries" -Type "Int" -ExpectedValue $MaxConcurrentMailboxDeliveries -ActualValue $mbxTransportService.MaxConcurrentMailboxDeliveries -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MaxConcurrentMailboxSubmissions" -Type "Int" -ExpectedValue $MaxConcurrentMailboxSubmissions -ActualValue $mbxTransportService.MaxConcurrentMailboxSubmissions -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "PipelineTracingEnabled" -Type "Boolean" -ExpectedValue $PipelineTracingEnabled -ActualValue $mbxTransportService.PipelineTracingEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "PipelineTracingPath" -Type "String" -ExpectedValue $PipelineTracingPath -ActualValue $mbxTransportService.PipelineTracingPath -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "PipelineTracingSenderAddress" -Type "SMTPAddress" -ExpectedValue $PipelineTracingSenderAddress -ActualValue $mbxTransportService.PipelineTracingSenderAddress -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ReceiveProtocolLogMaxAge" -Type "TimeSpan" -ExpectedValue $ReceiveProtocolLogMaxAge -ActualValue $mbxTransportService.ReceiveProtocolLogMaxAge -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ReceiveProtocolLogMaxDirectorySize" -Type "Unlimited" -ExpectedValue $ReceiveProtocolLogMaxDirectorySize -ActualValue $mbxTransportService.ReceiveProtocolLogMaxDirectorySize -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ReceiveProtocolLogMaxFileSize" -Type "Unlimited" -ExpectedValue $ReceiveProtocolLogMaxFileSize -ActualValue $mbxTransportService.ReceiveProtocolLogMaxFileSize -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ReceiveProtocolLogPath" -Type "String" -ExpectedValue $ReceiveProtocolLogPath -ActualValue $mbxTransportService.ReceiveProtocolLogPath -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "SendProtocolLogMaxAge" -Type "TimeSpan" -ExpectedValue $SendProtocolLogMaxAge -ActualValue $mbxTransportService.SendProtocolLogMaxAge -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "SendProtocolLogMaxDirectorySize" -Type "Unlimited" -ExpectedValue $SendProtocolLogMaxDirectorySize -ActualValue $mbxTransportService.SendProtocolLogMaxDirectorySize -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "SendProtocolLogMaxFileSize" -Type "Unlimited" -ExpectedValue $SendProtocolLogMaxFileSize -ActualValue $mbxTransportService.SendProtocolLogMaxFileSize -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "SendProtocolLogPath" -Type "String" -ExpectedValue $SendProtocolLogPath -ActualValue $mbxTransportService.SendProtocolLogPath -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - } - else - { - return $false - } - - return $true -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMailboxTransportService/MSFT_xExchMailboxTransportService.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMailboxTransportService/MSFT_xExchMailboxTransportService.schema.mof deleted file mode 100644 index 43804b5a..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMailboxTransportService/MSFT_xExchMailboxTransportService.schema.mof +++ /dev/null @@ -1,29 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xExchMailboxTransportService")] -class MSFT_xExchMailboxTransportService : OMI_BaseResource -{ - [Key] String Identity; //Exchange server - [Required, EmbeddedInstance("MSFT_Credential")] String Credential; //Credentials used to establish a remote Powershell session to Exchange - [Write] Boolean AllowServiceRestart; //Whether it is OK to restart service MSExchangeTransport; - [Write] Boolean ConnectivityLogEnabled; - [Write] String ConnectivityLogMaxAge; - [Write] String ConnectivityLogMaxDirectorySize; - [Write] String ConnectivityLogMaxFileSize; - [Write] String ConnectivityLogPath; - [Write] Boolean ContentConversionTracingEnabled; - [Write] SInt32 MaxConcurrentMailboxDeliveries; - [Write] SInt32 MaxConcurrentMailboxSubmissions; - [Write] Boolean PipelineTracingEnabled; - [Write] String PipelineTracingPath; - [Write] String PipelineTracingSenderAddress; - [Write] String ReceiveProtocolLogMaxAge; - [Write] String ReceiveProtocolLogMaxDirectorySize; - [Write] String ReceiveProtocolLogMaxFileSize; - [Write] String ReceiveProtocolLogPath; - [Write] String RoutingTableLogMaxAge; - [Write] String RoutingTableLogMaxDirectorySize; - [Write] String RoutingTableLogPath; - [Write] String SendProtocolLogMaxAge; - [Write] String SendProtocolLogMaxDirectorySize; - [Write] String SendProtocolLogMaxFileSize; - [Write] String SendProtocolLogPath; -}; diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMaintenanceMode/MSFT_xExchMaintenanceMode.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMaintenanceMode/MSFT_xExchMaintenanceMode.psm1 deleted file mode 100644 index ef8ec8c4..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMaintenanceMode/MSFT_xExchMaintenanceMode.psm1 +++ /dev/null @@ -1,1286 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscTestsPresent", "")] -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscExamplesPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.Boolean] - $Enabled, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.String[]] - $AdditionalComponentsToActivate, - - [System.String] - $DomainController, - - [System.Boolean] - $MovePreferredDatabasesBack = $false, - - [System.Boolean] - $SetInactiveComponentsFromAnyRequesterToActive = $false, - - [System.String] - $UpgradedServerVersion - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Enabled" = $Enabled} -VerbosePreference $VerbosePreference - - #Load TransportMaintenanceMode Helper - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)"))\TransportMaintenance.psm1" -Verbose:0 - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-*" -VerbosePreference $VerbosePreference - - $maintenanceModeStatus = GetMaintenanceModeStatus -EnteringMaintenanceMode $Enabled -DomainController $DomainController - $atDesiredVersion = IsExchangeAtDesiredVersion -DomainController $DomainController -UpgradedServerVersion $UpgradedServerVersion - - if ($null -ne $maintenanceModeStatus) - { - #Determine which components are Active - $activeComponents = $MaintenanceModeStatus.ServerComponentState | Where-Object {$_.State -eq "Active"} - - [string[]]$activeComponentsList = @() - - if ($null -ne $activeComponents) - { - foreach ($activeComponent in $activeComponents) - { - $activeComponentsList += $activeComponent.Component - } - } - - $activeComponentCount = $activeComponentsList.Count - - - #Figure out what our Enabled state should really be in case UpgradedServerVersion was passed - $isEnabled = $Enabled - - if ($Enabled -eq $true -and $atDesiredVersion -eq $true) - { - $isEnabled = $false - } - - - $returnValue = @{ - Enabled = $isEnabled - ActiveComponentCount = $activeComponentCount - ActiveComponentsList = $activeComponentsList - ActiveDBCount = GetActiveDBCount -MaintenanceModeStatus $maintenanceModeStatus -DomainController $DomainController - ActiveUMCallCount = GetUMCallCount -MaintenanceModeStatus $maintenanceModeStatus -DomainController $DomainController - ClusterState = $maintenanceModeStatus.ClusterNode.State - QueuedMessageCount = GetQueueMessageCount -MaintenanceModeStatus $maintenanceModeStatus - } - } - - $returnValue -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.Boolean] - $Enabled, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.String[]] - $AdditionalComponentsToActivate, - - [System.String] - $DomainController, - - [System.Boolean] - $MovePreferredDatabasesBack = $false, - - [System.Boolean] - $SetInactiveComponentsFromAnyRequesterToActive = $false, - - [System.String] - $UpgradedServerVersion - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Enabled" = $Enabled} -VerbosePreference $VerbosePreference - - #Load TransportMaintenanceMode Helper - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)"))\TransportMaintenance.psm1" -Verbose:0 - - #Get ready for calling DAG maintenance scripts later - $scriptsFolder = Join-Path -Path ((Get-ItemProperty HKLM:\SOFTWARE\Microsoft\ExchangeServer\v15\Setup).MsiInstallPath) -ChildPath "Scripts" - $startDagServerMaintenanceScript = Join-Path -Path "$($scriptsFolder)" -ChildPath "StartDagServerMaintenance.ps1" - $stopDagServerMaintenanceScript = Join-Path -Path "$($scriptsFolder)" -ChildPath "StopDagServerMaintenance.ps1" - - #Override Write-Host, as it is used by the target scripts, and causes a DSC error since the session is not interactive - New-Alias Write-Host Write-Verbose - - #Check if setup is running. - $setupRunning = IsSetupRunning - - if ($setupRunning -eq $true) - { - Write-Verbose "Exchange Setup is currently running. Skipping maintenance mode checks." - return - } - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "*" -VerbosePreference $VerbosePreference - - #If the request is to put the server in maintenance mode, make sure we aren't already at the (optional) requested Exchange Server version - $atDesiredVersion = IsExchangeAtDesiredVersion -DomainController $DomainController -UpgradedServerVersion $UpgradedServerVersion - - if ($Enabled -eq $true -and $atDesiredVersion -eq $true) - { - Write-Verbose "Server is already at or above the desired upgrade version of '$($UpgradedServerVersion)'. Skipping putting server into maintenance mode." - return - } - - #Continue on with setting the maintenance mode state - $maintenanceModeStatus = GetMaintenanceModeStatus -EnteringMaintenanceMode $Enabled -DomainController $DomainController - - if ($null -ne $maintenanceModeStatus) - { - #Set vars relevant to both 'Enabled' code paths - $htStatus = $MaintenanceModeStatus.ServerComponentState | Where-Object {$_.Component -eq "HubTransport"} - $haStatus = $MaintenanceModeStatus.ServerComponentState | Where-Object {$_.Component -eq "HubTransport"} - - #Put the server into maintenance mode - if ($Enabled -eq $true) - { - #Block DB activation on this server - if ($maintenanceModeStatus.MailboxServer.DatabaseCopyAutoActivationPolicy -ne "Blocked") - { - Write-Verbose "Setting DatabaseCopyAutoActivationPolicy to Blocked" - SetMailboxServer -Identity $env:COMPUTERNAME -DomainController $DomainController -AdditionalParams @{"DatabaseCopyAutoActivationPolicy" = "Blocked"} - } - - #Set UM to draining before anything else - $changedUM = ChangeComponentState -Component "UMCallRouter" -Requester "Maintenance" -ServerComponentState $maintenanceModeStatus.ServerComponentState -State "Draining" -SetInactiveComponentsFromAnyRequesterToActive $SetInactiveComponentsFromAnyRequesterToActive -DomainController $DomainController - - #Start HT maintenance if required - if ($htStatus.State -ne "Inactive") - { - Write-Verbose "Entering Transport Maintenance" - [string[]]$transportExclusions = GetMessageRedirectionExclusions -DomainController $DomainController - Start-TransportMaintenance -LoadLocalShell $false -MessageRedirectExclusions $transportExclusions -Verbose - } - - #Wait for remaining UM calls to drain - if ($changedUM) - { - WaitForUMToDrain -DomainController $DomainController - } - - #Run StartDagServerMaintenance script to put cluster offline and failover DB's - if ($maintenanceModeStatus.ClusterNode.State -eq "Up" -or - $maintenanceModeStatus.MailboxServer.DatabaseCopyAutoActivationPolicy -ne "Blocked" -or - (GetActiveDBCount -MaintenanceModeStatus $maintenanceModeStatus -DomainController $DomainController) -ne 0) - { - Write-Verbose "Running StartDagServerMaintenance.ps1" - - $dagMemberCount = GetDAGMemberCount - - if ($dagMemberCount -ne 0 -and $dagMemberCount -le 2) - { - . $startDagServerMaintenanceScript -serverName $env:COMPUTERNAME -overrideMinimumTwoCopies -Verbose - } - else - { - . $startDagServerMaintenanceScript -serverName $env:COMPUTERNAME -Verbose - } - } - - #Set remaining components to offline - $changedState = ChangeComponentState -Component "ServerWideOffline" -Requester "Maintenance" -ServerComponentState $maintenanceModeStatus.ServerComponentState -State "Inactive" -SetInactiveComponentsFromAnyRequesterToActive $SetInactiveComponentsFromAnyRequesterToActive -DomainController $DomainController - - #Check whether we are actually in maintenance mode - $testResults = Test-TargetResource @PSBoundParameters - - if ($testResults -eq $false) - { - throw "Server is not fully in maintenance mode after running through steps to enable maintenance mode." - } - } - #Take the server out of maintenance mode - else - { - #Bring ServerWideOffline and UMCallRouter back online - $changedState = ChangeComponentState -Component "ServerWideOffline" -Requester "Maintenance" -ServerComponentState $maintenanceModeStatus.ServerComponentState -State "Active" -SetInactiveComponentsFromAnyRequesterToActive $SetInactiveComponentsFromAnyRequesterToActive -DomainController $DomainController - $changedState = ChangeComponentState -Component "UMCallRouter" -Requester "Maintenance" -ServerComponentState $maintenanceModeStatus.ServerComponentState -State "Active" -SetInactiveComponentsFromAnyRequesterToActive $SetInactiveComponentsFromAnyRequesterToActive -DomainController $DomainController - - #Run StopDagServerMaintenance.ps1 if required - if ($maintenanceModeStatus.ClusterNode.State -ne "Up" -or ` - $maintenanceModeStatus.MailboxServer.DatabaseCopyAutoActivationPolicy -ne "Unrestricted" -or` - $haStatus.State -ne "Active") - { - Write-Verbose "Running StopDagServerMaintenance.ps1" - - #Run StopDagServerMaintenance.ps1 in try/catch, so if an exception occurs, we can at least finish - #doing the rest of the steps to take the server out of maintenance mode - try - { - . $stopDagServerMaintenanceScript -serverName $env:COMPUTERNAME -Verbose - } - catch - { - Write-Error "Caught exception running StopDagServerMaintenance.ps1: $($_.Exception.Message)" - } - } - - #End Transport Maintenance - if ($htStatus.State -ne "Active") - { - Write-Verbose "Ending Transport Maintenance" - Stop-TransportMaintenance -LoadLocalShell $false -Verbose - } - - #Bring components online that may have been taken offline by a failed setup run - $changedState = ChangeComponentState -Component "Monitoring" -Requester "Functional" -ServerComponentState $maintenanceModeStatus.ServerComponentState -State "Active" -SetInactiveComponentsFromAnyRequesterToActive $SetInactiveComponentsFromAnyRequesterToActive -DomainController $DomainController - $changedState = ChangeComponentState -Component "RecoveryActionsEnabled" -Requester "Functional" -ServerComponentState $maintenanceModeStatus.ServerComponentState -State "Active" -SetInactiveComponentsFromAnyRequesterToActive $SetInactiveComponentsFromAnyRequesterToActive -DomainController $DomainController - - #Bring online any specifically requested components - if ($null -ne $AdditionalComponentsToActivate) - { - foreach ($component in $AdditionalComponentsToActivate) - { - if ((IsComponentCheckedByDefault -ComponentName $component) -eq $false) - { - $status = $null - $status = $MaintenanceModeStatus.ServerComponentState | Where-Object {$_.Component -like "$($component)"} - - $changedState = ChangeComponentState -Component $component -Requester "Functional" -ServerComponentState $maintenanceModeStatus.ServerComponentState -State "Active" -SetInactiveComponentsFromAnyRequesterToActive $SetInactiveComponentsFromAnyRequesterToActive -DomainController $DomainController - } - } - } - - if ($MovePreferredDatabasesBack -eq $true) - { - MovePrimaryDatabasesBack -DomainController $DomainController - } - } - } - else - { - throw "Failed to retrieve maintenance mode status of server." - } - - Remove-Item Alias:Write-Host -ErrorAction SilentlyContinue -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.Boolean] - $Enabled, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.String[]] - $AdditionalComponentsToActivate, - - [System.String] - $DomainController, - - [System.Boolean] - $MovePreferredDatabasesBack = $false, - - [System.Boolean] - $SetInactiveComponentsFromAnyRequesterToActive = $false, - - [System.String] - $UpgradedServerVersion - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Enabled" = $Enabled} -VerbosePreference $VerbosePreference - - #Load TransportMaintenanceMode Helper - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)"))\TransportMaintenance.psm1" -Verbose:0 - - $setupRunning = IsSetupRunning - - if ($setupRunning -eq $true) - { - Write-Verbose "Exchange Setup is currently running. Skipping maintenance mode checks." - return $true - } - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-*" -VerbosePreference $VerbosePreference - - $maintenanceModeStatus = GetMaintenanceModeStatus -EnteringMaintenanceMode $Enabled -DomainController $DomainController - - if ($null -ne $maintenanceModeStatus) - { - #Make sure server is fully in maintenance mode - if ($Enabled -eq $true) - { - $atDesiredVersion = IsExchangeAtDesiredVersion -DomainController $DomainController -UpgradedServerVersion $UpgradedServerVersion - - if ($atDesiredVersion -eq $true) - { - Write-Verbose "Server is already at or above the desired upgrade version of '$($UpgradedServerVersion)'. Skipping putting server into maintenance mode." - return $true - } - else - { - if ($maintenanceModeStatus.MailboxServer.DatabaseCopyAutoActivationPolicy -ne "Blocked") - { - Write-Verbose "DatabaseCopyAutoActivationPolicy is not set to Blocked" - return $false - } - - if ($null -ne ($MaintenanceModeStatus.ServerComponentState | Where-Object {$_.State -ne "Inactive" -and $_.Component -ne "Monitoring" -and $_.Component -ne "RecoveryActionsEnabled"})) - { - Write-Verbose "One or more components have a status other than Inactive" - return $false - } - - if ($maintenanceModeStatus.ClusterNode.State -eq "Up") - { - Write-Verbose "Cluster node has a status of Up" - return $false - } - - if ((IsServerPAM -DomainController $DomainController) -eq $true) - { - Write-Verbose "Server still has the Primary Active Manager role" - return $false - } - - - [int]$messagesQueued = GetQueueMessageCount -MaintenanceModeStatus $maintenanceModeStatus - - if ($messagesQueued -gt 0) - { - Write-Verbose "Found $($messagesQueued) messages still in queue" - return $false - } - - - [int]$activeDBCount = GetActiveDBCount -MaintenanceModeStatus $maintenanceModeStatus -DomainController $DomainController - - if ($activeDBCount -gt 0) - { - Write-Verbose "Found $($activeDBCount) replicated databases still activated on this server" - return $false - } - - - [int]$umCallCount = GetUMCallCount -MaintenanceModeStatus $maintenanceModeStatus -DomainController $DomainController - - if ($umCallCount -gt 0) - { - Write-Verbose "Found $($umCallCount) active UM calls on this server" - return $false - } - } - } - #Make sure the server is fully out of maintenance mode - else - { - $activeComponents = $MaintenanceModeStatus.ServerComponentState | Where-Object {$_.State -eq "Active"} - - if ($null -eq $activeComponents) - { - Write-Verbose "No Components found with a status of Active" - return $false - } - - if ($null -eq ($activeComponents | Where-Object {$_.Component -eq "ServerWideOffline"})) - { - Write-Verbose "Component ServerWideOffline is not Active" - return $false - } - - if ($null -eq ($activeComponents | Where-Object {$_.Component -eq "UMCallRouter"})) - { - Write-Verbose "Component UMCallRouter is not Active" - return $false - } - - if ($null -eq ($activeComponents | Where-Object {$_.Component -eq "HubTransport"})) - { - Write-Verbose "Component HubTransport is not Active" - return $false - } - - if ($maintenanceModeStatus.ClusterNode.State -ne "Up") - { - Write-Verbose "Cluster node has a status of $($maintenanceModeStatus.ClusterNode.State)" - return $false - } - - if ($maintenanceModeStatus.MailboxServer.DatabaseCopyAutoActivationPolicy -ne "Unrestricted") - { - Write-Verbose "DatabaseCopyAutoActivationPolicy is set to $($maintenanceModeStatus.MailboxServer.DatabaseCopyAutoActivationPolicy)" - return $false - } - - if ($null -eq ($activeComponents | Where-Object {$_.Component -eq "Monitoring"})) - { - Write-Verbose "Component Monitoring is not Active" - return $false - } - - if ($null -eq ($activeComponents | Where-Object {$_.Component -eq "RecoveryActionsEnabled"})) - { - Write-Verbose "Component RecoveryActionsEnabled is not Active" - return $false - } - - if ($null -ne $AdditionalComponentsToActivate) - { - foreach ($component in $AdditionalComponentsToActivate) - { - if ((IsComponentCheckedByDefault -ComponentName $component) -eq $false) - { - $status = $null - $status = $MaintenanceModeStatus.ServerComponentState | Where-Object {$_.Component -like "$($component)"} - - if ($null -ne $status -and $Status.State -ne "Active") - { - Write-Verbose "Component $($component) is not set to Active" - return $false - } - } - } - } - } - } - else - { - throw "Failed to retrieve maintenance mode status for server." - } - - return $true -} - -#Gets a Hashtable containing various objects from Exchange that will be used to determine maintenance mode status -function GetMaintenanceModeStatus -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [System.String] - $DomainController, - - [System.Boolean] - $EnteringMaintenanceMode = $true - ) - - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep 'DomainController' - - $serverComponentState = GetServerComponentState -Identity $env:COMPUTERNAME -DomainController $DomainController - $clusterNode = Get-ClusterNode -Name $env:COMPUTERNAME - $dbCopyStatus = GetMailboxDatabaseCopyStatus -Server $env:COMPUTERNAME -DomainController $DomainController - $umCalls = GetUMActiveCalls -Server $env:COMPUTERNAME -DomainController $DomainController - $mailboxServer = GetMailboxServer -Identity $env:COMPUTERNAME -DomainController $DomainController - $queues = Get-Queue -Server $env:COMPUTERNAME -ErrorAction SilentlyContinue - - #If we're checking queues too soon after restarting Transport, Get-Queue may fail. Wait for bootloader to be active and try again. - if ($null -eq $queues -and $EnteringMaintenanceMode -eq $true) - { - $endTime = [DateTime]::Now.AddMinutes(5) - - Write-Verbose "Waiting up to 5 minutes for the Transport Bootloader to be ready before running Get-Queue. Wait started at $([DateTime]::Now)." - - while ($null -eq $queues -and [DateTime]::Now -lt $endTime) - { - Wait-BootLoaderReady -Server $env:COMPUTERNAME -TimeOut (New-TimeSpan -Seconds 15) -PollingFrequency (New-TimeSpan -Seconds 1) | Out-Null - $queues = Get-Queue -Server $env:COMPUTERNAME -ErrorAction SilentlyContinue - } - } - - [System.Collections.Hashtable]$returnValue = @{ - ServerComponentState = $serverComponentState - ClusterNode = $clusterNode - Queues = $queues - DBCopyStatus = $dbCopyStatus - UMActiveCalls = $umCalls - MailboxServer = $mailboxServer - } - - return $returnValue -} - -#Gets a count of messages in queues on the local server -function GetQueueMessageCount -{ - [CmdletBinding()] - [OutputType([System.UInt32])] - param - ( - [parameter(Mandatory = $true)] - [System.Collections.Hashtable] - $MaintenanceModeStatus - ) - - [Uint32]$messageCount = 0 - - if ($null -ne $MaintenanceModeStatus.Queues) - { - foreach ($queue in $MaintenanceModeStatus.Queues | Where-Object {$_.Identity -notlike "*\Shadow\*"}) - { - Write-Verbose "Found queue '$($queue.Identity)' with a message count of '$($queue.MessageCount)'." - $messageCount += $queue.MessageCount - } - } - else - { - Write-Warning "No Transport Queues were detected on this server. This can occur if the MSExchangeTransport service is not started, or if Get-Queue was run too quickly after restarting the service." - } - - return $messageCount -} - -#Gets a count of database that are replication enabled, and are still activated on the local server (even if they are dismounted) -function GetActiveDBCount -{ - [CmdletBinding()] - [OutputType([System.UInt32])] - param - ( - [parameter(Mandatory = $true)] - [System.Collections.Hashtable] - $MaintenanceModeStatus, - - [System.String] - $DomainController - ) - - [Uint32]$activeDBCount = 0 - - #Get DB's with a status of Mounted, Mounting, Dismounted, or Dismounting - $localDBs = $MaintenanceModeStatus.DBCopyStatus | Where-Object {$_.Status -like "Mount*" -or $_.Status -like "Dismount*"} - - #Ensure that any DB's we found actually have copies - foreach ($db in $localDBs) - { - $dbProps = GetMailboxDatabase -Identity "$($db.DatabaseName)" -DomainController $DomainController - - if ($dbProps.ReplicationType -ne "None") - { - Write-Verbose "Found database '$($db.DatabaseName)' with a replication type of '$($dbProps.ReplicationType)' and a status of '$($db.Status)'." - $activeDBCount++ - } - } - - return $activeDBCount -} - -#Gets a count of active UM calls on the local server -function GetUMCallCount -{ - [CmdletBinding()] - [OutputType([System.UInt32])] - param - ( - [parameter(Mandatory = $true)] - [System.Collections.Hashtable] - $MaintenanceModeStatus, - - [System.String] - $DomainController - ) - - [Uint32]$umCallCount = 0 - - $umCalls = GetUMActiveCalls -Server $env:COMPUTERNAME -DomainController $DomainController - - if ($null -ne $umCalls) - { - if ($null -eq $umCalls.Count) - { - $umCallCount = 1 - } - else - { - $umCallCount = $umCalls.Count - } - } - - return $umCallCount -} - -#Gets a list of servers in the DAG with HubTransport not set to Active, or DatabaseCopyAutoActivationPolicy set to Blocked -function GetMessageRedirectionExclusions -{ - [CmdletBinding()] - [OutputType([System.String[]])] - param - ( - [System.String] - $DomainController - ) - - [string[]]$exclusions = @() - - $mbxServer = GetMailboxServer -Identity $env:COMPUTERNAME -DomainController $DomainController - - if ($null -ne $mbxServer) - { - $dag = GetDatabaseAvailabilityGroup -Identity $($mbxServer.DatabaseAvailabilityGroup) -DomainController $DomainController - - if ($null -ne $dag) - { - foreach ($server in $dag.Servers) - { - if ($server.Name -notlike $env:COMPUTERNAME) - { - $serverName = $server.Name.ToLower() - - #Check whether HubTransport is active on the specified server - $htState = $null - $htState = GetServerComponentState -Identity $server.Name -Component "HubTransport" -DomainController $DomainController - - if ($null -ne $htState -and $htState.State -notlike "Active") - { - if (($exclusions.Contains($serverName) -eq $false)) - { - $exclusions += $serverName - continue - } - } - - #Check whether the server is already blocked from database activation - $currentMbxServer = $null - $currentMbxServer = GetMailboxServer -Identity $server.Name -DomainController $DomainController - - if ($null -ne $currentMbxServer -and $currentMbxServer.DatabaseCopyAutoActivationPolicy -like "Blocked") - { - if (($exclusions.Contains($serverName) -eq $false)) - { - $exclusions += $serverName - continue - } - } - } - } - } - } - - return $exclusions -} - -#If UpgradedServerVersion was specified, checks to see whether the server is already at the desired version -function IsExchangeAtDesiredVersion -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [System.String] - $DomainController, - - [System.String] - $UpgradedServerVersion - ) - - $atDesiredVersion = $false - - if (!([string]::IsNullOrEmpty($UpgradedServerVersion))) - { - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep 'DomainController' - - $server = GetExchangeServer -Identity $env:COMPUTERNAME -DomainController $DomainController - - if ($null -ne $server) - { - [string[]]$versionParts = $UpgradedServerVersion.Split('.') - - if ($null -ne $versionParts -and $versionParts.Length -eq 4) - { - if (([int]::Parse($server.AdminDisplayVersion.Major) -ge [int]::Parse($versionParts[0])) -and - ([int]::Parse($server.AdminDisplayVersion.Minor) -ge [int]::Parse($versionParts[1])) -and - ([int]::Parse($server.AdminDisplayVersion.Build) -ge [int]::Parse($versionParts[2])) -and - ([int]::Parse($server.AdminDisplayVersion.Revision) -ge [int]::Parse($versionParts[3]))) - { - $atDesiredVersion = $true - } - else - { - Write-Verbose "Desired server version '$($UpgradedServerVersion)' is greater than the actual server version '$($server.AdminDisplayVersion)'" - } - } - else - { - throw "Invalid version format for `$UpgradedServerVersion. Should be in the format ##.#.####.#" - } - } - } - - return $atDesiredVersion -} - -#Checks to see whether the specified component is one that is already checked by default -function IsComponentCheckedByDefault -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [string] - $ComponentName - ) - - [boolean]$checkedByDefault = $false - - if ($ComponentName -like "ServerWideOffline" -or $ComponentName -like "UMCallRouter" -or $ComponentName -like "HubTransport" -or $ComponentName -like "Monitoring" -or $ComponentName -like "RecoveryActionsEnabled") - { - $checkedByDefault = $true - } - - return $checkedByDefault -} - -#Gets a count of members in this servers DAG -function GetDAGMemberCount -{ - [CmdletBinding()] - [OutputType([System.Int32])] - param( - [System.String] - $DomainController - ) - - [System.Int32]$count = 0 - - $server = GetMailboxServer -Identity $env:COMPUTERNAME -DomainController $DomainController - - if ($null -ne $server -and ![string]::IsNullOrEmpty($server.DatabaseAvailabilityGroup)) - { - $dag = GetDatabaseAvailabilityGroup -Identity "$($server.DatabaseAvailabilityGroup)" -DomainController $DomainController - - if ($null -ne $dag) - { - $count = $dag.Servers.Count - } - } - - return $count -} - -function IsServerPAM -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param( - [System.String] - $DomainController - ) - - $isPAM = $false - - $server = GetMailboxServer -Identity $env:COMPUTERNAME -DomainController $DomainController - - if ($null -ne $server -and ![string]::IsNullOrEmpty($server.DatabaseAvailabilityGroup)) - { - $dag = GetDatabaseAvailabilityGroup -Identity "$($server.DatabaseAvailabilityGroup)" -DomainController $DomainController - - if ($null -ne $dag -and $dag.PrimaryActiveManager -like $env:COMPUTERNAME) - { - $isPAM = $true - } - } - - return $isPAM -} - -#Waits up the the specified WaitMinutes for existing UM calls to finish. Returns True if no more UM calls are active. -function WaitForUMToDrain -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [System.String] - $DomainController, - - [System.UInt32] - $SleepSeconds = 15, - - [System.UInt32] - $WaitMinutes = 5 - ) - - [boolean]$umDrained = $false - - $endTime = [DateTime]::Now.AddMinutes($WaitMinutes) - - Write-Verbose "Waiting up to $($WaitMinutes) minutes for active UM calls to finish" - - while ($fullyInMaintenanceMode -eq $false -and [DateTime]::Now -lt $endTime) - { - Write-Verbose "Checking whether all UM calls are finished at $([DateTime]::Now)." - - $umCalls = $null - - GetUMActiveCalls -Server $env:COMPUTERNAME -DomainController $DomainController - - if ($null -eq $umCalls -or $umCalls.Count -eq 0) - { - $umDrained = $true - } - else - { - Write-Verbose "There are still active UM calls as of $([DateTime]::Now). Sleeping for $($SleepSeconds) seconds. Will continue checking until $($endTime)." - Start-Sleep -Seconds $SleepSeconds - } - } - - return $umDrained -} - -#Checks whether a Component is at the specified State, if not, changes the component to the state. -#Returns whether a change was made to the component state -function ChangeComponentState -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Component, - - [parameter(Mandatory = $true)] - [System.String] - $Requester, - - [parameter(Mandatory = $true)] - $ServerComponentState, - - [parameter(Mandatory = $true)] - [System.String] - $State, - - [System.String] - $DomainController, - - [System.Boolean] - $SetInactiveComponentsFromAnyRequesterToActive = $false - ) - - [boolean]$madeChange = $false - - $componentState = $MaintenanceModeStatus.ServerComponentState | Where-Object {$_.Component -like "$($Component)"} - - if ($null -ne $componentState) - { - #If we're already Inactive don't bother setting to Draining. - if ($State -like "Draining" -and $componentState.State -like "Inactive") - { - return $false - } - elseif ($componentState.State -notlike "$($State)") - { - Write-Verbose "Setting $($componentState.Component) component to $($State) for requester $($Requester)" - - SetServerComponentState -Component $componentState.Component -State $State -Requester $Requester -DomainController $DomainController - - $madeChange = $true - - if ($State -eq "Active" -and $SetInactiveComponentsFromAnyRequesterToActive -eq $true) - { - $additionalRequesters = $null - $additionalRequesters = $componentState.LocalStates | Where-Object {$_.Requester -notlike "$($Requester)" -and $_.State -notlike "Active"} - - if ($null -ne $additionalRequesters) - { - foreach ($additionalRequester in $additionalRequesters) - { - Write-Verbose "Setting $($componentState.Component) component to Active for requester $($additionalRequester.Requester)" - - SetServerComponentState -Component $componentState.Component -State Active -Requester $additionalRequester.Requester -DomainController $DomainController - } - } - } - } - } - - return $madeChange -} - -#Finds any databases which have an Activation Preference of 1 for this server, which are not currently hosted on this server, and moves them back -function MovePrimaryDatabasesBack -{ - [CmdletBinding()] - param - ( - [System.String] - $DomainController - ) - - $databases = GetMailboxDatabase -Server $env:COMPUTERNAME -Status -DomainController $DomainController - - [string[]]$databasesWithActivationPrefOneNotOnThisServer = @() - - if ($null -ne $databases) - { - foreach ($database in $databases) - { - if ($null -ne $database.ActivationPreference) - { - foreach ($ap in $database.ActivationPreference) - { - if ($ap.Key.Name -like $env:COMPUTERNAME -and $ap.Value -eq 1) - { - $copyStatus = $null - $copyStatus = GetMailboxDatabaseCopyStatus -Identity "$($database.Name)\$($env:COMPUTERNAME)" -DomainController $DomainController - - if ($null -ne $copyStatus -and $copyStatus.Status -eq "Healthy") - { - $databasesWithActivationPrefOneNotOnThisServer += $database.Name - } - } - } - } - } - } - - if ($databasesWithActivationPrefOneNotOnThisServer.Count -gt 0) - { - Write-Verbose "Found $($databasesWithActivationPrefOneNotOnThisServer.Count) Healthy databases with Activation Preference 1 that should be moved to this server." - - foreach ($database in $databasesWithActivationPrefOneNotOnThisServer) - { - Write-Verbose "Attempting to move database '$($database)' back to this server." - - #Do the move in a try/catch block so we can log the error, but not have it prevent other databases from attempting to move - try - { - MoveActiveMailboxDatabase -Identity $database -ActivateOnServer $env:COMPUTERNAME -DomainController $DomainController - } - catch - { - Write-Error "$($_.Exception.Message)" - } - } - } - else - { - Write-Verbose "Found 0 Healthy databases with Activation Preference 1 for this server that are currently not hosted on this server" - } -} - -#region Exchange Cmdlet Wrappers -function GetExchangeServer -{ - [CmdletBinding()] - param( - [parameter(Mandatory = $true)] - [System.String] - $Identity = $env:COMPUTERNAME, - - [System.String] - $DomainController - ) - - if ([string]::IsNullOrEmpty($DomainController)) - { - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove 'DomainController' - } - - return (Get-ExchangeServer @PSBoundParameters) -} - -function GetDatabaseAvailabilityGroup -{ - [CmdletBinding()] - param( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [System.String] - $DomainController - ) - - if ([string]::IsNullOrEmpty($DomainController)) - { - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove 'DomainController' - } - - return (Get-DatabaseAvailabilityGroup @PSBoundParameters -Status) -} - -function GetServerComponentState -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity = $env:COMPUTERNAME, - - [System.String] - $Component, - - [System.String] - $DomainController - ) - - if ([string]::IsNullOrEmpty($Component)) - { - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove 'Component' - } - - if ([string]::IsNullOrEmpty($DomainController)) - { - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove 'DomainController' - } - - return (Get-ServerComponentState @PSBoundParameters) -} - -function SetServerComponentState -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Component, - - [parameter(Mandatory = $true)] - [System.String] - $Requester, - - [parameter(Mandatory = $true)] - [System.String] - $State, - - [System.String] - $DomainController - ) - - if ([string]::IsNullOrEmpty($DomainController)) - { - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove 'DomainController' - } - - Set-ServerComponentState -Identity $env:COMPUTERNAME @PSBoundParameters -} - -function GetMailboxDatabase -{ - [CmdletBinding()] - param - ( - [System.String] - $Identity, - - [System.String] - $DomainController, - - [System.String] - $Server, - - [switch] - $Status - ) - - if ([string]::IsNullOrEmpty($Identity)) - { - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove 'Identity' - } - - if ([string]::IsNullOrEmpty($DomainController)) - { - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove 'DomainController' - } - - if ([string]::IsNullOrEmpty($Server)) - { - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove 'Server' - } - - return (Get-MailboxDatabase @PSBoundParameters) -} - -function GetMailboxDatabaseCopyStatus -{ - [CmdletBinding()] - param - ( - [System.String] - $Identity, - - [System.String] - $DomainController, - - [System.String] - $Server - ) - - if ([string]::IsNullOrEmpty($Identity)) - { - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove 'Identity' - } - - if ([string]::IsNullOrEmpty($DomainController)) - { - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove 'DomainController' - } - - if ([string]::IsNullOrEmpty($Server)) - { - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove 'Server' - } - - return (Get-MailboxDatabaseCopyStatus @PSBoundParameters) -} - -function GetMailboxServer -{ - [CmdletBinding()] - param( - [parameter(Mandatory = $true)] - [System.String] - $Identity = $env:COMPUTERNAME, - - [System.String] - $DomainController - ) - - if ([string]::IsNullOrEmpty($DomainController)) - { - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove 'DomainController' - } - - return (Get-MailboxServer @PSBoundParameters) -} - -function SetMailboxServer -{ - [CmdletBinding()] - param( - [parameter(Mandatory = $true)] - [System.String] - $Identity = $env:COMPUTERNAME, - - [System.String] - $DomainController, - - [System.Collections.Hashtable] - $AdditionalParams - ) - - if ([string]::IsNullOrEmpty($DomainController)) - { - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove 'DomainController' - } - - AddParameters -PSBoundParametersIn $PSBoundParameters -ParamsToAdd $AdditionalParams - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove 'AdditionalParams' - - Set-MailboxServer @PSBoundParameters -} - -function GetUMActiveCalls -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Server = $env:COMPUTERNAME, - - [System.String] - $DomainController - ) - - if ([string]::IsNullOrEmpty($DomainController)) - { - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove 'DomainController' - } - - return (Get-UMActiveCalls @PSBoundParameters) -} - -function MoveActiveMailboxDatabase -{ - [CmdletBinding()] - param - ( - [System.String] - $ActivateOnServer, - - [System.String] - $Identity, - - [System.String] - $DomainController, - - [System.String] - $MoveComment, - - [System.String] - $Server = $env:COMPUTERNAME - ) - - if ([string]::IsNullOrEmpty($ActivateOnServer)) - { - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove 'ActivateOnServer' - } - - if ([string]::IsNullOrEmpty($DomainController)) - { - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove 'DomainController' - } - - if ([string]::IsNullOrEmpty($Identity)) - { - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove 'Identity' - } - - if ([string]::IsNullOrEmpty($MoveComment)) - { - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove 'MoveComment' - } - - if ([string]::IsNullOrEmpty($Server)) - { - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove 'Server' - } - - Move-ActiveMailboxDatabase @PSBoundParameters -Confirm:$false -ErrorAction Stop -} -#endregion - -Export-ModuleMember -Function *-TargetResource - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMaintenanceMode/MSFT_xExchMaintenanceMode.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMaintenanceMode/MSFT_xExchMaintenanceMode.schema.mof deleted file mode 100644 index 95555a2c..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMaintenanceMode/MSFT_xExchMaintenanceMode.schema.mof +++ /dev/null @@ -1,13 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xExchMaintenanceMode")] -class MSFT_xExchMaintenanceMode : OMI_BaseResource -{ - [Key, Description("Whether the server should be put into Maintenance Mode. When Enabled is set to True, the server will be put in Maintenance Mode. If False, the server will be taken out of Maintenance Mode.")] Boolean Enabled; - [Required, Description("Credentials used to establish a remote Powershell session to Exchange"), EmbeddedInstance("MSFT_Credential")] String Credential; - [Write, Description("When taking a server out of Maintenance Mode, the following components will be set to Active by default: ServerWideOffline, UMCallRouter, HighAvailability, Monitoring, RecoveryActionsEnabled. This parameter specifies an additional list of components to set to Active.")] String AdditionalComponentsToActivate[]; - [Write, Description("The DomainController parameter specifies the fully qualified domain name (FQDN) of the domain controller that writes this configuration change to Active Directory.")] String DomainController; - [Write, Description("Whether to move back databases with an Activation Preference of one for this server after taking the server out of Maintenance Mode. Defaults to False.")] Boolean MovePreferredDatabasesBack; - [Write, Description("Whether components that were set to Inactive by outside Requesters should also be set to Active when exiting Maintenance Mode. Defaults to False.")] Boolean SetInactiveComponentsFromAnyRequesterToActive; - [Write, Description("Optional string to specify what the server version will be after applying a Cumulative Update. If the server is already at this version, requests to put the server in Maintenance Mode will be ignored. Version should be in the format ##.#.####.#, as in 15.0.1104.5.")] String UpgradedServerVersion; -}; - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMaintenanceMode/TransportMaintenance.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMaintenanceMode/TransportMaintenance.psm1 deleted file mode 100644 index 1d6c7a1f..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMaintenanceMode/TransportMaintenance.psm1 +++ /dev/null @@ -1,2648 +0,0 @@ -#region Globals from all three scripts -# Service Names -$TransportServiceName = "MsExchangeTransport" -$MessageTracing = "MSMessageTracingClient" -$EdgeSync = "MsExchangeEdgeSync" -$Script:OriginalPref = $ErrorActionPreference - -$Script:ExchangeServer = $null -$Script:TransportService = $null -$Script:HubTransport = $null -$Script:Entered = $false - -$Component = "HubTransport" -$Requester = "Maintenance" - -$Target = $env:COMPUTERNAME - -$Script:LogFileName = $null -$Script:TransportMaintenanceLogPrefix = 'TransportMaintenance' -$Script:TransportMaintenanceLogNameFormat = "{0}\TransportMaintenance-{1}-{2}.log" -$Script:ServerInMM = "ServerInMM" -$Script:AllotedTimeExceeded = "AllotedTimeExceeded" -$Script:NoProgressTimeout = "NoProgressTimeout" -$Script:UnredirectedMessageEventId = 100 -$Script:UndrainedDiscardEventEventId = 101 -$Script:MaxWaitForOtherWorkflow = New-TimeSpan -Minutes 30 -$Script:TransportMaintenanceSync = $null -$Script:ExchangeVersion = "" - -$ServiceState = $null -#endregion - -#region New Code or Wrappers -<# -.DESCRIPTION -Begin maintenance script for HUB components. - -.PARAMETER Target -The name of the machine being put into maintenance. - -#> -function Start-TransportMaintenance -{ - [CmdletBinding()] - param( - [Parameter(Mandatory = $false)] - [string]$Target = $env:COMPUTERNAME, - - [switch]$ExcludeLocalSiteFromMessageRedirect, - - [boolean]$LoadLocalShell = $false, - - [string[]]$MessageRedirectExclusions - ) - - if ($LoadLocalShell -eq $true) - { - AddExchangeSnapinIfRequired - } - - $Script:LogInfo = @{ - Target = $Target - } - - try - { - Write-Verbose "Starting non-fatal Transport maintenance tasks for '$Target' on $($env:ComputerName)" - if(-not (Initialize-TransportMaintenance -Target $Target)) - { - return - } - - # Log the BeginTM/start event - $beginTMLog = New-LogEntry -Source $Target -Stage BeginTM - Write-EventOfEntry -Event Start -Entry $beginTMLog -Reason $Script:LogInfo - - Invoke-RemoteMaintenance -Target $Target -MessageRedirectExclusions $MessageRedirectExclusions -ExcludeLocalSiteFromMessageRedirect:$ExcludeLocalSiteFromMessageRedirect - - } - catch - { - Write-Warning "At least one non-fatal tasked failed. Ignoring and continuing deployment. Error was $_" - } - finally - { - if($beginTMLog) - { - Write-EventOfEntry -Event Completed -Entry $beginTMLog -Reason $Script:LogInfo - } - } -} - -<# -.DESCRIPTION -Performs End Maintenance of HubTransport - -#> -function Stop-TransportMaintenance -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseDeclaredVarsMoreThanAssignments", "")] - [CmdletBinding()] - param( - [boolean]$LoadLocalShell = $false - ) - - if ($LoadLocalShell -eq $true) - { - AddExchangeSnapinIfRequired - } - - $ServiceState = "Online" - - Start-HUBEndMaintenance -} - -function AddExchangeSnapinIfRequired -{ - if ($null -eq (Get-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 -ErrorAction SilentlyContinue)) - { - Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 -ErrorAction SilentlyContinue - } -} -#endregion - -#region From TransportBeginMaintenance.ps1 -# .DESCRIPTION -# Initializes logging, validates if the current server -# -# .PARAMETER Target -# Target server for the operation. -# -# .RETURN -# True if the initialization is successful and caller should continue the MM process. -# Else, returns false and caller should NOT continue with the MM. -function Initialize-TransportMaintenance -{ - param( - [Parameter(Mandatory = $true)] - [string]$Target - ) - - $ErrorActionPreference = "Stop" - $Error.Clear() - - Initialize-TransportMaintenanceLog -Server $Target - - $Script:ExchangeServer = Get-ExchangeServer $Target - if(-not $Script:ExchangeServer) - { - Write-Verbose "$Target is not an exchange server" - - $Script:LogInfo.Add('ExchangeServer', 'False') - Write-SkippedEvent -Source $Target -Stage BeginTM -Reason $Script:LogInfo - - return $false - } - - $Script:TransportService = Get-Service ` - -ComputerName $Script:ExchangeServer.Fqdn ` - -Name $TransportServiceName ` - -ErrorAction SilentlyContinue - - if(-not $Script:TransportService) - { - Write-Verbose "MSExchangeTransport service is not found on $Target" - - $Script:LogInfo.Add($TransportServiceName, 'NotFound') - Write-SkippedEvent -Source $Target -Stage BeginTM -Reason $Script:LogInfo - - return $false - } - - $Script:HubTransport = Get-ComponentState -Server $Target - if(-not $Script:HubTransport) - { - Write-Verbose "Unable to find HubTransport's ServerComponentState from $($env:ComputerName) for $Target." - - $Script:LogInfo.Add('HubTransport', 'NotFound') - Write-SkippedEvent -Source $Target -Stage BeginTM -Reason $Script:LogInfo - - return $false - } - - $Script:Entered = $true - return $true -} - -# .DESCRIPTION -# Fully drains the Transport and put HubTransport component state to Inactive -# -# .PARAMETER Target -# Target server for the operation. -# -# .RETURN -# None -function Invoke-FullyDrainTransport -{ - param( - [Parameter(Mandatory = $false)] - [string]$Target = $env:COMPUTERNAME, - - [switch]$ExcludeLocalSiteFromMessageRedirect, - - [string[]]$MessageRedirectExclusions) - - #drain active messages - Clear-ActiveMessage -Server $Target -TransportService $script:TransportService - - # redirect the remaining messages - $activeServers = Send-MessagesToNewServer -Server $Target -MessageRedirectExclusions $MessageRedirectExclusions -ExcludeLocalSite:$ExcludeLocalSiteFromMessageRedirect - - # Drain the discard events - if($activeServers) - { - Clear-DiscardEvent -Primary $Target -ShadowServers $activeServers | out-null - } - else - { - Write-Verbose "Unable to find other active servers in this DAG. Skip draining of discard event." - } - - Write-Verbose "Setting HubTransport component state to Inactive" - Set-ComponentState -Server $Target -State Inactive - Log-InfoEvent -Source $Target -Stage RestartTransport -Reason @{ComponentState = 'Inactive'} -} - -# .DESCRIPTION -# Perform the Remote Maintenance stage -# -# .PARAMETER Target -# Target server for the operation. -# -function Invoke-RemoteMaintenance -{ - param( - [Parameter(Mandatory = $false)] - [string]$Target = $env:COMPUTERNAME, - - [switch]$ExcludeLocalSiteFromMessageRedirect, - - [string[]]$MessageRedirectExclusions - ) - - if(($Script:TransportService.Status -ne "Running") -or ` - ($Script:HubTransport.State -ne "Active")) - { - $Script:LogInfo.Add('MsExchangeTransport', $Script:TransportService.Status) - $Script:LogInfo.Add('HubTransport', $Script:HubTransport.State) - $Script:LogInfo.Add('Reason', 'Skipped') - } - else - { - Invoke-FullyDrainTransport -Target $Target -MessageRedirectExclusions $MessageRedirectExclusions -ExcludeLocalSiteFromMessageRedirect:$ExcludeLocalSiteFromMessageRedirect - } -} - - -#endregion - -#region From TransportEndMaintenance.ps1 -# Main entry point for the script. -function Start-HUBEndMaintenance -{ - $reasons = @{ - ServiceState = $ServiceState - } - try - { - Initialize-TransportMaintenanceLog -Server $Target - - $TransportService = get-service $TransportServiceName -errorAction silentlyContinue - if(-not $TransportService) - { - Write-Verbose 'MSExchangeTransport service is not found' - - $reasons.Add('MsExchangeTransport', 'NotFound') - Write-SkippedEvent -Source $Target -Stage EndTM -Reason $reasons - return; - } - - $endMMLog = New-LogEntry -Source $Target -Stage EndTM - - Write-EventOfEntry -Event Start -Entry $endMMLog -Reason $reasons - - if($ServiceState -eq "Online") - { - Set-TransportActive - return - } - - # All other parameter combinations indicate 'Inactive' state. - Set-TransportInactive - } - finally - { - if($endMMLog) - { - Write-EventOfEntry -Event Completed -Entry $endMMLog -Reason $reasons - } - } -} - -# checks and enable the submission queue if needed. This should be successful in -# the first iteration. However, we allow the service to have up to 5 minutes to return -# the submission queue. -function Enable-SubmissionQueue -{ - param( - [Parameter(Mandatory = $false)] - [TimeSpan] $PollingFrequency = (New-TimeSpan -Seconds 10), - - [Parameter(Mandatory = $false)] - [TimeSpan] $Timeout = (New-TimeSpan -Minutes 5) - ) - - $endTime = (Get-Date) + $Timeout - $submissionQName = $env:COMPUTERNAME + "\Submission" - - while ($true) - { - $submissionQ = Get-Queue $submissionQName -ErrorAction 'SilentlyContinue' - if ($submissionQ) - { - if($submissionQ.Status -eq 'Suspended') - { - try - { - Resume-Queue $submissionQName -confirm:$false - Log-InfoEvent -source $env:COMPUTERNAME -stage SubmissionQueueCheck -Reason @{EnableSubmissionQueue = 'Succeeded'} - return $true - } - catch - { - Log-InfoEvent -source $env:COMPUTERNAME -stage SubmissionQueueCheck -Reason @{EnableSubmissionQueue = 'Failed'} - return $false - } - } - - Write-SkippedEvent -source $env:COMPUTERNAME -stage SubmissionQueueCheck -Reason @{EnableSubmissionQueue = $submissionQ.Status} - return $true - } - - if ((Get-Date) -gt $endTime) - { - Log-InfoEvent -source $env:COMPUTERNAME -stage SubmissionQueueCheck -Reason @{EnableSubmissionQueue = 'QueueNotFound'} - return $false - } - else - { - Start-Sleep -Seconds $PollingFrequency.Seconds - } - } -} - -# Sets the Transport Component State to 'Active' and starts the appropriate services. -function Set-TransportActive -{ - Write-Output "Enter [Set-TransportActive]" - - $currentServerComponentState = Get-ServerComponentState -Identity $env:COMPUTERNAME -Component $Component - $transportService = Get-CimInstance -ClassName win32_service -filter "name = 'MSExchangeTransport'" - - if($currentServerComponentState.State -eq "Active" ` - -and $null -ne $transportService ` - -and $transportService.StartMode -eq "Auto" ` - -and $transportService.State -eq "Running") - { - Write-SkippedEvent -Source $env:COMPUTERNAME -Stage StartTransport -Reason @{ComponentState = 'Active'} - } - else - { - # Set component state to 'Active' - Set-ComponentState -Component $Component -State "Active" -Requester $Requester | out-null - - # Restart transport - Set-ServiceState -ServiceName $TransportServiceName -State "Stopped" -LoggingStage StopTransport -StartMode "Auto" -ThrowOnFailure - Set-ServiceState -ServiceName $TransportServiceName -State "Running" -LoggingStage StartTransport -ThrowOnFailure - } - - # Enable the submission queue if needed. In case of failure, we will have to put - # the service back to inactive - if (-not (Enable-SubmissionQueue)) - { - Set-TransportInactive - return - } - - # Set MSExchangeEdgeSync service start mode to Auto and restart. - Set-ServiceState -ServiceName $EdgeSync -State "Stopped" -LoggingStage StopEdgeSync -StartMode "Auto" - Set-ServiceState -ServiceName $EdgeSync -State "Running" -LoggingStage StartEdgeSync - - # Do not change the start mode for MSMessageTracingClient - # MSMessageTracingClient service is disabled in some test topologies - # so only start the service, if it is NOT Disabled. - Set-ServiceState -ServiceName $MessageTracing -State "Running" -LoggingStage StartMessageTrace - - Write-Output "Exit [Set-TransportActive]" -} - -# Sets the Transport Component State to 'Inactive' and starts the appropriate services. -function Set-TransportInactive -{ - Write-Output "Enter [Set-TransportInactive]" - - $currentServerComponentState = Get-ServerComponentState -Identity $env:COMPUTERNAME -Component $Component - $transportService = Get-CimInstance -ClassName win32_service -filter "name = 'MSExchangeTransport'" - - if($currentServerComponentState.State -eq "Inactive" ` - -and $null -ne $transportService ` - -and $transportService.StartMode -eq "Auto" ` - -and $transportService.State -eq "Running") - { - Write-SkippedEvent -Source $env:COMPUTERNAME -Stage StartTransport -Reason @{ComponentState = 'Inactive'} - } - else - { - # Set component state to 'Inactive' - Set-ComponentState -Component $Component -State "Inactive" -Requester $Requester | out-null - Set-ServiceState -ServiceName $TransportServiceName -State "Running" -LoggingStage StopTransport -StartMode "Auto" -ThrowOnFailure - } - - Write-Output "Exit [Set-TransportInactive]" -} -#endregion - -#region From DatacenterDeploymentTransportLibrary.ps1 - -# .DESCRIPTION -# Get servers in the dag that contains the specified server -# -# .PARAMETER server -# Server whose dag's members is retrieving. -# -# .PARAMETER ExcludeLocalSite -# Whether to exclude the servers on the same site -# -# .RETURN -# array of servers in the dag. -# -function Get-ServersInDag -{ - param( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String]$server, - - [Parameter(Mandatory = $true)] - [Switch]$ExcludeLocalSite, - - [string[]]$AdditionalExclusions - ) - - Write-Verbose "$server - Retrieving the DAG for the target server" - $exchangeServer = (Get-ExchangeServer $server) - if ($null -eq $exchangeServer) - { - Write-Warning "Could not get the exchange server. Skipping redirect." - return $null - } - - if ($exchangeServer.IsMailboxServer -eq $false) - { - Write-Warning "Could not find the mailbox server. Skipping redirect." - return $null - } - - $dag = (Get-MailboxServer $server).DatabaseAvailabilityGroup - if ($null -eq $dag) - { - Write-Warning "Could not find the DAG for the target server. Skipping redirect." - return $null - } - - Write-Verbose "$server - Retrieving other hub transport servers in the DAG - $dag" - - $dagServers = @((Get-DatabaseAvailabilityGroup $dag).Servers | ForEach-Object {if($_.Name){$_.Name}else{$_}} | Where-Object {$_ -ne $server}) - - if($null -ne $dagServers) - { - #Filter out servers who are in the local site, if $ExcludeLocalSite - if ($ExcludeLocalSite) - { - for ($i = $dagServers.Count - 1; $i -ge 0; $i--) - { - $dagServerProps = $null - $dagServerProps = Get-ExchangeServer $dagServers[$i] - - if ($null -ne $dagServerProps -and $dagServerProps.Site -eq $exchangeServer.Site) - { - $dagServers = $dagServers | Where-Object {$_ -ne $dagServers[$i]} - } - } - } - - #Filter out additional exclusions - if ($null -ne $AdditionalExclusions) - { - foreach ($exclusion in $AdditionalExclusions) - { - $dagServers = $dagServers | Where-Object {$_ -notlike $exclusion} - } - } - } - - if (-not $dagServers) - { - Write-Warning "Could not find servers in the DAG that do not meeting exclusion criteria." - } - - return $dagServers -} - -# .DESCRIPTION -# Selects the active servers from the specified array of servers. -# Active servers are those that have EdgeTransport running. -# -# .PARAMETER $Servers -# Array of servers -# -# .RETURN -# Array of active servers -function Get-ActiveServer -{ - param( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String[]]$Servers - ) - - $activeServers = $Servers | ` - Where-Object{(Get-ServerComponentState -Identity $_ -Component HubTransport).State -eq 'Active' } | ` - ForEach-Object { ` - $xml = [xml](Get-ExchangeDiagnosticInfo -Process "EdgeTransport" -server $_ -erroraction SilentlyContinue) - if($xml -and $xml.Diagnostics.ProcessInfo) - { - Write-Output $_ - } - } - - return $activeServers -} - -# .DESCRIPTION -# Get version for exchange installed on the server -# -# .PARAMETER server -# Server whose version is being retrieved. -# -# .RETURN -# version string. -# -function Get-ExchangeVersion -{ - param( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String]$server - ) - - Write-Verbose "$server - Retrieving version for the target server" - - $serverVersion = (Get-ExchangeServer $server).AdminDisplayVersion - - if ($null -eq $serverVersion) - { - Write-Warning "Could not find exchange version." - return $null - } - - $versionString = [string]::Format("{0}.{1}.{2}.{3}", ` - $serverVersion.Major.ToString("D2"), ` - $serverVersion.Minor.ToString("D2"), ` - $serverVersion.Build.ToString("D4"), ` - $serverVersion.Revision.ToString("D3")) - return $versionString -} - -# .DESCRIPTION -# Get the list of files that are in the Maintenance Log folder -# -# .PARAMETER $TransportService -# Transport Service object retrieved from Get-TransportService of the current server -# This object holds configuration and size limits of the Maintenance Log folder -# -# .PARAMETER $LogPath -# The path to the log folder adjusted for remote logging. -# -# .RETURN -# Array of file objects of files that are in the Maintenance Log folder -function Get-TransportMaintenanceLogFileList() -{ - param( - [Parameter(Mandatory = $true)] - [Object] $TransportService, - - [Parameter(Mandatory = $true)] - [string] $LogPath - ) - - $logFilesMatch = "{0}\{1}*.log" -f $LogPath, $Script:TransportMaintenanceLogPrefix - return @(Get-Item $logFilesMatch -ErrorAction SilentlyContinue) -} - -# .DESCRIPTION -# Ensures the current Maintenance log file stay within the limit specified in the TransportService object. -# Creates and initializes the log file to be ready for accepting logs. -# -# .PARAMETER $LogPath -# The path to the log folder adjusted for remote logging. -# -# .PARAMETER $TransportService -# Transport Service object retrieved from Get-TransportService of the current server -# This object holds configuration and size limits of the Maintenance Log folder -function Register-TransportMaintenanceLog -{ - param( - [Parameter(Mandatory = $true)] - [Object] $TransportService, - - [Parameter(Mandatory = $true)] - [string] $LogPath - ) - - $maxFileSize = $TransportService.TransportMaintenanceLogMaxFileSize.Value.ToBytes() - - if($Script:LogFileName -and $Script:LogStream) - { - if((Get-Item $Script:LogFileName).Length -lt $maxFileSize) - { - return - } - else - { - $Script:LogFileName = $null - $newestLog = $null - } - } - else - { - $newestLog = Get-TransportMaintenanceLogFileList -TransportService $TransportService -LogPath $LogPath | ` - Sort-Object LastWriteTime -Descending | ` - Select-Object -First 1 - } - - if(-not $newestLog -or $newestLog.Length -ge $maxFileSize) - { - $instance = 0 - while($true) - { - $newLogFileName = $Script:TransportMaintenanceLogNameFormat -f ` - $LogPath, ` - [System.DateTime]::Now.ToString("yyyyMMdd"), $instance - - $existedLogFile = Get-Item -Path $newLogFileName -ErrorAction SilentlyContinue - if(-not $existedLogFile) - { - break; - } - $instance++ - } - } - else - { - $newLogFileName = $newestLog.FullName - } - - $Script:LogFileName = $newLogFileName -} - -# .DESCRIPTION -# Removes old log files from the Maintenance Log directory to stay within the age limit specified -# in the TransportService object -# -# .PARAMETER $LogPath -# The path to the log folder adjusted for remote logging. -# -# .PARAMETER $TransportService -# Transport Service object retrieved from Get-TransportService of the current server -# This object holds configuration and size limits of the Maintenance Log folder -function Remove-TransportMaintenanceLogsOverMaxAge -{ - param( - [Parameter(Mandatory = $true)] - [Object] $TransportService, - - [Parameter(Mandatory = $true)] - [string] $LogPath - ) - - $maxLogAge = [TimeSpan]$TransportService.TransportMaintenanceLogMaxAge - [DateTime]$rolloutTime = (Get-Date) - $maxLogAge - - Get-TransportMaintenanceLogFileList -TransportService $TransportService -LogPath $LogPath | ` - Where-Object {$_.LastWriteTime -lt $rolloutTime} | ` - ForEach-Object {Remove-Item -Path $_.FullName} -} - -# .DESCRIPTION -# Removes old log files from the Maintenance Log directory to stay within total size limit specified -# in the TransportService object -# -# .PARAMETER $LogPath -# The path to the log folder adjusted for remote logging. -# -# .PARAMETER $TransportService -# Transport Service object retrieved from Get-TransportService of the current server -# This object holds configuration and size limits of the Maintenance Log folder -function Remove-TransportMaintenanceLogsOverMaxDirectorySize -{ - param( - [Parameter(Mandatory = $true)] - [Object] $TransportService, - - [Parameter(Mandatory = $true)] - [string] $LogPath - ) - - $maxDirectorySize = $TransportService.TransportMaintenanceLogMaxDirectorySize.Value.ToBytes() - $maxFileSize = $TransportService.TransportMaintenanceLogMaxFileSize.Value.ToBytes() - - $files = Get-TransportMaintenanceLogFileList -TransportService $TransportService -LogPath $LogPath | Sort-Object LastWriteTime - $directorySize = $files | Measure-Object Length -Sum | ForEach-Object { $_.Sum } - - $i = 0 - $desiredSize = $maxDirectorySize - $maxFileSize - while ($directorySize -ge $desiredSize) - { - try - { - if($files[$i].FullName -ne $Script:LogFileName) - { - $directorySize -= $files[$i].Length - Remove-Item -Path $files[$i].FullName - $i++ - } - } - catch - { - continue - } - } -} - -# .DESCRIPTION -# Get the adjusted logging path for remote or local logging. -# -# .PARAMETER $TransportService -# Transport Service object retrieved from Get-TransportService of the current server -# This object holds configuration and size limits of the Maintenance Log folder -# -# .PARAMETER $Server -# Server name of the log folder -# -# .RETURN -# The path to the log folder adjusted for remote or local logging depending on the specified $Server. -function Get-MaintenanceLogPath -{ - param( - [Parameter(Mandatory = $true)] - [Object] $TransportService, - - [Parameter(Mandatory = $false)] - [String] $Server = $env:ComputerName - ) - - if(-not $TransportService.TransportMaintenanceLogPath) - { - $logPath = Join-Path (Split-Path ($TransportService.QueueLogPath) -Parent) "TransportMaintenance" - } - else - { - $logPath = $TransportService.TransportMaintenanceLogPath.PathName - } - - if($server -eq $env:ComputerName) - { - return $logPath - } - - $drive = [IO.Path]::GetPathRoot($logPath) - $share = Get-CimInstance -ClassName Win32_Share -ComputerName $server -Filter "Path = '$drive\'" -ErrorAction SilentlyContinue - if($share) - { - $remotePath = "\\{0}\{1}\{2}" -f ` - $server, ` - $share.Name, ` - $logPath.SubString($drive.Length) - return $remotePath - } - else - { - return $logPath - } -} - -# .DESCRIPTION -# Initializes the Maintenance Log and ensures the log directory conforms with limits -# set in Transport Service. This function must be called by Begin/End MM script before -# performing any MM tasks to ensure log file is created properly. -# -# .PARAMETER Server -# Name of Server to write the maintenance log to -function Initialize-TransportMaintenanceLog() -{ - param( - [Parameter(Mandatory = $false)] - [String] $Server = $env:ComputerName - ) - - #read MM log limits - $transportService = Get-TransportService -Identity $Server - - # only configure the logging if we have the setting from Transport Service - $hasMaintenanceSettings = $transportService.PsObject.Properties.Match('TransportMaintenance*') - if($hasMaintenanceSettings.Count -gt 0) - { - if(-not $transportService.TransportMaintenanceLogEnabled) - { - $Script:LogFileName = $null - return - } - - $logPath = Get-MaintenanceLogPath -Server $Server -TransportService $transportService - - if(Test-Path $logPath) - { - Remove-TransportMaintenanceLogsOverMaxAge -TransportService $transportService -LogPath $logPath - Remove-TransportMaintenanceLogsOverMaxDirectorySize -TransportService $transportService -LogPath $logPath - } - else - { - try - { - New-Item $logPath -Item Directory -ErrorAction Stop | Out-Null - } - catch - { - Write-Verbose $_.Exception.Message - $Script:LogFileName = $null - return - } - } - - $Script:ExchangeVersion = Get-ExchangeVersion $Server - Register-TransportMaintenanceLog -TransportService $transportService -LogPath $logPath - } -} - -# .DESCRIPTION -# Change the running state of a service -# -# .PARAMETER $ServiceName -# Name of the service to change the state of -# -# .PARAMETER $Server -# Server where the service is running on -# -# .PARAMETER $State -# New state of the service, can be Stopped, Running, Paused, or NoChange -# -# .PARAMETER $StartMode -# Change the startMode if necessary before changing its running state -# -# .PARAMETER $WaitTime -# Maximum wait time for the service to change its state -# -# .PARAMETER $LoggingStage -# If provide, a log entry is added to MM log on start and complete of the state change -# -# .PARAMETER $ThrowOnFailure -# Whether to throw on failures -# -# .RETURN -# True if successful, false otherwise. -function Set-ServiceState -{ - param( - [Parameter(Mandatory = $true)] - [string]$ServiceName, - - [Parameter(Mandatory = $false)] - [string]$Server = $env:COMPUTERNAME, - - [Parameter(Mandatory = $false)] - [ValidateSet("NoChange", "Stopped", "Running", "Paused")] - [string]$State = "NoChange", - - [Parameter(Mandatory = $false)] - [ValidateSet("NoChange", "Auto", "Automatic", "Manual", "Disabled")] - [string]$StartMode = "NoChange", - - [Parameter(Mandatory = $false)] - [TimeSpan] $WaitTime = (New-TimeSpan -Minutes 5), - - [Parameter(Mandatory = $false)] - [string] $LoggingStage, - - [Parameter(Mandatory = $false)] - [Switch] $ThrowOnFailure - ) - - $service = Get-CimInstance -ClassName win32_service -filter "name = '$ServiceName'" -ComputerName $Server - - if(-not $service) - { - if($LoggingStage) - { - Write-SkippedEvent -Source $Server -Stage $LoggingStage -Reason @{$ServiceName = 'NotFound'} - } - - if($ThrowOnFailure) - { - throw "Service $ServiceName not found on $Server." - } - return - } - - # Check and change the StartMode if necessary - if($StartMode -eq "Auto") - { - $StartMode = "Automatic" - } - - if(($StartMode -ne "NoChange") -and ($service.StartMode -ne $StartMode)) - { - $service.ChangeStartMode($StartMode) | Out-Null - - if($StartMode -eq "Disabled") - { - $State = "Stopped" - } - } - - # Determine if the start/stop/restart action is needed - if($State -eq "NoChange" -or $service.State -eq $State) - { - return - } - - if($LoggingStage) - { - $logEntry = New-LogEntry -Source $Server -Stage $LoggingStage - Write-EventOfEntry -Event Start -Entry $logEntry - } - - switch($State) - { - "Stopped" - { - $service.StopService() | Out-Null - } - - "Running" - { - if($service.State -eq "Paused") - { - $service.ResumeService() | Out-Null - } - else - { - $service.StartService()| Out-Null - } - } - - "Paused" - { - if($service.State -eq "Running") - { - $service.PauseService() | Out-Null - } - else - { - # service is stopped, start it up first - $service.StartService() | Out-Null - - if($WaitTime -eq [TimeSpan]::Zero) - { - $startupWaitTime = New-TimeSpan -Minutes 5 - } - else - { - $startupWaitTime = $WaitTime - } - - Wait-ServiceState ` - -ServiceName $ServiceName ` - -Server $Server ` - -State "Running" ` - -WaitTime $startupWaitTime ` - -ThrowOnFailure:$ThrowOnFailure - - # pause now - $service.PauseService() | Out-Null - } - } - } - - if($WaitTime -gt [TimeSpan]::Zero) - { - Wait-ServiceState ` - -ServiceName $ServiceName ` - -Server $Server ` - -State $State ` - -WaitTime $WaitTime ` - -ThrowOnFailure:$ThrowOnFailure - } - - if($LoggingStage) - { - Write-EventOfEntry -Event Completed -Entry $logEntry -reason @{'MaxWaitMinutes' = $WaitTime.TotalMinutes} - } -} - -# .DESCRIPTION -# Create a log entry object to be used in logging with various events and reasons -# -# .PARAMETER Source -# Name of the computer that originates this logging -# -# .PARAMETER Stage -# Logging stage -# -# .PARAMETER Id -# Id of this log entry -# -# .PARAMETER Count -# Value for the count column, meaning of this count varies with id and stage -# -# .RETURN -# Log Entry object which can be use Write-EventOfEntry & Write-SkippedEvent -function New-LogEntry -{ - param( - [Parameter(Mandatory = $true)] - [String] $Source, - - [Parameter(Mandatory = $true)] - [string] $Stage, - - [Parameter(Mandatory = $false)] - [string] $Id, - - [Parameter(Mandatory = $false)] - [int] $Count = -1 - ) - - $logProps = @{ - Source = $Source - Stage = $Stage - Id = $Id - Count = $Count - Created = Get-Date - } - - return New-Object PsObject -Property $logProps -} - -# .DESCRIPTION -# Add a log entry of certain event to the current log file -# -# .PARAMETER Event -# Event to be logged. For Completed event, the duration is automatically -# computed from the time LogEntry was created -# -# .PARAMETER Entry -# Log Entry, created by New-LogEntry -# -# .PARAMETER Reason -# Reason of this event -function Write-EventOfEntry -{ - param( - [Parameter(Mandatory = $true)] - [string] $Event, - - [Parameter(Mandatory = $true)] - [Object] $Entry, - - [Parameter(Mandatory = $false)] - [hashtable] $Reason - ) - - if($Event -eq "Completed") - { - $duration = (Get-Date) - $Entry.Created - } - - if($Reason) - { - $Reason.GetEnumerator() | ` - Sort-Object Key | ForEach-Object { - if($ReasonStr) - { - $ReasonStr += '; ' - } - - $ReasonStr += "{0}={1}" -f $_.Name,$_.Value - } - } - - $msg = [string]::Format("{0},{1},{2},{3},{4},{5:g},{6},{7},{8}", ` - (Get-Date), ` - $Entry.Source, ` - $Entry.Stage, ` - $Event, ` - $Entry.Id, ` - $duration, ` - $(if($Entry.Count -ne -1){$Entry.Count} else {""}), ` - $ReasonStr, ` - $Script:ExchangeVersion) - - Write-Verbose $msg - - if(-not $Script:LogFileName) - { - return - } - - $maxTries = 3 - while($maxTries -gt 0) - { - try - { - Add-Content -Path $Script:LogFileName -Value $msg -ErrorAction Stop - return - } - catch [IO.DriveNotFoundException] - { - # we stop logging if log causes exception - $Script:LogFileName = $null - Write-Verbose $_.Exception.Message - return - } - catch - { - # we may have other MM workflow accessing the log file - # delay 1 sec and try again - Start-Sleep -Seconds 1 - $maxTries-- - } - } -} - -# .DESCRIPTION -# Log a Skipped event to the current log file -# -# .PARAMETER Source -# Name of the computer that originates this logging -# -# .PARAMETER Stage -# Logging stage -# -# .PARAMETER Id -# Id of this log entry -# -# .PARAMETER Count -# Value for the count column, meaning of this count varies with id and stage -# -# .PARAMETER Reason -# Reason of this event - -function Write-SkippedEvent -{ - param( - [Parameter(Mandatory = $true)] - [String] $Source, - - [Parameter(Mandatory = $true)] - [string] $Stage, - - [Parameter(Mandatory = $false)] - [string] $Id, - - [Parameter(Mandatory = $false)] - [int] $Count, - - [Parameter(Mandatory = $false)] - [hashtable] $Reason - ) - - $entry = New-LogEntry -Source $Source -Stage $Stage -Id $Id -Count $Count - Write-EventOfEntry -Event Skipped -Entry $entry -Reason $Reason -} - -# .DESCRIPTION -# Log an Info event to the current log file -# -# .PARAMETER Source -# Name of the computer that originates this logging -# -# .PARAMETER Stage -# Logging stage -# -# .PARAMETER Id -# Id of this log entry -# -# .PARAMETER Count -# Value for the count column, meaning of this count varies with id and stage -# -# .PARAMETER Reason -# Reason of this event - -function Log-InfoEvent -{ - param( - [Parameter(Mandatory = $true)] - [String] $Source, - - [Parameter(Mandatory = $true)] - [string] $Stage, - - [Parameter(Mandatory = $false)] - [string] $Id, - - [Parameter(Mandatory = $false)] - [int] $Count, - - [Parameter(Mandatory = $false)] - [hashtable] $Reason - ) - - $entry = New-LogEntry -Source $Source -Stage $Stage -Id $Id -Count $Count - Write-EventOfEntry -Event Info -Entry $entry -Reason $Reason -} - -# .DESCRIPTION -# Used by Wait-EmptyEntriesCompletion. -# Takes a hash table by the entry's id. Remove any entry that's not found in ActiveEntries. -# -# .PARAMETER ActiveEntries -# Array of active entries -# -# .PARAMETER DetailLogging -# Whether to log progress of each entry. -# -# .PARAMETER Tracker -# Tracking hash table to be updated -# -# .RETURN -# returns True if at least an entry removed. Otherwise returns False. -function Remove-CompletedEntriesFromHashtable -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseDeclaredVarsMoreThanAssignments", "")] - param ( - [Parameter(Mandatory = $true)] - [HashTable] $Tracker, - - [Parameter(Mandatory = $false)] - [Object[]] $ActiveEntries = @(), - - [Parameter(Mandatory = $false)] - [Switch] $DetailLogging = $true - ) - - $progressMade = $false - - $activeIds = $ActiveEntries | ForEach-Object {$_.Id} - $completedKeys = $tracker.Keys | Where-Object {$activeIds -notcontains $_} - $completedKeys | ForEach-Object { - # update entry - $entry = $Tracker[$_] - $entry.LogEntry.Count = 0 - - if($DetailLogging) - { - Write-EventOfEntry -Event Completed -Entry $entry.LogEntry - } - - # remove completed entry from tracking - $Tracker.Remove($_) - $progressMade = $true - } - - return $progressMade -} - -# .DESCRIPTION -# Used by Wait-EmptyEntriesCompletion. -# Takes a hash table by the entry's id. Adds/Updates any entry that's found in ActiveEntries. -# -# .PARAMETER Tracker -# Tracking hash table to be updated -# -# .PARAMETER Source -# Name of server, for logging purpose, which GetEntries Scriptblock is retrieving data from -# -# .PARAMETER Stage -# Name of the Stage of the overall BeginMM process, for logging purpose -# -# .PARAMETER DetailLogging -# Whether to log progress of each entry. -# -# .PARAMETER ActiveEntries -# Array of active entries -# -# .RETURN -# Returns True if at least an entry is updated or created. Otherwise returns False. -function Update-EntriesTracker -{ - param ( - [Parameter(Mandatory = $true)] - [HashTable] $Tracker, - - [Parameter(Mandatory = $true)] - [string] $Source, - - [Parameter(Mandatory = $true)] - [string] $Stage, - - [Parameter(Mandatory = $false)] - [Switch] $DetailLogging = $true, - - [Parameter(Mandatory = $false)] - [Object[]] $ActiveEntries = @() - ) - - $progressMade = $false - - # Update the tracker hash table; Create new entries as needed - $ActiveEntries | ForEach-Object { - if(-not $tracker.ContainsKey($_.Id)) - { - $logEntry = New-LogEntry -Source $Source -Stage $Stage -Id $_.Id -Count $_.Count - - $trackEnty = New-Object PsObject -Property @{ - LogEntry = $logEntry - LastUpdated = Get-Date - } - - $tracker.Add($_.Id, $trackEnty) - - if($DetailLogging) - { - Write-EventOfEntry -Event Start -Entry $logEntry - } - - $progressMade = $true - } - else - { - $trackingEntry = $tracker[$_.Id] - $drainRateProp = $_.PsObject.Properties.Match('DrainRate') - if((($drainRateProp.count -gt 0) -and ($_.DrainRate -gt 0)) -or ` - (($drainRateProp.count -eq 0) -and ($trackingEntry.LogEntry.Count -ne $_.Count))) - { - $trackingEntry.LogEntry.Count = $_.Count - $trackingEntry.LastUpdated = Get-Date - $progressMade = $true - } - } - } - - return $progressMade -} - -# .DESCRIPTION -# Implements a generic wait function for entries returned by a scriptblock to go -# to zero or abort when time allow exceed or no progress was made. -# Each entry is tracked individually. -# -# .PARAMETER GetEntries -# ScriptBlock to be called every PollingFrequency interval with GetScriptArgs arguments -# to retrieve an array of entries with count -# -# .PARAMETER Stage -# Name of the Stage of the overall BeginMM process, for logging purpose -# -# .PARAMETER DetailLogging -# Whether to log progress of each entry. -# -# .PARAMETER GetEntriesAgrs -# Parameters for the GetEntries script block -# -# .PARAMETER Source -# Name of server, for logging purpose, which GetEntries Scriptblock is retrieving data from -# -# .PARAMETER PollingFrequency -# Frequency of polling queues for status -# -# .PARAMETER Timeout -# Timeout not to exceed -# -# .PARAMETER NoProgressTimeout -# Timeout for when no progress is made -# -# .PARAMETER ThrowOnTimeout -# Whether to throw error on timeout -# -# .RETURN -# Returns the remaining count of messages in the queues. When the wait ends with overall timeout -# or no progress timeout, this function returns a non-zero value. -function Wait-EmptyEntriesCompletion -{ - Param ( - [Parameter(Mandatory = $true)] - [ScriptBlock] $GetEntries, - - [Parameter(Mandatory = $true)] - [string] $Stage, - - [Parameter(Mandatory = $false)] - [Switch] $DetailLogging = $true, - - [Parameter(Mandatory = $false)] - [object[]] $GetEntriesArgs = @(), - - [Parameter(Mandatory = $false)] - [string] $Source = $env:COMPUTERNAME, - - [Parameter(Mandatory = $false)] - [TimeSpan] $PollingFrequency = (New-TimeSpan -Seconds 10), - - [Parameter(Mandatory = $false)] - [TimeSpan] $Timeout = (New-TimeSpan -Minutes 5), - - [Parameter(Mandatory = $false)] - [TimeSpan] $NoProgressTimeout = (New-TimeSpan -Minutes 1), - - [Parameter(Mandatory = $false)] - [Switch] $ThrowOnTimeout - ) - - $tracker = @{} - $endTime = (Get-Date) + $Timeout - $summaryLog = $null - $firstTime = $true - - while($true) - { - $activeEntries = Invoke-Command -ScriptBlock $GetEntries -ArgumentList $GetEntriesArgs | Where-Object {$_.Count -gt 0} - - if($firstTime) - { - if($DetailLogging -and -not $ActiveEntries) - { - Write-SkippedEvent -Source $Source -Stage $Stage -Reason @{Reason = 'Not needed'} - } - else - { - $startCount = 0 - $startCount += $activeEntries | Measure-Object -Sum -Property Count | ForEach-Object {$_.Sum} - - $summaryLog = New-LogEntry -Source $Source -Stage $Stage -Count $startCount - Write-EventOfEntry -Event Start -Entry $summaryLog - } - - $firstTime = $false - } - - $foundCompleted = Remove-CompletedEntriesFromHashtable ` - -Tracker $tracker ` - -ActiveEntries $activeEntries ` - -DetailLogging:$DetailLogging - - if(-not $activeEntries) - { - break; - } - - $foundUpdate = Update-EntriesTracker ` - -Tracker $tracker ` - -ActiveEntries $activeEntries ` - -Source $Source ` - -Stage $Stage ` - -DetailLogging:$DetailLogging - - if((Get-Date) -gt $endTime) - { - Write-Verbose "$Source - $Stage Time-out occurred. Wait aborted!" - $Reason = $Script:AllotedTimeExceeded - break; - } - elseif($foundCompleted -or $foundUpdate) - { - $remaningCount = $activeEntries | Measure-Object -Sum -Property Count | ForEach-Object {$_.Sum} - Write-Verbose "$Source - $Stage Progress made. $remaningCount items remain." - } - else - { - # checking if it's been too long since progress was made - $recentEntries = $tracker.Values | Where-Object {((Get-Date) - $_.LastUpdated) -lt $NoProgressTimeout} - if(-not $recentEntries) - { - Write-Verbose "$Source - $Stage NoProgressTimeout occurred. Wait aborted!" - $Reason = $Script:NoProgressTimeout - break; - } - } - - Start-Sleep -Seconds $PollingFrequency.Seconds - } - - $remainingCount = 0 - $remainingCount += $activeEntries | Measure-Object -Sum -Property Count | ForEach-Object {$_.Sum} - - if($DetailLogging) - { - $tracker.Values | ForEach-Object { Write-EventOfEntry -Event Completed -Entry $_.LogEntry -Reason @{Reason = $reason} } - } - else - { - $summaryLog.Count = $remainingCount - - if($reason) - { - Write-EventOfEntry -Event Completed -Entry $summaryLog -Reason @{Reason = $reason} - } - else - { - Write-EventOfEntry -Event Completed -Entry $summaryLog - } - } - - if($ThrowOnTimeout) - { - throw New-Object System.TimeoutException "Time-out reached." - } - - return $remainingCount -} - -# .SYNOPSIS -# Waits for the draining of Remote SMTP Relay queues, MapiDelivery queues and Submission queue. -# -# .DESCRIPTION -# Monitors and waits for all messages to be drained before returning. Will throw -# TimeoutException if time-out is reached or if no progress is made in NoProgressTimeout. -# -# .PARAMETER Server -# Target server for the operation. -# -# .PARAMETER QueueTypes -# Array of DeliveryTypes defined in: -# http://technet.microsoft.com/en-us/library/bb125022(v=exchg.150).aspx#NextHopSolutionKey. -# If null specified, all queue types are included in the wait. This function implicitly -# includes Submission queue and excludes Poison queue. -# -# .PARAMETER ActiveMsgOnly -# Whether to wait for active messages or all messages. -# -# .PARAMETER Stage -# Whether the wait is for the natural draining or the redirection -# -# .PARAMETER PollingFrequency -# Frequency of polling queues for status -# -# .PARAMETER Timeout -# Timeout not to exceed -# -# .PARAMETER NoProgressTimeout -# Timeout for when no progress is made -# -# .PARAMETER ThrowOnTimeout -# Whether to throw error on timeout -# -# .RETURN -# Returns the remaining count of messages in the queues. When the wait ends with overall timeout or no progress timeout, -# this function returns a non-zero value. -function Wait-EmptyQueuesCompletion -{ - Param ( - [Parameter(Mandatory = $true)] - [string]$Server = $null, - - [Parameter(Mandatory = $false)] - [String[]] $QueueTypes = $null, - - [Parameter(Mandatory = $false)] - [bool] $ActiveMsgOnly = $false, - - [Parameter(Mandatory = $false)] - [string]$Stage = "QueueDrain", - - [Parameter(Mandatory = $false)] - [TimeSpan] $PollingFrequency = (New-TimeSpan -Seconds 10), - - [Parameter(Mandatory = $false)] - [TimeSpan] $Timeout = (New-TimeSpan -Minutes 5), - - [Parameter(Mandatory = $false)] - [TimeSpan] $NoProgressTimeout = (New-TimeSpan -Minutes 1), - - [Parameter(Mandatory = $false)] - [Switch] $ThrowOnTimeout - ) - - $getQueueEntries = ` - { - param( - [Parameter(Mandatory = $true)] - [string]$Server = $null, - - [Parameter(Mandatory = $true)] - [string[]]$QueueTypes, - - [Parameter(Mandatory = $true)] - [bool]$ActiveMsgOnly - ) - - $filter = "{MessageCount -gt 0 -and DeliveryType -ne 'ShadowRedundancy' -and NextHopDomain -ne 'Poison Message'}" - $queues = get-queue -server $Server -ErrorAction SilentlyContinue -filter $filter | ` - Where-Object{ $null -eq $QueueTypes -or $QueueTypes -contains $_.DeliveryType } - - $entries = $queues | ForEach-Object { - if($ActiveMsgOnly) - { - $count = $_.MessageCountsPerPriority | Measure-Object -Sum | ForEach-Object {$_.Sum} - } - else - { - $count = $_.MessageCount - } - - $queueInfo = ` - @{ - Id = $_.Identity - Count = $count - DrainRate = $_.OutgoingRate - } - New-Object PsObject -Property $queueInfo - } - - return $entries - } - - Write-Verbose "$Server - Start waiting for $Stage..." - - $remaining = Wait-EmptyEntriesCompletion ` - -GetEntries $getQueueEntries ` - -GetEntriesArgs $Server,$queueTypes,$ActiveMsgOnly ` - -Source $Server ` - -Stage $Stage ` - -DetailLogging:$false ` - -PollingFrequency $PollingFrequency ` - -TimeOut $TimeOut ` - -NoProgressTimeout $NoProgressTimeout ` - -ThrowOnTimeout:$ThrowOnTimeout - - Write-Verbose "$Server - Wait for $Stage ended with $remaining items remain." - - return $remaining -} - -# .DESCRIPTION -# returns the pending discard events from a specified server -# -# .PARAMETER Server -# Target server for the operation. -# -# .PARAMETER Detail -# If detail is specified, Discard Ids are included in the discard information returned. -# -# .RETURN -# Returns array of discard events count of each shadow server. When -Detail present, -# DiscardIDs of each shadow server are also returned. -function Get-DiscardInfo -{ - param( - [Parameter(Mandatory = $true)] - [string]$Server, - [Parameter(Mandatory = $false)] - [switch]$Detail - ) - - if($Detail) - { - $argument = 'verbose' - } - else - { - $argument = 'basic' - } - - $shadowInfo = [xml](Get-ExchangeDiagnosticInfo -Server $Server -Process edgetransport -Component ShadowRedundancy -argument $argument) - - $discardInfo = $shadowInfo.Diagnostics.Components.ShadowRedundancy.ShadowServerCollection.ShadowServer | ` - Where-Object {$_.ShadowServerInfo.discardEventsCount -gt 0 } | - ForEach-Object { - $infoProps = ` - @{ - Id = [System.Text.Encoding]::ASCII.GetString([System.Convert]::FromBase64String($_.Context)) - Count = $_.ShadowServerInfo.discardEventsCount - DiscardIds = @() - } - if($Detail) - { - $infoProps.DiscardIds = $_.ShadowServerInfo.discardEventMessageId - } - - new-object psobject -Property $infoProps - } - - return $discardInfo -} - -# .SYNOPSIS -# Waits for discard events to be consumed by shadow servers -# -# .DESCRIPTION -# Monitors and waits for all discard events to be consumed by shadow servers before returned. -# Will throw TimeoutException if timeout is reached or if no progress is made in NoProgressTimeout. -# -# .PARAMETER Server -# Target server for the operation. -# -# .PARAMETER ActiveServers -# Array of active servers whose discard events are waiting to be drained -# -# .PARAMETER PollingFrequency -# Frequency of polling queues for status -# -# .PARAMETER Timeout -# Timeout not to exceed -# -# .PARAMETER NoProgressTimeout -# Timeout for when no progress is made -# -# .PARAMETER ThrowOnTimeout -# Whether to throw error on timeout -# -# .RETURN -# Returns the remaining count of discard events. When the wait ends with timeout exceeded or no progress -# this functions returns a non-zero value. -function Wait-EmptyDiscardsCompletion -{ - Param ( - [Parameter(Mandatory = $true)] - [string]$Server = $null, - - [Parameter(Mandatory = $true)] - [string[]]$ActiveServers = $null, - - [Parameter(Mandatory = $false)] - [TimeSpan] $PollingFrequency = (New-TimeSpan -Seconds 10), - - [Parameter(Mandatory = $false)] - [TimeSpan] $Timeout = (New-TimeSpan -Minutes 5), - - [Parameter(Mandatory = $false)] - [TimeSpan] $NoProgressTimeout = (New-TimeSpan -Minutes 1), - - [Parameter(Mandatory = $false)] - [Switch] $ThrowOnTimeout - ) - - Write-Verbose "$Server - Start waiting for ShadowDiscardDrain..." - - # log the undrainable entries - $discardInfo = Get-DiscardInfo -server $Server - $discardInfo | Where-Object {$ActiveServers -notcontains $_.Id.Split('.')[0]} | ForEach-Object { - Write-SkippedEvent -Source $Server -Stage ShadowDiscardDrain -Id $_.Id ` - -Count $_.Count -Reason @{Reason = $Script:ServerInMM} - } - - # wait for discard events to be drained - $getDiscardInfo = ` - { - param ( - [Parameter(Mandatory = $true)] - [string]$Server = $null, - - [Parameter(Mandatory = $true)] - [string[]]$ActiveServers = $null - ) - - $discardInfo = Get-DiscardInfo -server $Server - $discardInfo | Where-Object {$ActiveServers -contains $_.Id.Split('.')[0]} - } - - $remaining = Wait-EmptyEntriesCompletion ` - -GetEntries $getDiscardInfo ` - -GetEntriesArgs $Server,$ActiveServers ` - -Source $Server ` - -Stage ShadowDiscardDrain ` - -PollingFrequency $PollingFrequency ` - -TimeOut $TimeOut ` - -NoProgressTimeout $NoProgressTimeout ` - -ThrowOnTimeout:$ThrowOnTimeout - - Write-Verbose "$Server - ShadowDiscardDrain ended with $remaining items remain." - - return $remaining -} - -# .DESCRIPTION -# Waits for the event log StartScanForMessages (id = 17008) to be logged to Windows Event Log -# This tells that the bootscanner had completed counting for the outstanding items and -# start boot-scanning messages -# -# .PARAMETER ServerFqdn -# Fqdn of the server -# -# .PARAMETER PollingFrequency -# Frequency of polling for event -# -# .PARAMETER Timeout -# Timeout not to exceed -# -# .PARAMETER NoProgressTimeout -# Timeout for when no progress is made -# -# .PARAMETER ThrowOnTimeout -# Whether to throw error on timeout -# -# .RETURN -# none -function Wait-BootLoaderCountCheck -{ - Param ( - [Parameter(Mandatory = $true)] - [string]$ServerFqdn, - - [Parameter(Mandatory = $false)] - [TimeSpan] $PollingFrequency = (New-TimeSpan -Seconds 10), - - [Parameter(Mandatory = $false)] - [TimeSpan] $Timeout = (New-TimeSpan -Minutes 5), - - [Parameter(Mandatory = $false)] - [TimeSpan] $NoProgressTimeout = (New-TimeSpan -Minutes 1), - - [Parameter(Mandatory = $false)] - [Switch] $ThrowOnTimeout - ) - - $waitBootScanningEvent = - { - param( - [Parameter(Mandatory = $true)] - [string]$fqdn = $null, - - [Parameter(Mandatory = $true)] - [DateTime]$StartTime = $null - ) - - $bootScanningEvent = @{ - LogName = 'Application' - ProviderName = 'MsExchangeTransport' - Id = 17008 - StartTime = $StartTime - } - - $event = Get-WinEvent -ComputerName $ServerFqdn -FilterHashtable $bootScanningEvent -ErrorAction SilentlyContinue - - if($event) - { - # return null to complete the wait - return $null - } - else - { - $bootScanningEvent = ` - @{ - Id = "TransportQueueDatabase" - Count = 1 - } - New-Object PsObject -Property $bootScanningEvent - } - } - - $server = $ServerFqdn.split('.')[0] - $xml = [xml](Get-ExchangeDiagnosticInfo -Process "EdgeTransport" -server $server -erroraction SilentlyContinue) - if($xml) - { - $processStartTime = [DateTime]($xml.Diagnostics.ProcessInfo.StartTime) - Wait-EmptyEntriesCompletion ` - -GetEntries $waitBootScanningEvent ` - -GetEntriesArgs $ServerFqdn,$processStartTime ` - -Source $server ` - -Stage BootLoaderCountCheck ` - -PollingFrequency $PollingFrequency ` - -TimeOut $Timeout ` - -NoProgressTimeout $NoProgressTimeout ` - -ThrowOnTimeout:$ThrowOnTimeout - } -} - -# .DESCRIPTION -# Waits for the 'BootLoader Outstanding Items' perfcounter to go down to 0 -# -# .PARAMETER ServerFqdn -# Fqdn of the server -# -# .PARAMETER PollingFrequency -# Frequency of polling for event -# -# .PARAMETER Timeout -# Timeout not to exceed -# -# .PARAMETER NoProgressTimeout -# Timeout for when no progress is made -# -# .PARAMETER ThrowOnTimeout -# Whether to throw error on timeout -# -# .RETURN -# none -function Wait-BootLoaderSubmitCheck -{ - Param ( - [Parameter(Mandatory = $true)] - [string] $ServerFqdn, - - [Parameter(Mandatory = $false)] - [TimeSpan] $PollingFrequency = (New-TimeSpan -Seconds 10), - - [Parameter(Mandatory = $false)] - [TimeSpan] $Timeout = (New-TimeSpan -Minutes 5), - - [Parameter(Mandatory = $false)] - [TimeSpan] $NoProgressTimeout = (New-TimeSpan -Minutes 1), - - [Parameter(Mandatory = $false)] - [Switch] $ThrowOnTimeout - ) - - $getOutstandingItems = - { - param( - [Parameter(Mandatory = $true)] - [string]$fqdn = $null - ) - - $counter = Get-Counter ` - -Counter "\MSExchangeTransport Database(other*)\BootLoader Outstanding Items" ` - -ComputerName $fqdn ` - -ErrorAction SilentlyContinue - try - { - $counterInfo = ` - @{ - Id = "BootLoaderOutstandingItems" - Count = $counter.CounterSamples[0].RawValue - } - } - catch - { - $counterInfo = ` - @{ - Id = "BootLoaderOutstandingItems" - Count = 1 - } - } - - return New-Object PsObject -Property $counterInfo - } - - $server = $ServerFqdn.split('.')[0] - $remaining = Wait-EmptyEntriesCompletion ` - -GetEntries $getOutstandingItems ` - -GetEntriesArgs $ServerFqdn ` - -Source $server ` - -Stage BootLoaderSubmitCheck ` - -PollingFrequency $PollingFrequency ` - -TimeOut $Timeout ` - -NoProgressTimeout $NoProgressTimeout ` - -ThrowOnTimeout:$ThrowOnTimeout - - return $remaining -} - -# .DESCRIPTION -# If the process has been running for more than 30 mins, then this function returns immediately. -# Otherwise, wait for the bootscanner to complete up to 30 minutes or the specified timeout, whichever -# less. -# -# .PARAMETER Server -# Target server for the operation. -# -# .PARAMETER MaxBootLoaderProcessTimeout -# Max time for the BootLoader to completely bootscanning all the unprocessed messages. -# -# .PARAMETER PollingFrequency -# Frequency of polling queues for status -# -# .PARAMETER Timeout -# Timeout not to exceed -# -# .PARAMETER NoProgressTimeout -# Timeout for when no progress is made -# -# .PARAMETER ThrowOnTimeout -# Whether to throw error on timeout -# -# .RETURN -# Returns the remaining count of the outstanding items in the BootLoader. When the wait ends with -# timeout exceeded or no progress, this function returns a non-zero value. -function Wait-BootLoaderReady -{ - Param ( - [Parameter(Mandatory = $true)] - [string]$Server = $null, - - [Parameter(Mandatory = $false)] - [TimeSpan]$MaxBootLoaderProcessTimeout = (New-TimeSpan -Minutes 30), - - [Parameter(Mandatory = $false)] - [TimeSpan] $PollingFrequency = (New-TimeSpan -Seconds 10), - - [Parameter(Mandatory = $false)] - [TimeSpan] $Timeout = (New-TimeSpan -Minutes 5), - - [Parameter(Mandatory = $false)] - [TimeSpan] $NoProgressTimeout = (New-TimeSpan -Minutes 1), - - [Parameter(Mandatory = $false)] - [Switch] $ThrowOnTimeout - ) - - Write-Verbose "$Server - Waiting for BootLoader to be ready..." - - $exchangeServer = Get-ExchangeServer $Server - if(-not $exchangeServer) - { - Write-Warning "Could not get the exchange server. Skip waiting for BootLoader." - return 0 - } - - $retry = 5 - while ($true) - { - try - { - $xml = [xml](Get-ExchangeDiagnosticInfo -Process "EdgeTransport" -server $Server -erroraction SilentlyContinue) - $processLifeTime = [TimeSpan]($xml.Diagnostics.ProcessInfo.LifeTime) - $processStartTime = [DateTime]($xml.Diagnostics.ProcessInfo.StartTime) - break - } - catch - { - if($retry -gt 0) - { - Write-Verbose "$Server - Can not read the process lifetime. Sleep 20 to retry..." - Start-Sleep 20 - $retry-- - } - else - { - break - } - } - } - - - if(-not $processLifeTime -or -not $processStartTime) - { - # EdgeTransport isn't running or Server isn't a HubTransport, nothing to wait here - Write-SkippedEvent -Source $Server -Stage BootLoaderCountCheck -Reason @{Reason = 'EdgeTransportUnreachable'} - Write-SkippedEvent -Source $Server -Stage BootLoaderSubmitCheck -Reason @{Reason = 'EdgeTransportUnreachable'} - - Write-Warning "$Server - EdgeTransport is not running or server $server is unreachable. Skipping waiting for BootLoader." - return 0 - } - - if($processLifeTime -gt $MaxBootLoaderProcessTimeout) - { - Write-SkippedEvent -Source $Server -Stage BootLoaderCountCheck -Reason @{ProcessLifeTime = $processLifeTime} - Write-SkippedEvent -Source $Server -Stage BootLoaderSubmitCheck -Reason @{ProcessLifeTime = $processLifeTime} - - Write-Verbose "$Server - EdgeTransport has been running for $processLifeTime. BootLoader is ready" - return 0 - } - elseif ($MaxBootLoaderProcessTimeout - $processLifeTime -gt $Timeout) - { - $waitTime = $Timeout - } - else - { - $waitTime = $MaxBootLoaderProcessTimeout - $processLifeTime - } - - $msg = "$Server EdgeTransport has been running for $processLifeTime! Let's give BootLoader $waitTime to complete." - Write-Verbose $msg - - $stopWatch = [System.Diagnostics.Stopwatch]::StartNew() - - Wait-BootLoaderCountCheck ` - -ServerFqdn ($exchangeServer.fqdn) ` - -PollingFrequency $PollingFrequency ` - -TimeOut $waitTime ` - -NoProgressTimeout $waitTime ` - -ThrowOnTimeout:$ThrowOnTimeout - - $stopWatch.Stop() - $elapsed = $stopWatch.Elapsed - $waitTime = $waitTime - $elapsed - - Wait-BootLoaderSubmitCheck ` - -ServerFqdn ($exchangeServer.fqdn) ` - -PollingFrequency $PollingFrequency ` - -TimeOut $waitTime ` - -NoProgressTimeout $NoProgressTimeout ` - -ThrowOnTimeout:$ThrowOnTimeout - - Write-Verbose "$Server - BootLoader ended with $remaining items remain" - return $remaining -} - -# .DESCRIPTION -# Put the MsExchangeTransport/EdgeTransport on the specified server to Draining -# mode WITHOUT changing the server component state. This is done by pausing the service. -# -# .PARAMETER Server -# Server to drain the active messages from -# -# .PARAMETER TransportService -# Optional MsExchangeTransport service object. -function Clear-ActiveMessage -{ - param( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $Server = $env:COMPUTERNAME, - - [Parameter(Mandatory = $false)] - [object] $TransportService - ) - - Wait-BootLoaderReady -Server $Server - - if(-not $TransportService) - { - $exServer = Get-ExchangeServer $Server - Write-Verbose "$Server - Pausing the MsExchangeTransport service to stop accepting new traffic" - $TransportService = get-service -ComputerName $exServer.Fqdn -Name MSExchangeTransport -errorAction silentlyContinue - } - - if($TransportService) - { - $TransportService.Pause() | Out-Null - } - - $queueTypes = @("SmtpDeliveryToMailbox", "SmtpRelayToRemoteAdSite", "SmtpRelayToDag", "SmtpRelayToServers", "Undefined") - Wait-EmptyQueuesCompletion -Server $server -QueueTypes $queueTypes -ActiveMsgOnly $true -Stage QueueDrain -Timeout 00:01:30 -} - -# .DESCRIPTION -# Redirecting messages from the specified server to all other servers in its dag -# -# .PARAMETER server -# Server whose messages are being redirecting -# -# .PARAMETER ExcludeLocalSite -# Whether to redirect messages to servers at the same site -# -# .PARAMETER LogIfRemain -# Whether to write to window event log if there remaining message that can not be redirected -# -# .RETURN -# Returns active servers in the dag -# -function Send-MessagesToNewServer -{ - param( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $Server, - - [Parameter(Mandatory = $false)] - [switch] $ExcludeLocalSite, - - [Parameter(Mandatory = $false)] - [switch] $LogIfRemain = $true, - - [string[]]$MessageRedirectExclusions - ) - - # get domain name of the server - $fqdn = Get-ExchangeServer $Server | ForEach-Object {$_.Fqdn} - $domainIndex = $fqdn.Indexof(".") - $domain = $fqdn.SubString($domainIndex) - - $serversInDag = Get-ServersInDag -server $Server -ExcludeLocalSite:$ExcludeLocalSite -AdditionalExclusions $MessageRedirectExclusions - if (-not $serversInDag -or $serversInDag.count -eq 0) - { - Write-Warning "$Server - Could not find servers in the DAG to redirect messages to that do not meeting exclusion criteria. Skipping redirect." - return $null - } - - $serversInDag = Get-ActiveServer $serversInDag - $hubFqdns = $serversInDag | Where-Object { $_ -ne $Server } | ForEach-Object { $_ + $domain } - - $verboseMessage = "$Server - Redirecting messages to " + [string]::Join(", ", $hubFqdns) - Write-Verbose $verboseMessage - - Redirect-Message -Target $hubFqdns -Server $Server -Confirm:$false -ErrorAction SilentlyContinue - - $timeOut = (New-TimeSpan -Minutes 8) - $remaining = Wait-EmptyQueuesCompletion -Server $Server -Stage Redirect -Timeout $timeOut - - if($remaining -and $LogIfRemain) - { - $message = "Transport service is going to Maintenance with $messageCount messages in its queues." - Log-WindowsEvent -EventId $Script:UnredirectedMessageEventId -Message $message - } - - return $serversInDag -} - -# .DESCRIPTION -# Forcing heartbeats from other shadow servers in the dag to the primary -# Wait for all discard events to be drained by its shadow servers -# -# .PARAMETER primary -# Primary server -# -# .PARAMETER shadowServers -# Array of shadow servers -# -# .PARAMETER LogIfRemain -# Whether to log a windows event log if there is remains discard event that can't be drained. -# -# .RETURN -# none -# -function Clear-DiscardEvent -{ - param( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $Primary, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String[]] $ShadowServers, - - [Parameter(Mandatory = $false)] - [switch] $LogIfRemain = $true - ) - - $filter = "{DeliveryType -eq 'ShadowRedundancy' -and NextHopDomain -like '$Primary*'}" - $ShadowServers | ForEach-Object { - Write-Verbose "$Primary - Forcing heart-beat on server $_" - Retry-Queue -server $_ -Filter $filter -ErrorAction SilentlyContinue - } - - Write-Verbose "$Primary - Waiting for the heartbeats to complete processing" - $remaining = Wait-EmptyDiscardsCompletion -Server $Primary -ActiveServers $ShadowServers -NoProgressTimeout (New-TimeSpan -Minutes 2) - - if($remaining -and $LogIfRemain) - { - $message = "Transport service is going to Maintenance with $remaining unacknowledged discard events." - Log-WindowsEvent -EventId $Script:UndrainedDiscardEventEventId -Message $message - } -} - -function Unblock-SubmissionQueue -{ - Write-Verbose "Getting handles for Transport worker process and service" - $TransportWorkerProcess=(get-process EdgeTransport) - $TransportServiceProcess=(get-process MSExchangeTransport) - $TransportService=(get-service MSExchangeTransport) - - ## Create the dump - Write-Output "Sending trouble signal (204) to Transport Service" - try { $TransportService.ExecuteCommand(204) } ## This could fail and its ok. - catch { Write-Verbose ("Sending trouble signal (204) to Transport Service issued an error:"+$Error[0].ToString()) } - - Write-Verbose "Waiting 90s for the worker process to exit(Watson dump being created)" - if ($TransportWorkerProcess.WaitForExit(90000)) - { - Write-Output "Worker process exited" - } - else - { - Write-Warning "Worker process hasn't exited." - } - - ##Stop transport, one way or another - Write-Output "Stopping Transport." - try { $TransportService.Stop() } ## This could timeout and it's ok. - catch { Write-Verbose ("Stopping Transport issued an error:"+$Error[0].ToString()) } - - Write-Verbose "Waiting for Transport to stop completely" - while (-not $TransportServiceProcess.WaitForExit(30000)) - { - if(-not $TransportWorkerProcess.HasExited) - { - Write-Warning "Transport worker process didn't stop yet. Killing the process" - $TransportWorkerProcess.Kill() - } - else - { - Write-Warning "Transport service didnt stop yet. Killing the process" - $TransportServiceProcess.Kill() - } - } - $TransportService.WaitForStatus("Stopped") ## If it never stops the workflow will timeout and we should wake some people up. - Write-Output "Transport is stopped." - - ## Starting transport will cause the dependencies to start. - Write-Output "Starting Transport" - try { $TransportService.Start() } ## This could timeout and its ok. - catch { Write-Verbose ("Starting Transport issued an error:"+$Error[0].ToString()) } - - $TransportService.WaitForStatus("Running") ## If it never starts the workflow will timeout and we should wake some people up. - - Write-Output "Transport restarted." -} - -# .DESCRIPTION -# Sets specified component to state requested. -# -# .PARAMETER $State -# Requested state for the component. -# -# .PARAMETER $Component -# Component to set. -# -# .PARAMETER $Requester -# Requester who set the state. -# -# .PARAMETER Server -# The server to change the component state -# -function Set-ComponentState -{ - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet("Active", "Inactive")] - [string]$State, - - [Parameter(Mandatory = $false)] - [string]$Component = "HubTransport", - - [Parameter(Mandatory = $false)] - [string]$Requester = "Maintenance", - - [Parameter(Mandatory = $false)] - [string]$Server = $env:COMPUTERNAME - ) - - Write-Verbose "Setting $Component state to $State" - Set-ServerComponentState ` - -Identity $Server ` - -Component $Component ` - -Requester $Requester ` - -State $State ` - -ErrorAction SilentlyContinue -} - -# .DESCRIPTION -# Gets state of the specified component of an exchange server -# -# .PARAMETER $Server -# Server to retrieve component state of -# -# .PARAMETER $Component -# Component to get. -# -function Get-ComponentState -{ - param - ( - [Parameter(Mandatory = $false)] - [string]$Server = $env:COMPUTERNAME, - - [Parameter(Mandatory = $false)] - [string]$Component = "HubTransport" - ) - - Write-Verbose "Getting $Component state of $Server" - $serverComponentState = Get-ServerComponentState ` - -Identity $Server ` - -Component $Component ` - -ErrorAction SilentlyContinue - Write-Verbose "ServerComponentState of $Component is '$($serverComponentState.State)'" - - return $serverComponentState -} - -# .DESCRIPTION -# Change the running state of a service -# -# .PARAMETER $ServiceName -# Name of the service to change the state of -# -# .PARAMETER $Server -# Server where the service is running on -# -# .PARAMETER $State -# New state of the service, can be Stopped, Running, Paused, or NoChange -# -# .PARAMETER $StartMode -# Change the startMode if necessary before changing its running state -# -# .PARAMETER $WaitTime -# Maximum wait time for the service to change its state -# -# .PARAMETER $LoggingStage -# If provide, a log entry is added to MM log on start and complete of the state change -# -# .PARAMETER $ThrowOnFailure -# Whether to throw on failures -# -# .RETURN -# True if successful, false otherwise. -function Set-ServiceState -{ - param( - [Parameter(Mandatory = $true)] - [string]$ServiceName, - - [Parameter(Mandatory = $false)] - [string]$Server = $env:COMPUTERNAME, - - [Parameter(Mandatory = $false)] - [ValidateSet("NoChange", "Stopped", "Running", "Paused")] - [string]$State = "NoChange", - - [Parameter(Mandatory = $false)] - [ValidateSet("NoChange", "Auto", "Automatic", "Manual", "Disabled")] - [string]$StartMode = "NoChange", - - [Parameter(Mandatory = $false)] - [TimeSpan] $WaitTime = (New-TimeSpan -Minutes 5), - - [Parameter(Mandatory = $false)] - [string] $LoggingStage, - - [Parameter(Mandatory = $false)] - [Switch] $ThrowOnFailure - ) - - $service = Get-CimInstance -ClassName win32_service -filter "name = '$ServiceName'" -ComputerName $Server - - if(-not $service) - { - if($LoggingStage) - { - Write-SkippedEvent -Source $Server -Stage $LoggingStage -Reason @{$ServiceName = 'NotFound'} - } - - if($ThrowOnFailure) - { - throw "Service $ServiceName not found on $Server." - } - return - } - - # Check and change the StartMode if necessary - if($StartMode -eq "Auto") - { - $StartMode = "Automatic" - } - - if(($StartMode -ne "NoChange") -and ($service.StartMode -ne $StartMode)) - { - $service.ChangeStartMode($StartMode) | Out-Null - - if($StartMode -eq "Disabled") - { - $State = "Stopped" - } - } - - # Determine if the start/stop/restart action is needed - if($State -eq "NoChange" -or $service.State -eq $State) - { - return - } - - if($LoggingStage) - { - $logEntry = New-LogEntry -Source $Server -Stage $LoggingStage - Write-EventOfEntry -Event Start -Entry $logEntry - } - - switch($State) - { - "Stopped" - { - $service.StopService() | Out-Null - } - - "Running" - { - if($service.State -eq "Paused") - { - $service.ResumeService() | Out-Null - } - else - { - $service.StartService()| Out-Null - } - } - - "Paused" - { - if($service.State -eq "Running") - { - $service.PauseService() | Out-Null - } - else - { - # service is stopped, start it up first - $service.StartService() | Out-Null - - if($WaitTime -eq [TimeSpan]::Zero) - { - $startupWaitTime = New-TimeSpan -Minutes 5 - } - else - { - $startupWaitTime = $WaitTime - } - - Wait-ServiceState ` - -ServiceName $ServiceName ` - -Server $Server ` - -State "Running" ` - -WaitTime $startupWaitTime ` - -ThrowOnFailure:$ThrowOnFailure - - # pause now - $service.PauseService() | Out-Null - } - } - } - - if($WaitTime -gt [TimeSpan]::Zero) - { - Wait-ServiceState ` - -ServiceName $ServiceName ` - -Server $Server ` - -State $State ` - -WaitTime $WaitTime ` - -ThrowOnFailure:$ThrowOnFailure - } - - if($LoggingStage) - { - Write-EventOfEntry -Event Completed -Entry $logEntry -reason @{'MaxWaitMinutes' = $WaitTime.TotalMinutes} - } -} - -# .DESCRIPTION -# Wait for the state of a service to change to the specified state -# -# .PARAMETER $ServiceName -# Name of the service to wait for -# -# .PARAMETER $Server -# Server where the service is running on -# -# .PARAMETER $State -# State to wait for -# -# .PARAMETER $WaitTime -# Maximum wait time for the service to change its state -# -# .PARAMETER $ThrowOnFailure -# Whether to throw on failures -# -# .RETURN -# None -function Wait-ServiceState -{ - param( - [Parameter(Mandatory = $true)] - [string]$ServiceName, - - [Parameter(Mandatory = $false)] - [string]$Server = $env:COMPUTERNAME, - - [Parameter(Mandatory = $True)] - [ValidateSet("Stopped", "Running", "Paused")] - [string]$State, - - [Parameter(Mandatory = $false)] - [TimeSpan] $WaitTime = (New-TimeSpan -Minutes 5), - - [Parameter(Mandatory = $false)] - [Switch] $ThrowOnFailure - ) - - $service = Get-Service -ComputerName $Server -ServiceName $ServiceName - - if(-not $service) - { - if($ThrowOnFailure) - { - throw "Service $ServiceName not found on $Server." - } - return - } - - try - { - $service.WaitForStatus($State, $WaitTime) | Out-Null - } - catch - { - if($ThrowOnFailure) - { - throw $_ - } - } -} - -# .DESCRIPTION -# Function to stop a service by killing the underlying process -# -# .PARAMETER $ServiceName -# Name of the service to stop -# -# .PARAMETER $StartMode -# Service startup mode to set after killing the service, default to 'Auto' -function Stop-ServiceForcefully -{ - param - ( - [ValidateNotNullOrEmpty()] - [string]$ServiceName = $(throw "ServiceName required."), - - [ValidateSet("Auto", "Manual", "Disabled")] - [string]$StartMode = "Auto" - ) - - Write-Verbose "Stopping $ServiceName Service" - Set-ServiceState -ServiceName $ServiceName -StartMode Disabled -WaitTime ([TimeSpan]::Zero) - # Wait in case it needs time to take effect - Wait-Event -Timeout 5 - - $processFullPath = (Get-CimInstance -query "SELECT PathName FROM Win32_Service WHERE Name = '$ServiceName'").PathName.Replace('"','') - $processName = (Split-Path $processFullPath -Leaf).Replace('.exe','') - - $process = Get-Process -Name $processName -ErrorAction SilentlyContinue - if ($null -ne $process) - { - Stop-Process $process -Force - # we wait so that the next statement that sets the startup type back to automatic does not - # take effect while the process is still being killed and cause SCM to start the service back up - Wait-Event -Timeout 5 - } - else - { - Write-Verbose 'The service process was not running' - } - - Set-ServiceState -ServiceName $ServiceName -StartMode $StartMode -WaitTime ([TimeSpan]::Zero) -} -#endregion - -Export-ModuleMember -Function Start-TransportMaintenance -Export-ModuleMember -Function Stop-TransportMaintenance -Export-ModuleMember -Function Wait-BootLoaderReady diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMapiVirtualDirectory/MSFT_xExchMapiVirtualDirectory.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMapiVirtualDirectory/MSFT_xExchMapiVirtualDirectory.psm1 deleted file mode 100644 index 8d00018f..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMapiVirtualDirectory/MSFT_xExchMapiVirtualDirectory.psm1 +++ /dev/null @@ -1,231 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscTestsPresent", "")] -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscExamplesPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.String] - $DomainController, - - [System.String] - $ExternalUrl, - - [parameter(Mandatory = $true)] - [System.String[]] - $IISAuthenticationMethods, - - [System.String] - $InternalUrl - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-MapiVirtualDirectory" -VerbosePreference $VerbosePreference - - $vdir = GetMapiVirtualDirectory @PSBoundParameters - - if ($null -ne $vdir) - { - $returnValue = @{ - Identity = $Identity - IISAuthenticationMethods = $vdir.IISAuthenticationMethods - ExternalUrl = $vdir.ExternalUrl.AbsoluteUri - InternalUrl = $vdir.InternalUrl.AbsoluteUri - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.String] - $DomainController, - - [System.String] - $ExternalUrl, - - [parameter(Mandatory = $true)] - [System.String[]] - $IISAuthenticationMethods, - - [System.String] - $InternalUrl - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Set-MapiVirtualDirectory" -VerbosePreference $VerbosePreference - - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "Credential","AllowServiceRestart" - - SetEmptyStringParamsToNull -PSBoundParametersIn $PSBoundParameters - - Set-MapiVirtualDirectory @PSBoundParameters - - if ($AllowServiceRestart -eq $true) - { - Write-Verbose "Recycling MSExchangeMapiFrontEndAppPool and MSExchangeMapiMailboxAppPool" - - RestartAppPoolIfExists -Name MSExchangeMapiFrontEndAppPool - RestartAppPoolIfExists -Name MSExchangeMapiMailboxAppPool - } - else - { - Write-Warning "The configuration will not take effect until MSExchangeMapiFrontEndAppPool and MSExchangeMapiMailboxAppPool are manually recycled." - } -} - - -function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.String] - $DomainController, - - [System.String] - $ExternalUrl, - - [parameter(Mandatory = $true)] - [System.String[]] - $IISAuthenticationMethods, - - [System.String] - $InternalUrl - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-MapiVirtualDirectory" -VerbosePreference $VerbosePreference - - $vdir = GetMapiVirtualDirectory @PSBoundParameters - - if ($null -eq $vdir) - { - return $false - } - else - { - if (!(VerifySetting -Name "IISAuthenticationMethods" -Type "Array" -ExpectedValue $IISAuthenticationMethods -ActualValue $vdir.IISAuthenticationMethods -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ExternalUrl" -Type "String" -ExpectedValue $ExternalUrl -ActualValue $vdir.ExternalUrl.AbsoluteUri -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "InternalUrl" -Type "String" -ExpectedValue $InternalUrl -ActualValue $vdir.InternalUrl.AbsoluteUri -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - } - - return $true -} - -function GetMapiVirtualDirectory -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.String] - $DomainController, - - [System.String] - $ExternalUrl, - - [parameter(Mandatory = $true)] - [System.String[]] - $IISAuthenticationMethods, - - [System.String] - $InternalUrl - ) - - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Identity","DomainController" - - return (Get-MapiVirtualDirectory @PSBoundParameters) -} - - -Export-ModuleMember -Function *-TargetResource - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMapiVirtualDirectory/MSFT_xExchMapiVirtualDirectory.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMapiVirtualDirectory/MSFT_xExchMapiVirtualDirectory.schema.mof deleted file mode 100644 index ef250ab6..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchMapiVirtualDirectory/MSFT_xExchMapiVirtualDirectory.schema.mof +++ /dev/null @@ -1,18 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xExchMapiVirtualDirectory")] -class MSFT_xExchMapiVirtualDirectory : OMI_BaseResource -{ - [Key] String Identity; //Identity of Mapi Vdir. Should be in the format 'SERVERNAME\Vdir', as in 'SERVER\mapi (Default Web Site)' - [Required, EmbeddedInstance("MSFT_Credential")] String Credential; //Credentials used to establish a remote Powershell session to Exchange - [Write] Boolean AllowServiceRestart; //Whether it is Ok to recycle the Mapi App Pools after making changes - - //Remaining props correspond directly to Set-MapiVirtualDirectory parameters - //http://technet.microsoft.com/en-US/library/dn595082%28v=exchg.150%29.aspx - [Write] String DomainController; - [Write] String ExternalUrl; - [Required] String IISAuthenticationMethods[]; - [Write] String InternalUrl; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchOabVirtualDirectory/MSFT_xExchOabVirtualDirectory.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchOabVirtualDirectory/MSFT_xExchOabVirtualDirectory.psm1 deleted file mode 100644 index 6963393e..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchOabVirtualDirectory/MSFT_xExchOabVirtualDirectory.psm1 +++ /dev/null @@ -1,405 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscTestsPresent", "")] -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscExamplesPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.String[]] - $OABsToDistribute, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $BasicAuthentication, - - [System.String] - $DomainController, - - [System.String[]] - $ExtendedProtectionFlags, - - [System.String[]] - $ExtendedProtectionSPNList, - - [ValidateSet("None","Allow","Require")] - [System.String] - $ExtendedProtectionTokenChecking, - - [System.String] - $ExternalUrl, - - [System.String] - $InternalUrl, - - [System.Int32] - $PollInterval, - - [System.Boolean] - $RequireSSL, - - [System.Boolean] - $WindowsAuthentication - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-OabVirtualDirectory","Set-OabVirtualDirectory","Get-OfflineAddressBook","Set-OfflineAddressBook" -VerbosePreference $VerbosePreference - - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Identity","DomainController" - - $vdir = Get-OabVirtualDirectory @PSBoundParameters - - if ($null -ne $vdir) - { - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "DomainController" - - #Get all OAB's which this VDir distributes for, and add their names to an array - $oabs = Get-OfflineAddressBook @PSBoundParameters | Where-Object {$_.VirtualDirectories -like "*$($Identity)*"} - - [string[]]$oabNames = @() - - if ($null -ne $oabs) - { - foreach ($oab in $oabs) - { - $oabNames += $oab.Name - } - } - - $returnValue = @{ - Identity = $Identity - OABsToDistribute = $oabNames - BasicAuthentication = $vdir.BasicAuthentication - ExtendedProtectionFlags = $vdir.ExtendedProtectionFlags - ExtendedProtectionSPNList = $vdir.ExtendedProtectionSPNList - ExtendedProtectionTokenChecking = $vdir.ExtendedProtectionTokenChecking - ExternalUrl = $vdir.ExternalUrl - InternalUrl = $vdir.InternalUrl - PollInterval = $vdir.PollInterval - RequireSSL = $vdir.RequireSSL - WindowsAuthentication = $vdir.WindowsAuthentication - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.String[]] - $OABsToDistribute, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $BasicAuthentication, - - [System.String] - $DomainController, - - [System.String[]] - $ExtendedProtectionFlags, - - [System.String[]] - $ExtendedProtectionSPNList, - - [ValidateSet("None","Allow","Require")] - [System.String] - $ExtendedProtectionTokenChecking, - - [System.String] - $ExternalUrl, - - [System.String] - $InternalUrl, - - [System.Int32] - $PollInterval, - - [System.Boolean] - $RequireSSL, - - [System.Boolean] - $WindowsAuthentication - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - if ($PSBoundParameters.ContainsKey("OABsToDistribute")) - { - #Get existing Vdir props so we can tell if we need to add OAB distribution points - $vdir = Get-TargetResource @PSBoundParameters - - foreach ($oab in $OABsToDistribute) - { - #If we aren't currently distributing an OAB, add it - if ((Array2ContainsArray1Contents -Array1 $oab -Array2 $vdir.OABsToDistribute -IgnoreCase) -eq $false) - { - AddOabDistributionPoint @PSBoundParameters -TargetOabName "$($oab)" - } - } - } - else - { - #Need to establish a remote Powershell session since it wasn't done in Get-TargetResource above - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Set-OabVirtualDirectory" - } - - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "Credential","AllowServiceRestart","OABsToDistribute" - - SetEmptyStringParamsToNull -PSBoundParametersIn $PSBoundParameters - - Set-OabVirtualDirectory @PSBoundParameters - - if ($AllowServiceRestart -eq $true) - { - Write-Verbose "Recycling MSExchangeOABAppPool" - - RestartAppPoolIfExists -Name MSExchangeOABAppPool - } - else - { - Write-Warning "The configuration will not take effect until MSExchangeOABAppPool is manually recycled." - } -} - - -function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.String[]] - $OABsToDistribute, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $BasicAuthentication, - - [System.String] - $DomainController, - - [System.String[]] - $ExtendedProtectionFlags, - - [System.String[]] - $ExtendedProtectionSPNList, - - [ValidateSet("None","Allow","Require")] - [System.String] - $ExtendedProtectionTokenChecking, - - [System.String] - $ExternalUrl, - - [System.String] - $InternalUrl, - - [System.Int32] - $PollInterval, - - [System.Boolean] - $RequireSSL, - - [System.Boolean] - $WindowsAuthentication - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - $vdir = Get-TargetResource @PSBoundParameters - - if ($null -eq $vdir) - { - return $false - } - else - { - if ($PSBoundParameters.ContainsKey("OABsToDistribute") -and (Array2ContainsArray1Contents -Array1 $OABsToDistribute -Array2 $vdir.OABsToDistribute -IgnoreCase) -eq $false) - { - ReportBadSetting -SettingName "OABsToDistribute" -ExpectedValue $OABsToDistribute -ActualValue $vdir.OABsToDistribute -VerbosePreference $VerbosePreference - } - - if (!(VerifySetting -Name "BasicAuthentication" -Type "Boolean" -ExpectedValue $BasicAuthentication -ActualValue $vdir.BasicAuthentication -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ExtendedProtectionFlags" -Type "Array" -ExpectedValue $ExtendedProtectionFlags -ActualValue $vdir.ExtendedProtectionFlags -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ExtendedProtectionSPNList" -Type "Array" -ExpectedValue $ExtendedProtectionSPNList -ActualValue $vdir.ExtendedProtectionSPNList -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ExtendedProtectionTokenChecking" -Type "String" -ExpectedValue $ExtendedProtectionTokenChecking -ActualValue $vdir.ExtendedProtectionTokenChecking -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ExternalUrl" -Type "String" -ExpectedValue $ExternalUrl -ActualValue $vdir.ExternalUrl.AbsoluteUri -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "InternalUrl" -Type "String" -ExpectedValue $InternalUrl -ActualValue $vdir.InternalUrl.AbsoluteUri -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "PollInterval" -Type "Int" -ExpectedValue $PollInterval -ActualValue $vdir.PollInterval -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "RequireSSL" -Type "Boolean" -ExpectedValue $RequireSSL -ActualValue $vdir.RequireSSL -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "WindowsAuthentication" -Type "Boolean" -ExpectedValue $WindowsAuthentication -ActualValue $vdir.WindowsAuthentication -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - } - - return $true -} - -#Adds a specified OAB vdir to the distribution points for an OAB -function AddOabDistributionPoint -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.String[]] - $OABsToDistribute, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $BasicAuthentication, - - [System.String] - $DomainController, - - [System.String[]] - $ExtendedProtectionFlags, - - [System.String[]] - $ExtendedProtectionSPNList, - - [ValidateSet("None","Allow","Require")] - [System.String] - $ExtendedProtectionTokenChecking, - - [System.String] - $ExternalUrl, - - [System.String] - $InternalUrl, - - [System.Int32] - $PollInterval, - - [System.Boolean] - $RequireSSL, - - [System.Boolean] - $WindowsAuthentication, - - [parameter(Mandatory = $true)] #Extra parameter added just for this function - [System.String] - $TargetOabName - ) - - #Keep track of the OAB vdir to add - $vdirIdentity = $Identity - - #Setup params for Get-OfflineAddressBook - AddParameters -PSBoundParametersIn $PSBoundParameters -ParamsToAdd @{"Identity" = $TargetOabName} - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Identity","DomainController" - - $oab = Get-OfflineAddressBook @PSBoundParameters if ($null -ne $oab) { #Assemble the list of existing Virtual Directories [string[]]$allVdirs = @() foreach ($vdir in $oab.VirtualDirectories) { $oabServer = ServerFromOABVdirDN -OabVdirDN $vdir.DistinguishedName [string]$entry = $oabServer + "\" + $vdir.Name $allVdirs += $entry } #Add desired vdir to existing list $allVdirs += $vdirIdentity - - #Set back to the OAB - Set-OfflineAddressBook @PSBoundParameters -VirtualDirectories $allVdirs - } - else - { - throw "Unable to find OAB '$($TargetOabName)'" - } -} - -#Gets just the server netbios name from an OAB virtual directory distinguishedName function ServerFromOABVdirDN($OabVdirDN) { $startString = "CN=Protocols,CN=" $endString = ",CN=Servers" $startIndex = $OabVdirDN.IndexOf($startString) + $startString.Length $length = $OabVdirDN.IndexOf($endString) - $startIndex $serverName = $OabVdirDN.Substring($startIndex, $length) return $serverName } - -Export-ModuleMember -Function *-TargetResource - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchOabVirtualDirectory/MSFT_xExchOabVirtualDirectory.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchOabVirtualDirectory/MSFT_xExchOabVirtualDirectory.schema.mof deleted file mode 100644 index d91236e1..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchOabVirtualDirectory/MSFT_xExchOabVirtualDirectory.schema.mof +++ /dev/null @@ -1,25 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xExchOabVirtualDirectory")] -class MSFT_xExchOabVirtualDirectory : OMI_BaseResource -{ - [Key] String Identity; //Identity of OAB Vdir. Should be in the format 'SERVERNAME\Vdir', as in 'SERVER\OAB (Default Web Site)' - [Required, EmbeddedInstance("MSFT_Credential")] String Credential; //Credentials used to establish a remote Powershell session to Exchange - [Write] String OABsToDistribute[]; //An array of names of Offline Address Books that this virtual directory should be added as a distribution point for. - [Write] Boolean AllowServiceRestart; //Whether it is OK to recycle the app pool after making changes. Defaults to $true. - - //Remaining props correspond directly to Set-OabVirtualDirectory parameters - //http://technet.microsoft.com/en-us/library/bb124707(v=exchg.150).aspx - [Write] Boolean BasicAuthentication; - [Write] String DomainController; - [Write] String ExtendedProtectionFlags[]; - [Write] String ExtendedProtectionSPNList[]; - [Write, ValueMap{"None","Allow","Require"}, Values{"None","Allow","Require"}] String ExtendedProtectionTokenChecking; - [Write] String ExternalUrl; - [Write] String InternalUrl; - [Write] Sint32 PollInterval; - [Write] Boolean RequireSSL; - [Write] Boolean WindowsAuthentication; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchOutlookAnywhere/MSFT_xExchOutlookAnywhere.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchOutlookAnywhere/MSFT_xExchOutlookAnywhere.psm1 deleted file mode 100644 index 1dd4f184..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchOutlookAnywhere/MSFT_xExchOutlookAnywhere.psm1 +++ /dev/null @@ -1,387 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscTestsPresent", "")] -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscExamplesPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.String] - $DomainController, - - [System.String[]] - $ExtendedProtectionFlags, - - [System.String[]] - $ExtendedProtectionSPNList, - - [ValidateSet("Allow","None","Require")] - [System.String] - $ExtendedProtectionTokenChecking, - - [ValidateSet("Ntlm","Basic","Negotiate")] - [System.String] - $ExternalClientAuthenticationMethod, - - [System.Boolean] - $ExternalClientsRequireSsl, - - [System.String] - $ExternalHostname, - - [System.String[]] - $IISAuthenticationMethods, - - [ValidateSet("Ntlm","Basic","Negotiate")] - [System.String] - $InternalClientAuthenticationMethod, - - [System.String] - $InternalHostname, - - [System.Boolean] - $InternalClientsRequireSsl, - - [System.Boolean] - $SSLOffloading - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad 'Get-OutlookAnywhere' -VerbosePreference $VerbosePreference - - $RpcVdir = GetOutlookAnywhere @PSBoundParameters - - if ($null -ne $RpcVdir) - { - $returnValue = @{ - Identity = $Identity - InternalHostname = $RpcVdir.InternalHostname.HostnameString - ExternalHostname = $RpcVdir.ExternalHostname.HostnameString - InternalClientAuthenticationMethod = $RpcVdir.InternalClientAuthenticationMethod - ExternalClientAuthenticationMethod = $RpcVdir.ExternalClientAuthenticationMethod - IISAuthenticationMethods = $RpcVdir.IISAuthenticationMethods - ExtendedProtectionFlags = $RpcVdir.ExtendedProtectionFlags - ExtendedProtectionSPNList = $RpcVdir.ExtendedProtectionSPNList - ExtendedProtectionTokenChecking = $RpcVdir.ExtendedProtectionTokenChecking - ExternalClientsRequireSsl = $RpcVdir.ExternalClientsRequireSsl - InternalClientsRequireSsl = $RpcVdir.InternalClientsRequireSsl - SSLOffloading = $RpcVdir.SSLOffloading - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.String] - $DomainController, - - [System.String[]] - $ExtendedProtectionFlags, - - [System.String[]] - $ExtendedProtectionSPNList, - - [ValidateSet("Allow","None","Require")] - [System.String] - $ExtendedProtectionTokenChecking, - - [ValidateSet("Ntlm","Basic","Negotiate")] - [System.String] - $ExternalClientAuthenticationMethod, - - [System.Boolean] - $ExternalClientsRequireSsl, - - [System.String] - $ExternalHostname, - - [System.String[]] - $IISAuthenticationMethods, - - [ValidateSet("Ntlm","Basic","Negotiate")] - [System.String] - $InternalClientAuthenticationMethod, - - [System.String] - $InternalHostname, - - [System.Boolean] - $InternalClientsRequireSsl, - - [System.Boolean] - $SSLOffloading - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad 'Set-OutlookAnywhere' -VerbosePreference $VerbosePreference - - #Ensure an empty string is $null and not a string - SetEmptyStringParamsToNull -PSBoundParametersIn $PSBoundParameters - - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove 'Credential','AllowServiceRestart' - - Set-OutlookAnywhere @PSBoundParameters - - if($AllowServiceRestart -eq $true) - { - Write-Verbose "Recycling MSExchangeRpcProxyAppPool and MSExchangeRpcProxyFrontEndAppPool" - - RestartAppPoolIfExists -Name MSExchangeRpcProxyAppPool - RestartAppPoolIfExists -Name MSExchangeRpcProxyFrontEndAppPool - } - else - { - Write-Warning "The configuration will not take effect until MSExchangeRpcProxyAppPool and MSExchangeRpcProxyFrontEndAppPool are manually recycled." - } -} - - -function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.String] - $DomainController, - - [System.String[]] - $ExtendedProtectionFlags, - - [System.String[]] - $ExtendedProtectionSPNList, - - [ValidateSet("Allow","None","Require")] - [System.String] - $ExtendedProtectionTokenChecking, - - [ValidateSet("Ntlm","Basic","Negotiate")] - [System.String] - $ExternalClientAuthenticationMethod, - - [System.Boolean] - $ExternalClientsRequireSsl, - - [System.String] - $ExternalHostname, - - [System.String[]] - $IISAuthenticationMethods, - - [ValidateSet("Ntlm","Basic","Negotiate")] - [System.String] - $InternalClientAuthenticationMethod, - - [System.String] - $InternalHostname, - - [System.Boolean] - $InternalClientsRequireSsl, - - [System.Boolean] - $SSLOffloading - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad 'Get-OutlookAnywhere' -VerbosePreference $VerbosePreference - - #Ensure an empty string is $null and not a string - SetEmptyStringParamsToNull -PSBoundParametersIn $PSBoundParameters - - $RpcVdir = GetOutlookAnywhere @PSBoundParameters - - if ($null -eq $RpcVdir) - { - return $false - } - else - { - if (!(VerifySetting -Name "InternalHostname" -Type "String" -ExpectedValue $InternalHostname -ActualValue $RpcVdir.InternalHostname.HostnameString -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ExternalHostname" -Type "String" -ExpectedValue $ExternalHostname -ActualValue $RpcVdir.ExternalHostname.HostnameString -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "InternalClientAuthenticationMethod" -Type "String" -ExpectedValue $InternalClientAuthenticationMethod -ActualValue $RpcVdir.InternalClientAuthenticationMethod -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ExternalClientAuthenticationMethod" -Type "String" -ExpectedValue $ExternalClientAuthenticationMethod -ActualValue $RpcVdir.ExternalClientAuthenticationMethod -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ExtendedProtectionTokenChecking" -Type "String" -ExpectedValue $ExtendedProtectionTokenChecking -ActualValue $RpcVdir.ExtendedProtectionTokenChecking -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - #ExternalClientsRequireSsl will only actually return as $true if ExternalHostname was also set - if (![string]::IsNullOrEmpty($ExternalHostname) -and !(VerifySetting -Name "ExternalClientsRequireSsl" -Type "Boolean" -ExpectedValue $ExternalClientsRequireSsl -ActualValue $RpcVdir.ExternalClientsRequireSsl -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "InternalClientsRequireSsl" -Type "Boolean" -ExpectedValue $InternalClientsRequireSsl -ActualValue $RpcVdir.InternalClientsRequireSsl -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "SSLOffloading" -Type "Boolean" -ExpectedValue $SSLOffloading -ActualValue $RpcVdir.SSLOffloading -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "IISAuthenticationMethods" -Type "Array" -ExpectedValue $IISAuthenticationMethods -ActualValue $RpcVdir.IISAuthenticationMethods -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ExtendedProtectionFlags" -Type "Array" -ExpectedValue $ExtendedProtectionFlags -ActualValue $RpcVdir.ExtendedProtectionFlags -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ExtendedProtectionSPNList" -Type "Array" -ExpectedValue $ExtendedProtectionSPNList -ActualValue $RpcVdir.ExtendedProtectionSPNList -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - } - - #If the code made it this far all properties are in a desired state - return $true -} - -function GetOutlookAnywhere -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.String] - $DomainController, - - [System.String[]] - $ExtendedProtectionFlags, - - [System.String[]] - $ExtendedProtectionSPNList, - - [ValidateSet("Allow","None","Require")] - [System.String] - $ExtendedProtectionTokenChecking, - - [ValidateSet("Ntlm","Basic","Negotiate")] - [System.String] - $ExternalClientAuthenticationMethod, - - [System.Boolean] - $ExternalClientsRequireSsl, - - [System.String] - $ExternalHostname, - - [System.String[]] - $IISAuthenticationMethods, - - [ValidateSet("Ntlm","Basic","Negotiate")] - [System.String] - $InternalClientAuthenticationMethod, - - [System.String] - $InternalHostname, - - [System.Boolean] - $InternalClientsRequireSsl, - - [System.Boolean] - $SSLOffloading - ) - - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Identity","DomainController" - - return (Get-OutlookAnywhere @PSBoundParameters) -} - -Export-ModuleMember -Function *-TargetResource - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchOutlookAnywhere/MSFT_xExchOutlookAnywhere.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchOutlookAnywhere/MSFT_xExchOutlookAnywhere.schema.mof deleted file mode 100644 index bcbf4979..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchOutlookAnywhere/MSFT_xExchOutlookAnywhere.schema.mof +++ /dev/null @@ -1,26 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xExchOutlookAnywhere")] -class MSFT_xExchOutlookAnywhere : OMI_BaseResource -{ - [Key] String Identity; //The Identity of the OAB Virtual Directory - [Required, EmbeddedInstance("MSFT_Credential")] String Credential; //Credentials used to establish a remote Powershell session to Exchange - [Write] Boolean AllowServiceRestart; //Whether it is OK to recycle the app pool after making changes. Defaults to $true. - - //Remaining props correspond directly to Set-OutlookAnywhere parameters - //http://technet.microsoft.com/en-us/library/bb123545(v=exchg.150).aspx - [Write] String DomainController; - [Write] Boolean ExternalClientsRequireSsl; - [Write] String ExtendedProtectionFlags[]; - [Write] String ExtendedProtectionSPNList[]; - [Write, ValueMap{"Allow","None","Require"}, Values{"Allow","None","Require"}] String ExtendedProtectionTokenChecking; - [Write, ValueMap{"Ntlm","Basic","Negotiate"}, Values{"Ntlm","Basic","Negotiate"}] String ExternalClientAuthenticationMethod; - [Write] String ExternalHostname; - [Write] String IISAuthenticationMethods[]; - [Write, ValueMap{"Ntlm","Basic","Negotiate"}, Values{"Ntlm","Basic","Negotiate"}] String InternalClientAuthenticationMethod; - [Write] Boolean InternalClientsRequireSsl; - [Write] String InternalHostname; - [Write] Boolean SSLOffloading; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchOwaVirtualDirectory/MSFT_xExchOwaVirtualDirectory.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchOwaVirtualDirectory/MSFT_xExchOwaVirtualDirectory.psm1 deleted file mode 100644 index 180ccd3f..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchOwaVirtualDirectory/MSFT_xExchOwaVirtualDirectory.psm1 +++ /dev/null @@ -1,488 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscTestsPresent", "")] -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscExamplesPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $AdfsAuthentication, - - [System.Boolean] - $BasicAuthentication, - - [System.Boolean] - $ChangePasswordEnabled, - - [System.Boolean] - $DigestAuthentication, - - [System.String] - $DomainController, - - [System.String[]] - $ExternalAuthenticationMethods, - - [System.String] - $ExternalUrl, - - [System.Boolean] - $FormsAuthentication, - - [System.Boolean] - $InstantMessagingEnabled, - - [System.String] - $InstantMessagingCertificateThumbprint, - - [System.String] - $InstantMessagingServerName, - - [ValidateSet("None","Ocs")] - [System.String] - $InstantMessagingType, - - [System.String] - $InternalUrl, - - [System.Boolean] - $LogonPagePublicPrivateSelectionEnabled, - - [System.Boolean] - $LogonPageLightSelectionEnabled, - - [System.Boolean] - $WindowsAuthentication, - - [ValidateSet("FullDomain","UserName","PrincipalName")] - [System.String] - $LogonFormat, - - [System.String] - $DefaultDomain - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad 'Get-OwaVirtualDirectory' -VerbosePreference $VerbosePreference - - $OwaVdir = GetOwaVirtualDirectory @PSBoundParameters - - if ($null -ne $OwaVdir) - { - $returnValue = @{ - Identity = $Identity - InternalUrl = $OwaVdir.InternalUrl.AbsoluteUri - ExternalUrl = $OwaVdir.ExternalUrl.AbsoluteUri - FormsAuthentication = $OwaVdir.FormsAuthentication - WindowsAuthentication = $OwaVdir.WindowsAuthentication - BasicAuthentication = $OwaVdir.BasicAuthentication - ChangePasswordEnabled = $OwaVdir.ChangePasswordEnabled - DigestAuthentication = $OwaVdir.DigestAuthentication - AdfsAuthentication = $OwaVdir.AdfsAuthentication - InstantMessagingType = $OwaVdir.InstantMessagingType - InstantMessagingEnabled = $OwaVdir.InstantMessagingEnabled - InstantMessagingServerName = $OwaVdir.InstantMessagingServerName - InstantMessagingCertificateThumbprint = $OwaVdir.InstantMessagingCertificateThumbprint - LogonPagePublicPrivateSelectionEnabled = $OwaVdir.LogonPagePublicPrivateSelectionEnabled - LogonPageLightSelectionEnabled = $OwaVdir.LogonPageLightSelectionEnabled - ExternalAuthenticationMethods = $OwaVdir.ExternalAuthenticationMethods - LogonFormat = $OwaVdir.LogonFormat - DefaultDomain = $OwaVdir.DefaultDomain - } - } - - $returnValue -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $AdfsAuthentication, - - [System.Boolean] - $BasicAuthentication, - - [System.Boolean] - $ChangePasswordEnabled, - - [System.Boolean] - $DigestAuthentication, - - [System.String] - $DomainController, - - [System.String[]] - $ExternalAuthenticationMethods, - - [System.String] - $ExternalUrl, - - [System.Boolean] - $FormsAuthentication, - - [System.Boolean] - $InstantMessagingEnabled, - - [System.String] - $InstantMessagingCertificateThumbprint, - - [System.String] - $InstantMessagingServerName, - - [ValidateSet("None","Ocs")] - [System.String] - $InstantMessagingType, - - [System.String] - $InternalUrl, - - [System.Boolean] - $LogonPagePublicPrivateSelectionEnabled, - - [System.Boolean] - $LogonPageLightSelectionEnabled, - - [System.Boolean] - $WindowsAuthentication, - - [ValidateSet("FullDomain","UserName","PrincipalName")] - [System.String] - $LogonFormat, - - [System.String] - $DefaultDomain - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad 'Set-OwaVirtualDirectory' -VerbosePreference $VerbosePreference - - #Ensure an empty string is $null and not a string - SetEmptyStringParamsToNull -PSBoundParametersIn $PSBoundParameters - - #Remove Credential and AllowServiceRestart because those parameters do not exist on Set-OwaVirtualDirectory - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove 'Credential','AllowServiceRestart' - - Set-OwaVirtualDirectory @PSBoundParameters - - if($AllowServiceRestart -eq $true) - { - Write-Verbose "Recycling MSExchangeOWAAppPool" - RestartAppPoolIfExists -Name MSExchangeOWAAppPool - } - else - { - Write-Warning "The configuration will not take effect until MSExchangeOWAAppPool is manually recycled." - } -} - - -function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $AdfsAuthentication, - - [System.Boolean] - $BasicAuthentication, - - [System.Boolean] - $ChangePasswordEnabled, - - [System.Boolean] - $DigestAuthentication, - - [System.String] - $DomainController, - - [System.String[]] - $ExternalAuthenticationMethods, - - [System.String] - $ExternalUrl, - - [System.Boolean] - $FormsAuthentication, - - [System.Boolean] - $InstantMessagingEnabled, - - [System.String] - $InstantMessagingCertificateThumbprint, - - [System.String] - $InstantMessagingServerName, - - [ValidateSet("None","Ocs")] - [System.String] - $InstantMessagingType, - - [System.String] - $InternalUrl, - - [System.Boolean] - $LogonPagePublicPrivateSelectionEnabled, - - [System.Boolean] - $LogonPageLightSelectionEnabled, - - [System.Boolean] - $WindowsAuthentication, - - [ValidateSet("FullDomain","UserName","PrincipalName")] - [System.String] - $LogonFormat, - - [System.String] - $DefaultDomain - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad 'Get-OwaVirtualDirectory' -VerbosePreference $VerbosePreference - - #Ensure an empty string is $null and not a string - SetEmptyStringParamsToNull -PSBoundParametersIn $PSBoundParameters - - $OwaVdir = GetOwaVirtualDirectory @PSBoundParameters - - if ($null -eq $OwaVdir) - { - return $false - } - else - { - if (!(VerifySetting -Name "InternalUrl" -Type "String" -ExpectedValue $InternalUrl -ActualValue $OwaVdir.InternalUrl.AbsoluteUri -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ExternalUrl" -Type "String" -ExpectedValue $ExternalUrl -ActualValue $OwaVdir.ExternalUrl.AbsoluteUri -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "FormsAuthentication" -Type "Boolean" -ExpectedValue $FormsAuthentication -ActualValue $OwaVdir.FormsAuthentication -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "WindowsAuthentication" -Type "Boolean" -ExpectedValue $WindowsAuthentication -ActualValue $OwaVdir.WindowsAuthentication -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "BasicAuthentication" -Type "Boolean" -ExpectedValue $BasicAuthentication -ActualValue $OwaVdir.BasicAuthentication -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ChangePasswordEnabled" -Type "Boolean" -ExpectedValue $ChangePasswordEnabled -ActualValue $OwaVdir.ChangePasswordEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "DigestAuthentication" -Type "Boolean" -ExpectedValue $DigestAuthentication -ActualValue $OwaVdir.DigestAuthentication -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "AdfsAuthentication" -Type "Boolean" -ExpectedValue $AdfsAuthentication -ActualValue $OwaVdir.AdfsAuthentication -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "InstantMessagingType" -Type "String" -ExpectedValue $InstantMessagingType -ActualValue $OwaVdir.InstantMessagingType -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "InstantMessagingEnabled" -Type "Boolean" -ExpectedValue $InstantMessagingEnabled -ActualValue $OwaVdir.InstantMessagingEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "InstantMessagingCertificateThumbprint" -Type "String" -ExpectedValue $InstantMessagingCertificateThumbprint -ActualValue $OwaVdir.InstantMessagingCertificateThumbprint -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "InstantMessagingServerName" -Type "String" -ExpectedValue $InstantMessagingServerName -ActualValue $OwaVdir.InstantMessagingServerName -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "LogonPagePublicPrivateSelectionEnabled" -Type "Boolean" -ExpectedValue $LogonPagePublicPrivateSelectionEnabled -ActualValue $OwaVdir.LogonPagePublicPrivateSelectionEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "LogonPageLightSelectionEnabled" -Type "Boolean" -ExpectedValue $LogonPageLightSelectionEnabled -ActualValue $OwaVdir.LogonPageLightSelectionEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ExternalAuthenticationMethods" -Type "Array" -ExpectedValue $ExternalAuthenticationMethods -ActualValue $OwaVdir.ExternalAuthenticationMethods -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "LogonFormat" -Type "String" -ExpectedValue $LogonFormat -ActualValue $OwaVdir.LogonFormat -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "DefaultDomain" -Type "String" -ExpectedValue $DefaultDomain -ActualValue $OwaVdir.DefaultDomain -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - } - - #If the code made it this for all properties are in a desired state - return $true -} - -function GetOwaVirtualDirectory -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $AdfsAuthentication, - - [System.Boolean] - $BasicAuthentication, - - [System.Boolean] - $ChangePasswordEnabled, - - [System.Boolean] - $DigestAuthentication, - - [System.String] - $DomainController, - - [System.String[]] - $ExternalAuthenticationMethods, - - [System.String] - $ExternalUrl, - - [System.Boolean] - $FormsAuthentication, - - [System.Boolean] - $InstantMessagingEnabled, - - [System.String] - $InstantMessagingCertificateThumbprint, - - [System.String] - $InstantMessagingServerName, - - [ValidateSet("None","Ocs")] - [System.String] - $InstantMessagingType, - - [System.String] - $InternalUrl, - - [System.Boolean] - $LogonPagePublicPrivateSelectionEnabled, - - [System.Boolean] - $LogonPageLightSelectionEnabled, - - [System.Boolean] - $WindowsAuthentication, - - [ValidateSet("FullDomain","UserName","PrincipalName")] - [System.String] - $LogonFormat, - - [System.String] - $DefaultDomain - ) - - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Identity","DomainController" - - return (Get-OwaVirtualDirectory @PSBoundParameters) -} - - -Export-ModuleMember -Function *-TargetResource - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchOwaVirtualDirectory/MSFT_xExchOwaVirtualDirectory.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchOwaVirtualDirectory/MSFT_xExchOwaVirtualDirectory.schema.mof deleted file mode 100644 index aadfd211..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchOwaVirtualDirectory/MSFT_xExchOwaVirtualDirectory.schema.mof +++ /dev/null @@ -1,32 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xExchOwaVirtualDirectory")] -class MSFT_xExchOwaVirtualDirectory : OMI_BaseResource -{ - [Key] String Identity; //The Identity of the OWA Virtual Directory - [Required, EmbeddedInstance("MSFT_Credential")] String Credential; //Credentials used to establish a remote Powershell session to Exchange - - //Remaining props correspond directly to Set-OwaVirtualDirectory parameters - //http://technet.microsoft.com/en-us/library/bb123515(v=exchg.150).aspx - [Write] Boolean AdfsAuthentication; - [Write] Boolean AllowServiceRestart; - [Write] Boolean BasicAuthentication; - [Write] Boolean ChangePasswordEnabled; - [Write] Boolean DigestAuthentication; - [Write] String DomainController; - [Write] String ExternalAuthenticationMethods[]; - [Write] String ExternalUrl; - [Write] Boolean FormsAuthentication; - [Write] String InternalUrl; - [Write] Boolean InstantMessagingEnabled; - [Write] String InstantMessagingCertificateThumbprint; - [Write] String InstantMessagingServerName; - [Write, ValueMap{"None","Ocs"}, Values{"None","Ocs"}] String InstantMessagingType; - [Write] Boolean LogonPagePublicPrivateSelectionEnabled; - [Write] Boolean LogonPageLightSelectionEnabled; - [Write] Boolean WindowsAuthentication; - [Write, ValueMap{"FullDomain","UserName","PrincipalName"}, Values{"FullDomain","UserName","PrincipalName"}] String LogonFormat; - [Write] String DefaultDomain; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchPopSettings/MSFT_xExchPopSettings.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchPopSettings/MSFT_xExchPopSettings.psm1 deleted file mode 100644 index bffec3b0..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchPopSettings/MSFT_xExchPopSettings.psm1 +++ /dev/null @@ -1,228 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscTestsPresent", "")] -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscExamplesPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Server, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.String] - $DomainController, - - [ValidateSet("PlainTextLogin","PlainTextAuthentication","SecureLogin")] - [System.String] - $LoginType, - - [System.String[]] - $ExternalConnectionSettings, - - [System.String] - $X509CertificateName - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Server" = $Server} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-PopSettings" -VerbosePreference $VerbosePreference - - $pop = GetPopSettings @PSBoundParameters - - if ($null -ne $pop) - { - $returnValue = @{ - Server = $Identity - LoginType = $pop.LoginType - ExternalConnectionSettings = $pop.ExternalConnectionSettings - X509CertificateName = $pop.X509CertificateName - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Server, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.String] - $DomainController, - - [ValidateSet("PlainTextLogin","PlainTextAuthentication","SecureLogin")] - [System.String] - $LoginType, - - [System.String[]] - $ExternalConnectionSettings, - - [System.String] - $X509CertificateName - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Server" = $Server} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Set-PopSettings" -VerbosePreference $VerbosePreference - - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "Credential","AllowServiceRestart" - - Set-PopSettings @PSBoundParameters - - if ($AllowServiceRestart -eq $true) - { - Write-Verbose "Restarting POP Services" - - Get-Service MSExchangePOP4* | Restart-Service - } - else - { - Write-Warning "The configuration will not take effect until MSExchangePOP services are manually restarted." - } -} - - -function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Server, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.String] - $DomainController, - - [ValidateSet("PlainTextLogin","PlainTextAuthentication","SecureLogin")] - [System.String] - $LoginType, - - [System.String[]] - $ExternalConnectionSettings, - - [System.String] - $X509CertificateName - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Server" = $Server} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-PopSettings" -VerbosePreference $VerbosePreference - - SetEmptyStringParamsToNull -PSBoundParametersIn $PSBoundParameters - - $pop = GetPopSettings @PSBoundParameters - - if ($null -eq $pop) - { - return $false - } - else - { - if (!(VerifySetting -Name "LoginType" -Type "String" -ExpectedValue $LoginType -ActualValue $pop.LoginType -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ExternalConnectionSettings" -Type "Array" -ExpectedValue $ExternalConnectionSettings -ActualValue $pop.ExternalConnectionSettings -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "X509CertificateName" -Type "String" -ExpectedValue $X509CertificateName -ActualValue $pop.X509CertificateName -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - } - - return $true -} - -function GetPopSettings -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Server, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.String] - $DomainController, - - [ValidateSet("PlainTextLogin","PlainTextAuthentication","SecureLogin")] - [System.String] - $LoginType, - - [System.String[]] - $ExternalConnectionSettings, - - [System.String] - $X509CertificateName - ) - - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Server","DomainController" - - return (Get-PopSettings @PSBoundParameters) -} - -Export-ModuleMember -Function *-TargetResource - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchPopSettings/MSFT_xExchPopSettings.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchPopSettings/MSFT_xExchPopSettings.schema.mof deleted file mode 100644 index 944c6723..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchPopSettings/MSFT_xExchPopSettings.schema.mof +++ /dev/null @@ -1,15 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xExchPopSettings")] -class MSFT_xExchPopSettings : OMI_BaseResource -{ - [Key] String Server; //The POP server to configure - [Required, EmbeddedInstance("MSFT_Credential")] String Credential; //Credentials used to establish a remote Powershell session to Exchange - [Write] Boolean AllowServiceRestart; //Whether it is OK to restart the POP services after making changes. Defaults to $false. - [Write] String DomainController; //Optional Domain Controller to connect to - [Write, ValueMap{"PlainTextLogin","PlainTextAuthentication","SecureLogin"}, Values{"PlainTextLogin","PlainTextAuthentication","SecureLogin"}] String LoginType; //The LoginType to be used for POP - [Write] String ExternalConnectionSettings[]; //Specifies the host name, port, and encryption type that Exchange uses when POP3 clients connect to their email from the outside - [Write] String X509CertificateName; //Specifies the host name in the SSL certificate from the Associated Subject field. -}; - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchPowershellVirtualDirectory/MSFT_xExchPowerShellVirtualDirectory.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchPowershellVirtualDirectory/MSFT_xExchPowerShellVirtualDirectory.psm1 deleted file mode 100644 index cd0d9fe7..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchPowershellVirtualDirectory/MSFT_xExchPowerShellVirtualDirectory.psm1 +++ /dev/null @@ -1,282 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscTestsPresent", "")] -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscExamplesPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $BasicAuthentication, - - [System.Boolean] - $CertificateAuthentication, - - [System.String] - $DomainController, - - [System.String] - $ExternalUrl, - - [System.String] - $InternalUrl, - - [System.Boolean] - $RequireSSL, - - [System.Boolean] - $WindowsAuthentication - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-PowerShellVirtualDirectory" -VerbosePreference $VerbosePreference - - $vdir = GetPowerShellVirtualDirectory @PSBoundParameters - - if ($null -ne $vdir) - { - $returnValue = @{ - Identity = $Identity - BasicAuthentication = $vdir.BasicAuthentication - CertificateAuthentication = $vdir.CertificateAuthentication - ExternalUrl = $vdir.ExternalUrl.AbsoluteUri - InternalUrl = $vdir.InternalUrl.AbsoluteUri - RequireSSL = $vdir.RequireSSL - WindowsAuthentication = $vdir.WindowsAuthentication - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $BasicAuthentication, - - [System.Boolean] - $CertificateAuthentication, - - [System.String] - $DomainController, - - [System.String] - $ExternalUrl, - - [System.String] - $InternalUrl, - - [System.Boolean] - $RequireSSL, - - [System.Boolean] - $WindowsAuthentication - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Set-PowerShellVirtualDirectory" -VerbosePreference $VerbosePreference - - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "Credential","AllowServiceRestart" - - SetEmptyStringParamsToNull -PSBoundParametersIn $PSBoundParameters - - Set-PowerShellVirtualDirectory @PSBoundParameters - - if ($AllowServiceRestart -eq $true) - { - #Remove existing PS sessions, as we're about to break them - RemoveExistingRemoteSession -VerbosePreference $VerbosePreference - - Write-Verbose "Recycling MSExchangePowerShellAppPool and MSExchangePowerShellFrontEndAppPool" - - RestartAppPoolIfExists -Name MSExchangePowerShellAppPool - RestartAppPoolIfExists -Name MSExchangePowerShellFrontEndAppPool - } - else - { - Write-Warning "The configuration will not take effect until MSExchangePowerShellAppPool and MSExchangePowerShellFrontEndAppPool are manually recycled." - } -} - - -function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $BasicAuthentication, - - [System.Boolean] - $CertificateAuthentication, - - [System.String] - $DomainController, - - [System.String] - $ExternalUrl, - - [System.String] - $InternalUrl, - - [System.Boolean] - $RequireSSL, - - [System.Boolean] - $WindowsAuthentication - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-PowerShellVirtualDirectory" -VerbosePreference $VerbosePreference - - $vdir = GetPowerShellVirtualDirectory @PSBoundParameters - - if ($null -eq $vdir) - { - return $false - } - else - { - if (!(VerifySetting -Name "BasicAuthentication" -Type "Boolean" -ExpectedValue $BasicAuthentication -ActualValue $vdir.BasicAuthentication -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "CertificateAuthentication" -Type "Boolean" -ExpectedValue $CertificateAuthentication -ActualValue $vdir.CertificateAuthentication -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ExternalUrl" -Type "String" -ExpectedValue $ExternalUrl -ActualValue $vdir.ExternalUrl.AbsoluteUri -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "InternalUrl" -Type "String" -ExpectedValue $InternalUrl -ActualValue $vdir.InternalUrl.AbsoluteUri -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "RequireSSL" -Type "Boolean" -ExpectedValue $RequireSSL -ActualValue $vdir.RequireSSL -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "WindowsAuthentication" -Type "Boolean" -ExpectedValue $WindowsAuthentication -ActualValue $vdir.WindowsAuthentication -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - } - - return $true -} - -function GetPowerShellVirtualDirectory -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $BasicAuthentication, - - [System.Boolean] - $CertificateAuthentication, - - [System.String] - $DomainController, - - [System.String] - $ExternalUrl, - - [System.String] - $InternalUrl, - - [System.Boolean] - $RequireSSL, - - [System.Boolean] - $WindowsAuthentication - ) - - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Identity","DomainController" - - return (Get-PowerShellVirtualDirectory @PSBoundParameters) -} - -Export-ModuleMember -Function *-TargetResource - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchPowershellVirtualDirectory/MSFT_xExchPowerShellVirtualDirectory.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchPowershellVirtualDirectory/MSFT_xExchPowerShellVirtualDirectory.schema.mof deleted file mode 100644 index 895d94da..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchPowershellVirtualDirectory/MSFT_xExchPowerShellVirtualDirectory.schema.mof +++ /dev/null @@ -1,21 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xExchPowerShellVirtualDirectory")] -class MSFT_xExchPowerShellVirtualDirectory : OMI_BaseResource -{ - [Key] String Identity; //Identity of PS Vdir. Should be in the format 'SERVERNAME\Vdir', as in 'SERVER\PowerShell (Default Web Site)' - [Required, EmbeddedInstance("MSFT_Credential")] String Credential; //Credentials used to establish a remote Powershell session to Exchange - [Write] Boolean AllowServiceRestart; //Whether it is OK to recycle the app pool after making changes. Defaults to $true. - - //Remaining props correspond directly to Set-PowershellVirtualDirectory parameters - //http://technet.microsoft.com/en-us/library/dd298108(v=exchg.150).aspx - [Write] Boolean BasicAuthentication; - [Write] Boolean CertificateAuthentication; - [Write] String DomainController; - [Write] String ExternalUrl; - [Write] String InternalUrl; - [Write] Boolean RequireSSL; - [Write] Boolean WindowsAuthentication; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchReceiveConnector/MSFT_xExchReceiveConnector.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchReceiveConnector/MSFT_xExchReceiveConnector.psm1 deleted file mode 100644 index 59578053..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchReceiveConnector/MSFT_xExchReceiveConnector.psm1 +++ /dev/null @@ -1,1245 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscTestsPresent", "")] -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscExamplesPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [Microsoft.Management.Infrastructure.CimInstance[]] - $ExtendedRightAllowEntries, - - [Microsoft.Management.Infrastructure.CimInstance[]] - $ExtendedRightDenyEntries, - - [System.Boolean] - $AdvertiseClientSettings, - - [System.String[]] - $AuthMechanism, - - [System.String] - $Banner, - - [System.Boolean] - $BareLinefeedRejectionEnabled, - - [System.Boolean] - $BinaryMimeEnabled, - - [System.String[]] - $Bindings, - - [System.Boolean] - $ChunkingEnabled, - - [System.String] - $Comment, - - [System.String] - $ConnectionInactivityTimeout, - - [System.String] - $ConnectionTimeout, - - [System.String] - $DefaultDomain, - - [System.String] - $DomainController, - - [System.Boolean] - $DeliveryStatusNotificationEnabled, - - [System.Boolean] - $DomainSecureEnabled, - - [System.Boolean] - $EightBitMimeEnabled, - - [System.Boolean] - $EnableAuthGSSAPI, - - [System.Boolean] - $Enabled, - - [System.Boolean] - $EnhancedStatusCodesEnabled, - - [ValidateSet("None","Allow","Require")] - [System.String] - $ExtendedProtectionPolicy, - - [System.String] - $Fqdn, - - [System.Boolean] - $LongAddressesEnabled, - - [System.String] - $MaxAcknowledgementDelay, - - [System.String] - $MaxHeaderSize, - - [System.Int32] - $MaxHopCount, - - [System.String] - $MaxInboundConnection, - - [System.Int32] - $MaxInboundConnectionPercentagePerSource, - - [System.String] - $MaxInboundConnectionPerSource, - - [System.Int32] - $MaxLocalHopCount, - - [System.Int32] - $MaxLogonFailures, - - [System.String] - $MaxMessageSize, - - [System.String] - $MaxProtocolErrors, - - [System.Int32] - $MaxRecipientsPerMessage, - - [System.String] - $MessageRateLimit, - - [ValidateSet("None","IPAddress","User","All")] - [System.String] - $MessageRateSource, - - [System.Boolean] - $OrarEnabled, - - [System.String[]] - $PermissionGroups, - - [System.Boolean] - $PipeliningEnabled, - - [ValidateSet("None","Verbose")] - [System.String] - $ProtocolLoggingLevel, - - [System.String[]] - $RemoteIPRanges, - - [System.Boolean] - $RequireEHLODomain, - - [System.Boolean] - $RequireTLS, - - [System.String] - $ServiceDiscoveryFqdn, - - [ValidateSet("Enabled","Disabled","EnabledWithoutValue")] - [System.String] - $SizeEnabled, - - [System.Boolean] - $SuppressXAnonymousTls, - - [System.String] - $TarpitInterval, - - [System.String] - $TlsCertificateName, - - [System.String[]] - $TlsDomainCapabilities, - - [ValidateSet("FrontendTransport","HubTransport")] - [System.String] - $TransportRole, - - [ValidateSet("Client","Internal","Internet","Partner","Custom")] - [System.String] - $Usage - ) - - ValidateIdentity -Identity $Identity - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-ReceiveConnector" -VerbosePreference $VerbosePreference - - $connector = GetReceiveConnector @PSBoundParameters - - if ($null -ne $connector) - { - $returnValue = @{ - Identity = $Identity - AdvertiseClientSettings = $connector.AdvertiseClientSettings - AuthMechanism = $connector.AuthMechanism - Banner = $connector.Banner - BareLinefeedRejectionEnabled = $connector.BareLinefeedRejectionEnabled - BinaryMimeEnabled = $connector.BinaryMimeEnabled - Bindings = $connector.Bindings - ChunkingEnabled = $connector.ChunkingEnabled - Comment = $connector.Comment - ConnectionInactivityTimeout = $connector.ConnectionInactivityTimeout - ConnectionTimeout = $connector.ConnectionTimeout - DefaultDomain = $connector.DefaultDomain - DeliveryStatusNotificationEnabled = $connector.DeliveryStatusNotificationEnabled - DomainSecureEnabled = $connector.DomainSecureEnabled - EightBitMimeEnabled = $connector.EightBitMimeEnabled - EnableAuthGSSAPI = $connector.EnableAuthGSSAPI - Enabled = $connector.Enabled - EnhancedStatusCodesEnabled = $connector.EnhancedStatusCodesEnabled - ExtendedProtectionPolicy = $connector.ExtendedProtectionPolicy - ExtendedRightAllowEntries = $ExtendedRightAllowEntries | ForEach-Object {"$($_.key)=$($_.Value)"} - ExtendedRightDenyEntries = $ExtendedRightDenyEntries | ForEach-Object {"$($_.key)=$($_.Value)"} - Fqdn = $connector.Fqdn - LongAddressesEnabled = $connector.LongAddressesEnabled - MaxAcknowledgementDelay = $connector.MaxAcknowledgementDelay - MaxHeaderSize = $connector.MaxHeaderSize - MaxHopCount = $connector.MaxHopCount - MaxInboundConnection = $connector.MaxInboundConnection - MaxInboundConnectionPercentagePerSource = $connector.MaxInboundConnectionPercentagePerSource - MaxInboundConnectionPerSource = $connector.MaxInboundConnectionPerSource - MaxLocalHopCount = $connector.MaxLocalHopCount - MaxLogonFailures = $connector.MaxLogonFailures - MaxMessageSize = $connector.MaxMessageSize - MaxProtocolErrors = $connector.MaxProtocolErrors - MaxRecipientsPerMessage = $connector.MaxRecipientsPerMessage - MessageRateLimit = $connector.MessageRateLimit - MessageRateSource = $connector.MessageRateSource - OrarEnabled = $connector.OrarEnabled - PermissionGroups = $connector.PermissionGroups - PipeliningEnabled = $connector.PipeliningEnabled - ProtocolLoggingLevel = $connector.ProtocolLoggingLevel - RemoteIPRanges = $connector.RemoteIPRanges - RequireEHLODomain = $connector.RequireEHLODomain - RequireTLS = $connector.RequireTLS - ServiceDiscoveryFqdn = $connector.ServiceDiscoveryFqdn - SizeEnabled = $connector.SizeEnabled - SuppressXAnonymousTls = $connector.SuppressXAnonymousTls - TarpitInterval = $connector.TarpitInterval - TlsCertificateName = $connector.TlsCertificateName - TlsDomainCapabilities = $connector.TlsDomainCapabilities - TransportRole = $connector.TransportRole - } - } - - $returnValue -} - -function Set-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [Microsoft.Management.Infrastructure.CimInstance[]] - $ExtendedRightAllowEntries, - - [Microsoft.Management.Infrastructure.CimInstance[]] - $ExtendedRightDenyEntries, - - [System.Boolean] - $AdvertiseClientSettings, - - [System.String[]] - $AuthMechanism, - - [System.String] - $Banner, - - [System.Boolean] - $BareLinefeedRejectionEnabled, - - [System.Boolean] - $BinaryMimeEnabled, - - [System.String[]] - $Bindings, - - [System.Boolean] - $ChunkingEnabled, - - [System.String] - $Comment, - - [System.String] - $ConnectionInactivityTimeout, - - [System.String] - $ConnectionTimeout, - - [System.String] - $DefaultDomain, - - [System.String] - $DomainController, - - [System.Boolean] - $DeliveryStatusNotificationEnabled, - - [System.Boolean] - $DomainSecureEnabled, - - [System.Boolean] - $EightBitMimeEnabled, - - [System.Boolean] - $EnableAuthGSSAPI, - - [System.Boolean] - $Enabled, - - [System.Boolean] - $EnhancedStatusCodesEnabled, - - [ValidateSet("None","Allow","Require")] - [System.String] - $ExtendedProtectionPolicy, - - [System.String] - $Fqdn, - - [System.Boolean] - $LongAddressesEnabled, - - [System.String] - $MaxAcknowledgementDelay, - - [System.String] - $MaxHeaderSize, - - [System.Int32] - $MaxHopCount, - - [System.String] - $MaxInboundConnection, - - [System.Int32] - $MaxInboundConnectionPercentagePerSource, - - [System.String] - $MaxInboundConnectionPerSource, - - [System.Int32] - $MaxLocalHopCount, - - [System.Int32] - $MaxLogonFailures, - - [System.String] - $MaxMessageSize, - - [System.String] - $MaxProtocolErrors, - - [System.Int32] - $MaxRecipientsPerMessage, - - [System.String] - $MessageRateLimit, - - [ValidateSet("None","IPAddress","User","All")] - [System.String] - $MessageRateSource, - - [System.Boolean] - $OrarEnabled, - - [System.String[]] - $PermissionGroups, - - [System.Boolean] - $PipeliningEnabled, - - [ValidateSet("None","Verbose")] - [System.String] - $ProtocolLoggingLevel, - - [System.String[]] - $RemoteIPRanges, - - [System.Boolean] - $RequireEHLODomain, - - [System.Boolean] - $RequireTLS, - - [System.String] - $ServiceDiscoveryFqdn, - - [ValidateSet("Enabled","Disabled","EnabledWithoutValue")] - [System.String] - $SizeEnabled, - - [System.Boolean] - $SuppressXAnonymousTls, - - [System.String] - $TarpitInterval, - - [System.String] - $TlsCertificateName, - - [System.String[]] - $TlsDomainCapabilities, - - [ValidateSet("FrontendTransport","HubTransport")] - [System.String] - $TransportRole, - - [ValidateSet("Client","Internal","Internet","Partner","Custom")] - [System.String] - $Usage - ) - - ValidateIdentity -Identity $Identity - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "*ReceiveConnector","*ADPermission" -VerbosePreference $VerbosePreference - - $connector = GetReceiveConnector @PSBoundParameters - - if ($Ensure -eq "Absent") - { - if ($null -ne $connector) - { - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Identity","DomainController" - - Remove-ReceiveConnector @PSBoundParameters -Confirm:$false - } - } - else - { - #Remove Credential and Ensure so we don't pass it into the next command - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "Credential","Ensure" - - SetEmptyStringParamsToNull -PSBoundParametersIn $PSBoundParameters - - #We need to create the new connector - if ($null -eq $connector) - { - #Create a copy of the original parameters - $originalPSBoundParameters = @{} + $PSBoundParameters - - #The following aren't valid for New-ReceiveConnector - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "Identity","BareLinefeedRejectionEnabled","ExtendedRightAllowEntries","ExtendedRightDenyEntries" - - #Parse out the server name and connector name from the given Identity - $serverName = $Identity.Substring(0, $Identity.IndexOf("\")) - $connectorName = $Identity.Substring($Identity.IndexOf("\") + 1) - - #Add in server and name parameters - AddParameters -PSBoundParametersIn $PSBoundParameters -ParamsToAdd @{"Server" = $serverName; "Name" = $connectorName} - - #Create the connector - $connector = New-ReceiveConnector @PSBoundParameters - - #Ensure the connector exists, and if so, set us up so we can run Set-ReceiveConnector next - if ($null -ne $connector) - { - #Remove the two props we added - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "Server","Name" - - #Add original props back - AddParameters -PSBoundParametersIn $PSBoundParameters -ParamsToAdd $originalPSBoundParameters - } - else - { - throw "Failed to create new Receive Connector." - } - } - - #The connector already exists, so use Set-ReceiveConnector - if ($null -ne $connector) - { - #Usage is not a valid command for Set-ReceiveConnector - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "Usage","ExtendedRightAllowEntries","ExtendedRightDenyEntries" - - Set-ReceiveConnector @PSBoundParameters - - #set AD permissions - if ($ExtendedRightAllowEntries) - { - foreach ($ExtendedRightAllowEntry in $ExtendedRightAllowEntries) { - foreach ($Value in $($ExtendedRightAllowEntry.Value.Split(","))) { - $connector | Add-ADPermission -User $ExtendedRightAllowEntry.Key -ExtendedRights $Value - } - } - } - - if ($ExtendedRightDenyEntries) - { - foreach ($ExtendedRightDenyEntry in $ExtendedRightDenyEntries) { - foreach ($Value in $($ExtendedRightDenyEntry.Value.Split(","))) { - $connector | Remove-ADPermission -User $ExtendedRightDenyEntry.Key -ExtendedRights $Value -Confirm:$false - } - } - } - } - } -} - - -function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [Microsoft.Management.Infrastructure.CimInstance[]] - $ExtendedRightAllowEntries, - - [Microsoft.Management.Infrastructure.CimInstance[]] - $ExtendedRightDenyEntries, - - [System.Boolean] - $AdvertiseClientSettings, - - [System.String[]] - $AuthMechanism, - - [System.String] - $Banner, - - [System.Boolean] - $BareLinefeedRejectionEnabled, - - [System.Boolean] - $BinaryMimeEnabled, - - [System.String[]] - $Bindings, - - [System.Boolean] - $ChunkingEnabled, - - [System.String] - $Comment, - - [System.String] - $ConnectionInactivityTimeout, - - [System.String] - $ConnectionTimeout, - - [System.String] - $DefaultDomain, - - [System.Boolean] - $DeliveryStatusNotificationEnabled, - - [System.String] - $DomainController, - - [System.Boolean] - $DomainSecureEnabled, - - [System.Boolean] - $EightBitMimeEnabled, - - [System.Boolean] - $EnableAuthGSSAPI, - - [System.Boolean] - $Enabled, - - [System.Boolean] - $EnhancedStatusCodesEnabled, - - [ValidateSet("None","Allow","Require")] - [System.String] - $ExtendedProtectionPolicy, - - [System.String] - $Fqdn, - - [System.Boolean] - $LongAddressesEnabled, - - [System.String] - $MaxAcknowledgementDelay, - - [System.String] - $MaxHeaderSize, - - [System.Int32] - $MaxHopCount, - - [System.String] - $MaxInboundConnection, - - [System.Int32] - $MaxInboundConnectionPercentagePerSource, - - [System.String] - $MaxInboundConnectionPerSource, - - [System.Int32] - $MaxLocalHopCount, - - [System.Int32] - $MaxLogonFailures, - - [System.String] - $MaxMessageSize, - - [System.String] - $MaxProtocolErrors, - - [System.Int32] - $MaxRecipientsPerMessage, - - [System.String] - $MessageRateLimit, - - [ValidateSet("None","IPAddress","User","All")] - [System.String] - $MessageRateSource, - - [System.Boolean] - $OrarEnabled, - - [System.String[]] - $PermissionGroups, - - [System.Boolean] - $PipeliningEnabled, - - [ValidateSet("None","Verbose")] - [System.String] - $ProtocolLoggingLevel, - - [System.String[]] - $RemoteIPRanges, - - [System.Boolean] - $RequireEHLODomain, - - [System.Boolean] - $RequireTLS, - - [System.String] - $ServiceDiscoveryFqdn, - - [ValidateSet("Enabled","Disabled","EnabledWithoutValue")] - [System.String] - $SizeEnabled, - - [System.Boolean] - $SuppressXAnonymousTls, - - [System.String] - $TarpitInterval, - - [System.String] - $TlsCertificateName, - - [System.String[]] - $TlsDomainCapabilities, - - [ValidateSet("FrontendTransport","HubTransport")] - [System.String] - $TransportRole, - - [ValidateSet("Client","Internal","Internet","Partner","Custom")] - [System.String] - $Usage - ) - - ValidateIdentity -Identity $Identity - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-ReceiveConnector","Get-ADPermission" -VerbosePreference $VerbosePreference - - $connector = GetReceiveConnector @PSBoundParameters - - #get AD permissions if necessary - if (($ExtendedRightAllowEntries) -or ($ExtendedRightDenyEntries)) - { - $ADPermissions = $connector | Get-ADPermission | Where-Object {$_.IsInherited -eq $false} - } - - if ($null -eq $connector) - { - if ($Ensure -eq "Present") - { - return $false - } - else - { - return $true - } - } - else - { - if ($Ensure -eq "Absent") - { - return $false - } - else - { - #remove "Custom" from PermissionGroups - $connector.PermissionGroups = ($connector.PermissionGroups -split "," ) -notmatch "Custom" -join "," - - if (!(VerifySetting -Name "AdvertiseClientSettings" -Type "Boolean" -ExpectedValue $AdvertiseClientSettings -ActualValue $connector.AdvertiseClientSettings -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "AuthMechanism" -Type "Array" -ExpectedValue $AuthMechanism -ActualValue (StringToArray -StringIn "$($connector.AuthMechanism)" -Separator ',') -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "Banner" -Type "String" -ExpectedValue $Banner -ActualValue $connector.Banner -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "BareLinefeedRejectionEnabled" -Type "Boolean" -ExpectedValue $BareLinefeedRejectionEnabled -ActualValue $connector.BareLinefeedRejectionEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "BinaryMimeEnabled" -Type "Boolean" -ExpectedValue $BinaryMimeEnabled -ActualValue $connector.BinaryMimeEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "Bindings" -Type "Array" -ExpectedValue $Bindings -ActualValue $connector.Bindings -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ChunkingEnabled" -Type "Boolean" -ExpectedValue $ChunkingEnabled -ActualValue $connector.ChunkingEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "Comment" -Type "String" -ExpectedValue $Comment -ActualValue $connector.Comment -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ConnectionInactivityTimeout" -Type "Timespan" -ExpectedValue $ConnectionInactivityTimeout -ActualValue $connector.ConnectionInactivityTimeout -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ConnectionTimeout" -Type "Timespan" -ExpectedValue $ConnectionTimeout -ActualValue $connector.ConnectionTimeout -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "DefaultDomain" -Type "String" -ExpectedValue $DefaultDomain -ActualValue $connector.DefaultDomain -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "DeliveryStatusNotificationEnabled" -Type "Boolean" -ExpectedValue $DeliveryStatusNotificationEnabled -ActualValue $connector.DeliveryStatusNotificationEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "DomainSecureEnabled" -Type "Boolean" -ExpectedValue $DomainSecureEnabled -ActualValue $connector.DomainSecureEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "EightBitMimeEnabled" -Type "Boolean" -ExpectedValue $EightBitMimeEnabled -ActualValue $connector.EightBitMimeEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "EnableAuthGSSAPI" -Type "Boolean" -ExpectedValue $EnableAuthGSSAPI -ActualValue $connector.EnableAuthGSSAPI -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "Enabled" -Type "Boolean" -ExpectedValue $Enabled -ActualValue $connector.Enabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "EnhancedStatusCodesEnabled" -Type "Boolean" -ExpectedValue $EnhancedStatusCodesEnabled -ActualValue $connector.EnhancedStatusCodesEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ExtendedProtectionPolicy" -Type "String" -ExpectedValue $ExtendedProtectionPolicy -ActualValue $connector.ExtendedProtectionPolicy -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "Fqdn" -Type "String" -ExpectedValue $Fqdn -ActualValue $connector.Fqdn -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "LongAddressesEnabled" -Type "Boolean" -ExpectedValue $LongAddressesEnabled -ActualValue $connector.LongAddressesEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MaxHopCount" -Type "Int" -ExpectedValue $MaxHopCount -ActualValue $connector.MaxHopCount -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MaxAcknowledgementDelay" -Type "Timespan" -ExpectedValue $MaxAcknowledgementDelay -ActualValue $connector.MaxAcknowledgementDelay -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MaxInboundConnection" -Type "String" -ExpectedValue $MaxInboundConnection -ActualValue $connector.MaxInboundConnection -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MaxInboundConnectionPercentagePerSource" -Type "Int" -ExpectedValue $MaxInboundConnectionPercentagePerSource -ActualValue $connector.MaxInboundConnectionPercentagePerSource -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MaxInboundConnectionPerSource" -Type "String" -ExpectedValue $MaxInboundConnectionPerSource -ActualValue $connector.MaxInboundConnectionPerSource -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MaxHeaderSize" -Type "ByteQuantifiedSize" -ExpectedValue $MaxHeaderSize -ActualValue $connector.MaxHeaderSize -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MaxLocalHopCount" -Type "Int" -ExpectedValue $MaxLocalHopCount -ActualValue $connector.MaxLocalHopCount -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MaxLogonFailures" -Type "Int" -ExpectedValue $MaxLogonFailures -ActualValue $connector.MaxLogonFailures -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MaxMessageSize" -Type "ByteQuantifiedSize" -ExpectedValue $MaxMessageSize -ActualValue $connector.MaxMessageSize -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MaxProtocolErrors" -Type "String" -ExpectedValue $MaxProtocolErrors -ActualValue $connector.MaxProtocolErrors -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MaxRecipientsPerMessage" -Type "Int" -ExpectedValue $MaxRecipientsPerMessage -ActualValue $connector.MaxRecipientsPerMessage -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MessageRateLimit" -Type "String" -ExpectedValue $MessageRateLimit -ActualValue $connector.MessageRateLimit -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MessageRateSource" -Type "String" -ExpectedValue $MessageRateSource -ActualValue $connector.MessageRateSource -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "OrarEnabled" -Type "Boolean" -ExpectedValue $OrarEnabled -ActualValue $connector.OrarEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "PermissionGroups" -Type "Array" -ExpectedValue $PermissionGroups -ActualValue (StringToArray -StringIn $connector.PermissionGroups -Separator ',') -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "PipeliningEnabled" -Type "Boolean" -ExpectedValue $PipeliningEnabled -ActualValue $connector.PipeliningEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ProtocolLoggingLevel" -Type "String" -ExpectedValue $ProtocolLoggingLevel -ActualValue $connector.ProtocolLoggingLevel -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "RemoteIPRanges" -Type "Array" -ExpectedValue $RemoteIPRanges -ActualValue $connector.RemoteIPRanges -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "RequireEHLODomain" -Type "Boolean" -ExpectedValue $RequireEHLODomain -ActualValue $connector.RequireEHLODomain -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "RequireTLS" -Type "Boolean" -ExpectedValue $RequireTLS -ActualValue $connector.RequireTLS -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ServiceDiscoveryFqdn" -Type "String" -ExpectedValue $ServiceDiscoveryFqdn -ActualValue $connector.ServiceDiscoveryFqdn -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "SizeEnabled" -Type "String" -ExpectedValue $SizeEnabled -ActualValue $connector.SizeEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "SuppressXAnonymousTls" -Type "Boolean" -ExpectedValue $SuppressXAnonymousTls -ActualValue $connector.SuppressXAnonymousTls -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "TarpitInterval" -Type "Timespan" -ExpectedValue $TarpitInterval -ActualValue $connector.TarpitInterval -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "TlsCertificateName" -Type "String" -ExpectedValue $TlsCertificateName -ActualValue $connector.TlsCertificateName -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "TlsDomainCapabilities" -Type "Array" -ExpectedValue $TlsDomainCapabilities -ActualValue $connector.TlsDomainCapabilities -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "TransportRole" -Type "String" -ExpectedValue $TransportRole -ActualValue $connector.TransportRole -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - #check AD permissions if necessary - if ($ExtendedRightAllowEntries) - { - if (!(ExtendedRightExists -ADPermissions $ADPermissions -ExtendedRights $ExtendedRightAllowEntries -ShouldbeTrue:$True -VerbosePreference $VerbosePreference)) - { - return $false - } - } - - if ($ExtendedRightDenyEntries) - { - if (ExtendedRightExists -ADPermissions $ADPermissions -ExtendedRights $ExtendedRightDenyEntries -ShouldbeTrue:$false -VerbosePreference $VerbosePreference) - { - return $false - } - } - } - } - - #If we made it here, all tests passed - return $true -} - -#Runs Get-ReceiveConnector, only specifying Identity, ErrorAction, and optionally DomainController -function GetReceiveConnector -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [Microsoft.Management.Infrastructure.CimInstance[]] - $ExtendedRightAllowEntries, - - [Microsoft.Management.Infrastructure.CimInstance[]] - $ExtendedRightDenyEntries, - - [System.Boolean] - $AdvertiseClientSettings, - - [System.String[]] - $AuthMechanism, - - [System.String] - $Banner, - - [System.Boolean] - $BareLinefeedRejectionEnabled, - - [System.Boolean] - $BinaryMimeEnabled, - - [System.String[]] - $Bindings, - - [System.Boolean] - $ChunkingEnabled, - - [System.String] - $Comment, - - [System.String] - $ConnectionInactivityTimeout, - - [System.String] - $ConnectionTimeout, - - [System.String] - $DefaultDomain, - - [System.Boolean] - $DeliveryStatusNotificationEnabled, - - [System.Boolean] - $DomainSecureEnabled, - - [System.Boolean] - $EightBitMimeEnabled, - - [System.Boolean] - $EnableAuthGSSAPI, - - [System.Boolean] - $Enabled, - - [System.Boolean] - $EnhancedStatusCodesEnabled, - - [ValidateSet("None","Allow","Require")] - [System.String] - $ExtendedProtectionPolicy, - - [System.String] - $Fqdn, - - [System.Boolean] - $LongAddressesEnabled, - - [System.String] - $MaxAcknowledgementDelay, - - [System.String] - $MaxHeaderSize, - - [System.Int32] - $MaxHopCount, - - [System.String] - $MaxInboundConnection, - - [System.Int32] - $MaxInboundConnectionPercentagePerSource, - - [System.String] - $MaxInboundConnectionPerSource, - - [System.Int32] - $MaxLocalHopCount, - - [System.Int32] - $MaxLogonFailures, - - [System.String] - $MaxMessageSize, - - [System.String] - $MaxProtocolErrors, - - [System.Int32] - $MaxRecipientsPerMessage, - - [System.String] - $MessageRateLimit, - - [ValidateSet("None","IPAddress","User","All")] - [System.String] - $MessageRateSource, - - [System.Boolean] - $OrarEnabled, - - [System.String[]] - $PermissionGroups, - - [System.Boolean] - $PipeliningEnabled, - - [ValidateSet("None","Verbose")] - [System.String] - $ProtocolLoggingLevel, - - [System.String[]] - $RemoteIPRanges, - - [System.Boolean] - $RequireEHLODomain, - - [System.Boolean] - $RequireTLS, - - [System.String] - $ServiceDiscoveryFqdn, - - [ValidateSet("Enabled","Disabled","EnabledWithoutValue")] - [System.String] - $SizeEnabled, - - [System.Boolean] - $SuppressXAnonymousTls, - - [System.String] - $TarpitInterval, - - [System.String] - $TlsCertificateName, - - [System.String[]] - $TlsDomainCapabilities, - - [ValidateSet("FrontendTransport","HubTransport")] - [System.String] - $TransportRole, - - [ValidateSet("Client","Internal","Internet","Partner","Custom")] - [System.String] - $Usage - ) - - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Identity","DomainController" - - return (Get-ReceiveConnector @PSBoundParameters -ErrorAction SilentlyContinue) -} - -#Ensure that a connector Identity is in the proper form -function ValidateIdentity -{ - param([string]$Identity) - - if ([string]::IsNullOrEmpty($Identity) -or !($Identity.Contains("\"))) - { - throw "Identity must be in the format: 'SERVERNAME\Connector Name' (No quotes)" - } -} - -#check a connector for specific extended rights -function ExtendedRightExists -{ - [cmdletbinding()] - [OutputType([System.Boolean])] - param( - $ADPermissions, - [Microsoft.Management.Infrastructure.CimInstance[]]$ExtendedRights, - [boolean]$ShouldbeTrue, - $VerbosePreference - ) - $returnvalue = $false - foreach ($Right in $ExtendedRights) - { - foreach ($Value in $($Right.Value.Split(","))) - { - if ($null -ne ($ADPermissions | Where-Object {($_.User.RawIdentity -eq $Right.Key) -and ($_.ExtendedRights.RawIdentity -eq $Value)})) - { - $returnvalue = $true - if (!($ShouldbeTrue)) - { - Write-Verbose "Should report exist!" - ReportBadSetting -SettingName "ExtendedRight" -ExpectedValue "User:$($Right.Key) Value:$($Value)" -ActualValue "Present" -VerbosePreference $VerbosePreference - return $returnvalue - exit; - } - } - else - { - $returnvalue = $false - if ($ShouldbeTrue) - { - ReportBadSetting -SettingName "ExtendedRight" -ExpectedValue "User:$($Right.Key) Value:$($Value)" -ActualValue "Absent" -VerbosePreference $VerbosePreference - return $returnvalue - exit; - } - } - } - } -return $returnvalue -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchReceiveConnector/MSFT_xExchReceiveConnector.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchReceiveConnector/MSFT_xExchReceiveConnector.schema.mof deleted file mode 100644 index 372de2c2..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchReceiveConnector/MSFT_xExchReceiveConnector.schema.mof +++ /dev/null @@ -1,63 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xExchReceiveConnector")] -class MSFT_xExchReceiveConnector : OMI_BaseResource -{ - [Key] String Identity; //Identity of the Receive Connector. Needs to be in format 'SERVERNAME\CONNECTORNAME' (no quotes) - [Required, EmbeddedInstance("MSFT_Credential")] String Credential; //Credentials used to establish a remote Powershell session to Exchange - [Required, ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; //Whether the connector should be present or not - - //Remaining properties correspond directly to Set-ReceiveConnector parameters - //http://technet.microsoft.com/en-us/library/bb125140(v=exchg.150).aspx - [Write] Boolean AdvertiseClientSettings; - [Write] String AuthMechanism[]; - [Write] String Banner; - [Write] Boolean BareLinefeedRejectionEnabled; - [Write] Boolean BinaryMimeEnabled; - [Write] String Bindings[]; - [Write] Boolean ChunkingEnabled; - [Write] String Comment; - [Write] String ConnectionInactivityTimeout; - [Write] String ConnectionTimeout; - [Write] String DefaultDomain; - [Write] Boolean DeliveryStatusNotificationEnabled; - [Write] String DomainController; - [Write] Boolean DomainSecureEnabled; - [Write] Boolean EightBitMimeEnabled; - [Write] Boolean EnableAuthGSSAPI; - [Write] Boolean Enabled; - [Write] Boolean EnhancedStatusCodesEnabled; - [Write, EmbeddedInstance("MSFT_KeyValuePair")] String ExtendedRightAllowEntries[]; - [Write, EmbeddedInstance("MSFT_KeyValuePair")] String ExtendedRightDenyEntries[]; - [Write, ValueMap{"None","Allow","Require"}, Values{"None","Allow","Require"}] String ExtendedProtectionPolicy; - [Write] String Fqdn; - [Write] Boolean LongAddressesEnabled; - [Write] String MaxAcknowledgementDelay; - [Write] String MaxHeaderSize; - [Write] Sint32 MaxHopCount; - [Write] String MaxInboundConnection; - [Write] Sint32 MaxInboundConnectionPercentagePerSource; - [Write] String MaxInboundConnectionPerSource; - [Write] Sint32 MaxLocalHopCount; - [Write] Sint32 MaxLogonFailures; - [Write] String MaxMessageSize; - [Write] String MaxProtocolErrors; - [Write] Sint32 MaxRecipientsPerMessage; - [Write] String MessageRateLimit; - [Write, ValueMap{"None","IPAddress","User","All"}, Values{"None","IPAddress","User","All"}] String MessageRateSource; - [Write] Boolean OrarEnabled; - [Write] String PermissionGroups[]; - [Write] Boolean PipeliningEnabled; - [Write, ValueMap{"None","Verbose"}, Values{"None","Verbose"}] String ProtocolLoggingLevel; - [Write] String RemoteIPRanges[]; - [Write] Boolean RequireEHLODomain; - [Write] Boolean RequireTLS; - [Write] String ServiceDiscoveryFqdn; - [Write, ValueMap{"Enabled","Disabled","EnabledWithoutValue"}, Values{"Enabled","Disabled","EnabledWithoutValue"}] String SizeEnabled; - [Write] Boolean SuppressXAnonymousTls; - [Write] String TarpitInterval; - [Write] String TlsCertificateName; - [Write] String TlsDomainCapabilities[]; - [Write, ValueMap{"FrontendTransport","HubTransport"}, Values{"FrontendTransport","HubTransport"}] String TransportRole; - [Write, ValueMap{"Client","Internal","Internet","Partner","Custom"}, Values{"Client","Internal","Internet","Partner","Custom"}] String Usage; -}; - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchTransportService/MSFT_xExchTransportService.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchTransportService/MSFT_xExchTransportService.psm1 deleted file mode 100644 index 57b0b2d5..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchTransportService/MSFT_xExchTransportService.psm1 +++ /dev/null @@ -1,1562 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscTestsPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.String] - $ActiveUserStatisticsLogMaxAge, - - [System.String] - $ActiveUserStatisticsLogMaxDirectorySize, - - [System.String] - $ActiveUserStatisticsLogMaxFileSize, - - [System.String] - $ActiveUserStatisticsLogPath, - - [System.Boolean] - $AgentLogEnabled, - - [System.String] - $AgentLogMaxAge, - - [System.String] - $AgentLogMaxDirectorySize, - - [System.String] - $AgentLogMaxFileSize, - - [System.String] - $AgentLogPath, - - [System.Boolean] - $ConnectivityLogEnabled, - - [System.String] - $ConnectivityLogMaxAge, - - [System.String] - $ConnectivityLogMaxDirectorySize, - - [System.String] - $ConnectivityLogMaxFileSize, - - [System.String] - $ConnectivityLogPath, - - [System.Boolean] - $ContentConversionTracingEnabled, - - [System.String] - $DelayNotificationTimeout, - - [System.Boolean] - $DnsLogEnabled, - - [System.String] - $DnsLogMaxAge, - - [System.String] - $DnsLogMaxDirectorySize, - - [System.String] - $DnsLogMaxFileSize, - - [System.String] - $DnsLogPath, - - [System.Boolean] - $ExternalDNSAdapterEnabled, - - [System.String] - $ExternalDNSAdapterGuid, - - [ValidateSet("Any","UseTcpOnly","UseUdpOnly")] - [System.String] - $ExternalDNSProtocolOption, - - [System.String[]] - $ExternalDNSServers, - - [System.String] - $ExternalIPAddress, - - [System.Boolean] - $InternalDNSAdapterEnabled, - - [System.String] - $InternalDNSAdapterGuid, - - [ValidateSet("Any","UseTcpOnly","UseUdpOnly")] - [System.String] - $InternalDNSProtocolOption, - - [System.String[]] - $InternalDNSServers, - - [ValidateSet("None","Verbose")] - [System.String] - $IntraOrgConnectorProtocolLoggingLevel, - - [System.Int32] - $IntraOrgConnectorSmtpMaxMessagesPerConnection, - - [System.Boolean] - $IrmLogEnabled, - - [System.String] - $IrmLogMaxAge, - - [System.String] - $IrmLogMaxDirectorySize, - - [System.String] - $IrmLogMaxFileSize, - - [System.String] - $IrmLogPath, - - [System.Int32] - $MaxConcurrentMailboxDeliveries, - - [System.Int32] - $MaxConcurrentMailboxSubmissions, - - [System.Int32] - $MaxConnectionRatePerMinute, - - [ValidateRange(1,2147483647)] - [System.String] - $MaxOutboundConnections, - - [ValidateRange(1,2147483647)] - [System.String] - $MaxPerDomainOutboundConnections, - - [System.String] - $MessageExpirationTimeout, - - [System.String] - $MessageRetryInterval, - - [System.Boolean] - $MessageTrackingLogEnabled, - - [System.String] - $MessageTrackingLogMaxAge, - - [System.String] - $MessageTrackingLogMaxDirectorySize, - - [System.String] - $MessageTrackingLogMaxFileSize, - - [System.String] - $MessageTrackingLogPath, - - [System.Boolean] - $MessageTrackingLogSubjectLoggingEnabled, - - [System.String] - $OutboundConnectionFailureRetryInterval, - - [System.String] - $PickupDirectoryMaxHeaderSize, - - [ValidateRange(1,20000)] - [System.Int32] - $PickupDirectoryMaxMessagesPerMinute, - - [ValidateRange(1,10000)] - [System.Int32] - $PickupDirectoryMaxRecipientsPerMessage, - - [System.String] - $PickupDirectoryPath, - - [System.Boolean] - $PipelineTracingEnabled, - - [System.String] - $PipelineTracingPath, - - [System.String] - $PipelineTracingSenderAddress, - - [System.Boolean] - $PoisonMessageDetectionEnabled, - - [ValidateRange(1,10)] - [System.Int32] - $PoisonThreshold, - - [System.String] - $QueueLogMaxAge, - - [System.String] - $QueueLogMaxDirectorySize, - - [System.String] - $QueueLogMaxFileSize, - - [System.String] - $QueueLogPath, - - [System.String] - $QueueMaxIdleTime, - - [System.String] - $ReceiveProtocolLogMaxAge, - - [System.String] - $ReceiveProtocolLogMaxDirectorySize, - - [System.String] - $ReceiveProtocolLogMaxFileSize, - - [System.String] - $ReceiveProtocolLogPath, - - [System.Boolean] - $RecipientValidationCacheEnabled, - - [System.String] - $ReplayDirectoryPath, - - [System.String] - $RootDropDirectoryPath, - - [System.String] - $RoutingTableLogMaxAge, - - [System.String] - $RoutingTableLogMaxDirectorySize, - - [System.String] - $RoutingTableLogPath, - - [System.String] - $SendProtocolLogMaxAge, - - [System.String] - $SendProtocolLogMaxDirectorySize, - - [System.String] - $SendProtocolLogMaxFileSize, - - [System.String] - $SendProtocolLogPath, - - [System.String] - $ServerStatisticsLogMaxAge, - - [System.String] - $ServerStatisticsLogMaxDirectorySize, - - [System.String] - $ServerStatisticsLogMaxFileSize, - - [System.String] - $ServerStatisticsLogPath, - - [ValidateRange(1,15)] - [System.Int32] - $TransientFailureRetryCount, - - [System.String] - $TransientFailureRetryInterval, - - [System.Boolean] - $UseDowngradedExchangeServerAuth - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-TransportService" -VerbosePreference $VerbosePreference - - #Remove Credential and Ensure so we don't pass it into the next command - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "Credential","AllowServiceRestart" - - $TransportService = Get-TransportService $Identity -ErrorAction SilentlyContinue - if ($null -ne $TransportService) - { - $returnValue = @{ - Identity = $Identity - ActiveUserStatisticsLogMaxAge = $TransportService.ActiveUserStatisticsLogMaxAge - ActiveUserStatisticsLogMaxDirectorySize = $TransportService.ActiveUserStatisticsLogMaxDirectorySize - ActiveUserStatisticsLogMaxFileSize = $TransportService.ActiveUserStatisticsLogMaxFileSize - ActiveUserStatisticsLogPath = $TransportService.ActiveUserStatisticsLogPath - AgentLogEnabled = $TransportService.AgentLogEnabled - AgentLogMaxAge = $TransportService.AgentLogMaxAge - AgentLogMaxDirectorySize = $TransportService.AgentLogMaxDirectorySize - AgentLogMaxFileSize = $TransportService.AgentLogMaxFileSize - AgentLogPath = $TransportService.AgentLogPath - ConnectivityLogEnabled = $TransportService.ConnectivityLogEnabled - ConnectivityLogMaxAge = $TransportService.ConnectivityLogMaxAge - ConnectivityLogMaxDirectorySize = $TransportService.ConnectivityLogMaxDirectorySize - ConnectivityLogMaxFileSize = $TransportService.ConnectivityLogMaxFileSize - ConnectivityLogPath = $TransportService.ConnectivityLogPath - ContentConversionTracingEnabled = $TransportService.ContentConversionTracingEnabled - DelayNotificationTimeout = $TransportService.DelayNotificationTimeout - DnsLogEnabled = $TransportService.DnsLogEnabled - DnsLogMaxAge = $TransportService.DnsLogMaxAge - DnsLogMaxDirectorySize = $TransportService.DnsLogMaxDirectorySize - DnsLogMaxFileSize = $TransportService.DnsLogMaxFileSize - DnsLogPath = $TransportService.DnsLogPath - ExternalDNSAdapterEnabled = $TransportService.ExternalDNSAdapterEnabled - ExternalDNSAdapterGuid = $TransportService.ExternalDNSAdapterGuid - ExternalDNSProtocolOption = $TransportService.ExternalDNSProtocolOption - ExternalDNSServers = $TransportService.ExternalDNSServers.IPAddressToString - ExternalIPAddress = $TransportService.ExternalIPAddress - InternalDNSAdapterEnabled = $TransportService.InternalDNSAdapterEnabled - InternalDNSAdapterGuid = $TransportService.InternalDNSAdapterGuid - InternalDNSProtocolOption = $TransportService.InternalDNSProtocolOption - InternalDNSServers = $TransportService.InternalDNSServers.IPAddressToString - IntraOrgConnectorProtocolLoggingLevel = $TransportService.IntraOrgConnectorProtocolLoggingLevel - IntraOrgConnectorSmtpMaxMessagesPerConnection = $TransportService.IntraOrgConnectorSmtpMaxMessagesPerConnection - IrmLogEnabled = $TransportService.IrmLogEnabled - IrmLogMaxAge = $TransportService.IrmLogMaxAge - IrmLogMaxDirectorySize = $TransportService.IrmLogMaxDirectorySize - IrmLogMaxFileSize = $TransportService.IrmLogMaxFileSize - IrmLogPath = $TransportService.IrmLogPath - MaxConcurrentMailboxDeliveries = $TransportService.MaxConcurrentMailboxDeliveries - MaxConcurrentMailboxSubmissions = $TransportService.MaxConcurrentMailboxSubmissions - MaxConnectionRatePerMinute = $TransportService.MaxConnectionRatePerMinute - MaxOutboundConnections = $TransportService.MaxOutboundConnections - MaxPerDomainOutboundConnections = $TransportService.MaxPerDomainOutboundConnections - MessageExpirationTimeout = $TransportService.MessageExpirationTimeout - MessageRetryInterval = $TransportService.MessageRetryInterval - MessageTrackingLogEnabled = $TransportService.MessageTrackingLogEnabled - MessageTrackingLogMaxAge = $TransportService.MessageTrackingLogMaxAge - MessageTrackingLogMaxDirectorySize = $TransportService.MessageTrackingLogMaxDirectorySize - MessageTrackingLogMaxFileSize = $TransportService.MessageTrackingLogMaxFileSize - MessageTrackingLogPath = $TransportService.MessageTrackingLogPath - MessageTrackingLogSubjectLoggingEnabled = $TransportService.MessageTrackingLogSubjectLoggingEnabled - OutboundConnectionFailureRetryInterval = $TransportService.OutboundConnectionFailureRetryInterval - PickupDirectoryMaxHeaderSize = $TransportService.PickupDirectoryMaxHeaderSize - PickupDirectoryMaxMessagesPerMinute = $TransportService.PickupDirectoryMaxMessagesPerMinute - PickupDirectoryMaxRecipientsPerMessage = $TransportService.PickupDirectoryMaxRecipientsPerMessage - PickupDirectoryPath = $TransportService.PickupDirectoryPath - PipelineTracingEnabled = $TransportService.PipelineTracingEnabled - PipelineTracingPath = $TransportService.PipelineTracingPath - PipelineTracingSenderAddress = $TransportService.PipelineTracingSenderAddress - PoisonMessageDetectionEnabled = $TransportService.PoisonMessageDetectionEnabled - PoisonThreshold = $TransportService.PoisonThreshold - QueueLogMaxAge = $TransportService.QueueLogMaxAge - QueueLogMaxDirectorySize = $TransportService.QueueLogMaxDirectorySize - QueueLogMaxFileSize = $TransportService.QueueLogMaxFileSize - QueueLogPath = $TransportService.QueueLogPath - QueueMaxIdleTime = $TransportService.QueueMaxIdleTime - ReceiveProtocolLogMaxAge = $TransportService.ReceiveProtocolLogMaxAge - ReceiveProtocolLogMaxDirectorySize = $TransportService.ReceiveProtocolLogMaxDirectorySize - ReceiveProtocolLogMaxFileSize = $TransportService.ReceiveProtocolLogMaxFileSize - ReceiveProtocolLogPath = $TransportService.ReceiveProtocolLogPath - RecipientValidationCacheEnabled = $TransportService.RecipientValidationCacheEnabled - ReplayDirectoryPath = $TransportService.ReplayDirectoryPath - RootDropDirectoryPath = $TransportService.RootDropDirectoryPath - RoutingTableLogMaxAge = $TransportService.RoutingTableLogMaxAge - RoutingTableLogMaxDirectorySize = $TransportService.RoutingTableLogMaxDirectorySize - RoutingTableLogPath = $TransportService.RoutingTableLogPath - SendProtocolLogMaxAge = $TransportService.SendProtocolLogMaxAge - SendProtocolLogMaxDirectorySize = $TransportService.SendProtocolLogMaxDirectorySize - SendProtocolLogMaxFileSize = $TransportService.SendProtocolLogMaxFileSize - SendProtocolLogPath = $TransportService.SendProtocolLogPath - ServerStatisticsLogMaxAge = $TransportService.ServerStatisticsLogMaxAge - ServerStatisticsLogMaxDirectorySize = $TransportService.ServerStatisticsLogMaxDirectorySize - ServerStatisticsLogMaxFileSize = $TransportService.ServerStatisticsLogMaxFileSize - ServerStatisticsLogPath = $TransportService.ServerStatisticsLogPath - TransientFailureRetryCount = $TransportService.TransientFailureRetryCount - TransientFailureRetryInterval = $TransportService.TransientFailureRetryInterval.ToString() - UseDowngradedExchangeServerAuth = $TransportService.UseDowngradedExchangeServerAuth - } - } - $returnValue -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.String] - $ActiveUserStatisticsLogMaxAge, - - [System.String] - $ActiveUserStatisticsLogMaxDirectorySize, - - [System.String] - $ActiveUserStatisticsLogMaxFileSize, - - [System.String] - $ActiveUserStatisticsLogPath, - - [System.Boolean] - $AgentLogEnabled, - - [System.String] - $AgentLogMaxAge, - - [System.String] - $AgentLogMaxDirectorySize, - - [System.String] - $AgentLogMaxFileSize, - - [System.String] - $AgentLogPath, - - [System.Boolean] - $ConnectivityLogEnabled, - - [System.String] - $ConnectivityLogMaxAge, - - [System.String] - $ConnectivityLogMaxDirectorySize, - - [System.String] - $ConnectivityLogMaxFileSize, - - [System.String] - $ConnectivityLogPath, - - [System.Boolean] - $ContentConversionTracingEnabled, - - [System.String] - $DelayNotificationTimeout, - - [System.Boolean] - $DnsLogEnabled, - - [System.String] - $DnsLogMaxAge, - - [System.String] - $DnsLogMaxDirectorySize, - - [System.String] - $DnsLogMaxFileSize, - - [System.String] - $DnsLogPath, - - [System.Boolean] - $ExternalDNSAdapterEnabled, - - [System.String] - $ExternalDNSAdapterGuid, - - [ValidateSet("Any","UseTcpOnly","UseUdpOnly")] - [System.String] - $ExternalDNSProtocolOption, - - [System.String[]] - $ExternalDNSServers, - - [System.String] - $ExternalIPAddress, - - [System.Boolean] - $InternalDNSAdapterEnabled, - - [System.String] - $InternalDNSAdapterGuid, - - [ValidateSet("Any","UseTcpOnly","UseUdpOnly")] - [System.String] - $InternalDNSProtocolOption, - - [System.String[]] - $InternalDNSServers, - - [ValidateSet("None","Verbose")] - [System.String] - $IntraOrgConnectorProtocolLoggingLevel, - - [System.Int32] - $IntraOrgConnectorSmtpMaxMessagesPerConnection, - - [System.Boolean] - $IrmLogEnabled, - - [System.String] - $IrmLogMaxAge, - - [System.String] - $IrmLogMaxDirectorySize, - - [System.String] - $IrmLogMaxFileSize, - - [System.String] - $IrmLogPath, - - [System.Int32] - $MaxConcurrentMailboxDeliveries, - - [System.Int32] - $MaxConcurrentMailboxSubmissions, - - [System.Int32] - $MaxConnectionRatePerMinute, - - [ValidateRange(1,2147483647)] - [System.String] - $MaxOutboundConnections, - - [ValidateRange(1,2147483647)] - [System.String] - $MaxPerDomainOutboundConnections, - - [System.String] - $MessageExpirationTimeout, - - [System.String] - $MessageRetryInterval, - - [System.Boolean] - $MessageTrackingLogEnabled, - - [System.String] - $MessageTrackingLogMaxAge, - - [System.String] - $MessageTrackingLogMaxDirectorySize, - - [System.String] - $MessageTrackingLogMaxFileSize, - - [System.String] - $MessageTrackingLogPath, - - [System.Boolean] - $MessageTrackingLogSubjectLoggingEnabled, - - [System.String] - $OutboundConnectionFailureRetryInterval, - - [System.String] - $PickupDirectoryMaxHeaderSize, - - [ValidateRange(1,20000)] - [System.Int32] - $PickupDirectoryMaxMessagesPerMinute, - - [ValidateRange(1,10000)] - [System.Int32] - $PickupDirectoryMaxRecipientsPerMessage, - - [System.String] - $PickupDirectoryPath, - - [System.Boolean] - $PipelineTracingEnabled, - - [System.String] - $PipelineTracingPath, - - [System.String] - $PipelineTracingSenderAddress, - - [System.Boolean] - $PoisonMessageDetectionEnabled, - - [ValidateRange(1,10)] - [System.Int32] - $PoisonThreshold, - - [System.String] - $QueueLogMaxAge, - - [System.String] - $QueueLogMaxDirectorySize, - - [System.String] - $QueueLogMaxFileSize, - - [System.String] - $QueueLogPath, - - [System.String] - $QueueMaxIdleTime, - - [System.String] - $ReceiveProtocolLogMaxAge, - - [System.String] - $ReceiveProtocolLogMaxDirectorySize, - - [System.String] - $ReceiveProtocolLogMaxFileSize, - - [System.String] - $ReceiveProtocolLogPath, - - [System.Boolean] - $RecipientValidationCacheEnabled, - - [System.String] - $ReplayDirectoryPath, - - [System.String] - $RootDropDirectoryPath, - - [System.String] - $RoutingTableLogMaxAge, - - [System.String] - $RoutingTableLogMaxDirectorySize, - - [System.String] - $RoutingTableLogPath, - - [System.String] - $SendProtocolLogMaxAge, - - [System.String] - $SendProtocolLogMaxDirectorySize, - - [System.String] - $SendProtocolLogMaxFileSize, - - [System.String] - $SendProtocolLogPath, - - [System.String] - $ServerStatisticsLogMaxAge, - - [System.String] - $ServerStatisticsLogMaxDirectorySize, - - [System.String] - $ServerStatisticsLogMaxFileSize, - - [System.String] - $ServerStatisticsLogPath, - - [ValidateRange(1,15)] - [System.Int32] - $TransientFailureRetryCount, - - [System.String] - $TransientFailureRetryInterval, - - [System.Boolean] - $UseDowngradedExchangeServerAuth - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Set-TransportService" -VerbosePreference $VerbosePreference - - #Remove Credential and Ensure so we don't pass it into the next command - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "Credential","AllowServiceRestart" - - try - { - - #if PipelineTracingSenderAddress exists and is $null remove it from $PSBoundParameters and add argument - if ($PSBoundParameters.ContainsKey('PipelineTracingSenderAddress')) - { - if ([string]::IsNullOrEmpty($PipelineTracingSenderAddress)) - { - Write-Verbose "PipelineTracingSenderAddress is NULL" - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "PipelineTracingSenderAddress" - $Arguments += '-PipelineTracingSenderAddress $null ' - } - } - - #if ExternalIPAddress exists and is $null remove it from $PSBoundParameters and add argument - if ($PSBoundParameters.ContainsKey('ExternalIPAddress')) - { - if ([string]::IsNullOrEmpty($ExternalIPAddress)) - { - Write-Verbose "ExternalIPAddress is NULL" - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "ExternalIPAddress" - $Arguments += '-ExternalIPAddress $null ' - } - } - - #if InternalDNSServers exists and is $null remove it from $PSBoundParameters and add argument - if ($PSBoundParameters.ContainsKey('InternalDNSServers')) - { - if ([string]::IsNullOrEmpty($InternalDNSServers)) - { - Write-Verbose "InternalDNSServers is NULL" - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "InternalDNSServers" - $Arguments += '-InternalDNSServers $null ' - } - } - - #if ExternalDNSServers exists and is $null remove it from $PSBoundParameters and add argument - if ($PSBoundParameters.ContainsKey('ExternalDNSServers')) - { - if ([string]::IsNullOrEmpty($ExternalDNSServers)) - { - Write-Verbose "ExternalDNSServers is NULL" - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "ExternalDNSServers" - $Arguments += '-ExternalDNSServers $null ' - } - } - - if ($arguments) - { - $expression = 'Set-TransportService @PSBoundParameters '+$Arguments - Invoke-Expression $expression - } - else - { - Set-TransportService @PSBoundParameters - } - } - catch - { - Write-Verbose "The following exception was thrown:$($_.Exception.Message)" - } - - if ($AllowServiceRestart -eq $true) - { - Write-Verbose "Restart service MSExchangeTransport" - Restart-Service -Name MSExchangeTransport -WarningAction SilentlyContinue - } - Else - { - Write-Warning "The configuration will not take effect until the MSExchangeTransport service is manually restarted." - } - -} - -function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.String] - $ActiveUserStatisticsLogMaxAge, - - [System.String] - $ActiveUserStatisticsLogMaxDirectorySize, - - [System.String] - $ActiveUserStatisticsLogMaxFileSize, - - [System.String] - $ActiveUserStatisticsLogPath, - - [System.Boolean] - $AgentLogEnabled, - - [System.String] - $AgentLogMaxAge, - - [System.String] - $AgentLogMaxDirectorySize, - - [System.String] - $AgentLogMaxFileSize, - - [System.String] - $AgentLogPath, - - [System.Boolean] - $ConnectivityLogEnabled, - - [System.String] - $ConnectivityLogMaxAge, - - [System.String] - $ConnectivityLogMaxDirectorySize, - - [System.String] - $ConnectivityLogMaxFileSize, - - [System.String] - $ConnectivityLogPath, - - [System.Boolean] - $ContentConversionTracingEnabled, - - [System.String] - $DelayNotificationTimeout, - - [System.Boolean] - $DnsLogEnabled, - - [System.String] - $DnsLogMaxAge, - - [System.String] - $DnsLogMaxDirectorySize, - - [System.String] - $DnsLogMaxFileSize, - - [System.String] - $DnsLogPath, - - [System.Boolean] - $ExternalDNSAdapterEnabled, - - [System.String] - $ExternalDNSAdapterGuid, - - [ValidateSet("Any","UseTcpOnly","UseUdpOnly")] - [System.String] - $ExternalDNSProtocolOption, - - [System.String[]] - $ExternalDNSServers, - - [System.String] - $ExternalIPAddress, - - [System.Boolean] - $InternalDNSAdapterEnabled, - - [System.String] - $InternalDNSAdapterGuid, - - [ValidateSet("Any","UseTcpOnly","UseUdpOnly")] - [System.String] - $InternalDNSProtocolOption, - - [System.String[]] - $InternalDNSServers, - - [ValidateSet("None","Verbose")] - [System.String] - $IntraOrgConnectorProtocolLoggingLevel, - - [System.Int32] - $IntraOrgConnectorSmtpMaxMessagesPerConnection, - - [System.Boolean] - $IrmLogEnabled, - - [System.String] - $IrmLogMaxAge, - - [System.String] - $IrmLogMaxDirectorySize, - - [System.String] - $IrmLogMaxFileSize, - - [System.String] - $IrmLogPath, - - [System.Int32] - $MaxConcurrentMailboxDeliveries, - - [System.Int32] - $MaxConcurrentMailboxSubmissions, - - [System.Int32] - $MaxConnectionRatePerMinute, - - [ValidateRange(1,2147483647)] - [System.String] - $MaxOutboundConnections, - - [ValidateRange(1,2147483647)] - [System.String] - $MaxPerDomainOutboundConnections, - - [System.String] - $MessageExpirationTimeout, - - [System.String] - $MessageRetryInterval, - - [System.Boolean] - $MessageTrackingLogEnabled, - - [System.String] - $MessageTrackingLogMaxAge, - - [System.String] - $MessageTrackingLogMaxDirectorySize, - - [System.String] - $MessageTrackingLogMaxFileSize, - - [System.String] - $MessageTrackingLogPath, - - [System.Boolean] - $MessageTrackingLogSubjectLoggingEnabled, - - [System.String] - $OutboundConnectionFailureRetryInterval, - - [System.String] - $PickupDirectoryMaxHeaderSize, - - [ValidateRange(1,20000)] - [System.Int32] - $PickupDirectoryMaxMessagesPerMinute, - - [ValidateRange(1,10000)] - [System.Int32] - $PickupDirectoryMaxRecipientsPerMessage, - - [System.String] - $PickupDirectoryPath, - - [System.Boolean] - $PipelineTracingEnabled, - - [System.String] - $PipelineTracingPath, - - [System.String] - $PipelineTracingSenderAddress, - - [System.Boolean] - $PoisonMessageDetectionEnabled, - - [ValidateRange(1,10)] - [System.Int32] - $PoisonThreshold, - - [System.String] - $QueueLogMaxAge, - - [System.String] - $QueueLogMaxDirectorySize, - - [System.String] - $QueueLogMaxFileSize, - - [System.String] - $QueueLogPath, - - [System.String] - $QueueMaxIdleTime, - - [System.String] - $ReceiveProtocolLogMaxAge, - - [System.String] - $ReceiveProtocolLogMaxDirectorySize, - - [System.String] - $ReceiveProtocolLogMaxFileSize, - - [System.String] - $ReceiveProtocolLogPath, - - [System.Boolean] - $RecipientValidationCacheEnabled, - - [System.String] - $ReplayDirectoryPath, - - [System.String] - $RootDropDirectoryPath, - - [System.String] - $RoutingTableLogMaxAge, - - [System.String] - $RoutingTableLogMaxDirectorySize, - - [System.String] - $RoutingTableLogPath, - - [System.String] - $SendProtocolLogMaxAge, - - [System.String] - $SendProtocolLogMaxDirectorySize, - - [System.String] - $SendProtocolLogMaxFileSize, - - [System.String] - $SendProtocolLogPath, - - [System.String] - $ServerStatisticsLogMaxAge, - - [System.String] - $ServerStatisticsLogMaxDirectorySize, - - [System.String] - $ServerStatisticsLogMaxFileSize, - - [System.String] - $ServerStatisticsLogPath, - - [ValidateRange(1,15)] - [System.Int32] - $TransientFailureRetryCount, - - [System.String] - $TransientFailureRetryInterval, - - [System.Boolean] - $UseDowngradedExchangeServerAuth - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-TransportService" -VerbosePreference $VerbosePreference - - $TransportService = Get-TransportService $Identity -ErrorAction SilentlyContinue - - if ($null -ne $TransportService) - { - - if (!(VerifySetting -Name "ActiveUserStatisticsLogMaxAge" -Type "Timespan" -ExpectedValue $ActiveUserStatisticsLogMaxAge -ActualValue $TransportService.ActiveUserStatisticsLogMaxAge -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ActiveUserStatisticsLogMaxDirectorySize" -Type "ByteQuantifiedSize" -ExpectedValue $ActiveUserStatisticsLogMaxDirectorySize -ActualValue $TransportService.ActiveUserStatisticsLogMaxDirectorySize -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ActiveUserStatisticsLogMaxFileSize" -Type "ByteQuantifiedSize" -ExpectedValue $ActiveUserStatisticsLogMaxFileSize -ActualValue $TransportService.ActiveUserStatisticsLogMaxFileSize -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ActiveUserStatisticsLogPath" -Type "String" -ExpectedValue $ActiveUserStatisticsLogPath -ActualValue $TransportService.ActiveUserStatisticsLogPath -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "AgentLogEnabled" -Type "Boolean" -ExpectedValue $AgentLogEnabled -ActualValue $TransportService.AgentLogEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "AgentLogMaxAge" -Type "Timespan" -ExpectedValue $AgentLogMaxAge -ActualValue $TransportService.AgentLogMaxAge -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "AgentLogMaxDirectorySize" -Type "Unlimited" -ExpectedValue $AgentLogMaxDirectorySize -ActualValue $TransportService.AgentLogMaxDirectorySize -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "AgentLogMaxFileSize" -Type "Unlimited" -ExpectedValue $AgentLogMaxFileSize -ActualValue $TransportService.AgentLogMaxFileSize -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "AgentLogPath" -Type "String" -ExpectedValue $AgentLogPath -ActualValue $TransportService.AgentLogPath -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ConnectivityLogEnabled" -Type "Boolean" -ExpectedValue $ConnectivityLogEnabled -ActualValue $TransportService.ConnectivityLogEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ConnectivityLogMaxAge" -Type "Timespan" -ExpectedValue $ConnectivityLogMaxAge -ActualValue $TransportService.ConnectivityLogMaxAge -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ConnectivityLogMaxDirectorySize" -Type "Unlimited" -ExpectedValue $ConnectivityLogMaxDirectorySize -ActualValue $TransportService.ConnectivityLogMaxDirectorySize -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ConnectivityLogMaxFileSize" -Type "Unlimited" -ExpectedValue $ConnectivityLogMaxFileSize -ActualValue $TransportService.ConnectivityLogMaxFileSize -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ConnectivityLogPath" -Type "String" -ExpectedValue $ConnectivityLogPath -ActualValue $TransportService.ConnectivityLogPath -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ContentConversionTracingEnabled" -Type "Boolean" -ExpectedValue $ContentConversionTracingEnabled -ActualValue $TransportService.ContentConversionTracingEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "DelayNotificationTimeout" -Type "TimeSpan" -ExpectedValue $DelayNotificationTimeout -ActualValue $TransportService.DelayNotificationTimeout -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "DnsLogEnabled" -Type "Boolean" -ExpectedValue $DnsLogEnabled -ActualValue $TransportService.DnsLogEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "DnsLogMaxAge" -Type "TimeSpan" -ExpectedValue $DnsLogMaxAge -ActualValue $TransportService.DnsLogMaxAge -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "DnsLogMaxDirectorySize" -Type "Unlimited" -ExpectedValue $DnsLogMaxDirectorySize -ActualValue $TransportService.DnsLogMaxDirectorySize -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "DnsLogMaxFileSize" -Type "Unlimited" -ExpectedValue $DnsLogMaxFileSize -ActualValue $TransportService.DnsLogMaxFileSize -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "DnsLogPath" -Type "String" -ExpectedValue $DnsLogPath -ActualValue $TransportService.DnsLogPath -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ExternalDNSAdapterEnabled" -Type "Boolean" -ExpectedValue $ExternalDNSAdapterEnabled -ActualValue $TransportService.ExternalDNSAdapterEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ExternalDNSAdapterGuid" -Type "String" -ExpectedValue $ExternalDNSAdapterGuid -ActualValue $TransportService.ExternalDNSAdapterGuid -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ExternalDNSProtocolOption" -Type "String" -ExpectedValue $ExternalDNSProtocolOption -ActualValue $TransportService.ExternalDNSProtocolOption -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ExternalDNSServers" -Type "IPAddresses" -ExpectedValue $ExternalDNSServers -ActualValue $TransportService.ExternalDNSServers.IPAddressToString -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ExternalIPAddress" -Type "IPAddress" -ExpectedValue $ExternalIPAddress -ActualValue $TransportService.ExternalIPAddress -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "InternalDNSAdapterEnabled" -Type "Boolean" -ExpectedValue $InternalDNSAdapterEnabled -ActualValue $TransportService.InternalDNSAdapterEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "InternalDNSAdapterGuid" -Type "String" -ExpectedValue $InternalDNSAdapterGuid -ActualValue $TransportService.InternalDNSAdapterGuid -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "InternalDNSProtocolOption" -Type "String" -ExpectedValue $InternalDNSProtocolOption -ActualValue $TransportService.InternalDNSProtocolOption -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "InternalDNSServers" -Type "IPAddresses" -ExpectedValue $InternalDNSServers -ActualValue $TransportService.InternalDNSServers.IPAddressToString -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "IntraOrgConnectorProtocolLoggingLevel" -Type "String" -ExpectedValue $IntraOrgConnectorProtocolLoggingLevel -ActualValue $TransportService.IntraOrgConnectorProtocolLoggingLevel -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "IntraOrgConnectorSmtpMaxMessagesPerConnection" -Type "Int" -ExpectedValue $IntraOrgConnectorSmtpMaxMessagesPerConnection -ActualValue $TransportService.IntraOrgConnectorSmtpMaxMessagesPerConnection -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "IrmLogEnabled" -Type "Boolean" -ExpectedValue $IrmLogEnabled -ActualValue $TransportService.IrmLogEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "IrmLogMaxAge" -Type "TimeSpan" -ExpectedValue $IrmLogMaxAge -ActualValue $TransportService.IrmLogMaxAge -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "IrmLogMaxDirectorySize" -Type "Unlimited" -ExpectedValue $IrmLogMaxDirectorySize -ActualValue $TransportService.IrmLogMaxDirectorySize -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "IrmLogMaxFileSize" -Type "ByteQuantifiedSize" -ExpectedValue $IrmLogMaxFileSize -ActualValue $TransportService.IrmLogMaxFileSize -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "IrmLogPath" -Type "String" -ExpectedValue $IrmLogPath -ActualValue $TransportService.IrmLogPath -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MaxConcurrentMailboxDeliveries" -Type "Int" -ExpectedValue $MaxConcurrentMailboxDeliveries -ActualValue $TransportService.MaxConcurrentMailboxDeliveries -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MaxConcurrentMailboxSubmissions" -Type "Int" -ExpectedValue $MaxConcurrentMailboxSubmissions -ActualValue $TransportService.MaxConcurrentMailboxSubmissions -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MaxConnectionRatePerMinute" -Type "Int" -ExpectedValue $MaxConnectionRatePerMinute -ActualValue $TransportService.MaxConnectionRatePerMinute -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MaxOutboundConnections" -Type "Unlimited" -ExpectedValue $MaxOutboundConnections -ActualValue $TransportService.MaxOutboundConnections -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MaxPerDomainOutboundConnections" -Type "Unlimited" -ExpectedValue $MaxPerDomainOutboundConnections -ActualValue $TransportService.MaxPerDomainOutboundConnections -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MessageExpirationTimeout" -Type "TimeSpan" -ExpectedValue $MessageExpirationTimeout -ActualValue $TransportService.MessageExpirationTimeout -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MessageRetryInterval" -Type "TimeSpan" -ExpectedValue $MessageRetryInterval -ActualValue $TransportService.MessageRetryInterval -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MessageTrackingLogEnabled" -Type "Boolean" -ExpectedValue $MessageTrackingLogEnabled -ActualValue $TransportService.MessageTrackingLogEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MessageTrackingLogMaxAge" -Type "TimeSpan" -ExpectedValue $MessageTrackingLogMaxAge -ActualValue $TransportService.MessageTrackingLogMaxAge -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MessageTrackingLogMaxDirectorySize" -Type "Unlimited" -ExpectedValue $MessageTrackingLogMaxDirectorySize -ActualValue $TransportService.MessageTrackingLogMaxDirectorySize -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MessageTrackingLogMaxFileSize" -Type "ByteQuantifiedSize" -ExpectedValue $MessageTrackingLogMaxFileSize -ActualValue $TransportService.MessageTrackingLogMaxFileSize -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MessageTrackingLogPath" -Type "String" -ExpectedValue $MessageTrackingLogPath -ActualValue $TransportService.MessageTrackingLogPath -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "MessageTrackingLogSubjectLoggingEnabled" -Type "Boolean" -ExpectedValue $MessageTrackingLogSubjectLoggingEnabled -ActualValue $TransportService.MessageTrackingLogSubjectLoggingEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "OutboundConnectionFailureRetryInterval" -Type "TimeSpan" -ExpectedValue $OutboundConnectionFailureRetryInterval -ActualValue $TransportService.OutboundConnectionFailureRetryInterval -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "PickupDirectoryMaxHeaderSize" -Type "ByteQuantifiedSize" -ExpectedValue $PickupDirectoryMaxHeaderSize -ActualValue $TransportService.PickupDirectoryMaxHeaderSize -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "PickupDirectoryMaxMessagesPerMinute" -Type "Int" -ExpectedValue $PickupDirectoryMaxMessagesPerMinute -ActualValue $TransportService.PickupDirectoryMaxMessagesPerMinute -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "PickupDirectoryMaxRecipientsPerMessage" -Type "Int" -ExpectedValue $PickupDirectoryMaxRecipientsPerMessage -ActualValue $TransportService.PickupDirectoryMaxRecipientsPerMessage -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "PickupDirectoryPath" -Type "String" -ExpectedValue $PickupDirectoryPath -ActualValue $TransportService.PickupDirectoryPath -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "PipelineTracingEnabled" -Type "Boolean" -ExpectedValue $PipelineTracingEnabled -ActualValue $TransportService.PipelineTracingEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "PipelineTracingPath" -Type "String" -ExpectedValue $PipelineTracingPath -ActualValue $TransportService.PipelineTracingPath -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - - if (!(VerifySetting -Name "PipelineTracingSenderAddress" -Type "SMTPAddress" -ExpectedValue $PipelineTracingSenderAddress -ActualValue $TransportService.PipelineTracingSenderAddress -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "PoisonMessageDetectionEnabled" -Type "Boolean" -ExpectedValue $PoisonMessageDetectionEnabled -ActualValue $TransportService.PoisonMessageDetectionEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "PoisonThreshold" -Type "Int" -ExpectedValue $PoisonThreshold -ActualValue $TransportService.PoisonThreshold -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "QueueLogMaxAge" -Type "TimeSpan" -ExpectedValue $QueueLogMaxAge -ActualValue $TransportService.QueueLogMaxAge -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "QueueLogMaxDirectorySize" -Type "Unlimited" -ExpectedValue $QueueLogMaxDirectorySize -ActualValue $TransportService.QueueLogMaxDirectorySize -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "QueueLogMaxFileSize" -Type "Unlimited" -ExpectedValue $QueueLogMaxFileSize -ActualValue $TransportService.QueueLogMaxFileSize -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "QueueLogPath" -Type "String" -ExpectedValue $QueueLogPath -ActualValue $TransportService.QueueLogPath -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "QueueMaxIdleTime" -Type "TimeSpan" -ExpectedValue $QueueMaxIdleTime -ActualValue $TransportService.QueueMaxIdleTime -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ReceiveProtocolLogMaxAge" -Type "TimeSpan" -ExpectedValue $ReceiveProtocolLogMaxAge -ActualValue $TransportService.ReceiveProtocolLogMaxAge -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ReceiveProtocolLogMaxDirectorySize" -Type "Unlimited" -ExpectedValue $ReceiveProtocolLogMaxDirectorySize -ActualValue $TransportService.ReceiveProtocolLogMaxDirectorySize -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ReceiveProtocolLogMaxFileSize" -Type "Unlimited" -ExpectedValue $ReceiveProtocolLogMaxFileSize -ActualValue $TransportService.ReceiveProtocolLogMaxFileSize -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ReceiveProtocolLogPath" -Type "String" -ExpectedValue $ReceiveProtocolLogPath -ActualValue $TransportService.ReceiveProtocolLogPath -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "RecipientValidationCacheEnabled" -Type "Boolean" -ExpectedValue $RecipientValidationCacheEnabled -ActualValue $TransportService.RecipientValidationCacheEnabled -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - if (!(VerifySetting -Name "ReplayDirectoryPath" -Type "String" -ExpectedValue $ReplayDirectoryPath -ActualValue $TransportService.ReplayDirectoryPath -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "RootDropDirectoryPath" -Type "String" -ExpectedValue $RootDropDirectoryPath -ActualValue $TransportService.RootDropDirectoryPath -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "RoutingTableLogMaxAge" -Type "TimeSpan" -ExpectedValue $RoutingTableLogMaxAge -ActualValue $TransportService.RoutingTableLogMaxAge -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "RoutingTableLogMaxDirectorySize" -Type "Unlimited" -ExpectedValue $RoutingTableLogMaxDirectorySize -ActualValue $TransportService.RoutingTableLogMaxDirectorySize -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "RoutingTableLogPath" -Type "String" -ExpectedValue $RoutingTableLogPath -ActualValue $TransportService.RoutingTableLogPath -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "SendProtocolLogMaxAge" -Type "TimeSpan" -ExpectedValue $SendProtocolLogMaxAge -ActualValue $TransportService.SendProtocolLogMaxAge -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "SendProtocolLogMaxDirectorySize" -Type "Unlimited" -ExpectedValue $SendProtocolLogMaxDirectorySize -ActualValue $TransportService.SendProtocolLogMaxDirectorySize -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "SendProtocolLogMaxFileSize" -Type "Unlimited" -ExpectedValue $SendProtocolLogMaxFileSize -ActualValue $TransportService.SendProtocolLogMaxFileSize -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "SendProtocolLogPath" -Type "String" -ExpectedValue $SendProtocolLogPath -ActualValue $TransportService.SendProtocolLogPath -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ServerStatisticsLogMaxAge" -Type "TimeSpan" -ExpectedValue $ServerStatisticsLogMaxAge -ActualValue $TransportService.ServerStatisticsLogMaxAge -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ServerStatisticsLogMaxDirectorySize" -Type "ByteQuantifiedSize" -ExpectedValue $ServerStatisticsLogMaxDirectorySize -ActualValue $TransportService.ServerStatisticsLogMaxDirectorySize -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ServerStatisticsLogMaxFileSize" -Type "ByteQuantifiedSize" -ExpectedValue $ServerStatisticsLogMaxFileSize -ActualValue $TransportService.ServerStatisticsLogMaxFileSize -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ServerStatisticsLogPath" -Type "String" -ExpectedValue $ServerStatisticsLogPath -ActualValue $TransportService.ServerStatisticsLogPath -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "TransientFailureRetryCount" -Type "Int" -ExpectedValue $TransientFailureRetryCount -ActualValue $TransportService.TransientFailureRetryCount -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "TransientFailureRetryInterval" -Type "TimeSpan" -ExpectedValue $TransientFailureRetryInterval -ActualValue $TransportService.TransientFailureRetryInterval -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "UseDowngradedExchangeServerAuth" -Type "Boolean" -ExpectedValue $UseDowngradedExchangeServerAuth -ActualValue $TransportService.UseDowngradedExchangeServerAuth -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - } - else - { - return $false - } - return $true -} - -function CompareIPAddressewithString -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param([System.Net.IPAddress]$IPAddress, [String]$String) - if (($null -eq $IPAddress -and !([string]::IsNullOrEmpty($String))) -or ($null -ne $IPAddress -and [string]::IsNullOrEmpty($String))) - { - $returnValue = $false - } - elseif ($null -eq $IPAddress -and [string]::IsNullOrEmpty($String)) - { - $returnValue = $true - } - else - { - $returnValue =($IPAddress.Equals([System.Net.IPAddress]::Parse($string))) - } - - if ($returnValue -eq $false) - { - ReportBadSetting -SettingName $IPAddress -ExpectedValue $ExpectedValue -ActualValue $IPAddress -VerbosePreference $VerbosePreference - } - return $returnValue -} - -function CompareSmtpAdresswithString -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param($SmtpAddress,[String]$String) - if (($null -eq $SmtpAddress) -and ([string]::IsNullOrEmpty($String))) - { - Write-Verbose "Expected and actual value is empty, therefore equal!" - return $true - } - elseif (($null -eq $SmtpAddress) -and -not ([string]::IsNullOrEmpty($String))) - { - return $false - } - elseif ($SmtpAddress.Gettype() -eq [Microsoft.Exchange.Data.SmtpAddress]) - { - if ([string]::IsNullOrEmpty($String)) - { - return $false - } - else - { - return($SmtpAddress.Equals([Microsoft.Exchange.Data.SmtpAddress]::Parse($string))) - } - } - else - { - Write-Verbose "No type of [Microsoft.Exchange.Data.SmtpAddress]!" - return $false - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchTransportService/MSFT_xExchTransportService.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchTransportService/MSFT_xExchTransportService.schema.mof deleted file mode 100644 index d49936a4..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchTransportService/MSFT_xExchTransportService.schema.mof +++ /dev/null @@ -1,93 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xExchTransportService")] -class MSFT_xExchTransportService : OMI_BaseResource -{ - [Key] String Identity; //Exchange server - [Required, EmbeddedInstance("MSFT_Credential")] String Credential; //Credentials used to establish a remote Powershell session to Exchange - [Write] Boolean AllowServiceRestart; //Whether it is OK to restart service MSExchangeTransport; - [Write] String ActiveUserStatisticsLogMaxAge; - [Write] String ActiveUserStatisticsLogMaxDirectorySize; - [Write] String ActiveUserStatisticsLogMaxFileSize; - [Write] String ActiveUserStatisticsLogPath; - [Write] Boolean AgentLogEnabled; - [Write] String AgentLogMaxAge; - [Write] String AgentLogMaxDirectorySize; - [Write] String AgentLogMaxFileSize; - [Write] String AgentLogPath; - [Write] Boolean ConnectivityLogEnabled; - [Write] String ConnectivityLogMaxAge; - [Write] String ConnectivityLogMaxDirectorySize; - [Write] String ConnectivityLogMaxFileSize; - [Write] String ConnectivityLogPath; - [Write] Boolean ContentConversionTracingEnabled; - [Write] String DelayNotificationTimeout; - [Write] Boolean DnsLogEnabled; - [Write] String DnsLogMaxAge; - [Write] String DnsLogMaxDirectorySize; - [Write] String DnsLogMaxFileSize; - [Write] String DnsLogPath; - [Write] Boolean ExternalDNSAdapterEnabled; - [Write] String ExternalDNSAdapterGuid; - [Write,ValueMap{"Any","UseTcpOnly","UseUdpOnly"}, Values{"Any","UseTcpOnly","UseUdpOnly"}] String ExternalDNSProtocolOption; - [Write] String ExternalDNSServers[]; - [Write] String ExternalIPAddress; - [Write] Boolean InternalDNSAdapterEnabled; - [Write] String InternalDNSAdapterGuid; - [Write,ValueMap{"Any","UseTcpOnly","UseUdpOnly"}, Values{"Any","UseTcpOnly","UseUdpOnly"}] String InternalDNSProtocolOption; - [Write] String InternalDNSServers[]; - [Write,ValueMap{"None","Verbose"}, Values{"None","Verbose"}] String IntraOrgConnectorProtocolLoggingLevel; - [Write] SInt32 IntraOrgConnectorSmtpMaxMessagesPerConnection; - [Write] Boolean IrmLogEnabled; - [Write] String IrmLogMaxAge; - [Write] String IrmLogMaxDirectorySize; - [Write] String IrmLogMaxFileSize; - [Write] String IrmLogPath; - [Write] SInt32 MaxConcurrentMailboxDeliveries; - [Write] SInt32 MaxConcurrentMailboxSubmissions; - [Write] SInt32 MaxConnectionRatePerMinute; - [Write] String MaxOutboundConnections; - [Write] String MaxPerDomainOutboundConnections; - [Write] String MessageExpirationTimeout; - [Write] String MessageRetryInterval; - [Write] Boolean MessageTrackingLogEnabled; - [Write] String MessageTrackingLogMaxAge; - [Write] String MessageTrackingLogMaxDirectorySize; - [Write] String MessageTrackingLogMaxFileSize; - [Write] String MessageTrackingLogPath; - [Write] Boolean MessageTrackingLogSubjectLoggingEnabled; - [Write] String OutboundConnectionFailureRetryInterval; - [Write] String PickupDirectoryMaxHeaderSize; - [Write] SInt32 PickupDirectoryMaxMessagesPerMinute; - [Write] SInt32 PickupDirectoryMaxRecipientsPerMessage; - [Write] String PickupDirectoryPath; - [Write] Boolean PipelineTracingEnabled; - [Write] String PipelineTracingPath; - [Write] String PipelineTracingSenderAddress; - [Write] Boolean PoisonMessageDetectionEnabled; - [Write] SInt32 PoisonThreshold; - [Write] String QueueLogMaxAge; - [Write] String QueueLogMaxDirectorySize; - [Write] String QueueLogMaxFileSize; - [Write] String QueueLogPath; - [Write] String QueueMaxIdleTime; - [Write] String ReceiveProtocolLogMaxAge; - [Write] String ReceiveProtocolLogMaxDirectorySize; - [Write] String ReceiveProtocolLogMaxFileSize; - [Write] String ReceiveProtocolLogPath; - [Write] Boolean RecipientValidationCacheEnabled; - [Write] String ReplayDirectoryPath; - [Write] String RootDropDirectoryPath; - [Write] String RoutingTableLogMaxAge; - [Write] String RoutingTableLogMaxDirectorySize; - [Write] String RoutingTableLogPath; - [Write] String SendProtocolLogMaxAge; - [Write] String SendProtocolLogMaxDirectorySize; - [Write] String SendProtocolLogMaxFileSize; - [Write] String SendProtocolLogPath; - [Write] String ServerStatisticsLogMaxAge; - [Write] String ServerStatisticsLogMaxDirectorySize; - [Write] String ServerStatisticsLogMaxFileSize; - [Write] String ServerStatisticsLogPath; - [Write] SInt32 TransientFailureRetryCount; - [Write] String TransientFailureRetryInterval; - [Write] Boolean UseDowngradedExchangeServerAuth; -}; diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchUMCallRouterSettings/MSFT_xExchUMCallRouterSettings.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchUMCallRouterSettings/MSFT_xExchUMCallRouterSettings.psm1 deleted file mode 100644 index 3be3782b..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchUMCallRouterSettings/MSFT_xExchUMCallRouterSettings.psm1 +++ /dev/null @@ -1,143 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscTestsPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Server, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [ValidateSet("TCP","TLS","Dual")] - [System.String] - $UMStartupMode, - - [System.String] - $DomainController - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Server" = $Server} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "*UMCallRouterSettings" -VerbosePreference $VerbosePreference - - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Server","DomainController" - - $umService = Get-UMCallRouterSettings @PSBoundParameters - - if ($null -ne $umService) - { - $returnValue = @{ - Server = $Server - UMStartupMode = $umService.UMStartupMode - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Server, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [ValidateSet("TCP","TLS","Dual")] - [System.String] - $UMStartupMode, - - [System.String] - $DomainController - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Server" = $Server} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "*UMCallRouterSettings" -VerbosePreference $VerbosePreference - - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "Credential" - - Set-UMCallRouterSettings @PSBoundParameters -} - - -function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Server, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [ValidateSet("TCP","TLS","Dual")] - [System.String] - $UMStartupMode, - - [System.String] - $DomainController - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Server" = $Server} -VerbosePreference $VerbosePreference - - $umService = Get-TargetResource @PSBoundParameters - - if ($null -eq $umService) - { - return $false - } - else - { - if (!(VerifySetting -Name "UMStartupMode" -Type "String" -ExpectedValue $UMStartupMode -ActualValue $umService.UMStartupMode -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - } - - return $true -} - - -Export-ModuleMember -Function *-TargetResource - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchUMCallRouterSettings/MSFT_xExchUMCallRouterSettings.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchUMCallRouterSettings/MSFT_xExchUMCallRouterSettings.schema.mof deleted file mode 100644 index 5e24123f..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchUMCallRouterSettings/MSFT_xExchUMCallRouterSettings.schema.mof +++ /dev/null @@ -1,12 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xExchUMCallRouterSettings")] -class MSFT_xExchUMCallRouterSettings : OMI_BaseResource -{ - [Key, Description("Hostname of the UM server to configure")] String Server; - [Required, Description("Credentials used to establish a remote Powershell session to Exchange"), EmbeddedInstance("MSFT_Credential")] String Credential; - [Required, Description("UMStartupMode for the UM call router"), ValueMap{"TCP","TLS","Dual"}, Values{"TCP","TLS","Dual"}] String UMStartupMode; - [Write, Description("Optional Domain Controller to connect to")] String DomainController; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchUMService/MSFT_xExchUMService.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchUMService/MSFT_xExchUMService.psm1 deleted file mode 100644 index a2ae3620..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchUMService/MSFT_xExchUMService.psm1 +++ /dev/null @@ -1,154 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscTestsPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [ValidateSet("TCP","TLS","Dual")] - [System.String] - $UMStartupMode, - - [System.String[]] - $DialPlans, - - [System.String] - $DomainController - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "*UMService" -VerbosePreference $VerbosePreference - - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Identity","DomainController" - - $umService = Get-UMService @PSBoundParameters - - if ($null -ne $umService) - { - $returnValue = @{ - Identity = $Identity - UMStartupMode = $umService.UMStartupMode - DialPlans = $umService.DialPlans.Name - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [ValidateSet("TCP","TLS","Dual")] - [System.String] - $UMStartupMode, - - [System.String[]] - $DialPlans, - - [System.String] - $DomainController - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "*UMService" -VerbosePreference $VerbosePreference - - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "Credential" - - Set-UMService @PSBoundParameters -} - - -function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [parameter(Mandatory = $true)] - [ValidateSet("TCP","TLS","Dual")] - [System.String] - $UMStartupMode, - - [System.String[]] - $DialPlans, - - [System.String] - $DomainController - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - $umService = Get-TargetResource @PSBoundParameters - - if ($null -eq $umService) - { - return $false - } - else - { - if (!(VerifySetting -Name "UMStartupMode" -Type "String" -ExpectedValue $UMStartupMode -ActualValue $umService.UMStartupMode -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - if (!(VerifySetting -Name "DialPlans" -Type "Array" -ExpectedValue $DialPlans -ActualValue $umService.DialPlans -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - } - - return $true -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchUMService/MSFT_xExchUMService.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchUMService/MSFT_xExchUMService.schema.mof deleted file mode 100644 index 93e3afc2..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchUMService/MSFT_xExchUMService.schema.mof +++ /dev/null @@ -1,13 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xExchUMService")] -class MSFT_xExchUMService : OMI_BaseResource -{ - [Key] String Identity; //Hostname of the UM server to configure - [Required, EmbeddedInstance("MSFT_Credential")] String Credential; //Credentials used to establish a remote Powershell session to Exchange - [Required, ValueMap{"TCP","TLS","Dual"}, Values{"TCP","TLS","Dual"}] String UMStartupMode; //UMStartupMode for the UM server - [Write] String DialPlans[]; //Specifies all dial plans that the Unified Messaging service handles incoming calls for - [Write] String DomainController; //Optional Domain Controller to connect to -}; - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchWaitForADPrep/MSFT_xExchWaitForADPrep.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchWaitForADPrep/MSFT_xExchWaitForADPrep.psm1 deleted file mode 100644 index a5bb52f8..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchWaitForADPrep/MSFT_xExchWaitForADPrep.psm1 +++ /dev/null @@ -1,416 +0,0 @@ -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Int32] - $SchemaVersion, - - [System.Int32] - $OrganizationVersion, - - [System.Int32] - $DomainVersion, - - [System.String[]] - $ExchangeDomains, - - [System.UInt32] - $RetryIntervalSec = 60, - - [System.UInt32] - $RetryCount = 30 - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -VerbosePreference $VerbosePreference - - $dse = GetADRootDSE -Credential $Credential - - if ($PSBoundParameters.ContainsKey("SchemaVersion")) - { - #Check for existence of schema object - $schemaObj = GetADObject -Credential $credential -DistinguishedName "CN=ms-Exch-Schema-Version-Pt,$($dse.schemaNamingContext)" -Properties "rangeUpper" - - if ($null -ne $schemaObj) - { - $currentSchemaVersion = $schemaObj.rangeUpper - } - else - { - Write-Warning "Unable to find schema object 'CN=ms-Exch-Schema-Version-Pt,$($dse.schemaNamingContext)'. This is either because Exchange /PrepareSchema has not been run, or because the configured account does not have permissions to access this object." - } - } - - if ($PSBoundParameters.ContainsKey("OrganizationVersion")) - { - $exchangeContainer = GetADObject -Credential $credential -DistinguishedName "CN=Microsoft Exchange,CN=Services,$($dse.configurationNamingContext)" -Properties "rangeUpper" - - if ($null -ne $exchangeContainer) - { - $orgContainer = GetADObject -Credential $Credential -Searching $true -DistinguishedName "CN=Microsoft Exchange,CN=Services,$($dse.configurationNamingContext)" -Properties "objectVersion" -Filter "objectClass -like 'msExchOrganizationContainer'" -SearchScope "OneLevel" - - if ($null -ne $orgContainer) - { - $currentOrganizationVersion = $orgContainer.objectVersion - } - else - { - Write-Warning "Unable to find any objects of class msExchOrganizationContainer under 'CN=Microsoft Exchange,CN=Services,$($dse.configurationNamingContext)'. This is either because Exchange /PrepareAD has not been run, or because the configured account does not have permissions to access this object." - } - } - else - { - Write-Warning "Unable to find Exchange Configuration Container at 'CN=Microsoft Exchange,CN=Services,$($dse.configurationNamingContext)'. This is either because Exchange /PrepareAD has not been run, or because the configured account does not have permissions to access this object." - } - } - - if ($PSBoundParameters.ContainsKey("DomainVersion")) - { - #Get this server's domain - [string]$machineDomain = (Get-CimInstance -ClassName Win32_ComputerSystem).Domain.ToLower() - - #Figure out all domains we need to inspect - [string[]]$targetDomains = @() - $targetDomains += $machineDomain - - if ($null -ne $ExchangeDomains) - { - foreach ($domain in $ExchangeDomains) - { - $domainLower = $domain.ToLower() - - if ($targetDomains.Contains($domainLower) -eq $false) - { - $targetDomains += $domainLower - } - } - } - - #Populate the return value in a hashtable of domains and versions - [Hashtable]$currentDomainVersions = @{} - - foreach ($domain in $targetDomains) - { - $domainDn = DomainDNFromFQDN -Fqdn $domain - - $mesoContainer = GetADObject -Credential $Credential -DistinguishedName "CN=Microsoft Exchange System Objects,$($domainDn)" -Properties "objectVersion" - - $mesoVersion = $null - - if ($null -ne $mesoContainer) - { - $mesoVersion = $mesoContainer.objectVersion - } - else - { - Write-Warning "Unable to find object with DN 'CN=Microsoft Exchange System Objects,$($domainDn)'. This is either because Exchange /PrepareDomain has not been run for this domain, or because the configured account does not have permissions to access this object." - } - - if ($null -eq $currentDomainVersions) - { - $currentDomainVersions = @{$domain = $mesoVersion} - } - else - { - $currentDomainVersions.Add($domain, $mesoVersion) - } - } - } - - $returnValue = @{ - SchemaVersion = $currentSchemaVersion - OrganizationVersion = $currentOrganizationVersion - DomainVersion = $currentDomainVersions - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Int32] - $SchemaVersion, - - [System.Int32] - $OrganizationVersion, - - [System.Int32] - $DomainVersion, - - [System.String[]] - $ExchangeDomains, - - [System.UInt32] - $RetryIntervalSec = 60, - - [System.UInt32] - $RetryCount = 30 - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -VerbosePreference $VerbosePreference - - $testResults = Test-TargetResource @PSBoundParameters - - for ($i = 0; $i -lt $RetryCount; $i++) - { - if ($testResults -eq $false) - { - Write-Verbose "AD has still not been fully prepped as of $([DateTime]::Now). Sleeping for $($RetryIntervalSec) seconds." - Start-Sleep -Seconds $RetryIntervalSec - - $testResults = Test-TargetResource @PSBoundParameters - } - else - { - break - } - } - - if ($testResults -eq $false) - { - throw "AD has still not been prepped after the maximum amount of retries." - } -} - - -function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Int32] - $SchemaVersion, - - [System.Int32] - $OrganizationVersion, - - [System.Int32] - $DomainVersion, - - [System.String[]] - $ExchangeDomains, - - [System.UInt32] - $RetryIntervalSec = 60, - - [System.UInt32] - $RetryCount = 30 - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -VerbosePreference $VerbosePreference - - $adStatus = Get-TargetResource @PSBoundParameters - - $returnValue = $true - - if ($null -eq $adStatus) - { - $returnValue = $false - } - else - { - if (!(VerifySetting -Name "SchemaVersion" -Type "Int" -ExpectedValue $SchemaVersion -ActualValue $adStatus.SchemaVersion -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - $returnValue = $false - } - - if (!(VerifySetting -Name "OrganizationVersion" -Type "Int" -ExpectedValue $OrganizationVersion -ActualValue $adStatus.OrganizationVersion -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - $returnValue = $false - } - - if ($PSBoundParameters.ContainsKey("DomainVersion")) - { - #Get this server's domain - [string]$machineDomain = (Get-CimInstance -ClassName Win32_ComputerSystem).Domain.ToLower() - - #Figure out all domains we need to inspect - [string[]]$targetDomains = @() - $targetDomains += $machineDomain - - if ($null -ne $ExchangeDomains) - { - foreach ($domain in $ExchangeDomains) - { - $domainLower = $domain.ToLower() - - if ($targetDomains.Contains($domainLower) -eq $false) - { - $targetDomains += $domainLower - } - } - } - - #Compare the desired DomainVersion with the actual version of each domain - foreach ($domain in $targetDomains) - { - if (!(VerifySetting -Name "DomainVersion" -Type "Int" -ExpectedValue $DomainVersion -ActualValue $adStatus.DomainVersion[$domain] -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - $returnValue = $false - } - } - } - } - - return $returnValue -} - -function GetADRootDSE -{ - param - ( - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential - ) - - if ($null -eq $Credential) - { - $dse = Get-ADRootDSE -ErrorAction SilentlyContinue -ErrorVariable errVar - } - else - { - $dse = Get-ADRootDSE -Credential $Credential -ErrorAction SilentlyContinue -ErrorVariable errVar - } - - return $dse -} - -function GetADObject -{ - param - ( - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [boolean] - $Searching = $false, - - [string] - $DistinguishedName, - - [string[]] - $Properties, - - [string] - $Filter, - - [string] - $SearchScope - ) - - if ($Searching -eq $false) - { - $getAdObjParams = @{"Identity" = $DistinguishedName} - } - else - { - $getAdObjParams = @{"SearchBase" = $DistinguishedName} - - if ([string]::IsNullOrEmpty($Filter) -eq $false) - { - $getAdObjParams.Add("Filter", $Filter) - } - - if ([string]::IsNullOrEmpty($SearchScope) -eq $false) - { - $getAdObjParams.Add("SearchScope", $SearchScope) - } - } - - if ($null -ne $Credential) - { - $getAdObjParams.Add("Credential", $Credential) - } - - if ([string]::IsNullOrEmpty($Properties) -eq $false) - { - $getAdObjParams.Add("Properties", $Properties) - } - - #ErrorAction SilentlyContinue doesn't seem to work with Get-ADObject. Doing in Try/Catch instead - try - { - $object = Get-ADObject @getAdObjParams - } - catch - { - Write-Warning "Failed to find object at '$DistinguishedName' using Get-ADObject." - } - - return $object -} - -function DomainDNFromFQDN -{ - param([string]$Fqdn) - - if ($Fqdn.Contains('.')) - { - $domainParts = $Fqdn.Split('.') - - $domainDn = "DC=$($domainParts[0])" - - for ($i = 1; $i -lt $domainParts.Count; $i++) - { - $domainDn = "$($domainDn),DC=$($domainParts[$i])" - } - } - elseif ($Fqdn.Length -gt 0) - { - $domainDn = "DC=$($Fqdn)" - } - else - { - throw "Empty value specified for domain name" - } - - return $domainDn -} - -Export-ModuleMember -Function *-TargetResource - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchWaitForADPrep/MSFT_xExchWaitForADPrep.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchWaitForADPrep/MSFT_xExchWaitForADPrep.schema.mof deleted file mode 100644 index 88a19a41..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchWaitForADPrep/MSFT_xExchWaitForADPrep.schema.mof +++ /dev/null @@ -1,20 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xExchWaitForADPrep")] -class MSFT_xExchWaitForADPrep : OMI_BaseResource -{ - [Key, Description("Not actually used. Enter anything, as long as it's not null")] String Identity; - [Write, Description("Credentials used to perform Active Directory lookups against the Schema, Configuration, and Domain naming contexts"), EmbeddedInstance("MSFT_Credential")] String Credential; - - //To find appropriate values for the next three properties, consult the 'Exchange 2013 Active Directory versions' setion - //of the following article: - //Prepare Active Directory and domains - //http://technet.microsoft.com/en-us/library/bb125224(v=exchg.150).aspx - [Write, Description("Specifies that the Active Directory schema should have been prepared using Exchange 2013 'setup /PrepareSchema', and should be at the specified version")] Sint32 SchemaVersion; - [Write, Description("Specifies that the Exchange Organization should have been prepared using Exchange 2013 'setup /PrepareAD', and should be at the specified version")] Sint32 OrganizationVersion; - [Write, Description("Specifies that the domain containing the target Exchange 2013 server was prepared using setup /PrepareAD, /PrepareDomain, or /PrepareAllDomains, and should be at the specified version")] Sint32 DomainVersion; - - [Write, Description("The FQDN's of domains that should be checked for DomainVersion in addition to the domain that this Exchange server belongs to")] String ExchangeDomains[]; - [Write, Description("How many seconds to wait between retries when checking whether AD has been prepped. Defaults to 60.")] Uint32 RetryIntervalSec; - [Write, Description("How many retry attempts should be made to see if AD has been prepped before an exception is thrown. Defaults to 30.")] Uint32 RetryCount; -}; - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchWaitForDAG/MSFT_xExchWaitForDAG.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchWaitForDAG/MSFT_xExchWaitForDAG.psm1 deleted file mode 100644 index 21c1128d..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchWaitForDAG/MSFT_xExchWaitForDAG.psm1 +++ /dev/null @@ -1,176 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscExamplesPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.String] - $DomainController, - - [System.UInt32] - $RetryIntervalSec = 60, - - [System.UInt32] - $RetryCount = 5 - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-DatabaseAvailabilityGroup" -VerbosePreference $VerbosePreference - - $dag = GetDatabaseAvailabilityGroup @PSBoundParameters - - if ($null -ne $dag) - { - $returnValue = @{ - Identity = $Identity - } - - } - - $returnValue -} - - -function Set-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.String] - $DomainController, - - [System.UInt32] - $RetryIntervalSec = 60, - - [System.UInt32] - $RetryCount = 5 - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-DatabaseAvailabilityGroup" -VerbosePreference $VerbosePreference - - $dag = GetDatabaseAvailabilityGroup @PSBoundParameters - - for ($i = 0; $i -lt $RetryCount; $i++) - { - if ($null -eq $dag) - { - Write-Warning "DAG '$($Identity)' does not yet exist. Sleeping for $($RetryIntervalSec) seconds." - Start-Sleep -Seconds $RetryIntervalSec - - $dag = GetDatabaseAvailabilityGroup @PSBoundParameters - } - else - { - break - } - } - - if ($null -eq $dag) - { - throw "DAG '$($Identity)' does not yet exist. This will prevent resources that are dependant on this resource from executing. If you are running the DSC configuration in push mode, you will need to re-run the configuration once the database has been created." - } -} - - -function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.String] - $DomainController, - - [System.UInt32] - $RetryIntervalSec = 60, - - [System.UInt32] - $RetryCount = 5 - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-DatabaseAvailabilityGroup" -VerbosePreference $VerbosePreference - - $dag = GetDatabaseAvailabilityGroup @PSBoundParameters - - return ($null -ne $dag) -} - -function GetDatabaseAvailabilityGroup -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.String] - $DomainController - ) - - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Identity","DomainController" - - return (Get-DatabaseAvailabilityGroup @PSBoundParameters -ErrorAction SilentlyContinue) -} - - -Export-ModuleMember -Function *-TargetResource - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchWaitForDAG/MSFT_xExchWaitForDAG.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchWaitForDAG/MSFT_xExchWaitForDAG.schema.mof deleted file mode 100644 index 6f42d01f..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchWaitForDAG/MSFT_xExchWaitForDAG.schema.mof +++ /dev/null @@ -1,13 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xExchWaitForDAG")] -class MSFT_xExchWaitForDAG : OMI_BaseResource -{ - [Key] String Identity; //The name of the DAG - [Required, EmbeddedInstance("MSFT_Credential")] String Credential; //Credentials used to establish a remote Powershell session to Exchange - [Write] String DomainController; //Domain controller to talk to when running Get-DatabaseAvailabilityGroup - [Write] Uint32 RetryIntervalSec; //How many seconds to wait between retries when checking whether the DAG exists. Defaults to 60. - [Write] Uint32 RetryCount; //Mount many retry attempts should be made to find the DAG before an exception is thrown. Defaults to 5. -}; - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchWaitForMailboxDatabase/MSFT_xExchWaitForMailboxDatabase.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchWaitForMailboxDatabase/MSFT_xExchWaitForMailboxDatabase.psm1 deleted file mode 100644 index 0c742b87..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchWaitForMailboxDatabase/MSFT_xExchWaitForMailboxDatabase.psm1 +++ /dev/null @@ -1,208 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscExamplesPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.String] - $DomainController, - - [System.UInt32] - $RetryIntervalSec = 60, - - [System.UInt32] - $RetryCount = 5, - - [System.String] - $AdServerSettingsPreferredServer - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-MailboxDatabase","Set-AdServerSettings" -VerbosePreference $VerbosePreference - - if ($PSBoundParameters.ContainsKey("AdServerSettingsPreferredServer") -and ![string]::IsNullOrEmpty($AdServerSettingsPreferredServer)) - { - Set-ADServerSettings -PreferredServer "$($AdServerSettingsPreferredServer)" - } - - $db = GetMailboxDatabase @PSBoundParameters - - if ($null -ne $db) - { - $returnValue = @{ - Identity = $Identity - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.String] - $DomainController, - - [System.UInt32] - $RetryIntervalSec = 60, - - [System.UInt32] - $RetryCount = 5, - - [System.String] - $AdServerSettingsPreferredServer - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-MailboxDatabase","Set-AdServerSettings" -VerbosePreference $VerbosePreference - - if ($PSBoundParameters.ContainsKey("AdServerSettingsPreferredServer") -and ![string]::IsNullOrEmpty($AdServerSettingsPreferredServer)) - { - Set-ADServerSettings -PreferredServer "$($AdServerSettingsPreferredServer)" - } - - $db = GetMailboxDatabase @PSBoundParameters - - for ($i = 0; $i -lt $RetryCount; $i++) - { - if ($null -eq $db) - { - Write-Warning "Database '$($Identity)' does not yet exist. Sleeping for $($RetryIntervalSec) seconds." - Start-Sleep -Seconds $RetryIntervalSec - - $db = GetMailboxDatabase @PSBoundParameters - } - else - { - break - } - } - - if ($null -eq $db) - { - throw "Database '$($Identity)' does not yet exist. This will prevent resources that are dependant on this resource from executing. If you are running the DSC configuration in push mode, you will need to re-run the configuration once the database has been created." - } -} - - -function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.String] - $DomainController, - - [System.UInt32] - $RetryIntervalSec = 60, - - [System.UInt32] - $RetryCount = 5, - - [System.String] - $AdServerSettingsPreferredServer - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad "Get-MailboxDatabase","Set-AdServerSettings" -VerbosePreference $VerbosePreference - - if ($PSBoundParameters.ContainsKey("AdServerSettingsPreferredServer") -and ![string]::IsNullOrEmpty($AdServerSettingsPreferredServer)) - { - Set-ADServerSettings -PreferredServer "$($AdServerSettingsPreferredServer)" - } - - $db = GetMailboxDatabase @PSBoundParameters - - return ($null -ne $db) -} - -function GetMailboxDatabase -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.String] - $DomainController, - - [System.UInt32] - $RetryIntervalSec = 60, - - [System.UInt32] - $RetryCount = 5, - - [System.String] - $AdServerSettingsPreferredServer - ) - - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Identity","DomainController" - - return (Get-MailboxDatabase @PSBoundParameters -ErrorAction SilentlyContinue) -} - - -Export-ModuleMember -Function *-TargetResource - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchWaitForMailboxDatabase/MSFT_xExchWaitForMailboxDatabase.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchWaitForMailboxDatabase/MSFT_xExchWaitForMailboxDatabase.schema.mof deleted file mode 100644 index 84300a3b..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchWaitForMailboxDatabase/MSFT_xExchWaitForMailboxDatabase.schema.mof +++ /dev/null @@ -1,14 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xExchWaitForMailboxDatabase")] -class MSFT_xExchWaitForMailboxDatabase : OMI_BaseResource -{ - [Key] String Identity; //The name of the Mailbox Database - [Required, EmbeddedInstance("MSFT_Credential")] String Credential; //Credentials used to establish a remote Powershell session to Exchange - [Write] String AdServerSettingsPreferredServer; //An optional domain controller to pass to Set-AdServerSettings -PreferredServer - [Write] String DomainController; //Domain controller to talk to when running Get-MailboxDatabase - [Write] Uint32 RetryIntervalSec; //How many seconds to wait between retries when checking whether the database exists. Defaults to 60. - [Write] Uint32 RetryCount; //Mount many retry attempts should be made to find the database before an exception is thrown. Defaults to 5. -}; - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchWebServicesVirtualDirectory/MSFT_xExchWebServicesVirtualDirectory.psm1 b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchWebServicesVirtualDirectory/MSFT_xExchWebServicesVirtualDirectory.psm1 deleted file mode 100644 index 2ea78206..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchWebServicesVirtualDirectory/MSFT_xExchWebServicesVirtualDirectory.psm1 +++ /dev/null @@ -1,343 +0,0 @@ -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscTestsPresent", "")] -[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCDscExamplesPresent", "")] -[CmdletBinding()] -param() - -function Get-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $BasicAuthentication, - - [System.Boolean] - $CertificateAuthentication, - - [System.Boolean] - $DigestAuthentication, - - [System.String] - $DomainController, - - [System.String] - $ExternalUrl, - - [System.String] - $InternalNLBBypassUrl, - - [System.String] - $InternalUrl, - - [System.Boolean] - $OAuthAuthentication, - - [System.Boolean] - $WindowsAuthentication, - - [System.Boolean] - $WSSecurityAuthentication - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad 'Get-WebServicesVirtualDirectory' -VerbosePreference $VerbosePreference - - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Identity","DomainController" - - $EwsVdir = Get-WebServicesVirtualDirectory @PSBoundParameters - - if ($null -ne $EwsVdir) - { - $returnValue = @{ - EwsVirtualDirectoryIdentity = $Identity - InternalUrl = $EwsVdir.InternalUrl.AbsoluteUri - ExternalUrl = $EwsVdir.InternalUrl.AbsoluteUri - BasicAuthentication = $EwsVdir.BasicAuthentication - CertificateAuthentication = $EwsVdir.CertificateAuthentication - DigestAuthentication = $EwsVdir.DigestAuthentication - OAuthAuthentication = $EwsVdir.OAuthAuthentication - WSSecurityAuthentication = $EwsVdir.WSSecurityAuthentication - InternalNLBBypassUrl = $EwsVdir.InternalNLBBypassUrl - WindowsAuthentication = $EwsVdir.WindowsAuthentication - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")] - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $BasicAuthentication, - - [System.Boolean] - $CertificateAuthentication, - - [System.Boolean] - $DigestAuthentication, - - [System.String] - $DomainController, - - [System.String] - $ExternalUrl, - - [System.String] - $InternalNLBBypassUrl, - - [System.String] - $InternalUrl, - - [System.Boolean] - $OAuthAuthentication, - - [System.Boolean] - $WindowsAuthentication, - - [System.Boolean] - $WSSecurityAuthentication - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad 'Set-WebServicesVirtualDirectory' -VerbosePreference $VerbosePreference - - #Ensure an empty string is $null and not a string - SetEmptyStringParamsToNull -PSBoundParametersIn $PSBoundParameters - - #Remove Credential and AllowServiceRestart because those parameters do not exist on Set-WebServicesVirtualDirectory - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToRemove 'Credential','AllowServiceRestart' - - #Need to do -Force and -Confirm:$false here or else an unresolvable URL will prompt for confirmation - Set-WebServicesVirtualDirectory @PSBoundParameters -Force -Confirm:$false - - if($AllowServiceRestart -eq $true) - { - Write-Verbose "Recycling MSExchangeServicesAppPool" - RestartAppPoolIfExists -Name MSExchangeServicesAppPool - } - else - { - Write-Warning "The configuration will not take effect until MSExchangeServicesAppPool is manually recycled." - } -} - - -function Test-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $BasicAuthentication, - - [System.Boolean] - $CertificateAuthentication, - - [System.Boolean] - $DigestAuthentication, - - [System.String] - $DomainController, - - [System.String] - $ExternalUrl, - - [System.String] - $InternalNLBBypassUrl, - - [System.String] - $InternalUrl, - - [System.Boolean] - $OAuthAuthentication, - - [System.Boolean] - $WindowsAuthentication, - - [System.Boolean] - $WSSecurityAuthentication - ) - - #Load helper module - Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xExchangeCommon.psm1" -Verbose:0 - - LogFunctionEntry -Parameters @{"Identity" = $Identity} -VerbosePreference $VerbosePreference - - #Establish remote Powershell session - GetRemoteExchangeSession -Credential $Credential -CommandsToLoad 'Get-WebServicesVirtualDirectory' -VerbosePreference $VerbosePreference - - #Ensure an empty string is $null and not a string - SetEmptyStringParamsToNull -PSBoundParametersIn $PSBoundParameters - - $EwsVdir = GetWebServicesVirtualDirectory @PSBoundParameters - - if ($null -eq $EwsVdir) - { - return $false - } - else - { - if (!(VerifySetting -Name "InternalUrl" -Type "String" -ExpectedValue $InternalUrl -ActualValue $EwsVdir.InternalUrl.AbsoluteUri -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "ExternalUrl" -Type "String" -ExpectedValue $ExternalUrl -ActualValue $EwsVdir.ExternalUrl.AbsoluteUri -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "BasicAuthentication" -Type "Boolean" -ExpectedValue $BasicAuthentication -ActualValue $EwsVdir.BasicAuthentication -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "CertificateAuthentication" -Type "Boolean" -ExpectedValue $CertificateAuthentication -ActualValue $EwsVdir.CertificateAuthentication -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "DigestAuthentication" -Type "Boolean" -ExpectedValue $DigestAuthentication -ActualValue $EwsVdir.DigestAuthentication -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "OAuthAuthentication" -Type "Boolean" -ExpectedValue $OAuthAuthentication -ActualValue $EwsVdir.OAuthAuthentication -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "WindowsAuthentication" -Type "Boolean" -ExpectedValue $WindowsAuthentication -ActualValue $EwsVdir.WindowsAuthentication -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "WSSecurityAuthentication" -Type "Boolean" -ExpectedValue $WSSecurityAuthentication -ActualValue $EwsVdir.WSSecurityAuthentication -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - - if (!(VerifySetting -Name "InternalNLBBypassUrl" -Type "String" -ExpectedValue $InternalNLBBypassUrl -ActualValue $EwsVdir.InternalNLBBypassUrl.AbsoluteUri -PSBoundParametersIn $PSBoundParameters -VerbosePreference $VerbosePreference)) - { - return $false - } - } - - #If the code made it this for all properties are in a desired state - return $true -} - -function GetWebServicesVirtualDirectory -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Identity, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.Boolean] - $AllowServiceRestart = $false, - - [System.Boolean] - $BasicAuthentication, - - [System.Boolean] - $CertificateAuthentication, - - [System.Boolean] - $DigestAuthentication, - - [System.String] - $DomainController, - - [System.String] - $ExternalUrl, - - [System.String] - $InternalNLBBypassUrl, - - [System.String] - $InternalUrl, - - [System.Boolean] - $OAuthAuthentication, - - [System.Boolean] - $WindowsAuthentication, - - [System.Boolean] - $WSSecurityAuthentication - ) - - RemoveParameters -PSBoundParametersIn $PSBoundParameters -ParamsToKeep "Identity","DomainController" - - return (Get-WebServicesVirtualDirectory @PSBoundParameters) -} - - -Export-ModuleMember -Function *-TargetResource - - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchWebServicesVirtualDirectory/MSFT_xExchWebServicesVirtualDirectory.schema.mof b/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchWebServicesVirtualDirectory/MSFT_xExchWebServicesVirtualDirectory.schema.mof deleted file mode 100644 index d306b1e7..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/DSCResources/MSFT_xExchWebServicesVirtualDirectory/MSFT_xExchWebServicesVirtualDirectory.schema.mof +++ /dev/null @@ -1,24 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xExchWebServicesVirtualDirectory")] -class MSFT_xExchWebServicesVirtualDirectory : OMI_BaseResource -{ - [Key] String Identity; //The Identity of the EWS Virtual Directory - [Required, EmbeddedInstance("MSFT_Credential")] String Credential; //Credentials used to establish a remote Powershell session to Exchange - [Write] Boolean AllowServiceRestart; //Whether it is OK to recycle the app pool after making changes. Defaults to $true. - - //Remaining props correspond directly to Set-WebServicesVirtualDirectory parameters - //http://technet.microsoft.com/en-us/library/aa997233(v=exchg.150).aspx - [Write] Boolean BasicAuthentication; - [Write] Boolean CertificateAuthentication; - [Write] Boolean DigestAuthentication; - [Write] String DomainController; - [Write] String ExternalUrl; - [Write] String InternalNLBBypassUrl; - [Write] String InternalUrl; - [Write] Boolean OAuthAuthentication; - [Write] Boolean WindowsAuthentication; - [Write] Boolean WSSecurityAuthentication; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xExchange/LICENSE b/lib/puppet_x/dsc_resources/xExchange/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xExchange/Misc/xExchangeCommon.psm1 b/lib/puppet_x/dsc_resources/xExchange/Misc/xExchangeCommon.psm1 deleted file mode 100644 index 48921fd3..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/Misc/xExchangeCommon.psm1 +++ /dev/null @@ -1,991 +0,0 @@ -#Gets the existing Remote PowerShell session to Exchange, if it exists -function GetExistingExchangeSession -{ - return (Get-PSSession -Name "DSCExchangeSession" -ErrorAction SilentlyContinue) -} - -#Establishes a Exchange remote powershell session to the local server. Reuses the session if it already exists. -function GetRemoteExchangeSession -{ - [CmdletBinding()] - param - ( - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [string[]] - $CommandsToLoad, - - $VerbosePreference, - - $SetupProcessName = "ExSetup*" - ) - - #Check if Exchange Setup is running. If so, we need to throw an exception, as a running Exchange DSC resource will block Exchange Setup from working properly. - if (IsSetupRunning -SetupProcessName $SetupProcessName) - { - throw "Exchange Setup is currently running. Preventing creation of new Remote PowerShell session to Exchange." - } - - #See if the session already exists - $Session = GetExistingExchangeSession - - #Attempt to reuse the session if we found one - if ($null -ne $Session) - { - if ($Session.State -eq "Opened") - { - Write-Verbose "Reusing existing Remote Powershell Session to Exchange" - } - else #Session is in an unexpected state. Remove it so we can rebuild it - { - RemoveExistingRemoteSession - $Session = $null - } - } - - #Either the session didn't exist, or it was broken and we nulled it out. Create a new one - if ($null -eq $Session) - { - #First make sure we are on a valid server version, and that Exchange is fully installed - VerifyServerVersion -VerbosePreference $VerbosePreference - - Write-Verbose "Creating new Remote Powershell session to Exchange" - - #Get local server FQDN - $machineDomain = (Get-CimInstance -ClassName Win32_ComputerSystem).Domain.ToLower() - $serverName = $env:computername.ToLower() - $serverFQDN = $serverName + "." + $machineDomain - - #Override chatty banner, because chatty - New-Alias Get-ExBanner Out-Null - New-Alias Get-Tip Out-Null - - #Load built in Exchange functions, and create session - $exbin = Join-Path -Path ((Get-ItemProperty HKLM:\SOFTWARE\Microsoft\ExchangeServer\v15\Setup).MsiInstallPath) -ChildPath "bin" - $remoteExchange = Join-Path -Path "$($exbin)" -ChildPath "RemoteExchange.ps1" - . $remoteExchange - $Session = _NewExchangeRunspace -fqdn $serverFQDN -credential $Credential -UseWIA $false -AllowRedirection $false - - #Remove the aliases we created earlier - Remove-Item Alias:Get-ExBanner - Remove-Item Alias:Get-Tip - - if ($null -ne $Session) - { - $Session.Name = "DSCExchangeSession" - } - } - - #If the session is still null here, things went wrong. Throw exception - if ($null -eq $Session) - { - throw "Failed to establish remote Powershell session to FQDN: $($serverFQDN)" - } - else #Import the session globally - { - #Temporarily set Verbose to SilentlyContinue so the Session and Module import isn't noisy - $oldVerbose = $VerbosePreference - $VerbosePreference = "SilentlyContinue" - - if ($CommandsToLoad.Count -gt 0) - { - $moduleInfo = Import-PSSession $Session -WarningAction SilentlyContinue -DisableNameChecking -AllowClobber -CommandName $CommandsToLoad -Verbose:0 - } - else - { - $moduleInfo = Import-PSSession $Session -WarningAction SilentlyContinue -DisableNameChecking -AllowClobber -Verbose:0 - } - - Import-Module $moduleInfo -Global -DisableNameChecking - - #Set Verbose back - $VerbosePreference = $oldVerbose - } -} - -#Removes any Remote Sessions that have been setup by us -function RemoveExistingRemoteSession -{ - [CmdletBinding()] - param($VerbosePreference) - - $sessions = GetExistingExchangeSession - - if ($null -ne $sessions) - { - Write-Verbose "Removing existing remote Powershell sessions" - - GetExistingExchangeSession | Remove-PSSession - } -} - -#Ensures that Exchange is installed, and that it is the correct version (2013 or 2016) -function VerifyServerVersion -{ - [CmdletBinding()] - param($VerbosePreference) - - $unsupportedMsg = "A supported version of Exchange is either not present, or not fully installed on this machine." - - if ($Global:ServerVersionGood -eq $true) - { - #Do nothing - } - elseif ($Global:ServerVersionGood -eq $false) - { - throw $unsupportedMsg - } - else - { - $setupComplete = IsSetupComplete - - if ($setupComplete -eq $false) - { - $Global:ServerVersionGood = $false - - throw $unsupportedMsg - } - else - { - $Global:ServerVersionGood = $true - } - } -} - -#Gets the WMI object corresponding to the Exchange Product -function GetExchangeProduct -{ - if ($null -eq $Global:CheckedExchangeProduct -or $Global:CheckedExchangeProduct -eq $false) - { - $Global:ExchangeProduct = Get-CimInstance -ClassName Win32_Product -Filter 'Name like "Microsoft Exchange Server"' - - $Global:CheckedExchangeProduct = $true - } - - return $Global:ExchangeProduct -} - -#Checks whether a supported version of Exchange is at least partially installed by looking for Exchange's product GUID -function IsExchangePresent -{ - $version = GetExchangeVersion - - if ($version -eq "2013" -or $version -eq "2016") - { - return $true - } - else - { - return $false - } -} - -#Gets the installed Exchange Version, and returns the number as a string. -#Returns N/A if the version cannot be found, and will optionally throw an exception -#if ThrowIfUnknownVersion was set to $true. -function GetExchangeVersion -{ - param ([bool]$ThrowIfUnknownVersion = $false) - - $version = "N/A" - - $product = GetExchangeProduct - - if ($null -ne $product) - { - if ($product.IdentifyingNumber -eq '{4934D1EA-BE46-48B1-8847-F1AF20E892C1}') #Exchange 2013 - { - return "2013" - } - elseif($product.IdentifyingNumber -eq '{CD981244-E9B8-405A-9026-6AEB9DCEF1F1}') #Exchange 2016 - { - return "2016" - } - } - - if ($version -eq "N/A" -and $ThrowIfUnknownVersion) - { - throw "Failed to discover a known Exchange Version" - } -} - -#Checks whether Setup fully completed -function IsSetupComplete -{ - $exchangePresent = IsExchangePresent - $setupPartiallyCompleted = IsSetupPartiallyCompleted - - if ($exchangePresent -eq $true -and $setupPartiallyCompleted -eq $false) - { - $isSetupComplete = $true - } - else - { - $isSetupComplete = $false - } - - return $isSetupComplete -} - -#Checks whether any Setup watermark keys exist which means that a previous installation of setup had already started but not completed -function IsSetupPartiallyCompleted -{ - $isPartiallyCompleted = $false - - #Now check if setup actually completed successfully - [string[]]$roleKeys = "CafeRole","ClientAccessRole","FrontendTransportRole","HubTransportRole","MailboxRole","UnifiedMessagingRole" - - foreach ($key in $roleKeys) - { - $values = $null - $values = Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\ExchangeServer\v15\$($key)" -ErrorAction SilentlyContinue - - if ($null -ne $values) - { - if ($null -ne $values.UnpackedVersion) - { - #If ConfiguredVersion is missing, or Action or Watermark or present, setup needs to be resumed - if ($null -eq $values.ConfiguredVersion -or $null -ne $values.Action -or $null -ne $values.Watermark) - { - $isPartiallyCompleted = $true - break - } - } - } - } - - return $isPartiallyCompleted -} - -#Checks whether setup is running by looking for if the ExSetup.exe process currently exists -function IsSetupRunning -{ - param([string]$SetupProcessName = "ExSetup*") - - return ($null -ne (Get-Process -Name $SetupProcessName -ErrorAction SilentlyContinue)) -} - -#Checks if two strings are equal, or are both either null or empty -function CompareStrings -{ - param([string]$String1, [string]$String2, [switch]$IgnoreCase) - - if (([string]::IsNullOrEmpty($String1) -and [string]::IsNullOrEmpty($String2))) - { - return $true - } - else - { - if ($IgnoreCase -eq $true) - { - return ($String1 -like $String2) - } - else - { - return ($String1 -clike $String2) - } - } -} - -#Checks if two bools are equal, or are both either null or false -function CompareBools($Bool1, $Bool2) -{ - if($Bool1 -ne $Bool2) - { - if (!(($null -eq $Bool1 -and $Bool2 -eq $false) -or ($null -eq $Bool2 -and $Bool1 -eq $false))) - { - return $false - } - } - - return $true -} - -#Takes a string which should be in timespan format, and compares it to an actual EnhancedTimeSpan object. Returns true if they are equal -function CompareTimespanWithString -{ - param([Microsoft.Exchange.Data.EnhancedTimeSpan]$TimeSpan, [string]$String) - - try - { - $converted = [Microsoft.Exchange.Data.EnhancedTimeSpan]::Parse($String) - - return ($TimeSpan.Equals($converted)) - } - catch - { - throw "String '$($String)' is not in a valid format for an EnhancedTimeSpan" - } - - return $false -} - -#Takes a string which should be in ByteQuantifiedSize format, and compares it to an actual ByteQuantifiedSize object. Returns true if they are equal -function CompareByteQuantifiedSizeWithString -{ - param([Microsoft.Exchange.Data.ByteQuantifiedSize]$ByteQuantifiedSize, [string]$String) - - try - { - $converted = [Microsoft.Exchange.Data.ByteQuantifiedSize]::Parse($String) - - return ($ByteQuantifiedSize.Equals($converted)) - } - catch - { - throw "String '$($String)' is not in a valid format for a ByteQuantifiedSize" - } -} - -#Takes a string which should be in Microsoft.Exchange.Data.Unlimited format, and compares with an actual Unlimited object. Returns true if they are equal. -function CompareUnlimitedWithString -{ - param($Unlimited, [string]$String) - - if ($Unlimited.IsUnlimited) - { - return (CompareStrings -String1 "Unlimited" -String2 $String -IgnoreCase) - } - elseif ($Unlimited.Value.GetType() -ne [Microsoft.Exchange.Data.ByteQuantifiedSize]) - { - return (CompareStrings -String1 $Unlimited -String2 $String -IgnoreCase) - } - else - { - return (CompareByteQuantifiedSizeWithString -ByteQuantifiedSize $Unlimited -String $String) - } -} - -#Takes an ADObjectId, gets a mailbox from it, and checks if it's EmailAddresses property contains the given string. -#The Get-Mailbox cmdlet must be loaded for this function to succeed. -function CompareADObjectIdWithEmailAddressString -{ - param([Microsoft.Exchange.Data.Directory.ADObjectId]$ADObjectId, [string]$String) - - if ($null -ne (Get-Command Get-Mailbox -ErrorAction SilentlyContinue)) - { - $mailbox = $ADObjectId | Get-Mailbox -ErrorAction SilentlyContinue - - return ($mailbox.EmailAddresses.Contains($String)) - } - else - { - Write-Error "CompareADObjectIdWithEmailAddressString requires the Get-Mailbox cmdlert" - - return $false - } -} - -#Takes a string containing a given separator, and breaks it into a string array -function StringToArray -{ - param([string]$StringIn, [char]$Separator) - - [string[]]$array = $StringIn.Split($Separator) - - for ($i = 0; $i -lt $array.Length; $i++) - { - $array[$i] = $array[$i].Trim() - } - - return $array -} - -#Takes an array of strings and converts all elements to lowercase -function StringArrayToLower -{ - param([string[]]$Array) - - for ($i = 0; $i -lt $Array.Count; $i++) - { - if (!([string]::IsNullOrEmpty($Array[$i]))) - { - $Array[$i] = $Array[$i].ToLower() - } - } - - return $Array -} - -#Checks whether two arrays have the same contents, where element order doesn't matter -function CompareArrayContents -{ - param([string[]]$Array1, [string[]]$Array2, [switch]$IgnoreCase) - - $hasSameContents = $true - - if ($Array1.Length -ne $Array2.Length) - { - $hasSameContents = $false - } - elseif ($Array1.Count -gt 0 -and $Array2.Count -gt 0) - { - if ($IgnoreCase -eq $true) - { - $Array1 = StringArrayToLower -Array $Array1 - $Array2 = StringArrayToLower -Array $Array2 - } - - foreach ($str in $Array1) - { - if (!($Array2.Contains($str))) - { - $hasSameContents = $false - break - } - } - } - - return $hasSameContents -} - -#Checks whether Array2 contains all elements of Array1 (Array2 may be larger than Array1) -function Array2ContainsArray1Contents -{ - param([string[]]$Array1, [string[]]$Array2, [switch]$IgnoreCase) - - $hasContents = $true - - if ($Array1.Length -eq 0) #Do nothing, as Array2 at a minimum contains nothing - {} - elseif ($Array2.Length -eq 0) #Array2 is empty and Array1 is not. Return false - { - $hasContents = $false - } - else - { - if ($IgnoreCase -eq $true) - { - $Array1 = StringArrayToLower -Array $Array1 - $Array2 = StringArrayToLower -Array $Array2 - } - - foreach ($str in $Array1) - { - if (!($Array2.Contains($str))) - { - $hasContents = $false - break - } - } - } - - return $hasContents -} - -#Takes $PSBoundParameters from another function and adds in the keys and values from the given Hashtable -function AddParameters -{ - param($PSBoundParametersIn, [Hashtable]$ParamsToAdd) - - foreach ($key in $ParamsToAdd.Keys) - { - if (!($PSBoundParametersIn.ContainsKey($key))) #Key doesn't exist, so add it with value - { - $PSBoundParametersIn.Add($key, $ParamsToAdd[$key]) | Out-Null - } - else #Key already exists, so just replace the value - { - $PSBoundParametersIn[$key] = $ParamsToAdd[$key] - } - } -} - -#Takes $PSBoundParameters from another function. If ParamsToRemove is specified, it will remove each param. -#If ParamsToKeep is specified, everything but those params will be removed. If both ParamsToRemove and ParamsToKeep -#are specified, only ParamsToKeep will be used. -function RemoveParameters -{ - param($PSBoundParametersIn, [string[]]$ParamsToKeep, [string[]]$ParamsToRemove) - - if ($ParamsToKeep.Count -gt 0) - { - [string[]]$ParamsToRemove = @() - - $lowerParamsToKeep = StringArrayToLower -Array $ParamsToKeep - - foreach ($key in $PSBoundParametersIn.Keys) - { - if (!($lowerParamsToKeep.Contains($key.ToLower()))) - { - $ParamsToRemove += $key - } - } - } - - if ($ParamsToRemove.Count -gt 0) - { - foreach ($param in $ParamsToRemove) - { - $PSBoundParametersIn.Remove($param) | Out-Null - } - } -} - -function RemoveVersionSpecificParameters -{ - param($PSBoundParametersIn, [string]$ParamName, [string]$ResourceName, [ValidateSet("2013","2016")][string]$ParamExistsInVersion) - - if ($PSBoundParametersIn.ContainsKey($ParamName)) - { - $serverVersion = GetExchangeVersion - - if ($serverVersion -ne $ParamExistsInVersion) - { - Write-Warning "$($ParamName) is not a valid parameter for $($ResourceName) in Exchange $($serverVersion). Skipping usage." - RemoveParameters -PSBoundParametersIn $PSBoundParametersIn -ParamsToRemove $ParamName - } - } -} - -function SetEmptyStringParamsToNull -{ - param($PSBoundParametersIn) - - [string[]] $emptyStringKeys = @() - - #First find all parameters that are a string, and are an empty string ("") - foreach ($key in $PSBoundParametersIn.Keys) - { - if ($null -ne $PSBoundParametersIn[$key] -and $PSBoundParametersIn[$key].GetType().Name -eq "String" -and $PSBoundParametersIn[$key] -eq "") - { - $emptyStringKeys += $key - } - } - - #Now that we have the keys, set their values to null - foreach ($key in $emptyStringKeys) - { - $PSBoundParametersIn[$key] = $null - } -} - -function VerifySetting -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param([string]$Name, [string]$Type, $ExpectedValue, $ActualValue, $PSBoundParametersIn, $VerbosePreference) - - $returnValue = $true - - if ($PSBoundParametersIn.ContainsKey($Name)) - { - if ($Type -like "String") - { - if ((CompareStrings -String1 $ExpectedValue -String2 $ActualValue -IgnoreCase) -eq $false) - { - $returnValue = $false - } - } - elseif ($Type -like "Boolean") - { - if ((CompareBools -Bool1 $ExpectedValue -Bool2 $ActualValue) -eq $false) - { - $returnValue = $false - } - } - elseif ($Type -like "Array") - { - if ((CompareArrayContents -Array1 $ExpectedValue -Array2 $ActualValue -IgnoreCase) -eq $false) - { - $returnValue = $false - } - } - elseif ($Type -like "Int") - { - if ($ExpectedValue -ne $ActualValue) - { - $returnValue = $false - } - } - elseif ($Type -like "Unlimited") - { - if ((CompareUnlimitedWithString -Unlimited $ActualValue -String $ExpectedValue) -eq $false) - { - $returnValue = $false - } - } - elseif ($Type -like "Timespan") - { - if ((CompareTimespanWithString -TimeSpan $ActualValue -String $ExpectedValue) -eq $false) - { - $returnValue = $false - } - } - elseif ($Type -like "ADObjectID") - { - if ((CompareADObjectIdWithEmailAddressString -ADObjectId $ActualValue -String $ExpectedValue) -eq $false) - { - $returnValue = $false - } - } - elseif ($Type -like "ByteQuantifiedSize") - { - if ((CompareByteQuantifiedSizeWithString -ByteQuantifiedSize $ActualValue -String $ExpectedValue) -eq $false) - { - $returnValue = $false - } - } - elseif ($Type -like "IPAddress") - { - if ((CompareIPAddresseWithString -IPAddress $ActualValue -String $ExpectedValue) -eq $false) - { - $returnValue = $false - } - } - elseif ($Type -like "IPAddresses") - { - if ((CompareIPAddressesWithArray -IPAddresses $ActualValue -Array $ExpectedValue) -eq $false) - { - $returnValue = $false - } - } - elseif ($Type -like "SMTPAddress") - { - if ((CompareSmtpAdressWithString -SmtpAddress $ActualValue -String $ExpectedValue) -eq $false) - { - $returnValue = $false - } - } - elseif ($Type -like "PSCredential") - { - if ((Compare-PSCredential -Cred1 $ActualValue -Cred2 $ExpectedValue ) -eq $false) - { - $returnValue = $false - } - } - else - { - throw "Type not found: $($Type)" - } - } - - if ($returnValue -eq $false) - { - ReportBadSetting -SettingName $Name -ExpectedValue $ExpectedValue -ActualValue $ActualValue -VerbosePreference $VerbosePreference - } - - return $returnValue -} - -function ReportBadSetting -{ - param($SettingName, $ExpectedValue, $ActualValue, $VerbosePreference) - - Write-Verbose "Invalid setting '$($SettingName)'. Expected value: '$($ExpectedValue)'. Actual value: '$($ActualValue)'" -} - -function LogFunctionEntry -{ - param([Hashtable]$Parameters, $VerbosePreference) - - $callingFunction = (Get-PSCallStack)[1].FunctionName - - if ($Parameters.Count -gt 0) - { - $parametersString = "" - - foreach ($key in $Parameters.Keys) - { - $value = $Parameters[$key] - - if ($parametersString -ne "") - { - $parametersString += ", " - } - - $parametersString += "$($key) = '$($value)'" - } - - Write-Verbose "Entering function '$($callingFunction)'. Notable parameters: $($parametersString)" - } - else - { - Write-Verbose "Entering function '$($callingFunction)'." - } -} - -function StartScheduledTask -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Path, - - [System.String] - $Arguments, - - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.String] - $TaskName, - - [System.String] - $WorkingDirectory, - - [System.UInt32] - $MaxWaitMinutes = 0, - - [System.UInt32] - $TaskPriority = 4, - - $VerbosePreference - ) - - $tName = "$([guid]::NewGuid().ToString())" - - if ($PSBoundParameters.ContainsKey("TaskName")) - { - $tName = "$($TaskName) $($tName)" - } - - $action = New-ScheduledTaskAction -Execute "$($Path)" -Argument "$($Arguments)" - - if ($PSBoundParameters.ContainsKey("WorkingDirectory")) - { - $action.WorkingDirectory = $WorkingDirectory - } - - Write-Verbose "Created Scheduled Task with name: $($tName)" - Write-Verbose "Task Action: $($Path) $($Arguments)" - - #Use 'NT AUTHORITY\SYSTEM' as the run as account unless a specific Credential was provided - $credParams = @{User = "NT AUTHORITY\SYSTEM"} - - if ($PSBoundParameters.ContainsKey("Credential")) - { - $credParams["User"] = $Credential.UserName - $credParams.Add("Password", $Credential.GetNetworkCredential().Password) - } - - $task = Register-ScheduledTask @credParams -TaskName "$($tName)" -Action $action -RunLevel Highest -ErrorVariable errRegister -ErrorAction SilentlyContinue - - if (0 -lt $errRegister.Count) - { - throw $errRegister[0] - } - elseif ($null -ne $task -and $task.State -eq "Ready") - { - #Set a time limit on the task - $taskSettings = $task.Settings - $taskSettings.ExecutionTimeLimit = "PT$($MaxWaitMinutes)M" - $taskSettings.Priority = $TaskPriority - Set-ScheduledTask @credParams -TaskName "$($task.TaskName)" -Settings $taskSettings - - Write-Verbose "Starting task at: $([DateTime]::Now)" - - $task | Start-ScheduledTask - } - else - { - throw "Failed to register Scheduled Task" - } -} - -function CheckForCmdletParameter -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param([string]$CmdletName, [string]$ParameterName) - - [bool]$hasParameter = $false - - $command = Get-Command -Name "$($CmdletName)" -ErrorAction SilentlyContinue - - if ($null -ne $command -and $null -ne $command.Parameters) - { - if ($command.Parameters.ContainsKey($ParameterName)) - { - $hasParameter = $true - } - } - - return $hasParameter -} - -function NotePreviousError -{ - $Global:previousError = $null - - if ($Global:error.Count -gt 0) - { - $Global:previousError = $Global:error[0] - } -} - -function ThrowIfNewErrorsEncountered -{ - [CmdletBinding()] - param([string]$CmdletBeingRun, $VerbosePreference) - - #Throw an exception if errors were encountered - if ($Global:error.Count -gt 0 -and $Global:previousError -ne $Global:error[0]) - { - [string]$errorMsg = "Failed to run $($CmdletBeingRun) with: " + $Global:error[0] - Write-Error $errorMsg - throw $errorMsg - } -} - -function RestartAppPoolIfExists -{ - [CmdletBinding()] - param([string]$Name) - - $state = Get-WebAppPoolState -Name $Name -ErrorAction SilentlyContinue - - if ($null -ne $state) - { - Restart-WebAppPool -Name $Name - } - else - { - Write-Verbose "Application pool with name '$($Name)' does not exist. Skipping application pool restart." - } -} - -#Checks if the UM language pack for the specified culture is installed -function IsUMLanguagePackInstalled -{ - Param - ( - [ValidateNotNullOrEmpty()] - [System.String] - $Culture - ) - - return [bool](Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\ExchangeServer\v15\UnifiedMessagingRole\LanguagePacks').$Culture -} - -#Compares a single IPAddress with a string -function CompareIPAddresseWithString -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param([System.Net.IPAddress]$IPAddress, [String]$String) - if (($null -eq $IPAddress -and !([string]::IsNullOrEmpty($String))) -or ($null -ne $IPAddress -and [string]::IsNullOrEmpty($String))) - { - $returnValue = $false - } - elseif ($null -eq $IPAddress -and [string]::IsNullOrEmpty($String)) - { - $returnValue = $true - } - else - { - $returnValue =($IPAddress.Equals([System.Net.IPAddress]::Parse($string))) - } - - if ($returnValue -eq $false) - { - ReportBadSetting -SettingName $IPAddress -ExpectedValue $ExpectedValue -ActualValue $IPAddress -VerbosePreference $VerbosePreference - } - return $returnValue -} - -#Compares a SMTP address with a string -function CompareSmtpAdressWithString -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param($SmtpAddress,[String]$String) - if (($null -eq $SmtpAddress) -and ([string]::IsNullOrEmpty($String))) - { - Write-Verbose "Expected and actual value is empty, therefore equal!" - return $true - } - elseif (($null -eq $SmtpAddress) -and -not ([string]::IsNullOrEmpty($String))) - { - return $false - } - elseif ($SmtpAddress.Gettype() -eq [Microsoft.Exchange.Data.SmtpAddress]) - { - if ([string]::IsNullOrEmpty($String)) - { - return $false - } - else - { - return($SmtpAddress.Equals([Microsoft.Exchange.Data.SmtpAddress]::Parse($string))) - } - } - else - { - Write-Verbose "No type of [Microsoft.Exchange.Data.SmtpAddress]!" - return $false - } -} - -#Compares IPAddresses with an array -function CompareIPAddressesWithArray -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param($IPAddresses, [Array]$Array) - if (([string]::IsNullOrEmpty($IPAddresses)) -and ([string]::IsNullOrEmpty($Array))) - { - $returnValue = $true - } - elseif ((([string]::IsNullOrEmpty($IPAddresses)) -and !(([string]::IsNullOrEmpty($Array)))) -or (!(([string]::IsNullOrEmpty($IPAddresses))) -and ([string]::IsNullOrEmpty($Array)))) - { - $returnValue = $false - } - else - { - CompareArrayContents -Array1 $IPAddresses -Array2 $Array - } - if ($returnValue -eq $false) - { - ReportBadSetting -SettingName $IPAddresses -ExpectedValue $ExpectedValue -ActualValue $IPAddress -VerbosePreference $VerbosePreference - } - return $returnValue -} - -#Compares two give PSCredential -function Compare-PSCredential -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param ( - #[System.Management.Automation.PSCredential] - #[System.Management.Automation.Credential()] - $Cred1, - - #[System.Management.Automation.PSCredential] - #[System.Management.Automation.Credential()] - $Cred2 - ) -Begin { - $returnValue = $false - if ($null -ne $Cred1) { - $Cred1User = $Cred1.UserName - $Cred1Password = $Cred1.GetNetworkCredential().Password - } - if ($null -ne $Cred2) { - $Cred2User = $Cred2.UserName - $Cred2Password = $Cred2.GetNetworkCredential().Password - } -} -Process { - if (($Cred1User -ceq $Cred2User) -and ($Cred1Password -ceq $Cred2Password)){ - Write-Verbose "Credentials match" - $returnValue = $true - } - else{ - Write-Verbose "Credentials don't match" - Write-Verbose "Cred1:$($Cred1User) Cred2:$($Cred2User)" - Write-Verbose "Cred1:$($Cred1Password) Cred2:$($Cred2Password)" - } -} -End { - return $returnValue -} -} - -Export-ModuleMember -Function * diff --git a/lib/puppet_x/dsc_resources/xExchange/Misc/xExchangeDiskPart.psm1 b/lib/puppet_x/dsc_resources/xExchange/Misc/xExchangeDiskPart.psm1 deleted file mode 100644 index d6715254..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/Misc/xExchangeDiskPart.psm1 +++ /dev/null @@ -1,217 +0,0 @@ -#Adds the array of commands to a single temp file, and has disk part execute the temp file -function StartDiskpart -{ - [CmdletBinding()] - [OutputType([System.String])] - Param ([Array]$Commands, [Boolean]$ShowOutput = $true, $VerbosePreference) - - $Tempfile = [System.IO.Path]::GetTempFileName() - - foreach ($Com in $Commands) - { - $CMDLine = $CMDLine + $Com + ", " - Add-Content $Tempfile $Com - } - - $Output = DiskPart /s $Tempfile - - if ($ShowOutput) - { - Write-Verbose "Executed Diskpart commands: $(StringArrayToCommaSeparatedString -Array $Commands). Result:" - Write-Verbose "$($Output)" - } - - Remove-Item $Tempfile - - return $Output -} - -#Uses diskpart to obtain information on the disks and volumes that already exist on the system -function GetDiskInfo -{ - [Hashtable]$global:DiskToVolumeMap = @{} - [Hashtable]$global:VolumeToMountPointMap = @{} - [Hashtable]$global:DiskSizeMap = @{} - [int[]]$diskNums = @() - - $diskList = StartDiskpart -Commands "List Disk" -ShowOutput $false - - $foundDisks = $false - - #First parse out the list of disks - foreach ($line in $diskList) - { - if ($foundDisks -eq $true) - { - if ($line.Contains("Disk ")) - { - #First find the disk number - $startIndex = " Disk ".Length - $endIndex = " -------- ".Length - $diskNumStr = $line.Substring($startIndex, $endIndex - $startIndex).Trim() - - if ($diskNumStr.Length -gt 0) - { - $diskNum = [int]::Parse($diskNumStr) - $diskNums += $diskNum - } - - #Now find the disk size - $startIndex = " -------- ------------- ".Length - $endIndex = " -------- ------------- ------- ".Length - $diskSize = $line.Substring($startIndex, $endIndex - $startIndex).Trim() - - if ($diskSize.Length -gt 0 -and $null -ne $diskNum) - { - $DiskSizeMap.Add($diskNum, $diskSize) - } - } - } - elseif ($line.Contains("-------- ------------- ------- ------- --- ---")) #Scroll forward until we find the where the list of disks starts - { - $foundDisks = $true - } - } - - #Now get info on the disks - foreach ($diskNum in $diskNums) - { - $diskDetails = StartDiskpart -Commands "Select Disk $($diskNum)","Detail Disk" -ShowOutput $false - - $foundVolumes = $false - - for ($i = 0; $i -lt $diskDetails.Count; $i++) - { - $line = $diskDetails[$i] - - if ($foundVolumes -eq $true) - { - if ($line.StartsWith(" Volume ")) - { - #First find the volume number - $volStart = " Volume ".Length - $volEnd = " ---------- ".Length - $volStr = $line.Substring($volStart, $volEnd - $volStart).Trim() - - if ($volStr.Length -gt 0) - { - $volNum = [int]::Parse($volStr) - - AddObjectToMapOfObjectArrays -Map $DiskToVolumeMap -Key $diskNum -Value $volNum - - #Now parse out the drive letter if it's set - $letterStart = " ---------- ".Length - $letterEnd = $line.IndexOf(" ---------- --- ") + " ---------- --- ".Length - $letter = $line.Substring($letterStart, $letterEnd - $letterStart).Trim() - - if ($letter.Length -eq 1) - { - AddObjectToMapOfObjectArrays -Map $VolumeToMountPointMap -Key $volNum -Value $letter - } - - #Now find all the mount points - do - { - $line = $diskDetails[++$i] - - if ($null -eq $line -or $line.StartsWith(" Volume ") -or $line.Trim().Length -eq 0) #We've hit the next volume, or the end of all info - { - $i-- #Move $i back one as we may have overrun the start of the next volume info - break - } - else - { - $mountPoint = $line.Trim() - - AddObjectToMapOfObjectArrays -Map $VolumeToMountPointMap -Key $volNum -Value $mountPoint - } - - } while ($i -lt $diskDetails.Count) - - } - } - } - elseif ($line.Contains("There are no volumes.")) - { - [string[]]$emptyArray = @() - $DiskToVolumeMap[$diskNum] = $emptyArray - - break - } - elseif ($line.Contains("---------- --- ----------- ----- ---------- ------- --------- --------")) - { - $foundVolumes = $true - } - } - } -} - -function StringArrayToCommaSeparatedString -{ - param([string[]]$Array) - - $string = "" - - if ($null -ne $Array -and $Array.Count -gt 0) - { - $string = $Array[0] - - for ($i = 1; $i -lt $Array.Count; $i++) - { - $string += ",$($Array[$i])" - } - } - - return $string -} - -#Takes a hashtable, and adds the given key and value. -function AddObjectToMapOfObjectArrays -{ - Param([Hashtable]$Map, $Key, $Value) - - if ($Map.ContainsKey($Key)) - { - $Map[$Key] += $Value - } - else - { - [object[]]$Array = $Value - $Map[$Key] = $Array - } -} - -#Checks whether the mount point specified in the given path already exists as a mount point -#Returns the volume number if it does exist, else -1 -function MountPointExists -{ - param([string]$Path) - - foreach ($key in $global:VolumeToMountPointMap.Keys) - { - foreach ($value in $global:VolumeToMountPointMap[$key]) - { - #Make sure both paths end with the same character - if (($value.EndsWith("\")) -eq $false) - { - $value += "\" - } - - if (($Path.EndsWith("\")) -eq $false) - { - $Path += "\" - } - - #Do the comparison - if ($value -like $Path) - { - return $key - } - } - } - - return -1 -} - - -Export-ModuleMember -Function * diff --git a/lib/puppet_x/dsc_resources/xExchange/xExchange.psd1 b/lib/puppet_x/dsc_resources/xExchange/xExchange.psd1 deleted file mode 100644 index a43e2b60..00000000 --- a/lib/puppet_x/dsc_resources/xExchange/xExchange.psd1 +++ /dev/null @@ -1,129 +0,0 @@ -# -# Module manifest for module 'xExchange' -# -# Generated by: Mike Hendrickson -# -# Generated on: 7/23/2014 -# - -@{ - -# Script module or binary module file associated with this manifest. -# RootModule = '' - -# Version number of this module. -ModuleVersion = '1.16.0.0' - -# ID used to uniquely identify this module -GUID = '9a908ca3-8a67-485c-a014-66ba37fcc2a4' - -# Author of this module -Author = 'Mike Hendrickson, Jason Walker, Michael Greene' - -# Company or vendor of this module -CompanyName = 'Microsoft' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'This DSC Module allows you to configure many different properties of Exchange 2013 servers, including individual server properties, databases and mount points, and Database Availability Groups.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Name of the Windows PowerShell host required by this module -# PowerShellHostName = '' - -# Minimum version of the Windows PowerShell host required by this module -# PowerShellHostVersion = '' - -# Minimum version of Microsoft .NET Framework required by this module -# DotNetFrameworkVersion = '' - -# Minimum version of the common language runtime (CLR) required by this module -# CLRVersion = '' - -# Processor architecture (None, X86, Amd64) required by this module -# ProcessorArchitecture = '' - -# Modules that must be imported into the global environment prior to importing this module -# RequiredModules = @() - -# Assemblies that must be loaded prior to importing this module -# RequiredAssemblies = @() - -# Script files (.ps1) that are run in the caller's environment prior to importing this module. -# ScriptsToProcess = @() - -# Type files (.ps1xml) to be loaded when importing this module -# TypesToProcess = @() - -# Format files (.ps1xml) to be loaded when importing this module -# FormatsToProcess = @() - -# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess -# NestedModules = @() - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Variables to export from this module -VariablesToExport = '*' - -# Aliases to export from this module -AliasesToExport = '*' - -# List of all modules packaged with this module -# ModuleList = @() - -# List of all files packaged with this module -# FileList = @() - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/xExchange/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/xExchange' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - ReleaseNotes = '* Add missing parameters to xExchClientAccessServer - -' - - } # End of PSData hashtable - -} # End of PrivateData hashtable - -# HelpInfo URI of this module -# HelpInfoURI = '' - -# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. -# DefaultCommandPrefix = '' - -} - - - - - - - - - - - diff --git a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/CommonResourceHelper.psm1 b/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/CommonResourceHelper.psm1 deleted file mode 100644 index 61e4f767..00000000 --- a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/CommonResourceHelper.psm1 +++ /dev/null @@ -1,265 +0,0 @@ -<# - .SYNOPSIS - Creates and throws an invalid argument exception. - - .PARAMETER Message - The message explaining why this error is being thrown. - - .PARAMETER ArgumentName - The name of the invalid argument that is causing this error to be thrown. -#> -function New-InvalidArgumentException -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Message, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $ArgumentName - ) - - $argumentException = New-Object -TypeName 'ArgumentException' ` - -ArgumentList @($Message, $ArgumentName) - - $newObjectParameters = @{ - TypeName = 'System.Management.Automation.ErrorRecord' - ArgumentList = @($argumentException, $ArgumentName, 'InvalidArgument', $null) - } - - $errorRecord = New-Object @newObjectParameters - - throw $errorRecord -} - -<# - .SYNOPSIS - Creates and throws an invalid operation exception. - - .PARAMETER Message - The message explaining why this error is being thrown. - - .PARAMETER ErrorRecord - The error record containing the exception that is causing this terminating error. -#> -function New-InvalidOperationException -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Message, - - [Parameter()] - [ValidateNotNull()] - [System.Management.Automation.ErrorRecord] - $ErrorRecord - ) - - if ($null -eq $ErrorRecord) - { - $invalidOperationException = New-Object -TypeName 'InvalidOperationException' ` - -ArgumentList @($Message) - } - else - { - $invalidOperationException = New-Object -TypeName 'InvalidOperationException' ` - -ArgumentList @($Message, $ErrorRecord.Exception) - } - - $newObjectParameters = @{ - TypeName = 'System.Management.Automation.ErrorRecord' - ArgumentList = @( - $invalidOperationException.ToString(), - 'MachineStateIncorrect', - 'InvalidOperation', - $null - ) - } - - $errorRecordToThrow = New-Object @newObjectParameters - - throw $errorRecordToThrow -} - -<# - .SYNOPSIS - Creates and throws an object not found exception. - - .PARAMETER Message - The message explaining why this error is being thrown. - - .PARAMETER ErrorRecord - The error record containing the exception that is causing this terminating error. -#> -function New-ObjectNotFoundException -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Message, - - [Parameter()] - [ValidateNotNull()] - [System.Management.Automation.ErrorRecord] - $ErrorRecord - ) - - if ($null -eq $ErrorRecord) - { - $exception = New-Object -TypeName 'System.Exception' ` - -ArgumentList @($Message) - } - else - { - $exception = New-Object -TypeName 'System.Exception' ` - -ArgumentList @($Message, $ErrorRecord.Exception) - } - - $newObjectParameters = @{ - TypeName = 'System.Management.Automation.ErrorRecord' - ArgumentList = @( - $exception.ToString(), - 'MachineStateIncorrect', - 'ObjectNotFound', - $null - ) - } - - $errorRecordToThrow = New-Object @newObjectParameters - - throw $errorRecordToThrow -} - -<# - .SYNOPSIS - Creates and throws an invalid result exception. - - .PARAMETER Message - The message explaining why this error is being thrown. - - .PARAMETER ErrorRecord - The error record containing the exception that is causing this terminating error. -#> -function New-InvalidResultException -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Message, - - [Parameter()] - [ValidateNotNull()] - [System.Management.Automation.ErrorRecord] - $ErrorRecord - ) - - if ($null -eq $ErrorRecord) - { - $exception = New-Object -TypeName 'System.Exception' ` - -ArgumentList @($Message) - } - else - { - $exception = New-Object -TypeName 'System.Exception' ` - -ArgumentList @($Message, $ErrorRecord.Exception) - } - - $newObjectParameters = @{ - TypeName = 'System.Management.Automation.ErrorRecord' - ArgumentList = @( - $exception.ToString(), - 'MachineStateIncorrect', - 'InvalidResult', - $null - ) - } - - $errorRecordToThrow = New-Object @newObjectParameters - - throw $errorRecordToThrow -} - -<# - .SYNOPSIS - Retrieves the localized string data based on the machine's culture. - Falls back to en-US strings if the machine's culture is not supported. - - .PARAMETER ResourceName - The name of the resource as it appears before '.strings.psd1' of the localized string file. - For example: - For WindowsOptionalFeature: MSFT_WindowsOptionalFeature - For Service: MSFT_ServiceResource - For Registry: MSFT_RegistryResource - For Helper: xSQLServerHelper - - .PARAMETER ScriptRoot - Optional. The root path where to expect to find the culture folder. This is only needed - for localization in helper modules. This should not normally be used for resources. -#> -function Get-LocalizedData -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $ResourceName, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $ScriptRoot - ) - - if ( -not $ScriptRoot ) - { - $resourceDirectory = Join-Path -Path $PSScriptRoot -ChildPath $ResourceName - $localizedStringFileLocation = Join-Path -Path $resourceDirectory -ChildPath $PSUICulture - } - else - { - $localizedStringFileLocation = Join-Path -Path $ScriptRoot -ChildPath $PSUICulture - } - - if (-not (Test-Path -Path $localizedStringFileLocation)) - { - # Fallback to en-US - if ( -not $ScriptRoot ) - { - $localizedStringFileLocation = Join-Path -Path $resourceDirectory -ChildPath 'en-US' - } - else - { - $localizedStringFileLocation = Join-Path -Path $ScriptRoot -ChildPath 'en-US' - } - } - - Import-LocalizedData ` - -BindingVariable 'localizedData' ` - -FileName "$ResourceName.strings.psd1" ` - -BaseDirectory $localizedStringFileLocation - - return $localizedData -} - -Export-ModuleMember -Function @( - 'New-InvalidArgumentException', - 'New-InvalidOperationException', - 'New-ObjectNotFoundException', - 'New-InvalidResultException', - 'Get-LocalizedData' ) diff --git a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xCluster/MSFT_xCluster.psm1 b/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xCluster/MSFT_xCluster.psm1 deleted file mode 100644 index 66494aeb..00000000 --- a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xCluster/MSFT_xCluster.psm1 +++ /dev/null @@ -1,413 +0,0 @@ -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` - -ChildPath 'CommonResourceHelper.psm1') - -$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_xCluster' - -<# - .SYNOPSIS - Returns the current state of the failover cluster. - - .PARAMETER Name - Name of the failover cluster. - - .PARAMETER StaticIPAddress - Static IP Address of the failover cluster. - - .PARAMETER DomainAdministratorCredential - Credential used to create the failover cluster in Active Directory. -#> -function Get-TargetResource -{ - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [System.String] - $StaticIPAddress, - - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $DomainAdministratorCredential - ) - - Write-Verbose -Message ($script:localizedData.GetClusterInformation -f $Name) - - $computerInformation = Get-CimInstance -ClassName Win32_ComputerSystem - if (($null -eq $computerInformation) -or ($null -eq $computerInformation.Domain)) - { - $errorMessage = $script:localizedData.TargetNodeDomainMissing - New-InvalidOperationException -Message $errorMessage - } - - try - { - ($oldToken, $context, $newToken) = Set-ImpersonateAs -Credential $DomainAdministratorCredential - - $cluster = Get-Cluster -Name $Name -Domain $computerInformation.Domain - if ($null -eq $cluster) - { - $errorMessage = $script:localizedData.ClusterNameNotFound -f $Name - New-ObjectNotFoundException -Message $errorMessage - } - - $address = Get-ClusterGroup -Cluster $Name -Name 'Cluster IP Address' | Get-ClusterParameter -Name 'Address' - } - finally - { - if ($context) - { - $context.Undo() - $context.Dispose() - Close-UserToken -Token $newToken - } - } - - @{ - Name = $Name - StaticIPAddress = $address.Value - DomainAdministratorCredential = $DomainAdministratorCredential - } -} - -<# - .SYNOPSIS - Creates the failover cluster and adds a node to the failover cluster. - - .PARAMETER Name - Name of the failover cluster. - - .PARAMETER StaticIPAddress - Static IP Address of the failover cluster. - - .PARAMETER DomainAdministratorCredential - Credential used to create the failover cluster in Active Directory. - - .NOTES - If the cluster does not exist, it will be created in the domain and the - static IP address will be assigned to the cluster. - When the cluster exist (either it was created or already existed), it - will add the target node ($env:COMPUTERNAME) to the cluster. - If the target node already is a member of the failover cluster but has - status down, it will be removed and then added again to the failover - cluster. -#> -function Set-TargetResource -{ - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [System.String] - $StaticIPAddress, - - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $DomainAdministratorCredential - ) - - $bCreate = $true - - Write-Verbose -Message ($script:localizedData.CheckClusterPresent -f $Name) - - $computerInformation = Get-CimInstance -ClassName Win32_ComputerSystem - if (($null -eq $computerInformation) -or ($null -eq $computerInformation.Domain)) - { - $errorMessage = $script:localizedData.TargetNodeDomainMissing - New-InvalidOperationException -Message $errorMessage - } - - try - { - $cluster = Get-Cluster -Name $Name -Domain $computerInformation.Domain - - if ($cluster) - { - $bCreate = $false - } - } - catch - { - $bCreate = $true - } - - try - { - ($oldToken, $context, $newToken) = Set-ImpersonateAs -Credential $DomainAdministratorCredential - - if ($bCreate) - { - Write-Verbose -Message ($script:localizedData.ClusterAbsent -f $Name) - - New-Cluster -Name $Name -Node $env:COMPUTERNAME -StaticAddress $StaticIPAddress -NoStorage -Force -ErrorAction Stop - - if ( -not (Get-Cluster)) - { - $errorMessage = $script:localizedData.FailedCreatingCluster - New-InvalidOperationException -Message $errorMessage - } - - Write-Verbose -Message ($script:localizedData.ClusterCreated -f $Name) - } - else - { - $targetNodeName = $env:COMPUTERNAME - - Write-Verbose -Message ($script:localizedData.AddNodeToCluster -f $targetNodeName, $Name) - - $list = Get-ClusterNode -Cluster $Name - foreach ($node in $list) - { - if ($node.Name -eq $targetNodeName) - { - if ($node.State -eq 'Down') - { - Write-Verbose -Message ($script:localizedData.RemoveOfflineNodeFromCluster -f $targetNodeName, $Name) - - Remove-ClusterNode -Name $targetNodeName -Cluster $Name -Force - } - } - } - - Add-ClusterNode -Name $targetNodeName -Cluster $Name -NoStorage - - Write-Verbose -Message ($script:localizedData.AddNodeToClusterSuccessful -f $targetNodeName, $Name) - } - } - finally - { - if ($context) - { - $context.Undo() - $context.Dispose() - Close-UserToken -Token $newToken - } - } -} - -<# - .SYNOPSIS - Test the failover cluster exist and that the node is a member of the - failover cluster. - - .PARAMETER Name - Name of the failover cluster. - - .PARAMETER StaticIPAddress - Static IP Address of the failover cluster. - - .PARAMETER DomainAdministratorCredential - Credential used to create the failover cluster in Active Directory. - - .NOTES - The code will check the following in order: - - 1. Is target node a member of the Active Directory domain? - 2. Does the failover cluster exist in the Active Directory domain? - 3. Is the target node a member of the failover cluster? - 4. Does the cluster node have the status UP? - - If the first return false an error will be thrown. If either of the - other return $false, then the cluster will be created, if it does not - exist and then the node will be added to the failover cluster. -#> -function Test-TargetResource -{ - [OutputType([Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [System.String] - $StaticIPAddress, - - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $DomainAdministratorCredential - ) - - $returnValue = $false - - Write-Verbose -Message ($script:localizedData.CheckClusterPresent -f $Name) - - $ComputerInfo = Get-CimInstance -ClassName Win32_ComputerSystem - if (($null -eq $ComputerInfo) -or ($null -eq $ComputerInfo.Domain)) - { - $errorMessage = $script:localizedData.TargetNodeDomainMissing - New-InvalidOperationException -Message $errorMessage - } - - try - { - ($oldToken, $context, $newToken) = Set-ImpersonateAs -Credential $DomainAdministratorCredential - - $cluster = Get-Cluster -Name $Name -Domain $ComputerInfo.Domain - - Write-Verbose -Message ($script:localizedData.ClusterPresent -f $Name) - - if ($cluster) - { - $targetNodeName = $env:COMPUTERNAME - - Write-Verbose -Message ($script:localizedData.CheckClusterNodeIsUp -f $targetNodeName, $Name) - - $allNodes = Get-ClusterNode -Cluster $Name - - foreach ($node in $allNodes) - { - if ($node.Name -eq $targetNodeName) - { - if ($node.State -eq 'Up') - { - $returnValue = $true - } - else - { - Write-Verbose -Message ($script:localizedData.ClusterNodeIsDown -f $targetNodeName, $Name) - } - - break - } - } - - if ($returnValue) - { - Write-Verbose -Message ($script:localizedData.ClusterNodePresent -f $targetNodeName, $Name) - } - else - { - Write-Verbose -Message ($script:localizedData.ClusterNodeAbsent -f $targetNodeName, $Name) - } - } - } - catch - { - Write-Verbose -Message ($script:localizedData.ClusterAbsentWithError -f $Name, $_.Message) - } - finally - { - if ($context) - { - $context.Undo() - $context.Dispose() - - Close-UserToken -Token $newToken - } - } - - $returnValue -} - -<# - .SYNOPSIS - Loads and returns a reference to the impersonation library. - -#> -function Get-ImpersonateLib -{ - if ($script:ImpersonateLib) - { - return $script:ImpersonateLib - } - - $sig = @' -[DllImport("advapi32.dll", SetLastError = true)] -public static extern bool LogonUser(string lpszUsername, string lpszDomain, string lpszPassword, int dwLogonType, int dwLogonProvider, ref IntPtr phToken); - -[DllImport("kernel32.dll")] -public static extern Boolean CloseHandle(IntPtr hObject); -'@ - $script:ImpersonateLib = Add-Type -PassThru -Namespace 'Lib.Impersonation' -Name ImpersonationLib -MemberDefinition $sig - - return $script:ImpersonateLib -} - -<# - .SYNOPSIS - Starts to impersonate the credentials provided in parameter Credential on the current user context. - - .PARAMETER Credential - The credentials that should be impersonated. - - .OUTPUTS - Returns three values. - - First value: The current user token before impersonation. - Second value: The impersonation context returned when impersonation is started. - Third value: The impersonated user token. - - .NOTES - LogonUser function - https://msdn.microsoft.com/en-us/library/windows/desktop/aa378184(v=vs.85).aspx - - WindowsIdentity.Impersonate Method () - https://msdn.microsoft.com/en-us/library/w070t6ka(v=vs.110).aspx -#> -function Set-ImpersonateAs -{ - param - ( - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $Credential - ) - - [IntPtr] $userToken = [Security.Principal.WindowsIdentity]::GetCurrent().Token - $userToken - $ImpersonateLib = Get-ImpersonateLib - - $bLogin = $ImpersonateLib::LogonUser($Credential.GetNetworkCredential().UserName, $Credential.GetNetworkCredential().Domain, $Credential.GetNetworkCredential().Password, - 9, 0, [ref]$userToken) - - if ($bLogin) - { - $Identity = New-Object -TypeName Security.Principal.WindowsIdentity -ArgumentList $userToken - $context = $Identity.Impersonate() - } - else - { - $errorMessage = $script:localizedData.UnableToImpersonateUser -f $Credential.GetNetworkCredential().UserName - New-InvalidOperationException -Message $errorMessage - } - - $context, $userToken -} - -<# - .SYNOPSIS - Closes a (impersonation) user token. - - .PARAMETER Token - The user token to close. - - .NOTES - CloseHandle function - https://msdn.microsoft.com/en-us/library/windows/desktop/ms724211(v=vs.85).aspx -#> -function Close-UserToken -{ - param - ( - [Parameter(Mandatory = $true)] - [System.IntPtr] - $Token - ) - - $ImpersonateLib = Get-ImpersonateLib - - $bLogin = $ImpersonateLib::CloseHandle($Token) - if (-not $bLogin) - { - $errorMessage = $script:localizedData.UnableToCloseToken -f $Token.ToString() - New-InvalidOperationException -Message $errorMessage - } -} diff --git a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xCluster/MSFT_xCluster.schema.mof b/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xCluster/MSFT_xCluster.schema.mof deleted file mode 100644 index ea908a61..00000000 --- a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xCluster/MSFT_xCluster.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ -#pragma namespace("\\\\.\\root\\microsoft\\windows\\DesiredStateConfiguration") - -[ClassVersion("1.0.0"), FriendlyName("xCluster")] -class MSFT_xCluster : OMI_BaseResource -{ - [key, Description("Name of the Cluster")] string Name; - [required, Description("StaticIPAddress of the Cluster")] string StaticIPAddress; - - [required, EmbeddedInstance("MSFT_Credential"), Description("Credential to create the cluster")] - String DomainAdministratorCredential; -}; diff --git a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xCluster/en-US/MSFT_xCluster.strings.psd1 b/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xCluster/en-US/MSFT_xCluster.strings.psd1 deleted file mode 100644 index 353c2d48..00000000 --- a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xCluster/en-US/MSFT_xCluster.strings.psd1 +++ /dev/null @@ -1,22 +0,0 @@ -# Localized resources for xCluster - -ConvertFrom-StringData @' - CheckClusterPresent = Checking if cluster {0} is present. - ClusterPresent = Cluster {0} is present. - ClusterAbsent = Cluster {0} is NOT present. - ClusterCreated = Created cluster {0}. - AddNodeToCluster = Adding node {0} to cluster {1}. - RemoveOfflineNodeFromCluster = Node {0} is down, need to remove it from the cluster {1}. - AddNodeToClusterSuccessful = Added node {0} to cluster {1}. - CheckClusterNodeIsUp = Checking if the node {0} is a member of the cluster {1}, and so that node status is 'Up'. - ClusterNodeIsDown = Node {0} is in the cluster {1} but the status is not 'Up'. Node will be treated as NOT being a member of the cluster {1}. - ClusterNodePresent = Cluster node {0} is a member of cluster {1}. - ClusterNodeAbsent = Cluster node {0} is NOT a member of cluster {1}. - ClusterAbsentWithError = Cluster {0} is NOT present with error: {1} - TargetNodeDomainMissing = Can't find the target node's domain name. - ClusterNameNotFound = Can't find the cluster {0}. - FailedCreatingCluster = Cluster creation failed. Please verify output of 'Get-Cluster' command. - UnableToImpersonateUser = Can't logon as user {0}. - UnableToCloseToken = Can't close impersonation token {0}. - GetClusterInformation = Retrieving information for cluster {0}. -'@ diff --git a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterDisk/MSFT_xClusterDisk.psm1 b/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterDisk/MSFT_xClusterDisk.psm1 deleted file mode 100644 index 0cfcd56d..00000000 --- a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterDisk/MSFT_xClusterDisk.psm1 +++ /dev/null @@ -1,185 +0,0 @@ -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` - -ChildPath 'CommonResourceHelper.psm1') - -$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_xClusterDisk' - -<# - .SYNOPSIS - Returns the current state of the failover cluster disk resource. - - .PARAMETER Number - The disk number of the cluster disk. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Number - ) - - Write-Verbose -Message ($script:localizedData.GetClusterDiskInformation -f $Number) - - if ($null -ne ($diskInstance = Get-CimInstance -ClassName MSCluster_Disk -Namespace 'Root\MSCluster' -Filter "Number = $Number")) - { - $diskResource = Get-ClusterResource | - Where-Object -FilterScript { $_.ResourceType -eq 'Physical Disk' } | - Where-Object -FilterScript { ($_ | Get-ClusterParameter -Name DiskIdGuid).Value -eq $diskInstance.Id } - - @{ - Number = $Number - Ensure = 'Present' - Label = $diskResource.Name - } - } - else - { - @{ - Number = $Number - Ensure = 'Absent' - Label = '' - } - } -} - -<# - .SYNOPSIS - Adds or removed the failover cluster disk resource from the failover cluster. - - .PARAMETER Number - The disk number of the cluster disk. - - .PARAMETER Ensure - Define if the cluster disk should be added (Present) or removed (Absent). - Default value is 'Present'. - - .PARAMETER Label - The disk label that should be assigned to the disk on the Failover Cluster - disk resource. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Number, - - [Parameter()] - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure = 'Present', - - [Parameter()] - [System.String] - $Label - ) - - $getTargetResourceResult = Get-TargetResource -Number $Number - - if ($Ensure -eq 'Present') - { - if ($getTargetResourceResult.Ensure -ne $Ensure) - { - Write-Verbose -Message ($script:localizedData.AddDiskToCluster -f $Number) - - Get-ClusterAvailableDisk | Where-Object -FilterScript { - $_.Number -eq $Number - } | Add-ClusterDisk - } - - if ($getTargetResourceResult.Label -ne $Label) - { - Write-Verbose -Message ($script:localizedData.SetDiskLabel -f $Number, $Label) - - $diskInstance = Get-CimInstance -ClassName MSCluster_Disk -Namespace 'Root\MSCluster' -Filter "Number = $Number" - - $diskResource = Get-ClusterResource | - Where-Object -FilterScript { $_.ResourceType -eq 'Physical Disk' } | - Where-Object -FilterScript { - ($_ | Get-ClusterParameter -Name DiskIdGuid).Value -eq $diskInstance.Id - } - - # Set the label of the cluster disk - $diskResource.Name = $Label - $diskResource.Update() - } - } - else - { - if ($getTargetResourceResult.Ensure -eq 'Present' -and $Ensure -eq 'Absent') - { - Write-Verbose -Message ($script:localizedData.RemoveDiskFromCluster -f $Number) - - $diskInstance = Get-CimInstance -ClassName MSCluster_Disk -Namespace 'Root\MSCluster' -Filter "Number = $Number" - - $diskResource = Get-ClusterResource | - Where-Object -FilterScript { $_.ResourceType -eq 'Physical Disk' } | - Where-Object -FilterScript { - ($_ | Get-ClusterParameter -Name DiskIdGuid).Value -eq $diskInstance.Id - } - - # Remove the cluster disk - $diskResource | Remove-ClusterResource -Force - } - } -} - -<# - .SYNOPSIS - Tests that the failover cluster disk resource exist in the failover cluster, - and that is has the correct label. - - .PARAMETER Number - The disk number of the cluster disk. - - .PARAMETER Ensure - Define if the cluster disk should be added (Present) or removed (Absent). - Default value is 'Present'. - - .PARAMETER Label - The disk label that should be assigned to the disk on the Failover Cluster - disk resource. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Number, - - [Parameter()] - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure = 'Present', - - [Parameter()] - [System.String] - $Label - ) - - Write-Verbose -Message ($script:localizedData.EvaluatingClusterDiskInformation -f $Number) - - $getTargetResourceResult = Get-TargetResource -Number $Number - - if($Ensure -eq 'Present') - { - return ( - ($Ensure -eq $getTargetResourceResult.Ensure) -and - (($Label -eq $getTargetResourceResult.Label) -or (-not $PSBoundParameters.ContainsKey('Label'))) - ) - } - else - { - return $Ensure -eq $getTargetResourceResult.Ensure - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterDisk/MSFT_xClusterDisk.schema.mof b/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterDisk/MSFT_xClusterDisk.schema.mof deleted file mode 100644 index d199f533..00000000 --- a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterDisk/MSFT_xClusterDisk.schema.mof +++ /dev/null @@ -1,7 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xClusterDisk")] -class MSFT_xClusterDisk : OMI_BaseResource -{ - [Key, Description("The disk number of the cluster disk.")] String Number; - [Write, Description("Define if the cluster disk should be added (Present) or removed (Absent). Default value is 'Present'."),ValueMap{"Present", "Absent"},Values{"Present", "Absent"}] string Ensure; - [Write, Description("The disk label that should be assigned to the disk on the Failover Cluster disk resource.")] String Label; -}; diff --git a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterDisk/en-US/MSFT_xClusterDisk.strings.psd1 b/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterDisk/en-US/MSFT_xClusterDisk.strings.psd1 deleted file mode 100644 index 761c7123..00000000 --- a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterDisk/en-US/MSFT_xClusterDisk.strings.psd1 +++ /dev/null @@ -1,9 +0,0 @@ -# Localized resources for xClusterDisk - -ConvertFrom-StringData @' - AddDiskToCluster = Add the disk {0} to the cluster. - SetDiskLabel = Set the disk label for the disk {0} to '{1}'. - RemoveDiskFromCluster = Remove the disk {0} from the cluster. - GetClusterDiskInformation = Retrieving information for cluster disk {0}. - EvaluatingClusterDiskInformation = Evaluating state of cluster disk {0}. -'@ diff --git a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterNetwork/MSFT_xClusterNetwork.psm1 b/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterNetwork/MSFT_xClusterNetwork.psm1 deleted file mode 100644 index 494be5a8..00000000 --- a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterNetwork/MSFT_xClusterNetwork.psm1 +++ /dev/null @@ -1,236 +0,0 @@ -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` - -ChildPath 'CommonResourceHelper.psm1') - -$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_xClusterNetwork' - -<# - .SYNOPSIS - Returns the current state of the failover cluster network resource. - - .PARAMETER Address - The address for the cluster network in the format '10.0.0.0'. - - .PARAMETER AddressMask - The address mask for the cluster network in the format '255.255.255.0'. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Address, - - [Parameter(Mandatory = $true)] - [System.String] - $AddressMask - ) - - Write-Verbose -Message ($script:localizedData.GetClusterNetworkInformation -f $Name) - - $NetworkResource = Get-ClusterNetwork | Where-Object -FilterScript { - $_.Address -eq $Address -and $_.AddressMask -eq $AddressMask - } - - @{ - Address = $Address - AddressMask = $AddressMask - Name = $NetworkResource.Name - Role = $NetworkResource.Role - Metric = $NetworkResource.Metric - } -} - -<# - .SYNOPSIS - Configures the properties Name, Role and Metric of the failover cluster - network resource. - - .PARAMETER Address - The address for the cluster network in the format '10.0.0.0'. - - .PARAMETER AddressMask - The address mask for the cluster network in the format '255.255.255.0'. - - .PARAMETER Name - The name of the cluster network. If the cluster network name is not in - desired state it will be renamed to match this name. - - .PARAMETER Role - The role of the cluster network. If the cluster network role is not in - desired state it will change to match this role. - - The cluster network role can be set to either the value 0, 1 or 3. - - 0 = Do not allow cluster network communication - 1 = Allow cluster network communication only - 3 = Allow cluster network communication and client connectivity - - See this article for more information about cluster network role values; - https://technet.microsoft.com/en-us/library/dn550728(v=ws.11).aspx - - .PARAMETER Metric - The metric number for the cluster network. If the cluster network metric - number is not in desired state it will be changed to match this metric - number. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Address, - - [Parameter(Mandatory = $true)] - [System.String] - $AddressMask, - - [Parameter()] - [System.String] - $Name, - - [Parameter()] - [ValidateSet('0', '1', '3')] - [System.String] - $Role, - - [Parameter()] - [System.String] - $Metric - ) - - $getTargetResourceResult = Get-TargetResource -Address $Address -AddressMask $AddressMask - - if ($PSBoundParameters.ContainsKey('Name') -and $getTargetResourceResult.Name -ne $Name) - { - Write-Verbose -Message ($script:localizedData.ChangeNetworkName -f $Address, $AddressMask, $Name) - - $clusterNetworkResource = Get-ClusterNetwork | Where-Object -FilterScript { - $_.Address -eq $Address -and $_.AddressMask -eq $AddressMask - } - $clusterNetworkResource.Name = $Name - $clusterNetworkResource.Update() - } - - if ($PSBoundParameters.ContainsKey('Role') -and $getTargetResourceResult.Role -ne $Role) - { - Write-Verbose -Message ($script:localizedData.ChangeNetworkRole -f $Address, $AddressMask, $Role) - - $clusterNetworkResource = Get-ClusterNetwork | Where-Object -FilterScript { - $_.Address -eq $Address -and $_.AddressMask -eq $AddressMask - } - $clusterNetworkResource.Role = $Role - $clusterNetworkResource.Update() - } - - if ($PSBoundParameters.ContainsKey('Metric') -and $getTargetResourceResult.Metric -ne $Metric) - { - Write-Verbose -Message ($script:localizedData.ChangeNetworkMetric -f $Address, $AddressMask, $Metric) - - $clusterNetworkResource = Get-ClusterNetwork | Where-Object -FilterScript { - $_.Address -eq $Address -and $_.AddressMask -eq $AddressMask - } - $clusterNetworkResource.Metric = $Metric - $clusterNetworkResource.Update() - } -} - -<# - .SYNOPSIS - Tests that the failover cluster network resource exist and has the correct - values for the properties Name, Role and Metric. - - .PARAMETER Address - The address for the cluster network in the format '10.0.0.0'. - - .PARAMETER AddressMask - The address mask for the cluster network in the format '255.255.255.0'. - - .PARAMETER Name - The name of the cluster network. If the cluster network name is not in - desired state it will be renamed to match this name. - - .PARAMETER Role - The role of the cluster network. If the cluster network role is not in - desired state it will change to match this role. - - The cluster network role can be set to either the value 0, 1 or 3. - - 0 = Do not allow cluster network communication - 1 = Allow cluster network communication only - 3 = Allow cluster network communication and client connectivity - - See this article for more information about cluster network role values; - https://technet.microsoft.com/en-us/library/dn550728(v=ws.11).aspx - - .PARAMETER Metric - The metric number for the cluster network. If the cluster network metric - number is not in desired state it will be changed to match this metric - number. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Address, - - [Parameter(Mandatory = $true)] - [System.String] - $AddressMask, - - [Parameter()] - [System.String] - $Name, - - [Parameter()] - [ValidateSet('0', '1', '3')] - [System.String] - $Role, - - [Parameter()] - [System.String] - $Metric - ) - - Write-Verbose -Message ($script:localizedData.EvaluatingClusterNetworkInformation -f $Name) - - $getTargetResourceResult = Get-TargetResource -Address $Address -AddressMask $AddressMask - - $testTargetResourceReturnValue = $true - - if ($PSBoundParameters.ContainsKey('Name')) - { - if ($Name -ne $getTargetResourceResult.Name) - { - $testTargetResourceReturnValue = $false - } - } - - if ($PSBoundParameters.ContainsKey('Role')) - { - if ($Role -ne $getTargetResourceResult.Role) - { - $testTargetResourceReturnValue = $false - } - } - - if ($PSBoundParameters.ContainsKey('Metric')) - { - if ($Metric -ne $getTargetResourceResult.Metric) - { - $testTargetResourceReturnValue = $false - } - } - - $testTargetResourceReturnValue -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterNetwork/MSFT_xClusterNetwork.schema.mof b/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterNetwork/MSFT_xClusterNetwork.schema.mof deleted file mode 100644 index 63945b7e..00000000 --- a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterNetwork/MSFT_xClusterNetwork.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xClusterNetwork")] -class MSFT_xClusterNetwork : OMI_BaseResource -{ - [Key, Description("The address for the cluster network in the format '10.0.0.0'.")] String Address; - [Key, Description("The address mask for the cluster network in the format '255.255.255.0'.")] String AddressMask; - [Write, Description("The name of the cluster network. If the cluster network name is not in desired state it will be renamed to match this name.")] String Name; - [Write, Description("he role of the cluster network. If the cluster network role is not in desired state it will change to match this role."), ValueMap{"0","1","3"}, Values{"0","1","3"}] String Role; - [Write, Description("The metric number for the cluster network. If the cluster network metric number is not in desired state it will be changed to match this metric number.")] String Metric; -}; diff --git a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterNetwork/en-US/MSFT_xClusterNetwork.strings.psd1 b/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterNetwork/en-US/MSFT_xClusterNetwork.strings.psd1 deleted file mode 100644 index 06a0a884..00000000 --- a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterNetwork/en-US/MSFT_xClusterNetwork.strings.psd1 +++ /dev/null @@ -1,9 +0,0 @@ -# Localized resources for xClusterNetwork - -ConvertFrom-StringData @' - ChangeNetworkName = Changing the name of the network {0}/{1} to '{2}'. - ChangeNetworkRole = Changing the role of the network {0}/{1} to '{2}'. - ChangeNetworkMetric = Changing the metric of the network {0}/{1} to '{2}'. - GetClusterNetworkInformation = Retrieving information for cluster network {0}. - EvaluatingClusterNetworkInformation = Evaluating state of cluster network {0}. -'@ diff --git a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterPreferredOwner/MSFT_xClusterPreferredOwner.psm1 b/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterPreferredOwner/MSFT_xClusterPreferredOwner.psm1 deleted file mode 100644 index 18a68131..00000000 --- a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterPreferredOwner/MSFT_xClusterPreferredOwner.psm1 +++ /dev/null @@ -1,314 +0,0 @@ -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` - -ChildPath 'CommonResourceHelper.psm1') - -$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_xClusterPreferredOwner' - -<# - .SYNOPSIS - Returns the current state of the failover cluster group and cluster - resource preferred owners. - - .PARAMETER ClusterGroup - Name of the cluster group. - - .PARAMETER ClusterName - Name of the cluster. - - .PARAMETER Nodes - The nodes to set as owners. - - .PARAMETER ClusterResources - The resources to set preferred owners on. - - .PARAMETER Ensure - If the preferred owners should be present or absent. Default value is - 'Present'. -#> -function Get-TargetResource -{ - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $ClusterGroup, - - [Parameter(Mandatory = $true)] - [System.String] - $ClusterName, - - [Parameter(Mandatory = $true)] - [System.String[]] - $Nodes, - - [Parameter()] - [System.String[]] - $ClusterResources, - - [Parameter()] - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure = 'Present' - ) - - Write-Verbose -Message ($script:localizedData.GetOwnerInformationForCluster -f $ClusterName) - - $ownerNodes = @( - Write-Verbose -Message ($script:localizedData.GetOwnerInformationForClusterGroup -f $ClusterGroup) - ((Get-ClusterGroup -Cluster $ClusterName | Where-Object -FilterScript { - $_.Name -like $ClusterGroup - } | Get-ClusterOwnerNode).OwnerNodes).Name - - if ($ClusterResources) - { - foreach ($resource in $ClusterResources) - { - Write-Verbose -Message ($script:localizedData.GetOwnerInformationForClusterResource -f $resource) - ((Get-ClusterResource -Cluster $ClusterName | Where-Object -FilterScript { - $_.Name -like $resource - } | Get-ClusterOwnerNode).OwnerNodes).Name - } - } - ) - - $ownerNodes = $ownerNodes | Select-Object -Unique - - @{ - ClusterGroup = $ClusterGroup - ClusterName = $ClusterName - Nodes = $ownerNodes - ClusterResources = $ClusterResources - Ensure = $Ensure - } -} - -<# - .SYNOPSIS - Configures the desired preferred owners on the failover cluster group and cluster - resource. - - .PARAMETER ClusterGroup - Name of the cluster group. - - .PARAMETER ClusterName - Name of the cluster. - - .PARAMETER Nodes - The nodes to set as owners. - - .PARAMETER ClusterResources - The resources to set preferred owners on. - - .PARAMETER Ensure - If the preferred owners should be present or absent. Default value is - 'Present'. -#> -function Set-TargetResource -{ - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $ClusterGroup, - - [Parameter(Mandatory = $true)] - [System.String] - $ClusterName, - - [Parameter(Mandatory = $true)] - [System.String[]] - $Nodes, - - [Parameter()] - [System.String[]] - $ClusterResources, - - [Parameter()] - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure = 'Present' - ) - - Write-Verbose -Message ($script:localizedData.GetAllNodesOfCluster -f $ClusterName) - $allNodes = (Get-ClusterNode -Cluster $ClusterName).Name - - if ($Ensure -eq 'Present') - { - Write-Verbose -Message ($script:localizedData.SetOwnerForClusterGroup -f $ClusterGroup, $Nodes) - $null = Get-ClusterGroup -Cluster $ClusterName | Where-Object -FilterScript { - $_.Name -like $ClusterGroup - } | Set-ClusterOwnerNode -Owners $Nodes - - $null = Get-ClusterResource | Where-Object { - $_.OwnerGroup -like $ClusterGroup - } | Set-ClusterOwnerNode -Owners $allNodes - - Write-Verbose -Message ($script:localizedData.MoveClusterGroup -f $ClusterGroup, $Nodes[0]) - $null = Get-ClusterGroup -Cluster $ClusterName | Where-Object -FilterScript { - $_.name -like $ClusterGroup - } | Move-ClusterGroup -Node $Nodes[0] - - foreach ($resource in $ClusterResources) - { - Write-Verbose -Message ($script:localizedData.SetOwnerForClusterResource -f $resource, $Nodes) - $null = Get-ClusterResource -Cluster $ClusterName | Where-Object -FilterScript { - $_.Name -like $resource - } | Set-ClusterOwnerNode -Owners $Nodes - } - } - - if ($Ensure -eq 'Absent') - { - Write-Verbose -Message ($script:localizedData.GetOwnerInformationForClusterGroup -f $ClusterGroup) - $currentOwners = ((Get-ClusterGroup -Cluster $ClusterName | Where-Object -FilterScript { - $_.Name -like $ClusterGroup - } | Get-ClusterOwnerNode).OwnerNodes).Name | Sort-Object -Unique - - $newOwners = @( - foreach ($currentOwner in $currentOwners) - { - if ($Nodes -notcontains $currentOwner) - { - $currentOwner - } - } - ) - - Write-Verbose -Message ($script:localizedData.RemoveOwnerFromClusterGroup -f $ClusterGroup, $Nodes) - $null = Get-ClusterGroup -Cluster $ClusterName | Where-Object -FilterScript { - $_.Name -like $ClusterGroup - } | Set-ClusterOwnerNode $newOwners - - Write-Verbose -Message ($script:localizedData.SetOwnerForClusterGroup -f $ClusterGroup, $newOwners) - $null = Get-ClusterResource | Where-Object -FilterScript { - $_.OwnerGroup -like $ClusterGroup - } | Set-ClusterOwnerNode $allNodes - - Write-Verbose -Message ($script:localizedData.MoveClusterGroup -f $ClusterGroup, $newOwners[0]) - $null = Get-ClusterGroup -Cluster $ClusterName | Where-Object -FilterScript { - $_.Name -like $ClusterGroup - } | Move-ClusterGroup -Node $newOwners[0] - - foreach ($resource in $ClusterResources) - { - Write-Verbose -Message ($script:localizedData.GetOwnerInformationForClusterResource -f $resource) - $currentOwners = ((Get-ClusterResource -Cluster $ClusterName | Where-Object -FilterScript { - $_.Name -like $resource - } | Get-ClusterOwnerNode).OwnerNodes).Name | Sort-Object -Unique - - $newOwners = @( - foreach ($currentOwner in $currentOwners) - { - if ($Nodes -notcontains $currentOwner) - { - $currentOwner - } - } - ) - - Write-Verbose -Message ($script:localizedData.SetOwnerForClusterResource -f $resource, $newOwners) - $null = Get-ClusterResource -Cluster $ClusterName | Where-Object -FilterScript { - $_.Name -like $resource - } | Set-ClusterOwnerNode -Owners $newOwners - } - } -} - -<# - .SYNOPSIS - Tests so that the desired preferred owners on the failover cluster group - and cluster resource are in desired state. - - .PARAMETER ClusterGroup - Name of the cluster group. - - .PARAMETER ClusterName - Name of the cluster. - - .PARAMETER Nodes - The nodes to set as owners. - - .PARAMETER ClusterResources - The resources to set preferred owners on. - - .PARAMETER Ensure - If the preferred owners should be present or absent. Default value is - 'Present'. -#> - -function Test-TargetResource -{ - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $ClusterGroup, - - [Parameter(Mandatory = $true)] - [System.String] - $ClusterName, - - [Parameter(Mandatory = $true)] - [System.String[]] - $Nodes, - - [Parameter()] - [System.String[]] - $ClusterResources, - - [Parameter()] - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure = 'Present' - ) - - Write-Verbose -Message ($script:localizedData.TestOwnerInformationForCluster -f $ClusterName) - - $getTargetResourceResult = (Get-TargetResource @PSBoundParameters).Nodes - $result = $true - - if ($Ensure -eq 'Present') - { - foreach ($object in $getTargetResourceResult) - { - if ($Nodes -notcontains $object) - { - Write-Verbose -Message ($script:localizedData.WasNotFoundAsPossibleOwner -f $object) - $result = $false - } - } - - foreach ($object in $Nodes) - { - if ($getTargetResourceResult -notcontains $object) - { - Write-Verbose -Message ($script:localizedData.WasNotFoundAsPossibleOwner -f $object) - $result = $false - } - } - } - - if ($Ensure -eq 'Absent') - { - foreach ($object in $getTargetResourceResult) - { - if ($Nodes -contains $object) - { - Write-Verbose -Message ($script:localizedData.WasFoundAsPossibleOwner -f $object) - $result = $false - } - } - - foreach ($object in $Nodes) - { - if ($getTargetResourceResult -contains $object) - { - Write-Verbose -Message ($script:localizedData.WasFoundAsPossibleOwner -f $object) - $result = $false - } - } - } - - $result -} diff --git a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterPreferredOwner/MSFT_xClusterPreferredOwner.schema.mof b/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterPreferredOwner/MSFT_xClusterPreferredOwner.schema.mof deleted file mode 100644 index da074de0..00000000 --- a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterPreferredOwner/MSFT_xClusterPreferredOwner.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xClusterPreferredOwner")] -class MSFT_xClusterPreferredOwner : OMI_BaseResource -{ - [Key, Description("Name of the cluster group.")] String ClusterGroup; - [Key, Description("Name of the cluster.")] String ClusterName; - [Required, Description("The nodes to set as owners.")] String Nodes[]; - [Write, Description("he resources to set preferred owners on.")] String ClusterResources[]; - [Write, Description("If the preferred owners should be present or absent. Default value is 'Present'."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; -}; diff --git a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterPreferredOwner/en-US/MSFT_xClusterPreferredOwner.strings.psd1 b/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterPreferredOwner/en-US/MSFT_xClusterPreferredOwner.strings.psd1 deleted file mode 100644 index c481da37..00000000 --- a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterPreferredOwner/en-US/MSFT_xClusterPreferredOwner.strings.psd1 +++ /dev/null @@ -1,15 +0,0 @@ -# Localized resources for xClusterPreferredOwner - -ConvertFrom-StringData @' - GetOwnerInformationForCluster = Retrieving owner information for cluster {0}. - GetOwnerInformationForClusterGroup = Retrieving owner information for cluster role/group {0}. - GetOwnerInformationForClusterResource = Retrieving owner information for cluster resource {0}. - GetAllNodesOfCluster = Retrieving all nodes from cluster {0}. - SetOwnerForClusterGroup = Setting owners for cluster role/group {0} to {1}. - SetOwnerForClusterResource = Setting owners for cluster resource {0} to {1}. - MoveClusterGroup = Moving cluster role/group {0} to node {1}. - RemoveOwnerFromClusterGroup = Removing owners {1} from cluster role/group {0}. - TestOwnerInformationForCluster = Testing Owner information for cluster {0}. - WasFoundAsPossibleOwner = {0} was found as possible owner. - WasNotFoundAsPossibleOwner = {0} was NOT found as possible owner. -'@ diff --git a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterQuorum/MSFT_xClusterQuorum.psm1 b/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterQuorum/MSFT_xClusterQuorum.psm1 deleted file mode 100644 index 4967de05..00000000 --- a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterQuorum/MSFT_xClusterQuorum.psm1 +++ /dev/null @@ -1,210 +0,0 @@ -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` --ChildPath 'CommonResourceHelper.psm1') - -$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_xClusterQuorum' - -<# - .SYNOPSIS - Returns the current state of the failover cluster quorum. - - .PARAMETER IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes'. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [System.String] - $IsSingleInstance - ) - - Write-Verbose -Message $script:localizedData.GetClusterQuorumInformation - - $getClusterQuorumResult = Get-ClusterQuorum - - switch ($getClusterQuorumResult.QuorumType) - { - # WS2016 only - 'Majority' - { - if ($null -eq $getClusterQuorumResult.QuorumResource) - { - $clusterQuorumType = 'NodeMajority' - } - elseif ($getClusterQuorumResult.QuorumResource.ResourceType.DisplayName -eq 'Physical Disk') - { - $clusterQuorumType = 'NodeAndDiskMajority' - } - elseif ($getClusterQuorumResult.QuorumResource.ResourceType.DisplayName -eq 'File Share Witness') - { - $clusterQuorumType = 'NodeAndFileShareMajority' - } - else - { - throw "Unknown quorum resource: $($getClusterQuorumResult.QuorumResource)" - } - } - - # WS2012R2 only - 'NodeMajority' - { - $clusterQuorumType = 'NodeMajority' - } - - 'NodeAndDiskMajority' - { - $clusterQuorumType = 'NodeAndDiskMajority' - } - - 'NodeAndFileShareMajority' - { - $clusterQuorumType = 'NodeAndFileShareMajority' - } - - # All - 'DiskOnly' - { - $clusterQuorumType = 'DiskOnly' - } - - # Default - default - { - throw "Unknown quorum type: $($getClusterQuorumResult.QuorumType)" - } - } - - if ($clusterQuorumType -eq 'NodeAndFileShareMajority') - { - $clusterQuorumResource = $getClusterQuorumResult.QuorumResource | - Get-ClusterParameter -Name SharePath | - Select-Object -ExpandProperty Value - } - else - { - $clusterQuorumResource = [String] $getClusterQuorumResult.QuorumResource.Name - } - - @{ - IsSingleInstance = $IsSingleInstance - Type = $clusterQuorumType - Resource = $clusterQuorumResource - } -} - -<# - .SYNOPSIS - Configures the failover cluster quorum. - - .PARAMETER IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes'. - - .PARAMETER Type - Quorum type to use. Can be set to either NodeMajority, NodeAndDiskMajority, - NodeAndFileShareMajority or DiskOnly. - - .PARAMETER Resource - The name of the disk or file share resource to use as witness. This parameter - is optional if the quorum type is set to NodeMajority. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [System.String] - $IsSingleInstance, - - [Parameter()] - [ValidateSet('NodeMajority', 'NodeAndDiskMajority', 'NodeAndFileShareMajority', 'DiskOnly')] - [System.String] - $Type, - - [Parameter()] - [System.String] - $Resource - ) - - Write-Verbose -Message ($script:localizedData.SetClusterQuorum -f $Type) - - switch ($Type) - { - 'NodeMajority' - { - Set-ClusterQuorum -NoWitness - } - - 'NodeAndDiskMajority' - { - Set-ClusterQuorum -DiskWitness $Resource - } - - 'NodeAndFileShareMajority' - { - Set-ClusterQuorum -FileShareWitness $Resource - } - - 'DiskOnly' - { - Set-ClusterQuorum -DiskOnly $Resource - } - } -} - -<# - .SYNOPSIS - Tests the current state of the failover cluster quorum. - - .PARAMETER IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes'. - - .PARAMETER Type - Quorum type to use. Can be set to either NodeMajority, NodeAndDiskMajority, - NodeAndFileShareMajority or DiskOnly. - - .PARAMETER Resource - The name of the disk or file share resource to use as witness. This parameter - is optional if the quorum type is set to NodeMajority. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [System.String] - $IsSingleInstance, - - [Parameter()] - [ValidateSet('NodeMajority', 'NodeAndDiskMajority', 'NodeAndFileShareMajority', 'DiskOnly')] - [System.String] - $Type, - - [Parameter()] - [System.String] - $Resource - ) - - Write-Verbose -Message $script:localizedData.EvaluatingClusterQuorumInformation - - $getGetTargetResourceResult = Get-TargetResource -IsSingleInstance $IsSingleInstance - - $testTargetResourceReturnValue = $false - - if ($getGetTargetResourceResult.Type -eq $Type -and $getGetTargetResourceResult.Resource -eq $Resource) - { - $testTargetResourceReturnValue = $true - } - - $testTargetResourceReturnValue -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterQuorum/MSFT_xClusterQuorum.schema.mof b/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterQuorum/MSFT_xClusterQuorum.schema.mof deleted file mode 100644 index 0e22d071..00000000 --- a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterQuorum/MSFT_xClusterQuorum.schema.mof +++ /dev/null @@ -1,7 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xClusterQuorum")] -class MSFT_xClusterQuorum : OMI_BaseResource -{ - [Key, Description("Specifies the resource is a single instance, the value must be 'Yes'."), ValueMap{"Yes"}, Values{"Yes"}] string IsSingleInstance; - [Write, Description("Quorum type to use. Can be set to either NodeMajority, NodeAndDiskMajority, NodeAndFileShareMajority or DiskOnly."), ValueMap{"NodeMajority", "NodeAndDiskMajority", "NodeAndFileShareMajority", "DiskOnly"}, Values{"NodeMajority", "NodeAndDiskMajority", "NodeAndFileShareMajority", "DiskOnly"}] string Type; - [Write, Description("The name of the disk or file share resource to use as witness. This parameter is optional if the quorum type is set to NodeMajority.")] String Resource; -}; diff --git a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterQuorum/en-US/MSFT_xClusterQuorum.strings.psd1 b/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterQuorum/en-US/MSFT_xClusterQuorum.strings.psd1 deleted file mode 100644 index 26d01cde..00000000 --- a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xClusterQuorum/en-US/MSFT_xClusterQuorum.strings.psd1 +++ /dev/null @@ -1,7 +0,0 @@ -# Localized resources for xClusterQuorum - -ConvertFrom-StringData @' - GetClusterQuorumInformation = Retrieving quorum information for cluster. - SetClusterQuorum = Setting quorum to type '{0}'. - EvaluatingClusterQuorumInformation = Evaluating state of quorum for cluster. -'@ diff --git a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xWaitForCluster/MSFT_xWaitForCluster.psm1 b/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xWaitForCluster/MSFT_xWaitForCluster.psm1 deleted file mode 100644 index b8336313..00000000 --- a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xWaitForCluster/MSFT_xWaitForCluster.psm1 +++ /dev/null @@ -1,183 +0,0 @@ -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` --ChildPath 'CommonResourceHelper.psm1') - -$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_xWaitForCluster' - -<# - .SYNOPSIS - Get the values for which failover cluster and for how long to wait for the - cluster to exist. - - .PARAMETER Name - Name of the cluster to wait for. - - .PARAMETER RetryIntervalSec - Interval to check for cluster existence. Default values is 10 seconds. - - .PARAMETER RetryCount - Maximum number of retries to check for cluster existence. Default value - is 50 retries. -#> -function Get-TargetResource -{ - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Name, - - [Parameter()] - [System.UInt64] - $RetryIntervalSec = 10, - - [Parameter()] - [System.UInt32] - $RetryCount = 50 - ) - - Write-Verbose -Message $script:localizedData.ReturnParameterValues - - @{ - Name = $Name - RetryIntervalSec = $RetryIntervalSec - RetryCount = $RetryCount - } -} - -<# - .SYNOPSIS - Waits for the specific failover cluster to exist. It will throw an error if the - cluster has not been detected during the timeout period. - - .PARAMETER Name - Name of the cluster to wait for. - - .PARAMETER RetryIntervalSec - Interval to check for cluster existence. Default values is 10 seconds. - - .PARAMETER RetryCount - Maximum number of retries to check for cluster existence. Default value - is 50 retries. -#> -function Set-TargetResource -{ - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Name, - - [Parameter()] - [System.UInt64] - $RetryIntervalSec = 10, - - [Parameter()] - [System.UInt32] - $RetryCount = 50 - ) - - $clusterFound = $false - Write-Verbose -Message ($script:localizedData.CheckClusterPresent -f $Name) - - for ($count = 0; $count -lt $RetryCount; $count++) - { - try - { - $computerObject = Get-CimInstance -ClassName Win32_ComputerSystem - if ($null -eq $computerObject -or $null -eq $computerObject.Domain) - { - Write-Verbose -Message $script:localizedData.TargetNodeDomainMissing - break - } - - $cluster = Get-Cluster -Name $Name -Domain $computerObject.Domain - - if ($null -ne $cluster) - { - Write-Verbose -Message ($script:localizedData.ClusterPresent -f $Name) - $clusterFound = $true - break - } - } - catch - { - Write-Verbose -Message ($script:localizedData.ClusterAbsent -f $Name, $RetryIntervalSec) - } - - Write-Verbose -Message ($script:localizedData.ClusterAbsent -f $Name, $RetryIntervalSec) - Start-Sleep -Seconds $RetryIntervalSec - } - - if (-not $clusterFound) - { - $errorMessage = $script:localizedData.ClusterAbsentAfterTimeOut -f $Name, $count, $RetryIntervalSec - New-InvalidOperationException -Message $errorMessage - } -} - -<# - .SYNOPSIS - Test if the specific failover cluster exist. - - .PARAMETER Name - Name of the cluster to wait for. - - .PARAMETER RetryIntervalSec - Interval to check for cluster existence. Default values is 10 seconds. - - .PARAMETER RetryCount - Maximum number of retries to check for cluster existence. Default value - is 50 retries. -#> -function Test-TargetResource -{ - [OutputType([Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Name, - - [Parameter()] - [System.UInt64] - $RetryIntervalSec = 10, - - [Parameter()] - [System.UInt32] - $RetryCount = 50 - ) - - Write-Verbose -Message ($script:localizedData.EvaluatingClusterPresent -f $Name) - - $testTargetResourceReturnValue = $false - - try - { - $computerObject = Get-CimInstance -ClassName Win32_ComputerSystem - if ($null -eq $computerObject -or $null -eq $computerObject.Domain) - { - Write-Verbose -Message $script:localizedData.TargetNodeDomainMissing - } - else - { - $cluster = Get-Cluster -Name $Name -Domain $computerObject.Domain - if ($null -eq $cluster) - { - Write-Verbose -Message ($script:localizedData.ClusterAbsentWithDomain -f $Name, $computerObject.Domain) - } - else - { - Write-Verbose -Message ($script:localizedData.ClusterPresent -f $Name) - $testTargetResourceReturnValue = $true - } - } - } - catch - { - Write-Verbose -Message ($script:localizedData.ClusterAbsentWithError -f $Name, $_.Message) - } - - $testTargetResourceReturnValue -} - diff --git a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xWaitForCluster/MSFT_xWaitForCluster.schema.mof b/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xWaitForCluster/MSFT_xWaitForCluster.schema.mof deleted file mode 100644 index 6da3968d..00000000 --- a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xWaitForCluster/MSFT_xWaitForCluster.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ -#pragma namespace("\\\\.\\root\\microsoft\\windows\\DesiredStateConfiguration") - -[ClassVersion("1.0.0"), FriendlyName("xWaitForCluster")] -class MSFT_xWaitForCluster : OMI_BaseResource -{ - [Key, Description("Name of the cluster to wait for.")] string Name; - [Write, Description("Interval to check for cluster existence. Default values is 10 seconds.")] Uint64 RetryIntervalSec; - [Write, Description("Maximum number of retries to check for cluster existence. Default value is 50 retries.")] Uint32 RetryCount; -}; - - diff --git a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xWaitForCluster/en-US/MSFT_xWaitForCluster.strings.psd1 b/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xWaitForCluster/en-US/MSFT_xWaitForCluster.strings.psd1 deleted file mode 100644 index 60e652f4..00000000 --- a/lib/puppet_x/dsc_resources/xFailOverCluster/DSCResources/MSFT_xWaitForCluster/en-US/MSFT_xWaitForCluster.strings.psd1 +++ /dev/null @@ -1,13 +0,0 @@ -# Localized resources for xWaitForCluster - -ConvertFrom-StringData @' - ReturnParameterValues = Returning the values passed as parameters. - CheckClusterPresent = Checking if cluster {0} is present. - TargetNodeDomainMissing = Can't find the target node's domain name. - ClusterPresent = Cluster {0} is present. - ClusterAbsent = Cluster {0} is NOT present. Will retry again after {1} seconds. - ClusterAbsentWithDomain = Cluster {0} is NOT present in Active Directory domain '{1}'. - ClusterAbsentWithError = Cluster {0} is NOT present with error: {1} - ClusterAbsentAfterTimeOut = Failover cluster {0} was not found after {1} attempts with {2} seconds interval. - EvaluatingClusterPresent = Evaluating if cluster {0} is present. -'@ diff --git a/lib/puppet_x/dsc_resources/xFailOverCluster/LICENSE b/lib/puppet_x/dsc_resources/xFailOverCluster/LICENSE deleted file mode 100644 index a1d2d916..00000000 --- a/lib/puppet_x/dsc_resources/xFailOverCluster/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2017 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/lib/puppet_x/dsc_resources/xFailOverCluster/xFailOverCluster.psd1 b/lib/puppet_x/dsc_resources/xFailOverCluster/xFailOverCluster.psd1 deleted file mode 100644 index 73e91f66..00000000 --- a/lib/puppet_x/dsc_resources/xFailOverCluster/xFailOverCluster.psd1 +++ /dev/null @@ -1,114 +0,0 @@ -@{ - -ModuleVersion = '1.8.0.0' - -GUID = '026e7fd8-06dd-41bc-b373-59366ab18679' - -Author = 'Microsoft Corporation' - -CompanyName = 'Microsoft Corporation' - -Copyright = '(c) 2017 Microsoft Corporation. All rights reserved.' - -Description = 'Module containing DSC resources used to configure Failover Clusters.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/xFailOverCluster/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/xFailOverCluster' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - ReleaseNotes = '- Changes to xFailOverCluster - - Added a common resource helper module with helper functions for localization. - - Added helper functions; Get-LocalizedData, New-InvalidResultException, - New-ObjectNotFoundException, New-InvalidOperationException and - New-InvalidArgumentException. - - Fixed lint error MD034 and fixed typos in README.md. - - Opt-in for module files common tests ([issue 119](https://github.com/PowerShell/xFailOverCluster/issues/119)). - - Removed Byte Order Mark (BOM) from the files; CommonResourceHelper.psm1 and FailoverClusters.stubs.psm1. - - Opt-in for script files common tests ([issue 121](https://github.com/PowerShell/xFailOverCluster/issues/121)). - - Removed Byte Order Mark (BOM) from the files; CommonResourceHelper.Tests.ps1, - MSFT\_xCluster.Tests.ps1, MSFT\_xClusterDisk.Tests.ps1, - MSFT\_xClusterPreferredOwner.Tests.ps1, MSFT_xWaitForCluster.Tests.ps1. - - Added common test helper functions to help test the throwing of localized error strings. - - Get-InvalidArgumentRecord - - Get-InvalidOperationRecord - - Get-ObjectNotFoundException - - Get-InvalidResultException. - - Updated year to 2017 in license file and module manifest ([issue 131](https://github.com/PowerShell/xFailOverCluster/issues/131)). -- Changes to xClusterDisk - - Enabled localization for all strings ([issue 84](https://github.com/PowerShell/xFailOverCluster/issues/84)). - - Fixed the OutputType data type that was not fully qualified. - - Minor style changes. - - Fixed Script Analyzer warnings for Write-Verbose. -- Changes to xClusterNetwork - - Replaced the URL for the parameter Role in README.md. The new URL is a more - generic description of the possible settings for the Role parameter. The - previous URL was still correct but focused on Hyper-V in particular. - - Fixed typos in parameter descriptions in README.md, comment-based help and schema.mof. - - Enabled localization for all strings ([issue 85](https://github.com/PowerShell/xFailOverCluster/issues/85)). - - Minor style changes. - - Fixed Script Analyzer warnings for Write-Verbose. -- Changes to xCluster - - Resolved Script Analyzer rule warnings by changing Get-WmiObject to - Get-CimInstance ([issue 49](https://github.com/PowerShell/xFailOverCluster/issues/49)). - - Minor style change in tests. Removed "-" in front of "-Be", "-Not", "-Throw", - etc. - - Enabled localization for all strings ([issue 83](https://github.com/PowerShell/xFailOverCluster/issues/83)). - - Added tests to improve code coverage. - - Fixed random problem with tests failing with error "Invalid token for - impersonation - it cannot be duplicated." ([issue 133](https://github.com/PowerShell/xFailOverCluster/issues/133)). - - Minor style changes. - - Fixed Script Analyzer warnings for Write-Verbose. -- Changes to xWaitForCluster - - Refactored the unit test for this resource to use stubs and increase coverage - ([issue 78](https://github.com/PowerShell/xFailOverCluster/issues/78)). - - Now the Test-TargetResource correctly returns false if the domain name cannot - be evaluated ([issue 107](https://github.com/PowerShell/xFailOverCluster/issues/107)). - - Changed the code to be more aligned with the style guideline. - - Updated parameter description in the schema.mof. - - Resolved Script Analyzer warnings ([issue 54](https://github.com/PowerShell/xFailOverCluster/issues/54)). - - Enabled localization for all strings ([issue 88](https://github.com/PowerShell/xFailOverCluster/issues/88)). - - Minor style changes. -- Changes to xClusterQuorum - - Refactored the unit test for this resource to use stubs and increase coverage - ([issue 77](https://github.com/PowerShell/xFailOverCluster/issues/77)). - - Changed the code to be more aligned with the style guideline. - - Updated parameter description in the schema.mof. - - Added example ([issue 47](https://github.com/PowerShell/xFailOverCluster/issues/47)) - - 1-SetQuorumToNodeMajority.ps1 - - 2-SetQuorumToNodeAndDiskMajority.ps1 - - 3-SetQuorumToNodeAndFileShareMajority.ps1 - - 4-SetQuorumToDiskOnly.ps1 - - Added links to examples from README.md. - - Minor style changes. - - Enabled localization for all strings ([issue 87](https://github.com/PowerShell/xFailOverCluster/issues/87)). -- Changes to xClusterPreferredOwner - - Enabled localization for all strings ([issue 86](https://github.com/PowerShell/xFailOverCluster/issues/86)). - - Fixed typo in the returned hash table from Get-TargetResource. - - Minor style changes. - -' - - } # End of PSData hashtable - -} # End of PrivateData hashtable -} - - - diff --git a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/HyperVCommon/HyperVCommon.psm1 b/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/HyperVCommon/HyperVCommon.psm1 deleted file mode 100644 index 42978cd5..00000000 --- a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/HyperVCommon/HyperVCommon.psm1 +++ /dev/null @@ -1,407 +0,0 @@ -#region localizeddata -if (Test-Path "${PSScriptRoot}\${PSUICulture}") -{ - Import-LocalizedData ` - -BindingVariable LocalizedData ` - -Filename HyperVCommon.strings.psd1 ` - -BaseDirectory "${PSScriptRoot}\${PSUICulture}" -} -else -{ - # fallback to en-US - Import-LocalizedData ` - -BindingVariable LocalizedData ` - -Filename HyperVCommon.strings.psd1 ` - -BaseDirectory "${PSScriptRoot}\en-US" -} -#endregion - -<# - .SYNOPSIS - Throws an InvalidOperation custom exception. - - .PARAMETER ErrorId - The error Id of the exception. - - .PARAMETER ErrorMessage - The error message text to set in the exception. -#> -function New-InvalidOperationError -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $ErrorId, - - [Parameter(Mandatory = $true)] - [System.String] - $ErrorMessage - ) - - $exception = New-Object -TypeName System.InvalidOperationException ` - -ArgumentList $ErrorMessage - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidOperation - $errorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord ` - -ArgumentList $exception, $ErrorId, $errorCategory, $null - throw $errorRecord -} # end function New-InvalidOperationError - -<# - .SYNOPSIS - Throws an InvalidArgument custom exception. - - .PARAMETER ErrorId - The error Id of the exception. - - .PARAMETER ErrorMessage - The error message text to set in the exception. -#> -function New-InvalidArgumentError -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $ErrorId, - - [Parameter(Mandatory = $true)] - [System.String] - $ErrorMessage - ) - - $exception = New-Object -TypeName System.ArgumentException ` - -ArgumentList $ErrorMessage - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidArgument - $errorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord ` - -ArgumentList $exception, $ErrorId, $errorCategory, $null - throw $errorRecord -} # end function New-InvalidArgumentError - -<# - .SYNOPSIS - Sets one or more virtual machine properties, powering the VM - off if required. - - .PARAMETER Name - Name of the virtual machine to apply the changes to. - - .PARAMETER VMName - Name of the virtual machine to apply the changes to. - - .PARAMETER VMCommand - The Hyper-V cmdlet name to call to enact the changes. - - .PARAMETER ChangeProperty - The collection of cmdlet parameter names and values to pass to the command. - - .PARAMETER WaitForIP - Waits for the virtual machine to report an IP address when transitioning - into a running state. - - .PARAMETER RestartIfNeeded - Power cycle the virtual machine if changes are required. -#> -function Set-VMProperty -{ - [CmdletBinding(DefaultParameterSetName = 'Name')] - param - ( - [Parameter(Mandatory = $true, ParameterSetName = 'Name')] - [System.String] - $Name, - - [Parameter(Mandatory = $true, ParameterSetName = 'VMName')] - [System.String] - $VMName, - - [Parameter(Mandatory = $true)] - [System.String] - $VMCommand, - - [Parameter(Mandatory = $true)] - [System.Collections.Hashtable] - $ChangeProperty, - - [Parameter()] - [System.Boolean] - $WaitForIP, - - [Parameter()] - [System.Boolean] - $RestartIfNeeded - ) - - if ($PSBoundParameters.ContainsKey('VMName')) - { - # Add the -Name property to the ChangeProperty hashtable for splatting - $ChangeProperty['VMName'] = $VMName - - # Set the common parameters for splatting against Get-VM and Set-VMState - $vmCommonProperty = @{ Name = $VMName; } - - # Ensure that the name parameter is set for verbose messages - $Name = $VMName - } - else - { - # Add the -Name property to the ChangeProperty hashtable for splatting - $ChangeProperty['Name'] = $Name - - # Set the common parameters for splatting against Get-VM and Set-VMState - $vmCommonProperty = @{ Name = $Name; } - } - - $vmObject = Get-VM @vmCommonProperty - $vmOriginalState = $vmObject.State - - if ($vmOriginalState -ne 'Off' -and $RestartIfNeeded) - { - # Turn the vm off to make changes - Set-VMState @vmCommonProperty -State Off - - Write-Verbose -Message ($localizedData.UpdatingVMProperties -f $Name) - # Make changes using the passed hashtable - & $VMCommand @ChangeProperty - - # Cannot move an off VM to a paused state - only to running state - if ($vmOriginalState -eq 'Running') - { - Set-VMState @vmCommonProperty -State Running -WaitForIP $WaitForIP - } - - Write-Verbose -Message ($localizedData.VMPropertiesUpdated -f $Name) - - # Cannot restore a vm to a paused state - if ($vmOriginalState -eq 'Paused') - { - Write-Warning -Message ($localizedData.VMStateWillBeOffWarning -f $Name) - } - } - elseif ($vmOriginalState -eq 'Off') - { - Write-Verbose -Message ($localizedData.UpdatingVMProperties -f $Name) - & $VMCommand @ChangeProperty - Write-Verbose -Message ($localizedData.VMPropertiesUpdated -f $Name) - } - else - { - $errorMessage = $localizedData.CannotUpdatePropertiesOnlineError -f $Name, $vmOriginalState - New-InvalidOperationError -ErrorId RestartRequired -ErrorMessage $errorMessage - } -} #end function - -<# - .SYNOPSIS - Sets one or more virtual machine properties, powering the VM - off if required. - - .PARAMETER Name - Name of the virtual machine to apply the changes to. - - .PARAMETER State - The target power state of the virtual machine. - - .PARAMETER ChangeProperty - The collection of cmdlet parameter names and values to pass to the command. - - .PARAMETER WaitForIP - Waits for the virtual machine to be report an IP address when transitioning - into a running state. -#> -function Set-VMState -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [Alias('VMName')] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [ValidateSet('Running','Paused','Off')] - [System.String] - $State, - - [Parameter()] - [System.Boolean] - $WaitForIP - ) - - switch ($State) - { - 'Running' { - $vmCurrentState = (Get-VM -Name $Name).State - if ($vmCurrentState -eq 'Paused') - { - # If VM is in paused state, use resume-vm to make it running - Write-Verbose -Message ($localizedData.ResumingVM -f $Name) - Resume-VM -Name $Name - } - elseif ($vmCurrentState -eq 'Off') - { - # If VM is Off, use start-vm to make it running - Write-Verbose -Message ($localizedData.StartingVM -f $Name) - Start-VM -Name $Name - } - - if ($WaitForIP) - { - Wait-VMIPAddress -Name $Name -Verbose - } - } - 'Paused' { - if ($vmCurrentState -ne 'Off') - { - Write-Verbose -Message ($localizedData.SuspendingVM -f $Name) - Suspend-VM -Name $Name - } - } - 'Off' { - if ($vmCurrentState -ne 'Off') - { - Write-Verbose -Message ($localizedData.StoppingVM -f $Name) - Stop-VM -Name $Name -Force -WarningAction SilentlyContinue - } - } - } -} #end function - -<# - .SYNOPSIS - Waits for a virtual machine to be assigned an IP address. - - .PARAMETER Name - Name of the virtual machine to apply the changes to. - - .PARAMETER Timeout - Number of seconds to wait before timing out. Defaults to 300 (5 minutes). -#> -function Wait-VMIPAddress -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [Alias('VMName')] - [System.String] - $Name, - - [Parameter()] - [System.Int32] - $Timeout = 300 - ) - - [System.Int32] $elapsedSeconds = 0 - while ((Get-VMNetworkAdapter -VMName $Name).IpAddresses.Count -lt 2) - { - Write-Verbose -Message ($localizedData.WaitingForVMIPAddress -f $Name) - Start-Sleep -Seconds 3; - - $elapsedSeconds += 3 - if ($elapsedSeconds -gt $Timeout) - { - $errorMessage = $localizedData.WaitForVMIPAddressTimeoutError -f $Name, $Timeout - New-InvalidOperationError -ErrorId 'WaitVmTimeout' -ErrorMessage $errorMessage - } - } -} #end function - -<# - .SYNOPSIS - Ensures that the specified PowerShell module(s) are installed. - - .PARAMETER Name - Name of the PowerShell module to check is installed. -#> -function Assert-Module -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.String[]] - $Name - ) - - if (-not (Get-Module -Name $Name -ListAvailable )) - { - $errorMessage = $localizedData.RoleMissingError -f $Name - New-InvalidOperationError -ErrorId MissingRole -ErrorMessage $errorMessage - } -} #end function - -<# - .SYNOPSIS - Converts a number of seconds, minutes, hours or days into a System.TimeSpan object. - - .PARAMETER TimeInterval - The total number of seconds, minutes, hours or days to convert. - - .PARAMETER TimeSpanType - Convert using specified interval type. -#> -function ConvertTo-TimeSpan -{ - [CmdletBinding()] - [OutputType([System.TimeSpan])] - param - ( - [Parameter(Mandatory = $true)] - [System.UInt32] - $TimeInterval, - - [Parameter(Mandatory = $true)] - [ValidateSet('Seconds','Minutes','Hours','Days')] - [System.String] - $TimeIntervalType - ) - - $newTimeSpanParams = @{ } - switch ($TimeIntervalType) - { - 'Seconds' { $newTimeSpanParams['Seconds'] = $TimeInterval } - 'Minutes' { $newTimeSpanParams['Minutes'] = $TimeInterval } - 'Hours' { $newTimeSpanParams['Hours'] = $TimeInterval } - 'Days' { $newTimeSpanParams['Days'] = $TimeInterval } - } - return (New-TimeSpan @newTimeSpanParams) -} #end function ConvertTo-TimeSpan - -<# - .SYNOPSIS - Converts a System.TimeSpan into the number of seconds, minutes, hours or days. - - .PARAMETER TimeSpan - TimeSpan to convert into an integer - - .PARAMETER TimeSpanType - Convert timespan into the total number of seconds, minutes, hours or days. -#> -function ConvertFrom-TimeSpan -{ - [CmdletBinding()] - [OutputType([System.Int32])] - param - ( - [Parameter(Mandatory = $true)] - [System.TimeSpan] - $TimeSpan, - - [Parameter(Mandatory = $true)] - [ValidateSet('Seconds','Minutes','Hours','Days')] - [System.String] - $TimeSpanType - ) - - switch ($TimeSpanType) - { - 'Seconds' { return $TimeSpan.TotalSeconds -as [System.UInt32] } - 'Minutes' { return $TimeSpan.TotalMinutes -as [System.UInt32] } - 'Hours' { return $TimeSpan.TotalHours -as [System.UInt32] } - 'Days' { return $TimeSpan.TotalDays -as [System.UInt32] } - } -} #end function ConvertFrom-TimeSpan diff --git a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/HyperVCommon/en-us/HyperVCommon.strings.psd1 b/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/HyperVCommon/en-us/HyperVCommon.strings.psd1 deleted file mode 100644 index d1cdd761..00000000 --- a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/HyperVCommon/en-us/HyperVCommon.strings.psd1 +++ /dev/null @@ -1,15 +0,0 @@ -ConvertFrom-StringData @' - UpdatingVMProperties = Updating VM '{0}' properties. - VMPropertiesUpdated = VM '{0}' properties have been updated. - WaitingForVMIPAddress = Waiting for IP Address for VM '{0}' ... - StoppingVM = Stopping VM '{0}'. - SuspendingVM = Suspending VM '{0}'. - StartingVM = Starting VM '{0}'. - ResumingVM = Resuming VM '{0}'. - - VMStateWillBeOffWarning = VM '{0}' state will be 'OFF' and not 'Paused'. - - CannotUpdatePropertiesOnlineError = Can not change properties for VM '{0}' in '{1}' state unless 'RestartIfNeeded' is set to true. - WaitForVMIPAddressTimeoutError = Waiting for VM '{0}' IP address timed out after {1} seconds. - RoleMissingError = Please ensure that '{0}' role is installed with its PowerShell module. -'@ diff --git a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVHD/MSFT_xVHD.psm1 b/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVHD/MSFT_xVHD.psm1 deleted file mode 100644 index f1e769cf..00000000 --- a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVHD/MSFT_xVHD.psm1 +++ /dev/null @@ -1,381 +0,0 @@ -<# -.SYNOPSIS - Gets MSFT_xVHD resource current state. - -.PARAMETER Name - The desired VHD file name. - -.PARAMETER Path - The desired Path where the VHD will be created. - -.PARAMETER Generation - Virtual disk format. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [String] - $Name, - - [Parameter(Mandatory = $true)] - [String] - $Path, - - [Parameter()] - [ValidateSet("Vhd","Vhdx")] - [String] - $Generation = "Vhd" - ) - - # Check if Hyper-V module is present for Hyper-V cmdlets - if (!(Get-Module -ListAvailable -Name Hyper-V)) - { - Throw 'Please ensure that Hyper-V role is installed with its PowerShell module' - } - - # Construct the full path for the vhdFile - $vhdName = GetNameWithExtension -Name $Name -Generation $Generation - $vhdFilePath = Join-Path -Path $Path -ChildPath $vhdName - Write-Verbose -Message "Vhd full path is $vhdFilePath" - - $vhd = Get-VHD -Path $vhdFilePath -ErrorAction SilentlyContinue - - $ensure = 'Absent' - if ($vhd) - { - $ensure = 'Present' - } - - @{ - Name = $Name - Path = $Path - ParentPath = $vhd.ParentPath - Generation = $vhd.VhdFormat - Ensure = $ensure - ID = $vhd.DiskIdentifier - Type = $vhd.VhdType - FileSizeBytes = $vhd.FileSize - MaximumSizeBytes = $vhd.Size - IsAttached = $vhd.Attached - } -} - -<# -.SYNOPSIS - Configures MSFT_xVHD resource state. - -.PARAMETER Name - The desired VHD file name. - -.PARAMETER Path - The desired Path where the VHD will be created. - -.PARAMETER ParentPath - Parent VHD file path, for differencing disk. - -.PARAMETER MaximumSizeBytes - Maximum size of VHD to be created. - -.PARAMETER Type - Virtual disk type. - -.PARAMETER Generation - Virtual disk format. - -.PARAMETER Ensure - Ensures that the VHD is Present or Absent. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [String] - $Name, - - [Parameter(Mandatory = $true)] - [String] - $Path, - - [Parameter()] - [String] - $ParentPath, - - [Parameter()] - [Uint64] - $MaximumSizeBytes, - - [Parameter()] - [ValidateSet('Dynamic', 'Fixed', 'Differencing')] - [String] - $Type = 'Dynamic', - - [Parameter()] - [ValidateSet('Vhd', 'Vhdx')] - [String] - $Generation = 'Vhd', - - [Parameter()] - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present' - ) - - # Construct the full path for the vhdFile - $vhdName = GetNameWithExtension -Name $Name -Generation $Generation - $vhdFilePath = Join-Path -Path $Path -ChildPath $vhdName - Write-Verbose -Message "Vhd full path is $vhdFilePath" - - Write-Verbose -Message "Checking if $vhdFilePath is $Ensure ..." - - # If vhd should be absent, delete it - if ($Ensure -eq 'Absent') - { - if (Test-Path -Path $vhdFilePath) - { - Write-Verbose -Message "$vhdFilePath is not $Ensure" - Remove-Item -Path $vhdFilePath -Force -ErrorAction Stop - } - Write-Verbose -Message "$vhdFilePath is $Ensure" - } - - else - { - # Check if the Vhd is present - try - { - $vhd = Get-VHD -Path $vhdFilePath -ErrorAction Stop - - # If this is a differencing disk, check the parent path - if ($ParentPath) - { - Write-Verbose -Message "Checking if $vhdFilePath parent path is $ParentPath ..." - - # If the parent path is not set correct, fix it - if ($vhd.ParentPath -ne $ParentPath) - { - Write-Verbose -Message "$vhdFilePath parent path is not $ParentPath." - Set-VHD -Path $vhdFilePath -ParentPath $ParentPath - Write-Verbose -Message "$vhdFilePath parent path is now $ParentPath." - } - else - { - Write-Verbose -Message "$vhdFilePath is $Ensure and parent path is set to $ParentPath." - } - } - - # This is a fixed disk, check the size - elseif ($PSBoundParameters.ContainsKey('MaximumSizeBytes')) - { - Write-Verbose -Message "Checking if $vhdFilePath size is $MaximumSizeBytes ..." - - # If the size is not correct, fix it - if ($vhd.Size -ne $MaximumSizeBytes) - { - Write-Verbose -Message "$vhdFilePath size is not $MaximumSizeBytes." - Resize-VHD -Path $vhdFilePath -SizeBytes $MaximumSizeBytes - Write-Verbose -Message "$vhdFilePath size is now $MaximumSizeBytes." - } - else - { - Write-Verbose -Message "$vhdFilePath is $Ensure and size is $MaximumSizeBytes." - } - } - - if ($vhd.Type -ne $Type) - { - Write-Verbose -Message 'This module can''t convert disk types' - } - } - - # Vhd file is not present - catch - { - Write-Verbose -Message "$vhdFilePath is not $Ensure" - if ($ParentPath) - { - $null = New-VHD -Path $vhdFilePath -ParentPath $ParentPath - } - else - { - $params = @{ - Path = $vhdFilePath - SizeBytes = $MaximumSizeBytes - $Type = $True - } - $null = New-VHD @params - } - - Write-Verbose -Message "$vhdFilePath is now $Ensure" - } - } -} - -<# -.SYNOPSIS - Tests if MSFT_xVHD resource state is in the desired state or not. - -.PARAMETER Name - The desired VHD file name. - -.PARAMETER Path - The desired Path where the VHD will be created. - -.PARAMETER ParentPath - Parent VHD file path, for differencing disk. - -.PARAMETER MaximumSizeBytes - Maximum size of VHD to be created. - -.PARAMETER Type - Virtual disk type. - -.PARAMETER Generation - Virtual disk format. - -.PARAMETER Ensure - Ensures that the VHD is Present or Absent. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [String] - $Name, - - [Parameter(Mandatory = $true)] - [String] - $Path, - - [Parameter()] - [String] - $ParentPath, - - [Parameter()] - [Uint64] - $MaximumSizeBytes, - - [Parameter()] - [ValidateSet('Vhd', 'Vhdx')] - [String] - $Generation = 'Vhd', - - [Parameter()] - [ValidateSet('Dynamic', 'Fixed', 'Differencing')] - [String] - $Type = 'Dynamic', - - [Parameter()] - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present' - ) - - # Check if Hyper-V module is present for Hyper-V cmdlets - if (!(Get-Module -ListAvailable -Name Hyper-V)) - { - Throw "Please ensure that Hyper-V role is installed with its PowerShell module" - } - - # input validation - if ($Type -ne 'Differencing' -and -not $MaximumSizeBytes) - { - Throw 'Specify MaximumSizeBytes property for Fixed and Dynamic VHDs.' - } - - if ($ParentPath -and $Type -ne 'Differencing') - { - Throw 'Parent path is only supported for Differencing disks' - } - - if (-not $ParentPath -and $Type -eq 'Differencing') - { - Throw 'Differencing requires a parent path' - } - - if ($ParentPath) - { - if (!(Test-Path -Path $ParentPath)) - { - Throw "$ParentPath does not exists" - } - - # Check if the generation matches parenting disk - if ($Generation -and ($ParentPath.Split('.')[-1] -ne $Generation)) - { - Throw "Generation $Generation should match ParentPath extension $($ParentPath.Split('.')[-1])" - } - } - - if (!(Test-Path -Path $Path)) - { - Throw "$Path does not exists" - } - - # Construct the full path for the vhdFile - $vhdName = GetNameWithExtension -Name $Name -Generation $Generation - $vhdFilePath = Join-Path -Path $Path -ChildPath $vhdName - Write-Verbose -Message "Vhd full path is $vhdFilePath" - - # Add the logic here and at the end return either $true or $false. - $result = Test-VHD -Path $vhdFilePath -ErrorAction SilentlyContinue - Write-Verbose -Message "Vhd $vhdFilePath is present:$result and Ensure is $Ensure" - return ($result -and ($Ensure -eq "Present")) -} - -<# -.SYNOPSIS - Appends generation appropriate file extension if not already specified. - -.PARAMETER Name - The desired VHD file name. - -.PARAMETER Generation - Virtual disk format. -#> -function GetNameWithExtension -{ - param - ( - [Parameter(Mandatory = $true)] - [String] - $Name, - - [Parameter(Mandatory = $true)] - [String] - $Generation = 'Vhd' - ) - - # If the name ends with vhd or vhdx don't append the generation to the vhdname. - if ($Name -like '*.vhd' -or $Name -like '*.vhdx') - { - $extension = $Name.Split('.')[-1] - if ($Generation -ne $extension) - { - throw "the extension $extension on the name does not match the generation $Generation" - } - else - { - Write-Verbose -Message "Vhd full name is $vhdName" - $vhdName = $Name - } - } - else - { - # Append generation to the name - $vhdName = "$Name.$Generation" - Write-Verbose -Message "Vhd full name is $vhdName" - } - - $vhdName -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVHD/MSFT_xVHD.schema.mof b/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVHD/MSFT_xVHD.schema.mof deleted file mode 100644 index f41e9d2a..00000000 --- a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVHD/MSFT_xVHD.schema.mof +++ /dev/null @@ -1,15 +0,0 @@ -[ClassVersion("1.0.0"), FriendlyName("xVHD")] -class MSFT_xVHD : OMI_BaseResource -{ - [Key, Description("Name of the VHD File")] String Name; - [Key, Description("Folder where the VHD will be created")] String Path; - [Write, Description("Parent VHD file path, for differencing disk")] String ParentPath; - [Write, Description("Maximum size of Vhd to be created")] Uint64 MaximumSizeBytes; - [Write, Description("Virtual disk format - Vhd or Vhdx"), ValueMap{"Vhd","Vhdx"}, Values{"Vhd","Vhdx"}] String Generation; - [Write, Description("Should the VHD be created or deleted"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Read, Description("Virtual Disk Identifier")] String ID; - [Write, Description("Type of Vhd - Dynamic, Fixed, Differencing"), ValueMap{"Dynamic","Fixed","Differencing"}, Values{"Dynamic","Fixed","Differencing"}] String Type; - [Read, Description("Current size of the VHD")] Uint64 FileSizeBytes; - [Read, Description("Is the VHD attached to a VM or not")] Boolean IsAttached; -}; - diff --git a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMDvdDrive/MSFT_xVMDvdDrive.psm1 b/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMDvdDrive/MSFT_xVMDvdDrive.psm1 deleted file mode 100644 index fd7e010d..00000000 --- a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMDvdDrive/MSFT_xVMDvdDrive.psm1 +++ /dev/null @@ -1,437 +0,0 @@ -#region localizeddata -if (Test-Path "${PSScriptRoot}\${PSUICulture}") -{ - Import-LocalizedData ` - -BindingVariable LocalizedData ` - -Filename MSFT_xVMDvdDrive.strings.psd1 ` - -BaseDirectory "${PSScriptRoot}\${PSUICulture}" -} -else -{ - #fallback to en-US - Import-LocalizedData ` - -BindingVariable LocalizedData ` - -Filename MSFT_xVMDvdDrive.strings.psd1 ` - -BaseDirectory "${PSScriptRoot}\en-US" -} -#endregion - -# Import the common HyperV functions -Import-Module -Name ( Join-Path ` - -Path (Split-Path -Path $PSScriptRoot -Parent) ` - -ChildPath '\HyperVCommon\HyperVCommon.psm1' ) - -<# - .SYNOPSIS - Returns the current status of the VM DVD Drive. - - .PARAMETER VMName - Specifies the name of the virtual machine to which the DVD drive is to be added. - - .PARAMETER ControllerNumber - Specifies the number of the controller to which the DVD drive is to be added. - - .PARAMETER ControllerLocation - Specifies the number of the location on the controller at which the DVD drive is to be added. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $VMName, - - [parameter(Mandatory = $true)] - [System.Uint32] - $ControllerNumber, - - [parameter(Mandatory = $true)] - [System.Uint32] - $ControllerLocation - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.GettingVMDVDDriveMessage ` - -f $VMName,$ControllerNumber,$ControllerLocation) - ) -join '' ) - - Test-ParameterValid @PSBoundParameters - - $dvdDrive = Get-VMDvdDrive @PSBoundParameters - - if ($dvdDrive) - { - $returnValue = @{ - VMName = $VMName - ControllerLocation = $ControllerLocation - ControllerNumber = $ControllerNumber - Path = $dvdDrive.Path - Ensure = 'Present' - } - } - else - { - $returnValue = @{ - VMName = $VMName - ControllerLocation = $ControllerLocation - ControllerNumber = $ControllerNumber - Path = '' - Ensure = 'Absent' - } - } # if - - $returnValue -} # Get-TargetResource - -<# - .SYNOPSIS - Adds, removes or changes the mounted ISO on a VM DVD Drive. - - .PARAMETER VMName - Specifies the name of the virtual machine to which the DVD drive is to be added. - - .PARAMETER ControllerNumber - Specifies the number of the controller to which the DVD drive is to be added. - - .PARAMETER ControllerLocation - Specifies the number of the location on the controller at which the DVD drive is to be added. - - .PARAMETER Path - Specifies the full path to the virtual hard disk file or physical hard disk volume for the - added DVD drive. - - .PARAMETER Ensure - Specifies if the DVD Drive should exist or not. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $VMName, - - [parameter(Mandatory = $true)] - [System.Uint32] - $ControllerLocation, - - [parameter(Mandatory = $true)] - [System.Uint32] - $ControllerNumber, - - [System.String] - $Path, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = 'Present' - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.SettingVMDVDDriveMessage ` - -f $VMName,$ControllerNumber,$ControllerLocation) - ) -join '' ) - - $null = $PSBoundParameters.Remove('Path') - $null = $PSBoundParameters.Remove('Ensure') - - # Get the current status of the VM DVD Drive - $dvdDrive = Get-TargetResource @PSBoundParameters - - if ($Ensure -eq 'Present') - { - # The DVD Drive should exist - if ($dvdDrive.Ensure -eq 'Present') - { - # The DVD Drive already exists - if (-not [String]::IsNullOrWhiteSpace($Path) ` - -and ($Path -ne $dvdDrive.Path)) - { - # The current path assigned to the DVD Drive needs to be changed. - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.VMDVDDriveChangePathMessage) ` - -f $VMName,$ControllerNumber,$ControllerLocation,$Path ` - ) -join '' ) - - Set-VMDvdDrive @PSBoundParameters -Path $Path - } - } - else - { - # The DVD Drive does not exist but should. Change required. - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.VMDVDDriveAddMessage) ` - -f $VMName,$ControllerNumber,$ControllerLocation,$Path ` - ) -join '' ) - - if (-not [String]::IsNullOrWhiteSpace($Path)) { - $PSBoundParameters.Add('Path',$Path) - } # if - - Add-VMDvdDrive @PSBoundParameters - } # if - } - else - { - # The DVD Drive should not exist - if ($dvdDrive.Ensure -eq 'Present') - { - # The DVD Drive does exist, but should not. Change required. - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.VMDVDDriveRemoveMessage) ` - -f $VMName,$ControllerNumber,$ControllerLocation ` - ) -join '' ) - - Remove-VMDvdDrive @PSBoundParameters - } # if - } # if -} # Set-TargetResource - -<# - .SYNOPSIS - Tests the state of a VM DVD Drive and the mounted ISO. - - .PARAMETER VMName - Specifies the name of the virtual machine to which the DVD drive is to be added. - - .PARAMETER ControllerNumber - Specifies the number of the controller to which the DVD drive is to be added. - - .PARAMETER ControllerLocation - Specifies the number of the location on the controller at which the DVD drive is to be added. - - .PARAMETER Path - Specifies the full path to the virtual hard disk file or physical hard disk volume for the - added DVD drive. - - .PARAMETER Ensure - Specifies if the DVD Drive should exist or not. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $VMName, - - [parameter(Mandatory = $true)] - [System.Uint32] - $ControllerLocation, - - [parameter(Mandatory = $true)] - [System.Uint32] - $ControllerNumber, - - [System.String] - $Path, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = 'Present' - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.TestingVMDVDDriveMessage ` - -f $VMName,$ControllerNumber,$ControllerLocation) - ) -join '' ) - - $null = $PSBoundParameters.Remove('Path') - $null = $PSBoundParameters.Remove('Ensure') - - # Get the current status of the VM DVD Drive - $dvdDrive = Get-TargetResource @PSBoundParameters - - # Flag to signal whether settings are correct - [Boolean] $desiredConfigurationMatch = $true - - if ($Ensure -eq 'Present') - { - # The DVD Drive should exist - if ($dvdDrive.Ensure -eq 'Present') - { - # The DVD Drive already exists - if (-not [String]::IsNullOrWhiteSpace($Path) ` - -and ($Path -ne $dvdDrive.Path)) - { - # The current path assigned to the DVD drive is wrong. Change required. - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.VMDVDDriveExistsAndShouldPathMismatchMessage) ` - -f $VMName,$ControllerNumber,$ControllerLocation,$Path,$dvdDrive.Path ` - ) -join '' ) - - $desiredConfigurationMatch = $false - } - else - { - # The DVD drive exists and should. Change not required. - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.VMDVDDriveExistsAndShouldMessage) ` - -f $VMName,$ControllerNumber,$ControllerLocation,$Path ` - ) -join '' ) - } # if - } - else - { - # The DVD Drive does not exist but should. Change required. - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.VMDVDDriveDoesNotExistButShouldMessage) ` - -f $VMName,$ControllerNumber,$ControllerLocation ` - ) -join '' ) - - $desiredConfigurationMatch = $false - } # if - } - else - { - # The DVD Drive should not exist - if ($dvdDrive.Ensure -eq 'Present') - { - # The DVD Drive does exist, but should not. Change required. - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.VMDVDDriveDoesExistButShouldNotMessage) ` - -f $VMName,$ControllerNumber,$ControllerLocation ` - ) -join '' ) - - $desiredConfigurationMatch = $false - } - else - { - # The DVD Drive does not exist and should not. Change not required. - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.VMDVDDriveDoesNotExistAndShouldNotMessage) ` - -f $VMName,$ControllerNumber,$ControllerLocation ` - ) -join '' ) - } # if - } # if - - return $desiredConfigurationMatch -} # Test-TargetResource - -<# - .SYNOPSIS - Validates that the parameters passed are valid. If the parameter combination - is invalid then an exception will be thrown. The following items are validated: - - The VM exists. - - A disk mount point at the controller number/location exists. - - A hard disk is not already mounted at the controller number/location. - - The Path if required is valid. - - .PARAMETER VMName - Specifies the name of the virtual machine to which the DVD drive is to be added. - - .PARAMETER ControllerNumber - Specifies the number of the controller to which the DVD drive is to be added. - - .PARAMETER ControllerLocation - Specifies the number of the location on the controller at which the DVD drive is to be added. - - .PARAMETER Path - Specifies the full path to the virtual hard disk file or physical hard disk volume for the - added DVD drive. - - .PARAMETER Ensure - Specifies if the DVD Drive should exist or not. - - .OUTPUTS - Returns true if the parameters are valid, but will throw a specific error if not. -#> -function Test-ParameterValid -{ - [CmdletBinding()] - [OutputType([Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $VMName, - - [parameter(Mandatory = $true)] - [System.Uint32] - $ControllerLocation, - - [parameter(Mandatory = $true)] - [System.Uint32] - $ControllerNumber, - - [System.String] - $Path, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = 'Present' - ) - - # Check if Hyper-V module is present for Hyper-V cmdlets - if(-not (Get-Module -ListAvailable -Name Hyper-V)) - { - New-InvalidArgumentError ` - -ErrorId 'RoleMissingError' ` - -ErrorMessage ($LocalizedData.RoleMissingError -f ` - 'Hyper-V') - } # if - - # Does the VM exist? - $null = Get-VM -Name $VMName - - # Does the controller exist? - if (-not (Get-VMScsiController -VMName $VMName -ControllerNumber $ControllerNumber) ` - -and -not (Get-VMIdeController -VMName $VMName -ControllerNumber $ControllerNumber)) - { - # No it does not - New-InvalidArgumentError ` - -ErrorId 'VMControllerDoesNotExistError' ` - -ErrorMessage ($LocalizedData.VMControllerDoesNotExistError -f ` - $VMName,$ControllerNumber) - } # if - - # Is a Hard Drive assigned to this controller location/number? - if (Get-VMHardDiskDrive ` - -VMName $VMName ` - -ControllerLocation $ControllerLocation ` - -ControllerNumber $ControllerNumber) - { - # Yes, so don't even try and touch this - New-InvalidArgumentError ` - -ErrorId 'ControllerConflictError' ` - -ErrorMessage ($LocalizedData.ControllerConflictError -f ` - $VMName,$ControllerNumber,$ControllerLocation) - } # if - - if ($Ensure -eq 'Present') - { - # If the path is not blank does it exist? - if (-not ([String]::IsNullOrWhiteSpace($Path))) - { - if (-not (Test-Path -Path $Path)) - { - # Path does not exist - New-InvalidArgumentError ` - -ErrorId 'PathDoesNotExistError' ` - -ErrorMessage ($LocalizedData.PathDoesNotExistError -f ` - $Path) - } # if - } # if - } # if - - return $true -} # Test-ParameterValid - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMDvdDrive/MSFT_xVMDvdDrive.schema.mof b/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMDvdDrive/MSFT_xVMDvdDrive.schema.mof deleted file mode 100644 index 04e3c4ad..00000000 --- a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMDvdDrive/MSFT_xVMDvdDrive.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xVMDvdDrive")] -class MSFT_xVMDvdDrive : OMI_BaseResource -{ - [Key, Description("Specifies the name of the virtual machine to which the DVD drive is to be added.")] String VMName; - [Key, Description("Specifies the number of the controller to which the DVD drive is to be added.")] Uint32 ControllerNumber; - [Key, Description("Specifies the number of the location on the controller at which the DVD drive is to be added.")] Uint32 ControllerLocation; - [Write, Description("Specifies the full path to the virtual hard disk file or physical hard disk volume for the added DVD drive.")] String Path; - [Write, Description("Specifies if the DVD Drive should exist or not."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; -}; diff --git a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMDvdDrive/en-us/MSFT_xVMDvdDrive.strings.psd1 b/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMDvdDrive/en-us/MSFT_xVMDvdDrive.strings.psd1 deleted file mode 100644 index 2c29d24c..00000000 --- a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMDvdDrive/en-us/MSFT_xVMDvdDrive.strings.psd1 +++ /dev/null @@ -1,20 +0,0 @@ -ConvertFrom-StringData @' - GettingVMDVDDriveMessage = Getting VM DVD Drive for VM '{0}' controller number {1} location {2}. - - SettingVMDVDDriveMessage = Setting VM DVD Drive for VM '{0}' controller number {1} location {2}. - VMDVDDriveChangePathMessage = VM '{0}' DVD Drive on controller number {1} location {2} already exists, changing the Path to '{3}'. - VMDVDDriveAddMessage = Adding VM '{0}' DVD Drive on controller number {1} location {2} with path '{3}'. - VMDVDDriveRemoveMessage = Removing VM '{0}' DVD Drive on controller number {1} location {2}. - - TestingVMDVDDriveMessage = Testing VM DVD Drive for VM '{0}' controller number {1} location {2}. - VMDVDDriveExistsAndShouldPathMismatchMessage = VM '{0}' DVD Drive on controller number {1} location {2} exists and should but the desired path '{3}' does not match '{4}'. Change required. - VMDVDDriveExistsAndShouldMessage = VM '{0}' DVD Drive on controller number {1} location {2} exists and should and the path '{3}' matches. Change not required. - VMDVDDriveDoesNotExistButShouldMessage = VM '{0}' DVD Drive on controller number {1} location {2} does not exist but should. Change required. - VMDVDDriveDoesExistButShouldNotMessage = VM '{0}' DVD Drive on controller number {1} location {2} exists but should not. Change required. - VMDVDDriveDoesNotExistAndShouldNotMessage = VM '{0}' DVD Drive on controller number {1} location {2} does not exist and should not. Change not required. - - RoleMissingError = Please ensure that '{0}' role is installed with its PowerShell module. - VMControllerDoesNotExistError = The controller number {1} does not exist on VM '{0}'. - PathDoesNotExistError = The path '{0}' does not exist. - ControllerConflictError = The Controller number {1} location {2} already has a hard drive attached on VM '{0}'. -'@ diff --git a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMHost/MSFT_xVMHost.psm1 b/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMHost/MSFT_xVMHost.psm1 deleted file mode 100644 index 140a5895..00000000 --- a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMHost/MSFT_xVMHost.psm1 +++ /dev/null @@ -1,409 +0,0 @@ -#region localizeddata -if (Test-Path "${PSScriptRoot}\${PSUICulture}") -{ - Import-LocalizedData -BindingVariable localizedData -Filename MSFT_xVMHost.psd1 ` - -BaseDirectory "${PSScriptRoot}\${PSUICulture}" -} -else -{ - # fallback to en-US - Import-LocalizedData -BindingVariable localizedData -Filename MSFT_xVMHost.psd1 ` - -BaseDirectory "${PSScriptRoot}\en-US" -} -#endregion - -# Import the common HyperV functions -Import-Module -Name ( Join-Path ` - -Path (Split-Path -Path $PSScriptRoot -Parent) ` - -ChildPath '\HyperVCommon\HyperVCommon.psm1' ) - -<# -.SYNOPSIS - Gets MSFT_xVMHost resource current state. - -.PARAMETER IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes'. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [System.String] - $IsSingleInstance - ) - - Assert-Module -Name 'Hyper-V' - - Write-Verbose -Message $localizedData.QueryingVMHost - $vmHost = Get-VMHost - - # Convert the current TimeSpan into minutes - $convertFromTimeSpanParams = @{ - TimeSpan = $vmHost.ResourceMeteringSaveInterval - TimeSpanType = 'Minutes' - } - $resourceMeteringSaveInterval = ConvertFrom-TimeSpan @convertFromTimeSpanParams - - $configuration = @{ - IsSingleInstance = $IsSingleInstance - EnableEnhancedSessionMode = $vmHost.EnableEnhancedSessionMode - FibreChannelWwnn = $vmHost.FibreChannelWwnn - FibreChannelWwpnMaximum = $vmHost.FibreChannelWwpnMaximum - FibreChannelWwpnMinimum = $vmHost.FibreChannelWwpnMinimum - MacAddressMaximum = $vmHost.MacAddressMaximum - MacAddressMinimum = $vmHost.MacAddressMinimum - MaximumStorageMigrations = $vmHost.MaximumStorageMigrations - MaximumVirtualMachineMigrations = $vmHost.MaximumVirtualMachineMigrations - NumaSpanningEnabled = $vmHost.NumaSpanningEnabled - ResourceMeteringSaveIntervalMinute = $resourceMeteringSaveInterval - UseAnyNetworkForMigration = $vmHost.UseAnyNetworkForMigration - VirtualHardDiskPath = $vmHost.VirtualHardDiskPath - VirtualMachineMigrationAuthenticationType = $vmHost.VirtualMachineMigrationAuthenticationType - VirtualMachineMigrationPerformanceOption = $vmHost.VirtualMachineMigrationPerformanceOption - VirtualMachinePath = $vmHost.VirtualMachinePath - } - - return $configuration -} - -<# -.SYNOPSIS - Tests if MSFT_xVMHost resource state is in the desired state or not. - -.PARAMETER IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes'. - -.PARAMETER EnableEnhancedSessionMode - Indicates whether users can use enhanced mode when they connect to virtual machines on this - server by using Virtual Machine Connection. - -.PARAMETER FibreChannelWwnn - Specifies the default value of the World Wide Node Name on the Hyper-V host. - -.PARAMETER FibreChannelWwpnMaximum - Specifies the maximum value that can be used to generate World Wide Port Names on the Hyper-V - host. Use with the FibreChannelWwpnMinimum parameter to establish a range of WWPNs that the - specified Hyper-V host can assign to virtual Fibre Channel adapters. - -.PARAMETER FibreChannelWwpnMinimum - Specifies the minimum value that can be used to generate the World Wide Port Names on the - Hyper-V host. Use with the FibreChannelWwpnMaximum parameter to establish a range of WWPNs that - the specified Hyper-V host can assign to virtual Fibre Channel adapters. - -.PARAMETER MacAddressMaximum - Specifies the maximum MAC address using a valid hexadecimal value. Use with the - MacAddressMinimum parameter to establish a range of MAC addresses that the specified Hyper-V - host can assign to virtual machines configured to receive dynamic MAC addresses. - -.PARAMETER MacAddressMinimum - Specifies the minimum MAC address using a valid hexadecimal value. Use with the - MacAddressMaximum parameter to establish a range of MAC addresses that the specified Hyper-V - host can assign to virtual machines configured to receive dynamic MAC addresses. - -.PARAMETER MaximumStorageMigrations - Specifies the maximum number of storage migrations that can be performed at the same time on - the Hyper-V host. - -.PARAMETER MaximumVirtualMachineMigrations - Specifies the maximum number of live migrations that can be performed at the same time on the - Hyper-V host. - -.PARAMETER NumaSpanningEnabled - Specifies whether virtual machines on the Hyper-V host can use resources from more than one - NUMA node. - -.PARAMETER ResourceMeteringSaveIntervalMinute - Specifies how often the Hyper-V host saves the data that tracks resource usage. The range is a - minimum of 60 minutes to a maximum 1440 minutes (24 hours). - -.PARAMETER UseAnyNetworkForMigration - Specifies how networks are selected for incoming live migration traffic. If set to $True, any - available network on the host can be used for this traffic. If set to $False, incoming live - migration traffic is transmitted only on the networks specified in the MigrationNetworks - property of the host. - -.PARAMETER VirtualHardDiskPath - Specifies the default folder to store virtual hard disks on the Hyper-V host. - -.PARAMETER VirtualMachineMigrationAuthenticationType - Specifies the type of authentication to be used for live migrations. The acceptable values for - this parameter are 'Kerberos' and 'CredSSP'. - -.PARAMETER VirtualMachineMigrationPerformanceOption - Specifies the performance option to use for live migration. The acceptable values for this - parameter are 'TCPIP', 'Compression' and 'SMB'. - -.PARAMETER VirtualMachinePath - Specifies the default folder to store virtual machine configuration files on the Hyper-V host. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [System.String] - $IsSingleInstance, - - [Parameter()] - [System.Boolean] - $EnableEnhancedSessionMode, - - [Parameter()] - [System.String] - $FibreChannelWwnn, - - [Parameter()] - [System.String] - $FibreChannelWwpnMaximum, - - [Parameter()] - [System.String] - $FibreChannelWwpnMinimum, - - [Parameter()] - [System.String] - $MacAddressMaximum, - - [Parameter()] - [System.String] - $MacAddressMinimum, - - [Parameter()] - [System.UInt32] - $MaximumStorageMigrations, - - [Parameter()] - [System.UInt32] - $MaximumVirtualMachineMigrations, - - [Parameter()] - [System.Boolean] - $NumaSpanningEnabled, - - [Parameter()] - [System.UInt32] - $ResourceMeteringSaveIntervalMinute, - - [Parameter()] - [System.Boolean] - $UseAnyNetworkForMigration, - - [Parameter()] - [System.String] - $VirtualHardDiskPath, - - [Parameter()] - [ValidateSet('Kerberos','CredSSP')] - [System.String] - $VirtualMachineMigrationAuthenticationType, - - [Parameter()] - [ValidateSet('TCPIP','Compression','SMB')] - [System.String] - $VirtualMachineMigrationPerformanceOption, - - [Parameter()] - [System.String] - $VirtualMachinePath - ) - - Assert-Module -Name 'Hyper-V' - - $targetResource = Get-TargetResource -IsSingleInstance $IsSingleInstance - $isTargetResourceCompliant = $true - - foreach ($parameter in $PSBoundParameters.GetEnumerator()) - { - if (($targetResource.ContainsKey($parameter.Key)) -and - ($parameter.Value -ne $targetResource[$parameter.Key])) - { - $isTargetResourceCompliant = $false - Write-Verbose -Message ($localizedData.PropertyMismatch -f $parameter.Key, - $parameter.Value, $targetResource[$parameter.Key]) - } - } - - if ($isTargetResourceCompliant) - { - Write-Verbose -Message $localizedData.VMHostInDesiredState - } - else - { - Write-Verbose -Message $localizedData.VMHostNotInDesiredState - } - - return $isTargetResourceCompliant -} #end function - -<# -.SYNOPSIS - Configures MSFT_xVMHost resource state. - -.PARAMETER IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes'. - -.PARAMETER EnableEnhancedSessionMode - Indicates whether users can use enhanced mode when they connect to virtual machines on this - server by using Virtual Machine Connection. - -.PARAMETER FibreChannelWwnn - Specifies the default value of the World Wide Node Name on the Hyper-V host. - -.PARAMETER FibreChannelWwpnMaximum - Specifies the maximum value that can be used to generate World Wide Port Names on the Hyper-V - host. Use with the FibreChannelWwpnMinimum parameter to establish a range of WWPNs that the - specified Hyper-V host can assign to virtual Fibre Channel adapters. - -.PARAMETER FibreChannelWwpnMinimum - Specifies the minimum value that can be used to generate the World Wide Port Names on the - Hyper-V host. Use with the FibreChannelWwpnMaximum parameter to establish a range of WWPNs that - the specified Hyper-V host can assign to virtual Fibre Channel adapters. - -.PARAMETER MacAddressMaximum - Specifies the maximum MAC address using a valid hexadecimal value. Use with the - MacAddressMinimum parameter to establish a range of MAC addresses that the specified Hyper-V - host can assign to virtual machines configured to receive dynamic MAC addresses. - -.PARAMETER MacAddressMinimum - Specifies the minimum MAC address using a valid hexadecimal value. Use with the - MacAddressMaximum parameter to establish a range of MAC addresses that the specified Hyper-V - host can assign to virtual machines configured to receive dynamic MAC addresses. - -.PARAMETER MaximumStorageMigrations - Specifies the maximum number of storage migrations that can be performed at the same time on - the Hyper-V host. - -.PARAMETER MaximumVirtualMachineMigrations - Specifies the maximum number of live migrations that can be performed at the same time on the - Hyper-V host. - -.PARAMETER NumaSpanningEnabled - Specifies whether virtual machines on the Hyper-V host can use resources from more than one - NUMA node. - -.PARAMETER ResourceMeteringSaveIntervalMinute - Specifies how often the Hyper-V host saves the data that tracks resource usage. The range is a - minimum of 60 minutes to a maximum 1440 minutes (24 hours). - -.PARAMETER UseAnyNetworkForMigration - Specifies how networks are selected for incoming live migration traffic. If set to $True, any - available network on the host can be used for this traffic. If set to $False, incoming live - migration traffic is transmitted only on the networks specified in the MigrationNetworks - property of the host. - -.PARAMETER VirtualHardDiskPath - Specifies the default folder to store virtual hard disks on the Hyper-V host. - -.PARAMETER VirtualMachineMigrationAuthenticationType - Specifies the type of authentication to be used for live migrations. The acceptable values for - this parameter are 'Kerberos' and 'CredSSP'. - -.PARAMETER VirtualMachineMigrationPerformanceOption - Specifies the performance option to use for live migration. The acceptable values for this - parameter are 'TCPIP', 'Compression' and 'SMB'. - -.PARAMETER VirtualMachinePath - Specifies the default folder to store virtual machine configuration files on the Hyper-V host. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [System.String] - $IsSingleInstance, - - [Parameter()] - [System.Boolean] - $EnableEnhancedSessionMode, - - [Parameter()] - [System.String] - $FibreChannelWwnn, - - [Parameter()] - [System.String] - $FibreChannelWwpnMaximum, - - [Parameter()] - [System.String] - $FibreChannelWwpnMinimum, - - [Parameter()] - [System.String] - $MacAddressMaximum, - - [Parameter()] - [System.String] - $MacAddressMinimum, - - [Parameter()] - [System.UInt32] - $MaximumStorageMigrations, - - [Parameter()] - [System.UInt32] - $MaximumVirtualMachineMigrations, - - [Parameter()] - [System.Boolean] - $NumaSpanningEnabled, - - [Parameter()] - [System.UInt32] - $ResourceMeteringSaveIntervalMinute, - - [Parameter()] - [System.Boolean] - $UseAnyNetworkForMigration, - - [Parameter()] - [System.String] - $VirtualHardDiskPath, - - [Parameter()] - [ValidateSet('Kerberos','CredSSP')] - [System.String] - $VirtualMachineMigrationAuthenticationType, - - [Parameter()] - [ValidateSet('TCPIP','Compression','SMB')] - [System.String] - $VirtualMachineMigrationPerformanceOption, - - [Parameter()] - [System.String] - $VirtualMachinePath - ) - - Assert-Module -Name 'Hyper-V' - - $null = $PSBoundParameters.Remove('IsSingleInstance') - - if ($PSBoundParameters.ContainsKey('ResourceMeteringSaveIntervalMinute')) - { - # Need to convert the specified minutes into a TimeSpan object first - $convertToTimeSpanParams = @{ - TimeInterval = $PSBoundParameters['ResourceMeteringSaveIntervalMinute'] - TimeIntervalType = 'Minutes' - } - $resourceMeteringSaveInterval = ConvertTo-TimeSpan @convertToTimeSpanParams - - # Remove the existing UInt32 explicit type and add the TimeSpan type parameter - $null = $PSBoundParameters.Remove('ResourceMeteringSaveIntervalMinute') - $PSBoundParameters['ResourceMeteringSaveInterval'] = $resourceMeteringSaveInterval - } - - Write-Verbose -Message $localizedData.UpdatingVMHostProperties - Set-VMHost @PSBoundParameters - Write-Verbose -Message $localizedData.VMHostPropertiesUpdated -} #end function diff --git a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMHost/MSFT_xVMHost.schema.mof b/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMHost/MSFT_xVMHost.schema.mof deleted file mode 100644 index f2131669..00000000 --- a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMHost/MSFT_xVMHost.schema.mof +++ /dev/null @@ -1,20 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xVMHost")] -class MSFT_xVMHost : OMI_BaseResource -{ - [Key, Description("Specifies the resource is a single instance, the value must be 'Yes'."), ValueMap{"Yes"}, Values{"Yes"}] String IsSingleInstance; - [Write, Description("Indicates whether users can use enhanced mode when they connect to virtual machines on this server by using Virtual Machine Connection.")] Boolean EnableEnhancedSessionMode; - [Write, Description("Specifies the default value of the World Wide Node Name on the Hyper-V host.")] String FibreChannelWwnn; - [Write, Description("Specifies the maximum value that can be used to generate World Wide Port Names on the Hyper-V host.")] String FibreChannelWwpnMaximum; - [Write, Description("Specifies the minimum value that can be used to generate the World Wide Port Names on the Hyper-V host.")] String FibreChannelWwpnMinimum; - [Write, Description("Specifies the maximum MAC address using a valid hexadecimal value.")] String MacAddressMaximum; - [Write, Description("Specifies the minimum MAC address using a valid hexadecimal value.")] String MacAddressMinimum; - [Write, Description("Specifies the maximum number of storage migrations that can be performed at the same time on the Hyper-V host.")] Uint32 MaximumStorageMigrations; - [Write, Description("Specifies the maximum number of live migrations that can be performed at the same time on the Hyper-V host.")] Uint32 MaximumVirtualMachineMigrations; - [Write, Description("Specifies whether virtual machines on the Hyper-V host can use resources from more than one NUMA node.")] Boolean NumaSpanningEnabled; - [Write, Description("Specifies how often the Hyper-V host saves the data that tracks resource usage. The range is a minimum of 60 minutes to a maximum of 1440 (24 hours).")] Uint32 ResourceMeteringSaveIntervalMinute; - [Write, Description("Specifies how networks are selected for incoming live migration traffic.")] Boolean UseAnyNetworkForMigration; - [Write, Description("Specifies the default folder to store virtual hard disks on the Hyper-V host.")] String VirtualHardDiskPath; - [Write, Description("Specifies the type of authentication to be used for live migrations. The acceptable values for this parameter are 'Kerberos' and 'CredSSP'."), ValueMap{"CredSSP","Kerberos"}, Values{"CredSSP","Kerberos"}] String VirtualMachineMigrationAuthenticationType; - [Write, Description("Specifies the performance option to use for live migration. The acceptable values for this parameter are 'TCPIP', 'Compression' and 'SMB'."), ValueMap{"TCPIP","Compression","SMB"}, Values{"TCPIP","Compression","SMB"}] String VirtualMachineMigrationPerformanceOption; - [Write, Description("Specifies the default folder to store virtual machine configuration files on the Hyper-V host.")] String VirtualMachinePath; -}; diff --git a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMHost/en-US/MSFT_xVMHost.psd1 b/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMHost/en-US/MSFT_xVMHost.psd1 deleted file mode 100644 index 6a9ae594..00000000 --- a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMHost/en-US/MSFT_xVMHost.psd1 +++ /dev/null @@ -1,8 +0,0 @@ -ConvertFrom-StringData @' - QueryingVMHost = Querying VM host configuration. - PropertyMismatch = Property '{0}' mismatch; expected value '{1}', but was '{2}'. - VMHostInDesiredState = VM host in desired state. - VMHostNotInDesiredState = VM host not in desired state. - UpdatingVMHostProperties = Updating VM host properties. - VMHostPropertiesUpdated = VM host properties have been updated. -'@ diff --git a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMHyperV/MSFT_xVMHyperV.psm1 b/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMHyperV/MSFT_xVMHyperV.psm1 deleted file mode 100644 index 69262e5c..00000000 --- a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMHyperV/MSFT_xVMHyperV.psm1 +++ /dev/null @@ -1,785 +0,0 @@ -# Fallback message strings in en-US -DATA localizedData -{ - # culture = "en-US" - ConvertFrom-StringData @' - RoleMissingError = Please ensure that '{0}' role is installed with its PowerShell module. - MoreThanOneVMExistsError = More than one VM with the name '{0}' exists. - PathDoesNotExistError = Path '{0}' does not exist. - VhdPathDoesNotExistError = Vhd '{0}' does not exist. - MinMemGreaterThanStartupMemError = MinimumMemory '{0}' should not be greater than StartupMemory '{1}' - MinMemGreaterThanMaxMemError = MinimumMemory '{0}' should not be greater than MaximumMemory '{1}' - StartUpMemGreaterThanMaxMemError = StartupMemory '{0}' should not be greater than MaximumMemory '{1}'. - VhdUnsupportedOnGen2VMError = Generation 2 virtual machines do not support the .VHD virtual disk extension. - CannotUpdatePropertiesOnlineError = Can not change properties for VM '{0}' in '{1}' state unless 'RestartIfNeeded' is set to true. - - AdjustingGreaterThanMemoryWarning = VM {0} '{1}' is greater than {2} '{3}'. Adjusting {0} to be '{3}'. - AdjustingLessThanMemoryWarning = VM {0} '{1}' is less than {2} '{3}'. Adjusting {0} to be '{3}'. - VMStateWillBeOffWarning = VM '{0}' state will be 'OFF' and not 'Paused'. - - CheckingVMExists = Checking if VM '{0}' exists ... - VMExists = VM '{0}' exists. - VMDoesNotExist = VM '{0}' does not exist. - CreatingVM = Creating VM '{0}' ... - VMCreated = VM '{0}' created. - VMPropertyShouldBe = VM property '{0}' should be '{1}', actual '{2}'. - VMPropertySet = VM property '{0}' is '{1}'. - VMPropertiesUpdated = VM '{0}' properties have been updated. - WaitingForVMIPAddress = Waiting for IP Address for VM '{0}' ... -'@ -} - -# Import the common HyperV functions -Import-Module -Name ( Join-Path ` - -Path (Split-Path -Path $PSScriptRoot -Parent) ` - -ChildPath '\HyperVCommon\HyperVCommon.psm1' ) - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [System.String] - $VhdPath - ) - - # Check if Hyper-V module is present for Hyper-V cmdlets - if(!(Get-Module -ListAvailable -Name Hyper-V)) - { - Throw ($localizedData.RoleMissingError -f 'Hyper-V') - } - - $vmobj = Get-VM -Name $Name -ErrorAction SilentlyContinue - - # Check if 1 or 0 VM with name = $name exist - if($vmobj.count -gt 1) - { - Throw ($localizedData.MoreThanOneVMExistsError -f $Name) - } - - # Retrieve the Vhd hierarchy to ensure we enumerate snapshots/differencing disks - # Fixes #28 - $vhdChain = @(Get-VhdHierarchy -VhdPath ($vmObj.HardDrives[0].Path)) - - $vmSecureBootState = $false - if ($vmobj.Generation -eq 2) - { - # Retrieve secure boot status (can only be enabled on Generation 2 VMs) and convert to a boolean. - $vmSecureBootState = ($vmobj | Get-VMFirmware).SecureBoot -eq 'On' - } - - $guestServiceId = 'Microsoft:{0}\6C09BB55-D683-4DA0-8931-C9BF705F6480' -f $vmObj.Id - - @{ - Name = $Name - ## Return the Vhd specified if it exists in the Vhd chain - VhdPath = if ($vhdChain -contains $VhdPath) { $VhdPath }; - SwitchName = $vmObj.NetworkAdapters.SwitchName - State = $vmobj.State - Path = $vmobj.Path - Generation = $vmobj.Generation - SecureBoot = $vmSecureBootState - StartupMemory = $vmobj.MemoryStartup - MinimumMemory = $vmobj.MemoryMinimum - MaximumMemory = $vmobj.MemoryMaximum - MACAddress = $vmObj.NetWorkAdapters.MacAddress - ProcessorCount = $vmobj.ProcessorCount - Ensure = if($vmobj){"Present"}else{"Absent"} - ID = $vmobj.Id - Status = $vmobj.Status - CPUUsage = $vmobj.CPUUsage - MemoryAssigned = $vmobj.MemoryAssigned - Uptime = $vmobj.Uptime - CreationTime = $vmobj.CreationTime - HasDynamicMemory = $vmobj.DynamicMemoryEnabled - NetworkAdapters = $vmobj.NetworkAdapters.IPAddresses - EnableGuestService = ($vmobj | Get-VMIntegrationService | Where-Object -FilterScript {$_.Id -eq $guestServiceId}).Enabled - } -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - # Name of the VM - [Parameter(Mandatory = $true)] - [String] - $Name, - - # VHD associated with the VM - [Parameter(Mandatory = $true)] - [String] - $VhdPath, - - # Virtual switch associated with the VM - [Parameter()] - [String[]] - $SwitchName, - - # State of the VM - [Parameter()] - [ValidateSet('Running','Paused','Off')] - [String] - $State, - - # Folder where the VM data will be stored - [Parameter()] - [String] - $Path, - - # Virtual machine generation - [Parameter()] - [ValidateRange(1,2)] - [UInt32] - $Generation = 1, - - # Startup RAM for the VM - [Parameter()] - [ValidateRange(32MB,65536MB)] - [UInt64] - $StartupMemory, - - # Minimum RAM for the VM. This enables dynamic memory - [Parameter()] - [ValidateRange(32MB,65536MB)] - [UInt64] - $MinimumMemory, - - # Maximum RAM for the VM. This enables dynamic memory - [Parameter()] - [ValidateRange(32MB,1048576MB)] - [UInt64] - $MaximumMemory, - - # MAC address of the VM - [Parameter()] - [String[]] - $MACAddress, - - # Processor count for the VM - [Parameter()] - [UInt32] - $ProcessorCount, - - # Waits for VM to get valid IP address - [Parameter()] - [Boolean] - $WaitForIP, - - # If specified, shutdowns and restarts the VM as needed for property changes - [Parameter()] - [Boolean] - $RestartIfNeeded, - - # Should the VM be created or deleted - [Parameter()] - [ValidateSet('Present','Absent')] - [String] - $Ensure = 'Present', - - [Parameter()] - [System.String] - $Notes, - - # Enable secure boot for Generation 2 VMs - [Parameter()] - [Boolean] - $SecureBoot = $true, - - # Enable Guest Services - [Parameter()] - [Boolean] - $EnableGuestService = $false - ) - - # Check if Hyper-V module is present for Hyper-V cmdlets - if(!(Get-Module -ListAvailable -Name Hyper-V)) - { - Throw ($localizedData.RoleMissingError -f 'Hyper-V') - } - - Write-Verbose -Message ($localizedData.CheckingVMExists -f $Name) - $vmObj = Get-VM -Name $Name -ErrorAction SilentlyContinue - - # VM already exists - if($vmObj) - { - Write-Verbose -Message ($localizedData.VMExists -f $Name) - - # If VM shouldn't be there, stop it and remove it - if($Ensure -eq "Absent") - { - Write-Verbose -Message ($localizedData.VMPropertyShouldBe -f 'Ensure', $Ensure, 'Present') - Get-VM $Name | Stop-VM -Force -Passthru -WarningAction SilentlyContinue | Remove-VM -Force - Write-Verbose -Message ($localizedData.VMPropertySet -f 'Ensure', $Ensure) - } - - # If VM is present, check its state, startup memory, minimum memory, maximum memory,processor countand mac address - # One cannot set the VM's vhdpath, path, generation and switchName after creation - else - { - # If state has been specified and the VM is not in right state, set it to right state - if($State -and ($vmObj.State -ne $State)) - { - Write-Verbose -Message ($localizedData.VMPropertyShouldBe -f 'State', $State, $vmObj.State) - Set-VMState -Name $Name -State $State -WaitForIP $WaitForIP - Write-Verbose -Message ($localizedData.VMPropertySet -f 'State', $State) - } - - $changeProperty = @{} - # If the VM does not have the right startup memory - if($StartupMemory -and ($vmObj.MemoryStartup -ne $StartupMemory)) - { - Write-Verbose -Message ($localizedData.VMPropertyShouldBe -f 'MemoryStartup', $StartupMemory, $vmObj.MemoryStartup) - $changeProperty["MemoryStartup"]=$StartupMemory - } - elseif($MinimumMemory -and ($vmObj.MemoryStartup -lt $MinimumMemory)) - { - Write-Verbose -Message ($localizedData.AdjustingLessThanMemoryWarning -f 'StartupMemory', $vmObj.MemoryStartup, 'MinimumMemory', $MinimumMemory) - $changeProperty["MemoryStartup"]=$MinimumMemory - } - elseif($MaximumMemory -and ($vmObj.MemoryStartup -gt $MaximumMemory)) - { - Write-Verbose -Message ($localizedData.AdjustingGreaterThanMemoryWarning -f 'StartupMemory', $vmObj.MemoryStartup, 'MaximumMemory', $MaximumMemory) - $changeProperty["MemoryStartup"]=$MaximumMemory - } - - # If the VM does not have the right minimum or maximum memory, stop the VM, set the right memory, start the VM - if($MinimumMemory -or $MaximumMemory) - { - $changeProperty["DynamicMemory"]=$true - - if($MinimumMemory -and ($vmObj.Memoryminimum -ne $MinimumMemory)) - { - Write-Verbose -Message ($localizedData.VMPropertyShouldBe -f 'MinimumMemory', $MinimumMemory, $vmObj.MemoryMinimum) - $changeProperty["MemoryMinimum"]=$MinimumMemory - } - if($MaximumMemory -and ($vmObj.Memorymaximum -ne $MaximumMemory)) - { - Write-Verbose -Message ($localizedData.VMPropertyShouldBe -f 'MaximumMemory', $MaximumMemory, $vmObj.MemoryMaximum) - $changeProperty["MemoryMaximum"]=$MaximumMemory - } - } - - # If the VM does not have the right processor count, stop the VM, set the right memory, start the VM - if($ProcessorCount -and ($vmObj.ProcessorCount -ne $ProcessorCount)) - { - Write-Verbose -Message ($localizedData.VMPropertyShouldBe -f 'ProcessorCount', $ProcessorCount, $vmObj.ProcessorCount) - $changeProperty["ProcessorCount"]=$ProcessorCount - } - - # Stop the VM, set the right properties, start the VM only if there are properties to change - if ($changeProperty.Count -gt 0) - { - Set-VMProperty -Name $Name -VMCommand "Set-VM" -ChangeProperty $changeProperty -WaitForIP $WaitForIP -RestartIfNeeded $RestartIfNeeded - Write-Verbose -Message ($localizedData.VMPropertiesUpdated -f $Name) - } - - ## Set VM network switches. This can be done while the VM is running. - for ($i = 0; $i -lt $SwitchName.Count; $i++) - { - $switch = $SwitchName[$i] - $nic = $vmObj.NetworkAdapters[$i] - if ($nic) { - ## We cannot change the MAC address whilst the VM is running.. This is changed later - if ($nic.SwitchName -ne $switch) { - Write-Verbose -Message ($localizedData.VMPropertyShouldBe -f 'NIC', $switch, $nic.SwitchName) - $nic | Connect-VMNetworkAdapter -SwitchName $switch - Write-Verbose -Message ($localizedData.VMPropertySet -f 'NIC', $switch) - } - } - else { - Write-Verbose -Message ($localizedData.VMPropertyShouldBe -f 'NIC', $switch, '') - if ($MACAddress -and (-not [System.String]::IsNullOrEmpty($MACAddress[$i]))) - { - Add-VMNetworkAdapter -VMName $Name -SwitchName $switch -StaticMacAddress $MACAddress[$i] - Write-Verbose -Message ($localizedData.VMPropertySet -f 'NIC', $switch) - } - else - { - Add-VMNetworkAdapter -VMName $Name -SwitchName $switch - Write-Verbose -Message ($localizedData.VMPropertySet -f 'NIC', $switch) - } - ## Refresh the NICs after we've added one - $vmObj = Get-VM -Name $Name -ErrorAction SilentlyContinue - } - } - - # If the VM does not have the right MACAddress, stop the VM, set the right MACAddress, start the VM - for ($i = 0; $i -lt $MACAddress.Count; $i++) - { - $address = $MACAddress[$i] - $nic = $vmObj.NetworkAdapters[$i] - if ($nic.MacAddress -ne $address) - { - Write-Verbose -Message ($localizedData.VMPropertyShouldBe -f 'MACAddress', $address, $nic.MacAddress) - Set-VMMACAddress -Name $Name -NICIndex $i -MACAddress $address -WaitForIP $WaitForIP -RestartIfNeeded $RestartIfNeeded - } - } - - if ($Generation -eq 2) - { - # Retrive the current secure boot state - $vmSecureBoot = Test-VMSecureBoot -Name $Name - if ($SecureBoot -ne $vmSecureBoot) - { - Write-Verbose -Message ($localizedData.VMPropertyShouldBe -f 'SecureBoot', $SecureBoot, $vmSecureBoot) - - if (-not $SecureBoot) - { - $enableSecureBoot = 'On' - } - else - { - $enableSecureBoot = 'Off' - } - # Cannot change the secure boot state whilst the VM is powered on. - $setVMPropertyParams = @{ - VMName = $Name - VMCommand = 'Set-VMFirmware' - ChangeProperty = @{ EnableSecureBoot = $enableSecureBoot } - RestartIfNeeded = $RestartIfNeeded - } - Set-VMProperty @setVMPropertyParams - Write-Verbose -Message ($localizedData.VMPropertySet -f 'SecureBoot', $SecureBoot) - } - } - - if($Notes -ne $null) - { - # If the VM notes do not match the desire notes, update them. This can be done while the VM is running. - if($vmObj.Notes -ne $Notes) - { - Set-Vm -Name $Name -Notes $Notes - } - } - - # If the VM doesn't have Guest Service Interface correctly configured, update it. - $guestServiceId = 'Microsoft:{0}\6C09BB55-D683-4DA0-8931-C9BF705F6480' -f $vmObj.Id - - $guestService = $vmObj | Get-VMIntegrationService | Where-Object -FilterScript {$_.Id -eq $guestServiceId} - if ($guestService.Enabled -eq $false -and $EnableGuestService) - { - Write-Verbose -Message ($localizedData.VMPropertyShouldBe -f 'EnableGuestService', $EnableGuestService, $guestService.Enabled) - $guestService | Enable-VMIntegrationService - Write-Verbose -Message ($localizedData.VMPropertySet -f 'EnableGuestService', $EnableGuestService) - } - elseif ($guestService.Enabled -and -not $EnableGuestService) - { - Write-Verbose -Message ($localizedData.VMPropertyShouldBe -f 'EnableGuestService', $EnableGuestService, $guestService.Enabled) - $guestService | Disable-VMIntegrationService - Write-Verbose -Message ($localizedData.VMPropertySet -f 'EnableGuestService', $EnableGuestService) - } - } - } - - # VM is not present, create one - else - { - Write-Verbose -Message ($localizedData.VMDoesNotExist -f $Name) - if($Ensure -eq "Present") - { - Write-Verbose -Message ($localizedData.CreatingVM -f $Name) - - $parameters = @{} - $parameters["Name"] = $Name - $parameters["VHDPath"] = $VhdPath - $parameters["Generation"] = $Generation - - # Optional parameters - if($SwitchName) - { - $parameters["SwitchName"]=$SwitchName[0] - } - if($Path){$parameters["Path"]=$Path} - $defaultStartupMemory = 512MB - if($StartupMemory){$parameters["MemoryStartupBytes"]=$StartupMemory} - elseif($MinimumMemory -and $defaultStartupMemory -lt $MinimumMemory){$parameters["MemoryStartupBytes"]=$MinimumMemory} - elseif($MaximumMemory -and $defaultStartupMemory -gt $MaximumMemory){$parameters["MemoryStartupBytes"]=$MaximumMemory} - $null = New-VM @parameters - - $parameters = @{} - $parameters["Name"] = $Name - if($MinimumMemory -or $MaximumMemory) - { - $parameters["DynamicMemory"]=$true - if($MinimumMemory){$parameters["MemoryMinimumBytes"]=$MinimumMemory} - if($MaximumMemory){$parameters["MemoryMaximumBytes"]=$MaximumMemory} - } - - if($Notes) - { - $parameters["Notes"] = $Notes - } - - if($ProcessorCount) - { - $parameters["ProcessorCount"]=$ProcessorCount - } - - $null = Set-VM @parameters - - ## There's always a NIC added with New-VM - if($MACAddress) - { - Set-VMNetworkAdapter -VMName $Name -StaticMacAddress $MACAddress[0] - } - - ## Add additional NICs - for ($i = 1; $i -lt $SwitchName.Count; $i++) - { - $addVMNetworkAdapterParams = @{ - VMName = $Name; - SwitchName = $SwitchName[$i] - } - if ($MACAddress -and (-not [System.String]::IsNullOrEmpty($MACAddress[$i]))) - { - $addVMNetworkAdapterParams['StaticMacAddress'] = $MACAddress[$i] - } - Add-VMNetworkAdapter @addVMNetworkAdapterParams - Write-Verbose -Message ($localizedData.VMPropertySet -f 'NIC', $SwitchName[$i]) - } - - if ($Generation -eq 2) { - # Secure boot is only applicable to Generation 2 VMs and it defaults to on. - # Therefore, we only need to explicitly set it to off if specified. - if ($SecureBoot -eq $false) - { - Set-VMFirmware -VMName $Name -EnableSecureBoot Off - } - } - - if ($EnableGuestService) - { - $guestServiceId = 'Microsoft:{0}\6C09BB55-D683-4DA0-8931-C9BF705F6480' -f (Get-VM -Name $Name).Id - Get-VMIntegrationService -VMName $Name | Where-Object -FilterScript {$_.Id -eq $guestServiceId} | Enable-VMIntegrationService - } - - Write-Verbose -Message ($localizedData.VMCreated -f $Name) - - if ($State) - { - Set-VMState -Name $Name -State $State -WaitForIP $WaitForIP - Write-Verbose -Message ($localizedData.VMPropertySet -f 'State', $State) - } - - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - # Name of the VM - [Parameter(Mandatory = $true)] - [String] - $Name, - - # VHD associated with the VM - [Parameter(Mandatory = $true)] - [String] - $VhdPath, - - # Virtual switch associated with the VM - [Parameter()] - [String[]] - $SwitchName, - - # State of the VM - [Parameter()] - [ValidateSet('Running','Paused','Off')] - [String] - $State, - - # Folder where the VM data will be stored - [Parameter()] - [String] - $Path, - - # Virtual machine generation - [Parameter()] - [ValidateRange(1,2)] - [UInt32] - $Generation = 1, - - # Startup RAM for the VM - [Parameter()] - [ValidateRange(32MB,65536MB)] - [UInt64] - $StartupMemory, - - # Minimum RAM for the VM. This enables dynamic memory - [Parameter()] - [ValidateRange(32MB,65536MB)] - [UInt64] - $MinimumMemory, - - # Maximum RAM for the VM. This enables dynamic memory - [Parameter()] - [ValidateRange(32MB,1048576MB)] - [UInt64] - $MaximumMemory, - - # MAC address of the VM - [Parameter()] - [String[]] - $MACAddress, - - # Processor count for the VM - [Parameter()] - [UInt32] - $ProcessorCount, - - # Waits for VM to get valid IP address - [Parameter()] - [Boolean] - $WaitForIP, - - # If specified, shutdowns and restarts the VM as needed for property changes - [Parameter()] - [Boolean] - $RestartIfNeeded, - - # Should the VM be created or deleted - [Parameter()] - [ValidateSet('Present','Absent')] - [String] - $Ensure = 'Present', - - [Parameter()] - [System.String] - $Notes, - - # Enable secure boot for Generation 2 VMs - [Parameter()] - [Boolean] - $SecureBoot = $true, - - [Parameter()] - [Boolean] - $EnableGuestService = $false - ) - - #region input validation - - # Check if Hyper-V module is present for Hyper-V cmdlets - if(!(Get-Module -ListAvailable -Name Hyper-V)) - { - Throw ($localizedData.RoleMissingError -f 'Hyper-V') - } - - # Check if 1 or 0 VM with name = $name exist - if((Get-VM -Name $Name -ErrorAction SilentlyContinue).count -gt 1) - { - Throw ($localizedData.MoreThanOneVMExistsError -f $Name) - } - - # Check if $VhdPath exist - if(!(Test-Path $VhdPath)) - { - Throw ($localizedData.VhdPathDoesNotExistError -f $VhdPath) - } - - # Check if Minimum memory is less than StartUpmemory - if($StartupMemory -and $MinimumMemory -and ($MinimumMemory -gt $StartupMemory)) - { - Throw ($localizedData.MinMemGreaterThanStartupMemError -f $MinimumMemory, $StartupMemory) - } - - # Check if Minimum memory is greater than Maximummemory - if($MaximumMemory -and $MinimumMemory -and ($MinimumMemory -gt $MaximumMemory)) - { - Throw ($localizedData.MinMemGreaterThanMaxMemError -f $MinimumMemory, $MaximumMemory) - } - - # Check if Startup memory is greater than Maximummemory - if($MaximumMemory -and $StartupMemory -and ($StartupMemory -gt $MaximumMemory)) - { - Throw ($localizedData.StartUpMemGreaterThanMaxMemError -f $StartupMemory, $MaximumMemory) - } - - <# VM Generation has no direct relation to the virtual hard disk format and cannot be changed - after the virtual machine has been created. Generation 2 VMs do not support .VHD files. #> - if(($Generation -eq 2) -and ($VhdPath.Split('.')[-1] -eq 'vhd')) - { - Throw ($localizedData.VhdUnsupportedOnGen2VMError) - } - - # Check if $Path exist - if($Path -and !(Test-Path -Path $Path)) - { - Throw ($localizedData.PathDoesNotExistError -f $Path) - } - - #endregion - - try - { - $vmObj = Get-VM -Name $Name -ErrorAction Stop - if($Ensure -eq "Present") - { - $vhdChain = @(Get-VhdHierarchy -VhdPath ($vmObj.HardDrives[0].Path)) - if($vhdChain -notcontains $VhdPath) - { - Write-Verbose -Message ($localizedData.VMPropertyShouldBe -f 'VhdPath', $VhdPath, ($vhdChain -join ',')) - return $false - } - if($state -and ($vmObj.State -ne $State)){return $false} - if($StartupMemory -and ($vmObj.MemoryStartup -ne $StartupMemory)){return $false} - if($vmObj.HardDrives.Path -notcontains $VhdPath){return $false} - for ($i = 0; $i -lt $SwitchName.Count; $i++) - { - if ($vmObj.NetworkAdapters[$i].SwitchName -ne $SwitchName[$i]) - { - Write-Verbose -Message ($localizedData.VMPropertyShouldBe -f 'SwitchName', $SwitchName[$i], $vmObj.NetworkAdapters[$i].SwitchName) - return $false - } - } - if($state -and ($vmObj.State -ne $State)){return $false} - if($StartupMemory -and ($vmObj.MemoryStartup -ne $StartupMemory)){return $false} - for ($i = 0; $i -lt $MACAddress.Count; $i++) - { - if ($vmObj.NetworkAdapters[$i].MACAddress -ne $MACAddress[$i]) - { - Write-Verbose -Message ($localizedData.VMPropertyShouldBe -f 'MACAddress', $MACAddress[$i], $vmObj.NetworkAdapters[$i].MACAddress) - return $false - } - } - - ## $Generation always exists, only check if parameter has been explicitly specified - if($PSBoundParameters.ContainsKey('Generation') -and ($Generation -ne $vmObj.Generation)){return $false} - - if($ProcessorCount -and ($vmObj.ProcessorCount -ne $ProcessorCount)){return $false} - if($MaximumMemory -and ($vmObj.MemoryMaximum -ne $MaximumMemory)){return $false} - if($MinimumMemory -and ($vmObj.MemoryMinimum -ne $MinimumMemory)){return $false} - - if($vmObj.Generation -eq 2) { - $vmSecureBoot = Test-VMSecureBoot -Name $Name - if ($SecureBoot -ne $vmSecureBoot) - { - Write-Verbose -Message ($localizedData.VMPropertyShouldBe -f 'SecureBoot', $SecureBoot, $vmSecureBoot) - return $false - } - } - $guestServiceId = 'Microsoft:{0}\6C09BB55-D683-4DA0-8931-C9BF705F6480' -f $vmObj.Id - $guestService = $vmObj | Get-VMIntegrationService | Where-Object -FilterScript {$_.Id -eq $guestServiceId} - if ($guestService.Enabled -ne $EnableGuestService) - { - Write-Verbose -Message ($localizedData.VMPropertyShouldBe -f 'EnableGuestService', $EnableGuestService, $guestService.Enabled) - return $false - } - return $true - } - else - { - return $false - } - } - catch [System.Management.Automation.ActionPreferenceStopException] - { - ($Ensure -eq 'Absent') - } -} - -#region Helper function - -<# Returns VM VHDs, including snapshots and differencing disks #> -function Get-VhdHierarchy -{ - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $VhdPath - ) - - $vmVhdPath = Get-VHD -Path $VhdPath - Write-Output -InputObject $vmVhdPath.Path - while(-not [System.String]::IsNullOrEmpty($vmVhdPath.ParentPath)) - { - $vmVhdPath.ParentPath - $vmVhdPath = (Get-VHD -Path $vmVhdPath.ParentPath) - } -} - -# The 'Set-VMProperty' method cannot be used as it cannot deal with piped -# command in it's current implementation -function Set-VMMACAddress -{ - param - ( - [Parameter(Mandatory = $true)] - [String] - $Name, - - [Parameter(Mandatory = $true)] - [String] - $MACAddress, - - [Parameter(Mandatory = $true)] - [Int] - $NICIndex, - - [Parameter()] - [Boolean] - $WaitForIP, - - [Parameter()] - [Boolean] - $RestartIfNeeded - ) - $vmObj = Get-VM -Name $Name - $originalState = $vmObj.state - if($originalState -ne "Off" -and $RestartIfNeeded) - { - Set-VMState -Name $Name -State Off - $vmObj.NetworkAdapters[$NICIndex] | Set-VMNetworkAdapter -StaticMacAddress $MACAddress - - # Can not move a off VM to paused, but only to running state - if($originalState -eq "Running") - { - Set-VMState -Name $Name -State Running -WaitForIP $WaitForIP - } - - # Cannot make a paused VM to go back to Paused state after turning Off - if($originalState -eq "Paused") - { - Write-Warning -Message ($localizedData.VMStateWillBeOffWarning -f $Name) - } - } - elseif($originalState -eq "Off") - { - $vmObj.NetworkAdapters[$NICIndex] | Set-VMNetworkAdapter -StaticMacAddress $MACAddress - Write-Verbose -Message ($localizedData.VMPropertySet -f 'MACAddress', $MACAddress) - } - else - { - Write-Error -Message ($localizedData.CannotUpdatePropertiesOnlineError -f $Name, $vmObj.State) - } -} - -function Test-VMSecureBoot -{ - param - ( - [Parameter(Mandatory = $true)] - [string] - $Name - ) - $vm = Get-VM -Name $Name - return (Get-VMFirmware -VM $vm).SecureBoot -eq 'On' -} - -#endregion - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMHyperV/MSFT_xVMHyperV.schema.mof b/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMHyperV/MSFT_xVMHyperV.schema.mof deleted file mode 100644 index d76bd193..00000000 --- a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMHyperV/MSFT_xVMHyperV.schema.mof +++ /dev/null @@ -1,29 +0,0 @@ -[ClassVersion("1.0.0"), FriendlyName("xVMHyperV")] -class MSFT_xVMHyperV : OMI_BaseResource -{ - [Key, Description("Name of the VM")] String Name; - [Required, Description("VHD associated with the VM")] String VhdPath; - [Write, Description("Virtual switch(es) associated with the VM")] String SwitchName[]; - [Write, Description("State of the VM."), ValueMap{"Running","Paused","Off"}, Values{"Running","Paused","Off"}] String State; - [Write, Description("Folder where the VM data will be stored")] String Path; - [Write, Description("Virtual machine generation")] Uint32 Generation; - [Write, Description("Startup RAM for the VM.")] Uint64 StartupMemory; - [Write, Description("Minimum RAM for the VM. This enables dynamic memory.")] Uint64 MinimumMemory; - [Write, Description("Maximum RAM for the VM. This enable dynamic memory.")] Uint64 MaximumMemory; - [Write, Description("MAC address(es) of the VM NICs.")] String MACAddress[]; - [Write, Description("Processor count for the VM")] Uint32 ProcessorCount; - [Write, Description("Waits for VM to get valid IP address.")] Boolean WaitForIP; - [Write, Description("If specified, shutdowns and restarts the VM as needed for property changes")] Boolean RestartIfNeeded; - [Write, Description("Should the VM be created or deleted"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, Description("Notes about the VM.")] String Notes; - [Write, Description("Enable secure boot for Generation 2 VMs.")] Boolean SecureBoot; - [Write, Description("Enable Guest Service Interface for the VM.")] Boolean EnableGuestService; - [Read, Description("VM unique ID")] String ID; - [Read, Description("Status of the VM")] String Status; - [Read, Description("CPU Usage of the VM")] Uint32 CPUUsage; - [Read, Description("Memory assigned to the VM")] Uint64 MemoryAssigned; - [Read, Description("Uptime of the VM")] String Uptime; - [Read, Description("Creation time of the VM")] DateTime CreationTime; - [Read, Description("Does VM has dynamic memory enabled")] Boolean HasDynamicMemory; - [Read, Description("Network adapters' IP addresses of the VM")] String NetworkAdapters[]; -}; diff --git a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMNetworkAdapter/MSFT_xVMNetworkAdapter.psm1 b/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMNetworkAdapter/MSFT_xVMNetworkAdapter.psm1 deleted file mode 100644 index e1b67129..00000000 --- a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMNetworkAdapter/MSFT_xVMNetworkAdapter.psm1 +++ /dev/null @@ -1,373 +0,0 @@ -#region localizeddata -if (Test-Path "${PSScriptRoot}\${PSUICulture}") -{ - Import-LocalizedData -BindingVariable LocalizedData -filename MSFT_xVMNetworkAdapter.psd1 ` - -BaseDirectory "${PSScriptRoot}\${PSUICulture}" -} -else -{ - #fallback to en-US - Import-LocalizedData -BindingVariable LocalizedData -filename MSFT_xVMNetworkAdapter.psd1 ` - -BaseDirectory "${PSScriptRoot}\en-US" -} -#endregion - -<# -.SYNOPSIS - Gets MSFT_xVMNetworkAdapter resource current state. - -.PARAMETER Id - Specifies an unique identifier for the network adapter. - -.PARAMETER Name - Specifies a name for the network adapter that needs to be connected to a VM or management OS. - -.PARAMETER SwitchName - Specifies the name of the switch to which the new VM network adapter will be connected. - -.PARAMETER VMName - Specifies the name of the VM to which the network adapter will be connected. - Specify VMName as ManagementOS if you wish to connect the adapter to host OS. -#> -Function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - Param ( - [Parameter(Mandatory)] - [String] $Id, - - [Parameter(Mandatory)] - [String] $Name, - - [Parameter(Mandatory)] - [String] $SwitchName, - - [Parameter(Mandatory)] - [String] $VMName - ) - - $configuration = @{ - Id = $Id - Name = $Name - SwitchName = $SwitchName - VMName = $VMName - } - - $arguments = @{ - Name = $Name - } - - if ($VMName -ne 'ManagementOS') - { - $arguments.Add('VMName',$VMName) - } - else - { - $arguments.Add('ManagementOS', $true) - $arguments.Add('SwitchName', $SwitchName) - } - - Write-Verbose -Message $localizedData.GetVMNetAdapter - $netAdapter = Get-VMNetworkAdapter @arguments -ErrorAction SilentlyContinue - - if ($netAdapter) - { - Write-Verbose -Message $localizedData.FoundVMNetAdapter - if ($VMName -eq 'ManagementOS') - { - $configuration.Add('MacAddress', $netAdapter.MacAddress) - $configuration.Add('DynamicMacAddress', $false) - } - elseif ($netAdapter.VMName) - { - $configuration.Add('MacAddress', $netAdapter.MacAddress) - $configuration.Add('DynamicMacAddress', $netAdapter.DynamicMacAddressEnabled) - } - $configuration.Add('Ensure','Present') - } - else - { - Write-Verbose -Message $localizedData.NoVMNetAdapterFound - $configuration.Add('Ensure','Absent') - } - - return $configuration -} - -<# -.SYNOPSIS - Sets MSFT_xVMNetworkAdapter resource state. - -.PARAMETER Id - Specifies an unique identifier for the network adapter. - -.PARAMETER Name - Specifies a name for the network adapter that needs to be connected to a VM or management OS. - -.PARAMETER SwitchName - Specifies the name of the switch to which the new VM network adapter will be connected. - -.PARAMETER VMName - Specifies the name of the VM to which the network adapter will be connected. - Specify VMName as ManagementOS if you wish to connect the adapter to host OS. - -.PARAMETER MacAddress - Specifies the MAC address for the network adapter. This is not applicable if VMName - is set to ManagementOS. Use this parameter to specify a static MAC address. - -.PARAMETER Ensure - Specifies if the network adapter should be Present or Absent. -#> -Function Set-TargetResource -{ - [CmdletBinding()] - Param ( - [Parameter(Mandatory)] - [String] $Id, - - [Parameter(Mandatory)] - [String] $Name, - - [Parameter(Mandatory)] - [String] $SwitchName, - - [Parameter(Mandatory)] - [String] $VMName, - - [Parameter()] - [String] $MacAddress, - - [Parameter()] - [ValidateSet('Present','Absent')] - [String] $Ensure='Present' - ) - - $arguments = @{ - Name = $Name - } - - if ($VMName -ne 'ManagementOS') - { - $arguments.Add('VMName',$VMName) - } - else - { - $arguments.Add('ManagementOS', $true) - $arguments.Add('SwitchName', $SwitchName) - } - - Write-Verbose -Message $localizedData.GetVMNetAdapter - $netAdapterExists = Get-VMNetworkAdapter @arguments -ErrorAction SilentlyContinue - - if ($Ensure -eq 'Present') - { - if ($netAdapterExists) - { - Write-Verbose -Message $localizedData.FoundVMNetAdapter - if (($VMName -ne 'ManagementOS')) - { - if ($MacAddress) - { - if ($netAdapterExists.DynamicMacAddressEnabled) - { - Write-Verbose -Message $localizedData.EnableStaticMacAddress - $updateMacAddress = $true - } - elseif ($MacAddress -ne $netAdapterExists.StaicMacAddress) - { - Write-Verbose -Message $localizedData.EnableStaticMacAddress - $updateMacAddress = $true - } - } - else - { - if (-not $netAdapterExists.DynamicMacAddressEnabled) - { - Write-Verbose -Message $localizedData.EnableDynamicMacAddress - $updateMacAddress = $true - } - } - - if ($netAdapterExists.SwitchName -ne $SwitchName) - { - Write-Verbose -Message $localizedData.PerformSwitchConnect - Connect-VMNetworkAdapter -VMNetworkAdapter $netAdapterExists -SwitchName $SwitchName -ErrorAction Stop -Verbose - } - - if (($updateMacAddress)) - { - Write-Verbose -Message $localizedData.PerformVMNetModify - - $setArguments = @{ } - $setArguments.Add('VMNetworkAdapter',$netAdapterExists) - if ($MacAddress) - { - $setArguments.Add('StaticMacAddress',$MacAddress) - } - else - { - $setArguments.Add('DynamicMacAddress', $true) - } - Set-VMNetworkAdapter @setArguments -ErrorAction Stop - } - } - } - else - { - if ($VMName -ne 'ManagementOS') - { - if (-not $MacAddress) - { - $arguments.Add('DynamicMacAddress',$true) - } - else - { - $arguments.Add('StaticMacAddress',$MacAddress) - } - $arguments.Add('SwitchName',$SwitchName) - } - Write-Verbose -Message $localizedData.AddVMNetAdapter - Add-VMNetworkAdapter @arguments -ErrorAction Stop - } - } - else - { - Write-Verbose -Message $localizedData.RemoveVMNetAdapter - Remove-VMNetworkAdapter @arguments -ErrorAction Stop - } -} - -<# -.SYNOPSIS - Tests if MSFT_xVMNetworkAdapter resource state is indeed desired state or not. - -.PARAMETER Id - Specifies an unique identifier for the network adapter. - -.PARAMETER Name - Specifies a name for the network adapter that needs to be connected to a VM or management OS. - -.PARAMETER SwitchName - Specifies the name of the switch to which the new VM network adapter will be connected. - -.PARAMETER VMName - Specifies the name of the VM to which the network adapter will be connected. - Specify VMName as ManagementOS if you wish to connect the adapter to host OS. - -.PARAMETER MacAddress - Specifies the MAC address for the network adapter. This is not applicable if VMName - is set to ManagementOS. Use this parameter to specify a static MAC address. - -.PARAMETER Ensure - Specifies if the network adapter should be Present or Absent. -#> -Function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - Param ( - [Parameter(Mandatory)] - [String] $Id, - - [Parameter(Mandatory)] - [String] $Name, - - [Parameter(Mandatory)] - [String] $SwitchName, - - [Parameter(Mandatory)] - [String] $VMName, - - [Parameter()] - [String] $MacAddress, - - [Parameter()] - [ValidateSet('Present','Absent')] - [String] $Ensure='Present' - ) - - $arguments = @{ - Name = $Name - } - - if ($VMName -ne 'ManagementOS') - { - $arguments.Add('VMName',$VMName) - } - else - { - $arguments.Add('ManagementOS', $true) - $arguments.Add('SwitchName', $SwitchName) - } - - Write-Verbose -Message $localizedData.GetVMNetAdapter - $netAdapterExists = Get-VMNetworkAdapter @arguments -ErrorAction SilentlyContinue - - if ($Ensure -eq 'Present') - { - if ($netAdapterExists) - { - if ($VMName -ne 'ManagementOS') - { - if ($MacAddress) - { - if ($netAdapterExists.DynamicMacAddressEnabled) - { - Write-Verbose -Message $localizedData.EnableStaticMacAddress - return $false - } - elseif ($netAdapterExists.MacAddress -ne $MacAddress) - { - Write-Verbose -Message $localizedData.StaticAddressDoesNotMatch - return $false - } - } - else - { - if (-not $netAdapterExists.DynamicMacAddressEnabled) - { - Write-Verbose -Message $localizedData.EnableDynamicMacAddress - return $false - } - } - - if ($netAdapterExists.SwitchName -ne $SwitchName) - { - Write-Verbose -Message $localizedData.SwitchIsDifferent - return $false - } - else - { - Write-Verbose -Message $localizedData.VMNetAdapterExistsNoActionNeeded - return $true - } - } - else - { - Write-Verbose -Message $localizedData.VMNetAdapterExistsNoActionNeeded - return $true - } - } - else - { - Write-Verbose -Message $localizedData.VMNetAdapterDoesNotExistShouldAdd - return $false - } - } - else - { - if ($netAdapterExists) - { - Write-Verbose -Message $localizedData.VMNetAdapterExistsShouldRemove - return $false - } - else - { - Write-Verbose -Message $localizedData.VMNetAdapterDoesNotExistNoActionNeeded - return $true - } - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMNetworkAdapter/MSFT_xVMNetworkAdapter.schema.mof b/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMNetworkAdapter/MSFT_xVMNetworkAdapter.schema.mof deleted file mode 100644 index 2d7ed1d3..00000000 --- a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMNetworkAdapter/MSFT_xVMNetworkAdapter.schema.mof +++ /dev/null @@ -1,12 +0,0 @@ - -[ClassVersion("2.0.0.0"), FriendlyName("xVMNetworkAdapter")] -class MSFT_xVMNetworkAdapter : OMI_BaseResource -{ - [Key] String Id; - [Required] String Name; - [Required] String SwitchName; - [Required] String VMName; - [Write] String MacAddress; - [Write, ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Read] Boolean DynamicMacAddress; -}; diff --git a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMNetworkAdapter/en-US/MSFT_xVMNetworkAdapter.psd1 b/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMNetworkAdapter/en-US/MSFT_xVMNetworkAdapter.psd1 deleted file mode 100644 index c60f3ff9..00000000 --- a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMNetworkAdapter/en-US/MSFT_xVMNetworkAdapter.psd1 +++ /dev/null @@ -1,23 +0,0 @@ -ConvertFrom-StringData @' - VMNameAndManagementTogether=VMName cannot be provided when ManagementOS is set to True. - MustProvideVMName=Must provide VMName parameter when ManagementOS is set to False. - GetVMNetAdapter=Getting VM Network Adapter information. - FoundVMNetAdapter=Found VM Network Adapter. - NoVMNetAdapterFound=No VM Network Adapter found. - StaticMacAddressChosen=Static MAC Address has been specified. - StaticAddressDoesNotMatch=Staic MAC address on the VM Network Adapter does not match. - ModifyVMNetAdapter=VM Network Adapter exists with different configuration. This will be modified. - EnableDynamicMacAddress=VM Network Adapter exists but without Dynamic MAC address setting. - EnableStaticMacAddress=VM Network Adapter exists but without static MAC address setting. - PerformVMNetModify=Performing VM Network Adapter configuration changes. - CannotChangeHostAdapterMacAddress=VM Network adapter in configuration is a host adapter. Its configuration cannot be modified. - AddVMNetAdapter=Adding VM Network Adapter. - RemoveVMNetAdapter=Removing VM Network Adapter. - VMNetAdapterExistsNoActionNeeded=VM Network Adapter exists with requested configuration. No action needed. - VMNetAdapterDoesNotExistShouldAdd=VM Network Adapter does not exist. It will be added. - VMNetAdapterExistsShouldRemove=VM Network Adapter Exists. It will be removed. - VMNetAdapterDoesNotExistNoActionNeeded=VM Network adapter does not exist. No action needed. - StaticMacExists=StaicMacAddress configuration exists as desired. - SwitchIsDifferent=Net Adapter is not connected to the requested switch. - PerformSwitchConnect=Connecting VM Net adapter to the right switch. -'@ diff --git a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMProcessor/MSFT_xVMProcessor.psm1 b/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMProcessor/MSFT_xVMProcessor.psm1 deleted file mode 100644 index 79cd09cc..00000000 --- a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMProcessor/MSFT_xVMProcessor.psm1 +++ /dev/null @@ -1,443 +0,0 @@ -#region localizeddata -if (Test-Path "${PSScriptRoot}\${PSUICulture}") -{ - Import-LocalizedData -BindingVariable localizedData -Filename MSFT_xVMProcessor.psd1 ` - -BaseDirectory "${PSScriptRoot}\${PSUICulture}" -} -else -{ - # fallback to en-US - Import-LocalizedData -BindingVariable localizedData -Filename MSFT_xVMProcessor.psd1 ` - -BaseDirectory "${PSScriptRoot}\en-US" -} -#endregion - -# Import the common HyperV functions -Import-Module -Name ( Join-Path ` - -Path (Split-Path -Path $PSScriptRoot -Parent) ` - -ChildPath '\HyperVCommon\HyperVCommon.psm1' ) - -<# -.SYNOPSIS - Gets MSFT_xVMProcessor resource current state. - -.PARAMETER VMName - Specifies the name of the virtual machine on which the processor is to be configured. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $VMName - ) - - Assert-Module -Name 'Hyper-V' - Write-Verbose -Message ($localizedData.QueryingVMProcessor -f $VMName) - $vmProcessor = Get-VMProcessor -VMName $VMName -ErrorAction Stop - $configuration = @{ - VMName = $VMName - EnableHostResourceProtection = $vmProcessor.EnableHostResourceProtection - ExposeVirtualizationExtensions = $vmProcessor.ExposeVirtualizationExtensions - HwThreadCountPerCore = $vmProcessor.HwThreadCountPerCore - Maximum = $vmProcessor.Maximum - MaximumCountPerNumaNode = $vmProcessor.MaximumCountPerNumaNode - MaximumCountPerNumaSocket = $vmProcessor.MaximumCountPerNumaSocket - RelativeWeight = $vmProcessor.RelativeWeight - Reserve = $vmProcessor.Reserve - ResourcePoolName = $vmProcessor.ResourcePoolName - CompatibilityForMigrationEnabled = $vmProcessor.CompatibilityForMigrationEnabled - CompatibilityForOlderOperatingSystemsEnabled = $vmProcessor.CompatibilityForOlderOperatingSystemsEnabled - RestartIfNeeded = $false - } - return $configuration -} - -<# -.SYNOPSIS - Tests if MSFT_xVMProcessor resource state is in the desired state or not. - -.PARAMETER VMName - Specifies the name of the virtual machine on which the processor is to be configured. - -.PARAMETER EnableHostResourceProtection - Specifies whether to enable host resource protection. - NOTE: Only supported on Windows 10 and Server 2016. - -.PARAMETER ExposeVirtualizationExtensions - Specifies whether nested virtualization is enabled. - NOTE: Only supported on Windows 10 and Server 2016. - -.PARAMETER HwThreadCountPerCore - Specifies the maximum thread core per processor core. - NOTE: Only supported on Windows 10 and Server 2016. - -.PARAMETER Maximum - Specifies the maximum percentage of resources available to the virtual machine - processor to be configured. Allowed values range from 0 to 100. - -.PARAMETER MaximumCountPerNumaNode - Specifies the maximum number of processors per NUMA node to be configured for - the virtual machine. - -.PARAMETER MaximumCountPerNumaSocket - Specifies the maximum number of sockets per NUMA node to be configured for - the virtual machine. - -.PARAMETER RelativeWeight - Specifies the priority for allocating the physical computer's processing - power to this virtual machine relative to others. Allowed values range - from 1 to 10000. - -.PARAMETER Reserve - Specifies the percentage of processor resources to be reserved for this - virtual machine. Allowed values range from 0 to 100. - -.PARAMETER ResourcePoolName - Specifies the name of the processor resource pool to be used. - -.PARAMETER CompatibilityForMigrationEnabled - Specifies whether the virtual processors features are to be limited - for compatibility when migrating the virtual machine to another host. - -.PARAMETER CompatibilityForOlderOperatingSystemsEnabled - Specifies whether the virtual processor’s features are to be limited - for compatibility with older operating systems. - -.PARAMETER RestartIfNeeded - If specified, shutdowns and restarts the VM if needed for property - changes. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $VMName, - - [Parameter()] - [System.Boolean] - $EnableHostResourceProtection, - - [Parameter()] - [System.Boolean] - $ExposeVirtualizationExtensions, - - [Parameter()] - [System.UInt64] - $HwThreadCountPerCore, - - [Parameter()] - [ValidateRange(0,100)] - [System.UInt64] - $Maximum, - - [Parameter()] - [System.UInt32] - $MaximumCountPerNumaNode, - - [Parameter()] - [System.UInt32] - $MaximumCountPerNumaSocket, - - [Parameter()] - [ValidateRange(0,10000)] - [System.UInt32] - $RelativeWeight, - - [Parameter()] - [ValidateRange(0,100)] - [System.UInt64] - $Reserve, - - [Parameter()] - [System.String] - $ResourcePoolName, - - [Parameter()] - [System.Boolean] - $CompatibilityForMigrationEnabled, - - [Parameter()] - [System.Boolean] - $CompatibilityForOlderOperatingSystemsEnabled, - - [Parameter()] - [System.Boolean] - $RestartIfNeeded - ) - - Assert-Module -Name 'Hyper-V' - Assert-TargetResourceParameter @PSBoundParameters - - $targetResource = Get-TargetResource -VMName $VMName - $excludedTestParameters = @('RestartIfNeeded') - $isTargetResourceCompliant = $true - - foreach ($parameter in $PSBoundParameters.GetEnumerator()) - { - if (($targetResource.ContainsKey($parameter.Key)) -and - ($parameter.Key -notin $excludedTestParameters) -and - ($parameter.Value -ne $targetResource[$parameter.Key])) - { - $isTargetResourceCompliant = $false - Write-Verbose -Message ($localizedData.PropertyMismatch -f $parameter.Key, - $parameter.Value, $targetResource[$parameter.Key]) - } - } - - if ($isTargetResourceCompliant) - { - Write-Verbose -Message ($localizedData.VMProcessorInDesiredState -f $VMName) - } - else - { - Write-Verbose -Message ($localizedData.VMProcessorNotInDesiredState -f $VMName) - } - - return $isTargetResourceCompliant -} #end function - -<# -.SYNOPSIS - Configures MSFT_xVMProcessor resource state. - -.PARAMETER VMName - Specifies the name of the virtual machine on which the processor is to be configured. - -.PARAMETER EnableHostResourceProtection - Specifies whether to enable host resource protection. - NOTE: Only supported on Windows 10 and Server 2016. - -.PARAMETER ExposeVirtualizationExtensions - Specifies whether nested virtualization is enabled. - NOTE: Only supported on Windows 10 and Server 2016. - -.PARAMETER HwThreadCountPerCore - Specifies the maximum thread core per processor core - NOTE: Only supported on Windows 10 and Server 2016. - -.PARAMETER Maximum - Specifies the maximum percentage of resources available to the virtual machine - processor to be configured. Allowed values range from 0 to 100. - -.PARAMETER MaximumCountPerNumaNode - Specifies the maximum number of processors per NUMA node to be configured for - the virtual machine. - -.PARAMETER MaximumCountPerNumaSocket - Specifies the maximum number of sockets per NUMA node to be configured for - the virtual machine. - -.PARAMETER RelativeWeight - Specifies the priority for allocating the physical computer's processing - power to this virtual machine relative to others. Allowed values range - from 1 to 10000. - -.PARAMETER Reserve - Specifies the percentage of processor resources to be reserved for this - virtual machine. Allowed values range from 0 to 100. - -.PARAMETER ResourcePoolName - Specifies the name of the processor resource pool to be used. - -.PARAMETER CompatibilityForMigrationEnabled - Specifies whether the virtual processors features are to be limited - for compatibility when migrating the virtual machine to another host. - -.PARAMETER CompatibilityForOlderOperatingSystemsEnabled - Specifies whether the virtual processor’s features are to be limited - for compatibility with older operating systems. - -.PARAMETER RestartIfNeeded - If specified, shutdowns and restarts the VM if needed for property - changes. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $VMName, - - [Parameter()] - [System.Boolean] - $EnableHostResourceProtection, - - [Parameter()] - [System.Boolean] - $ExposeVirtualizationExtensions, - - [Parameter()] - [System.UInt64] - $HwThreadCountPerCore, - - [Parameter()] - [ValidateRange(0,100)] - [System.UInt64] - $Maximum, - - [Parameter()] - [System.UInt32] - $MaximumCountPerNumaNode, - - [Parameter()] - [System.UInt32] - $MaximumCountPerNumaSocket, - - [Parameter()] - [ValidateRange(0,10000)] - [System.UInt32] - $RelativeWeight, - - [Parameter()] - [ValidateRange(0,100)] - [System.UInt64] - $Reserve, - - [Parameter()] - [System.String] - $ResourcePoolName, - - [Parameter()] - [System.Boolean] - $CompatibilityForMigrationEnabled, - - [Parameter()] - [System.Boolean] - $CompatibilityForOlderOperatingSystemsEnabled, - - [Parameter()] - [System.Boolean] - $RestartIfNeeded - ) - - Assert-Module -Name 'Hyper-V' - Assert-TargetResourceParameter @PSBoundParameters - - # Parameters requiring shutdown. - $restartRequiredParameterNames = @( - 'ExposeVirtualizationExtensions', - 'CompatibilityForMigrationEnabled', - 'CompatibilityForOlderOperatingSystemsEnabled', - 'HwThreadCountPerCore', - 'MaximumCountPerNumaNode', - 'MaximumCountPerNumaSocket', - 'ResourcePoolName' - ) - $isRestartRequired = $false - $vmObject = Get-VM -Name $VMName - - # Only check for restart required parameters if VM is not off - if ($vmObject.State -ne 'Off') - { - foreach ($parameterName in $restartRequiredParameterNames) - { - if ($PSBoundParameters.ContainsKey($parameterName)) - { - if (-not $RestartIfNeeded) - { - $errorMessage = $localized.CannotUpdateVmOnlineError -f $parameterName - New-InvalidOperationError -ErrorId InvalidState -ErrorMessage $errorMessage - } - else - { - $isRestartRequired = $true - } - } - } #end foreach parameter - } - - $null = $PSBoundParameters.Remove('RestartIfNeeded') - $null = $PSBoundParameters.Remove('VMName') - - if (-not $isRestartRequired) - { - # No parameter specified that requires a restart, so disable the restart flag - Write-Verbose -Message ($localizedData.UpdatingVMProperties -f $VMName) - Set-VMProcessor -VMName $VMName @PSBoundParameters - Write-Verbose -Message ($localizedData.VMPropertiesUpdated -f $VMName) - } - else - { - # Restart is required and that requires turning VM off - $setVMPropertyParameters = @{ - VMName = $VMName - VMCommand = 'Set-VMProcessor' - ChangeProperty = $PSBoundParameters - RestartIfNeeded = $true - Verbose = $Verbose - } - Set-VMProperty @setVMPropertyParameters - } -} #end function - -<# -.SYNOPSIS - Ensures OS supports the supplied parameters. - -.PARAMETER EnableHostResourceProtection - Specifies whether to enable host resource protection. - NOTE: Only supported on Windows 10, Server 2016 and Nano. - -.PARAMETER ExposeVirtualizationExtensions - Specifies whether nested virtualization is enabled. - NOTE: Only supported on Windows 10, Server 2016 and Nano. - -.PARAMETER HwThreadCountPerCore - Specifies the maximum thread core per processor core - NOTE: Only supported on Windows 10, Server 2016 and Nano. - -.PARAMETER RemainingArgument - Catch all to enable splatting of remaining parameters. -#> -function Assert-TargetResourceParameter -{ - [CmdletBinding()] - param - ( - [Parameter()] - [System.Boolean] - $EnableHostResourceProtection, - - [Parameter()] - [System.Boolean] - $ExposeVirtualizationExtensions, - - [Parameter()] - [System.UInt64] - $HwThreadCountPerCore, - - [Parameter(ValueFromRemainingArguments)] - [System.Object[]] - $RemainingArguments - ) - - # Get-CimInstance returns build number as a string - $win32OperatingSystem = Get-CimInstance -ClassName Win32_OperatingSystem -Verbose:$false - $osBuildNumber = $win32OperatingSystem.BuildNumber -as [System.Int64] - $build14393RequiredParameterNames = @( - 'EnableHostResourceProtection', - 'ExposeVirtualizationExtensions', - 'HwThreadCountPerCore' - ) - - foreach ($parameterName in $build14393RequiredParameterNames) - { - if (($PSBoundParameters.ContainsKey($parameterName)) -and ($osBuildNumber -lt 14393)) - { - $errorMessage = $localizedData.UnsupportedSystemError -f $parameterName, 14393 - New-InvalidArgumentError -ErrorId SystemUnsupported -ErrorMessage $errorMessage - } - } -} #end function - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMProcessor/MSFT_xVMProcessor.schema.mof b/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMProcessor/MSFT_xVMProcessor.schema.mof deleted file mode 100644 index 0b3c1746..00000000 --- a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMProcessor/MSFT_xVMProcessor.schema.mof +++ /dev/null @@ -1,17 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xVMProcessor")] -class MSFT_xVMProcessor : OMI_BaseResource -{ - [Key, Description("Specifies the name of the virtual machine on which the processor is to be configured.")] String VMName; - [Write, Description("Specifies whether to enable host resource protection.")] Boolean EnableHostResourceProtection; - [Write, Description("Specifies whether nested virtualization is enabled.")] Boolean ExposeVirtualizationExtensions; - [Write, Description("Specifies the maximum thread core per processor core.")] Uint64 HwThreadCountPerCore; - [Write, Description("Specifies the maximum percentage of resources available to the virtual machine processor to be configured. Allowed values range from 0 to 100.")] Uint64 Maximum; - [Write, Description("Specifies the maximum number of processors per NUMA node to be configured for the virtual machine.")] Uint32 MaximumCountPerNumaNode; - [Write, Description("Specifies the maximum number of sockets per NUMA node to be configured for the virtual machine.")] Uint32 MaximumCountPerNumaSocket; - [Write, Description("Specifies the priority for allocating the physical computer's processing power to this virtual machine relative to others. Allowed values range from 1 to 10000.")] Uint32 RelativeWeight; - [Write, Description("Specifies the percentage of processor resources to be reserved for this virtual machine. Allowed values range from 0 to 100.")] Uint64 Reserve; - [Write, Description("Specifies the name of the processor resource pool to be used.")] String ResourcePoolName; - [Write, Description("Specifies whether the virtual processors features are to be limited for compatibility when migrating the virtual machine to another host.")] Boolean CompatibilityForMigrationEnabled; - [Write, Description("Specifies whether the virtual processor’s features are to be limited for compatibility with older operating systems.")] Boolean CompatibilityForOlderOperatingSystemsEnabled; - [Write, Description("If specified, shutdowns and restarts the VM if needed for property changes.")] Boolean RestartIfNeeded; -}; diff --git a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMProcessor/en-US/MSFT_xVMProcessor.psd1 b/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMProcessor/en-US/MSFT_xVMProcessor.psd1 deleted file mode 100644 index fa6eab6f..00000000 --- a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMProcessor/en-US/MSFT_xVMProcessor.psd1 +++ /dev/null @@ -1,12 +0,0 @@ -ConvertFrom-StringData @' - QueryingVMProcessor = Querying VM '{0}' processor(s). - PropertyMismatch = Property '{0}' mismatch; expected value '{1}', but was '{2}'. - VMProcessorInDesiredState = VM '{0}' processor(s) in desired state. - VMProcessorNotInDesiredState = VM '{0}' processor(s) not in desired state. - UpdatingVMProperties = Updating VM '{0}' properties. - VMPropertiesUpdated = VM '{0}' properties have been updated. - - VMNotFoundError = VM '{0}' was not found. - UnsupportedSystemError = Parameter '{0}' is not supported on operating system builds earlier than '{1}'. - CannotUpdateVmOnlineError = Cannot change online property '{0}' unless 'RestartIfNeeded' is set to true. -'@ diff --git a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMSwitch/MSFT_xVMSwitch.psm1 b/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMSwitch/MSFT_xVMSwitch.psm1 deleted file mode 100644 index a9ee5839..00000000 --- a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMSwitch/MSFT_xVMSwitch.psm1 +++ /dev/null @@ -1,566 +0,0 @@ -#region localizeddata -if (Test-Path "${PSScriptRoot}\${PSUICulture}") -{ - Import-LocalizedData ` - -BindingVariable LocalizedData ` - -Filename MSFT_xVMSwitch.strings.psd1 ` - -BaseDirectory "${PSScriptRoot}\${PSUICulture}" -} -else -{ - #fallback to en-US - Import-LocalizedData ` - -BindingVariable LocalizedData ` - -Filename MSFT_xVMSwitch.strings.psd1 ` - -BaseDirectory "${PSScriptRoot}\en-US" -} -#endregion - -# Import the common HyperV functions -Import-Module -Name ( Join-Path ` - -Path (Split-Path -Path $PSScriptRoot -Parent) ` - -ChildPath '\HyperVCommon\HyperVCommon.psm1' ) - -<# -.SYNOPSIS - Gets MSFT_xVMSwitch resource current state. - -.PARAMETER Name - Name of the VM Switch. - -.PARAMETER Type - Type of switch. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [String] - $Name, - - [Parameter(Mandatory = $true)] - [ValidateSet("External","Internal","Private")] - [String] - $Type - ) - - Write-Verbose -Message "Getting settings for VM Switch '$Name'" - - # Check if Hyper-V module is present for Hyper-V cmdlets - if (!(Get-Module -ListAvailable -Name Hyper-V)) - { - New-InvalidOperationError ` - -ErrorId 'HyperVNotInstalledError' ` - -ErrorMessage $LocalizedData.HyperVNotInstalledError - } - - $switch = Get-VMSwitch -Name $Name -SwitchType $Type -ErrorAction SilentlyContinue - - if ($null -ne $switch) - { - $ensure = 'Present' - if ($switch.SwitchType -eq 'External') - { - if ($switch.EmbeddedTeamingEnabled -ne $true) - { - $netAdapterName = (Get-NetAdapter -InterfaceDescription $switch.NetAdapterInterfaceDescription -ErrorAction SilentlyContinue).Name - $description = $switch.NetAdapterInterfaceDescription - } - else - { - $netAdapterName = (Get-NetAdapter -InterfaceDescription $switch.NetAdapterInterfaceDescriptions).Name - $description = $switch.NetAdapterInterfaceDescriptions - } - } - else - { - $netAdapterName = $null - $description = $null - } - } - else - { - $ensure = 'Absent' - } - - $returnValue = @{ - Name = $switch.Name - Type = $switch.SwitchType - NetAdapterName = [string[]]$netAdapterName - AllowManagementOS = $switch.AllowManagementOS - EnableEmbeddedTeaming = $switch.EmbeddedTeamingEnabled - Ensure = $ensure - Id = $switch.Id - NetAdapterInterfaceDescription = $description - } - - if ($null -ne $switch.BandwidthReservationMode) - { - $returnValue['BandwidthReservationMode'] = $switch.BandwidthReservationMode - } - else - { - $returnValue['BandwidthReservationMode'] = 'NA' - } - - return $returnValue -} - -<# -.SYNOPSIS - Configures MSFT_xVMSwitch resource state. - -.PARAMETER Name - Name of the VM Switch. - -.PARAMETER Type - Type of switch. - -.PARAMETER NetAdapterName - Network adapter name(s) for external switch type. - -.PARAMETER AllowManagementOS - Specify if the VM host has access to the physical NIC. - -.PARAMETER EnableEmbeddedTeaming - Should embedded NIC teaming be used (Windows Server 2016 only). - -.PARAMETER BandwidthReservationMode - Type of Bandwidth Reservation Mode to use for the switch. - -.PARAMETER Ensure - Whether switch should be present or absent. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [String] - $Name, - - [Parameter(Mandatory = $true)] - [ValidateSet("External","Internal","Private")] - [String] - $Type, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String[]] - $NetAdapterName, - - [Parameter()] - [Boolean] - $AllowManagementOS = $false, - - [Parameter()] - [Boolean] - $EnableEmbeddedTeaming = $false, - - [Parameter()] - [ValidateSet("Default","Weight","Absolute","None","NA")] - [String] - $BandwidthReservationMode = "NA", - - [Parameter()] - [ValidateSet("Present","Absent")] - [String] - $Ensure = "Present" - ) - - # Check if Hyper-V module is present for Hyper-V cmdlets - if (!(Get-Module -ListAvailable -Name Hyper-V)) - { - New-InvalidOperationError ` - -ErrorId 'HyperVNotInstalledError' ` - -ErrorMessage $LocalizedData.HyperVNotInstalledError - } - - # Check to see if the BandwidthReservationMode chosen is supported in the OS - elseif (($BandwidthReservationMode -ne "NA") -and ((Get-OSVersion) -lt [version]'6.2.0')) - { - New-InvalidArgumentError ` - -ErrorId 'BandwidthReservationModeError' ` - -ErrorMessage $LocalizedData.BandwidthReservationModeError - } - - if ($EnableEmbeddedTeaming -eq $true -and (Get-OSVersion).Major -lt 10) - { - New-InvalidArgumentError ` - -ErrorId 'SETServer2016Error' ` - -ErrorMessage $LocalizedData.SETServer2016Error - } - - if ($Ensure -eq 'Present') - { - $switch = (Get-VMSwitch -Name $Name -SwitchType $Type -ErrorAction SilentlyContinue) - - # If switch is present and it is external type, that means it doesn't have right properties (TEST code ensures that) - if ($switch -and ($switch.SwitchType -eq 'External')) - { - $removeReaddSwitch = $false - - Write-Verbose -Message ($LocalizedData.CheckingSwitchMessage -f $Name) - if ($switch.EmbeddedTeamingEnabled -eq $false -or $null -eq $switch.EmbeddedTeamingEnabled) - { - if ((Get-NetAdapter -Name $NetAdapterName).InterfaceDescription -ne $switch.NetAdapterInterfaceDescription) - { - Write-Verbose -Message ($LocalizedData.NetAdapterInterfaceIncorrectMessage -f $Name) - $removeReaddSwitch = $true - } - } - else - { - $adapters = (Get-NetAdapter -InterfaceDescription $switch.NetAdapterInterfaceDescriptions -ErrorAction SilentlyContinue).Name - if ($null -ne (Compare-Object -ReferenceObject $adapters -DifferenceObject $NetAdapterName)) - { - Write-Verbose -Message ($LocalizedData.SwitchIncorrectNetworkAdapters -f $Name) - $removeReaddSwitch = $true - } - } - - if (($BandwidthReservationMode -ne "NA") -and ($switch.BandwidthReservationMode -ne $BandwidthReservationMode)) - { - Write-Verbose -Message ($LocalizedData.BandwidthReservationModeIncorrect -f $Name) - $removeReaddSwitch = $true - } - - if ($null -ne $switch.EmbeddedTeamingEnabled -and - $switch.EmbeddedTeamingEnabled -ne $EnableEmbeddedTeaming) - { - Write-Verbose -Message ($LocalizedData.EnableEmbeddedTeamingIncorrect -f $Name) - $removeReaddSwitch = $true - } - - if ($removeReaddSwitch) - { - Write-Verbose -Message ($LocalizedData.RemoveAndReaddSwitchMessage -f $Name) - $switch | Remove-VMSwitch -Force - $parameters = @{} - $parameters["Name"] = $Name - $parameters["NetAdapterName"] = $NetAdapterName - - if ($BandwidthReservationMode -ne "NA") - { - $parameters["MinimumBandwidthMode"] = $BandwidthReservationMode - } - - if ($PSBoundParameters.ContainsKey("AllowManagementOS")) - { - $parameters["AllowManagementOS"] = $AllowManagementOS - } - - if ($PSBoundParameters.ContainsKey("EnableEmbeddedTeaming")) - { - $parameters["EnableEmbeddedTeaming"] = $EnableEmbeddedTeaming - } - - $null = New-VMSwitch @parameters - Write-Verbose -Message "Switch $Name has right netadapter $NetAdapterName" - # Since the switch is recreated, the $switch variable is stale and needs to be reassigned - $switch = (Get-VMSwitch -Name $Name -SwitchType $Type -ErrorAction SilentlyContinue) - } - else - { - Write-Verbose -Message ($LocalizedData.SwitchCorrectNetAdapterAndBandwidthMode -f $Name, $NetAdapterName, $BandwidthReservationMode) - } - - Write-Verbose -Message ($LocalizedData.CheckAllowManagementOS -f $Name) - if ($PSBoundParameters.ContainsKey("AllowManagementOS") -and ($switch.AllowManagementOS -ne $AllowManagementOS)) - { - Write-Verbose -Message ($LocalizedData.AllowManagementOSIncorrect -f $Name) - $switch | Set-VMSwitch -AllowManagementOS $AllowManagementOS - Write-Verbose -Message ($LocalizedData.AllowManagementOSUpdated -f $Name, $AllowManagementOS) - } - else - { - Write-Verbose -Message ($LocalizedData.AllowManagementOSCorrect -f $Name) - } - } - - # If the switch is not present, create one - else - { - Write-Verbose -Message ($LocalizedData.PresentNotCorrect -f $Name, $Ensure) - Write-Verbose -Message $LocalizedData.CreatingSwitch - $parameters = @{} - $parameters["Name"] = $Name - - if ($BandwidthReservationMode -ne "NA") - { - $parameters["MinimumBandwidthMode"] = $BandwidthReservationMode - } - - if ($NetAdapterName) - { - $parameters["NetAdapterName"] = $NetAdapterName - if ($PSBoundParameters.ContainsKey("AllowManagementOS")) - { - $parameters["AllowManagementOS"] = $AllowManagementOS - } - } - else - { - $parameters["SwitchType"] = $Type - } - - if ($PSBoundParameters.ContainsKey("EnableEmbeddedTeaming")) - { - $parameters["EnableEmbeddedTeaming"] = $EnableEmbeddedTeaming - } - - $null = New-VMSwitch @parameters - Write-Verbose -Message ($LocalizedData.PresentCorrect -f $Name, $Ensure) - } - } - # Ensure is set to "Absent", remove the switch - else - { - Get-VMSwitch $Name -ErrorAction SilentlyContinue | Remove-VMSwitch -Force - } -} - -<# -.SYNOPSIS - Tests if MSFT_xVMSwitch resource state is in the desired state or not. - -.PARAMETER Name - Name of the VM Switch. - -.PARAMETER Type - Type of switch. - -.PARAMETER NetAdapterName - Network adapter name(s) for external switch type. - -.PARAMETER AllowManagementOS - Specify if the VM host has access to the physical NIC. - -.PARAMETER EnableEmbeddedTeaming - Should embedded NIC teaming be used (Windows Server 2016 only). - -.PARAMETER BandwidthReservationMode - Type of Bandwidth Reservation Mode to use for the switch. - -.PARAMETER Ensure - Whether switch should be present or absent. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [String] - $Name, - - [Parameter(Mandatory = $true)] - [ValidateSet("External","Internal","Private")] - [String] - $Type, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String[]] - $NetAdapterName, - - [Parameter()] - [Boolean] - $AllowManagementOS = $false, - - [Parameter()] - [Boolean] - $EnableEmbeddedTeaming = $false, - - [Parameter()] - [ValidateSet("Default","Weight","Absolute","None","NA")] - [String] - $BandwidthReservationMode = "NA", - - [Parameter()] - [ValidateSet("Present","Absent")] - [String] - $Ensure = "Present" - ) - - # Check if Hyper-V module is present for Hyper-V cmdlets - if (!(Get-Module -ListAvailable -Name Hyper-V)) - { - New-InvalidOperationError ` - -ErrorId 'HyperVNotInstalledError' ` - -ErrorMessage $LocalizedData.HyperVNotInstalledError - } - - #region input validation - if ($Type -eq 'External' -and !($NetAdapterName)) - { - New-InvalidArgumentError ` - -ErrorId 'NetAdapterNameRequiredError' ` - -ErrorMessage $LocalizedData.NetAdapterNameRequiredError - } - - if ($Type -ne 'External' -and $NetAdapterName) - { - New-InvalidArgumentError ` - -ErrorId 'NetAdapterNameNotRequiredError' ` - -ErrorMessage $LocalizedData.NetAdapterNameNotRequiredError - } - - if (($BandwidthReservationMode -ne "NA") -and ((Get-OSVersion) -lt [version]'6.2.0')) - { - New-InvalidArgumentError ` - -ErrorId 'BandwidthReservationModeError' ` - -ErrorMessage $LocalizedData.BandwidthReservationModeError - } - - if ($EnableEmbeddedTeaming -eq $true -and (Get-OSVersion).Major -lt 10) - { - New-InvalidArgumentError ` - -ErrorId 'SETServer2016Error' ` - -ErrorMessage $LocalizedData.SETServer2016Error - } - #endregion - - try - { - # Check if switch exists - Write-Verbose -Message ($LocalizedData.PresentChecking -f $Name, $Ensure) - $switch = Get-VMSwitch -Name $Name -SwitchType $Type -ErrorAction Stop - - # If switch exists - if ($null -ne $switch) - { - Write-Verbose -Message ($LocalizedData.SwitchPresent -f $Name) - # If switch should be present, check the switch type - if ($Ensure -eq 'Present') - { - ## Only check the BandwidthReservationMode if specified - if ($PSBoundParameters.ContainsKey('BandwidthReservationMode')) - { - # If the BandwidthReservationMode is correct, or if $switch.BandwidthReservationMode is $null which means it isn't supported on the OS - Write-Verbose -Message ($LocalizedData.CheckingBandwidthReservationMode -f $Name) - if ($switch.BandwidthReservationMode -eq $BandwidthReservationMode -or $null -eq $switch.BandwidthReservationMode) - { - Write-Verbose -Message ($LocalizedData.BandwidthReservationModeCorrect -f $Name) - } - else - { - Write-Verbose -Message ($LocalizedData.BandwidthReservationModeIncorrect -f $Name) - return $false - } - } - - # If switch is the external type, check additional propeties - if ($Type -eq 'External') - { - if ($EnableEmbeddedTeaming -eq $false) - { - Write-Verbose -Message ($LocalizedData.CheckingNetAdapterInterface -f $Name) - $adapter = $null - try - { - $adapter = Get-NetAdapter -Name $NetAdapterName -ErrorAction SilentlyContinue - } - catch - { - # There are scenarios where the SilentlyContinue error action is not honoured, - # so this block serves to handle those and the write-verbose message is here - # to ensure that script analyser doesn't see an empty catch block to throw an - # error - Write-Verbose -Message $LocalizedData.NetAdapterNotFound - } - - if ($adapter.InterfaceDescription -ne $switch.NetAdapterInterfaceDescription) - { - return $false - } - else - { - Write-Verbose -Message ($LocalizedData.NetAdapterInterfaceCorrect -f $Name) - } - } - else - { - Write-Verbose -Message ($LocalizedData.CheckingNetAdapterInterfaces -f $Name) - if ($null -ne $switch.NetAdapterInterfaceDescriptions) - { - $adapters = (Get-NetAdapter -InterfaceDescription $switch.NetAdapterInterfaceDescriptions -ErrorAction SilentlyContinue).Name - if ($null -ne (Compare-Object -ReferenceObject $adapters -DifferenceObject $NetAdapterName)) - { - Write-Verbose -Message ($LocalizedData.IncorrectNetAdapterInterfaces -f $Name) - return $false - } - else - { - Write-Verbose -Message ($LocalizedData.CorrectNetAdapterInterfaces -f $Name) - } - } - else - { - Write-Verbose -Message ($LocalizedData.IncorrectNetAdapterInterfaces -f $Name) - return $false - } - } - - if ($PSBoundParameters.ContainsKey("AllowManagementOS")) - { - Write-Verbose -Message ($LocalizedData.CheckAllowManagementOS -f $Name) - if (($switch.AllowManagementOS -ne $AllowManagementOS)) - { - return $false - } - else - { - Write-Verbose -Message ($LocalizedData.AllowManagementOSCorrect -f $Name) - } - } - } - - # Only check embedded teaming if specified - if ($PSBoundParameters.ContainsKey("EnableEmbeddedTeaming") -eq $true) - { - Write-Verbose -Message ($LocalizedData.CheckEnableEmbeddedTeaming -f $Name) - if ($switch.EmbeddedTeamingEnabled -eq $EnableEmbeddedTeaming -or $null -eq $switch.EmbeddedTeamingEnabled) - { - Write-Verbose -Message ($LocalizedData.EnableEmbeddedTeamingCorrect -f $Name) - } - else - { - Write-Verbose -Message ($LocalizedData.EnableEmbeddedTeamingIncorrect -f $Name) - return $false - } - } - - return $true - } - # If switch should be absent, but is there, return $false - else - { - return $false - } - } - } - - # If no switch was present - catch [System.Management.Automation.ActionPreferenceStopException] - { - Write-Verbose -Message ($LocalizedData.SwitchNotPresent -f $Name) - return ($Ensure -eq 'Absent') - } -} - -<# -.SYNOPSIS -Returns the OS version -#> -function Get-OSVersion -{ - [Environment]::OSVersion.Version -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMSwitch/MSFT_xVMSwitch.schema.mof b/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMSwitch/MSFT_xVMSwitch.schema.mof deleted file mode 100644 index 711a1980..00000000 --- a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMSwitch/MSFT_xVMSwitch.schema.mof +++ /dev/null @@ -1,13 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xVMSwitch")] -class MSFT_xVMSwitch : OMI_BaseResource -{ - [Key, Description("Name of the VM Switch")] String Name; - [Key, Description("Type of switch"), ValueMap{"External","Internal","Private"}, Values{"External","Internal","Private"}] String Type; - [Write, Description("Network adapter name(s) for external switch type")] String NetAdapterName[]; - [Write, Description("Specify if the VM host has access to the physical NIC")] Boolean AllowManagementOS; - [Write, Description("Should embedded NIC teaming be used (Windows Server 2016 only)")] Boolean EnableEmbeddedTeaming; - [Write, Description("Type of Bandwidth Reservation Mode to use for the switch"), ValueMap{"Default","Weight","Absolute","None","NA"}, Values{"Default","Weight","Absolute","None","NA"}] String BandwidthReservationMode; - [Write, Description("Whether switch should be present or absent"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Read, Description("Unique ID for the switch")] String Id; - [Read, Description("Description of the network interface")] String NetAdapterInterfaceDescription; -}; diff --git a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMSwitch/en-us/MSFT_xVMSwitch.strings.psd1 b/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMSwitch/en-us/MSFT_xVMSwitch.strings.psd1 deleted file mode 100644 index 2f59fb8c..00000000 --- a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVMSwitch/en-us/MSFT_xVMSwitch.strings.psd1 +++ /dev/null @@ -1,35 +0,0 @@ -ConvertFrom-StringData @' - CheckingSwitchMessage = Checking switch '{0}' NetAdapterInterface and BandwidthReservationMode ... - NetAdapterInterfaceIncorrectMessage = The switch '{0}' NetAdapterInterface is incorrect ... - SwitchIncorrectNetworkAdapters = Switch '{0}' has an incorrect list of network adapters... - BandwidthReservationModeIncorrect = The switch '{0}' BandwidthReservationMode is incorrect ... - EnableEmbeddedTeamingIncorrect = The switch '{0}' EnableEmbeddedTeaming is incorrect ... - RemoveAndReaddSwitchMessage = Removing switch '{0}' and creating with the correct properties ... - SwitchCorrectNetAdapterAndBandwidthMode = Switch '{0}' has right netadapter '{1}' and BandwidthReservationMode '{2}' - CheckAllowManagementOS = Checking switch '{0}' AllowManagementOS ... - AllowManagementOSIncorrect = Switch '{0}' AllowManagementOS property is not correct - AllowManagementOSUpdated = Switch '{0}' AllowManagementOS property is set to '{1}' - AllowManagementOSCorrect = Switch '{0}' AllowManagementOS is correctly set - PresentNotCorrect = Switch '{0}' is not '{1}'. - CreatingSwitch = Creating Switch ...Checking - PresentCorrect = Switch '{0}' is now '{1}'. - PresentChecking = Checking if Switch '{0}' is '{1}' ... - SwitchPresent = Switch '{0}' is Present - SwitchNotPresent = Switch '{0}' is Absent - CheckingBandwidthReservationMode = Checking if Switch '{0}' has correct BandwidthReservationMode ... - BandwidthReservationModeCorrect = Switch '{0}' has correct BandwidthReservationMode or it does not apply to this OS - CheckingNetAdapterInterface = Checking if Switch '{0}' has correct NetAdapterInterface ... - NetAdapterNotFound = Network adapter not found - NetAdapterInterfaceCorrect = Switch '{0}' has correct NetAdapterInterface - CheckingNetAdapterInterfaces = Checking if Switch '{0}' has correct NetAdapterInterfaces ... - IncorrectNetAdapterInterfaces = Switch '{0}' has an incorrect list of network adapters - CorrectNetAdapterInterfaces = Switch '{0}' has a correct list of network adapters - CheckEnableEmbeddedTeaming = Checking if Switch '{0}' has correct EnableEmbeddedTeaming ... - EnableEmbeddedTeamingCorrect = Switch '{0}' has correct EnableEmbeddedTeaming or it does not apply to this OS - - SETServer2016Error = Embedded teaming is only supported on Windows Server 2016 - HyperVNotInstalledError = Please ensure that the Hyper-V role is installed with its PowerShell module - BandwidthReservationModeError = The BandwidthReservationMode cannot be set on a Hyper-V version lower than 2012 - NetAdapterNameRequiredError = For external switch type, NetAdapterName must be specified - NetAdapterNameNotRequiredError = For Internal or Private switch type, NetAdapterName should not be specified -'@ diff --git a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVhdFileDirectory/MSFT_xVhdFileDirectory.psm1 b/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVhdFileDirectory/MSFT_xVhdFileDirectory.psm1 deleted file mode 100644 index 400bee59..00000000 --- a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVhdFileDirectory/MSFT_xVhdFileDirectory.psm1 +++ /dev/null @@ -1,482 +0,0 @@ - -<# -# Get the current configuration of the machine -# This function is called when you do Get-DscConfiguration after the configuration is set. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $VhdPath, - - [parameter(Mandatory = $true)] - [Microsoft.Management.Infrastructure.CimInstance[]] - $FileDirectory, - - [ValidateSet('ModifiedDate','SHA-1','SHA-256','SHA-512')] - [System.String] - $CheckSum = 'ModifiedDate' - ) - - if ( -not (Test-path $VhdPath)) - { - $item = New-CimInstance -ClassName MSFT_FileDirectoryConfiguration -Property @{DestinationPath = $VhdPath; Ensure = "Absent"} -Namespace root/microsoft/windows/desiredstateconfiguration -ClientOnly - - Return @{ - VhdPath = $VhdPath - FileDirectory = $item - } - } - - # Mount VHD. - $mountVHD = EnsureVHDState -Mounted -vhdPath $vhdPath - - $itemsFound = foreach($Item in $FileDirectory) - { - $item = GetItemToCopy -item $item - $mountedDrive = $mountVHD | Get-Disk | Get-Partition | Get-Volume - $letterDrive = (-join $mountedDrive.DriveLetter) + ":\" - - # show the drive letters. - Get-PSDrive | Write-Verbose - - $finalPath = Join-Path $letterDrive $item.DestinationPath - - Write-Verbose "Getting the current value at $finalPath ..." - - if (Test-Path $finalPath) - { - New-CimInstance -ClassName MSFT_FileDirectoryConfiguration -Property @{DestinationPath = $finalPath; Ensure = "Present"} -Namespace root/microsoft/windows/desiredstateconfiguration -ClientOnly - } - else - { - New-CimInstance -ClassName MSFT_FileDirectoryConfiguration -Property @{DestinationPath = $finalPath ; Ensure = "Absent"} -Namespace root/microsoft/windows/desiredstateconfiguration -ClientOnly - } - } - - # Dismount VHD. - EnsureVHDState -Dismounted -vhdPath $VhdPath - - # Return the result. - Return @{ - VhdPath = $VhdPath - FileDirectory = $itemsFound - } -} - - -# This is a resource method that gets called if the Test-TargetResource returns false. -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $VhdPath, - - [parameter(Mandatory = $true)] - [Microsoft.Management.Infrastructure.CimInstance[]] - $FileDirectory, - - [ValidateSet('ModifiedDate','SHA-1','SHA-256','SHA-512')] - [System.String] - $CheckSum = 'ModifiedDate' - ) - - if (-not (Test-Path $VhdPath)) { throw "Specified destination path $VhdPath does not exist!"} - - # mount the VHD. - $mountedVHD = EnsureVHDState -Mounted -vhdPath $VhdPath - - try - { - # show the drive letters. - Get-PSDrive | Write-Verbose - - $mountedDrive = $mountedVHD | Get-Disk | Get-Partition | Get-Volume - - foreach ($item in $FileDirectory) - { - $itemToCopy = GetItemToCopy -item $item - $letterDrive = (-join $mountedDrive.DriveLetter) + ":\" - $finalDestinationPath = $letterDrive - $finalDestinationPath = Join-Path $letterDrive $itemToCopy.DestinationPath - - # if the destination should be removed - if (-not($itemToCopy.Ensure)) - { - if (Test-Path $finalDestinationPath) - { - SetVHDFile -destinationPath $finalDestinationPath -ensure:$false -recurse:($itemToCopy.Recurse) - } - } - else - { - # Copy Scenario - if ($itemToCopy.SourcePath) - { - SetVHDFile -sourcePath $itemToCopy.SourcePath -destinationPath $finalDestinationPath -recurse:($itemToCopy.Recurse) -force:($itemToCopy.Force) - } - elseif ($itemToCopy.Content) - { - "Writing a content to a file" - - # if the type is not specified assume it is a file. - if (-not ($itemToCopy.Type)) - { - $itemToCopy.Type = 'File' - } - - # Create file/folder scenario - SetVHDFile -destinationPath $finalDestinationPath -type $itemToCopy.Type -force:($itemToCopy.Force) -content $itemToCopy.Content - } - - # Set Attribute scenario - if ($itemToCopy.Attributes) - { - SetVHDFile -destinationPath $finalDestinationPath -attribute $itemToCopy.Attributes -force:($itemToCopy.Force) - } - } - - } - } - finally - { - EnsureVHDState -Dismounted -vhdPath $VhdPath - } -} - -# This function returns if the current configuration of the machine is the same as the desired configration for this resource. -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $VhdPath, - - [parameter(Mandatory = $true)] - [Microsoft.Management.Infrastructure.CimInstance[]] - $FileDirectory, - - [ValidateSet('ModifiedDate','SHA-1','SHA-256','SHA-512')] - [System.String] - $CheckSum = 'ModifiedDate' - ) - - # If the VHD path does not exist throw an error and stop. - if ( -not (Test-Path $VhdPath)) - { - throw "VHD does not exist in the specified path $VhdPath" - } - - # mount the vhd. - $mountedVHD = EnsureVHDState -Mounted -vhdPath $VhdPath - - try - { - # Show the drive letters after mount - Get-PSDrive | Write-Verbose - - $mountedDrive = $mountedVHD | Get-Disk | Get-Partition | Get-Volume - $letterDrive = (-join $mountedDrive.DriveLetter) + ":\" - Write-Verbose $letterDrive - - # return test result equal to true unless one of the tests in the loop below fails. - $result = $true - - foreach ($item in $FileDirectory) - { - $itemToCopy = GetItemToCopy -item $item - $destination = $itemToCopy.DestinationPath - Write-Verbose ("Testing the file with relative VHD destination $destination") - $destination = $itemToCopy.DestinationPath - $finalDestinationPath = $letterDrive - $finalDestinationPath = Join-Path $letterDrive $destination - - if (Test-Path $finalDestinationPath) - { - if( -not ($itemToCopy.Ensure)) - { - $result = $false - break; - } - else - { - $itemToCopyIsFile = Test-Path $itemToCopy.SourcePath -PathType Leaf - $destinationIsFolder = Test-Path $finalDestinationPath -PathType Container - - if ($itemToCopyIsFile -and $destinationIsFolder) - { - # Verify if the file exist inside the folder - $fileName = Split-Path $itemToCopy.SourcePath -Leaf - Write-Verbose "Checking if $fileName exist under $finalDestinationPath" - $fileExistInDestination = Test-Path (Join-Path $finalDestinationPath $fileName) - - # Report if the file exist on the destination folder. - Write-Verbose "File exist on the destination under $finalDestinationPath :- $fileExistInDestination" - $result = $fileExistInDestination - $result = $result -and -not(ItemHasChanged -sourcePath $itemToCopy.SourcePath -destinationPath (Join-Path $finalDestinationPath $fileName) -CheckSum $CheckSum) - } - - if (($itemToCopy.Type -eq "Directory") -and ($itemToCopy.Recurse)) - { - $result = $result -and -not(ItemHasChanged -sourcePath $itemToCopy.SourcePath -destinationPath $finalDestinationPath -CheckSum $CheckSum) - - if (-not ($result)) - { - break; - } - } - } - } - else - { - # If Ensure is specified as Present or if Ensure is not specified at all. - if(($itemToCopy.Ensure)) - { - $result = $false - break; - } - } - - # Check the attribute - if ($itemToCopy.Attributes) - { - $currentAttribute = @(Get-ItemProperty -Path $finalDestinationPath |% Attributes) - $result = $currentAttribute.Contains($itemToCopy.Attributes) - } - } - } - finally - { - EnsureVHDState -Dismounted -vhdPath $VhdPath - } - - - Write-Verbose "Test returned $result" - return $result; -} - -# Assert the state of the VHD. -function EnsureVHDState -{ - [CmdletBinding(DefaultParametersetName="Mounted")] - param( - - [parameter(Mandatory=$false,ParameterSetName = "Mounted")] - [switch]$Mounted, - [parameter(Mandatory=$false,ParameterSetName = "Dismounted")] - [switch]$Dismounted, - [parameter(Mandatory=$true)] - $vhdPath - ) - - if ( -not ( Get-Module -ListAvailable Hyper-v)) - { - throw "Hyper-v-Powershell Windows Feature is required to run this resource. Please install Hyper-v feature and try again" - } - if ($PSCmdlet.ParameterSetName -eq 'Mounted') - { - # Try mounting the VHD. - $mountedVHD = Mount-VHD -Path $vhdPath -Passthru -ErrorAction SilentlyContinue -ErrorVariable var - - # If mounting the VHD failed. Dismount the VHD and mount it again. - if ($var) - { - Write-Verbose "Mounting Failed. Attempting to dismount and mount it back" - Dismount-VHD $vhdPath - $mountedVHD = Mount-VHD -Path $vhdPath -Passthru -ErrorAction SilentlyContinue - - return $mountedVHD - } - else - { - return $mountedVHD - } - } - else - { - Dismount-VHD $vhdPath -ea SilentlyContinue - - } -} - -# Change the Cim Instance objects in to a hash table containing property value pair. -function GetItemToCopy -{ - param([Microsoft.Management.Infrastructure.CimInstance] $item) - - $returnValue = @{ - SourcePath = $item.CimInstanceProperties["SourcePath"].Value - DestinationPath = $item.CimInstanceProperties["DestinationPath"].Value - Ensure = $item.CimInstanceProperties["Ensure"].Value - Recurse = $item.CimInstanceProperties["Recurse"].Value - Force = $item.CimInstanceProperties["Force"].Value - Content = $item.CimInstanceProperties["Content"].Value - Attributes = @($item.CimInstanceProperties["Attributes"].Value) - Type = $item.CimInstanceProperties["Type"].Value - } - - # Assign Default values, if they are not specified. - if ($returnValue.Ensure -eq $null) - { - $returnValue.Ensure = "Present" - } - - if ($returnValue.Force -eq $null) - { - $returnValue.Force = "True" - } - - if ($returnValue.Recurse -eq $null) - { - $returnValue.Recurse = "True" - } - if ($returnValue.Type -eq $null) - { - if (Test-Path $returnValue.SourcePath -PathType Leaf ) - { - $returnValue.Type = 'File' - } - else - { - $returnValue.Type = 'Directory' - } - } - - # Convert string "True" or "False" to boolean for ease of programming. - $returnValue.Force = $returnValue.Force -eq "True" - $returnValue.Recurse = $returnValue.Recurse -eq "True" - $returnValue.Ensure = $returnValue.Ensure -eq "Present" - $returnValue.Keys | %{ Write-Verbose "$_ => $($returnValue[$_])"} - - return $returnValue -} - - -# This is the main function that gets called after the file is mounted to perform copy, set or new operations on the mounted drive. -function SetVHDFile -{ - [CmdletBinding(DefaultParametersetName="Copy")] - param( - [parameter(Mandatory=$true,ParameterSetName = "Copy")] - $sourcePath, - [switch]$recurse, - [switch]$force, - [parameter(Mandatory=$false,ParameterSetName = "New")] - $type, - [parameter(Mandatory=$false,ParameterSetName = "New")] - $content, - [parameter(Mandatory=$true)] - $destinationPath, - [parameter(Mandatory=$true,ParameterSetName = "Set")] - $attribute, - [parameter(Mandatory=$true,ParameterSetName = "Delete")] - [switch]$ensure - ) - - Write-Verbose "Setting the VHD file $($PSCmdlet.ParameterSetName)" - if ($PSCmdlet.ParameterSetName -eq 'Copy') - { - New-Item -Path (Split-Path $destinationPath) -ItemType Directory -ErrorAction SilentlyContinue - Copy-Item -Path $sourcePath -Destination $destinationPath -Force:$force -Recurse:$recurse -ErrorAction SilentlyContinue - } - elseif ($PSCmdlet.ParameterSetName -eq 'New') - { - If ($type -eq 'Directory') - { - New-Item -Path $destinationPath -ItemType $type - } - else - { - New-Item -Path $destinationPath -ItemType $type - $content | Out-File $destinationPath - } - - } - elseif ($PSCmdlet.ParameterSetName -eq 'Set') - { - Write-Verbose "Attempting to change the attribute of the file $destinationPath to value $attribute" - Set-ItemProperty -Path $destinationPath -Name Attributes -Value $attribute - } - elseif (!($ensure)) - { - Remove-Item -Path $destinationPath -Force:$force -Recurse:$recurse - } -} - -# Detect if the item to be copied is modified version of the orginal. -function ItemHasChanged -{ - param( - [parameter(Mandatory=$true)] - [ValidateScript({Test-Path $_})] - $sourcePath, - [parameter(Mandatory=$true)] - [ValidateScript({Test-Path $_})] - $destinationPath, - [parameter(Mandatory=$false)] - [ValidateSet('ModifiedDate','SHA-1','SHA-256','SHA-512')] - $CheckSum = 'ModifiedDate' - ) - - $itemIsFolder = Test-Path $sourcePath -Type Container - $sourceItems = $null; - $destinationItems = $null; - - if ($itemIsFolder) - { - $sourceItems = Get-ChildItem "$sourcePath\*.*" -Recurse - $destinationItems = Get-ChildItem "$destinationPath\*.*" -Recurse - - } - else - { - $sourceItems = Get-ChildItem $sourcePath - $destinationItems = Get-ChildItem $destinationPath - - } - - if ( -not ($destinationItems)) - { - return $true; - } - - # Compute the difference using the algorithem specified. - $difference = $null - - switch ($CheckSum) - { - - 'ModifiedDate' - { - $difference = Compare-Object -ReferenceObject $sourceItems -DifferenceObject $destinationItems -Property LastWriteTime - } - 'SHA-1' - { - $difference = Compare-Object -ReferenceObject ($sourceItems | Get-FileHash -Algorithm SHA1) -DifferenceObject ($destinationItems | Get-FileHash -Algorithm SHA1) -Property Hash - } - 'SHA-256' - { - $difference = Compare-Object -ReferenceObject ($sourceItems | Get-FileHash -Algorithm SHA256) -DifferenceObject ($destinationItems | Get-FileHash -Algorithm SHA256) -Property Hash - } - 'SHA-512' - { - $difference = Compare-Object -ReferenceObject ($sourceItems | Get-FileHash -Algorithm SHA512) -DifferenceObject ($destinationItems | Get-FileHash -Algorithm SHA512) -Property Hash - } - } - # If there are object difference between the item at the source and Items at the distenation. - return ($null -ne $difference) - -} - -Export-ModuleMember -Function *-TargetResource - diff --git a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVhdFileDirectory/MSFT_xVhdFileDirectory.schema.mof b/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVhdFileDirectory/MSFT_xVhdFileDirectory.schema.mof deleted file mode 100644 index b221b4b4..00000000 --- a/lib/puppet_x/dsc_resources/xHyper-V/DSCResources/MSFT_xVhdFileDirectory/MSFT_xVhdFileDirectory.schema.mof +++ /dev/null @@ -1,24 +0,0 @@ - -[ClassVersion("1.0.0.0")] -Class MSFT_xFileDirectory -{ - [Required] string DestinationPath; - [Write] string SourcePath; - [Write,ValueMap{"Present", "Absent"},Values{"Present", "Absent"}] string Ensure; - [Write,ValueMap{"File", "Directory"},Values{"File", "Directory"}] string Type; - [Write] boolean Recurse; - [Write] boolean Force ; - [write] string Content; - [Write,ValueMap{"ReadOnly", "Hidden", "System", "Archive"},Values{"ReadOnly", "Hidden", "System", "Archive"}] string Attributes[]; -}; - -[ClassVersion("1.0.0.0"), FriendlyName("xVhdFile")] -class MSFT_xVhdFileDirectory : OMI_BaseResource -{ - [Key, Description("Path to the VHD")] String VhdPath; - [Required, EmbeddedInstance("MSFT_xFileDirectory"), Description("The FileDirectory objects to copy to the VHD")] String FileDirectory[]; - [Write,ValueMap{"ModifiedDate","SHA-1","SHA-256","SHA-512"},Values{"ModifiedDate","SHA-1","SHA-256","SHA-512"}] string CheckSum; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xHyper-V/LICENSE b/lib/puppet_x/dsc_resources/xHyper-V/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xHyper-V/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xHyper-V/Misc/VHDResourceGenerator.ps1 b/lib/puppet_x/dsc_resources/xHyper-V/Misc/VHDResourceGenerator.ps1 deleted file mode 100644 index 1a009581..00000000 --- a/lib/puppet_x/dsc_resources/xHyper-V/Misc/VHDResourceGenerator.ps1 +++ /dev/null @@ -1,13 +0,0 @@ - $name = New-DscResourceProperty -Name Name -Type String -Attribute Key -Description "Name of the VHD File" - $path = New-DscResourceProperty -Name Path -Type String -Attribute Key -Description "Folder where the VHD will be created" - $parentPath = New-DscResourceProperty -Name ParentPath -Type String -Attribute Write -Description "Parent VHD file path, for differencing disk" - $generation = New-DscResourceProperty -Name Generation -Type String -Attribute Write -ValidateSet "Vhd","Vhdx" -Description "Virtual disk format - Vhd or Vhdx" - $ensure = New-DscResourceProperty -Name Ensure -Type String -Attribute Write -ValidateSet "Present","Absent" -Description "Should the VHD be created or deleted" - $MaximumSizeBytes = New-DscResourceProperty -Name MaximumSizeBytes -Type Uint32 -Attribute Write -Description "Maximum size of Vhd to be created" - - $id = New-DscResourceProperty -Name ID -Type String -Attribute Read -Description "Virtual Disk Identifier" - $type = New-DscResourceProperty -Name Type -Type String -Attribute Read -Description "Type of Vhd - Dynamic, Fixed, Differencing" - $FileSizeBytes = New-DscResourceProperty -Name FileSizeBytes -Type Uint32 -Attribute Read -Description "Current size of the VHD" - $IsAttached = New-DscResourceProperty -Name IsAttached -Type Boolean -Attribute Read -Description "Is the VHD attached to a VM or not" - - New-DscResource -Name MSFT_xVHD -Properties $name,$path,$parentPath,$generation,$ensure,$id,$type,$MaximumSizeBytes,$FileSizeBytes,$IsAttached -Path . -ClassVersion 1.0.0 -FriendlyName xVHD diff --git a/lib/puppet_x/dsc_resources/xHyper-V/Misc/VMResourceGenerator.ps1 b/lib/puppet_x/dsc_resources/xHyper-V/Misc/VMResourceGenerator.ps1 deleted file mode 100644 index 41d24510..00000000 --- a/lib/puppet_x/dsc_resources/xHyper-V/Misc/VMResourceGenerator.ps1 +++ /dev/null @@ -1,26 +0,0 @@ - $name = New-xDscResourceProperty -Name Name -Type String -Attribute Key -Description "Name of the VM" - $vhdPath = New-xDscResourceProperty -Name VhdPath -Type String -Attribute Required -Description "VHD associated with the VM" - $switchName = New-xDscResourceProperty -Name SwitchName -Type String -Attribute Write -Description "Virtual switch associated with the VM" - $path = New-xDscResourceProperty -Name Path -Type String -Attribute Write -Description "Folder where the VM data will be stored" - $generation = New-xDscResourceProperty -Name Generation -Type String -Attribute Write -ValidateSet "Vhd","Vhdx" -Description "Associated Virtual disk format - Vhd or Vhdx" - $ensure = New-xDscResourceProperty -Name Ensure -Type String -Attribute Write -ValidateSet "Present","Absent" -Description "Should the VM be created or deleted" - $startupMem = New-xDscResourceProperty -Name StartupMemory -Type Uint64 -Attribute Write -Description "Startup RAM for the VM." - $minMem = New-xDscResourceProperty -Name MinimumMemory -Type Uint64 -Attribute Write -Description "Minimum RAM for the VM. This enables dynamic memory." - $maxMem = New-xDscResourceProperty -Name MaximumMemory -Type Uint64 -Attribute Write -Description "Maximum RAM for the VM. This enable dynamic memory." - $macAddress = New-xDscResourceProperty -Name MACAddress -Type String -Attribute Write -Description "MAC address of the VM." - $waitForIP = New-xDscResourceProperty -Name WaitForIP -Type Boolean -Attribute Write -Description "Waits for VM to get valid IP address." - $state = New-xDscResourceProperty -Name State -Type String -Attribute Write -ValidateSet "Running","Paused","Off" -Description "State of the VM." - $notes = New-xDscResourceProperty -Name Notes -Type String -Attribute Write -Description "Notes about the VM." - $procCount = New-xDscResourceProperty -Name ProcessorCount -Type Uint32 -Attribute Write -Description "Processor count for the VM" - $restartIfNeeded = New-xDscResourceProperty -Name RestartIfNeeded -Type Boolean -Attribute Write -Description "If specified, shutsdown and restarts the VM if needed for resource change" - - $id = New-xDscResourceProperty -Name ID -Type String -Attribute Read -Description "VM unique ID" - $status = New-xDscResourceProperty -Name Status -Type String -Attribute Read -Description "Status of the VM" - $CPUUsage = New-xDscResourceProperty -Name CPUUsage -Type Uint32 -Attribute Read -Description "CPU Usage of the VM" - $memAssigned = New-xDscResourceProperty -Name MemoryAssigned -Type Uint64 -Attribute Read -Description "Memory assigned to the VM" - $uptime = New-xDscResourceProperty -Name Uptime -Type String -Attribute Read -Description "Uptime of the VM" - $creationTime = New-xDscResourceProperty -Name CreationTime -Type DateTime -Attribute Read -Description "Creation time of the VM" - $hasDynamicMemory = New-xDscResourceProperty -Name HasDynamicMemory -Type Boolean -Attribute Read -Description "Does VM has dynamic memory enabled" - $networkAdapters = New-xDscResourceProperty -Name NetworkAdapters -Type String[] -Attribute Read -Description "Network adapters of the VM" - - New-xDscResource -Name MSFT_xVMHyperV -Property @($name,$vhdPath,$switchName,$state,$path,$generation,$startupMem,$minMem,$maxMem,$macAddress,$procCount,$waitForIP,$restartIfNeeded,$ensure, $notes,$id,$status,$CPUUsage,$memAssigned,$uptime,$creationTime,$hasDynamicMemory,$networkAdapters) -Path . -ClassVersion 1.0.0 -FriendlyName xVMHyperV diff --git a/lib/puppet_x/dsc_resources/xHyper-V/Misc/VMSwitchGenerator.ps1 b/lib/puppet_x/dsc_resources/xHyper-V/Misc/VMSwitchGenerator.ps1 deleted file mode 100644 index 4d27ea99..00000000 --- a/lib/puppet_x/dsc_resources/xHyper-V/Misc/VMSwitchGenerator.ps1 +++ /dev/null @@ -1,8 +0,0 @@ - $name = New-DscResourceProperty -Name Name -Type String -Attribute Key -Description "Name of the VM Switch" - $type = New-DscResourceProperty -Name Type -Type String -Attribute Key -ValidateSet "Internal","Private" -Description "Type of switch" - $netAdapter = New-DscResourceProperty -Name NetAdapterName -Type String -Attribute Write -Description "Network adapter name for external switch type" - $allowManagementOS = New-DscResourceProperty -Name AllowManagementOS -Type Boolean -Attribute Write -Description "Specify is the VM host has access to the physical NIC" - $ensure = New-DscResourceProperty -Name Ensure -Type String -Attribute Write -ValidateSet "Present","Absent" -Description "Whether switch should be present or absent" - $id = New-DscResourceProperty -Name Id -Type String -Attribute Read -Description "Unique ID for the switch" - $netDescription = New-DscResourceProperty -Name NetAdapterInterfaceDescription -Type String -Attribute Read -Description "Description of the network interface" - New-DscResource -Name MSFT_xVMSwitch -Path . -Properties $name,$type,$netAdapter,$allowManagementOS,$ensure,$id,$netDescription -ClassVersion 1.0.0.0 -FriendlyName xVMSwitch diff --git a/lib/puppet_x/dsc_resources/xHyper-V/xHyper-V.psd1 b/lib/puppet_x/dsc_resources/xHyper-V/xHyper-V.psd1 deleted file mode 100644 index bb051dcd..00000000 --- a/lib/puppet_x/dsc_resources/xHyper-V/xHyper-V.psd1 +++ /dev/null @@ -1,101 +0,0 @@ -@{ -# Version number of this module. -ModuleVersion = '3.9.0.0' - -# ID used to uniquely identify this module -GUID = 'f5a5f169-7026-4053-932a-19a7c37b1ca5' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2013 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'Module with DSC Resources for Hyper-V area' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Minimum version of the common language runtime (CLR) required by this module -CLRVersion = '4.0' - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/xHyper-V/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/xHyper-V' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - ReleaseNotes = '* MSFT_xVMHyperV: - * Increased xVMHyperV StartupMemory and MinimumMemory limits from 17GB to 64GB. - * EnableGuestService works on localized OS (language independent). - * Adds missing Hyper-V-PowerShell feature in examples. -* Added the following resources: - * MSFT_xVMProcessor to manage virtual machine processor options. - * MSFT_xVMHost to managing Hyper-V host settings. -* MSFT_xVMSwitch: - * Added support for Switch Embedded Teaming (SET) in Server 2016. - * Fixed a bug where Get-TargetResource threw an error if a non External switch - is used. - * Updated unit tests to use template version 1.2.0. - * Style fixes. - * Added support for Localization. -* xHyper-V module: - * Added vs code formatting rule settings. - * Fix Markdown rule violations in Readme.md. - * Added .MetaTestOptIn.json for Markdown common test to be included. - * Added Appveyor badge for Dev branch in Readme.md and moved to Branches section. - * Added missing properties for all resources in Readme.md. - * Added and corrected missing / wrong DataTypes and Dsc attributes in Readme.md. - * Updated Readme to match DscResources style. - * Created change log and linked to it from Readme. - * Removed version info from Readme. - * Updated appveyor.yml to use Appveyor module. - * Examples: - * Removed code from Readme and linked to example files instead. - * Moved code to new example files where there was only code in Readme. - * Codecov: - * Updated appveyor.yml to include codecov. - * Added .codecov.yml. - * Added codecov badges to Readme. -* MSFT_xVHD: - * Support setting the disk type. - * Added unit tests. - * Added example Sample\_xVHD\_FixedVHD.ps1 - * Style fixes - -' - - } # End of PSData hashtable - -} # End of PrivateData hashtable -} - - - - - - - - diff --git a/lib/puppet_x/dsc_resources/xInternetExplorerHomePage/DSCResources/xInternetExplorerHomePage/xInternetExplorerHomePage.psm1 b/lib/puppet_x/dsc_resources/xInternetExplorerHomePage/DSCResources/xInternetExplorerHomePage/xInternetExplorerHomePage.psm1 deleted file mode 100644 index e41fa522..00000000 --- a/lib/puppet_x/dsc_resources/xInternetExplorerHomePage/DSCResources/xInternetExplorerHomePage/xInternetExplorerHomePage.psm1 +++ /dev/null @@ -1,241 +0,0 @@ -#--------------------------------------------------------------------------------- #The sample scripts are not supported under any Microsoft standard support #program or service. The sample scripts are provided AS IS without warranty #of any kind. Microsoft further disclaims all implied warranties including, #without limitation, any implied warranties of merchantability or of fitness for #a particular purpose. The entire risk arising out of the use or performance of #the sample scripts and documentation remains with you. In no event shall #Microsoft, its authors, or anyone else involved in the creation, production, or #delivery of the scripts be liable for any damages whatsoever (including, #without limitation, damages for loss of business profits, business interruption, #loss of business information, or other pecuniary loss) arising out of the use #of or inability to use the sample scripts or documentation, even if Microsoft #has been advised of the possibility of such damages #--------------------------------------------------------------------------------- - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [String] - $StartPage, - - [String] - $SecondaryStartPages - ) - - $IEMainReg = 'HKLM:\Software\Microsoft\Internet Explorer\Main' - - Write-Verbose "Detecting the start page of Internet Explorer." - $StartPageReg = (Get-ItemProperty -Path $IEMainReg).'Start Page' - - Write-Verbose "Detecting the secondary start pages of Internet Explorer." - $SecondaryStartPagesReg = (Get-ItemProperty -Path $IEMainReg).'Secondary Start Pages' - - - $returnValue = @{ - #Verify that the value exists, if it does not exist, the value of output is "NULL". - StartPage = $(If($StartPageReg){$StartPageReg}Else{"NULL"}) - SecondaryStartPages = $(If($SecondaryStartPagesReg){$SecondaryStartPagesReg}Else{"NULL"}) - } - - If($SecondaryStartPages) - { - If($($StartPage -eq $StartPageReg) -and $($SecondaryStartPages -eq $SecondaryStartPagesReg)) - { - $returnValue.Ensure = "Present" - } - Else - { - $returnValue.Ensure = "Absent" - } - } - Else - { - If($StartPage -eq $StartPageReg) - { - $returnValue.Ensure = "Present" - } - Else - { - $returnValue.Ensure = "Absent" - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - [parameter(Mandatory = $true)] - [String] - $StartPage, - - [String] - $SecondaryStartPages, - - [ValidateSet("Present","Absent")] - [String] - $Ensure = 'Present' - ) - - $IEMainReg = 'HKLM:\Software\Microsoft\Internet Explorer\Main' - - Switch($Ensure) - { - #Set the home page of IE - 'Present' - { - If($SecondaryStartPages) - { - If($PSCmdlet.ShouldProcess("Internet Explorer","Set the start page and secondary start page")) - { - Try - { - Write-Verbose "Setting the start page of Internet Explorer." - Set-ItemProperty -Path $IEMainReg -Name "Start Page" -Value "$StartPage" -ErrorAction Stop - - Write-Verbose "Setting the secondary start page of Internete Explorer." - Set-ItemProperty -Path $IEMainReg -Name "Secondary Start Pages" -Value "$SecondaryStartPages" -ErrorAction Stop - } - Catch - { - $ErrorMsg = $_.Exception.Message Write-Verbose $ErrorMsg - } - } - } - Else - { - If($PSCmdlet.ShouldProcess("Internet Explorer","Set the start page")) - { - Try - { - Write-Verbose "Setting the start page of Internet Explorer." - Set-ItemProperty -Path $IEMainReg -Name "Start Page" -Value "$StartPage" -ErrorAction Stop - - } - Catch - { - $ErrorMsg = $_.Exception.Message Write-Verbose $ErrorMsg - } - } - } - } - - #Remove the home page of IE - 'Absent' - { - If($SecondaryStartPages) - { - If($PSCmdlet.ShouldProcess("Internet Explorer","Remove the start page and secondary start page")) - { - Try - { - Write-Verbose "Removing the start page of Internete Explorer." - Set-ItemProperty -Path $IEMainReg -Name "Start Page" -Value "" -ErrorAction Stop - - Write-Verbose "Removing the secondary start page of Internete Explorer." - Set-ItemProperty -Path $IEMainReg -Name "Secondary Start pages" -Value "" -ErrorAction Stop - } - Catch - { - $ErrorMsg = $_.Exception.Message Write-Verbose $ErrorMsg - } - } - } - Else - { - If($PSCmdlet.ShouldProcess("Internet Explorer","Remove the start page")) - { - Try - { - Write-Verbose "Removing the start page of Internete Explorer." - Set-ItemProperty -Path $IEMainReg -Name "Start Page" -Value "" -ErrorAction Stop - } - Catch - { - $ErrorMsg = $_.Exception.Message Write-Verbose $ErrorMsg - } - } - } - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([Boolean])] - param - ( - [parameter(Mandatory = $true)] - [String] - $StartPage, - - [String] - $SecondaryStartPages, - - [ValidateSet("Present","Absent")] - [String] - $Ensure = 'Present' - ) - - - #Output the result of Get-TargetResource function. - $Get = Get-TargetResource -StartPage $StartPage -SecondaryStartPages $SecondaryStartPages - - Switch($Ensure) - { - 'Present' - { - If($SecondaryStartPages) - { - If($StartPage -eq $Get.StartPage -and $SecondaryStartPages -eq $Get.SecondaryStartPages) - { - return $true - } - Else - { - return $false - } - } - Else - { - If($StartPage -eq $Get.StartPage -and $SecondaryStartPages -eq $Get.SecondaryStartPages) - { - return $true - } - Else - { - return $false - } - } - } - - 'Absent' - { - If($SecondaryStartPages) - { - If($Get.StartPage -eq "NULL" -and $Get.SecondaryStartPages -eq "NULL") - { - return $true - } - Else - { - return $false - } - } - Else - { - If($Get.StartPage -eq "NULL") - { - return $true - } - Else - { - return $false - } - } - } - } -} - -Export-ModuleMember -Function *-TargetResource - - - diff --git a/lib/puppet_x/dsc_resources/xInternetExplorerHomePage/DSCResources/xInternetExplorerHomePage/xInternetExplorerHomePage.schema.mof b/lib/puppet_x/dsc_resources/xInternetExplorerHomePage/DSCResources/xInternetExplorerHomePage/xInternetExplorerHomePage.schema.mof deleted file mode 100644 index b150e594..00000000 --- a/lib/puppet_x/dsc_resources/xInternetExplorerHomePage/DSCResources/xInternetExplorerHomePage/xInternetExplorerHomePage.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xInternetExplorerHomePage")] -class xInternetExplorerHomePage : OMI_BaseResource -{ - [Key, Description("Specifies the URL for the home page of Internet Explorer.")] String StartPage; - [Write, Description("Specifies the URL for the secondary home pages of Internet Explorer.")] String SecondaryStartPages; - [Write, Description("Should the IE home page is configured or unconfigured."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xInternetExplorerHomePage/LICENSE b/lib/puppet_x/dsc_resources/xInternetExplorerHomePage/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xInternetExplorerHomePage/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xInternetExplorerHomePage/xInternetExplorerHomePage.psd1 b/lib/puppet_x/dsc_resources/xInternetExplorerHomePage/xInternetExplorerHomePage.psd1 deleted file mode 100644 index b9bb8243..00000000 --- a/lib/puppet_x/dsc_resources/xInternetExplorerHomePage/xInternetExplorerHomePage.psd1 +++ /dev/null @@ -1,37 +0,0 @@ -@{ - -# Version number of this module. -ModuleVersion = '1.0.0' - -# ID used to uniquely identify this module -GUID = 'b7261a23-14b6-4524-b194-04513563e920' - -# Author of this module -Author = 'OneScript Team' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'This DSC Resources can easily set an URL for the home page of Internet Explorer' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Functions to export from this module -FunctionsToExport = 'Get-TargetResource', 'Test-TargetResource', 'Set-TargetResource' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Variables to export from this module -VariablesToExport = '*' - -# Aliases to export from this module -AliasesToExport = '*' - -} - diff --git a/lib/puppet_x/dsc_resources/xJea/DSCResources/Library/Helper.psm1 b/lib/puppet_x/dsc_resources/xJea/DSCResources/Library/Helper.psm1 deleted file mode 100644 index b9914216..00000000 --- a/lib/puppet_x/dsc_resources/xJea/DSCResources/Library/Helper.psm1 +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright © 2014, Microsoft Corporation. All rights reserved. -# Internal function to throw terminating error with specified errorCategory, errorId and errorMessage -function New-TerminatingError -{ - param - ( - [Parameter(Mandatory)] - [String]$errorId, - - [Parameter(Mandatory)] - [String]$errorMessage, - - [Parameter(Mandatory)] - [System.Management.Automation.ErrorCategory]$errorCategory - ) - - $exception = New-Object System.InvalidOperationException $errorMessage - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - throw $errorRecord -} - - diff --git a/lib/puppet_x/dsc_resources/xJea/DSCResources/Library/JeaAccount.psm1 b/lib/puppet_x/dsc_resources/xJea/DSCResources/Library/JeaAccount.psm1 deleted file mode 100644 index 81920cd6..00000000 --- a/lib/puppet_x/dsc_resources/xJea/DSCResources/Library/JeaAccount.psm1 +++ /dev/null @@ -1,330 +0,0 @@ -# Copyright © 2014, Microsoft Corporation. All rights reserved. -Import-Module $PSScriptRoot\..\Library\Helper.psm1 -Import-Module $PSScriptRoot\..\Library\JeaDir.psm1 - -<# -.Synopsis - Creates a random password. -.DESCRIPTION - Creates a random password by generating a array of characters and passing it to Get-Random -.EXAMPLE -PS> New-RandomPassword -g0dIDojsRGcV -.EXAMPLE -PS> New-RandomPassword -Length 3 -dyN -.EXAMPLE -PS> New-RandomPassword -Length 30 -UseSpecialCharacters -r5Lhs1K9n*joZl$u^NDO&TkWvPCf2c -#> -function New-RandomPassword -{ - [CmdletBinding()] - [OutputType([String])] - Param - ( - # Length of the password - [Parameter(Mandatory=$False, Position=0)] - [ValidateRange(12, 127)] - $Length=12, - - # Includes the characters !@#$%^&*-+ in the password - [switch]$UseSpecialCharacters - ) - - [char[]]$allowedCharacters = ([Char]'a'..[char]'z') + ([char]'A'..[char]'Z') + ([byte][char]'0'..[byte][char]'9') - if ($UseSpecialCharacters) - { - foreach ($c in '!','@','#','$','%','^','&','*','-','+') - { - $allowedCharacters += [char]$c - } - } - - $characters = 1..$Length | % { - $characterIndex = Get-Random -Minimum 0 -Maximum $allowedCharacters.Count - $allowedCharacters[$characterIndex] - } - - return (-join $characters) -} - -Set-Alias New-RandomString New-RandomPassword - -<# -.Synopsis - Create a User Account with a random name -.DESCRIPTION - -.EXAMPLE - Example of how to use this cmdlet -.EXAMPLE - Another example of how to use this cmdlet -#> -function New-JeaSessionAccount -{ - [CmdletBinding(DefaultParameterSetName='UserNamePrefix')] - Param - ( - #******************************************************************************** - # A random username is generated. This parameter gives you the opportunity to - # to prefix that name with a string to help identify the account - [Parameter(Mandatory=$false, ParameterSetName='UserNamePrefix')] - [ValidateLength(0,12)] - $UserNamePrefix = 'JSA-', - - [Parameter(Mandatory=$true, ParameterSetName='UserName')] - $UserName, - - [string] - $ComputerName = $Env:COMPUTERNAME, - - [string] - $Description = "JEA Service Account created by $($env:UserDomain + '\' + $ENV:Username) at $(Get-Date)", - - [string[]] - $Group='Administrators' - ) - - if (!($PSCmdlet.ParameterSetName -eq 'UserName')) - { - $MaxWindowsUserLength = 20 - $Templength = $MaxWindowsUserLength - $UserNamePrefix.Length - $UserName = $UserNamePrefix + (New-RandomString -Length $TempLength) - } - - $Computer = [ADSI]"WinNT://$COMPUTERNAME,Computer" - - Write-Verbose "New [JeaSessionAccount]$UserName" - $User = $Computer.Create('User', $UserName) - $password = New-RandomPassword -Length 127 -UseSpecialCharacters - $cred = new-object pscredential $username, (convertto-securestring $password -asplaintext -force) - - $null = $( - $User.SetPassword($password) - $User.SetInfo() - $User.FullName = 'Jea Session Account' - $User.SetInfo() - $User.Description = $Description - $User.SetInfo() - $User.UserFlags = 64 # ADS_UF_PASSWD_CANT_CHANGE http://msdn.microsoft.com/en-us/library/aa772300(v=vs.85).aspx - $User.SetInfo() - ) - - foreach ($item in $group) - { - Write-Verbose " [JeaSessionAccount]$UserName ADD [Group]$item" - $gobj = [ADSI]"WinNT://$COMPUTERNAME/$item,group" - $null = $gobj.add("WinNT://$ComputerName/$UserName") - } - return $cred -} - -function Remove-JeaAccount -{ - Param - ( - - [Parameter(Mandatory=$true)] - $UserName, - - [string] - $ComputerName = $Env:COMPUTERNAME - ) - - $Computer = [ADSI]"WinNT://$COMPUTERNAME,Computer" - $computer.delete('user',$userName) -} - - -function Test-JeaSessionAccount -{ - [CmdletBinding()] - [OutputType([Boolean])] - Param - ( - [Parameter(Mandatory=$true, Position=0)] - $UserName, - - $ComputerName = $Env:COMPUTERNAME - - ) - - $oldDebugPrefernce = $DebugPreference; $oldVerbosePreference = $VerbosePreference - $DebugPreference = $VerbosePreference = 'SilentlyContinue' - $user = Get-CimInstance -Query "select * from Win32_UserAccount Where Name=""$UserName"" AND LocalAccount=""TRUE""" -ComputerName $ComputerName -Verbose:0 - $DebugPreference = $oldDebugPrefernce; $VerbosePreference = $oldVerbosePreference - return [Boolean]$user -} - - -function Reset-JeaSessionAccountPassword -{ - [CmdletBinding()] - Param - ( - #******************************************************************************** - # A random username is generated. This parameter gives you the opportunity to - # to prefix that name with a string to help identify the account - [Parameter(Mandatory=$true, Position=0)] - $UserName, - - $ComputerName = $Env:COMPUTERNAME - - ) - - $user = [ADSI]"WinNT://$computerName/$username,user" - $password = New-RandomPassword -Length 127 -UseSpecialCharacters - $null = $user.setpassword($password) - $null = $user.SetInfo() - $cred = new-object pscredential $username, (convertto-securestring $password -asplaintext -force) - return $cred -} - -function Assert-JeaAdminAccount -{ - $cred = $null - if (!(Test-JeaSessionAccount -UserName JeaSchTaskAccount)) - { - Write-Verbose 'New [JeaScheduledTaskAccount]' - $cred = New-JeaSessionAccount -UserName JeaSchTaskAccount -Group Administrators -Description "This is a special Jea account to run the ResetJeaSessionAccountPasswords Scheduled task" - } - Assert-ScheduledScripts - Assert-ScheduledTasks $cred -} - -$ResetScript = @' - #This resets the passwords for all the RUnas - [char[]]$pwChars = ([Char]'a'..[char]'z') + ([char]'A'..[char]'Z') + ([byte][char]'0'..[byte][char]'9') - foreach ($c in '!','@','#','$','%','^','&','*','-','+') - { - $pwChars += [char]$c - } - - $endpoint = Get-PSSessionConfiguration |where {$_.RunAsUser -like 'JSA-*'} - if ($endpoint) - { - foreach ($ep in $endpoint) - { - $user = [ADSI]"WinNT://$($env:computerName)/$($ep.RunAsUser),user" - $password = (( $pwChars |Get-Random -Count 127 | % {[char]$_}) -join '') - $null = $user.setpassword($password) - $null = $user.SetInfo() - $cred = new-object pscredential ($ep.RunAsUser), (convertto-securestring $password -asplaintext -force) - Set-PSSessionConfiguration -Name $($ep.Name) -RunAsCredential $cred -Force - } - Restart-Service Winrm -Force - } -'@ - -$RestartWinRM = @' -#requires -Version 5 -<# -If you restart the WinRM service while DSC is running, it puts WinRM in a bad state -so this script waits for DSC to finish it's work and then restarts WinRM -#> -if ((Get-DscLocalConfigurationManager).LocalConfigurationManagerState) -{ $property = "LocalConfigurationManagerState" -}else -{ $property = "LCMState" -} -While ((Get-DscLocalConfigurationManager).$property -ne 'Ready') -{ - Start-Sleep -Seconds 2 -} -start-sleep -seconds 20 -Restart-Service winrm -Force -'@ - -function Assert-ScheduledScripts -{ - $UtilDir = Get-JeaUtilDir - if (!(Test-Path $UtilDir)) - { - Write-Verbose "New [JeaDirectory]$utildir" - mkdir -Force -Path $UtilDir - } - - $ResetPS1 = Join-Path $UtilDir 'ScheduledPasswordReset.ps1' - if (!(Test-Path $ResetPs1) -or - (cat $resetPS1 -Delimiter "None") -ne $resetscript) - { - Write-Verbose 'Reset [JeaScheduledPasswordResetScript]' - $resetScript > $ResetPS1 - } - - $RestartWinRMPS1 = Join-Path $UtilDir 'RestartWinrm.ps1' - if (!(Test-Path $restartWinRMPS1) -or - (Get-Content $restartWinRMPS1 -Delimiter 'None') -ne $RestartWinRM) - { - Write-Verbose 'Reset [JeaScheduledPasswordreStartWinRMScript]' - $RestartWinRM > $restartWinRMPS1 - } -} - -function Assert-ScheduledTasks -{ -param( -[Parameter()] -$cred -) - - $UtilDir = Get-JeaUtilDir - $wd = "`"$UtilDir`"" - $ResetPS1 = Join-Path $UtilDir 'ScheduledPasswordReset.ps1' - $file = "`"$ResetPS1`"" - $cmdPath = (get-command Powershell.exe).Source - $Arguments = "-nologo -executionPolicy ByPass -NoProfile -NonInteractive -file $file -WorkingDirectory $wd -WindowStyle hidden" - $s = Get-ScheduledTask -TaskPath \Microsoft\Windows\Jea\ -TaskName ResetJeaSessionAccountPasswords -ErrorAction SilentlyContinue - Write-Verbose "Test [JEAScheduledTask]ResetJeaSessionAccountPasswords $([Bool]$s)" - if (!($s) -or - $s.Actions.Count -ne 1 -or - $s.Actions[0].Execute -ne $cmdPath -or - $s.Actions[0].Arguments -ne $Arguments) - { - if ($s) {Unregister-ScheduledTask -TaskPath \Microsoft\Windows\Jea\ -TaskName ResetJeaSessionAccountPasswords -ErrorAction SilentlyContinue } - $action = New-ScheduledTaskAction -Execute $cmdPath -Argument $arguments - $trigger = New-ScheduledTaskTrigger -Daily -At 1:00 - if (!$Cred) - { - Write-Verbose 'Register [JEAScheduledTask]ResetJeaSessionAccountPasswords' - $cred = Reset-JeaSessionAccountPassword -UserName JeaSchTaskAccount - } - $setting = New-ScheduledTaskSettingsSet -MultipleInstances IgnoreNew -StartWhenAvailable - Write-Verbose 'Register [JEAScheduledTask]ResetJeaSessionAccountPasswords' - Register-ScheduledTask -TaskName ResetJeaSessionAccountPasswords -Action $action ` - -TaskPath \Microsoft\Windows\Jea\ -Description 'Reset Jea Session Account Passwords' ` - -Settings $setting ` - -Trigger $trigger ` - -User $cred.UserName -Password $cred.GetNetworkCredential().Password - - } - - - $RestartWinRMPS1 = Join-Path $UtilDir 'RestartWinrm.ps1' - $file = "`"$RestartWinrmPS1`"" - $Arguments = "-nologo -executionPolicy ByPass -NoProfile -NonInteractive -file $file -WorkingDirectory $wd -WindowStyle hidden" - $s = Get-ScheduledTask -TaskPath \Microsoft\Windows\Jea\ -TaskName RestartWinRM -ErrorAction SilentlyContinue - Write-Verbose "Test [JEAScheduledTask]RestartWinRM $([Bool]$s)" - if (!($s) -or - $s.Actions.Count -ne 1 -or - $s.Actions[0].Execute -ne $cmdPath -or - $s.Actions[0].Arguments -ne $Arguments) - { - if ($s) {Unregister-ScheduledTask -TaskPath \Microsoft\Windows\Jea\ -TaskName RestartWinRM -ErrorAction SilentlyContinue } - $action = New-ScheduledTaskAction -Execute $cmdPath -Argument $arguments - if (!$Cred) - { - Write-Verbose 'Register [JEAScheduledTask]JeaSchTaskAccount' - $cred = Reset-JeaSessionAccountPassword -UserName JeaSchTaskAccount - } - $settings = New-ScheduledTaskSettingsSet -MultipleInstances IgnoreNew - Write-Verbose 'Register [JEAScheduledTask]RestartWinRM' - Register-ScheduledTask -TaskName RestartWinRM -Action $action ` - -TaskPath \Microsoft\Windows\Jea\ -Description 'Restart WinRM after current DSC cycle is complete' ` - -Settings $settings ` - -User $cred.UserName -Password $cred.GetNetworkCredential().Password - - } -} - diff --git a/lib/puppet_x/dsc_resources/xJea/DSCResources/Library/JeaDir.psm1 b/lib/puppet_x/dsc_resources/xJea/DSCResources/Library/JeaDir.psm1 deleted file mode 100644 index e2b2f988..00000000 --- a/lib/puppet_x/dsc_resources/xJea/DSCResources/Library/JeaDir.psm1 +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright © 2014, Microsoft Corporation. All rights reserved. - -function Get-JeaDir { Join-Path $env:ProgramFiles 'Jea' } -function Get-JeaToolKitDir { Join-Path (Get-JeaDir) 'Toolkit'} -function Get-JeaUtilDir { Join-Path (Get-JeaDir) 'Util'} -function Get-JeaStartupScriptDir { Join-Path (Get-JeaDir) 'StartupScript'} -function Get-JeaActivityDir { Join-Path (Get-JeaDir) 'Activity'} -function Get-JeaMotdDir { Join-Path (Get-JeaDir) 'Motd'} -function Assert-JeaDirectory -{ - $ToolkitDir = Get-JeaToolKitDir - $UtilDir = Get-JeaUtilDir - $StartupScriptDir = Get-JeaStartupScriptDir - $ActivityDir = Get-JeaActivityDir - $MotdDir = Get-JeaMotdDir - foreach ($dir in $ToolKitDir, $UtilDir, $StartupScriptDir, $ActivityDir, $MotdDir) - { - if (!(Test-Path $Dir)) - { - Write-Verbose -Message "New [JeaDirectory]$Dir" - mkdir $Dir -Force - } - } - $SafeProxyfile = Join-path $UtilDir 'SafeProxy.psm1' - if (!(test-path $SafeProxyfile)) - { - $sourcePS1 = Resolve-Path (Join-Path $PSScriptRoot '..\..\Util\SafeProxy.psm1') - Copy-Item $sourcePS1 -Destination $SafeProxyfile -Verbose - } - $initfile = Join-path $UtilDir 'Initialize-Toolkit.ps1' - if (!(test-path $initfile)) - { - $sourcePS1 = Resolve-Path (Join-Path $PSScriptRoot '..\..\Util\Initialize-ToolKit.ps1') - Copy-Item $sourcePS1 -Destination $initfile -Verbose - } -} - - - diff --git a/lib/puppet_x/dsc_resources/xJea/DSCResources/Library/JeaInitFile.psm1 b/lib/puppet_x/dsc_resources/xJea/DSCResources/Library/JeaInitFile.psm1 deleted file mode 100644 index b610ad1d..00000000 --- a/lib/puppet_x/dsc_resources/xJea/DSCResources/Library/JeaInitFile.psm1 +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright © 2014, Microsoft Corporation. All rights reserved. -function New-InitializationFile -{ - [CmdletBinding()] - [Alias()] - [OutputType([int])] - Param - ( - [Parameter(Mandatory=$true, - Position=0)] - $Path, - - [Parameter(Position=1)] - $Toolkit - ) -Write-Verbose "New [InitializationFile]$path" -''> $path -$toolkitNames = @() -foreach ($t in $toolkit) -{ - $toolkitNames += ("$t" +'-Toolkit') -} - -@" -<# -This is a auto-generated JEA startup file -Generated At: $(Get-date) -Generated On: $(hostname) -Generated By: $($env:UserDomain + '\' + $env:UserName) -#> -function whoami {`$PSSenderInfo} - -`$Init = (Join-Path `$env:ProgramFiles 'Jea\Util\Initialize-Toolkit.ps1') -. `$Init -toolkit $($Toolkitnames -join ',') - -"@ > $path - -} - diff --git a/lib/puppet_x/dsc_resources/xJea/DSCResources/Library/JeaProxy.psm1 b/lib/puppet_x/dsc_resources/xJea/DSCResources/Library/JeaProxy.psm1 deleted file mode 100644 index c88b7ed8..00000000 --- a/lib/puppet_x/dsc_resources/xJea/DSCResources/Library/JeaProxy.psm1 +++ /dev/null @@ -1,429 +0,0 @@ -# Copyright © 2014, Microsoft Corporation. All rights reserved. -Import-Module $PSScriptRoot\..\Library\Helper.psm1 -Import-Module $PSScriptRoot\..\Library\JeaDir.psm1 - -Add-Type @' - namespace Jea - { - using System.Collections; - using System.Collections.Generic; - using System.Globalization; - public class Parameter - { - public string ValidatePattern; - public string ValidateSet; - public string ParameterType; - public string Mandatory; - } - public class Proxy - { - public string Module; - public string Name; - public Hashtable Parameter; - public Proxy() - { - Parameter = new Hashtable(System.StringComparer.InvariantCultureIgnoreCase); - } - } - } -'@ - - - - -function ConvertTo-CSpec -{ - [CmdletBinding()] - Param - ( - [Parameter(Mandatory=$true, - ValueFromPipeline=$true, - Position=0)] - $In - ) - - Begin - { - } - Process - { - if ($In.Module -or $In.Name) - { - new-object psobject -Property @{ - Module = $(if ($In.Module ) {$In.module.Trim() }) - Name = $(if ($In.Name ) {$In.Name.Trim() }else {'*'}) - Parameter = $(if ($In.Parameter ) {$In.Parameter.Trim() }else {'*'}) - ValidateSet = $(if ($In.ValidateSet ) {$In.ValidateSet.Trim() }) - ValidatePattern = $(if ($In.ValidatePattern) {$In.ValidatePattern.Trim()}) - ParameterType = $(if ($In.ParameterType ) {$In.ParameterType.Trim() }) - Mandatory = $In.Mandatory - } - } - } - End - { - } -} - -function Get-JeaProxy -{ -param( - [Parameter(Mandatory=$true,Position=0)] - [ValidateNotNull()] - $Name, - [Parameter(Mandatory=$true,Position=1)] - [ValidateNotNull()] - $Parameter -) - #Names may specify specific commands or have wildcards to specify sets of commands - if (!$CommandsToGenerate.$Name -and $Parameter) - { - $CommandsToGenerate.$Name = New-Object Jea.Proxy - } - return $CommandsToGenerate.$Name -} - -function Add-ParametersToProxy -{ -param( - [Parameter(Mandatory=$true,Position=0)] - [ValidateNotNull()] - $Proxy, - [Parameter(Mandatory=$true,Position=1)] - [ValidateNotNull()] - $CSpec, - [Parameter(Mandatory=$true,Position=2)] - [ValidateNotNull()] - $CmdInfo -) - - if ($CSpec.Parameter -eq '*') - { - foreach ($ParameterName in $CmdInfo.Parameters.Keys) - { - $p = $proxy.parameter.($ParameterName) - if (!$p) - { - $p = new-object Jea.Parameter - $proxy.parameter.Add($ParameterName, $p) - } - } - } - else - { - $p = $proxy.parameter.$($CSpec.Parameter) - if (!$p) - { - $p = new-object Jea.Parameter - $proxy.parameter.Add($CSpec.Parameter.ToLower(), $p) - } - if ($CSpec.ValidateSet) - { - $p.ValidateSet =$CSpec.ValidateSet.Tolower() - } - if ($CSpec.ValidatePattern) - { - $p.ValidatePattern = $CSpec.ValidatePattern - } - if ($CSpec.ParameterType) - { - $p.ParameterType = $CSpec.ParameterType - } - if ($CSpec.Mandatory) - { - $p.Mandatory = $CSpec.Mandatory - } - } -} - -function ConvertTo-CommandsToGenerate -{ -param( - [Parameter(Mandatory=$true, - ValueFromPipeline=$true, - Position=0)] - [ValidateNotNull()] - $CSpec -) - Begin - { - $CommandsToGenerate = @{} - } - Process - { - $module = $CSpec.Module - if ($module -match "\.dll$") - { - $module = ((split-path $module -Leaf) -split '.dll')[0] - } - foreach ($CmdInfo in Get-Command -Module $Module -Name $CSpec.Name -CommandType Function,Cmdlet) - { - $proxy = Get-JeaProxy -Name $CmdInfo.Name -Parameter $CSpec.Parameter - Add-ParametersToProxy -Proxy $proxy -CSpec $CSpec -CmdInfo $cmdInfo - } - } - End - { - return $CommandsToGenerate - } -} -function New-ToolKitPremable -{ - param - ( - [Parameter(Mandatory)] - [String]$Name, - - [String] - $CommandSpecs, - - [System.String[]] - $Applications - ) - # Now we generate the File -@" -<# -This is a auto-generated module containing proxy cmdlets. -Generated At: $(Get-date) -Generated On: $(hostname) -Generated By: $($env:UserDomain + '\' + $env:UserName) - -#region OrginalCSVFile -******************** START Original Source file *********************** -$CommandSpecs -******************** END Original Source file *********************** -#endRegion - -#> - -$( - $list = @() - foreach ($a in $Applications) - { - $list += """$a""" - } - if ($list.count) - { -'$ExportedApplications = ' + ($list -join ',') - } - ) -"@ -} - -# Some of these are dangerous and other get in the way of the runspace working -$forbiddenProxy = @( - 'Exit-Pssession','Format-Table','Format-List','Format-Custom','Format-Wide', - 'Get-Command','Get-Help','Get-Formatdata','Get-Member','Group-Object', - 'Import-Module','Measure-Object','New-Object','Out-Default','Select-Object', - 'TabExpansion2','Where-Object','Write-Debug','Write-Error','Write-Host', - 'Write-Output','Write-Verbose','Write-Warning' -) - -function ConvertTo-ProxyFunctions -{ - [CmdletBinding()] - Param - ( - # Param1 help description - [Parameter(Mandatory=$true, - ValueFromPipeline=$true, - Position=0)] - $CmdName - - ) - - Begin - { - # Proxy Modules are typically going to be used in constrained runspaces where best - # practice will be to turn of ModuleAutoloading so the proxy needs to load whatever - # modules it will proxy - $modulesToImport = @{'Microsoft.PowerShell.Core'=1 } - $exportCmdlet = @() - } - Process - { - $Cmd = Get-Command -Name $CmdName -CommandType Cmdlet,Function -ErrorAction Stop - if (!$cmd) - { - Throw "No such Object [$CmdName :$CommandType]" - } - <# - TODO: Need to do some flavor of analsys of MANDATORY PARAMETERS in SETs - #> - foreach ($c in $cmd |where {$_.Name -notIn $forbiddenProxy}) - { - if ($c.Module) {import-module -Name $c.module -ErrorAction Ignore -Verbose:0} - if ($c.CommandType -eq 'function') - { - rename-item function:$($c.Name) $($c.Name + '-Original') - $c = Get-command -name ($cmdName + '-Original') -CommandType Function -ErrorAction Stop - } - $Parameter = $CommandsToGenerate.$CmdName.Parameter.Keys - $MetaData = New-Object System.Management.Automation.CommandMetaData $c - $metaData.Name = $CmdName - - foreach ($p in @($MetaData.Parameters.Keys)) - { - $p = $p.Tolower() - if ($p -notin $Parameter) - { - $null = $MetaData.Parameters.Remove($p) - } - else - { - $v = $CommandsToGenerate.$CmdName.Parameter.$p.ValidateSet - if ($v) - { - $MetaData.Parameters.$p.attributes.Add( $(New-Object System.Management.Automation.ValidateSetAttribute $($v -split ';'))) - } - $v = $CommandsToGenerate.$CmdName.Parameter.$p.ValidatePattern - if ($v) - { - $MetaData.Parameters.$p.attributes.Add( $(New-Object System.Management.Automation.ValidatePatternAttribute $v)) - } - $v = $CommandsToGenerate.$CmdName.Parameter.$p.ParameterType - if ($v) - { - $type = [System.AppDomain]::CurrentDomain.GetAssemblies().GetTypes() | where {$_.fullname -match $ParameterType} - if ($type) - { - $MetaData.Parameters.$p.ParameterType = $type[0].FullName - } - } - $v = $CommandsToGenerate.$CmdName.Parameter.$p.Mandatory - if ($v) - { - foreach($ps in $MetaData.Parameters.$p.Parametersets.Keys) - { - $MetaData.Parameters.$p.Parametersets.$PS.IsMandatory=$true - } - } - }#end - }#foreach - - if ($c.Module) - { - $RealModule = $c.module - if (!$modulesToImport.$RealModule) - { - $modulesToImport.$RealModule = 'Already imported' -@" -Import-Module $($RealModule) -Scope Global -"@ - } - - } -@" - -#region $cmdname -$( -if ($c.CommandType -eq 'function') -{ -"rename-item function:$cmdName $($cmdName+ '-Original')" -} -) -function $cmdName -{ -"@ - [System.Management.Automation.ProxyCommand]::create($MetaData) - -@" -} # $cmdName -#endregion - - -"@ - $exportCmdlet += $CmdName - - } #foreach $cmd - - } - End - { -@" -Export-ModuleMember -Function $(($exportCmdlet | sort -Unique) -join ',') -#EOF -"@ - - } -} - -function Test-Schema -{ -param( - [Parameter(Mandatory)] - $CSVs -) - $allowed = 'Module','Name','Parameter','ValidateSet','ValidatePattern','ParameterType','Mandatory' - $mismatch = $CSVs |Get-Member -MemberType Properties | where Name -notIn $Allowed - if ($mismatch) - { - $errorMsg = "Incorrect CommandSpec schema: $($Mismatch.Name -join ',')" - Write-Verbose $errorMsg - throw $errorMsg - } -} -<# -.Synopsis - Use a CSV-formated string to drive creation of a JeaProxy module -.DESCRIPTION - JeaProxy modules provide fine grain control over what a user can invoke. - It accomplishes this by manipulating the command parsing information and - generating a proxy function. This process is driven off a CommandSpecs which - is a CSV formated string using the schema: - Module,Name,Parameter,ValidateSet,ValidatePattern,ParameterType - - If only a name is specified, the cmdlet is surfaced in whole - If a Name and a parameter are specified, then only those parameters will be - surfaced for that cmdlet. Since it is a CSV format, only one parameter - can be specified on a line so we need to process all the lines and - consolidate the information before we create the proxies. - If a Name, a parameter and a Validate is specified, we add a VALIDATESET - attribute with the values of the Validate field. - The values need to be seperated with a ';'. - - Applications can also be specified. Applications are non-PowerShell - native executables (e.g. Ping.exe or IPconfig.exe) -.EXAMPLE - Export-JeaProxy -Name GeneralAdmin -Applications "ping.exe","ipconfig.exe" -CommandSpecs @` -Module,Name,Parameter,ValidateSet,ValidatePattern,ParameterType -,Get-Process -,Stop-Process,Name,calc;notepad -,get-service -,Stop-Service,Name,,^SQL -`@ -.OUTPUTS - Two files are created in the ($env:ProgramFiles)\Jea\Toolkit directory - 1) $Name-Toolkit.psm1 # The proxy module - 2) $Name-CommandSpecs.csv # For diagnostics -.NOTES - General notes -#> -function Export-JeaProxy -{ - param - ( - [Parameter(Mandatory)] - [String]$Name, - - [String] - $CommandSpecs, - - [System.String[]] - $Applications - ) - - $CommandSpecs > (Join-Path (Get-JeaToolKitDir) "$($Name)-CommandSpecs.csv") - Write-Verbose "New [JeaDirectory.CSV]$($Name)-CommandSpecs.csv" - - $CSVs = $CommandsToGenerate = $CommandSpecs.ToLower() | ConvertFrom-Csv - Test-Schema $CSVs - $CommandsToGenerate = $CSVs | ConvertTo-CSPec | ConvertTo-CommandsToGenerate - - $toolkit = (Join-Path (Get-JeaToolKitDir) "$($Name)-ToolKit.psm1") - New-ToolKitPremable @PSBoundParameters > $toolkit - $CommandsToGenerate.Keys |Sort {($_ -split '-')[1]},{($_ -split '-')[0]} | ConvertTo-ProxyFunctions >> $toolkit - Write-Verbose "New [JeaDirectory.Module]$toolkit" - -} #Export-JeaProxy - diff --git a/lib/puppet_x/dsc_resources/xJea/DSCResources/MSFT_xJeaEndpoint/MSFT_xJeaEndpoint.psm1 b/lib/puppet_x/dsc_resources/xJea/DSCResources/MSFT_xJeaEndpoint/MSFT_xJeaEndpoint.psm1 deleted file mode 100644 index 4c07d984..00000000 --- a/lib/puppet_x/dsc_resources/xJea/DSCResources/MSFT_xJeaEndpoint/MSFT_xJeaEndpoint.psm1 +++ /dev/null @@ -1,272 +0,0 @@ -#requires -version 5 -# Copyright © 2014, Microsoft Corporation. All rights reserved. -#region Helper -Import-Module $PSScriptRoot\..\Library\Helper.psm1 -Import-Module $PSScriptRoot\..\Library\JeaDir.psm1 -Import-Module $PSScriptRoot\..\Library\JeaAccount.psm1 -Import-Module $PSScriptRoot\..\Library\JeaInitFile.psm1 - - -#endregion - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name - ) - - try - { - write-Verbose "$((get-date).GetDateTimeFormats()[112]) Start Get [EndPoint]$Name" - $endpoint = Get-PSSessionConfiguration -Name $Name -ErrorAction SilentlyContinue -Verbose:0 - - if ($endpoint) - { - $returnValue = @{ - Name = [System.String]$Name - Toolkit = [System.String[]]"TODO: GET TOOLKITS" - Ensure = [System.String]'Present' - SecurityDescriptorSddl = [System.String]$endpoint.SecurityDescriptorSddl - Group = [String[]]$( - "TODO: Get Groups" - ) - } - } - else - { - $returnValue = @{ - Name = [System.String]$Name - Ensure = [System.String]'Absent' - } - } - $returnValue - }catch - { - write-Debug "ERROR: $($_|fl * -force|out-string)" - New-TerminatingError -errorId 'GetJeaEndpointFailed' -errorMessage $_.Exception -errorCategory InvalidOperation - }finally - { - write-Verbose "$((get-date).GetDateTimeFormats()[112]) Done Get [EndPoint]$Name" - } -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [System.String[]] - $Toolkit, - - [System.String] - $SecurityDescriptorSddl='O:NSG:BAD:P(A;;GA;;;BA)(A;;GA;;;RM)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD)', - - [System.String[]] - $Group = @('Administrators'), - - [System.Boolean] - $CleanAll, - - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present' - ) - try - { - write-Verbose "$((get-date).GetDateTimeFormats()[112]) Start Set [EndPoint]$Name" - if ($CleanAll) - { - #region Remove non-default endpoints - Write-Verbose 'Remove [JeaEndpoints] *' - $defaultEndpoints = 'microsoft.powershell','microsoft.powershell.workflow','microsoft.powershell32','microsoft.windows.servermanagerworkflows' - Get-PSSessionConfiguration -Verbose:0 |where Name -NotIn $defaultEndpoints | % { - Write-Verbose "Remove [PSEndPoint] $($_.Name)" - Unregister-PSSessionConfiguration -NoServiceRestart -Force -Verbose:0 -Name $_.Name - } - #endregion - - #region Remove the JSA UserAccounts - Write-Verbose 'Remove [JSAUserAccount]*' - [ADSI]$Server="WinNT://$($Env:COMPUTERNAME)" - foreach ($account in (Get-CimInstance -Query 'select * from Win32_UserAccount Where Name Like "JSA-%" AND LocalAccount="TRUE"').Name) - { - Write-Verbose "Remove [JSAUserAccount] $account" - $server.Delete('user',$account) - } - if (Get-CimInstance -Query 'select * from Win32_UserAccount Where Name = "JeaSchTaskAccount" AND LocalAccount="TRUE"') - { - Write-Verbose "Remove [JSAUserAccount]JeaSchTaskAccount" - $server.Delete('user','JeaSchTaskAccount') - } - #endregion - - #region remove StartupFiles - if (test-path (Get-JeaStartupScriptDir)) - { - Write-Verbose 'Remove [JeaStartupFile] *' - Remove-Item (Join-Path (Get-JeaStartupScriptDir) *) -Recurse -Verbose - } - #endregion - - #region Remove JeaScheduled Tasks - write-verbose "Remove [ScheduleTask]RestartWinRM" - Unregister-ScheduledTask -TaskPath \Microsoft\Windows\Jea\ -TaskName RestartWinRM -ErrorAction Ignore - write-verbose "Remove [ScheduleTask]ResetJeaSessionAccountPasswords" - Unregister-ScheduledTask -TaskPath \Microsoft\Windows\Jea\ -TaskName ResetJeaSessionAccountPasswords -ErrorAction Ignore - #endregion - - } - else - { - JeaAccount\Assert-JeaAdminAccount - - $endPointName = $Name - $endPoint = Get-PSSessionConfiguration -Name $Name -Verbose:0 -ErrorAction SilentlyContinue - $account = "JSA-$Name" - if ($Ensure -AND !($endPoint)) - { - #region ACCOUNT - Write-Verbose "Test [JeaSessionAccount]$account" - if (Test-JeaSessionAccount -UserName $account) - { - Write-Verbose " [JeaSessionAccount]$account = `$true; Reset-JeaSessionAccountPassword" - $cred = Reset-JeaSessionAccountPassword -UserName $account - }else - { - Write-Verbose "New [JeaSessionAccount]$account" - $cred = New-JeaSessionAccount -UserName $account -Description 'PowerShell Session Acount' -Group $group - } - #endregion - - #region InitializationFile - $startupfile = Join-Path (Get-JeaStartupScriptDir) "Initialize-$($Name).ps1" - Write-Verbose "New [JeaStartupFile] $StartupFile -> [Jeatoolkit]$Toolkit" - New-InitializationFile -Path $StartupFile -Toolkit $Toolkit - #endregion - - #region EndPoint - Write-Verbose "New [JeaEndPoint] $Name" - try - { - # Set the following preference so the functions inside Unregister-PSSessionConfig doesn't get these settings - $oldDebugPrefernce = $DebugPreference; $oldVerbosePreference = $VerbosePreference - $DebugPreference = $VerbosePreference = 'SilentlyContinue' - - $null = Register-PSSessionConfiguration -Name $Name -StartupScript $startupfile -RunAsCredential $cred -NoServiceRestart -Verbose:0 -Force -SecurityDescriptorSddl $SecurityDescriptorSddl - # Reset the following preference to older values - $DebugPreference = $oldDebugPrefernce; $VerbosePreference = $oldVerbosePreference - - Start-ScheduledTask -TaskName RestartWinRM -TaskPath \Microsoft\Windows\Jea\ - } - catch - { - write-Debug "ERROR: $($_|fl * -force|out-string)" - New-TerminatingError -errorId 'JeaEndpointConfigurationFailed' -errorMessage $_.Exception -errorCategory InvalidOperation - } - - #endregion - }elseif (!($Ensure) -And $EndPoint) - { - Write-Verbose "Unregister [JeaEndPoint] $Name" - Unregister-PSSessionConfiguration -Name $Name -Force -Verbose:0 - Start-ScheduledTask -TaskName RestartWinRM -TaskPath \Microsoft\Windows\Jea\ - if (Test-JeaSessionAccount -UserName $account) - { - [ADSI]$Server="WinNT://$($Env:COMPUTERNAME)" - $server.Delete('user',$account) - } - } - } - }catch - { - write-Debug "ERROR: $($_|fl * -force|out-string)" - New-TerminatingError -errorId 'SetJeaEndpointFailed' -errorMessage $_.Exception -errorCategory InvalidOperation - - }finally - { - write-Verbose "$((get-date).GetDateTimeFormats()[112]) Done Set [EndPoint]$Name" - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [System.String[]] - $Toolkit, - - [System.String] - $SecurityDescriptorSddl, - - [System.String[]] - $Group, - - [System.Boolean] - $CleanAll, - - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present' - ) - - try - { - write-Verbose "$((get-date).GetDateTimeFormats()[112]) Start Test [EndPoint]$Name" - - if ($Cleanall) - { - return $false - }else - { - Write-Verbose "Test [JeaEndPoint] $name" - - $endPoint = Get-PSSessionConfiguration -Name $Name -Verbose:0 -ErrorAction Stop - $namePresentMessage = " [JeaEndPoint] $name Present" - Write-Verbose -Message $namePresentMessage - if ($Ensure -eq 'Absent') - { - return $false - } - else - { - Write-Verbose 'TEST SecurityDescriptorSddl' - if ($SecurityDescriptorSddl -and ($endPoint.SecurityDescriptorSddl -ne $SecurityDescriptorSddl)) - { - Write-Verbose ' SecurityDescriptorSddl MISMATCH' - return $false - } - Write-Verbose ' TODO: Check for Toolkits, StartupScript and UserAccount' - return $true - } - } - }catch - { - Write-Verbose " [JeaEndPoint] $Name Absent" - return ($Ensure -eq 'Absent') - }finally - { - write-Verbose "$((get-date).GetDateTimeFormats()[112]) Done Test [EndPoint]$Name" - } -} - - -Export-ModuleMember -Function *-TargetResource - - diff --git a/lib/puppet_x/dsc_resources/xJea/DSCResources/MSFT_xJeaEndpoint/MSFT_xJeaEndpoint.schema.mof b/lib/puppet_x/dsc_resources/xJea/DSCResources/MSFT_xJeaEndpoint/MSFT_xJeaEndpoint.schema.mof deleted file mode 100644 index 4e203223..00000000 --- a/lib/puppet_x/dsc_resources/xJea/DSCResources/MSFT_xJeaEndpoint/MSFT_xJeaEndpoint.schema.mof +++ /dev/null @@ -1,13 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xJeaEndPoint")] -class MSFT_xJeaEndpoint : OMI_BaseResource -{ - [Key, Description("Name of the JEA toolkit to be generated")] String Name; - [Write, Description("List of Jea Toolkits to make available via this endpoint")] String Toolkit[]; - [Write, Description("Sddl to define who can access this JeaEndpoint")] String SecurityDescriptorSddl; - [Write, Description("List of local groups that this Endpoints JeaSessionAccount should be a member of")] String Group[]; - [Write, ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write] Boolean CleanAll; -}; - - diff --git a/lib/puppet_x/dsc_resources/xJea/DSCResources/MSFT_xJeaToolkit/MSFT_xJeaToolkit.psm1 b/lib/puppet_x/dsc_resources/xJea/DSCResources/MSFT_xJeaToolkit/MSFT_xJeaToolkit.psm1 deleted file mode 100644 index 7b28f008..00000000 --- a/lib/puppet_x/dsc_resources/xJea/DSCResources/MSFT_xJeaToolkit/MSFT_xJeaToolkit.psm1 +++ /dev/null @@ -1,161 +0,0 @@ -#requires -version 5 -# Copyright © 2014, Microsoft Corporation. All rights reserved. -#region HelperFunctions -Import-Module $PSScriptRoot\..\Library\Helper.psm1 -Import-Module $PSScriptRoot\..\Library\JeaDir.psm1 -Import-Module $PSScriptRoot\..\Library\JeaProxy.psm1 -# Internal function to throw terminating error with specified errroCategory, errorId and errorMessage - - - - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name - ) - - try - { - write-Verbose "$((get-date).GetDateTimeFormats()[112]) Start Get [Toolkit]$Name" - - $modulePath = (Join-Path (Join-Path (Get-JeaDir) 'Toolkit') "$($name)-ToolKit.psm1") - Write-Verbose "Importing [JeaToolKit]$modulePath" - Import-Module $modulePath -Force -DisableNameChecking -Verbose:0 - - $module = Microsoft.PowerShell.Core\Get-Module -Name "$name-Toolkit" - Write-Verbose "Module= $module " - $returnValue = @{ - Name = [System.String]"$name-Toolkit" - CommandSpecs = [String]$( - $csvPath = (Join-Path (Join-Path (Get-JeaDir) 'Toolkit') "$($name)-CommandSpecs.csv") - if (test-path $csvPath) - { - Microsoft.PowerShell.Management\get-content -Path $csvPath -Raw - } - ) - Applications = [System.String[]] $( - &$Module{$ExportedApplications} - ) - Ensure = [System.String]'Present' - - } - Microsoft.PowerShell.Core\remove-module "$Name-Toolkit" -Verbose:0 - $returnValue - }catch - { - write-Debug "ERROR: $($_|fl * -force|out-string)" - New-TerminatingError -errorId 'GetToolkitFailed' -errorMessage $_.Exception -errorCategory InvalidOperation - }finally - { - write-Verbose "$((get-date).GetDateTimeFormats()[112]) Done Get [JeaToolkit]$name" - } -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [String] - $CommandSpecs, - - [System.String[]] - $Applications, - - [System.String[]] - $ScriptDirectory, - - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present' - ) - - try - { - write-Verbose "$((get-date).GetDateTimeFormats()[112]) Start Set [Toolkit]$Name" - Assert-JeaDirectory - Export-JEAProxy -Name $name -CommandSpecs $CommandSpecs -Applications $Applications - } - catch - { - Write-Debug $($_ |fl * -force |Out-String) - New-TerminatingError -errorId 'JeaToolKitSet' -ErrorMessage $_.Exception -errorCategory OperationStopped - }finally - { - write-Verbose "$((get-date).GetDateTimeFormats()[112]) Done Set [Toolkit]$Name" - } - return $true -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [String] - $CommandSpecs, - - [System.String[]] - $Applications, - - [System.String[]] - $ScriptDirectory, - - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present' - ) - - try - { - write-Verbose "$((get-date).GetDateTimeFormats()[112]) Start Test [JeaToolkit]$name" - - $toolkit = Join-Path (Get-JeaToolKitDir) "$($Name)-ToolKit.psm1" - $CommandSpec = Join-Path (Get-JeaToolKitDir) "$($Name)-CommandSpecs.csv" - $Exists = ((Test-Path $Toolkit) -AND (Test-Path $CommandSpec)) - if ($Exists) { Write-Verbose " [JeaToolkit]$name Present"} - else { Write-Verbose " [JeaToolkit]$name Absent"} - - - if (($Ensure -eq 'Present' -and !$exists) -or - ($Ensure -eq 'Absent' -And $exists)) - { - return $false - } - if ($Ensure -eq 'Present' -and ($CommandSpecs.Trim() -ne (Get-Content $CommandSpec -Raw).Trim())) - { - return $false - } - return $true - }catch - { - write-Debug "ERROR: $($_|fl * -force|out-string)" - New-TerminatingError -errorId 'TestToolkitFailed' -errorMessage $_.Exception -errorCategory InvalidOperation - }finally - { - write-Verbose "$((get-date).GetDateTimeFormats()[112]) Done Test [JeaToolkit]$name" - } - -} #Test-TargetResource - - -Export-ModuleMember -Function *-TargetResource - - diff --git a/lib/puppet_x/dsc_resources/xJea/DSCResources/MSFT_xJeaToolkit/MSFT_xJeaToolkit.schema.mof b/lib/puppet_x/dsc_resources/xJea/DSCResources/MSFT_xJeaToolkit/MSFT_xJeaToolkit.schema.mof deleted file mode 100644 index bbdf883d..00000000 --- a/lib/puppet_x/dsc_resources/xJea/DSCResources/MSFT_xJeaToolkit/MSFT_xJeaToolkit.schema.mof +++ /dev/null @@ -1,12 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xJeaToolKit")] -class MSFT_xJeaToolkit : OMI_BaseResource -{ - [Key, Description("Name of the JEA toolkit to be generated")] String Name; - [Write, Description("CSV formated list of command specifications")] String CommandSpecs; - [Write, Description("array of script directories that can be run")] String ScriptDirectory[]; - [Write, Description("Array of executables that are allowed to run")] String Applications[]; - [Write, ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; -}; - - diff --git a/lib/puppet_x/dsc_resources/xJea/LICENSE b/lib/puppet_x/dsc_resources/xJea/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xJea/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xJea/Util/Initialize-ToolKit.ps1 b/lib/puppet_x/dsc_resources/xJea/Util/Initialize-ToolKit.ps1 deleted file mode 100644 index 5c836c8f..00000000 --- a/lib/puppet_x/dsc_resources/xJea/Util/Initialize-ToolKit.ps1 +++ /dev/null @@ -1,174 +0,0 @@ -# Copyright © 2014, Microsoft Corporation. All rights reserved. -#InitializeToolKit -param( - [ValidateNotNullOrEmpty()] - $ToolkitName -) - -ipmo (Join-Path $env:ProgramFiles 'Jea\Util\SafeProxy.psm1') -DisableNameChecking -$winrm = Get-Service WinRM - -function Write-ActivityRecord -{ - $JeaDir = Join-Path $env:ProgramFiles 'Jea' - $JeaActivityDir = Join-Path $JeaDir 'Activity' - $Logfile = Join-Path $JeaActivityDir 'ActivityLog.csv' - - $WinRMInfo = winrm enum shell |Select-String "ProcessID = $pid" -Context 5,0 - $winRMID = (($WinRMInfo.Context.PreContext |Select-String 'ShellID = ').Line.trim() -split ' = ')[1] - $record = new-Object PSObject -Property @{ - host = hostname - Datetime = Get-Date; - PID = $PID; - RunSpaceID = $ExecutionContext.Host.Runspace.InstanceId.Guid; - Toolkit = ($ToolkitName -join ';'); - WinRMShellID = $WinRMID; - } - - - $record | Export-Csv $Logfile -Append -} - -#region Show Message Of The Day (MOTD) -function Show-Motd -{ - $motd = (Join-Path $env:ProgramFiles 'Jea\motd.txt') - if (Test-Path $motd) - { - Write-Host (Get-Content $motd -raw) - } - foreach ($t in $toolkitName) - { - $motd = (Join-Path $env:ProgramFiles "Jea\Motd\$t.txt") - if (Test-Path $motd) - { - Write-Host (Get-Content $motd -raw) - } - } -} -#endregion - -function Import-Toolkit -{ - param($ToolkitName) - - foreach ($t in $ToolkitName) - { - $path = (Join-Path $env:ProgramFiles "Jea\toolkit\$($t).psm1") - if (Test-Path $path) - { - Import-Module $path -Force -DisableNameChecking - } - else - { - Write-host -ForegroundColor "Import-Toolkit [ToolKit]$path NotFound" - } - } -} - -function Approve-Command -{ - param([string[]]$name) - - foreach ($n in $name) - { - $approvedCommand.$n = 1 - } -} - -function Approve-RemoteSessionCommand -{ - $iss = [System.Management.Automation.Runspaces.InitialSessionState]::CreateRestricted('RemoteServer') - foreach ($f in $iss.Commands.Where({$_.CommandType -eq 'Function'})) - { - Set-Content "function:\$($f.Name)" -Value $f.definition - Approve-Command $f.name - } -} - - -function Approve-ExportedApplication -{ - $apps = @() - foreach ($m in Get-Module) - { - foreach ($a in &$m{$ExportedApplications}) - { - if ($a) - { - $apps += $(Get-command $a).Definition - } - } - } - $ExecutionContext.SessionState.Applications.Clear() - foreach ($a in $apps) - { - $ExecutionContext.SessionState.Applications.Add($a) - } -} - -function Block-UnauthorizedCommands -{ - param( - ) - - Get-Command | % { - $cmd = $_ - if ($approvedCommand.$($cmd.Name) ) - { - # If a proxy for a command exists, we need to remove the name from the list - # so that we can hide the underlying command - $approvedCommand.Remove($($cmd.Name)) - } - else - { - $cmd.Visibility = 'Private' - } - - } - - #Certain commands are particularly dangerous so make sure that they are not exposed. - foreach ($c in 'Invoke-Expression','Import-module') - { - (Get-Command $c).Visibility = 'Private' - } -} - - -function Enable-CommandLogging -{ - param($Module) - - Get-Module $Module | % { $_.LogPipelineExecutionDetails = $true } -} - -$approvedCommand = @{} - -Write-ActivityRecord -Show-Motd -Import-Toolkit $ToolkitName -Enable-CommandLogging $ToolkitName -Approve-RemoteSessionCommand -Approve-Command -name ` - 'whoami', - 'Get-Alias', - 'Get-History', - 'Get-Member', - 'Get-Module', - 'Group-Object', - 'Format-Table', - 'Format-List', - 'Measure-Object', - 'New-Object', # This needs to be constrained - 'Select-Object', - 'Sort-Object', - 'Get-SerializedCommand', - 'Tabexpansion2', - 'Where-Object' -Approve-Command -name $((Get-Module $ToolkitName ).Exportedfunctions.Values.name) -Block-UnauthorizedCommands -Approve-ExportedApplication - -$ExecutionContext.SessionState.Scripts.Clear() -$global:PSModuleAutoloadingPreference = 'None' -$ExecutionContext.SessionState.LanguageMode='NoLanguage' diff --git a/lib/puppet_x/dsc_resources/xJea/Util/SafeProxy.psm1 b/lib/puppet_x/dsc_resources/xJea/Util/SafeProxy.psm1 deleted file mode 100644 index 7a11471e..00000000 --- a/lib/puppet_x/dsc_resources/xJea/Util/SafeProxy.psm1 +++ /dev/null @@ -1,658 +0,0 @@ -# Copyright © 2014, Microsoft Corporation. All rights reserved. - -<# -This Proxy for Sort-Object Does exactly 1 thing - it strongly types Property to STRING[] -which denudes it of the opportunity for exploits (can't take a scriptblock) -#> -function Sort-Object -{ -[CmdletBinding(HelpUri='http://go.microsoft.com/fwlink/?LinkID=113403', RemotingCapability='None')] -param( - [switch] - ${Descending}, - - [switch] - ${Unique}, - - [Parameter(ValueFromPipeline=$true)] - [psobject] - ${InputObject}, - - [Parameter(Position=0)] - [System.String[]] - ${Property}, - - [string] - ${Culture}, - - [switch] - ${CaseSensitive}) - - begin - { - try { - $outBuffer = $null - if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) - { - $PSBoundParameters['OutBuffer'] = 1 - } - $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand('Sort-Object', [System.Management.Automation.CommandTypes]::Cmdlet) - $scriptCmd = {& $wrappedCmd @PSBoundParameters } - $steppablePipeline = $scriptCmd.GetSteppablePipeline($myInvocation.CommandOrigin) - $steppablePipeline.Begin($PSCmdlet) - } catch { - throw - } - } - - process - { - try { - $steppablePipeline.Process($_) - } catch { - throw - } - } - - end - { - try { - $steppablePipeline.End() - } catch { - throw - } - } -<# - -.ForwardHelpTargetName Sort-Object -.ForwardHelpCategory Cmdlet - -#> - -} - -function where-object -{ -[CmdletBinding(DefaultParameterSetName='EqualSet', HelpUri='http://go.microsoft.com/fwlink/?LinkID=113423', RemotingCapability='None')] -param( - [Parameter(ValueFromPipeline=$true)] - [psobject] - ${InputObject}, - - [Parameter(ParameterSetName='MatchSet', Mandatory=$true, Position=0)] - [Parameter(ParameterSetName='NotContainsSet', Mandatory=$true, Position=0)] - [Parameter(ParameterSetName='CaseSensitiveNotContainsSet', Mandatory=$true, Position=0)] - [Parameter(ParameterSetName='InSet', Mandatory=$true, Position=0)] - [Parameter(ParameterSetName='CaseSensitiveInSet', Mandatory=$true, Position=0)] - [Parameter(ParameterSetName='NotInSet', Mandatory=$true, Position=0)] - [Parameter(ParameterSetName='CaseSensitiveNotInSet', Mandatory=$true, Position=0)] - [Parameter(ParameterSetName='IsSet', Mandatory=$true, Position=0)] - [Parameter(ParameterSetName='LessOrEqualSet', Mandatory=$true, Position=0)] - [Parameter(ParameterSetName='CaseSensitiveLessOrEqualSet', Mandatory=$true, Position=0)] - [Parameter(ParameterSetName='GreaterOrEqualSet', Mandatory=$true, Position=0)] - [Parameter(ParameterSetName='CaseSensitiveMatchSet', Mandatory=$true, Position=0)] - [Parameter(ParameterSetName='NotMatchSet', Mandatory=$true, Position=0)] - [Parameter(ParameterSetName='CaseSensitiveGreaterOrEqualSet', Mandatory=$true, Position=0)] - [Parameter(ParameterSetName='NotLikeSet', Mandatory=$true, Position=0)] - [Parameter(ParameterSetName='CaseSensitiveContainsSet', Mandatory=$true, Position=0)] - [Parameter(ParameterSetName='LikeSet', Mandatory=$true, Position=0)] - [Parameter(ParameterSetName='CaseSensitiveNotMatchSet', Mandatory=$true, Position=0)] - [Parameter(ParameterSetName='ContainsSet', Mandatory=$true, Position=0)] - [Parameter(ParameterSetName='IsNotSet', Mandatory=$true, Position=0)] - [Parameter(ParameterSetName='CaseSensitiveLikeSet', Mandatory=$true, Position=0)] - [Parameter(ParameterSetName='CaseSensitiveNotLikeSet', Mandatory=$true, Position=0)] - [Parameter(ParameterSetName='EqualSet', Mandatory=$true, Position=0)] - [Parameter(ParameterSetName='CaseSensitiveEqualSet', Mandatory=$true, Position=0)] - [Parameter(ParameterSetName='NotEqualSet', Mandatory=$true, Position=0)] - [Parameter(ParameterSetName='CaseSensitiveNotEqualSet', Mandatory=$true, Position=0)] - [Parameter(ParameterSetName='GreaterThanSet', Mandatory=$true, Position=0)] - [Parameter(ParameterSetName='CaseSensitiveGreaterThanSet', Mandatory=$true, Position=0)] - [Parameter(ParameterSetName='LessThanSet', Mandatory=$true, Position=0)] - [Parameter(ParameterSetName='CaseSensitiveLessThanSet', Mandatory=$true, Position=0)] - [ValidateNotNullOrEmpty()] - [string] - ${Property}, - - [Parameter(ParameterSetName='CaseSensitiveLikeSet', Position=1)] - [Parameter(ParameterSetName='GreaterThanSet', Position=1)] - [Parameter(ParameterSetName='CaseSensitiveMatchSet', Position=1)] - [Parameter(ParameterSetName='NotInSet', Position=1)] - [Parameter(ParameterSetName='LikeSet', Position=1)] - [Parameter(ParameterSetName='CaseSensitiveGreaterThanSet', Position=1)] - [Parameter(ParameterSetName='CaseSensitiveNotInSet', Position=1)] - [Parameter(ParameterSetName='IsSet', Position=1)] - [Parameter(ParameterSetName='NotLikeSet', Position=1)] - [Parameter(ParameterSetName='IsNotSet', Position=1)] - [Parameter(ParameterSetName='LessOrEqualSet', Position=1)] - [Parameter(ParameterSetName='CaseSensitiveNotLikeSet', Position=1)] - [Parameter(ParameterSetName='MatchSet', Position=1)] - [Parameter(ParameterSetName='NotMatchSet', Position=1)] - [Parameter(ParameterSetName='CaseSensitiveNotMatchSet', Position=1)] - [Parameter(ParameterSetName='ContainsSet', Position=1)] - [Parameter(ParameterSetName='CaseSensitiveContainsSet', Position=1)] - [Parameter(ParameterSetName='NotContainsSet', Position=1)] - [Parameter(ParameterSetName='LessThanSet', Position=1)] - [Parameter(ParameterSetName='CaseSensitiveNotContainsSet', Position=1)] - [Parameter(ParameterSetName='CaseSensitiveLessThanSet', Position=1)] - [Parameter(ParameterSetName='InSet', Position=1)] - [Parameter(ParameterSetName='GreaterOrEqualSet', Position=1)] - [Parameter(ParameterSetName='EqualSet', Position=1)] - [Parameter(ParameterSetName='CaseSensitiveLessOrEqualSet', Position=1)] - [Parameter(ParameterSetName='CaseSensitiveEqualSet', Position=1)] - [Parameter(ParameterSetName='CaseSensitiveGreaterOrEqualSet', Position=1)] - [Parameter(ParameterSetName='NotEqualSet', Position=1)] - [Parameter(ParameterSetName='CaseSensitiveNotEqualSet', Position=1)] - [Parameter(ParameterSetName='CaseSensitiveInSet', Position=1)] - [System.Object] - ${Value}, - - [Parameter(ParameterSetName='EqualSet')] - [Alias('IEQ')] - [switch] - ${EQ}, - - [Parameter(ParameterSetName='CaseSensitiveEqualSet', Mandatory=$true)] - [switch] - ${CEQ}, - - [Parameter(ParameterSetName='NotEqualSet', Mandatory=$true)] - [Alias('INE')] - [switch] - ${NE}, - - [Parameter(ParameterSetName='CaseSensitiveNotEqualSet', Mandatory=$true)] - [switch] - ${CNE}, - - [Parameter(ParameterSetName='GreaterThanSet', Mandatory=$true)] - [Alias('IGT')] - [switch] - ${GT}, - - [Parameter(ParameterSetName='CaseSensitiveGreaterThanSet', Mandatory=$true)] - [switch] - ${CGT}, - - [Parameter(ParameterSetName='LessThanSet', Mandatory=$true)] - [Alias('ILT')] - [switch] - ${LT}, - - [Parameter(ParameterSetName='CaseSensitiveLessThanSet', Mandatory=$true)] - [switch] - ${CLT}, - - [Parameter(ParameterSetName='GreaterOrEqualSet', Mandatory=$true)] - [Alias('IGE')] - [switch] - ${GE}, - - [Parameter(ParameterSetName='CaseSensitiveGreaterOrEqualSet', Mandatory=$true)] - [switch] - ${CGE}, - - [Parameter(ParameterSetName='LessOrEqualSet', Mandatory=$true)] - [Alias('ILE')] - [switch] - ${LE}, - - [Parameter(ParameterSetName='CaseSensitiveLessOrEqualSet', Mandatory=$true)] - [switch] - ${CLE}, - - [Parameter(ParameterSetName='LikeSet', Mandatory=$true)] - [Alias('ILike')] - [switch] - ${Like}, - - [Parameter(ParameterSetName='CaseSensitiveLikeSet', Mandatory=$true)] - [switch] - ${CLike}, - - [Parameter(ParameterSetName='NotLikeSet', Mandatory=$true)] - [Alias('INotLike')] - [switch] - ${NotLike}, - - [Parameter(ParameterSetName='CaseSensitiveNotLikeSet', Mandatory=$true)] - [switch] - ${CNotLike}, - - [Parameter(ParameterSetName='MatchSet', Mandatory=$true)] - [Alias('IMatch')] - [switch] - ${Match}, - - [Parameter(ParameterSetName='CaseSensitiveMatchSet', Mandatory=$true)] - [switch] - ${CMatch}, - - [Parameter(ParameterSetName='NotMatchSet', Mandatory=$true)] - [Alias('INotMatch')] - [switch] - ${NotMatch}, - - [Parameter(ParameterSetName='CaseSensitiveNotMatchSet', Mandatory=$true)] - [switch] - ${CNotMatch}, - - [Parameter(ParameterSetName='ContainsSet', Mandatory=$true)] - [Alias('IContains')] - [switch] - ${Contains}, - - [Parameter(ParameterSetName='CaseSensitiveContainsSet', Mandatory=$true)] - [switch] - ${CContains}, - - [Parameter(ParameterSetName='NotContainsSet', Mandatory=$true)] - [Alias('INotContains')] - [switch] - ${NotContains}, - - [Parameter(ParameterSetName='CaseSensitiveNotContainsSet', Mandatory=$true)] - [switch] - ${CNotContains}, - - [Parameter(ParameterSetName='InSet', Mandatory=$true)] - [Alias('IIn')] - [switch] - ${In}, - - [Parameter(ParameterSetName='CaseSensitiveInSet', Mandatory=$true)] - [switch] - ${CIn}, - - [Parameter(ParameterSetName='NotInSet', Mandatory=$true)] - [Alias('INotIn')] - [switch] - ${NotIn}, - - [Parameter(ParameterSetName='CaseSensitiveNotInSet', Mandatory=$true)] - [switch] - ${CNotIn}, - - [Parameter(ParameterSetName='IsSet', Mandatory=$true)] - [switch] - ${Is}, - - [Parameter(ParameterSetName='IsNotSet', Mandatory=$true)] - [switch] - ${IsNot}) - - begin - { - try { - $outBuffer = $null - if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) - { - $PSBoundParameters['OutBuffer'] = 1 - } - $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand('Where-Object', [System.Management.Automation.CommandTypes]::Cmdlet) - $scriptCmd = {& $wrappedCmd @PSBoundParameters } - $steppablePipeline = $scriptCmd.GetSteppablePipeline($myInvocation.CommandOrigin) - $steppablePipeline.Begin($PSCmdlet) - } catch { - throw - } - } - - process - { - try { - $steppablePipeline.Process($_) - } catch { - throw - } - } - - end - { - try { - $steppablePipeline.End() - } catch { - throw - } - } -<# - -.ForwardHelpTargetName Where-Object -.ForwardHelpCategory Cmdlet - -#> - -} - -function format-table -{ -[CmdletBinding(HelpUri='http://go.microsoft.com/fwlink/?LinkID=113303')] -param( - [switch] - ${AutoSize}, - - [switch] - ${HideTableHeaders}, - - [switch] - ${Wrap}, - - [Parameter(Position=0)] - [string[]] - ${Property}, - - [string[]] - ${GroupBy}, - - [string] - ${View}, - - [switch] - ${ShowError}, - - [switch] - ${DisplayError}, - - [switch] - ${Force}, - - [ValidateSet('CoreOnly','EnumOnly','Both')] - [string] - ${Expand}, - - [Parameter(ValueFromPipeline=$true)] - [psobject] - ${InputObject}) - - begin - { - try { - $outBuffer = $null - if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) - { - $PSBoundParameters['OutBuffer'] = 1 - } - $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand('Format-Table', [System.Management.Automation.CommandTypes]::Cmdlet) - $scriptCmd = {& $wrappedCmd @PSBoundParameters } - $steppablePipeline = $scriptCmd.GetSteppablePipeline($myInvocation.CommandOrigin) - $steppablePipeline.Begin($PSCmdlet) - } catch { - throw - } - } - - process - { - try { - $steppablePipeline.Process($_) - } catch { - throw - } - } - - end - { - try { - $steppablePipeline.End() - } catch { - throw - } - } -<# - -.ForwardHelpTargetName Format-Table -.ForwardHelpCategory Cmdlet - -#> -} - -function format-list -{ -[CmdletBinding(HelpUri='http://go.microsoft.com/fwlink/?LinkID=113302')] -param( - [Parameter(Position=0)] - [string[]] - ${Property}, - - [string[]] - ${GroupBy}, - - [string] - ${View}, - - [switch] - ${ShowError}, - - [switch] - ${DisplayError}, - - [switch] - ${Force}, - - [ValidateSet('CoreOnly','EnumOnly','Both')] - [string] - ${Expand}, - - [Parameter(ValueFromPipeline=$true)] - [psobject] - ${InputObject}) - - begin - { - try { - $outBuffer = $null - if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) - { - $PSBoundParameters['OutBuffer'] = 1 - } - $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand('Format-List', [System.Management.Automation.CommandTypes]::Cmdlet) - $scriptCmd = {& $wrappedCmd @PSBoundParameters } - $steppablePipeline = $scriptCmd.GetSteppablePipeline($myInvocation.CommandOrigin) - $steppablePipeline.Begin($PSCmdlet) - } catch { - throw - } - } - - process - { - try { - $steppablePipeline.Process($_) - } catch { - throw - } - } - - end - { - try { - $steppablePipeline.End() - } catch { - throw - } - } -<# - -.ForwardHelpTargetName Format-List -.ForwardHelpCategory Cmdlet - -#> - - -} - -function Group-Object -{ -[CmdletBinding(HelpUri='http://go.microsoft.com/fwlink/?LinkID=113338', RemotingCapability='None')] -param( - [switch] - ${NoElement}, - - [Parameter(ParameterSetName='HashTable')] - [Alias('AHT')] - [switch] - ${AsHashTable}, - - [Parameter(ParameterSetName='HashTable')] - [switch] - ${AsString}, - - [Parameter(ValueFromPipeline=$true)] - [psobject] - ${InputObject}, - - [Parameter(Position=0)] - [string[]] - ${Property}, - - [string] - ${Culture}, - - [switch] - ${CaseSensitive}) - - begin - { - try { - $outBuffer = $null - if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) - { - $PSBoundParameters['OutBuffer'] = 1 - } - $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand('Group-Object', [System.Management.Automation.CommandTypes]::Cmdlet) - $scriptCmd = {& $wrappedCmd @PSBoundParameters } - $steppablePipeline = $scriptCmd.GetSteppablePipeline($myInvocation.CommandOrigin) - $steppablePipeline.Begin($PSCmdlet) - } catch { - throw - } - } - - process - { - try { - $steppablePipeline.Process($_) - } catch { - throw - } - } - - end - { - try { - $steppablePipeline.End() - } catch { - throw - } - } -<# - -.ForwardHelpTargetName Group-Object -.ForwardHelpCategory Cmdlet - -#> - - -} - -function Select-Object -{ -[CmdletBinding(DefaultParameterSetName='DefaultParameter', HelpUri='http://go.microsoft.com/fwlink/?LinkID=113387', RemotingCapability='None')] -param( - [Parameter(ValueFromPipeline=$true)] - [psobject] - ${InputObject}, - - [Parameter(ParameterSetName='SkipLastParameter', Position=0)] - [Parameter(ParameterSetName='DefaultParameter', Position=0)] - [string[]] - ${Property}, - - [Parameter(ParameterSetName='SkipLastParameter')] - [Parameter(ParameterSetName='DefaultParameter')] - [string[]] - ${ExcludeProperty}, - - [Parameter(ParameterSetName='DefaultParameter')] - [Parameter(ParameterSetName='SkipLastParameter')] - [string[]] - ${ExpandProperty}, - - [switch] - ${Unique}, - - [Parameter(ParameterSetName='DefaultParameter')] - [ValidateRange(0, 2147483647)] - [int] - ${Last}, - - [Parameter(ParameterSetName='DefaultParameter')] - [ValidateRange(0, 2147483647)] - [int] - ${First}, - - [Parameter(ParameterSetName='DefaultParameter')] - [ValidateRange(0, 2147483647)] - [int] - ${Skip}, - - [Parameter(ParameterSetName='SkipLastParameter')] - [ValidateRange(0, 2147483647)] - [int] - ${SkipLast}, - - [Parameter(ParameterSetName='IndexParameter')] - [Parameter(ParameterSetName='DefaultParameter')] - [switch] - ${Wait}, - - [Parameter(ParameterSetName='IndexParameter')] - [ValidateRange(0, 2147483647)] - [int[]] - ${Index}) - - begin - { - try { - $outBuffer = $null - if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) - { - $PSBoundParameters['OutBuffer'] = 1 - } - $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand('Select-Object', [System.Management.Automation.CommandTypes]::Cmdlet) - $scriptCmd = {& $wrappedCmd @PSBoundParameters } - $steppablePipeline = $scriptCmd.GetSteppablePipeline($myInvocation.CommandOrigin) - $steppablePipeline.Begin($PSCmdlet) - } catch { - throw - } - } - - process - { - try { - $steppablePipeline.Process($_) - } catch { - throw - } - } - - end - { - try { - $steppablePipeline.End() - } catch { - throw - } - } -<# - -.ForwardHelpTargetName Select-Object -.ForwardHelpCategory Cmdlet - -#> -} -Export-ModuleMember Where-Object,Sort-Object,format-table,format-list, group-object, Select-object - - - - diff --git a/lib/puppet_x/dsc_resources/xJea/xJea.psd1 b/lib/puppet_x/dsc_resources/xJea/xJea.psd1 deleted file mode 100644 index 325eacc3..00000000 --- a/lib/puppet_x/dsc_resources/xJea/xJea.psd1 +++ /dev/null @@ -1,59 +0,0 @@ -# Copyright © 2014, Microsoft Corporation. All rights reserved. -@{ -# Version number of this module. -ModuleVersion = '0.3.0.0' - -# ID used to uniquely identify this module -GUID = '1088cfb5-36e8-4e9f-b7e4-d49e8032dde6' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'Module with DSC Resources for Just Enough Admin (JEA). Jea makes it simple to create custom RBAC solutions using PowerShell.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -NestedModules = ".\xjea.psm1" - -# Minimum version of the common language runtime (CLR) required by this module -CLRVersion = '4.0' - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/xJea/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/xJea' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - # ReleaseNotes = '' - - } # End of PSData hashtable - -} # End of PrivateData hashtable -} - diff --git a/lib/puppet_x/dsc_resources/xJea/xjea.psm1 b/lib/puppet_x/dsc_resources/xJea/xjea.psm1 deleted file mode 100644 index 06786bcd..00000000 --- a/lib/puppet_x/dsc_resources/xJea/xjea.psm1 +++ /dev/null @@ -1,29 +0,0 @@ -function Show-JeaPresentation -{ - $path = Join-Path $PSScriptRoot 'docs\jea.pptx' - Invoke-item $path -} - -function show-JeaWhitePaper -{ - $path = Join-Path $PSScriptRoot 'docs\Just Enough Administration.docx' - Invoke-item $path -} - -function Show-JeaExamples -{ - $path = Join-Path $PSScriptRoot 'Examples\*' - if ($Host.Name -eq 'Windows PowerShell ISE Host') - { - psedit $path - } - else - { - $files = @() - foreach ($f in dir $path) - { - $files += "$($f.FullName)" - } - PowerShell_ise -file $($files -join ",") - } -} diff --git a/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlDatabase/MSFT_xMySqlDatabase.psm1 b/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlDatabase/MSFT_xMySqlDatabase.psm1 deleted file mode 100644 index bfbde59b..00000000 --- a/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlDatabase/MSFT_xMySqlDatabase.psm1 +++ /dev/null @@ -1,126 +0,0 @@ -# NOTE: LocalizedData isn't used in this resource as there are no interactive/user visible strings - -$ErrorPath = Join-Path -Path "$env:Temp" -ChildPath "MySQLErrors.txt" - -function Get-TargetResource -{ - [OutputType([Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $DatabaseName, - - [parameter(Mandatory = $true)] - [pscredential] $RootCredential, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $MySqlVersion - ) - - if (Test-Path $ErrorPath) - { - Remove-Item -Path $ErrorPath - } - - $arguments = "--execute=SELECT IF(EXISTS (SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = '$DatabaseName'), 'Yes','No')", ` - "--user=root", "--password=$($RootCredential.GetNetworkCredential().Password)", "--port=$(Get-MySqlPort -MySqlVersion $MySqlVersion)", "--silent" - $result = Invoke-MySqlCommand -CommandPath $(Get-MySqlExe -MySqlVersion $MySqlVersion) -Arguments $arguments 2>$ErrorPath - - Read-ErrorFile -ErrorFilePath $ErrorPath - - if ($result -eq "Yes") - { - $Ensure = "Present" - } - else - { - $Ensure = "Absent" - } - - return @{ - Ensure = $Ensure - DatabaseName = $DatabaseName - } -} - -function Set-TargetResource -{ - param - ( - [ValidateSet("Present", "Absent")] - [string] $Ensure = "Present", - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $DatabaseName, - - [parameter(Mandatory = $true)] - [pscredential] $RootCredential, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $MySqlVersion -) - - if (Test-Path $ErrorPath) - { - Remove-Item -Path $ErrorPath - } - - if($Ensure -eq "Present") - { - Write-Verbose "Creating Database $DatabaseName..." - $arguments = "--execute=CREATE DATABASE $DatabaseName", "--user=root", "--password=$($RootCredential.GetNetworkCredential().Password)", ` - "--port=$(Get-MySqlPort -MySqlVersion $MySqlVersion)", "--silent" - $null = Invoke-MySqlCommand -CommandPath $(Get-MySqlExe -MySqlVersion $MySqlVersion) -Arguments $arguments 2>$ErrorPath - } - else - { - Write-Verbose "Dropping Database $DatabaseName..." - $arguments = "--execute=DROP DATABASE $DatabaseName", "--user=root", "--password=$($RootCredential.GetNetworkCredential().Password)", ` - "--port=$(Get-MySqlPort -MySqlVersion $MySqlVersion)", "--silent" - $null = Invoke-MySqlCommand -CommandPath $(Get-MySqlExe -MySqlVersion $MySqlVersion) -Arguments $arguments 2>$ErrorPath - } - - Read-ErrorFile -ErrorFilePath $ErrorPath -} - -function Test-TargetResource -{ - [OutputType([Boolean])] - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - [ValidateSet("Present", "Absent")] - [string] $Ensure = "Present", - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $DatabaseName, - - [parameter(Mandatory = $true)] - [pscredential] $RootCredential, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $MySqlVersion - ) - - Write-Verbose "Ensure is $Ensure" - - $status = Get-TargetResource -DatabaseName $DatabaseName -RootCredential $RootCredential -MySqlVersion $MySqlVersion - - if($status['Ensure'] -eq $Ensure) - { - return $true - } - else - { - return $false - } -} - -Export-ModuleMember -function Get-TargetResource, Set-TargetResource, Test-TargetResource - diff --git a/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlDatabase/MSFT_xMySqlDatabase.schema.mof b/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlDatabase/MSFT_xMySqlDatabase.schema.mof deleted file mode 100644 index 2e20434f..00000000 --- a/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlDatabase/MSFT_xMySqlDatabase.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ -[ClassVersion("1.0.0"),FriendlyName("xMySqlDatabase")] -class MSFT_xMySqlDatabase : OMI_BaseResource -{ - [Key, Description("Name of the database.")] String DatabaseName; - [Write, Description("Should the database be present or absent."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Required, Description("The root credential that is used to install MySql server."), EmbeddedInstance("MSFT_Credential")] String RootCredential; - [Required, Description("MYSql Version Number")] String MySqlVersion; -}; - - diff --git a/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlDatabase/xMySqlDatabaseDesigner.ps1 b/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlDatabase/xMySqlDatabaseDesigner.ps1 deleted file mode 100644 index 6f4a4821..00000000 --- a/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlDatabase/xMySqlDatabaseDesigner.ps1 +++ /dev/null @@ -1,26 +0,0 @@ -# a Powershell script to create MySqlDatabase resource using xDSCResourceDesigner tool -$friendlyName = "xMySqlDatabase" -$resourceName = "MSFT_$friendlyName" -$classVersion = "1.0.0" - -$scriptRoot = Split-Path $MyInvocation.MyCommand.Path -$originalModuleRoot = join-Path $scriptroot "..\.." -$originalModuleRootPath = Resolve-Path $originalModuleRoot -$moduleRoot = Join-Path $env:temp "$($originalModuleRootPath.path | split-path -Leaf)Temp" - -$resources = @() -$schemaPath = (join-path $scriptRoot "$resourceName.schema.mof") - -#Key properties -$resources += New-xDscResourceProperty -Name Name -Type String -Attribute Key -Description "Name of the database." - -#Write properties -$resources += New-xDscResourceProperty -Name Ensure -Type String -Attribute Write -Description "Should the database be present or absent." -ValidateSet @("Present","Absent") -$resources += New-xDscResourceProperty -Name ConnectionCredential -Type PSCredential -Attribute Write -Description "The user credential that is used to install MySql server." - - -Resource is being created... - - -# Create a New template resource to a temporary folder -New-xDscResource -Property $resources -ClassVersion $classVersion -Name $resourceName -Path $moduleRoot -FriendlyName $friendlyName diff --git a/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlGrant/MSFT_xMySqlGrant.psm1 b/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlGrant/MSFT_xMySqlGrant.psm1 deleted file mode 100644 index 22c77832..00000000 --- a/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlGrant/MSFT_xMySqlGrant.psm1 +++ /dev/null @@ -1,182 +0,0 @@ -# This module only supports a subset of the possible database privileges -# A global variable that contains localized messages of MySqlGrant. -data LocalizedData -{ -# culture="en-US" -ConvertFrom-StringData @' -GrantCreated=Grant {0} for user {1} created successfully. -GrantRemoved=Grant {0} for user {1} removed successfully. -InvalidUserName=The name {0} does not exist. -InvalidPermissionType=The permission type {0} cannot be used. -GrantExists=A user with the name {0} exists. -GrantDoesNotExist=A user with the name {0} does not exist. -'@ -} - -Import-LocalizedData LocalizedData -FileName MSFT_xMySqlGrant.strings.psd1 - -$ErrorPath = Join-Path -Path "$env:Temp" -ChildPath "MySQLErrors.txt" - -function Get-TargetResource -{ - [OutputType([Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $UserName, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $DatabaseName, - - [parameter(Mandatory = $true)] - [pscredential] $RootCredential, - - [parameter(Mandatory = $true)] - [ValidateSet("ALL PRIVILEGES", "CREATE", "DROP", "DELETE", "INSERT", "SELECT", "UPDATE", "EXECUTE")] - [ValidateNotNullOrEmpty()] - [string] $PermissionType, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $MySqlVersion - ) - - if (Test-Path $ErrorPath) - { - Remove-Item -Path $ErrorPath - } - - $arguments = "--execute=SHOW GRANTS FOR '$UserName'@localhost", "--user=root", "--password=$($RootCredential.GetNetworkCredential().Password)", ` - "--port=$(Get-MySqlPort -MySqlVersion $MySqlVersion)", "--silent" - $results = Invoke-MySqlCommand -CommandPath $(Get-MySqlExe -MySqlVersion $MySqlVersion) -Arguments $arguments 2>$ErrorPath - - Read-ErrorFile -ErrorFilePath $ErrorPath - - $ensureResult = "Absent" - - ForEach ($result in $results) - { - if ($result -match $DatabaseName) - { - if (($result -match $PermissionType) -or ($result -match "ALL PRIVILEGES")) - { - $ensureResult = "Present" - break - } - } - } - - return @{ - UserName = $UserName - DatabaseName = $DatabaseName - Ensure = $ensureResult - PermissionType = $PermissionType - } -} - -function Set-TargetResource -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $UserName, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $DatabaseName, - - [ValidateSet("Present", "Absent")] - [string] $Ensure = "Present", - - [parameter(Mandatory = $true)] - [pscredential] $RootCredential, - - [parameter(Mandatory = $true)] - [ValidateSet("ALL PRIVILEGES", "CREATE", "DROP", "DELETE", "INSERT", "SELECT", "UPDATE", "EXECUTE")] - [ValidateNotNullOrEmpty()] - [string] $PermissionType, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $MySqlVersion - ) - - if (Test-Path $ErrorPath) - { - Remove-Item -Path $ErrorPath - } - - if($Ensure -eq "Present") - { - Write-Verbose "Granting $PermissionType on $DatabaseName to $UserName..." - - $arguments = "--execute=GRANT $PermissionType ON $DatabaseName.* TO '$UserName'@localhost", "--user=root", ` - "--password=$($RootCredential.GetNetworkCredential().Password)", "--port=$(Get-MySqlPort -MySqlVersion $MySqlVersion)", "--silent" - $null = Invoke-MySqlCommand -CommandPath $(Get-MySqlExe -MySqlVersion $MySqlVersion) -Arguments $arguments 2>$ErrorPath - - $msg = $($LocalizedData.GrantCreated) -f $PermissionType, $UserName - } - else - { - Write-Verbose "Revoking $PermissionType on $DatabaseName to $UserName..." - - $arguments = "--execute=REVOKE $PermissionType ON $DatabaseName.* FROM '$UserName'@localhost", "--user=root", ` - "--password=$($RootCredential.GetNetworkCredential().Password)", "--port=$(Get-MySqlPort -MySqlVersion $MySqlVersion)", "--silent" - $null = Invoke-MySqlCommand -CommandPath $(Get-MySqlExe -MySqlVersion $MySqlVersion) -Arguments $arguments 2>$ErrorPath - - $msg = $($LocalizedData.GrantRemoved) -f $PermissionType, $UserName - } - - Read-ErrorFile -ErrorFilePath $ErrorPath - - Write-Verbose -Message $msg -} - -function Test-TargetResource -{ - [OutputType([Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $UserName, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $DatabaseName, - - [ValidateSet("Present", "Absent")] - [string] $Ensure = "Present", - - [parameter(Mandatory = $true)] - [pscredential] $RootCredential, - - [parameter(Mandatory = $true)] - [ValidateSet("ALL PRIVILEGES", "CREATE", "DROP", "DELETE", "INSERT", "SELECT", "UPDATE", "EXECUTE")] - [ValidateNotNullOrEmpty()] - [string] $PermissionType, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $MySqlVersion - ) - - Write-Verbose "Ensure is $Ensure" - - $status = Get-TargetResource -UserName $UserName -DatabaseName $DatabaseName -RootCredential $RootCredential -PermissionType $PermissionType -MySqlVersion $MySqlVersion - - if($status['Ensure'] -eq $Ensure) - { - return $true - } - else - { - return $false - } -} - -Export-ModuleMember -function Get-TargetResource, Set-TargetResource, Test-TargetResource - diff --git a/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlGrant/MSFT_xMySqlGrant.schema.mof b/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlGrant/MSFT_xMySqlGrant.schema.mof deleted file mode 100644 index b978693f..00000000 --- a/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlGrant/MSFT_xMySqlGrant.schema.mof +++ /dev/null @@ -1,13 +0,0 @@ - -[ClassVersion("1.0.0"),FriendlyName("xMySqlGrant")] -class MSFT_xMySqlGrant : OMI_BaseResource -{ - [Key, Description("Name of MySQL user.")] String UserName; - [Key, Description("MySql database name to grant permissions.")] String DatabaseName; - [Required, Description("MySql connection credential used for the root."), EmbeddedInstance("MSFT_Credential")] String RootCredential; - [Key, Description("MySql user permission type."), ValueMap{"ALL PRIVILEGES", "CREATE", "DROP", "DELETE", "INSERT", "SELECT", "UPDATE", "EXECUTE"}, Values{"ALL PRIVILEGES", "CREATE", "DROP", "DELETE", "INSERT", "SELECT", "UPDATE", "EXECUTE"}] String PermissionType; - [Write, Description("Ensure given grant to mySql database present or absent."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Required, Description("MYSql Version Number")] String MySqlVersion; -}; - - diff --git a/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlGrant/en-US/MSFT_xMySqlGrant.strings.psd1 b/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlGrant/en-US/MSFT_xMySqlGrant.strings.psd1 deleted file mode 100644 index 22a13c76..00000000 --- a/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlGrant/en-US/MSFT_xMySqlGrant.strings.psd1 +++ /dev/null @@ -1,15 +0,0 @@ -# Localized resources for MSFT_xMySqlGrant - -ConvertFrom-StringData @' -###PSLOC -GrantCreated=Grant {0} for user {1} created successfully. -GrantRemoved=Grant {0} for user {1} removed successfully. -InvalidUserName=The name {0} cannot be used. Names may not consist entirely of periods and/or spaces, or contain these characters: {1} -InvalidPermissionType=The permission type {0} cannot be used. -GrantExists=A user with the name {0} exists. -GrantDoesNotExist=A user with the name {0} does not exist -###PSLOC - -'@ - - diff --git a/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlGrant/xMySqlGrantDesigner.ps1 b/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlGrant/xMySqlGrantDesigner.ps1 deleted file mode 100644 index bc262b41..00000000 --- a/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlGrant/xMySqlGrantDesigner.ps1 +++ /dev/null @@ -1,27 +0,0 @@ -# a Powershell script to create MySqlDatabase resource using xDSCResourceDesigner tool -$friendlyName = "xMySqlGrant" -$resourceName = "MSFT_$friendlyName" -$classVersion = "1.0.0" - -$scriptRoot = Split-Path $MyInvocation.MyCommand.Path -$originalModuleRoot = join-Path $scriptroot "..\.." -$originalModuleRootPath = Resolve-Path $originalModuleRoot -$moduleRoot = Join-Path $env:temp "$($originalModuleRootPath.path | split-path -Leaf)Temp" - -$resources = @() -$schemaPath = (join-path $scriptRoot "$resourceName.schema.mof") - -#Key properties -$resources += New-xDscResourceProperty -Name UserName -Type String -Attribute Key -Description "Name of MySQL user." -$resources += New-xDscResourceProperty -Name DatabaseName -Type String -Attribute Key -Description "MySql database name to grant permissions." - -#Write properties -$resources += New-xDscResourceProperty -Name ConnectionCredential -Type PSCredential -Attribute Write -Description "MySql connection credential used for the root." -$resources += New-xDscResourceProperty -Name PermissionType -Type String -Attribute Write -Description "Ensure given grant to mySql database present or absent." -ValidateSet @("ALL PRIVILEGES", "CREATE", "DROP", "DELETE", "INSERT", "SELECT", "UPDATE", "EXECUTE") -$resources += New-xDscResourceProperty -Name Ensure -Type String -Attribute Write -Description "Ensure given grant to mySql database present or absent." -ValidateSet @("Present","Absent") - - -Write-Host Resource is being created... - -# Create a New template resource to a temporary folder -New-xDscResource -Property $resources -ClassVersion $classVersion -Name $resourceName -Path $moduleRoot -FriendlyName $friendlyName diff --git a/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlServer/MSFT_xMySqlServer.psm1 b/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlServer/MSFT_xMySqlServer.psm1 deleted file mode 100644 index 56a9285d..00000000 --- a/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlServer/MSFT_xMySqlServer.psm1 +++ /dev/null @@ -1,112 +0,0 @@ -# NOTE: LocalizedData isn't used in this resource as there are no interactive/user visible strings - -function Get-TargetResource -{ - [OutputType([Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $MySqlVersion, - - [parameter(Mandatory = $true)] - [pscredential] $RootPassword - ) - - $MySqlInstalled = (Get-MySqlVersionInstalled -MySqlVersion $MySqlVersion) - - if ($MySqlInstalled) - { - $ensureResult = "Present" - $portResult = (Get-MySqlPort -MySqlVersion $MySqlVersion) - } - else - { - $ensureResult = "Absent" - $portResult = $null - } - - return @{ - Ensure = $ensureResult - MySqlVersion = $MySqlVersion - Port = $portResult - } -} - -function Set-TargetResource -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $MySqlVersion, - - [ValidateSet("Present", "Absent")] - [string] $Ensure = "Present", - - [parameter(Mandatory = $true)] - [pscredential] $RootPassword, - - [string] $Port = "3306" - - ) - - if ($Ensure -eq "Present") - { - $versionsInstalled = Get-MySqlAllInstalled - - if ($versionsInstalled -eq $null) - { - Write-Verbose "Installing MySQL..." - $arguments = "community", "install", ` - "server;$MySqlVersion;$(Get-ArchitectureName):*:servertype=Server;port=$Port;passwd=$($RootPassword.GetNetworkCredential().Password)", "-silent" - $null = Invoke-MySqlCommand -CommandPath $(Get-MySqlInstallerConsole) -Arguments $arguments - } - else - { - Write-Verbose "Updating/Upgrading is not currently implemented" - } - } - else - { - Write-Verbose "Uninstall is not currently implemented" - } - -} - -function Test-TargetResource -{ - [OutputType([Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $MySqlVersion, - - [ValidateSet("Present", "Absent")] - [string] $Ensure = "Present", - - [parameter(Mandatory = $true)] - [pscredential] $RootPassword, - - [string] $Port = "3306" - - ) - - Write-Verbose "Ensure is $Ensure" - - $status = Get-TargetResource -MySqlVersion $MySqlVersion -RootPassword $RootPassword - - # don't yet check if the root password matches - if(($status['Ensure'] -eq $Ensure) -and ($status['Port'] -eq $Port)) - { - return $true - } - else - { - return $false - } -} - -Export-ModuleMember -function Get-TargetResource, Set-TargetResource, Test-TargetResource - diff --git a/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlServer/MSFT_xMySqlServer.schema.mof b/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlServer/MSFT_xMySqlServer.schema.mof deleted file mode 100644 index 8a99d9e0..00000000 --- a/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlServer/MSFT_xMySqlServer.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ - -[ClassVersion("1.0.0"),FriendlyName("xMySqlServer")] -class MSFT_xMySqlServer : OMI_BaseResource -{ - [Key, Description("mySql Version Number")] String MySqlVersion; - [Write, ValueMap{"Present", "Absent"},Values{"Present", "Absent"}, Description("Ensure server is present or absent")] String Ensure; - [Required, EmbeddedInstance("MSFT_Credential"), Description("The root credential that is used to install mySql server.")] String RootPassword; - [Write, Description("The port number for the service")] String Port; -}; - - diff --git a/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlUser/MSFT_xMySqlUser.psm1 b/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlUser/MSFT_xMySqlUser.psm1 deleted file mode 100644 index 09cc6a4c..00000000 --- a/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlUser/MSFT_xMySqlUser.psm1 +++ /dev/null @@ -1,154 +0,0 @@ -# A global variable that contains localized messages of MySqlUser. -data LocalizedData -{ -# culture="en-US" -ConvertFrom-StringData @' -UserCreated=User {0} created successfully. -UserRemoved=User {0} removed successfully. -UserExists=A user with the name {0} exists. -UserDoesNotExist=A user with the name {0} does not exist. -'@ -} - -Import-LocalizedData LocalizedData -FileName MSFT_xMySqlUser.strings.psd1 - -$ErrorPath = Join-Path -Path "$env:Temp" -ChildPath "MySQLErrors.txt" - -function Get-TargetResource -{ - [OutputType([Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $UserName, - - [parameter(Mandatory = $true)] - [pscredential] $UserCredential, - - [parameter(Mandatory = $true)] - [pscredential] $RootCredential, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $MySqlVersion - ) - - if (Test-Path $ErrorPath) - { - Remove-Item -Path $ErrorPath - } - - $arguments = "--execute=SELECT IF(EXISTS (SELECT USER FROM MYSQL.USER WHERE USER = '$UserName' AND HOST = 'localhost'), 'Yes','No')", "--user=root", ` - "--password=$($RootCredential.GetNetworkCredential().Password)", "--port=$(Get-MySqlPort -MySqlVersion $MySqlVersion)", "--silent" - $result = Invoke-MySqlCommand -CommandPath $(Get-MySqlExe -MySqlVersion $MySqlVersion) -Arguments $arguments 2>$ErrorPath - - Read-ErrorFile -ErrorFilePath $ErrorPath - - if($result -ieq "Yes") - { - $msg = $($LocalizedData.UserExists) -f "$UserName" - Write-Verbose -Message $msg - $ensureResult = "Present" - } - else - { - $msg = $($LocalizedData.UserDoesNotExist) -f "$UserName" - Write-Verbose -Message $msg - $ensureResult = "Absent" - } - - return @{ - UserName = $UserName - Ensure = $ensureResult - } -} - -function Set-TargetResource -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $UserName, - - [ValidateSet("Present", "Absent")] - [string] $Ensure = "Present", - - [parameter(Mandatory = $true)] - [pscredential] $UserCredential, - - [parameter(Mandatory = $true)] - [pscredential] $RootCredential, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $MySqlVersion - ) - - if (Test-Path $ErrorPath) - { - Remove-Item -Path $ErrorPath - } - - if($Ensure -eq "Present") - { - Write-Verbose -Message "Adding user $UserName..." - $arguments = "--execute=CREATE USER '$UserName'@'localhost' IDENTIFIED BY '$($UserCredential.GetNetworkCredential().Password)'", "--user=root", ` - "--password=$($RootCredential.GetNetworkCredential().Password)", "--port=$(Get-MySqlPort -MySqlVersion $MySqlVersion)", "--silent" - $null = Invoke-MySqlCommand -CommandPath $(Get-MySqlExe -MySqlVersion $MySqlVersion) -Arguments $arguments 2>$ErrorPath - $msg = $($LocalizedData.UserCreated) -f "$UserName" - Write-Verbose -Message $msg - } - else - { - Write-Verbose "Dropping user $UserName..." - $arguments = "--execute=DROP USER '$UserName'@'localhost'", "--user=root", "--password=$($RootCredential.GetNetworkCredential().Password)", ` - "--port=$(Get-MySqlPort -MySqlVersion $MySqlVersion)", "--silent" - $null = Invoke-MySqlCommand -CommandPath $(Get-MySqlExe -MySqlVersion $MySqlVersion) -Arguments $arguments 2>$ErrorPath - $msg = $($LocalizedData.UserRemoved) -f "$UserName" - Write-Verbose -Message $msg - } - - Read-ErrorFile -ErrorFilePath $ErrorPath -} - -function Test-TargetResource -{ - [OutputType([Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $UserName, - - [ValidateSet("Present", "Absent")] - [string] $Ensure = "Present", - - [parameter(Mandatory = $true)] - [pscredential] $UserCredential, - - [parameter(Mandatory = $true)] - [pscredential] $RootCredential, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $MySqlVersion - ) - - Write-Verbose "Ensure is $Ensure" - - $status = Get-TargetResource -UserName $UserName -UserCredential $UserCredential -RootCredential $RootCredential -MySqlVersion $MySqlVersion - - if($status.Ensure -eq $Ensure) - { - return $true - } - else - { - return $false - } -} - -Export-ModuleMember -function Get-TargetResource, Set-TargetResource, Test-TargetResource - diff --git a/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlUser/MSFT_xMySqlUser.schema.mof b/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlUser/MSFT_xMySqlUser.schema.mof deleted file mode 100644 index 5423b400..00000000 --- a/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlUser/MSFT_xMySqlUser.schema.mof +++ /dev/null @@ -1,12 +0,0 @@ - -[ClassVersion("1.0.0"),FriendlyName("xMySqlUser")] -class MSFT_xMySqlUser : OMI_BaseResource -{ - [Key, Description("Name of MySQL user to create or remove.")] String UserName; - [Required, Description("Credential for MySQL user."), EmbeddedInstance("MSFT_Credential")] String UserCredential; - [Required, Description("MySQL root credential used to create a user."), EmbeddedInstance("MSFT_Credential")] String RootCredential; - [Write, Description("Ensure MySQL user is present or absent."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Required, Description("MySQL Version Number")] String MySqlVersion; -}; - - diff --git a/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlUser/en-US/MSFT_xMySqlUser.strings.psd1 b/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlUser/en-US/MSFT_xMySqlUser.strings.psd1 deleted file mode 100644 index 79782f3b..00000000 --- a/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlUser/en-US/MSFT_xMySqlUser.strings.psd1 +++ /dev/null @@ -1,14 +0,0 @@ -# Localized resources for MSFT_xMySqlUser - -ConvertFrom-StringData @' -###PSLOC -UserCreated=User {0} created successfully. -UserRemoved=User {0} removed successfully. -InvalidUserName=The name {0} cannot be used. Names may not consist entirely of periods and/or spaces, or contain these characters: {1} -UserExists=A user with the name {0} exists. -UserDoesNotExist=A user with the name {0} does not exist. -###PSLOC - -'@ - - diff --git a/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlUser/xMySqlUserDesigner.ps1 b/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlUser/xMySqlUserDesigner.ps1 deleted file mode 100644 index 4bf7b34e..00000000 --- a/lib/puppet_x/dsc_resources/xMySql/DscResources/MSFT_xMySqlUser/xMySqlUserDesigner.ps1 +++ /dev/null @@ -1,26 +0,0 @@ -# a Powershell script to create MySqlDatabase resource using xDSCResourceDesigner tool -$friendlyName = "xMySqlGrant" -$resourceName = "MSFT_$friendlyName" -$classVersion = "1.0.0" - -$scriptRoot = Split-Path $MyInvocation.MyCommand.Path -$originalModuleRoot = join-Path $scriptroot "..\.." -$originalModuleRootPath = Resolve-Path $originalModuleRoot -$moduleRoot = Join-Path $env:temp "$($originalModuleRootPath.path | split-path -Leaf)Temp" - -$resources = @() -$schemaPath = (join-path $scriptRoot "$resourceName.schema.mof") - -#Key properties -$resources += New-xDscResourceProperty -Name Name -Type String -Attribute Key -Description "Name of MySQL user to create or remove." - -#Write properties -$resources += New-xDscResourceProperty -Name Credential -Type PSCredential -Attribute Write -Description "Credential for MySql user." -$resources += New-xDscResourceProperty -Name ConnectionCredential -Type PSCredential -Attribute Write -Description "MySql connection credential used to create a user." -$resources += New-xDscResourceProperty -Name Ensure -Type String -Attribute Write -Description "Ensure mysql user is present or absent." -ValidateSet @("Present","Absent") - - -Write-Host Resource is being created... - -# Create a New template resource to a temporary folder -New-xDscResource -Property $resources -ClassVersion $classVersion -Name $resourceName -Path $moduleRoot -FriendlyName $friendlyName diff --git a/lib/puppet_x/dsc_resources/xMySql/DscResources/xMySqlProvision/xMySqlProvision.Schema.psm1 b/lib/puppet_x/dsc_resources/xMySql/DscResources/xMySqlProvision/xMySqlProvision.Schema.psm1 deleted file mode 100644 index a9fe2644..00000000 --- a/lib/puppet_x/dsc_resources/xMySql/DscResources/xMySqlProvision/xMySqlProvision.Schema.psm1 +++ /dev/null @@ -1,89 +0,0 @@ -# Composite configuration to provision MySql -configuration xMySqlProvision -{ - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $DownloadUri, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $MySQLVersion, - - [Parameter(Mandatory = $true)] - [PSCredential] $RootCredential, - - [String] $Port, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $DatabaseName, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $UserName, - - [Parameter(Mandatory = $true)] - [PSCredential] $UserCredential, - - [parameter(Mandatory = $true)] - [ValidateSet("ALL PRIVILEGES", "CREATE", "DROP", "DELETE", "INSERT", "SELECT", "UPDATE", "EXECUTE")] - [ValidateNotNullOrEmpty()] - [string[]] $PermissionType - ) - - # Make sure the MySQL Installer Console is installed - Package mySqlInstaller - { - Ensure = "Present" - Path = $DownloadURI - ProductId = "{5848D524-F8CF-4A46-A3E4-B9BDB979A0FE}" - Name = "MySQL Installer - Community" - } - - # Make sure MySQL is installed with the correct port and root credential - xMySqlServer mySqlServer - { - Ensure = "Present" - MySQLVersion = $MySQLVersion - RootPassword = $RootCredential - Port = $Port - DependsOn = "[Package]mySqlInstaller" - } - - # Make sure the MySQL database exists - xMySqlDatabase mySqlDatabase - { - Ensure = "Present" - DatabaseName = $DatabaseName - RootCredential = $RootCredential - MySQLVersion = $MySQLVersion - DependsOn = "[xMySqlServer]mySqlServer" - } - - # Make sure the MySQL user exists - xMySqlUser mySqlUser - { - Ensure = "Present" - UserName = $UserName - UserCredential = $UserCredential - RootCredential = $RootCredential - MySQLVersion = $MySQLVersion - DependsOn = "[xMySqlDatabase]mySqlDatabase" - } - - # Make sure the MySQL user has access to the MySQL database - xMySqlGrant mySqlGrant - { - Ensure = "Present" - UserName = $UserName - DatabaseName = $DatabaseName - RootCredential = $RootCredential - PermissionType = $PermissionType - MySQLVersion = $MySQLVersion - DependsOn = "[xMySqlUser]mySqlUser" - } -} - - diff --git a/lib/puppet_x/dsc_resources/xMySql/DscResources/xMySqlProvision/xMySqlProvision.psd1 b/lib/puppet_x/dsc_resources/xMySql/DscResources/xMySqlProvision/xMySqlProvision.psd1 deleted file mode 100644 index 53de53f5..00000000 --- a/lib/puppet_x/dsc_resources/xMySql/DscResources/xMySqlProvision/xMySqlProvision.psd1 +++ /dev/null @@ -1,97 +0,0 @@ -# -# Module manifest for module 'xMySqlProvision' -# -# -# Generated on: 6/23/2014 -# - -@{ - -# Script module or binary module file associated with this manifest. -RootModule = 'xMySqlProvision.Schema.psm1' - -# Version number of this module. -ModuleVersion = '1.0' - -# ID used to uniquely identify this module -GUID = '95207390-a91f-484d-9a51-3bbffb1149a6' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -# Description = '' - -# Minimum version of the Windows PowerShell engine required by this module -# PowerShellVersion = '' - -# Name of the Windows PowerShell host required by this module -# PowerShellHostName = '' - -# Minimum version of the Windows PowerShell host required by this module -# PowerShellHostVersion = '' - -# Minimum version of Microsoft .NET Framework required by this module -# DotNetFrameworkVersion = '' - -# Minimum version of the common language runtime (CLR) required by this module -# CLRVersion = '' - -# Processor architecture (None, X86, Amd64) required by this module -# ProcessorArchitecture = '' - -# Modules that must be imported into the global environment prior to importing this module -# RequiredModules = @() - -# Assemblies that must be loaded prior to importing this module -# RequiredAssemblies = @() - -# Script files (.ps1) that are run in the caller's environment prior to importing this module. -# ScriptsToProcess = @() - -# Type files (.ps1xml) to be loaded when importing this module -# TypesToProcess = @() - -# Format files (.ps1xml) to be loaded when importing this module -# FormatsToProcess = @() - -# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess -# NestedModules = @() - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Variables to export from this module -VariablesToExport = '*' - -# Aliases to export from this module -AliasesToExport = '*' - -# List of all modules packaged with this module -# ModuleList = @() - -# List of all files packaged with this module -# FileList = @() - -# Private data to pass to the module specified in RootModule/ModuleToProcess -# PrivateData = '' - -# HelpInfo URI of this module -# HelpInfoURI = '' - -# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. -# DefaultCommandPrefix = '' - -} - - - diff --git a/lib/puppet_x/dsc_resources/xMySql/LICENSE b/lib/puppet_x/dsc_resources/xMySql/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xMySql/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xMySql/MSFT_xMySqlUtilities.psm1 b/lib/puppet_x/dsc_resources/xMySql/MSFT_xMySqlUtilities.psm1 deleted file mode 100644 index 80bfa8ec..00000000 --- a/lib/puppet_x/dsc_resources/xMySql/MSFT_xMySqlUtilities.psm1 +++ /dev/null @@ -1,315 +0,0 @@ -function Invoke-MySqlCommand -{ - <# - .SYNOPSIS - This function runs the given command with the given arguments. This - is done so that the function can be mocked for unit testing. - - .EXAMPLE - Invoke-MySqlCommand -CommandPath "C:\somepath.exe" -Arguments "test", "test2" - - .PARAMETER CommandPath - This is the path to the command you want to run. - - .PARAMETER Arguments - These are the arguments you want to supply to the command. - #> - - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $CommandPath, - - [parameter(Mandatory = $true)] - [string[]] $Arguments - ) - - if (Test-Path -Path $CommandPath) - { - & $CommandPath $Arguments - } - else - { - Throw "$CommandPath does not exist" - } -} - -function Get-MySqlInstallerConsole -{ - <# - .SYNOPSIS - This function returns the path for the MySQL Installer Console. - - .EXAMPLE - Get-MySqlInstallerConsole - C:\Program Files (x86)\MySQL\MySQL Installer for Windows\MySQLInstallerConsole.exe - #> - - $mySqlInstallerConsole = Join-Path -Path "$(${env:ProgramFiles(x86)})\MySQL\MySQL Installer for Windows" -ChildPath "MySQLInstallerConsole.exe" - - # Throw an exception if MySQL Installer for Windows isn't installed - if (-not (Test-Path -Path $mySqlInstallerConsole)) - { - Throw 'Please ensure that MySQL Installer for Windows is installed' - } - - return $mySqlInstallerConsole -} - -function Get-MySqlExe -{ - <# - .SYNOPSIS - This function takes in a version number and returns the path of - mysql.exe for that version. It checks to see if the x64 - version is installed and then if the x86 version is - installed. If neither is installed it throws an error. - - .EXAMPLE - Get-MySqlExe -MySqlVersion "5.6.17" - C:\Program Files\MySQL\MySQL Server 5.6\bin\mysql.exe - - .EXAMPLE - Get-MySqlExe -MySqlVersion "5.6.17" - C:\Program Files (x86)\MySQL\MySQL Server 5.6\bin\mysql.exe - - .PARAMETER MySqlVersion - The version of MySQL you want the mysql.exe path for. - #> - - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $MySqlVersion - ) - - $shortVersion = Get-ShortVersion -MySqlVersion $MySqlVersion - $mySqlExeX64 = Join-Path -Path "$(${env:ProgramFiles})\MySQL\MySQL Server $shortVersion\bin" -ChildPath "mysql.exe" - $mySqlExeX86 = Join-Path -Path "$(${env:ProgramFiles(x86)})\MySQL\MySQL Server $shortVersion\bin" -ChildPath "mysql.exe" - - # Throw an exception if the path doesn't exist - if (Test-Path -Path $mySqlExeX64) - { - return $mySqlExeX64 - } - elseif (Test-Path -Path $mySqlExeX86) - { - return $mySqlExeX86 - } - else - { - Throw "Please ensure that MySQL Version $shortVersion is installed" - } -} - -function Get-MySqlVersionInstalled -{ - <# - .SYNOPSIS - This function takes in a version number and determines if that - version of MySQL is installed. - - .EXAMPLE - Get-MySqlVersionInstalled -MySqlVersion "5.6.17" - True - - .EXAMPLE - Get-MySqlVersionInstalled -MySqlVersion "5.6.17" - False - - .PARAMETER MySqlVersion - The MySQL version you want to know about. - #> - - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $MySqlVersion - ) - - $MySqlInstalled = $false - $arguments = "community", "status" - - $statusResults = (Invoke-MySqlCommand -CommandPath $(Get-MySqlInstallerConsole) -Arguments $arguments) -split "`r`n" - - ForEach ($statusResult in $statusResults) - { - if ($statusResult -eq "MySQL Server $MySqlVersion") - { - $MySqlInstalled = $true - } - } - - return $MySqlInstalled -} - -function Get-MySqlAllInstalled -{ - <# - .SYNOPSIS - This function returns all of the versions of MySQL - that are installed. - - .EXAMPLE - Get-MySqlAllInstalled - 5.6.17 - 5.7.8 - - .EXAMPLE - Get-MySqlAllInstalled - 5.6.17 - #> - - $allVersionsInstalled = @() - $arguments = "community", "status" - - $statusResults = (Invoke-MySqlCommand -CommandPath $(Get-MySqlInstallerConsole) -Arguments $arguments) -split "`r`n" - - ForEach ($statusResult in $statusResults) - { - if ($statusResult -match "^MySQL Server") - { - # get the version number from the $statusResult - $splitStatus = $statusResult.Split(" ") - $allVersionsInstalled += ,$splitStatus[2] - } - } - - return $allVersionsInstalled -} - -function Get-ShortVersion -{ - <# - .SYNOPSIS - This function takes in a version number and returns the shortened - version of it. - - .EXAMPLE - Get-ShortVersion -MySqlVersion "5.6.17" - 5.6 - - .EXAMPLE - Get-ShortVersion -MySqlVersion "5.7.8" - 5.7 - - .PARAMETER MySqlVersion - This is the long version number that you want shortened. - #> - - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $MySqlVersion - ) - - $splitVersion = $MySqlVersion.Split(".") - $shortVersion = [string]::Join(".",$splitVersion,0,2) - - return $shortVersion -} - -function Read-ErrorFile -{ - <# - .SYNOPSIS - This function reads an error file and throws an error if there - is a line that starts off with ERROR. - - .EXAMPLE - Read-ErrorFile -ErrorFilePath "C:\errorfile.txt" - - .PARAMETER ErrorFilePath - This is the path of the error file you want read. - #> - - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $ErrorFilePath - ) - - if (Test-Path -Path $ErrorFilePath) - { - ForEach ($line in (Get-Content $ErrorFilePath)) - { - if ($line -match "^ERROR") - { - Remove-Item -Path $ErrorFilePath - Throw "$line" - } - } - Remove-Item -Path $ErrorFilePath - } -} - -function Get-MySqlPort -{ - <# - .SYNOPSIS - This function looks at the my.ini file of the version passed in - and returns the port number from the file. - - .EXAMPLE - Get-MySqlPort -MySqlVersion "5.6.17" - 3306 - - .PARAMETER MySqlVersion - This is the version you want the port number for. - #> - - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $MySqlVersion - ) - - $myIniLocation = Join-Path "$(${env:ProgramData})\MySQL\MySQL Server $(Get-ShortVersion $MySqlVersion)" -ChildPath "my.ini" - - # Throw an exception if $myIniLocation doesn't exist - if (-not (Test-Path -Path $myIniLocation)) - { - Throw 'The my.ini file does not exist in the standard location' - } - - ForEach ($line in (Get-Content $myIniLocation)) - { - if ($line -match "^port=") - { - $mySqlPort = ($line -split '=')[1] - } - } - return $mySqlPort -} - -function Get-ArchitectureName -{ - <# - .SYNOPSIS - This function returns the architecture of the server. - - .EXAMPLE - Get-ArchitectureName - x64 - - .EXAMPLE - Get-ArchitectureName - x86 - #> - - if($env:PROCESSOR_ARCHITECTURE -eq "AMD64") - { - return "x64" - } - else - { - return "x86" - } -} diff --git a/lib/puppet_x/dsc_resources/xMySql/xMySql.psd1 b/lib/puppet_x/dsc_resources/xMySql/xMySql.psd1 deleted file mode 100644 index f1a9503d..00000000 --- a/lib/puppet_x/dsc_resources/xMySql/xMySql.psd1 +++ /dev/null @@ -1,63 +0,0 @@ -@{ -# Version number of this module. -ModuleVersion = '2.1.0.0' - -# ID used to uniquely identify this module -GUID = '7c3fee65-807c-4c25-8f60-0dbece96d1bb' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'Module for installing an instance of mySQL' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Minimum version of the common language runtime (CLR) required by this module -CLRVersion = '4.0' - -# Script module or binary module file associated with this manifest. -#RootModule = 'PSWSIISEndpoint.psm1' - -# Modules to import as nested modules of the module specified in ModuleToProcess -NestedModules = 'MSFT_xMySqlUtilities.psm1' - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/xMySql/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/xMySql' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - # ReleaseNotes = '' - - } # End of PSData hashtable - -} # End of PrivateData hashtable -} - - diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDNSServerAddress/MSFT_xDNSServerAddress.psm1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDNSServerAddress/MSFT_xDNSServerAddress.psm1 deleted file mode 100644 index 3c63d436..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDNSServerAddress/MSFT_xDNSServerAddress.psm1 +++ /dev/null @@ -1,354 +0,0 @@ -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Networking Common Modules -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` - -ChildPath 'NetworkingDsc.Common.psm1')) - -# Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` - -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$localizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xDNSServerAddress' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# - .SYNOPSIS - Returns the current DNS Server Addresses for an interface. - - .PARAMETER InterfaceAlias - Alias of the network interface for which the DNS server address is set. - - .PARAMETER AddressFamily - IP address family. - - .PARAMETER Address - The desired DNS Server address(es). Exclude to enable DHCP. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $InterfaceAlias, - - [Parameter(Mandatory = $true)] - [ValidateSet('IPv4', 'IPv6')] - [String] - $AddressFamily, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String[]] - $Address - ) - - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($LocalizedData.GettingDNSServerAddressesMessage) - ) -join '') - - # Remove the parameters we don't want to splat - $null = $PSBoundParameters.Remove('Address') - - # Get the current DNS Server Addresses based on the parameters given. - [String[]] $currentAddress = Get-DnsClientServerStaticAddress ` - @PSBoundParameters ` - -ErrorAction Stop - - $returnValue = @{ - Address = $currentAddress - AddressFamily = $AddressFamily - InterfaceAlias = $InterfaceAlias - } - - return $returnValue -} - -<# - .SYNOPSIS - Sets the DNS Server Address for an interface. - - .PARAMETER InterfaceAlias - Alias of the network interface for which the DNS server address is set. - - .PARAMETER AddressFamily - IP address family. - - .PARAMETER Address - The desired DNS Server address(es). Exclude to enable DHCP. - - .PARAMETER Validate - Requires that the DNS Server addresses be validated if they are updated. - It will cause the resource to throw a 'A general error occurred that is not covered by a more - specific error code.' error if set to True and specified DNS Servers are not accessible. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $InterfaceAlias, - - [Parameter(Mandatory = $true)] - [ValidateSet('IPv4', 'IPv6')] - [String] - $AddressFamily, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String[]] - $Address, - - [Parameter()] - [Boolean] - $Validate = $false - ) - - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($LocalizedData.ApplyingDNSServerAddressesMessage) - ) -join '') - - # If address not passed, set to an empty array - if (-not $PSBoundParameters.ContainsKey('Address')) - { - [String[]] $Address = @() - } - - # Remove the parameters we don't want to splat - $null = $PSBoundParameters.Remove('Address') - $null = $PSBoundParameters.Remove('Validate') - - # Get the current DNS Server Addresses based on the parameters given. - [String[]] $currentAddress = @(Get-DnsClientServerStaticAddress ` - @PSBoundParameters ` - -ErrorAction Stop) - - # Check if the Server addresses are the same as the desired addresses. - [Boolean] $addressDifferent = (@(Compare-Object ` - -ReferenceObject $currentAddress ` - -DifferenceObject $Address ` - -SyncWindow 0).Length -gt 0) - - if ($addressDifferent) - { - $dnsServerAddressSplat = @{ - InterfaceAlias = $InterfaceAlias - } - - if ($Address.Count -eq 0) - { - # Reset the DNS server address to DHCP - $dnsServerAddressSplat += @{ - ResetServerAddresses = $true - } - - Set-DnsClientServerAddress @dnsServerAddressSplat ` - -ErrorAction Stop - - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($LocalizedData.DNSServersHaveBeenSetToDHCPMessage) - ) -join '' ) - } - else - { - # Set the DNS server address to static - $dnsServerAddressSplat += @{ - Address = $Address - Validate = $Validate - } - - Set-DnsClientServerAddress @dnsServerAddressSplat ` - -ErrorAction Stop - - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($LocalizedData.DNSServersHaveBeenSetCorrectlyMessage) - ) -join '' ) - } - } - else - { - # Test will return true in this case - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($LocalizedData.DNSServersAlreadySetMessage) - ) -join '' ) - } -} - -<# - .SYNOPSIS - Tests the current state of a DNS Server Address for an interface. - - .PARAMETER InterfaceAlias - Alias of the network interface for which the DNS server address is set. - - .PARAMETER AddressFamily - IP address family. - - .PARAMETER Address - The desired DNS Server address(es). Exclude to enable DHCP. - - .PARAMETER Validate - Requires that the DNS Server addresses be validated if they are updated. - It will cause the resource to throw a 'A general error occurred that is not covered by a more - specific error code.' error if set to True and specified DNS Servers are not accessible. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $InterfaceAlias, - - [Parameter(Mandatory = $true)] - [ValidateSet('IPv4', 'IPv6')] - [String] - $AddressFamily, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String[]] - $Address, - - [Parameter()] - [Boolean] - $Validate = $false - ) - # Flag to signal whether settings are correct - [Boolean] $desiredConfigurationMatch = $true - - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($LocalizedData.CheckingDNSServerAddressesMessage) - ) -join '' ) - - # Validate the Address passed or set to empty array if not passed - if ($PSBoundParameters.ContainsKey('Address')) - { - foreach ($ServerAddress in $Address) - { - Assert-ResourceProperty ` - -Address $ServerAddress ` - -AddressFamily $AddressFamily ` - -InterfaceAlias $InterfaceAlias - } # foreach - } - else - { - [String[]] $Address = @() - } # if - - # Remove the parameters we don't want to splat - $null = $PSBoundParameters.Remove('Address') - $null = $PSBoundParameters.Remove('Validate') - - # Get the current DNS Server Addresses based on the parameters given. - [String[]] $currentAddress = @(Get-DnsClientServerStaticAddress ` - @PSBoundParameters ` - -ErrorAction Stop) - - # Check if the Server addresses are the same as the desired addresses. - [Boolean] $addressDifferent = (@(Compare-Object ` - -ReferenceObject $currentAddress ` - -DifferenceObject $Address ` - -SyncWindow 0).Length -gt 0) - - if ($addressDifferent) - { - $desiredConfigurationMatch = $false - - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($LocalizedData.DNSServersNotCorrectMessage) ` - -f ($Address -join ','),($currentAddress -join ',') - ) -join '' ) - } - else - { - # Test will return true in this case - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($LocalizedData.DNSServersSetCorrectlyMessage) - ) -join '' ) - } - return $desiredConfigurationMatch -} - -<# - .SYNOPSIS - Checks the Address details are valid and do not conflict with Address family. - Ensures interface exists. If any problems are detected an exception will be thrown. - - .PARAMETER InterfaceAlias - Alias of the network interface for which the DNS server address is set. - - .PARAMETER AddressFamily - IP address family. - - .PARAMETER Address - The desired DNS Server address. Set to empty to enable DHCP. -#> -function Assert-ResourceProperty -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $InterfaceAlias, - - [Parameter(Mandatory = $true)] - [ValidateSet('IPv4', 'IPv6')] - [String] - $AddressFamily, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Address - ) - - if ( -not (Get-NetAdapter | Where-Object -Property Name -EQ $InterfaceAlias )) - { - New-InvalidArgumentException ` - -Message ($LocalizedData.InterfaceNotAvailableError -f $InterfaceAlias) ` - -ArgumentName 'InterfaceAlias' - } - - if ( -not ([System.Net.IPAddress]::TryParse($Address, [ref]0))) - { - New-InvalidArgumentException ` - -Message ($LocalizedData.AddressFormatError -f $Address) ` - -ArgumentName 'Address' - } - - $detectedAddressFamily = ([System.Net.IPAddress]$Address).AddressFamily.ToString() - if (($detectedAddressFamily -eq [System.Net.Sockets.AddressFamily]::InterNetwork.ToString()) ` - -and ($AddressFamily -ne 'IPv4')) - { - New-InvalidArgumentException ` - -Message ($LocalizedData.AddressIPv4MismatchError -f $Address,$AddressFamily) ` - -ArgumentName 'Address' - } - - if (($detectedAddressFamily -eq [System.Net.Sockets.AddressFamily]::InterNetworkV6.ToString()) ` - -and ($AddressFamily -ne 'IPv6')) - { - New-InvalidArgumentException ` - -Message ($LocalizedData.AddressIPv6MismatchError -f $Address,$AddressFamily) ` - -ArgumentName 'Address' - } -} # Assert-ResourceProperty - -Export-ModuleMember -function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDNSServerAddress/MSFT_xDNSServerAddress.schema.mof b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDNSServerAddress/MSFT_xDNSServerAddress.schema.mof deleted file mode 100644 index 2bdda698..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDNSServerAddress/MSFT_xDNSServerAddress.schema.mof +++ /dev/null @@ -1,8 +0,0 @@ -[ClassVersion("1.0.0"), FriendlyName("xDNSServerAddress")] -class MSFT_xDNSServerAddress : OMI_BaseResource -{ - [Key, Description("Alias of the network interface for which the DNS server address is set.")] string InterfaceAlias; - [Key, Description("IP address family."), ValueMap{"IPv4", "IPv6"},Values{"IPv4", "IPv6"}] string AddressFamily; - [Write, Description("The desired DNS Server address(es). Exclude to enable DHCP.")] string Address[]; - [Write, Description("Requires that the DNS Server addresses be validated if they are updated. It will cause the resource to throw a 'A general error occurred that is not covered by a more specific error code.' error if set to True and specified DNS Servers are not accessible.")] boolean Validate; -}; diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDNSServerAddress/en-US/MSFT_xDNSServerAddress.strings.psd1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDNSServerAddress/en-US/MSFT_xDNSServerAddress.strings.psd1 deleted file mode 100644 index 07ef67b6..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDNSServerAddress/en-US/MSFT_xDNSServerAddress.strings.psd1 +++ /dev/null @@ -1,16 +0,0 @@ -# Localized resources for MSFT_xDNSServerAddress - -ConvertFrom-StringData @' - GettingDNSServerAddressesMessage = Getting the DNS server addresses. - ApplyingDNSServerAddressesMessage = Applying the DNS server addresses. - DNSServersSetCorrectlyMessage = DNS server addresses are set correctly. - DNSServersAlreadySetMessage = DNS server addresses are already set correctly. - CheckingDNSServerAddressesMessage = Checking the DNS server addresses. - DNSServersNotCorrectMessage = DNS server addresses are not correct. Expected "{0}", actual "{1}". - DNSServersHaveBeenSetCorrectlyMessage = DNS server addresses were set to the desired state. - DNSServersHaveBeenSetToDHCPMessage = DNS server addresses were set to the desired state of DHCP. - InterfaceNotAvailableError = Interface "{0}" is not available. Please select a valid interface and try again. - AddressFormatError = Address "{0}" is not in the correct format. Please correct the Address parameter in the configuration and try again. - AddressIPv4MismatchError = Address "{0}" is in IPv4 format, which does not match server address family {1}. Please correct either of them in the configuration and try again. - AddressIPv6MismatchError = Address "{0}" is in IPv6 format, which does not match server address family {1}. Please correct either of them in the configuration and try again. -'@ diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDefaultGatewayAddress/MSFT_xDefaultGatewayAddress.psm1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDefaultGatewayAddress/MSFT_xDefaultGatewayAddress.psm1 deleted file mode 100644 index b25766e9..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDefaultGatewayAddress/MSFT_xDefaultGatewayAddress.psm1 +++ /dev/null @@ -1,346 +0,0 @@ -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Networking Common Modules -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` - -ChildPath 'NetworkingDsc.Common.psm1')) - -# Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` - -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$LocalizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xDefaultGatewayAddress' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# - .SYNOPSIS - Returns the current state of the Default Gateway for an interface. - - .PARAMETER InterfaceAlias - Alias of the network interface for which the default gateway address is set. - - .PARAMETER AddressFamily - IP address family. - - .PARAMETER Address - The desired default gateway address - if not provided default gateway will be removed. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $InterfaceAlias, - - [Parameter(Mandatory = $true)] - [ValidateSet('IPv4', 'IPv6')] - [String] - $AddressFamily, - - [Parameter()] - [String] - $Address - ) - - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($LocalizedData.GettingDefaultGatewayAddressMessage) - ) -join '' ) - - # Use $AddressFamily to select the IPv4 or IPv6 destination prefix - $destinationPrefix = '0.0.0.0/0' - if ($AddressFamily -eq 'IPv6') - { - $destinationPrefix = '::/0' - } - # Get all the default routes - $defaultRoutes = Get-NetRoute -InterfaceAlias $InterfaceAlias -AddressFamily ` - $AddressFamily -ErrorAction Stop | ` - Where-Object { $_.DestinationPrefix -eq $destinationPrefix } - - $returnValue = @{ - AddressFamily = $AddressFamily - InterfaceAlias = $InterfaceAlias - } - # If there is a Default Gateway defined for this interface/address family add it - # to the return value. - if ($defaultRoutes) - { - $returnValue += @{ Address = $defaultRoutes.NextHop } - } - else - { - $returnValue += @{ Address = $null } - } - - $returnValue -} - -<# - .SYNOPSIS - Sets the Default Gateway for an interface. - - .PARAMETER InterfaceAlias - Alias of the network interface for which the default gateway address is set. - - .PARAMETER AddressFamily - IP address family. - - .PARAMETER Address - The desired default gateway address - if not provided default gateway will be removed. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $InterfaceAlias, - - [Parameter(Mandatory = $true)] - [ValidateSet('IPv4', 'IPv6')] - [String] - $AddressFamily, - - [Parameter()] - [String] - $Address - ) - - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($LocalizedData.ApplyingDefaultGatewayAddressMessage) - ) -join '' ) - - # Use $AddressFamily to select the IPv4 or IPv6 destination prefix - $destinationPrefix = '0.0.0.0/0' - - if ($AddressFamily -eq 'IPv6') - { - $destinationPrefix = '::/0' - } - - # Get all the default routes - $defaultRoutes = @(Get-NetRoute ` - -InterfaceAlias $InterfaceAlias ` - -AddressFamily $AddressFamily ` - -ErrorAction Stop).Where( { $_.DestinationPrefix -eq $destinationPrefix } ) - - # Remove any existing default route - foreach ($defaultRoute in $defaultRoutes) - { - Remove-NetRoute ` - -DestinationPrefix $defaultRoute.DestinationPrefix ` - -NextHop $defaultRoute.NextHop ` - -InterfaceIndex $defaultRoute.InterfaceIndex ` - -AddressFamily $defaultRoute.AddressFamily ` - -Confirm:$false -ErrorAction Stop - } - - if ($Address) - { - # Set the correct Default Route - # Build parameter hash table - $parameters = @{ - DestinationPrefix = $destinationPrefix - InterfaceAlias = $InterfaceAlias - AddressFamily = $AddressFamily - NextHop = $Address - } - - New-NetRoute @Parameters -ErrorAction Stop - - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($LocalizedData.DefaultGatewayAddressSetToDesiredStateMessage) - ) -join '' ) - } - else - { - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($LocalizedData.DefaultGatewayRemovedMessage) - ) -join '' ) - } -} - -<# - .SYNOPSIS - Tests the state of the Default Gateway for an interface. - - .PARAMETER InterfaceAlias - Alias of the network interface for which the default gateway address is set. - - .PARAMETER AddressFamily - IP address family. - - .PARAMETER Address - The desired default gateway address - if not provided default gateway will be removed. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $InterfaceAlias, - - [Parameter(Mandatory = $true)] - [ValidateSet('IPv4', 'IPv6')] - [String] - $AddressFamily, - - [Parameter()] - [String] - $Address - ) - - # Flag to signal whether settings are correct - [Boolean] $desiredConfigurationMatch = $true - - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($LocalizedData.CheckingDefaultGatewayAddressMessage) - ) -join '' ) - - Assert-ResourceProperty @PSBoundParameters - - # Use $AddressFamily to select the IPv4 or IPv6 destination prefix - $destinationPrefix = '0.0.0.0/0' - if ($AddressFamily -eq 'IPv6') - { - $destinationPrefix = '::/0' - } - - # Get all the default routes - $defaultRoutes = @(Get-NetRoute ` - -InterfaceAlias $InterfaceAlias ` - -AddressFamily $AddressFamily ` - -ErrorAction Stop).Where( { $_.DestinationPrefix -eq $destinationPrefix } ) - - # Test if the Default Gateway passed is equal to the current default gateway - if ($Address) - { - if ($defaultRoutes) - { - if (-not $defaultRoutes.Where( { $_.NextHop -eq $Address } )) - { - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($LocalizedData.DefaultGatewayNotMatchMessage) -f $Address, $defaultRoutes.NextHop - ) -join '' ) - $desiredConfigurationMatch = $false - } - else - { - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($LocalizedData.DefaultGatewayCorrectMessage) - ) -join '' ) - } - } - else - { - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($LocalizedData.DefaultGatewayDoesNotExistMessage) -f $Address - ) -join '' ) - $desiredConfigurationMatch = $false - } - } - else - { - # Is a default gateway address set? - if ($defaultRoutes) - { - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($LocalizedData.DefaultGatewayExistsButShouldNotMessage) - ) -join '' ) - $desiredConfigurationMatch = $false - } - else - { - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($LocalizedData.DefaultGatewayExistsAndShouldMessage) - 'Default Gateway does not exist which is correct.' - ) -join '' ) - } - } - - return $desiredConfigurationMatch -} - -<# - .SYNOPSIS - Check the Address details are valid and do not conflict with Address family. - Ensures interface exists. If any problems are detected an exception will be thrown. - - .PARAMETER InterfaceAlias - Alias of the network interface for which the default gateway address is set. - - .PARAMETER AddressFamily - IP address family. - - .PARAMETER Address - The desired default gateway address - if not provided default gateway will be removed. -#> -function Assert-ResourceProperty -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $InterfaceAlias, - - [Parameter()] - [ValidateSet('IPv4', 'IPv6')] - [String] - $AddressFamily = 'IPv4', - - [Parameter()] - [String] - $Address - ) - - if (-not (Get-NetAdapter | Where-Object -Property Name -EQ $InterfaceAlias )) - { - New-InvalidOperationException ` - -Message ($LocalizedData.InterfaceNotAvailableError -f $InterfaceAlias) - } - - if ($Address) - { - if (-not ([System.Net.IPAddress]::TryParse($Address, [ref]0))) - { - New-InvalidArgumentException ` - -Message ($LocalizedData.AddressFormatError -f $Address) ` - -ArgumentName 'Address' - } - - $detectedAddressFamily = ([System.Net.IPAddress]$Address).AddressFamily.ToString() - - if (($detectedAddressFamily -eq [System.Net.Sockets.AddressFamily]::InterNetwork.ToString()) ` - -and ($AddressFamily -ne 'IPv4')) - { - New-InvalidArgumentException ` - -Message ($LocalizedData.AddressIPv4MismatchError -f $Address, $AddressFamily) ` - -ArgumentName 'AddressFamily' - } - - if (($detectedAddressFamily -eq [System.Net.Sockets.AddressFamily]::InterNetworkV6.ToString()) ` - -and ($AddressFamily -ne 'IPv6')) - { - New-InvalidArgumentException ` - -Message ($LocalizedData.AddressIPv6MismatchError -f $Address, $AddressFamily) ` - -ArgumentName 'AddressFamily' - } - } -} # Assert-ResourceProperty - -Export-ModuleMember -function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDefaultGatewayAddress/MSFT_xDefaultGatewayAddress.schema.mof b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDefaultGatewayAddress/MSFT_xDefaultGatewayAddress.schema.mof deleted file mode 100644 index 0d7dd188..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDefaultGatewayAddress/MSFT_xDefaultGatewayAddress.schema.mof +++ /dev/null @@ -1,7 +0,0 @@ -[ClassVersion("1.0.0"), FriendlyName("xDefaultGatewayAddress")] -class MSFT_xDefaultGatewayAddress : OMI_BaseResource -{ - [Key, Description("Alias of the network interface for which the default gateway address is set.")] string InterfaceAlias; - [Key, Description("IP address family."), ValueMap{"IPv4", "IPv6"},Values{"IPv4", "IPv6"}] string AddressFamily; - [Write, Description("The desired default gateway address - if not provided default gateway will be removed.")] string Address; -}; diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDefaultGatewayAddress/en-US/MSFT_xDefaultGatewayAddress.strings.psd1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDefaultGatewayAddress/en-US/MSFT_xDefaultGatewayAddress.strings.psd1 deleted file mode 100644 index 08e6e70f..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDefaultGatewayAddress/en-US/MSFT_xDefaultGatewayAddress.strings.psd1 +++ /dev/null @@ -1,18 +0,0 @@ -# Localized resources for MSFT_xDefaultGatewayAddress - -ConvertFrom-StringData @' - GettingDefaultGatewayAddressMessage = Getting the Default Gateway Address. - ApplyingDefaultGatewayAddressMessage = Applying the Default Gateway Address. - DefaultGatewayAddressSetToDesiredStateMessage = Default Gateway address was set to the desired state. - DefaultGatewayRemovedMessage = Default Gateway address has been removed. - CheckingDefaultGatewayAddressMessage = Checking the Default Gateway Address. - DefaultGatewayNotMatchMessage = Default gateway does NOT match desired state. Expected "{0}", actual "{1}". - DefaultGatewayCorrectMessage = Default gateway is correct. - DefaultGatewayDoesNotExistMessage = Default gateway does not exist. Expected "{0}". - DefaultGatewayExistsButShouldNotMessage = Default gateway exists but it should not. - DefaultGatewayExistsAndShouldMessage = Default Gateway does not exist which is correct. - InterfaceNotAvailableError = Interface "{0}" is not available. Please select a valid interface and try again. - AddressFormatError = Address "{0}" is not in the correct format. Please correct the Address parameter in the configuration and try again. - AddressIPv4MismatchError = Address "{0}" is in IPv4 format, which does not match server address family {1}. Please correct either of them in the configuration and try again. - AddressIPv6MismatchError = Address "{0}" is in IPv6 format, which does not match server address family {1}. Please correct either of them in the configuration and try again. -'@ diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDhcpClient/MSFT_xDhcpClient.psm1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDhcpClient/MSFT_xDhcpClient.psm1 deleted file mode 100644 index bc0fba3e..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDhcpClient/MSFT_xDhcpClient.psm1 +++ /dev/null @@ -1,233 +0,0 @@ -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Networking Common Modules -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` - -ChildPath 'NetworkingDsc.Common.psm1')) - -# Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` - -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$LocalizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xDhcpClient' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# - .SYNOPSIS - Returns the current state of the DHCP Client for an interface. - - .PARAMETER InterfaceAlias - Alias of the network interface for which the DHCP Client is set. - - .PARAMETER AddressFamily - IP address family. - - .PARAMETER State - The desired state of the DHCP Client. -#> -function Get-TargetResource -{ - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $InterfaceAlias, - - [Parameter(Mandatory = $true)] - [ValidateSet('IPv4', 'IPv6')] - [System.String] - $AddressFamily, - - [Parameter(Mandatory = $true)] - [ValidateSet('Enabled', 'Disabled')] - [System.String] - $State - ) - - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($LocalizedData.GettingDHCPClientMessage) ` - -f $InterfaceAlias, $AddressFamily ` - ) -join '') - - Assert-ResourceProperty @PSBoundParameters - - $currentDHCPClient = Get-NetIPInterface ` - -InterfaceAlias $InterfaceAlias ` - -AddressFamily $AddressFamily - - $returnValue = @{ - State = $currentDHCPClient.Dhcp - AddressFamily = $AddressFamily - InterfaceAlias = $InterfaceAlias - } - - return $returnValue -} - -<# - .SYNOPSIS - Sets the DHCP Client for an interface. - - .PARAMETER InterfaceAlias - Alias of the network interface for which the DHCP Client is set. - - .PARAMETER AddressFamily - IP address family. - - .PARAMETER State - The desired state of the DHCP Client. -#> -function Set-TargetResource -{ - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $InterfaceAlias, - - [Parameter(Mandatory = $true)] - [ValidateSet('IPv4', 'IPv6')] - [System.String] - $AddressFamily, - - [Parameter(Mandatory = $true)] - [ValidateSet('Enabled', 'Disabled')] - [System.String] - $State - ) - - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($LocalizedData.ApplyingDHCPClientMessage) ` - -f $InterfaceAlias, $AddressFamily ` - ) -join '') - - Assert-ResourceProperty @PSBoundParameters - - $null = Get-NetIPInterface ` - -InterfaceAlias $InterfaceAlias ` - -AddressFamily $AddressFamily - - # The DHCP Client is in a different state - so change it. - Set-NetIPInterface ` - -InterfaceAlias $InterfaceAlias ` - -AddressFamily $AddressFamily ` - -Dhcp $State ` - -ErrorAction Stop - - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($LocalizedData.DHCPClientSetStateMessage) ` - -f $InterfaceAlias, $AddressFamily, $State ` - ) -join '' ) - -} # Set-TargetResource - -<# - .SYNOPSIS - Tests the state of the DHCP Client for an interface. - - .PARAMETER InterfaceAlias - Alias of the network interface for which the DHCP Client is set. - - .PARAMETER AddressFamily - IP address family. - - .PARAMETER State - The desired state of the DHCP Client. -#> -function Test-TargetResource -{ - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $InterfaceAlias, - - [Parameter(Mandatory = $true)] - [ValidateSet('IPv4', 'IPv6')] - [System.String] - $AddressFamily, - - [Parameter(Mandatory = $true)] - [ValidateSet('Enabled', 'Disabled')] - [System.String] - $State - ) - - # Flag to signal whether settings are correct - [System.Boolean] $desiredConfigurationMatch = $true - - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($LocalizedData.CheckingDHCPClientMessage) ` - -f $InterfaceAlias, $AddressFamily ` - ) -join '') - - Assert-ResourceProperty @PSBoundParameters - - $currentDHCPClient = Get-NetIPInterface ` - -InterfaceAlias $InterfaceAlias ` - -AddressFamily $AddressFamily - - # The DHCP Client is in a different state - so change it. - if ($currentDHCPClient.DHCP -ne $State) - { - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($LocalizedData.DHCPClientDoesNotMatchMessage) ` - -f $InterfaceAlias, $AddressFamily, $State ` - ) -join '' ) - $desiredConfigurationMatch = $false - } - - return $desiredConfigurationMatch -} # Test-TargetResource - -<# - .SYNOPSIS - Function will check the interface exists. - If any problems are detected an exception will be thrown. - - .PARAMETER InterfaceAlias - Alias of the network interface for which the DHCP Client is set. - - .PARAMETER AddressFamily - IP address family. - - .PARAMETER State - The desired state of the DHCP Client. -#> -function Assert-ResourceProperty -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $InterfaceAlias, - - [Parameter(Mandatory = $true)] - [ValidateSet('IPv4', 'IPv6')] - [System.String] - $AddressFamily, - - [Parameter(Mandatory = $true)] - [ValidateSet('Enabled', 'Disabled')] - [System.String] - $State - ) - - if (-not (Get-NetAdapter | Where-Object -Property Name -EQ $InterfaceAlias )) - { - New-InvalidOperationException ` - -Message ($LocalizedData.InterfaceNotAvailableError -f $InterfaceAlias) - } -} # Assert-ResourceProperty - -Export-ModuleMember -function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDhcpClient/MSFT_xDhcpClient.schema.mof b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDhcpClient/MSFT_xDhcpClient.schema.mof deleted file mode 100644 index 528ae867..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDhcpClient/MSFT_xDhcpClient.schema.mof +++ /dev/null @@ -1,7 +0,0 @@ -[ClassVersion("1.0.0"), FriendlyName("xDHCPClient")] -class MSFT_xDHCPClient : OMI_BaseResource -{ - [Key, Description("Alias of the network interface for which the DHCP Client is set.")] string InterfaceAlias; - [Key, Description("IP address family."), ValueMap{"IPv4", "IPv6"}, Values{"IPv4", "IPv6"}] string AddressFamily; - [Required, Description("The desired state of the DHCP Client."), ValueMap{"Enabled", "Disabled"}, Values{"Enabled", "Disabled"}] string State; -}; diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDhcpClient/en-US/MSFT_xDhcpClient.strings.psd1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDhcpClient/en-US/MSFT_xDhcpClient.strings.psd1 deleted file mode 100644 index 83ff0141..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDhcpClient/en-US/MSFT_xDhcpClient.strings.psd1 +++ /dev/null @@ -1,10 +0,0 @@ -# Localized resources for MSFT_xDhcpClient - -ConvertFrom-StringData @' - GettingDHCPClientMessage = Getting the DHCP Client on {1} interface "{0}". - ApplyingDHCPClientMessage = Applying the DHCP Client on {1} interface "{0}". - DHCPClientSetStateMessage = DHCP Client was set to the desired state {2} on {1} interface "{0}". - CheckingDHCPClientMessage = Checking the DHCP Client on {1} interface "{0}". - DHCPClientDoesNotMatchMessage = DHCP Client is not in the desired state {2} on {1} interface "{0}". - InterfaceNotAvailableError = Interface "{0}" is not available. Please select a valid interface and try again. -'@ diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDnsClientGlobalSetting/MSFT_xDnsClientGlobalSetting.data.psd1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDnsClientGlobalSetting/MSFT_xDnsClientGlobalSetting.data.psd1 deleted file mode 100644 index de52aeb0..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDnsClientGlobalSetting/MSFT_xDnsClientGlobalSetting.data.psd1 +++ /dev/null @@ -1,16 +0,0 @@ -@{ - ParameterList = @( - @{ - Name = 'SuffixSearchList' - Type = 'String' - }, - @{ - Name = 'UseDevolution' - Type = 'Boolean' - }, - @{ - Name = 'DevolutionLevel' - Type = 'Uint32' - } - ) -} diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDnsClientGlobalSetting/MSFT_xDnsClientGlobalSetting.psm1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDnsClientGlobalSetting/MSFT_xDnsClientGlobalSetting.psm1 deleted file mode 100644 index abdc4093..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDnsClientGlobalSetting/MSFT_xDnsClientGlobalSetting.psm1 +++ /dev/null @@ -1,232 +0,0 @@ -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Networking Common Modules -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` - -ChildPath 'NetworkingDsc.Common.psm1')) - -# Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` - -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$LocalizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xDnsClientGlobalSetting' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# - This is an array of all the parameters used by this resource. -#> -$resourceData = Import-LocalizedData ` - -BaseDirectory $PSScriptRoot ` - -FileName 'MSFT_xDnsClientGlobalSetting.data.psd1' - -# This must be a script parameter so that it is accessible -$script:parameterList = $resourceData.ParameterList - -<# - .SYNOPSIS - Returns the current DNS Client Global Settings. - - .PARAMETER IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes'. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [System.String] - $IsSingleInstance - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.GettingDnsClientGlobalSettingsMessage) - ) -join '' ) - - # Get the current Dns Client Global Settings - $dnsClientGlobalSetting = Get-DnsClientGlobalSetting ` - -ErrorAction Stop - - # Generate the return object. - $returnValue = @{ - IsSingleInstance = 'Yes' - } - - foreach ($parameter in $script:parameterList) - { - $returnValue += @{ - $parameter.Name = $dnsClientGlobalSetting.$($parameter.name) - } - } # foreach - - return $returnValue -} # Get-TargetResource - -<# - .SYNOPSIS - Sets the DNS Client Global Settings. - - .PARAMETER IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes'. - - .PARAMETER SuffixSearchList - Specifies a list of global suffixes that can be used in the specified order by the DNS client - for resolving the IP address of the computer name. - - .PARAMETER UseDevolution. - Specifies that devolution is activated. - - .PARAMETER DevolutionLevel - Specifies the number of labels up to which devolution should occur. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [System.String] - $IsSingleInstance, - - [Parameter()] - [System.String[]] - $SuffixSearchList, - - [Parameter()] - [System.Boolean] - $UseDevolution, - - [Parameter()] - [System.Uint32] - $DevolutionLevel - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.SettingDnsClientGlobalSettingMessage) - ) -join '' ) - - # Get the current Dns Client Global Settings - $dnsClientGlobalSetting = Get-DnsClientGlobalSetting ` - -ErrorAction Stop - - # Generate a list of parameters that will need to be changed. - $changeParameters = @{} - - foreach ($parameter in $script:parameterList) - { - $parameterSourceValue = $dnsClientGlobalSetting.$($parameter.name) - $parameterNewValue = (Get-Variable -Name ($parameter.name)).Value - - if ($PSBoundParameters.ContainsKey($parameter.Name) ` - -and (Compare-Object -ReferenceObject $parameterSourceValue -DifferenceObject $parameterNewValue -SyncWindow 0)) - { - $changeParameters += @{ - $($parameter.name) = $parameterNewValue - } - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.DnsClientGlobalSettingUpdateParameterMessage) ` - -f $parameter.Name,$parameterNewValue - ) -join '' ) - } # if - } # foreach - - if ($changeParameters.Count -gt 0) - { - # Update any parameters that were identified as different - $null = Set-DnsClientGlobalSetting ` - @ChangeParameters ` - -ErrorAction Stop - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.DnsClientGlobalSettingUpdatedMessage) - ) -join '' ) - } # if -} # Set-TargetResource - -<# - .SYNOPSIS - Tests the state of DNS Client Global Settings. - - .PARAMETER IsSingleInstance - Specifies the resource is a single instance, the value must be 'Yes'. - - .PARAMETER SuffixSearchList - Specifies a list of global suffixes that can be used in the specified order by the DNS client - for resolving the IP address of the computer name. - - .PARAMETER UseDevolution. - Specifies that devolution is activated. - - .PARAMETER DevolutionLevel - Specifies the number of labels up to which devolution should occur. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [System.String] - $IsSingleInstance, - - [Parameter()] - [System.String[]] - $SuffixSearchList, - - [Parameter()] - [System.Boolean] - $UseDevolution, - - [Parameter()] - [System.Uint32] - $DevolutionLevel - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.TestingDnsClientGlobalSettingMessage) - ) -join '' ) - - # Flag to signal whether settings are correct - [Boolean] $desiredConfigurationMatch = $true - - # Get the current Dns Client Global Settings - $dnsClientGlobalSetting = Get-DnsClientGlobalSetting ` - -ErrorAction Stop - - # Check each parameter - foreach ($parameter in $script:parameterList) - { - $parameterSourceValue = $dnsClientGlobalSetting.$($parameter.name) - $parameterNewValue = (Get-Variable -Name ($parameter.name)).Value - - if ($PSBoundParameters.ContainsKey($parameter.Name) ` - -and (Compare-Object -ReferenceObject $parameterSourceValue -DifferenceObject $parameterNewValue -SyncWindow 0)) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.DnsClientGlobalSettingParameterNeedsUpdateMessage) ` - -f $parameter.Name,$parameterSourceValue,$parameterNewValue - ) -join '' ) - - $desiredConfigurationMatch = $false - } # if - } # foreach - - return $desiredConfigurationMatch -} # Test-TargetResource - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDnsClientGlobalSetting/MSFT_xDnsClientGlobalSetting.schema.mof b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDnsClientGlobalSetting/MSFT_xDnsClientGlobalSetting.schema.mof deleted file mode 100644 index 6dfa2e49..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDnsClientGlobalSetting/MSFT_xDnsClientGlobalSetting.schema.mof +++ /dev/null @@ -1,8 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xDnsClientGlobalSetting")] -class MSFT_xDnsClientGlobalSetting : OMI_BaseResource -{ - [Key, Description("Specifies the resource is a single instance, the value must be 'Yes'."), ValueMap{"Yes"}, Values{"Yes"}] String IsSingleInstance; - [Write, Description("Specifies a list of global suffixes that can be used in the specified order by the DNS client for resolving the IP address of the computer name.")] String SuffixSearchList[]; - [Write, Description("Specifies that devolution is activated.")] Boolean UseDevolution; - [Write, Description("Specifies the number of labels up to which devolution should occur.")] Uint32 DevolutionLevel; -}; diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDnsClientGlobalSetting/en-US/MSFT_xDnsClientGlobalSetting.strings.psd1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDnsClientGlobalSetting/en-US/MSFT_xDnsClientGlobalSetting.strings.psd1 deleted file mode 100644 index 9d280fd4..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDnsClientGlobalSetting/en-US/MSFT_xDnsClientGlobalSetting.strings.psd1 +++ /dev/null @@ -1,10 +0,0 @@ -# Localized resources for MSFT_xDnsClientGlobalSetting - -ConvertFrom-StringData @' - GettingDnsClientGlobalSettingMessage = Getting DNS Client Global Settings. - SettingDnsClientGlobalSettingMessage = Setting DNS Client Global Settings. - DnsClientGlobalSettingUpdateParameterMessage = Setting DNS Client Global Settings parameter {0} to "{1}". - DnsClientGlobalSettingUpdatedMessage = Setting DNS Client Global Settings updated. - TestingDnsClientGlobalSettingMessage = Testing DNS Client Global Settings. - DnsClientGlobalSettingParameterNeedsUpdateMessage = DNS Client Global Setting "{0}" is "{1}" but should be "{2}". Change required. -'@ diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDnsConnectionSuffix/MSFT_xDnsConnectionSuffix.psm1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDnsConnectionSuffix/MSFT_xDnsConnectionSuffix.psm1 deleted file mode 100644 index 17328e56..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDnsConnectionSuffix/MSFT_xDnsConnectionSuffix.psm1 +++ /dev/null @@ -1,273 +0,0 @@ -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Networking Common Modules -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` - -ChildPath 'NetworkingDsc.Common.psm1')) - -# Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` - -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$LocalizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xDnsConnectionSuffix' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# - .SYNOPSIS - Returns the current DNS Connection Suffix for an interface. - - .PARAMETER InterfaceAlias - Alias of the network interface for which the DNS server address is set. - - .PARAMETER ConnectionSpecificSuffix - DNS connection-specific suffix to assign to the network interface. - - .PARAMETER RegisterThisConnectionsAddress - Specifies that the IP address for this connection is to be registered. - - .PARAMETER UseSuffixWhenRegistering - Specifies that this host name and the connection specific suffix for this connection are to - be registered. - - .PARAMETER Ensure - Ensure that the network interface connection-specific suffix is present or not. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $InterfaceAlias, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $ConnectionSpecificSuffix, - - [Parameter()] - [System.Boolean] - $RegisterThisConnectionsAddress = $true, - - [Parameter()] - [System.Boolean] - $UseSuffixWhenRegistering = $false, - - [Parameter()] - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure = 'Present' - ) - - $dnsClient = Get-DnsClient -InterfaceAlias $InterfaceAlias -ErrorAction SilentlyContinue - - $targetResource = @{ - InterfaceAlias = $dnsClient.InterfaceAlias - ConnectionSpecificSuffix = $dnsClient.ConnectionSpecificSuffix - RegisterThisConnectionsAddress = $dnsClient.RegisterThisConnectionsAddress - UseSuffixWhenRegistering = $dnsClient.UseSuffixWhenRegistering - } - - if ($Ensure -eq 'Present') - { - # Test to see if the connection-specific suffix matches - Write-Verbose -Message ($LocalizedData.CheckingConnectionSuffix -f $ConnectionSpecificSuffix) - - if ($dnsClient.ConnectionSpecificSuffix -eq $ConnectionSpecificSuffix) - { - $Ensure = 'Present' - } - else - { - $Ensure = 'Absent' - } - } - else - { - # ($Ensure -eq 'Absent'). Test to see if there is a connection-specific suffix - Write-Verbose -Message ($LocalizedData.CheckingConnectionSuffix -f '') - - if ([System.String]::IsNullOrEmpty($dnsClient.ConnectionSpecificSuffix)) - { - $Ensure = 'Absent' - } - else - { - $Ensure = 'Present' - } - } - - $targetResource['Ensure'] = $Ensure - - return $targetResource -} - -<# - .SYNOPSIS - Sets the DNS Connection Suffix for an interface. - - .PARAMETER InterfaceAlias - Alias of the network interface for which the DNS server address is set. - - .PARAMETER ConnectionSpecificSuffix - DNS connection-specific suffix to assign to the network interface. - - .PARAMETER RegisterThisConnectionsAddress - Specifies that the IP address for this connection is to be registered. - - .PARAMETER UseSuffixWhenRegistering - Specifies that this host name and the connection specific suffix for this connection are to - be registered. - - .PARAMETER Ensure - Ensure that the network interface connection-specific suffix is present or not. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $InterfaceAlias, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $ConnectionSpecificSuffix, - - [Parameter()] - [System.Boolean] - $RegisterThisConnectionsAddress = $true, - - [Parameter()] - [System.Boolean] - $UseSuffixWhenRegistering = $false, - - [Parameter()] - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure = 'Present' - ) - - $setDnsClientParams = @{ - InterfaceAlias = $InterfaceAlias - RegisterThisConnectionsAddress = $RegisterThisConnectionsAddress - UseSuffixWhenRegistering = $UseSuffixWhenRegistering - } - - if ($Ensure -eq 'Present') - { - $setDnsClientParams['ConnectionSpecificSuffix'] = $ConnectionSpecificSuffix - - Write-Verbose -Message ($LocalizedData.SettingConnectionSuffix ` - -f $ConnectionSpecificSuffix, $InterfaceAlias) - } - else - { - $setDnsClientParams['ConnectionSpecificSuffix'] = '' - - Write-Verbose -Message ($LocalizedData.RemovingConnectionSuffix ` - -f $ConnectionSpecificSuffix, $InterfaceAlias) - } - - Set-DnsClient @setDnsClientParams -} - -<# - .SYNOPSIS - Tests the current state of a DNS Connection Suffix for an interface. - - .PARAMETER InterfaceAlias - Alias of the network interface for which the DNS server address is set. - - .PARAMETER ConnectionSpecificSuffix - DNS connection-specific suffix to assign to the network interface. - - .PARAMETER RegisterThisConnectionsAddress - Specifies that the IP address for this connection is to be registered. - - .PARAMETER UseSuffixWhenRegistering - Specifies that this host name and the connection specific suffix for this connection are to - be registered. - - .PARAMETER Ensure - Ensure that the network interface connection-specific suffix is present or not. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $InterfaceAlias, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $ConnectionSpecificSuffix, - - [Parameter()] - [System.Boolean] - $RegisterThisConnectionsAddress = $true, - - [Parameter()] - [System.Boolean] - $UseSuffixWhenRegistering = $false, - - [Parameter()] - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure = 'Present' - ) - - $targetResource = Get-TargetResource @PSBoundParameters - $inDesiredState = $true - - if ($targetResource.Ensure -ne $Ensure) - { - Write-Verbose -Message ($LocalizedData.PropertyMismatch ` - -f 'Ensure', $Ensure, $targetResource.Ensure) - - $inDesiredState = $false - } - - if ($targetResource.RegisterThisConnectionsAddress -ne $RegisterThisConnectionsAddress) - { - Write-Verbose -Message ($LocalizedData.PropertyMismatch ` - -f 'RegisterThisConnectionsAddress', $RegisterThisConnectionsAddress, $targetResource.RegisterThisConnectionsAddress) - - $inDesiredState = $false - } - - if ($targetResource.UseSuffixWhenRegistering -ne $UseSuffixWhenRegistering) - { - Write-Verbose -Message ($LocalizedData.PropertyMismatch ` - -f 'UseSuffixWhenRegistering', $UseSuffixWhenRegistering, $targetResource.UseSuffixWhenRegistering) - - $inDesiredState = $false - } - - if ($inDesiredState) - { - Write-Verbose -Message $LocalizedData.ResourceInDesiredState - } - else - { - Write-Verbose -Message $LocalizedData.ResourceNotInDesiredState - } - - return $inDesiredState -} - -Export-ModuleMember -function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDnsConnectionSuffix/MSFT_xDnsConnectionSuffix.schema.mof b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDnsConnectionSuffix/MSFT_xDnsConnectionSuffix.schema.mof deleted file mode 100644 index 8a5fdb15..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDnsConnectionSuffix/MSFT_xDnsConnectionSuffix.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("1.0.0"), FriendlyName("xDnsConnectionSuffix")] -class MSFT_xDnsConnectionSuffix : OMI_BaseResource -{ - [Key, Description("Alias of the network interface for which the DNS server address is set.")] String InterfaceAlias; - [Required, Description("DNS connection-specific suffix to assign to the network interface.")] String ConnectionSpecificSuffix; - [Write, Description("Specifies that the IP address for this connection is to be registered.")] Boolean RegisterThisConnectionsAddress; - [Write, Description("Specifies that this host name and the connection specific suffix for this connection are to be registered.")] Boolean UseSuffixWhenRegistering; - [Write, Description("Ensure that the network interface connection-specific suffix is present or not."), ValueMap{"Present", "Absent"},Values{"Present", "Absent"}] String Ensure; -}; diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDnsConnectionSuffix/en-US/MSFT_xDnsConnectionSuffix.strings.psd1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDnsConnectionSuffix/en-US/MSFT_xDnsConnectionSuffix.strings.psd1 deleted file mode 100644 index 6e99d7ca..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xDnsConnectionSuffix/en-US/MSFT_xDnsConnectionSuffix.strings.psd1 +++ /dev/null @@ -1,10 +0,0 @@ -# Localized resources for MSFT_xDnsConnectionSuffix - -ConvertFrom-StringData @' - PropertyMismatch = Property '{0}' does NOT match. Expected '{1}', actual '{2}'. - CheckingConnectionSuffix = Checking connection suffix matches '{0}'. - ResourceInDesiredState = Resource is in the desired state. - ResourceNotInDesiredState = Resource is NOT in the desired state. - SettingConnectionSuffix = Setting connection suffix '{0}' on interface '{1}'. - RemovingConnectionSuffix = Removing connection suffix '{0}' on interface '{1}'. -'@ diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xFirewall/MSFT_xFirewall.Schema.mof b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xFirewall/MSFT_xFirewall.Schema.mof deleted file mode 100644 index d2eaf03a..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xFirewall/MSFT_xFirewall.Schema.mof +++ /dev/null @@ -1,37 +0,0 @@ -[ClassVersion("1.0.0"), FriendlyName("xFirewall")] -class MSFT_xFirewall : OMI_BaseResource -{ - [Key, Description("Name of the Firewall Rule")] String Name; - [Write, Description("Localized, user-facing name of the Firewall Rule being created")] String DisplayName; - [Write, Description("Name of the Firewall Group where we want to put the Firewall Rule")] string Group; - [Write, Description("Ensure the presence/absence of the resource"), ValueMap{"Present", "Absent"},Values{"Present", "Absent"}] String Ensure; - [Write, Description("Enable or disable the supplied configuration"), ValueMap{"True", "False"},Values{"True", "False"}] string Enabled; - [Write, Description("Allow or Block the supplied configuration"), ValueMap{"NotConfigured", "Allow", "Block"}, Values{"NotConfigured", "Allow", "Block"}] String Action; - [Write, Description("Specifies one or more profiles to which the rule is assigned")] String Profile[]; - [Write, Description("Direction of the connection"), ValueMap{"Inbound","Outbound"}, Values{"Inbound","Outbound"}] String Direction; - [Write, Description("Specific Port used for filter. Specified by port number, range, or keyword")] String RemotePort[]; - [Write, Description("Local Port used for the filter")] String LocalPort[]; - [Write, Description("Specific Protocol for filter. Specified by name, number, or range")] String Protocol; - [Write, Description("Documentation for the Rule.")] String Description; - [Write, Description("Path and file name of the program for which the rule is applied")] String Program; - [Write, Description("Specifies the short name of a Windows service to which the firewall rule applies")] String Service; - [Write, Description("Specifies that authentication is required on firewall rules"), ValueMap{"NotRequired", "Required", "NoEncap"}, Values{"NotRequired", "Required", "NoEncap"}] String Authentication; - [Write, Description("Specifies that encryption in authentication is required on firewall rules"), ValueMap{"NotRequired", "Required", "Dynamic"}, Values{"NotRequired", "Required", "Dynamic"}] String Encryption; - [Write, Description("Specifies the alias of the interface that applies to the traffic")] String InterfaceAlias[]; - [Write, Description("Specifies that only network connections made through the indicated interface types are subject to the requirements of this rule"), ValueMap{"Any", "Wired", "Wireless", "RemoteAccess"}, Values{"Any", "Wired", "Wireless", "RemoteAccess"}] String InterfaceType; - [Write, Description("Specifies that network packets with matching IP addresses match this rule")] String LocalAddress[]; - [Write, Description("Specifies the principals to which network traffic this firewall rule applies")] String LocalUser; - [Write, Description("Specifies the Windows Store application to which the firewall rule applies")] String Package; - [Write, Description("Specifies which version of Windows the associated rule applies")] String Platform[]; - [Write, Description("Specifies that network packets with matching IP addresses match this rule")] String RemoteAddress[]; - [Write, Description("Specifies that matching IPsec rules of the indicated computer accounts are created")] String RemoteMachine; - [Write, Description("Specifies that matching IPsec rules of the indicated user accounts are created")] String RemoteUser; - [Write, Description("Specifies a dynamic transport"), ValueMap{"Any","ProximityApps","ProximitySharing","WifiDirectPrinting","WifiDirectDisplay","WifiDirectDevices"},Values{"Any","ProximityApps","ProximitySharing","WifiDirectPrinting","WifiDirectDisplay","WifiDirectDevices"}] String DynamicTransport; - [Write, Description("Specifies that matching firewall rules of the indicated edge traversal policy are created"), ValueMap{"Block","Allow","DeferToUser","DeferToApp"},Values{"Block","Allow","DeferToUser","DeferToApp"}] String EdgeTraversalPolicy; - [Write, Description("Specifies the ICMP type codes")] String IcmpType[]; - [Write, Description("Indicates that matching firewall rules of the indicated value are created")] Boolean LocalOnlyMapping; - [Write, Description("Indicates that matching firewall rules of the indicated value are created")] Boolean LooseSourceMapping; - [Write, Description("Indicates that matching network traffic that would otherwise be blocked are allowed")] Boolean OverrideBlockRules; - [Write, Description("Specifies that matching firewall rules of the indicated owner are created")] String Owner; - [Read, Description("The current value of the Display Group of the Firewall Rule")] string DisplayGroup; -}; diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xFirewall/MSFT_xFirewall.data.psd1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xFirewall/MSFT_xFirewall.data.psd1 deleted file mode 100644 index 73bc7daa..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xFirewall/MSFT_xFirewall.data.psd1 +++ /dev/null @@ -1,36 +0,0 @@ -@{ - ParameterList = @( - @{ Name = 'Name'; Variable = 'FirewallRule'; Type = 'String' } - @{ Name = 'DisplayName'; Variable = 'FirewallRule'; Type = 'String' } - @{ Name = 'Group'; Variable = 'FirewallRule'; Type = 'String' } - @{ Name = 'DisplayGroup'; Variable = 'FirewallRule'; Type = '' } - @{ Name = 'Enabled'; Variable = 'FirewallRule'; Type = 'String' } - @{ Name = 'Action'; Variable = 'FirewallRule'; Type = 'String' } - @{ Name = 'Profile'; Variable = 'FirewallRule'; Type = 'Array'; Delimiter = ', ' } - @{ Name = 'Direction'; Variable = 'FirewallRule'; Type = 'String' } - @{ Name = 'Description'; Variable = 'FirewallRule'; Type = 'String' } - @{ Name = 'RemotePort'; Variable = 'properties'; Property = 'PortFilters'; Type = 'Array' } - @{ Name = 'LocalPort'; Variable = 'properties'; Property = 'PortFilters'; Type = 'Array' } - @{ Name = 'Protocol'; Variable = 'properties'; Property = 'PortFilters'; Type = 'String' } - @{ Name = 'Program'; Variable = 'properties'; Property = 'ApplicationFilters'; Type = 'String' } - @{ Name = 'Service'; Variable = 'properties'; Property = 'ServiceFilters'; Type = 'String' } - @{ Name = 'Authentication'; Variable = 'properties'; Property = 'SecurityFilters'; Type = 'String' } - @{ Name = 'Encryption'; Variable = 'properties'; Property = 'SecurityFilters'; Type = 'String' } - @{ Name = 'InterfaceAlias'; Variable = 'properties'; Property = 'InterfaceFilters'; Type = 'Array' } - @{ Name = 'InterfaceType'; Variable = 'properties'; Property = 'InterfaceTypeFilters'; Type = 'String' } - @{ Name = 'LocalAddress'; Variable = 'properties'; Property = 'AddressFilters'; Type = 'ArrayIP' } - @{ Name = 'LocalUser'; Variable = 'properties'; Property = 'SecurityFilters'; Type = 'String' } - @{ Name = 'Package'; Variable = 'properties'; Property = 'ApplicationFilters'; Type = 'String' } - @{ Name = 'Platform'; Variable = 'FirewallRule'; Type = 'Array' } - @{ Name = 'RemoteAddress'; Variable = 'properties'; Property = 'AddressFilters'; Type = 'ArrayIP' } - @{ Name = 'RemoteMachine'; Variable = 'properties'; Property = 'SecurityFilters'; Type = 'String' } - @{ Name = 'RemoteUser'; Variable = 'properties'; Property = 'SecurityFilters'; Type = 'String' } - @{ Name = 'DynamicTransport'; Variable = 'properties'; Property = 'PortFilters'; Type = 'String' } - @{ Name = 'EdgeTraversalPolicy'; Variable = 'FirewallRule'; Type = 'String' } - @{ Name = 'IcmpType'; Variable = 'properties'; Property = 'PortFilters'; Type = 'Array' } - @{ Name = 'LocalOnlyMapping'; Variable = 'FirewallRule'; Type = 'Boolean' } - @{ Name = 'LooseSourceMapping'; Variable = 'FirewallRule'; Type = 'Boolean' } - @{ Name = 'OverrideBlockRules'; Variable = 'properties'; Property = 'SecurityFilters'; Type = 'Boolean' } - @{ Name = 'Owner'; Variable = 'FirewallRule'; Type = 'String' } - ) -} diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xFirewall/MSFT_xFirewall.psm1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xFirewall/MSFT_xFirewall.psm1 deleted file mode 100644 index e11b29c4..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xFirewall/MSFT_xFirewall.psm1 +++ /dev/null @@ -1,1352 +0,0 @@ -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Networking Common Modules -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` - -ChildPath 'NetworkingDsc.Common.psm1')) - -# Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` - -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$localizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xFirewall' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# - This is an array of all the parameters used by this resource - It can be used by several of the functions to reduce the amount of code required - Each element contains 3 properties: - Name: The parameter name - Source: The source where the existing parameter can be pulled from - Type: This is the content type of the paramater (it is either array or string or blank) - A blank type means it will not be compared - data ParameterList - Delimiter: Only required for Profile parameter, because Get-NetFirewall rule doesn't - return the profile as an array, but a comma delimited string. Setting this value causes - the functions to first split the parameter into an array. -#> -$script:resourceData = Import-LocalizedData ` - -BaseDirectory $PSScriptRoot ` - -FileName 'MSFT_xFirewall.data.psd1' -$script:parameterList = $script:resourceData.ParameterList - -<# - .SYNOPSIS - Returns the current state of the Firewall Rule. - - .PARAMETER Name - Name of the firewall rule. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - # Name of the Firewall Rule - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Name - ) - - $ErrorActionPreference = 'Stop' - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($script:localizedData.GettingFirewallRuleMessage) -f $Name - ) -join '') - - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($script:localizedData.FindFirewallRuleMessage) -f $Name - ) -join '') - - $firewallRule = Get-FirewallRule -Name $Name - - if (-not $firewallRule) - { - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($script:localizedData.FirewallRuleDoesNotExistMessage) -f $Name - ) -join '') - return @{ - Ensure = 'Absent' - Name = $Name - } - } - - $properties = Get-FirewallRuleProperty -FirewallRule $firewallRule - - $result = @{ - Ensure = 'Present' - } - - <# - Populate the properties for get target resource by looping through - the parameter array list and adding the values to - #> - foreach ($parameter in $script:parameterList) - { - if ($parameter.Type -in @('Array', 'ArrayIP')) - { - $parameterValue = @(Get-FirewallPropertyValue ` - -FirewallRule $firewallRule ` - -Properties $properties ` - -Parameter $parameter) - if ($parameter.Delimiter) - { - $parameterValue = $parameterValue -split $parameter.Delimiter - } - - $result += @{ - $parameter.Name = $parameterValue - } - - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($script:localizedData.FirewallParameterValueMessage) -f ` - $Name, $parameter.Name, ($parameterValue -join ',') - ) -join '') - } - else - { - $parameterValue = Get-FirewallPropertyValue ` - -FirewallRule $firewallRule ` - -Properties $properties ` - -Parameter $parameter - - $result += @{ - $parameter.Name = $parameterValue - } - - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($script:localizedData.FirewallParameterValueMessage) -f ` - $Name, $parameter.Name, $parameterValue - ) -join '') - } - } - return $result -} - -<# - .SYNOPSIS - Create, update or delete the Firewall Rule. - - .PARAMETER Name - Name of the firewall rule. - - .PARAMETER DisplayName - Localized, user-facing name of the firewall rule being created. - - .PARAMETER Group - Name of the firewall group where we want to put the firewall rule. - - .PARAMETER Ensure - Ensure that the firewall rule exists. - - .PARAMETER Enabled - Enable or Disable the supplied configuration. - - .PARAMETER Action - Allow or Block the supplied configuration. - - .PARAMETER Profile - Specifies one or more profiles to which the rule is assigned. - - .PARAMETER Direction - Direction of the connection. - - .PARAMETER RemotePort - Specific port used for filter. Specified by port number, range, or keyword. - - .PARAMETER LocalPort - Local port used for the filter. - - .PARAMETER Protocol - Specific protocol for filter. Specified by name, number, or range. - - .PARAMETER Description - Documentation for the rule. - - .PARAMETER Program - Path and filename of the program for which the rule is applied. - - .PARAMETER Service - Specifies the short name of a Windows service to which the firewall rule applies. - - .PARAMETER Authentication - Specifies that authentication is required on firewall rules. - - .PARAMETER Encryption - Specifies that encryption in authentication is required on firewall rules. - - .PARAMETER InterfaceAlias - Specifies the alias of the interface that applies to the traffic. - - .PARAMETER InterfaceType - Specifies that only network connections made through the indicated interface types are subject - to the requirements of this rule. - - .PARAMETER LocalAddress - Specifies that network packets with matching IP addresses match this rule. This parameter value - is the first end point of an IPsec rule and specifies the computers that are subject to the - requirements of this rule. This parameter value is an IPv4 or IPv6 address, hostname, subnet, - range, or the following keyword: Any. - - .PARAMETER LocalUser - Specifies the principals to which network traffic this firewall rule applies. The principals, - represented by security identifiers (SIDs) in the security descriptor definition language (SDDL) - string, are services, users, application containers, or any SID to which network traffic is - associated. - - .PARAMETER Package - Specifies the Windows Store application to which the firewall rule applies. This parameter is - specified as a security identifier (SID). - - .PARAMETER Platform - Specifies which version of Windows the associated rule applies. - - .PARAMETER RemoteAddress - Specifies that network packets with matching IP addresses match this rule. This parameter value - is the second end point of an IPsec rule and specifies the computers that are subject to the - requirements of this rule. This parameter value is an IPv4 or IPv6 address, hostname, subnet, - range, or the following keyword: Any - - .PARAMETER RemoteMachine - Specifies that matching IPsec rules of the indicated computer accounts are created. This - parameter specifies that only network packets that are authenticated as incoming from or - outgoing to a computer identified in the list of computer accounts (SID) match this rule. - This parameter value is specified as an SDDL string. - - .PARAMETER RemoteUser - Specifies that matching IPsec rules of the indicated user accounts are created. This parameter - specifies that only network packets that are authenticated as incoming from or outgoing to a - user identified in the list of user accounts match this rule. This parameter value is specified - as an SDDL string. - - .PARAMETER DynamicTransport - Specifies a dynamic transport. - - .PARAMETER EdgeTraversalPolicy - Specifies that matching firewall rules of the indicated edge traversal policy are created. - - .PARAMETER IcmpType - Specifies the ICMP type codes. - - .PARAMETER LocalOnlyMapping - Indicates that matching firewall rules of the indicated value are created. - - .PARAMETER LooseSourceMapping - Indicates that matching firewall rules of the indicated value are created. - - .PARAMETER OverrideBlockRules - Indicates that matching network traffic that would otherwise be blocked are allowed. - - .PARAMETER Owner - Specifies that matching firewall rules of the indicated owner are created. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Name, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String] - $DisplayName, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String] - $Group, - - [Parameter()] - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present', - - [Parameter()] - [ValidateSet('True', 'False')] - [String] - $Enabled, - - [Parameter()] - [ValidateSet('NotConfigured', 'Allow', 'Block')] - [String] - $Action, - - [Parameter()] - [String[]] - $Profile, - - [Parameter()] - [ValidateSet('Inbound', 'Outbound')] - [String] - $Direction, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String[]] - $RemotePort, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String[]] - $LocalPort, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String] - $Protocol, - - [Parameter()] - [String] - $Description, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String] - $Program, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String] - $Service, - - [Parameter()] - [ValidateSet('NotRequired', 'Required', 'NoEncap')] - [String] - $Authentication, - - [Parameter()] - [ValidateSet('NotRequired', 'Required', 'Dynamic')] - [String] - $Encryption, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String[]] - $InterfaceAlias, - - [Parameter()] - [ValidateSet('Any', 'Wired', 'Wireless', 'RemoteAccess')] - [String] - $InterfaceType, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String[]] - $LocalAddress, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String] - $LocalUser, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String] - $Package, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String[]] - $Platform, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String[]] - $RemoteAddress, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String] - $RemoteMachine, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String] - $RemoteUser, - - [Parameter()] - [ValidateSet('Any', 'ProximityApps', 'ProximitySharing', 'WifiDirectPrinting', 'WifiDirectDisplay', 'WifiDirectDevices')] - [String] - $DynamicTransport, - - [Parameter()] - [ValidateSet('Block', 'Allow', 'DeferToUser', 'DeferToApp')] - [String] - $EdgeTraversalPolicy, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String[]] - $IcmpType, - - [Parameter()] - [Boolean] - $LocalOnlyMapping, - - [Parameter()] - [Boolean] - $LooseSourceMapping, - - [Parameter()] - [Boolean] - $OverrideBlockRules, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String] - $Owner - ) - - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($script:localizedData.ApplyingFirewallRuleMessage) -f $Name - ) -join '') - - # Remove any parameters not used in Splats - $null = $PSBoundParameters.Remove('Ensure') - - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($script:localizedData.FindFirewallRuleMessage) -f $Name - ) -join '') - $firewallRule = Get-FirewallRule -Name $Name - - $exists = ($null -ne $firewallRule) - - if ($Ensure -eq 'Present') - { - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($script:localizedData.FirewallRuleShouldExistMessage) -f $Name, $Ensure - ) -join '') - - if ($exists) - { - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($script:localizedData.FirewallRuleShouldExistAndDoesMessage) -f $Name - ) -join '') - - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($script:localizedData.CheckFirewallRuleParametersMessage) -f $Name - ) -join '') - - if (-not (Test-RuleProperties -FirewallRule $firewallRule @PSBoundParameters)) - { - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($script:localizedData.UpdatingExistingFirewallMessage) -f $Name - ) -join '') - - # If the Group is being changed the the rule needs to be recreated - if ($PSBoundParameters.ContainsKey('Group') ` - -and ($Group -ne $FirewallRule.Group)) - { - Remove-NetFirewallRule -Name $Name - - <# - Merge the existing rule values into the PSBoundParameters - so that it can be splatted. - #> - $properties = Get-FirewallRuleProperty -FirewallRule $firewallRule - - <# - Loop through each possible property and if it is not passed as a parameter - then set the PSBoundParameter property to the exiting rule value. - #> - foreach ($parameter in $ParametersList) - { - if (-not $PSBoundParameters.ContainsKey($parameter.Name)) - { - $parameterValue = Get-FirewallPropertyValue ` - -FirewallRule $firewallRule ` - -Properties $properties ` - -Parameter $parameter - - if ($ParameterValue) - { - $null = $PSBoundParameters.Add($parameter.Name, $ParameterValue) - } - } - } - - New-NetFirewallRule @PSBoundParameters - } - else - { - <# - If the DisplayName is provided then need to remove it - And change it to NewDisplayName if it is different. - #> - if ($PSBoundParameters.ContainsKey('DisplayName')) - { - $null = $PSBoundParameters.Remove('DisplayName') - if ($DisplayName -ne $FirewallRule.DisplayName) - { - $null = $PSBoundParameters.Add('NewDisplayName', $DisplayName) - } - } - - # Set the existing Firewall rule based on specified parameters - Set-NetFirewallRule @PSBoundParameters - } - } - } - else - { - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($script:localizedData.FirewallRuleShouldExistAndDoesNotMessage) -f $Name - ) -join '') - - # Set any default parameter values - if (-not $DisplayName) - { - if (-not $PSBoundParameters.ContainsKey('DisplayName')) - { - $null = $PSBoundParameters.Add('DisplayName', $Name) - } - else - { - $PSBoundParameters.DisplayName = $Name - } - } - - # Add the new Firewall rule based on specified parameters - New-NetFirewallRule @PSBoundParameters - } - } - else - { - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($script:localizedData.FirewallRuleShouldNotExistMessage) -f $Name, $Ensure - ) -join '') - - if ($exists) - { - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($script:localizedData.FirewallRuleShouldNotExistButDoesMessage) -f $Name - ) -join '') - - # Remove the existing Firewall rule - Remove-NetFirewallRule -Name $Name - } - else - { - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($script:localizedData.FirewallRuleShouldNotExistAndDoesNotMessage) -f $Name - ) -join '') - # Do Nothing - } - } -} - -<# - .SYNOPSIS - Test if Firewall Rule is in the required state. - - .PARAMETER Name - Name of the firewall rule. - - .PARAMETER DisplayName - Localized, user-facing name of the firewall rule being created. - - .PARAMETER Group - Name of the firewall group where we want to put the firewall rule. - - .PARAMETER Ensure - Ensure that the firewall rule exists. - - .PARAMETER Enabled - Enable or Disable the supplied configuration. - - .PARAMETER Action - Allow or Block the supplied configuration. - - .PARAMETER Profile - Specifies one or more profiles to which the rule is assigned. - - .PARAMETER Direction - Direction of the connection. - - .PARAMETER RemotePort - Specific port used for filter. Specified by port number, range, or keyword. - - .PARAMETER LocalPort - Local port used for the filter. - - .PARAMETER Protocol - Specific protocol for filter. Specified by name, number, or range. - - .PARAMETER Description - Documentation for the rule. - - .PARAMETER Program - Path and filename of the program for which the rule is applied. - - .PARAMETER Service - Specifies the short name of a Windows service to which the firewall rule applies. - - .PARAMETER Authentication - Specifies that authentication is required on firewall rules. - - .PARAMETER Encryption - Specifies that encryption in authentication is required on firewall rules. - - .PARAMETER InterfaceAlias - Specifies the alias of the interface that applies to the traffic. - - .PARAMETER InterfaceType - Specifies that only network connections made through the indicated interface types are subject - to the requirements of this rule. - - .PARAMETER LocalAddress - Specifies that network packets with matching IP addresses match this rule. This parameter value - is the first end point of an IPsec rule and specifies the computers that are subject to the - requirements of this rule. This parameter value is an IPv4 or IPv6 address, hostname, subnet, - range, or the following keyword: Any. - - .PARAMETER LocalUser - Specifies the principals to which network traffic this firewall rule applies. The principals, - represented by security identifiers (SIDs) in the security descriptor definition language (SDDL) - string, are services, users, application containers, or any SID to which network traffic is - associated. - - .PARAMETER Package - Specifies the Windows Store application to which the firewall rule applies. This parameter is - specified as a security identifier (SID). - - .PARAMETER Platform - Specifies which version of Windows the associated rule applies. - - .PARAMETER RemoteAddress - Specifies that network packets with matching IP addresses match this rule. This parameter value - is the second end point of an IPsec rule and specifies the computers that are subject to the - requirements of this rule. This parameter value is an IPv4 or IPv6 address, hostname, subnet, - range, or the following keyword: Any - - .PARAMETER RemoteMachine - Specifies that matching IPsec rules of the indicated computer accounts are created. This - parameter specifies that only network packets that are authenticated as incoming from or - outgoing to a computer identified in the list of computer accounts (SID) match this rule. - This parameter value is specified as an SDDL string. - - .PARAMETER RemoteUser - Specifies that matching IPsec rules of the indicated user accounts are created. This parameter - specifies that only network packets that are authenticated as incoming from or outgoing to a - user identified in the list of user accounts match this rule. This parameter value is specified - as an SDDL string. - - .PARAMETER DynamicTransport - Specifies a dynamic transport. - - .PARAMETER EdgeTraversalPolicy - Specifies that matching firewall rules of the indicated edge traversal policy are created. - - .PARAMETER IcmpType - Specifies the ICMP type codes. - - .PARAMETER LocalOnlyMapping - Indicates that matching firewall rules of the indicated value are created. - - .PARAMETER LooseSourceMapping - Indicates that matching firewall rules of the indicated value are created. - - .PARAMETER OverrideBlockRules - Indicates that matching network traffic that would otherwise be blocked are allowed. - - .PARAMETER Owner - Specifies that matching firewall rules of the indicated owner are created. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Name, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String] - $DisplayName, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String] - $Group, - - [Parameter()] - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present', - - [Parameter()] - [ValidateSet('True', 'False')] - [String] - $Enabled, - - [Parameter()] - [ValidateSet('NotConfigured', 'Allow', 'Block')] - [String] - $Action, - - [Parameter()] - [String[]] - $Profile, - - [Parameter()] - [ValidateSet('Inbound', 'Outbound')] - [String] - $Direction, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String[]] - $RemotePort, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String[]] - $LocalPort, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String] - $Protocol, - - [Parameter()] - [String] - $Description, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String] - $Program, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String] - $Service, - - [Parameter()] - [ValidateSet('NotRequired', 'Required', 'NoEncap')] - [String] - $Authentication, - - [Parameter()] - [ValidateSet('NotRequired', 'Required', 'Dynamic')] - [String] - $Encryption, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String[]] - $InterfaceAlias, - - [Parameter()] - [ValidateSet('Any', 'Wired', 'Wireless', 'RemoteAccess')] - [String] - $InterfaceType, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String[]] - $LocalAddress, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String] - $LocalUser, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String] - $Package, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String[]] - $Platform, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String[]] - $RemoteAddress, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String] - $RemoteMachine, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String] - $RemoteUser, - - [Parameter()] - [ValidateSet('Any', 'ProximityApps', 'ProximitySharing', 'WifiDirectPrinting', 'WifiDirectDisplay', 'WifiDirectDevices')] - [String] - $DynamicTransport, - - [Parameter()] - [ValidateSet('Block', 'Allow', 'DeferToUser', 'DeferToApp')] - [String] - $EdgeTraversalPolicy, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String[]] - $IcmpType, - - [Parameter()] - [Boolean] - $LocalOnlyMapping, - - [Parameter()] - [Boolean] - $LooseSourceMapping, - - [Parameter()] - [Boolean] - $OverrideBlockRules, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [String] - $Owner - ) - - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($script:localizedData.CheckingFirewallRuleMessage) -f $Name - ) -join '') - - # Remove any parameters not used in Splats - $null = $PSBoundParameters.Remove('Ensure') - - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($script:localizedData.FindFirewallRuleMessage) -f $Name - ) -join '') - - $firewallRule = Get-FirewallRule -Name $Name - - $exists = ($null -ne $firewallRule) - - if (-not $exists) - { - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($script:localizedData.FirewallRuleDoesNotExistMessage) -f $Name - ) -join '') - - # Returns whether complies with $Ensure - $returnValue = ($false -eq ($Ensure -eq 'Present')) - - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($script:localizedData.CheckingFirewallReturningMessage) -f $Name, $returnValue - ) -join '') - - return $returnValue - } - - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($script:localizedData.CheckFirewallRuleParametersMessage) -f $Name - ) -join '') - - $desiredConfigurationMatch = Test-RuleProperties -FirewallRule $firewallRule @PSBoundParameters - - # Returns whether or not $exists complies with $Ensure - $returnValue = ($desiredConfigurationMatch -and $exists -eq ($Ensure -eq 'Present')) - - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($script:localizedData.CheckingFirewallReturningMessage) -f $Name, $returnValue - ) -join '') - - return $returnValue -} - -#region HelperFunctions -<# - .SYNOPSIS - Tests if the properties in the supplied Firewall Rule match the expected parameters passed. - - .PARAMETER FirewallRule - The firewall rule object to compare the properties of. - - .PARAMETER Name - Name of the firewall rule. - - .PARAMETER DisplayName - Localized, user-facing name of the firewall rule being created. - - .PARAMETER Group - Name of the firewall group where we want to put the firewall rule. - - .PARAMETER Ensure - Ensure that the firewall rule exists. - - .PARAMETER Enabled - Enable or Disable the supplied configuration. - - .PARAMETER Action - Allow or Block the supplied configuration. - - .PARAMETER Profile - Specifies one or more profiles to which the rule is assigned. - - .PARAMETER Direction - Direction of the connection. - - .PARAMETER RemotePort - Specific port used for filter. Specified by port number, range, or keyword. - - .PARAMETER LocalPort - Local port used for the filter. - - .PARAMETER Protocol - Specific protocol for filter. Specified by name, number, or range. - - .PARAMETER Description - Documentation for the rule. - - .PARAMETER Program - Path and filename of the program for which the rule is applied. - - .PARAMETER Service - Specifies the short name of a Windows service to which the firewall rule applies. - - .PARAMETER Authentication - Specifies that authentication is required on firewall rules. - - .PARAMETER Encryption - Specifies that encryption in authentication is required on firewall rules. - - .PARAMETER InterfaceAlias - Specifies the alias of the interface that applies to the traffic. - - .PARAMETER InterfaceType - Specifies that only network connections made through the indicated interface types are subject - to the requirements of this rule. - - .PARAMETER LocalAddress - Specifies that network packets with matching IP addresses match this rule. This parameter value - is the first end point of an IPsec rule and specifies the computers that are subject to the - requirements of this rule. This parameter value is an IPv4 or IPv6 address, hostname, subnet, - range, or the following keyword: Any. - - .PARAMETER LocalUser - Specifies the principals to which network traffic this firewall rule applies. The principals, - represented by security identifiers (SIDs) in the security descriptor definition language (SDDL) - string, are services, users, application containers, or any SID to which network traffic is - associated. - - .PARAMETER Package - Specifies the Windows Store application to which the firewall rule applies. This parameter is - specified as a security identifier (SID). - - .PARAMETER Platform - Specifies which version of Windows the associated rule applies. - - .PARAMETER RemoteAddress - Specifies that network packets with matching IP addresses match this rule. This parameter value - is the second end point of an IPsec rule and specifies the computers that are subject to the - requirements of this rule. This parameter value is an IPv4 or IPv6 address, hostname, subnet, - range, or the following keyword: Any - - .PARAMETER RemoteMachine - Specifies that matching IPsec rules of the indicated computer accounts are created. This - parameter specifies that only network packets that are authenticated as incoming from or - outgoing to a computer identified in the list of computer accounts (SID) match this rule. - This parameter value is specified as an SDDL string. - - .PARAMETER RemoteUser - Specifies that matching IPsec rules of the indicated user accounts are created. This parameter - specifies that only network packets that are authenticated as incoming from or outgoing to a - user identified in the list of user accounts match this rule. This parameter value is specified - as an SDDL string. - - .PARAMETER DynamicTransport - Specifies a dynamic transport. - - .PARAMETER EdgeTraversalPolicy - Specifies that matching firewall rules of the indicated edge traversal policy are created. - - .PARAMETER IcmpType - Specifies the ICMP type codes. - - .PARAMETER LocalOnlyMapping - Indicates that matching firewall rules of the indicated value are created. - - .PARAMETER LooseSourceMapping - Indicates that matching firewall rules of the indicated value are created. - - .PARAMETER OverrideBlockRules - Indicates that matching network traffic that would otherwise be blocked are allowed. - - .PARAMETER Owner - Specifies that matching firewall rules of the indicated owner are created. -#> -function Test-RuleProperties -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - $FirewallRule, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Name, - - [Parameter()] - [String] - $DisplayName, - - [Parameter()] - [String] - $Group, - - [Parameter()] - [String] - $DisplayGroup, - - [Parameter()] - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present', - - [Parameter()] - [ValidateSet('True', 'False')] - [String] - $Enabled, - - [Parameter()] - [ValidateSet('NotConfigured', 'Allow', 'Block')] - [String] - $Action, - - [Parameter()] - [String[]] - $Profile, - - [Parameter()] - [ValidateSet('Inbound', 'Outbound')] - [String] - $Direction, - - [Parameter()] - [String[]] - $RemotePort, - - [Parameter()] - [String[]] - $LocalPort, - - [Parameter()] - [String] - $Protocol, - - [Parameter()] - [String] - $Description, - - [Parameter()] - [String] - $Program, - - [Parameter()] - [String] - $Service, - - [Parameter()] - [ValidateSet('NotRequired', 'Required', 'NoEncap')] - [String] - $Authentication, - - [Parameter()] - [ValidateSet('NotRequired', 'Required', 'Dynamic')] - [String] - $Encryption, - - [Parameter()] - [String[]] - $InterfaceAlias, - - [Parameter()] - [ValidateSet('Any', 'Wired', 'Wireless', 'RemoteAccess')] - [String] - $InterfaceType, - - [Parameter()] - [String[]] - $LocalAddress, - - [Parameter()] - [String] - $LocalUser, - - [Parameter()] - [String] - $Package, - - [Parameter()] - [String[]] - $Platform, - - [Parameter()] - [String[]] - $RemoteAddress, - - [Parameter()] - [String] - $RemoteMachine, - - [Parameter()] - [String] - $RemoteUser, - - [Parameter()] - [ValidateSet('Any', 'ProximityApps', 'ProximitySharing', 'WifiDirectPrinting', 'WifiDirectDisplay', 'WifiDirectDevices')] - [String] - $DynamicTransport, - - [Parameter()] - [ValidateSet('Block', 'Allow', 'DeferToUser', 'DeferToApp')] - [String] - $EdgeTraversalPolicy, - - [Parameter()] - [String[]] - $IcmpType, - - [Parameter()] - [Boolean] - $LocalOnlyMapping, - - [Parameter()] - [Boolean] - $LooseSourceMapping, - - [Parameter()] - [Boolean] - $OverrideBlockRules, - - [Parameter()] - [String] - $Owner - ) - - $properties = Get-FirewallRuleProperty -FirewallRule $FirewallRule - - $desiredConfigurationMatch = $true - - # Loop through the $script:parameterList array and compare the source - # with the value of each parameter. If different then - # set $desiredConfigurationMatch to false. - foreach ($parameter in $script:parameterList) - { - $parameterValue = Get-FirewallPropertyValue ` - -FirewallRule $firewallRule ` - -Properties $properties ` - -Parameter $parameter - - $parameterNew = (Get-Variable -Name ($parameter.Name)).Value - - switch -Wildcard ($parameter.Type) - { - 'String' - { - # Perform a plain string comparison. - if ($parameterNew -and ($parameterValue -ne $parameterNew)) - { - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($script:localizedData.PropertyNoMatchMessage) ` - -f $parameter.Name, $parameterValue, $parameterNew - ) -join '') - - $desiredConfigurationMatch = $false - } - } - - 'Boolean' - { - # Perform a boolean comparison. - if ($parameterNew -and ($parameterValue -ne $parameterNew)) - { - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($script:localizedData.PropertyNoMatchMessage) ` - -f $parameter.Name, $parameterValue, $parameterNew - ) -join '') - $desiredConfigurationMatch = $false - } - } - - 'Array*' - { - # Array comparison uses Compare-Object - if ($null -eq $parameterValue) - { - $parameterValue = @() - } - - if ($parameter.Delimiter) - { - $parameterValue = $parameterValue -split $parameter.Delimiter - } - - if ($parameter.Type -eq 'IPArray') - { - <# - IPArray comparison uses Compare-Object, except needs to convert any IP addresses - that use CIDR notation to use Subnet Mask notification because this is the - format that the Get-NetFirewallAddressFilter will return the IP addresses in - even if they were set using CIDR notation. - #> - $parameterNew = Convert-CIDRToSubhetMask -Address $parameterNew - } - - if ($parameterNew ` - -and ((Compare-Object ` - -ReferenceObject $parameterValue ` - -DifferenceObject $parameterNew).Count -ne 0)) - { - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($script:localizedData.PropertyNoMatchMessage) ` - -f $parameter.Name, ($parameterValue -join ','), ($parameterNew -join ',') - ) -join '') - $desiredConfigurationMatch = $false - } - } - } - } - - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($script:localizedData.TestFirewallRuleReturningMessage) -f $Name, $desiredConfigurationMatch - ) -join '') - return $desiredConfigurationMatch -} - -<# - .SYNOPSIS - Returns a Firewall object matching the specified name. - - .PARAMETER Name - The name of the Firewall Rule to Retrieve. -#> -function Get-FirewallRule -{ - [CmdletBinding()] - [OutputType([Microsoft.Management.Infrastructure.CimInstance])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Name - ) - - $firewallRule = @(Get-NetFirewallRule -Name $Name -ErrorAction SilentlyContinue) - - if (-not $firewallRule) - { - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($script:localizedData.FirewallRuleNotFoundMessage) -f $Name - ) -join '') - return $null - } - - <# - If more than one rule is returned for a name, then throw an exception - because this should not be possible. - #> - if ($firewallRule.Count -gt 1) - { - New-InvalidOperationException ` - -Message ($LocalizedData.RuleNotUniqueError -f $firewallRule.Count, $Name) - } - - # The array will only contain a single rule so only return the first one (not the array) - return $firewallRule[0] -} - -<# - .SYNOPSIS - Returns a Hashtable containing the component Firewall objects for the specified Firewall Rule. - - .PARAMETER FirewallRule - The firewall rule object to pull the additional firewall objects for. -#> -function Get-FirewallRuleProperty -{ - [CmdletBinding()] - [OutputType([HashTable])] - param - ( - [Parameter(Mandatory = $true)] - $FirewallRule - ) - - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($script:localizedData.GetAllPropertiesMessage) - ) -join '') - - return @{ - AddressFilters = @(Get-NetFirewallAddressFilter -AssociatedNetFirewallRule $FirewallRule) - ApplicationFilters = @(Get-NetFirewallApplicationFilter -AssociatedNetFirewallRule $FirewallRule) - InterfaceFilters = @(Get-NetFirewallInterfaceFilter -AssociatedNetFirewallRule $FirewallRule) - InterfaceTypeFilters = @(Get-NetFirewallInterfaceTypeFilter -AssociatedNetFirewallRule $FirewallRule) - PortFilters = @(Get-NetFirewallPortFilter -AssociatedNetFirewallRule $FirewallRule) - Profile = @(Get-NetFirewallProfile -AssociatedNetFirewallRule $FirewallRule) - SecurityFilters = @(Get-NetFirewallSecurityFilter -AssociatedNetFirewallRule $FirewallRule) - ServiceFilters = @(Get-NetFirewallServiceFilter -AssociatedNetFirewallRule $FirewallRule) - } -} - -<# - .SYNOPSIS - Looks up a Firewall Property value using the specified parameterList entry. - - .PARAMETER FirewallRule - The firewall rule object to pull the property from. - - .PARAMETER Properties - The additional firewall objects to pull the property from. - - .PARAMETER Parameter - The entry from the ParameterList table used to retireve the parameter for. -#> -function Get-FirewallPropertyValue -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - $FirewallRule, - - [Parameter(Mandatory = $true)] - $Properties, - - [Parameter(Mandatory = $true)] - $Parameter - ) - - if ($Parameter.Property) - { - return (Get-Variable ` - -Name ($Parameter.Variable)).value.$($Parameter.Property).$($Parameter.Name) - } - else - { - return (Get-Variable ` - -Name ($Parameter.Variable)).value.$($Parameter.Name) - } -} -#endregion - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xFirewall/en-US/MSFT_xFirewall.strings.psd1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xFirewall/en-US/MSFT_xFirewall.strings.psd1 deleted file mode 100644 index fac797cd..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xFirewall/en-US/MSFT_xFirewall.strings.psd1 +++ /dev/null @@ -1,24 +0,0 @@ -# Localized resources for MSFT_xFirewall - -ConvertFrom-StringData @' - GettingFirewallRuleMessage = Getting firewall rule with Name '{0}'. - FirewallRuleDoesNotExistMessage = Firewall rule with Name '{0}' does not exist. - FirewallParameterValueMessage = Firewall rule with Name '{0}' parameter {1} is '{2}'. - ApplyingFirewallRuleMessage = Applying settings for firewall rule with Name '{0}'. - FindFirewallRuleMessage = Find firewall rule with Name '{0}'. - FirewallRuleShouldExistMessage = We want the firewall rule with Name '{0}' to exist since Ensure is set to {1}. - FirewallRuleShouldExistAndDoesMessage = We want the firewall rule with Name '{0}' to exist and it does. Check for valid properties. - CheckFirewallRuleParametersMessage = Check each defined parameter against the existing firewall rule with Name '{0}'. - UpdatingExistingFirewallMessage = Updating existing firewall rule with Name '{0}'. - FirewallRuleShouldExistAndDoesNotMessage = We want the firewall rule with Name '{0}' to exist, but it does not. - FirewallRuleShouldNotExistMessage = We do not want the firewall rule with Name '{0}' to exist since Ensure is set to {1}. - FirewallRuleShouldNotExistButDoesMessage = We do not want the firewall rule with Name '{0}' to exist, but it does. Removing it. - FirewallRuleShouldNotExistAndDoesNotMessage = We do not want the firewall rule with Name '{0}' to exist, and it does not. - CheckingFirewallRuleMessage = Checking settings for firewall rule with Name '{0}'. - CheckingFirewallReturningMessage = Check Firewall rule with Name '{0}' returning {1}. - PropertyNoMatchMessage = {0} property value '{1}' does not match desired state '{2}'. - TestFirewallRuleReturningMessage = Test Firewall rule with Name '{0}' returning {1}. - FirewallRuleNotFoundMessage = No Firewall Rule found with Name '{0}'. - GetAllPropertiesMessage = Get all the properties and add filter info to rule map. - RuleNotUniqueError = {0} Firewall Rules with the Name '{1}' were found. Only one expected. -'@ diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xFirewallProfile/MSFT_xFirewallProfile.data.psd1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xFirewallProfile/MSFT_xFirewallProfile.data.psd1 deleted file mode 100644 index 6c012129..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xFirewallProfile/MSFT_xFirewallProfile.data.psd1 +++ /dev/null @@ -1,72 +0,0 @@ -@{ - ParameterList = @( - @{ - Name = 'AllowInboundRules' - Type = 'String' - }, - @{ - Name = 'AllowLocalFirewallRules' - Type = 'String' - }, - @{ - Name = 'AllowLocalIPsecRules' - Type = 'String' - }, - @{ - Name = 'AllowUnicastResponseToMulticast' - Type = 'String' - }, - @{ - Name = 'AllowUserApps' - Type = 'String' - }, - @{ - Name = 'AllowUserPorts' - Type = 'String' - }, - @{ - Name = 'DefaultInboundAction' - Type = 'String' - }, - @{ - Name = 'DefaultOutboundAction' - Type = 'String' - }, - @{ - Name = 'DisabledInterfaceAliases' - Type = 'Array' - }, - @{ - Name = 'Enabled' - Type = 'String' - }, - @{ - Name = 'EnableStealthModeForIPsec' - Type = 'String' - }, - @{ - Name = 'LogAllowed' - Type = 'String' - }, - @{ - Name = 'LogBlocked' - Type = 'String' - }, - @{ - Name = 'LogFileName' - Type = 'String' - }, - @{ - Name = 'LogIgnored' - Type = 'String' - }, - @{ - Name = 'LogMaxSizeKilobytes' - Type = 'Uint64' - } - @{ - Name = 'NotifyOnListen' - Type = 'String' - } - ) -} diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xFirewallProfile/MSFT_xFirewallProfile.psm1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xFirewallProfile/MSFT_xFirewallProfile.psm1 deleted file mode 100644 index c0bb011a..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xFirewallProfile/MSFT_xFirewallProfile.psm1 +++ /dev/null @@ -1,475 +0,0 @@ -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Networking Common Modules -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` - -ChildPath 'NetworkingDsc.Common.psm1')) - -# Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` - -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$LocalizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xFirewallProfile' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# - This is an array of all the parameters used by this resource. -#> -$resourceData = Import-LocalizedData ` - -BaseDirectory $PSScriptRoot ` - -FileName 'MSFT_xFirewallProfile.data.psd1' - -# This must be a script parameter so that it is accessible -$script:parameterList = $resourceData.ParameterList - -<# - .SYNOPSIS - Returns the current Firewall Profile. - - .PARAMETER Name - The name of the firewall profile to configure. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Domain', 'Public', 'Private')] - [System.String] - $Name - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.GettingFirewallProfileMessage) ` - -f $Name - ) -join '' ) - - # Get the current Dns Client Global Settings - $netFirewallProfile = Get-NetFirewallProfile -Name $Name ` - -ErrorAction Stop - - # Generate the return object. - $returnValue = @{ - Name = $Name - } - - foreach ($parameter in $script:parameterList) - { - $returnValue += @{ - $parameter.Name = $netFirewallProfile.$($parameter.name) - } - } # foreach - - return $returnValue -} # Get-TargetResource - - -<# - .SYNOPSIS - Sets the Firewall Profile. - - .PARAMETER Name - The name of the firewall profile to configure. - - .PARAMETER AllowInboundRules - Specifies that the firewall blocks inbound traffic. - - .PARAMETER AllowLocalFirewallRules - Specifies that the local firewall rules should be merged into the effective policy - along with Group Policy settings. - - .PARAMETER AllowLocalIPsecRules - Specifies that the local IPsec rules should be merged into the effective policy - along with Group Policy settings. - - .PARAMETER AllowUnicastResponseToMulticast - Allows unicast responses to multi-cast traffic. - - .PARAMETER AllowUserApps - Specifies that traffic from local user applications is allowed through the firewall. - - .PARAMETER AllowUserPorts - Specifies that traffic is allowed through local user ports. - - .PARAMETER DefaultInboundAction - Specifies how to filter inbound traffic. - - .PARAMETER DefaultOutboundAction - Specifies how to filter outbound traffic. - - .PARAMETER DisabledInterfaceAliases - Specifies a list of interfaces on which firewall settings are excluded. - - .PARAMETER Enabled - Specifies that devolution is activated. - - .PARAMETER EnableStealthModeForIPsec - Enables stealth mode for IPsec traffic. - - .PARAMETER LogAllowed - Specifies how to log the allowed packets in the location specified by the - LogFileName parameter. - - .PARAMETER LogBlocked - Specifies how to log the dropped packets in the location specified by the - LogFileName parameter. - - .PARAMETER LogFileName - Specifies the path and filename of the file to which Windows Server writes log entries. - - .PARAMETER LogIgnored - Specifies how to log the ignored packets in the location specified by the LogFileName - parameter. - - .PARAMETER LogMaxSizeKilobytes - Specifies the maximum file size of the log, in kilobytes. The acceptable values for - this parameter are: 1 through 32767. - - .PARAMETER NotifyOnListen - Allows the notification of listening for inbound connections by a service. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Domain', 'Public', 'Private')] - [System.String] - $Name, - - [Parameter()] - [ValidateSet('True', 'False', 'NotConfigured')] - [System.String] - $AllowInboundRules, - - [Parameter()] - [ValidateSet('True', 'False', 'NotConfigured')] - [System.String] - $AllowLocalFirewallRules, - - [Parameter()] - [ValidateSet('True', 'False', 'NotConfigured')] - [System.String] - $AllowLocalIPsecRules, - - [Parameter()] - [ValidateSet('True', 'False', 'NotConfigured')] - [System.String] - $AllowUnicastResponseToMulticast, - - [Parameter()] - [ValidateSet('True', 'False', 'NotConfigured')] - [System.String] - $AllowUserApps, - - [Parameter()] - [ValidateSet('True', 'False', 'NotConfigured')] - [System.String] - $AllowUserPorts, - - [Parameter()] - [ValidateSet('Block', 'Allow', 'NotConfigured')] - [System.String] - $DefaultInboundAction, - - [Parameter()] - [ValidateSet('Block', 'Allow', 'NotConfigured')] - [System.String] - $DefaultOutboundAction, - - [Parameter()] - [System.String[]] - $DisabledInterfaceAliases, - - [Parameter()] - [ValidateSet('True', 'False', 'NotConfigured')] - [System.String] - $Enabled, - - [Parameter()] - [ValidateSet('True', 'False', 'NotConfigured')] - [System.String] - $EnableStealthModeForIPsec, - - [Parameter()] - [ValidateSet('True', 'False', 'NotConfigured')] - [System.String] - $LogAllowed, - - [Parameter()] - [ValidateSet('True', 'False', 'NotConfigured')] - [System.String] - $LogBlocked, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $LogFileName, - - [Parameter()] - [ValidateSet('True', 'False', 'NotConfigured')] - [System.String] - $LogIgnored, - - [Parameter()] - [ValidateRange(1,32767)] - [System.Uint64] - $LogMaxSizeKilobytes, - - [Parameter()] - [ValidateSet('True', 'False', 'NotConfigured')] - [System.String] - $NotifyOnListen - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.SettingFirewallProfileMessage) ` - -f $Name - ) -join '' ) - - # Get the current Firewall Profile Settings - $netFirewallProfile = Get-NetFirewallProfile -Name $Name ` - -ErrorAction Stop - - # Generate a list of parameters that will need to be changed. - $changeParameters = @{} - - foreach ($parameter in $script:parameterList) - { - $parameterSourceValue = $netFirewallProfile.$($parameter.name) - $parameterNewValue = (Get-Variable -Name ($parameter.name)).Value - - if ($PSBoundParameters.ContainsKey($parameter.Name) ` - -and (Compare-Object -ReferenceObject $parameterSourceValue -DifferenceObject $parameterNewValue -SyncWindow 0)) - { - $changeParameters += @{ - $($parameter.name) = $parameterNewValue - } - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.FirewallProfileUpdateParameterMessage) ` - -f $Name,$parameter.Name,$parameterNewValue - ) -join '' ) - } # if - } # foreach - - if ($changeParameters.Count -gt 0) - { - # Update any parameters that were identified as different - $null = Set-NetFirewallProfile -Name $Name ` - @ChangeParameters ` - -ErrorAction Stop - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.FirewallProfileUpdatedMessage) ` - -f $Name - ) -join '' ) - } # if -} # Set-TargetResource - -<# - .SYNOPSIS - Tests the state of Firewall Profile. - - .PARAMETER Name - The name of the firewall profile to configure. - - .PARAMETER AllowInboundRules - Specifies that the firewall blocks inbound traffic. - - .PARAMETER AllowLocalFirewallRules - Specifies that the local firewall rules should be merged into the effective policy - along with Group Policy settings. - - .PARAMETER AllowLocalIPsecRules - Specifies that the local IPsec rules should be merged into the effective policy - along with Group Policy settings. - - .PARAMETER AllowUnicastResponseToMulticast - Allows unicast responses to multi-cast traffic. - - .PARAMETER AllowUserApps - Specifies that traffic from local user applications is allowed through the firewall. - - .PARAMETER AllowUserPorts - Specifies that traffic is allowed through local user ports. - - .PARAMETER DefaultInboundAction - Specifies how to filter inbound traffic. - - .PARAMETER DefaultOutboundAction - Specifies how to filter outbound traffic. - - .PARAMETER DisabledInterfaceAliases - Specifies a list of interfaces on which firewall settings are excluded. - - .PARAMETER Enabled - Specifies that devolution is activated. - - .PARAMETER EnableStealthModeForIPsec - Enables stealth mode for IPsec traffic. - - .PARAMETER LogAllowed - Specifies how to log the allowed packets in the location specified by the - LogFileName parameter. - - .PARAMETER LogBlocked - Specifies how to log the dropped packets in the location specified by the - LogFileName parameter. - - .PARAMETER LogFileName - Specifies the path and filename of the file to which Windows Server writes log entries. - - .PARAMETER LogIgnored - Specifies how to log the ignored packets in the location specified by the LogFileName - parameter. - - .PARAMETER LogMaxSizeKilobytes - Specifies the maximum file size of the log, in kilobytes. The acceptable values for - this parameter are: 1 through 32767. - - .PARAMETER NotifyOnListen - Allows the notification of listening for inbound connections by a service. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Domain', 'Public', 'Private')] - [System.String] - $Name, - - [Parameter()] - [ValidateSet('True', 'False', 'NotConfigured')] - [System.String] - $AllowInboundRules, - - [Parameter()] - [ValidateSet('True', 'False', 'NotConfigured')] - [System.String] - $AllowLocalFirewallRules, - - [Parameter()] - [ValidateSet('True', 'False', 'NotConfigured')] - [System.String] - $AllowLocalIPsecRules, - - [Parameter()] - [ValidateSet('True', 'False', 'NotConfigured')] - [System.String] - $AllowUnicastResponseToMulticast, - - [Parameter()] - [ValidateSet('True', 'False', 'NotConfigured')] - [System.String] - $AllowUserApps, - - [Parameter()] - [ValidateSet('True', 'False', 'NotConfigured')] - [System.String] - $AllowUserPorts, - - [Parameter()] - [ValidateSet('Block', 'Allow', 'NotConfigured')] - [System.String] - $DefaultInboundAction, - - [Parameter()] - [ValidateSet('Block', 'Allow', 'NotConfigured')] - [System.String] - $DefaultOutboundAction, - - [Parameter()] - [System.String[]] - $DisabledInterfaceAliases, - - [Parameter()] - [ValidateSet('True', 'False', 'NotConfigured')] - [System.String] - $Enabled, - - [Parameter()] - [ValidateSet('True', 'False', 'NotConfigured')] - [System.String] - $EnableStealthModeForIPsec, - - [Parameter()] - [ValidateSet('True', 'False', 'NotConfigured')] - [System.String] - $LogAllowed, - - [Parameter()] - [ValidateSet('True', 'False', 'NotConfigured')] - [System.String] - $LogBlocked, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $LogFileName, - - [Parameter()] - [ValidateSet('True', 'False', 'NotConfigured')] - [System.String] - $LogIgnored, - - [Parameter()] - [ValidateRange(1,32767)] - [System.Uint64] - $LogMaxSizeKilobytes, - - [Parameter()] - [ValidateSet('True', 'False', 'NotConfigured')] - [System.String] - $NotifyOnListen - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.TestingFirewallProfileMessage) ` - -f $Name - ) -join '' ) - - # Flag to signal whether settings are correct - [Boolean] $desiredConfigurationMatch = $true - - # Get the current Dns Client Global Settings - $netFirewallProfile = Get-NetFirewallProfile -Name $Name ` - -ErrorAction Stop - - # Check each parameter - foreach ($parameter in $script:parameterList) - { - $parameterSourceValue = $netFirewallProfile.$($parameter.name) - $parameterNewValue = (Get-Variable -Name ($parameter.name)).Value - - if ($PSBoundParameters.ContainsKey($parameter.Name) ` - -and (Compare-Object -ReferenceObject $parameterSourceValue -DifferenceObject $parameterNewValue -SyncWindow 0)) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.FirewallProfileParameterNeedsUpdateMessage) ` - -f $Name,$parameter.Name,$parameterSourceValue,$parameterNewValue - ) -join '' ) - - $desiredConfigurationMatch = $false - } # if - } # foreach - - return $desiredConfigurationMatch -} # Test-TargetResource - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xFirewallProfile/MSFT_xFirewallProfile.schema.mof b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xFirewallProfile/MSFT_xFirewallProfile.schema.mof deleted file mode 100644 index cea96009..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xFirewallProfile/MSFT_xFirewallProfile.schema.mof +++ /dev/null @@ -1,22 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xFirewallProfile")] -class MSFT_xFirewallProfile : OMI_BaseResource -{ - [Key, Description("The name of the firewall profile to configure."), ValueMap{"Domain", "Public", "Private"}, Values{"Domain", "Public", "Private"}] String Name; - [Write, Description("Specifies that the firewall blocks inbound traffic."), ValueMap{"True", "False", "NotConfigured"}, Values{"True", "False", "NotConfigured"}] String AllowInboundRules; - [Write, Description("Specifies that the local firewall rules should be merged into the effective policy along with Group Policy settings."), ValueMap{"True", "False", "NotConfigured"}, Values{"True", "False", "NotConfigured"}] String AllowLocalFirewallRules; - [Write, Description("Specifies that the local IPsec rules should be merged into the effective policy along with Group Policy settings."), ValueMap{"True", "False", "NotConfigured"}, Values{"True", "False", "NotConfigured"}] String AllowLocalIPsecRules; - [Write, Description("Allows unicast responses to multi-cast traffic."), ValueMap{"True", "False", "NotConfigured"}, Values{"True", "False", "NotConfigured"}] String AllowUnicastResponseToMulticast; - [Write, Description("Specifies that traffic from local user applications is allowed through the firewall."), ValueMap{"True", "False", "NotConfigured"}, Values{"True", "False", "NotConfigured"}] String AllowUserApps; - [Write, Description("Specifies that traffic is allowed through local user ports."), ValueMap{"True", "False", "NotConfigured"}, Values{"True", "False", "NotConfigured"}] String AllowUserPorts; - [Write, Description("Specifies how to filter inbound traffic."), ValueMap{"Block", "Allow", "NotConfigured"}, Values{"Block", "Allow", "NotConfigured"}] String DefaultInboundAction; - [Write, Description("Specifies how to filter outbound traffic."), ValueMap{"Block", "Allow", "NotConfigured"}, Values{"Block", "Allow", "NotConfigured"}] String DefaultOutboundAction; - [Write, Description("Specifies a list of interfaces on which firewall settings are excluded.")] String DisabledInterfaceAliases[]; - [Write, Description("Specifies that devolution is activated."), ValueMap{"True", "False", "NotConfigured"}, Values{"True", "False", "NotConfigured"}] String Enabled; - [Write, Description("Enables stealth mode for IPsec traffic."), ValueMap{"True", "False", "NotConfigured"}, Values{"True", "False", "NotConfigured"}] String EnableStealthModeForIPsec; - [Write, Description("Specifies how to log the allowed packets in the location specified by the LogFileName parameter."), ValueMap{"True", "False", "NotConfigured"}, Values{"True", "False", "NotConfigured"}] String LogAllowed; - [Write, Description("Specifies how to log the dropped packets in the location specified by the LogFileName parameter."), ValueMap{"True", "False", "NotConfigured"}, Values{"True", "False", "NotConfigured"}] String LogBlocked; - [Write, Description("Specifies the path and filename of the file to which Windows Server writes log entries.")] String LogFileName; - [Write, Description("Specifies how to log the ignored packets in the location specified by the LogFileName parameter."), ValueMap{"True", "False", "NotConfigured"}, Values{"True", "False", "NotConfigured"}] String LogIgnored; - [Write, Description("Specifies the maximum file size of the log, in kilobytes. The acceptable values for this parameter are: 1 through 32767.")] UInt64 LogMaxSizeKilobytes; - [Write, Description("Allows the notification of listening for inbound connections by a service."), ValueMap{"True", "False", "NotConfigured"}, Values{"True", "False", "NotConfigured"}] String NotifyOnListen; -}; diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xFirewallProfile/en-US/MSFT_xFirewallProfile.strings.psd1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xFirewallProfile/en-US/MSFT_xFirewallProfile.strings.psd1 deleted file mode 100644 index 7ce3dbee..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xFirewallProfile/en-US/MSFT_xFirewallProfile.strings.psd1 +++ /dev/null @@ -1,10 +0,0 @@ -# Localized resources for MSFT_xFirewallProfile - -ConvertFrom-StringData @' - GettingFirewallProfileMessage = Getting Firewall {0} Profile. - SettingFirewallProfileMessage = Setting Firewall {0} Profile. - FirewallProfileUpdateParameterMessage = Setting Firewall {0} Profile parameter {1} to "{1}". - FirewallProfileUpdatedMessage = Setting Firewall {0} Profile updated. - TestingFirewallProfileMessage = Testing Firewall {0} Profile. - FirewallProfileParameterNeedsUpdateMessage = Firewall {0} Profile "{1}" is "{2}" but should be "{3}". Change required. -'@ diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xHostsFile/MSFT_xHostsFile.psm1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xHostsFile/MSFT_xHostsFile.psm1 deleted file mode 100644 index 38acb9e7..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xHostsFile/MSFT_xHostsFile.psm1 +++ /dev/null @@ -1,266 +0,0 @@ -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Networking Common Modules -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` - -ChildPath 'NetworkingDsc.Common.psm1')) - -# Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` - -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$localizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xHostsFile' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# - .SYNOPSIS - Returns the current state of a hosts file entry. - - .PARAMETER HostName - Specifies the name of the computer that will be mapped to an IP address. - - .PARAMETER IPAddress - Specifies the IP Address that should be mapped to the host name. - - .PARAMETER Ensure - Specifies if the hosts file entry should be created or deleted. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $HostName, - - [System.String] - $IPAddress, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present" - ) - - Write-Verbose -Message ($LocalizedData.StartingGet -f $HostName) - - $result = Get-HostEntry -HostName $HostName - - if ($null -ne $result) - { - return @{ - HostName = $result.HostName - IPAddress = $result.IPAddress - Ensure = "Present" - } - } - else - { - return @{ - HostName = $HostName - IPAddress = $null - Ensure = "Absent" - } - } -} - -<# - .SYNOPSIS - Adds, updates or removes a hosts file entry. - - .PARAMETER HostName - Specifies the name of the computer that will be mapped to an IP address. - - .PARAMETER IPAddress - Specifies the IP Address that should be mapped to the host name. - - .PARAMETER Ensure - Specifies if the hosts file entry should be created or deleted. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $HostName, - - [System.String] - $IPAddress, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present" - ) - - $hostPath = "$env:windir\System32\drivers\etc\hosts" - $currentValues = Get-TargetResource @PSBoundParameters - - Write-Verbose -Message ($LocalizedData.StartingSet -f $HostName) - - if ($Ensure -eq "Present" -and $PSBoundParameters.ContainsKey("IPAddress") -eq $false) - { - New-InvalidArgumentException ` - -Message $($($LocalizedData.UnableToEnsureWithoutIP) -f $Address,$AddressFamily) ` - -ArgumentName 'IPAddress' - } - - if ($currentValues.Ensure -eq "Absent" -and $Ensure -eq "Present") - { - Write-Verbose -Message ($LocalizedData.CreateNewEntry -f $HostName) - Add-Content -Path $hostPath -Value "`r`n$IPAddress`t$HostName" - } - else - { - $hosts = Get-Content -Path $hostPath - $replace = $hosts | Where-Object { - [System.String]::IsNullOrEmpty($_) -eq $false -and $_.StartsWith('#') -eq $false - } | Where-Object { $_ -like "*$HostName*" } - - $multiLineEntry = $false - $data = $replace -split '\s+' - if ($data.Length -gt 2) - { - $multiLineEntry = $true - } - - if ($Ensure -eq "Present") - { - Write-Verbose -Message ($LocalizedData.UpdateExistingEntry -f $HostName) - if ($multiLineEntry -eq $true) - { - $newReplaceLine = $replace -replace $HostName, "" - $hosts = $hosts -replace $replace, $newReplaceLine - $hosts += "$IPAddress`t$HostName" - } - else - { - $hosts = $hosts -replace $replace, "$IPAddress`t$HostName" - } - } - else - { - Write-Verbose -Message ($LocalizedData.RemoveEntry -f $HostName) - if ($multiLineEntry -eq $true) - { - $newReplaceLine = $replace -replace $HostName, "" - $hosts = $hosts -replace $replace, $newReplaceLine - } - else - { - $hosts = $hosts -replace $replace, "" - } - } - - Set-Content -Path $hostPath -Value $hosts - } -} - -<# - .SYNOPSIS - Tests the current state of a hosts file entry. - - .PARAMETER HostName - Specifies the name of the computer that will be mapped to an IP address. - - .PARAMETER IPAddress - Specifies the IP Address that should be mapped to the host name. - - .PARAMETER Ensure - Specifies if the hosts file entry should be created or deleted. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $HostName, - - [System.String] - $IPAddress, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present" - ) - - $currentValues = Get-TargetResource @PSBoundParameters - Write-Verbose -Message ($LocalizedData.StartingTest -f $HostName) - - if ($Ensure -ne $currentValues.Ensure) - { - return $false - } - - if ($Ensure -eq "Present" -and $IPAddress -ne $currentValues.IPAddress) - { - return $false - } - return $true -} - -function Get-HostEntry -{ - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $HostName - ) - - $allHosts = Get-Content -Path "$env:windir\System32\drivers\etc\hosts" | - Where-Object { [System.String]::IsNullOrEmpty($_) -eq $false -and $_.StartsWith('#') -eq $false } - foreach ($hosts in $allHosts) - { - $data = $hosts -split '\s+' - if ($data.Length -gt 2) - { - # Account for host entries that have multiple entries on a single line - $result = @() - $array = @() - for ($i = 1; $i -lt $data.Length; $i++) - { - <# - Filter commments on the line. - Example: 0.0.0.0 s.gateway.messenger.live.com # breaks Skype GH-183 - becomes: - 0.0.0.0 s.gateway.messenger.live.com - #> - if ($data[$i] -eq '#') - { - break - } - - $array += $data[$i] - } - - $result = @{ - Host = $array - IPAddress = $data[0] - } - } - else - { - $result = @{ - Host = $data[1] - IPAddress = $data[0] - } - } - - if ($result.Host -eq $HostName) - { - return @{ - HostName = $result.Host - IPAddress = $result.IPAddress - } - } - } -} diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xHostsFile/MSFT_xHostsFile.schema.mof b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xHostsFile/MSFT_xHostsFile.schema.mof deleted file mode 100644 index 8fa95fe7..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xHostsFile/MSFT_xHostsFile.schema.mof +++ /dev/null @@ -1,7 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xHostsFile")] -class MSFT_xHostsFile : OMI_BaseResource -{ - [Key, Description("Specifies the name of the computer that will be mapped to an IP address.")] string HostName; - [Write, Description("Specifies the IP Address that should be mapped to the host name.")] string IPAddress; - [Write, Description("Specifies if the hosts file entry should be created or deleted."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; -}; diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xHostsFile/en-US/MSFT_xHostsFile.strings.psd1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xHostsFile/en-US/MSFT_xHostsFile.strings.psd1 deleted file mode 100644 index c836abf7..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xHostsFile/en-US/MSFT_xHostsFile.strings.psd1 +++ /dev/null @@ -1,11 +0,0 @@ -# Localized resources for MSFT_xHostFile - -ConvertFrom-StringData @' - UnableToEnsureWithoutIP = Unable to ensure a host entry is present without a corresponding IP address. Please add the IPAddress property and run this resource again. - CreateNewEntry = Creating new host entry for {0} - UpdateExistingEntry = Updating existing host entry for {0} - RemoveEntry = Removing host entry for {0} - StartingGet = Looking up host entry for {0} - StartingSet = Setting host entry for {0} - StartingTest = Testing host entry for {0} -'@ diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xIPAddress/MSFT_xIPAddress.psm1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xIPAddress/MSFT_xIPAddress.psm1 deleted file mode 100644 index 89a57145..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xIPAddress/MSFT_xIPAddress.psm1 +++ /dev/null @@ -1,476 +0,0 @@ -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Networking Common Modules -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` - -ChildPath 'NetworkingDsc.Common.psm1')) - -# Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` - -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$localizedDataSplat = @{ - ResourceName = 'MSFT_xIPAddress' - ResourcePath = (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) -} -$localizedData = Get-LocalizedData @localizedDataSplat - -<# - .SYNOPSIS - Returns the current state of an IP address assigned to an interface. - - .PARAMETER IPAddress - The desired IP address. - - .PARAMETER InterfaceAlias - Alias of the network interface for which the IP address should be set. - - .PARAMETER AddressFamily - IP address family. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter()] - [ValidateNotNullOrEmpty()] - [String[]] - $IPAddress, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $InterfaceAlias, - - [Parameter(Mandatory = $True)] - [ValidateSet('IPv4', 'IPv6')] - [String] - $AddressFamily = 'IPv4' - ) - - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($LocalizedData.GettingIPAddressMessage) - ) -join '') - - $GetNetIPAddressSplat = @{ - InterfaceAlias = $InterfaceAlias - AddressFamily = $AddressFamily - } - $currentIPAddress = Get-NetIPAddress @GetNetIPAddressSplat - - $currentIPAddressWithPrefix = $currentIPAddress | - Foreach-Object { "$($_.IPAddress)/$($_.prefixLength)" } - - $returnValue = @{ - IPAddress = @($currentIPAddressWithPrefix) - AddressFamily = $AddressFamily - InterfaceAlias = $InterfaceAlias - } - - $returnValue -} - -<# - .SYNOPSIS - Sets an IP address on an interface. - - .PARAMETER IPAddress - The desired IP address. - - .PARAMETER InterfaceAlias - Alias of the network interface for which the IP address should be set. - - .PARAMETER AddressFamily - IP address family. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter()] - [ValidateNotNullOrEmpty()] - [String[]] - $IPAddress, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $InterfaceAlias, - - [Parameter(Mandatory = $True)] - [ValidateSet('IPv4', 'IPv6')] - [String] - $AddressFamily = 'IPv4' - ) - - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($LocalizedData.ApplyingIPAddressMessage) - ) -join '') - - # Use $AddressFamily to select the IPv4 or IPv6 destination prefix - $DestinationPrefix = '0.0.0.0/0' - if ($AddressFamily -eq 'IPv6') - { - $DestinationPrefix = '::/0' - $prefixLength = 64 - } - - # Get all the default routes - this has to be done in case the IP Address is - # being Removed - $GetNetRouteSplat = @{ - InterfaceAlias = $InterfaceAlias - AddressFamily = $AddressFamily - ErrorAction = 'Stop' - } - $defaultRoutes = @(Get-NetRoute @GetNetRouteSplat).Where( { $_.DestinationPrefix -eq $DestinationPrefix } ) - - # Remove any default routes on the specified interface -- it is important to do - # this *before* removing the IP address, particularly in the case where the IP - # address was auto-configured by DHCP - if ($defaultRoutes) - { - foreach ($defaultRoute in $defaultRoutes) - { - $RemoveNetRouteSplat = @{ - DestinationPrefix = $defaultRoute.DestinationPrefix - NextHop = $defaultRoute.NextHop - InterfaceIndex = $defaultRoute.InterfaceIndex - AddressFamily = $defaultRoute.AddressFamily - Confirm = $false - ErrorAction = 'Stop' - } - Remove-NetRoute @RemoveNetRouteSplat - } - } - - # Get the current IP Address based on the parameters given. - $GetNetIPAddressSplat = @{ - InterfaceAlias = $InterfaceAlias - AddressFamily = $AddressFamily - ErrorAction = 'Stop' - } - $currentIPs = @(Get-NetIPAddress @GetNetIPAddressSplat) - - # Remove any IP addresses on the specified interface - if ($currentIPs) - { - foreach ($CurrentIP in $CurrentIPs) - { - $RemoveIP = $False - if ($CurrentIP.IPAddress -notin ($IPAddress -replace '\/\S*','')) - { - $RemoveIP = $True - } - elseif ($CurrentIP.IPAddress -in ($IPAddress -replace '\/\S*','')) - { - $ExistingIP = $IPAddress | Where-Object {$_ -match $CurrentIP.IPAddress} - if ($ExistingIP -ne "$($CurrentIP.IPAddress)/$($CurrentIP.prefixLength)") - { - $RemoveIP = $True - } - } - - if ($RemoveIP) - { - $RemoveNetIPAddressSplat = @{ - IPAddress = $CurrentIP.IPAddress - InterfaceIndex = $CurrentIP.InterfaceIndex - AddressFamily = $CurrentIP.AddressFamily - prefixLength = $CurrentIP.prefixLength - Confirm = $false - ErrorAction = 'Stop' - } - - Remove-NetIPAddress @RemoveNetIPAddressSplat - } - } - } - - $ipAddressObject = Get-IPAddressPrefix -IPAddress $IPAddress -AddressFamily $AddressFamily - - foreach ($singleIP in $ipAddressObject) - { - $prefixLength = $singleIP.prefixLength - - # Build parameter hash table - $Parameters = @{ - IPAddress = $singleIP.IPAddress - prefixLength = $prefixLength - InterfaceAlias = $InterfaceAlias - } - - # Apply the specified IP configuration - $null = New-NetIPAddress @Parameters -ErrorAction Stop - - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($LocalizedData.IPAddressSetStateMessage) - ) -join '' ) - } -} # Set-TargetResource - -<# - .SYNOPSIS - Tests the IP address on the interface. - - .PARAMETER IPAddress - The desired IP address. - - .PARAMETER InterfaceAlias - Alias of the network interface for which the IP address should be set. - - .PARAMETER AddressFamily - IP address family. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter()] - [ValidateNotNullOrEmpty()] - [String[]] - $IPAddress, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $InterfaceAlias, - - [Parameter(Mandatory = $True)] - [ValidateSet('IPv4', 'IPv6')] - [String] - $AddressFamily = 'IPv4' - ) - - # Flag to signal whether settings are correct - [Boolean] $desiredConfigurationMatch = $true - - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($LocalizedData.CheckingIPAddressMessage) - ) -join '') - - Assert-ResourceProperty @PSBoundParameters - - # Get the current IP Address based on the parameters given. - # First make sure that adapter is available - [Boolean] $adapterBindingReady = $false - [DateTime] $startTime = Get-Date - - while (-not $adapterBindingReady -and (((Get-Date) - $startTime).TotalSeconds) -lt 30) - { - $GetNetIPAddressSplat = @{ - InterfaceAlias = $InterfaceAlias - AddressFamily = $AddressFamily - ErrorAction = 'SilentlyContinue' - } - - $currentIPs = @(Get-NetIPAddress @GetNetIPAddressSplat) - - if ($currentIPs) - { - $adapterBindingReady = $true - } - else - { - Start-Sleep -Milliseconds 200 - } - } # while - - $ipAddressObject = Get-IPAddressPrefix -IPAddress $IPAddress -AddressFamily $AddressFamily - # Test if the IP Address passed is present - foreach ($singleIP in $ipAddressObject) - { - $prefixLength = $singleIP.prefixLength - if ($singleIP.IPAddress -notin $currentIPs.IPAddress) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.IPAddressDoesNotMatchMessage) -f $singleIP,$currentIPs.IPAddress - ) -join '' ) - $desiredConfigurationMatch = $false - } - else - { - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($LocalizedData.IPAddressMatchMessage) - ) -join '') - - # Filter the IP addresses for the IP address to check - $filterIP = $currentIPs.Where( { $_.IPAddress -eq $singleIP.IPAddress } ) - - # Only test the Prefix Length if the IP address is present - if (-not $filterIP.prefixLength.Equals([byte]$prefixLength)) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.prefixLengthDoesNotMatchMessage) -f $prefixLength,$currentIPs.prefixLength - ) -join '' ) - $desiredConfigurationMatch = $false - } - else - { - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($LocalizedData.prefixLengthMatchMessage) - ) -join '' ) - } - } - } - return $desiredConfigurationMatch -} # Test-TargetResource - -<# - .SYNOPSIS - Check the IP Address details are valid and do not conflict with Address family. - Also checks the prefix length and ensures the interface exists. - If any problems are detected an exception will be thrown. - - .PARAMETER IPAddress - The desired IP address. - - .PARAMETER InterfaceAlias - Alias of the network interface for which the IP address should be set. - - .PARAMETER AddressFamily - IP address family. -#> -function Assert-ResourceProperty -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String[]] - $IPAddress, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $InterfaceAlias, - - [Parameter()] - [ValidateSet('IPv4', 'IPv6')] - [String] - $AddressFamily = 'IPv4' - ) - - $prefixLengthArray = ($IPAddress -split '/')[1] - If ($prefixLengthArray.Count -ne $IPAddress.Count) - { - $prefixLengthArray = $IPAddress | Foreach-Object { - if ($_ -match '\/\d{1,3}') - { - ($_ -split '/')[1] - } - else - { - if ($_.split('.')[0] -in (0..127)) - { - $Value = 8 - } - elseif ($_.split('.')[0] -in (128..191)) - { - $Value = 16 - } - elseif ($_.split('.')[0] -in (192..223)) - { - $Value = 24 - } - if ($AddressFamily -eq 'IPv6') - { - $value = 64 - } - $value - } - } - } - - if (-not (Get-NetAdapter | Where-Object -Property Name -EQ $InterfaceAlias )) - { - $errorId = 'InterfaceNotAvailable' - $errorCategory = [System.Management.Automation.ErrorCategory]::DeviceError - $errorMessage = $($LocalizedData.InterfaceNotAvailableError) -f $InterfaceAlias - $exception = New-Object -TypeName System.InvalidOperationException ` - -ArgumentList $errorMessage - $errorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord ` - -ArgumentList $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord) - } - foreach ($singleIPAddress in $IPAddress) - { - $singleIP = ($singleIPAddress -split '/')[0] - - if (-not ([System.Net.Ipaddress]::TryParse($singleIP, [ref]0))) - { - $errorId = 'AddressFormatError' - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidArgument - $errorMessage = $($LocalizedData.AddressFormatError) -f $singleIPAddress - $exception = New-Object -TypeName System.InvalidOperationException ` - -ArgumentList $errorMessage - $errorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord ` - -ArgumentList $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord) - } - - $detectedAddressFamily = ([System.Net.IPAddress]$singleIP).AddressFamily.ToString() - if (($detectedAddressFamily -eq [System.Net.Sockets.AddressFamily]::InterNetwork.ToString()) ` - -and ($AddressFamily -ne 'IPv4')) - { - $errorId = 'AddressMismatchError' - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidArgument - $errorMessage = $($LocalizedData.AddressIPv4MismatchError) -f $singleIPAddress,$AddressFamily - $exception = New-Object -TypeName System.InvalidOperationException ` - -ArgumentList $errorMessage - $errorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord ` - -ArgumentList $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord) - } - - if (($detectedAddressFamily -eq [System.Net.Sockets.AddressFamily]::InterNetworkV6.ToString()) ` - -and ($AddressFamily -ne 'IPv6')) - { - $errorId = 'AddressMismatchError' - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidArgument - $errorMessage = $($LocalizedData.AddressIPv6MismatchError) -f $singleIPAddress,$AddressFamily - $exception = New-Object -TypeName System.InvalidOperationException ` - -ArgumentList $errorMessage - $errorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord ` - -ArgumentList $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord) - } - } - foreach ($prefixLength in $prefixLengthArray) - { - $prefixLength = [uint32]::Parse($prefixLength) - if (( - ($AddressFamily -eq 'IPv4') ` - -and (($prefixLength -lt [uint32]0) -or ($prefixLength -gt [uint32]32)) - ) -or ( - ($AddressFamily -eq 'IPv6') ` - -and (($prefixLength -lt [uint32]0) -or ($prefixLength -gt [uint32]128)) - )) - { - $errorId = 'prefixLengthError' - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidArgument - $errorMessage = $($LocalizedData.prefixLengthError) -f $prefixLength,$AddressFamily - $exception = New-Object -TypeName System.InvalidOperationException ` - -ArgumentList $errorMessage - $errorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord ` - -ArgumentList $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord) - } - } -} # Assert-ResourceProperty - -Export-ModuleMember -function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xIPAddress/MSFT_xIPAddress.schema.mof b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xIPAddress/MSFT_xIPAddress.schema.mof deleted file mode 100644 index dc6b1359..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xIPAddress/MSFT_xIPAddress.schema.mof +++ /dev/null @@ -1,7 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xIPAddress")] -class MSFT_xIPAddress : OMI_BaseResource -{ - [Write, Description("The desired IP address, optionally including prefix length using CIDR notation.")] string IPAddress[]; - [Key, Description("Alias of the network interface for which the IP address should be set.")] string InterfaceAlias; - [Key, Description("IP address family.") ,ValueMap{"IPv4", "IPv6"},Values{"IPv4", "IPv6"}] string AddressFamily; -}; diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xIPAddress/en-US/MSFT_xIPAddress.strings.psd1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xIPAddress/en-US/MSFT_xIPAddress.strings.psd1 deleted file mode 100644 index 67956dcd..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xIPAddress/en-US/MSFT_xIPAddress.strings.psd1 +++ /dev/null @@ -1,20 +0,0 @@ -# Localized resources for MSFT_xIPAddress - -ConvertFrom-StringData @' - GettingIPAddressMessage = Getting the IP Address. - ApplyingIPAddressMessage = Applying the IP Address. - IPAddressSetStateMessage = IP Interface was set to the desired state. - CheckingIPAddressMessage = Checking the IP Address. - IPAddressDoesNotMatchMessage = IP Address does NOT match desired state. Expected {0}, actual {1}. - IPAddressMatchMessage = IP Address is in desired state. - PrefixLengthDoesNotMatchMessage = Prefix Length does NOT match desired state. Expected {0}, actual {1}. - PrefixLengthMatchMessage = Prefix Length is in desired state. - DHCPIsNotDisabledMessage = DHCP is NOT disabled. - DHCPIsAlreadyDisabledMessage = DHCP is already disabled. - DHCPIsNotTestedMessage = DHCP status is ignored when Address Family is IPv6. - InterfaceNotAvailableError = Interface "{0}" is not available. Please select a valid interface and try again. - AddressFormatError = Address "{0}" is not in the correct format. Please correct the Address parameter in the configuration and try again. - AddressIPv4MismatchError = Address "{0}" is in IPv4 format, which does not match server address family {1}. Please correct either of them in the configuration and try again. - AddressIPv6MismatchError = Address "{0}" is in IPv6 format, which does not match server address family {1}. Please correct either of them in the configuration and try again. - PrefixLengthError = A Prefix Length of {0} is not valid for {1} addresses. Please correct the Prefix Length and try again. -'@ diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterBinding/MSFT_xNetAdapterBinding.psm1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterBinding/MSFT_xNetAdapterBinding.psm1 deleted file mode 100644 index daf7beae..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterBinding/MSFT_xNetAdapterBinding.psm1 +++ /dev/null @@ -1,281 +0,0 @@ -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Networking Common Modules -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` - -ChildPath 'NetworkingDsc.Common.psm1')) - -# Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` - -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$localizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xNetAdapterBinding' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# - .SYNOPSIS - Returns the current state of an Adapter Binding on an interface. - - .PARAMETER InterfaceAlias - Specifies the alias of a network interface. Supports the use of '*'. - - .PARAMETER ComponentId - Specifies the underlying name of the transport or filter in the following - form - ms_xxxx, such as ms_tcpip. - - .PARAMETER Ensure - Specifies if the component ID for the Interface should be Enabled or Disabled. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $InterfaceAlias, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $ComponentId, - - [ValidateSet('Enabled', 'Disabled')] - [String] - $State = 'Enabled' - ) - - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($LocalizedData.GettingNetAdapterBindingMessage -f ` - $InterfaceAlias,$ComponentId) - ) -join '') - - $currentNetAdapterBinding = Get-Binding @PSBoundParameters - - $adapterState = $currentNetAdapterBinding.Enabled | - Sort-Object -Unique - - if ( $adapterState.Count -eq 2) - { - $currentEnabled = 'Mixed' - } - elseif ( $adapterState -eq $true ) - { - $currentEnabled = 'Enabled' - } - else - { - $currentEnabled = 'Disabled' - } - - $returnValue = @{ - InterfaceAlias = $InterfaceAlias - ComponentId = $ComponentId - State = $State - CurrentState = $currentEnabled - } - - return $returnValue -} # Get-TargetResource - -<# - .SYNOPSIS - Sets the Adapter Binding on a specific interface. - - .PARAMETER InterfaceAlias - Specifies the alias of a network interface. Supports the use of '*'. - - .PARAMETER ComponentId - Specifies the underlying name of the transport or filter in the following - form - ms_xxxx, such as ms_tcpip. - - .PARAMETER Ensure - Specifies if the component ID for the Interface should be Enabled or Disabled. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $InterfaceAlias, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $ComponentId, - - [ValidateSet('Enabled', 'Disabled')] - [String] - $State = 'Enabled' - ) - - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($LocalizedData.ApplyingNetAdapterBindingMessage -f ` - $InterfaceAlias,$ComponentId) - ) -join '') - - $currentNetAdapterBinding = Get-Binding @PSBoundParameters - - # Remove the State so we can splat - $null = $PSBoundParameters.Remove('State') - - if ($State -eq 'Enabled') - { - Enable-NetAdapterBinding @PSBoundParameters - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($LocalizedData.NetAdapterBindingEnabledMessage -f ` - $InterfaceAlias,$ComponentId) - ) -join '' ) - } - else - { - Disable-NetAdapterBinding @PSBoundParameters - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($LocalizedData.NetAdapterBindingDisabledMessage -f ` - $InterfaceAlias,$ComponentId) - ) -join '' ) - } # if -} # Set-TargetResource - -<# - .SYNOPSIS - Tests the current state of an Adapter Binding on an interface. - - .PARAMETER InterfaceAlias - Specifies the alias of a network interface. Supports the use of '*'. - - .PARAMETER ComponentId - Specifies the underlying name of the transport or filter in the following - form - ms_xxxx, such as ms_tcpip. - - .PARAMETER Ensure - Specifies if the component ID for the Interface should be Enabled or Disabled. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $InterfaceAlias, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $ComponentId, - - [ValidateSet('Enabled', 'Disabled')] - [String] - $State = 'Enabled' - ) - - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($LocalizedData.CheckingNetAdapterBindingMessage -f ` - $InterfaceAlias,$ComponentId) - ) -join '') - - $currentNetAdapterBinding = Get-Binding @PSBoundParameters - - $adapterState = $currentNetAdapterBinding.Enabled | - Sort-Object -Unique - - if ( $adapterState.Count -eq 2) - { - $currentEnabled = 'Mixed' - } - elseif ( $adapterState -eq $true ) - { - $currentEnabled = 'Enabled' - } - else - { - $currentEnabled = 'Disabled' - } - - # Test if the binding is in the correct state - if ($currentEnabled -ne $State) - { - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($LocalizedData.NetAdapterBindingDoesNotMatchMessage -f ` - $InterfaceAlias,$ComponentId,$State,$currentEnabled) - ) -join '' ) - return $false - } - else - { - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($LocalizedData.NetAdapterBindingMatchMessage -f ` - $InterfaceAlias,$ComponentId) - ) -join '' ) - return $true - } # if -} # Test-TargetResource - -<# - .SYNOPSIS - Ensures the interface and component Id exists and returns the Net Adapter binding object. - - .PARAMETER InterfaceAlias - Specifies the alias of a network interface. Supports the use of '*'. - - .PARAMETER ComponentId - Specifies the underlying name of the transport or filter in the following - form - ms_xxxx, such as ms_tcpip. - - .PARAMETER Ensure - Specifies if the component ID for the Interface should be Enabled or Disabled. -#> -function Get-Binding -{ - [CmdletBinding()] - [OutputType([Microsoft.Management.Infrastructure.CimInstance])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $InterfaceAlias, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $ComponentId, - - [ValidateSet('Enabled', 'Disabled')] - [String] - $State = 'Enabled' - ) - - if (-not (Get-NetAdapter -Name $InterfaceAlias -ErrorAction SilentlyContinue)) - { - $errorId = 'InterfaceNotAvailable' - $errorCategory = [System.Management.Automation.ErrorCategory]::DeviceError - $errorMessage = $($LocalizedData.InterfaceNotAvailableError) -f $InterfaceAlias - $exception = New-Object -TypeName System.InvalidOperationException ` - -ArgumentList $errorMessage - $errorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord ` - -ArgumentList $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord) - } # if - - $binding = Get-NetAdapterBinding ` - -InterfaceAlias $InterfaceAlias ` - -ComponentId $ComponentId ` - -ErrorAction Stop - - return $binding -} # Get-Binding - -Export-ModuleMember -function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterBinding/MSFT_xNetAdapterBinding.schema.mof b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterBinding/MSFT_xNetAdapterBinding.schema.mof deleted file mode 100644 index 343aeaf8..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterBinding/MSFT_xNetAdapterBinding.schema.mof +++ /dev/null @@ -1,8 +0,0 @@ -[ClassVersion("1.0.0"), FriendlyName("xNetAdapterBinding")] -class MSFT_xNetAdapterBinding : OMI_BaseResource -{ - [Key, Description("Specifies the alias of a network interface. Supports the use of '*'.")] string InterfaceAlias; - [Key, Description("Specifies the underlying name of the transport or filter in the following form - ms_xxxx, such as ms_tcpip.")] string ComponentId; - [Write, Description("Specifies if the component ID for the Interface should be Enabled or Disabled."), ValueMap{"Enabled", "Disabled"}, Values{"Enabled", "Disabled"}] string State; - [Read, Description("Returns the current state of the component ID for the Interfaces."), ValueMap{"Enabled", "Disabled","Mixed"}, Values{"Enabled", "Disabled","Mixed"}] string CurrentState; -}; diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterBinding/en-US/MSFT_xNetAdapterBinding.strings.psd1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterBinding/en-US/MSFT_xNetAdapterBinding.strings.psd1 deleted file mode 100644 index 27c9e51c..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterBinding/en-US/MSFT_xNetAdapterBinding.strings.psd1 +++ /dev/null @@ -1,13 +0,0 @@ -# Localized resources for MSFT_xNetAdapterBinding - -ConvertFrom-StringData @' - GettingNetAdapterBindingMessage = Getting the '{0}' Inerface '{1}' Binding. - ApplyingNetAdapterBindingMessage = Applying the '{0}' Inerface '{1}' Binding. - NetAdapterBindingEnabledMessage = '{0}' Inerface '{1}' Binding was Enabled. - NetAdapterBindingDisabledMessage = '{0}' Inerface '{1}' Binding was Disabled. - CheckingNetAdapterBindingMessage = Checking the '{0}' Inerface '{1}' Binding. - NetAdapterBindingDoesNotMatchMessage = '{0}' Inerface '{1}' Binding does NOT match desired state. Expected {2}, actual {3}. - NetAdapterBindingMatchMessage = '{0}' Inerface '{1}' Binding is in desired state. - InterfaceNotAvailableError = Interface '{0}' is not available. Please select a valid interface and try again. - ComponentIdNotAvailableError = Inerface '{0}' does not have '{1}' bound to it. Please select a bound component Id and try again. -'@ diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterLso/MSFT_xNetAdapterLso.psm1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterLso/MSFT_xNetAdapterLso.psm1 deleted file mode 100644 index 73ee69b7..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterLso/MSFT_xNetAdapterLso.psm1 +++ /dev/null @@ -1,237 +0,0 @@ -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Networking Common Modules -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` - -ChildPath 'NetworkingDsc.Common.psm1')) - -# Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` - -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$localizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xNetAdapterLso' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# -.SYNOPSIS - Gets the current state of NetAdapterLso for a adapter. - -.PARAMETER Name - Specifies the name of the network adapter to check. - -.PARAMETER Protocol - Specifies which protocol to target. - -.PARAMETER State - Specifies the LSO state for the protocol. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [String] - $Name, - - [parameter(Mandatory = $true)] - [ValidateSet("V1IPv4","IPv4","IPv6")] - [String] - $Protocol, - - [parameter(Mandatory = $true)] - [Boolean] - $State - ) - - try - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $localizedData.CheckingNetAdapterMessage - ) -join '') - - $netAdapter = Get-NetAdapterLso -Name $Name -ErrorAction Stop - - if ($netAdapter) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NetAdapterTestingStateMessage -f $Name, $Protocol) - ) -join '') - - $result = @{ - Name = $Name - Protocol = $Protocol - } - switch ($Protocol) { - "V1IPv4" { $result.add('State', $netAdapter.V1IPv4Enabled) } - "IPv4" { $result.add('State', $netAdapter.IPv4Enabled) } - "IPv6" { $result.add('State', $netAdapter.IPv6Enabled) } - Default {"Should not be called."} - } - return $result - } - } - catch - { - throw $localizedData.NetAdapterNotFoundMessage - } - -} - -<# -.SYNOPSIS - Sets the NetAdapterLso resource state. - -.PARAMETER Name - Specifies the name of the network adapter to check. - -.PARAMETER Protocol - Specifies which protocol to target. - -.PARAMETER State - Specifies the LSO state for the protocol. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [String] - $Name, - - [parameter(Mandatory = $true)] - [ValidateSet("V1IPv4","IPv4","IPv6")] - [String] - $Protocol, - - [parameter(Mandatory = $true)] - [Boolean] - $State - ) - - try - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $localizedData.CheckingNetAdapterMessage - ) -join '') - - $netAdapter = Get-NetAdapterLso -Name $Name -ErrorAction Stop - - if ($netAdapter) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NetAdapterTestingStateMessage -f $Name, $Protocol) - ) -join '') - - if ($Protocol -eq "V1IPv4" -and $State -ne $netAdapter.V1IPv4Enabled) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NetAdapterApplyingChangesMessage -f ` - $Name, $Protocol, $($netAdapter.V1IPv4Enabled.ToString()), $($State.ToString()) ) - ) -join '') - - Set-NetAdapterLso -Name $Name -V1IPv4Enabled $State - } - elseif ($Protocol -eq "IPv4" -and $State -ne $netAdapter.IPv4Enabled) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NetAdapterApplyingChangesMessage -f ` - $Name, $Protocol, $($netAdapter.IPv4Enabled.ToString()), $($State.ToString()) ) - ) -join '') - - Set-NetAdapterLso -Name $Name -IPv4Enabled $State - } - elseif ($Protocol -eq "IPv6" -and $State -ne $netAdapter.IPv6Enabled) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.NetAdapterApplyingChangesMessage -f ` - $Name, $Protocol, $($netAdapter.IPv6Enabled.ToString()), $($State.ToString()) ) - ) -join '') - - Set-NetAdapterLso -Name $Name -IPv6Enabled $State - } - } - } - catch - { - throw $LocalizedData.NetAdapterNotFoundMessage - } - -} - -<# -.SYNOPSIS - Tests if the NetAdapterLso resource state is desired state. - -.PARAMETER Name - Specifies the name of the network adapter to check. - -.PARAMETER Protocol - Specifies which protocol to target. - -.PARAMETER State - Specifies the LSO state for the protocol. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [String] - $Name, - - [parameter(Mandatory = $true)] - [ValidateSet("V1IPv4","IPv4","IPv6")] - [String] - $Protocol, - - [parameter(Mandatory = $true)] - [Boolean] - $State - ) - - try - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $localizedData.CheckingNetAdapterMessage - ) -join '') - - $netAdapter = Get-NetAdapterLso -Name $Name -ErrorAction Stop - - if ($netAdapter) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $localizedData.NetAdapterTestingStateMessage -f ` - $Name, $Protocol - ) -join '') - - switch ($Protocol) { - "V1IPv4" { return ($State -eq $netAdapter.V1IPv4Enabled) } - "IPv4" { return ($State -eq $netAdapter.IPv4Enabled) } - "IPv6" { return ($State -eq $netAdapter.IPv6Enabled) } - Default {"Should not be called."} - } - } - } - catch - { - throw $LocalizedData.NetAdapterNotFoundMessage - } - -} diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterLso/MSFT_xNetAdapterLso.schema.mof b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterLso/MSFT_xNetAdapterLso.schema.mof deleted file mode 100644 index 7a4dc219..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterLso/MSFT_xNetAdapterLso.schema.mof +++ /dev/null @@ -1,7 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xNetAdapterLso")] -class MSFT_xNetAdapterLso : OMI_BaseResource -{ - [Key, Description("Specifies the name of network adapter.")] String Name; - [Required, Description("Specifies which protocol to make changes to."), ValueMap{"V1IPv4","IPv4","IPv6"}, Values{"V1IPv4","IPv4","IPv6"}] String Protocol; - [Required, Description("Specifies whether LSO should be enabled or disabled.")] Boolean State; -}; diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterLso/en-US/MSFT_xNetAdapterLso.strings.psd1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterLso/en-US/MSFT_xNetAdapterLso.strings.psd1 deleted file mode 100644 index 65f0c682..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterLso/en-US/MSFT_xNetAdapterLso.strings.psd1 +++ /dev/null @@ -1,9 +0,0 @@ -# Localized resources for MSFT_xNetAdapterLso - -ConvertFrom-StringData @' - CheckingNetAdapterMessage = Checking if network adapter exists or not. - NetAdapterNotFoundMessage = Network adapter not found - NetAdapterTestingStateMessage = Checking if adapter {0} {1} is in desired state. - NetAdapterIsInDesiredStateMessage = Network adapter {0} {1} is in desired state {2}. - NetAdapterApplyingChangesMessage = Network adapter {0} {1} was {2}, should be {3}, applying changes. -'@ diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterName/MSFT_xNetAdapterName.psm1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterName/MSFT_xNetAdapterName.psm1 deleted file mode 100644 index 3d207318..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterName/MSFT_xNetAdapterName.psm1 +++ /dev/null @@ -1,399 +0,0 @@ -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Networking Common Modules -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` - -ChildPath 'NetworkingDsc.Common.psm1')) - -# Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` - -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$localizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xNetAdapterName' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# - .SYNOPSIS - This function will get the network adapter based on the provided - parameters. - - .PARAMETER NewName - Specifies the new name of the network adapter. - - .PARAMETER Name - This is the name of the network adapter to find. - - .PARAMETER PhysicalMediaType - This is the media type of the network adapter to find. - - .PARAMETER Status - This is the status of the network adapter to find. - - .PARAMETER MacAddress - This is the MAC address of the network adapter to find. - - .PARAMETER InterfaceDescription - This is the interface description of the network adapter to find. - - .PARAMETER InterfaceIndex - This is the interface index of the network adapter to find. - - .PARAMETER InterfaceGuid - This is the interface GUID of the network adapter to find. - - .PARAMETER DriverDescription - This is the driver description of the network adapter. - - .PARAMETER InterfaceNumber - This is the interface number of the network adapter if more than one - are returned by the parameters. - - .PARAMETER IgnoreMultipleMatchingAdapters - This switch will suppress an error occurring if more than one matching - adapter matches the parameters passed. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $NewName, - - [ValidateNotNullOrEmpty()] - [System.String] - $Name, - - [Parameter()] - [System.String] - $PhysicalMediaType, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [ValidateSet('Up','Disconnected','Disabled')] - [System.String] - $Status = 'Up', - - [Parameter()] - [System.String] - $MacAddress, - - [Parameter()] - [System.String] - $InterfaceDescription, - - [Parameter()] - [System.UInt32] - $InterfaceIndex, - - [Parameter()] - [System.String] - $InterfaceGuid, - - [Parameter()] - [System.String] - $DriverDescription, - - [Parameter()] - [System.UInt32] - $InterfaceNumber = 1, - - [Parameter()] - [System.Boolean] - $IgnoreMultipleMatchingAdapters = $false - ) - - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($LocalizedData.GettingNetAdapterNameMessage -f $NewName) - ) -join '') - - $adapter = Find-NetworkAdapter ` - -Name $NewName ` - -ErrorAction SilentlyContinue - - if (-not $adapter) - { - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($LocalizedData.FindNetAdapterMessage) - ) -join '') - - $null = $PSBoundParameters.Remove('NewName') - - $adapter = Find-NetworkAdapter ` - @PSBoundParameters ` - -ErrorAction Stop - } - - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($LocalizedData.NetAdapterNameFoundMessage -f $adapter.Name) - ) -join '') - - $returnValue = @{ - Name = $adapter.Name - PhysicalMediaType = $adapter.PhysicalMediaType - Status = $adapter.Status - MacAddress = $adapter.MacAddress - InterfaceDescription = $adapter.InterfaceDescription - InterfaceIndex = $adapter.InterfaceIndex - InterfaceGuid = $adapter.InterfaceGuid - DriverDescription = $adapter.DriverDescription - InterfaceNumber = $InterfaceNumber - IgnoreMultipleMatchingAdapters = $IgnoreMultipleMatchingAdapters - } - - return $returnValue -} # Get-TargetResource - -<# - .SYNOPSIS - This function will rename a network adapter that matches the parameters. - - .PARAMETER NewName - Specifies the new name of the network adapter. - - .PARAMETER Name - This is the name of the network adapter to find. - - .PARAMETER PhysicalMediaType - This is the media type of the network adapter to find. - - .PARAMETER Status - This is the status of the network adapter to find. - - .PARAMETER MacAddress - This is the MAC address of the network adapter to find. - - .PARAMETER InterfaceDescription - This is the interface description of the network adapter to find. - - .PARAMETER InterfaceIndex - This is the interface index of the network adapter to find. - - .PARAMETER InterfaceGuid - This is the interface GUID of the network adapter to find. - - .PARAMETER DriverDescription - This is the driver description of the network adapter. - - .PARAMETER InterfaceNumber - This is the interface number of the network adapter if more than one - are returned by the parameters. - - .PARAMETER IgnoreMultipleMatchingAdapters - This switch will suppress an error occurring if more than one matching - adapter matches the parameters passed. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $NewName, - - [ValidateNotNullOrEmpty()] - [System.String] - $Name, - - [Parameter()] - [System.String] - $PhysicalMediaType, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [ValidateSet('Up','Disconnected','Disabled')] - [System.String] - $Status = 'Up', - - [Parameter()] - [System.String] - $MacAddress, - - [Parameter()] - [System.String] - $InterfaceDescription, - - [Parameter()] - [System.UInt32] - $InterfaceIndex, - - [Parameter()] - [System.String] - $InterfaceGuid, - - [Parameter()] - [System.String] - $DriverDescription, - - [Parameter()] - [System.UInt32] - $InterfaceNumber = 1, - - [Parameter()] - [System.Boolean] - $IgnoreMultipleMatchingAdapters = $false - ) - - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($LocalizedData.SettingNetAdapterNameMessage -f $NewName) - ) -join '') - - $null = $PSBoundParameters.Remove('NewName') - - $adapter = Find-NetworkAdapter ` - @PSBoundParameters ` - -ErrorAction Stop - - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($LocalizedData.RenamingNetAdapterNameMessage -f $adapter.Name,$NewName) - ) -join '') - - $adapter | Rename-NetAdapter -NewName $NewName - - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($LocalizedData.NetAdapterNameRenamedMessage -f $NewName) - ) -join '') -} # Set-TargetResource - -<# - .SYNOPSIS - This will check if the network adapter that matches the parameters needs - to be returned. - - .PARAMETER NewName - Specifies the new name of the network adapter. - - .PARAMETER Name - This is the name of the network adapter to find. - - .PARAMETER PhysicalMediaType - This is the media type of the network adapter to find. - - .PARAMETER Status - This is the status of the network adapter to find. - - .PARAMETER MacAddress - This is the MAC address of the network adapter to find. - - .PARAMETER InterfaceDescription - This is the interface description of the network adapter to find. - - .PARAMETER InterfaceIndex - This is the interface index of the network adapter to find. - - .PARAMETER InterfaceGuid - This is the interface GUID of the network adapter to find. - - .PARAMETER DriverDescription - This is the driver description of the network adapter. - - .PARAMETER InterfaceNumber - This is the interface number of the network adapter if more than one - are returned by the parameters. - - .PARAMETER IgnoreMultipleMatchingAdapters - This switch will suppress an error occurring if more than one matching - adapter matches the parameters passed. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $NewName, - - [ValidateNotNullOrEmpty()] - [System.String] - $Name, - - [Parameter()] - [System.String] - $PhysicalMediaType, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [ValidateSet('Up','Disconnected','Disabled')] - [System.String] - $Status = 'Up', - - [Parameter()] - [System.String] - $MacAddress, - - [Parameter()] - [System.String] - $InterfaceDescription, - - [Parameter()] - [System.UInt32] - $InterfaceIndex, - - [Parameter()] - [System.String] - $InterfaceGuid, - - [Parameter()] - [System.String] - $DriverDescription, - - [Parameter()] - [System.UInt32] - $InterfaceNumber = 1, - - [Parameter()] - [System.Boolean] - $IgnoreMultipleMatchingAdapters = $false - ) - - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($LocalizedData.TestingNetAdapterNameMessage -f $NewName) - ) -join '') - - $null = $PSBoundParameters.Remove('NewName') - - # Can an adapter be found with the new name? - $adapterWithNewName = Find-NetworkAdapter ` - -Name $NewName ` - -Verbose:$Verbose ` - -ErrorAction SilentlyContinue - - if ($adapterWithNewName) - { - # An adapter was found matching the new name - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($LocalizedData.NetAdapterWithNewNameExistsMessage -f $adapterWithNewName.Name) - ) -join '') - return $true - } - else - { - # Find an adapter matching the parameters - throw if none can be found - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($LocalizedData.FindNetAdapterMessage) - ) -join '') - - $adapter = Find-NetworkAdapter ` - @PSBoundParameters ` - -ErrorAction Stop - - # An adapter was found that needs to be changed to the new name - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($LocalizedData.NetAdapterNameNotMatchMessage -f $adapter.Name,$NewName) - ) -join '') - return $false - } # if -} # Test-TargetResource - -Export-ModuleMember -function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterName/MSFT_xNetAdapterName.schema.mof b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterName/MSFT_xNetAdapterName.schema.mof deleted file mode 100644 index 0beae1e3..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterName/MSFT_xNetAdapterName.schema.mof +++ /dev/null @@ -1,15 +0,0 @@ -[ClassVersion("1.0.0"), FriendlyName("xNetAdapterName")] -class MSFT_xNetAdapterName : OMI_BaseResource -{ - [Key, Description("Specifies the new name of the network adapter.")] String NewName; - [Write, Description("This is the name of the network adapter to find.")] String Name; - [Write, Description("This is the media type of the network adapter to find.")] String PhysicalMediaType; - [Write, Description("This is the status of the network adapter to find."), ValueMap{"Up", "Disconnected", "Disabled"}, Values{"Up", "Disconnected", "Disabled"}] String Status; - [Write, Description("This is the MAC address of the network adapter to find.")] String MacAddress; - [Write, Description("This is the interface description of the network adapter to find.")] String InterfaceDescription; - [Write, Description("This is the interface index of the network adapter to find.")] UInt32 InterfaceIndex; - [Write, Description("This is the interface GUID of the network adapter to find.")] String InterfaceGuid; - [Write, Description("This is the driver description of the network adapter.")] String DriverDescription; - [Write, Description("This is the interface number of the network adapter if more than one are returned by the parameters.")] UInt32 InterfaceNumber; - [Write, Description("This switch will suppress an error occurring if more than one matching adapter matches the parameters passed.")] Boolean IgnoreMultipleMatchingAdapters; -}; diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterName/en-us/MSFT_xNetAdapterName.strings.psd1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterName/en-us/MSFT_xNetAdapterName.strings.psd1 deleted file mode 100644 index 5c925d65..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterName/en-us/MSFT_xNetAdapterName.strings.psd1 +++ /dev/null @@ -1,11 +0,0 @@ -ConvertFrom-StringData @' - GettingNetAdapterNameMessage = Getting the network adapter Name '{0}'. - FindNetAdapterMessage = Finding network adapter matching search criteria. - NetAdapterNameFoundMessage = network adapter '{0}' found. - SettingNetAdapterNameMessage = Setting the network adapter Name '{0}'. - RenamingNetAdapterNameMessage = Renaming network adapter '{0}' to '{1}'. - NetAdapterNameRenamedMessage = network adapter renamed to '{0}'. - TestingNetAdapterNameMessage = Testing the network adapter Name '{0}'. - NetAdapterWithNewNameExistsMessage = A network adapter was found with the intended new name '{0}' of the Adapter. No rename required. - NetAdapterNameNotMatchMessage = network adapter Name '{0}' does not match the adapter '{1}' that was found. Rename required. -'@ diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterRDMA/MSFT_xNetAdapterRDMA.psm1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterRDMA/MSFT_xNetAdapterRDMA.psm1 deleted file mode 100644 index 144d1104..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterRDMA/MSFT_xNetAdapterRDMA.psm1 +++ /dev/null @@ -1,156 +0,0 @@ -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Networking Common Modules -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` - -ChildPath 'NetworkingDsc.Common.psm1')) - -# Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` - -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$localizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xNetAdapterRDMA' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# -.SYNOPSIS - Gets MSFT_xVMNetAdapterRDMA resource current state. - -.PARAMETER Name - Specifies the name of the network adapter for which the RDMA configuration needs to be retrieved. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [String] - $Name - ) - - $configuration = @{ - Name = $Name - } - - try - { - Write-Verbose -Message $localizedData.CheckNetAdapter - $netAdapter = Get-NetAdapterRdma -Name $Name -ErrorAction Stop - if ($netAdapter) - { - Write-Verbose -Message $localizedData.CheckNetAdapterRDMA - $configuration.Add('Enabled',$netAdapter.Enabled) - return $configuration - } - } - catch - { - throw $localizedData.NetAdapterNotFound - } -} - -<# -.SYNOPSIS - Sets MSFT_xVMNetAdapterRDMA resource state. - -.PARAMETER Name - Specifies the name of the network adapter for which the - RDMA configuration needs to be retrieved. - -.PARAMETER Enabled - Specifies if the RDMA configuration should be enabled or disabled. - This is a boolean value and the default is $true. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [String] - $Name, - - [Boolean] - $Enabled = $true - ) - - $configuration = @{ - Name = $Name - } - - try - { - Write-Verbose -Message $localizedData.CheckNetAdapter - $netAdapter = Get-NetAdapterRdma -Name $Name -ErrorAction Stop - if ($netAdapter) - { - Write-Verbose -Message $localizedData.CheckNetAdapterRDMA - if ($netAdapter.Enabled -ne $Enabled) - { - Write-Verbose -Message $localizedData.NetAdapterRDMADifferent - Write-Verbose -Message $localizedData.SetNetAdapterRDMA - Set-NetAdapterRdma -Name $Name -Enabled $Enabled - } - } - } - catch - { - throw $localizedData.NetAdapterNotFound - } -} - -<# -.SYNOPSIS - Tests if MSFT_xVMNetAdapterRDMA resource state is indeed desired state or not. - -.PARAMETER Name - Specifies the name of the network adapter for which the - RDMA configuration needs to be retrieved. - -.PARAMETER Enabled - Specifies if the RDMA configuration should be enabled or disabled. - This is a boolean value and the default is $true. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [String] - $Name, - - [Boolean] - $Enabled = $true - ) - - try - { - Write-Verbose -Message $localizedData.CheckNetAdapter - $netAdapter = Get-NetAdapterRdma -Name $Name -ErrorAction Stop - if ($netAdapter) - { - Write-Verbose -Message $localizedData.CheckNetAdapterRDMA - if ($netAdapter.Enabled -ne $Enabled) - { - Write-Verbose -Message $localizedData.NetAdapterRDMADifferent - return $false - } - else - { - Write-Verbose -Message $localizedData.NetAdapterRDMAMatches - return $true - } - } - } - catch - { - throw $localizedData.NetAdapterNotFound - } -} diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterRDMA/MSFT_xNetAdapterRDMA.schema.mof b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterRDMA/MSFT_xNetAdapterRDMA.schema.mof deleted file mode 100644 index 8883f754..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterRDMA/MSFT_xNetAdapterRDMA.schema.mof +++ /dev/null @@ -1,6 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xNetAdapterRDMA")] -class MSFT_xNetAdapterRDMA : OMI_BaseResource -{ - [Key, Description("Specifies the name of network adapter for which RDMA needs to be configured.")] String Name; - [Write, Description("Specifies whether RDMA is enabled or disabled.")] Boolean Enabled; -}; diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterRDMA/en-US/MSFT_xNetAdapterRDMA.strings.psd1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterRDMA/en-US/MSFT_xNetAdapterRDMA.strings.psd1 deleted file mode 100644 index db6e32d3..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetAdapterRDMA/en-US/MSFT_xNetAdapterRDMA.strings.psd1 +++ /dev/null @@ -1,10 +0,0 @@ -# Localized resources for MSFT_xNetAdapterRDMA - -ConvertFrom-StringData @' - CheckNetAdapter = Checking if network adapter exists or not. - CheckNetAdapterRDMA = Checking if RDMA is enabled and in desired state for this adapter. - NetAdapterNotFound = Network Adapter not found. - NetAdapterRDMADifferent = Network adapter RDMA setting is not in desired state. This will be configured. - SetNetAdapterRDMA = Setting network adapter RDMA configuration to desired state. - NetAdapterRDMAMatches = Network adapter RDMA configuration is in desired state. No action needed. -'@ diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetBIOS/MSFT_xNetBIOS.psm1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetBIOS/MSFT_xNetBIOS.psm1 deleted file mode 100644 index 290716ee..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetBIOS/MSFT_xNetBIOS.psm1 +++ /dev/null @@ -1,196 +0,0 @@ -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Networking Common Modules -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` - -ChildPath 'NetworkingDsc.Common.psm1')) - -# Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` - -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$localizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xNetBIOS' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -#region check NetBIOSSetting enum loaded, if not load -try -{ - [void][reflection.assembly]::GetAssembly([NetBIOSSetting]) -} -catch -{ - Add-Type -TypeDefinition @' - public enum NetBiosSetting - { - Default, - Enable, - Disable - } -'@ -} -#endregion - -<# - .SYNOPSIS - Returns the current state of the Net Bios on an interface. - - .PARAMETER InterfaceAlias - Specifies the alias of a network interface. Supports the use of '*'. - - .PARAMETER Setting - Default - Use NetBios settings from the DHCP server. If static IP, Enable NetBIOS. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $InterfaceAlias, - - [parameter(Mandatory = $true)] - [ValidateSet("Default","Enable","Disable")] - [System.String] - $Setting - ) - - Write-Verbose -Message ($LocalizedData.GettingNetBiosSetting -f $InterfaceAlias) - - $netadapterparams = @{ - ClassName = 'Win32_NetworkAdapter' - Filter = 'NetConnectionID="{0}"' -f $InterfaceAlias - } - - $netAdapterConfig = Get-CimInstance @netadapterparams -ErrorAction Stop | - Get-CimAssociatedInstance ` - -ResultClassName Win32_NetworkAdapterConfiguration ` - -ErrorAction Stop - - return @{ - InterfaceAlias = $InterfaceAlias - Setting = $([NETBIOSSetting].GetEnumValues()[$netAdapterConfig.TcpipNetbiosOptions]) - } -} - -<# - .SYNOPSIS - Sets the state of the Net Bios on an interface. - - .PARAMETER InterfaceAlias - Specifies the alias of a network interface. Supports the use of '*'. - - .PARAMETER Setting - Default - Use NetBios settings from the DHCP server. If static IP, Enable NetBIOS. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $InterfaceAlias, - - [parameter(Mandatory = $true)] - [ValidateSet("Default","Enable","Disable")] - [System.String] - $Setting - ) - - $netadapterparams = @{ - ClassName = 'Win32_NetworkAdapter' - Filter = 'NetConnectionID="{0}"' -f $InterfaceAlias - } - $netAdapterConfig = Get-CimInstance @netadapterparams -ErrorAction Stop | - Get-CimAssociatedInstance ` - -ResultClassName Win32_NetworkAdapterConfiguration ` - -ErrorAction Stop - - if ($Setting -eq [NETBIOSSetting]::Default) - { - Write-Verbose -Message $LocalizedData.ResetToDefaut - #If DHCP is not enabled, settcpipnetbios CIM Method won't take 0 so overwrite registry entry instead. - $regParam = @{ - Path = "HKLM:\SYSTEM\CurrentControlSet\Services\NetBT\Parameters\Interfaces\Tcpip_$($NetAdapterConfig.SettingID)" - Name = 'NetbiosOptions' - Value = 0 - } - $null = Set-ItemProperty @regParam - } - else - { - Write-Verbose -Message ($LocalizedData.SetNetBIOS -f $Setting) - $null = $netAdapterConfig | - Invoke-CimMethod -MethodName SetTcpipNetbios -ErrorAction Stop -Arguments @{ - TcpipNetbiosOptions = [uint32][NETBIOSSetting]::$Setting.value__ - } - } -} - -<# - .SYNOPSIS - Tests the current state the Net Bios on an interface. - - .PARAMETER InterfaceAlias - Specifies the alias of a network interface. Supports the use of '*'. - - .PARAMETER Setting - Default - Use NetBios settings from the DHCP server. If static IP, Enable NetBIOS. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $InterfaceAlias, - - [parameter(Mandatory = $true)] - [ValidateSet("Default","Enable","Disable")] - [System.String] - $Setting - ) - - $nic = Get-CimInstance ` - -ClassName Win32_NetworkAdapter ` - -Filter "NetConnectionID=`"$InterfaceAlias`"" - if ($null -ne $nic) - { - Write-Verbose -Message ($LocalizedData.InterfaceDetected -f $InterfaceAlias,$nic.InterfaceIndex) - } - else - { - $errorParam = @{ - Message = ($LocalizedData.NICNotFound -f $InterfaceAlias) - ArgumentName = 'InterfaceAlias' - } - New-InvalidArgumentException @errorParam - } - - $nicConfig = $NIC | Get-CimAssociatedInstance -ResultClassName Win32_NetworkAdapterConfiguration - - Write-Verbose -Message ($LocalizedData.CurrentNetBiosSetting -f [NETBIOSSetting].GetEnumValues()[$NICConfig.TcpipNetbiosOptions]) - - $desiredSetting = ([NETBIOSSetting]::$($Setting)).value__ - Write-Verbose -Message ($LocalizedData.DesiredSetting -f $Setting) - - if ($nicConfig.TcpipNetbiosOptions -eq $desiredSetting) - { - Write-Verbose -Message $LocalizedData.InDesiredState - return $true - } - else - { - Write-Verbose -Message $LocalizedData.NotInDesiredState - return $false - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetBIOS/MSFT_xNetBIOS.schema.mof b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetBIOS/MSFT_xNetBIOS.schema.mof deleted file mode 100644 index d9e516a0..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetBIOS/MSFT_xNetBIOS.schema.mof +++ /dev/null @@ -1,7 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xNetBIOS")] -class MSFT_xNetBIOS : OMI_BaseResource -{ - [Key, Description("Specifies the alias of a network interface.")] String InterfaceAlias; - [Required, Description("Default - Use NetBios settings from the DHCP server. If static IP, Enable NetBIOS."), ValueMap{"Default","Enable","Disable"}, Values{"Default","Enable","Disable"}] String Setting; -}; diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetBIOS/en-US/MSFT_xNetBIOS.strings.psd1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetBIOS/en-US/MSFT_xNetBIOS.strings.psd1 deleted file mode 100644 index e5e3db0b..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetBIOS/en-US/MSFT_xNetBIOS.strings.psd1 +++ /dev/null @@ -1,13 +0,0 @@ -# Localized resources for MSFT_xNetBIOS - -ConvertFrom-StringData @' - GettingNetBiosSetting = Getting NetBIOS Configuration for Interface {0}. - InterfaceDetected = Interface {0} detected with Index number: {1}. - CurrentNetBiosSetting = Current NetBIOS Configuration: {0}. - DesiredSetting = Desired NetBIOS Configuration: {0}. - InDesiredState = NetBIOS configuration is in desired state. - NotInDesiredState = NetBIOS configuration is not in desired state. - ResetToDefaut = NetBIOS configuration will be reset to default. - SetNetBIOS = NetBIOS configuration will be set to: {0}. - NICNotFound = Interface {0} was not found. -'@ diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetConnectionProfile/MSFT_xNetConnectionProfile.psm1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetConnectionProfile/MSFT_xNetConnectionProfile.psm1 deleted file mode 100644 index 2c50ef60..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetConnectionProfile/MSFT_xNetConnectionProfile.psm1 +++ /dev/null @@ -1,232 +0,0 @@ -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Networking Common Modules -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` - -ChildPath 'NetworkingDsc.Common.psm1')) - -# Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` - -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$localizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xNetConnectionProfile' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# - .SYNOPSIS - Returns the current Networking Connection Profile for the specified interface. - - .PARAMETER InterfaceAlias - Specifies the alias for the Interface that is being changed. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Position = 0, Mandatory = $true)] - [string] - $InterfaceAlias - ) - - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($LocalizedData.GettingNetConnectionProfile) -f $InterfaceAlias - ) -join '') - - $result = Get-NetConnectionProfile -InterfaceAlias $InterfaceAlias - - return @{ - InterfaceAlias = $result.InterfaceAlias - NetworkCategory = $result.NetworkCategory - IPv4Connectivity = $result.IPv4Connectivity - IPv6Connectivity = $result.IPv6Connectivity - } -} - -<# - .SYNOPSIS - Sets the Network Connection Profile for a specified interface. - - .PARAMETER InterfaceAlias - Specifies the alias for the Interface that is being changed. - - .PARAMETER IPv4Connectivity - Specifies the IPv4 Connection Value. - - .PARAMETER IPv6Connectivity - Specifies the IPv6 Connection Value. - - .PARAMETER NetworkCategory - Sets the Network Category for the interface -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [string] - $InterfaceAlias, - - [ValidateSet('Disconnected', 'NoTraffic', 'Subnet', 'LocalNetwork', 'Internet')] - [string] - $IPv4Connectivity, - - [ValidateSet('Disconnected', 'NoTraffic', 'Subnet', 'LocalNetwork', 'Internet')] - [string] - $IPv6Connectivity, - - [ValidateSet('Public', 'Private')] - [string] - $NetworkCategory - ) - - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($LocalizedData.SetNetConnectionProfile) -f $InterfaceAlias - ) -join '') - - Assert-ResourceProperty @PSBoundParameters - - Set-NetConnectionProfile @PSBoundParameters -} - -<# - .SYNOPSIS - Tests is the Network Connection Profile for the specified interface is in the correct state. - - .PARAMETER InterfaceAlias - Specifies the alias for the Interface that is being changed. - - .PARAMETER IPv4Connectivity - Specifies the IPv4 Connection Value. - - .PARAMETER IPv6Connectivity - Specifies the IPv6 Connection Value. - - .PARAMETER NetworkCategory - Sets the NetworkCategory for the interface -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [string] - $InterfaceAlias, - - [Parameter()] - [ValidateSet('Disconnected', 'NoTraffic', 'Subnet', 'LocalNetwork', 'Internet')] - [string] - $IPv4Connectivity, - - [Parameter()] - [ValidateSet('Disconnected', 'NoTraffic', 'Subnet', 'LocalNetwork', 'Internet')] - [string] - $IPv6Connectivity, - - [Parameter()] - [ValidateSet('Public', 'Private')] - [string] - $NetworkCategory - ) - - Assert-ResourceProperty @PSBoundParameters - - $current = Get-TargetResource -InterfaceAlias $InterfaceAlias - - if (-not [String]::IsNullOrEmpty($IPv4Connectivity) -and ` - ($IPv4Connectivity -ne $current.IPv4Connectivity)) - { - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($LocalizedData.TestIPv4Connectivity) -f $IPv4Connectivity, $current.IPv4Connectivity - ) -join '') - - return $false - } - - if (-not [String]::IsNullOrEmpty($IPv6Connectivity) -and ` - ($IPv6Connectivity -ne $current.IPv6Connectivity)) - { - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($LocalizedData.TestIPv6Connectivity) -f $IPv6Connectivity, $current.IPv6Connectivity - ) -join '') - - return $false - } - - if (-not [String]::IsNullOrEmpty($NetworkCategory) -and ` - ($NetworkCategory -ne $current.NetworkCategory)) - { - Write-Verbose -Message ( @( "$($MyInvocation.MyCommand): " - $($LocalizedData.TestNetworkCategory) -f $NetworkCategory, $current.NetworkCategory - ) -join '') - - return $false - } - - return $true -} - -<# - .SYNOPSIS - Check the parameter combination that was passed was valid. - Ensures interface exists. If any problems are detected an - exception will be thrown. - - .PARAMETER InterfaceAlias - Specifies the alias for the Interface that is being changed. - - .PARAMETER IPv4Connectivity - Specifies the IPv4 Connection Value. - - .PARAMETER IPv6Connectivity - Specifies the IPv6 Connection Value. - - .PARAMETER NetworkCategory - Sets the NetworkCategory for the interface -#> -function Assert-ResourceProperty -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [string] - $InterfaceAlias, - - [Parameter()] - [ValidateSet('Disconnected', 'NoTraffic', 'Subnet', 'LocalNetwork', 'Internet')] - [string] - $IPv4Connectivity, - - [Parameter()] - [ValidateSet('Disconnected', 'NoTraffic', 'Subnet', 'LocalNetwork', 'Internet')] - [string] - $IPv6Connectivity, - - [Parameter()] - [ValidateSet('Public', 'Private')] - [string] - $NetworkCategory - ) - - if (-not (Get-NetAdapter | Where-Object -Property Name -EQ $InterfaceAlias )) - { - New-InvalidOperationException ` - -Message ($LocalizedData.InterfaceNotAvailableError -f $InterfaceAlias) - } - - if ([String]::IsNullOrEmpty($IPv4Connectivity) -and ` - [String]::IsNullOrEmpty($IPv6Connectivity) -and ` - [String]::IsNullOrEmpty($NetworkCategory)) - { - New-InvalidOperationException ` - -Message ($LocalizedData.ParameterCombinationError) - } -} # Assert-ResourceProperty diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetConnectionProfile/MSFT_xNetConnectionProfile.schema.mof b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetConnectionProfile/MSFT_xNetConnectionProfile.schema.mof deleted file mode 100644 index 71442f7d..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetConnectionProfile/MSFT_xNetConnectionProfile.schema.mof +++ /dev/null @@ -1,8 +0,0 @@ -[ClassVersion("1.0"), FriendlyName("xNetConnectionProfile")] -class MSFT_xNetConnectionProfile : OMI_BaseResource -{ - [Key, Description("Specifies the alias for the Interface that is being changed.")] string InterfaceAlias; - [Write, Description("Sets the Network Category for the interface."), ValueMap{"Disconnected", "NoTraffic", "Subnet", "LocalNetwork", "Internet"}, Values{"Disconnected", "NoTraffic", "Subnet", "LocalNetwork", "Internet"}] string IPv4Connectivity; - [Write, Description("Specifies the IPv4 Connection Value."), ValueMap{"Disconnected", "NoTraffic", "Subnet", "LocalNetwork", "Internet"}, Values{"Disconnected", "NoTraffic", "Subnet", "LocalNetwork", "Internet"}] string IPv6Connectivity; - [Write, Description("Specifies the IPv6 Connection Value."), ValueMap{"Public", "Private"}, Values{"Public", "Private"}] string NetworkCategory; -}; diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetConnectionProfile/en-US/MSFT_xNetConnectionProfile.strings.psd1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetConnectionProfile/en-US/MSFT_xNetConnectionProfile.strings.psd1 deleted file mode 100644 index 5a07b0e8..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetConnectionProfile/en-US/MSFT_xNetConnectionProfile.strings.psd1 +++ /dev/null @@ -1,11 +0,0 @@ -# Localized resources for MSFT_xNetConnectionProfile - -ConvertFrom-StringData @' - GettingNetConnectionProfile = Getting NetConnectionProfile from interface '{0}'. - TestIPv4Connectivity = IPv4Connectivity '{0}' does not match set IPv4Connectivity '{1}' - TestIPv6Connectivity = IPv6Connectivity '{0}' does not match set IPv6Connectivity '{1}' - TestNetworkCategory = NetworkCategory '{0}' does not match set NetworkCategory '{1}' - SetNetConnectionProfile = Setting NetConnectionProfile on interface '{0}' - InterfaceNotAvailableError = Interface "{0}" is not available. Please select a valid interface and try again. - ParameterCombinationError = At least one of the parameters IPv4Connectivity, IPv6Connectivity or NetworkCategory must be set. -'@ diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetworkTeam/MSFT_xNetworkTeam.psm1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetworkTeam/MSFT_xNetworkTeam.psm1 deleted file mode 100644 index 310dc602..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetworkTeam/MSFT_xNetworkTeam.psm1 +++ /dev/null @@ -1,306 +0,0 @@ -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Networking Common Modules -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` - -ChildPath 'NetworkingDsc.Common.psm1')) - -# Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` - -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$localizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xNetworkTeam' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# - .SYNOPSIS - Returns the current state of a Network Team. - - .PARAMETER Name - Specifies the name of the network team to create. - - .PARAMETER TeamMembers - Specifies the network interfaces that should be a part of the network team. - This is a comma-separated list. -#> -Function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - Param - ( - [Parameter(Mandatory = $true)] - [string] - $Name, - - [Parameter(Mandatory = $true)] - [String[]] - $TeamMembers - ) - - $configuration = @{ - name = $Name - teamMembers = $TeamMembers - } - - Write-Verbose -Message ($localizedData.GetTeamInfo -f $Name) - $networkTeam = Get-NetLBFOTeam -Name $Name -ErrorAction SilentlyContinue - - if ($networkTeam) - { - Write-Verbose -Message ($localizedData.FoundTeam -f $Name) - if ($null -eq (Compare-Object -ReferenceObject $TeamMembers -DifferenceObject $networkTeam.Members)) - { - Write-Verbose -Message ($localizedData.teamMembersExist -f $Name) - $configuration.Add('loadBalancingAlgorithm', $networkTeam.loadBalancingAlgorithm) - $configuration.Add('teamingMode', $networkTeam.teamingMode) - $configuration.Add('ensure','Present') - } - } - else - { - Write-Verbose -Message ($localizedData.TeamNotFound -f $Name) - $configuration.Add('ensure','Absent') - } - - return $configuration -} - -<# - .SYNOPSIS - Adds, updates or removes a Network Team. - - .PARAMETER Name - Specifies the name of the network team to create. - - .PARAMETER TeamMembers - Specifies the network interfaces that should be a part of the network team. - This is a comma-separated list. - - .PARAMETER TeamingMode - Specifies the teaming mode configuration. - - .PARAMETER LoadBalancingAlgorithm - Specifies the load balancing algorithm for the network team. - - .PARAMETER Ensure - Specifies if the network team should be created or deleted. -#> -Function Set-TargetResource -{ - [CmdletBinding()] - Param - ( - [Parameter(Mandatory = $true)] - [string] - $Name, - - [Parameter(Mandatory = $true)] - [String[]] - $TeamMembers, - - [Parameter()] - [ValidateSet("SwitchIndependent", "LACP", "Static")] - [String] - $TeamingMode = "SwitchIndependent", - - [Parameter()] - [ValidateSet("Dynamic", "HyperVPort", "IPAddresses", "MacAddresses", "TransportPorts")] - [String] - $LoadBalancingAlgorithm = "HyperVPort", - - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present' - ) - Write-Verbose -Message ($localizedData.GetTeamInfo -f $Name) - $networkTeam = Get-NetLBFOTeam -Name $Name -ErrorAction SilentlyContinue - - if ($Ensure -eq 'Present') - { - if ($networkTeam) - { - Write-Verbose -Message ($localizedData.foundTeam -f $Name) - $setArguments = @{ - 'name' = $Name - } - - if ($networkTeam.loadBalancingAlgorithm -ne $LoadBalancingAlgorithm) - { - Write-Verbose -Message ($localizedData.lbAlgoDifferent -f $LoadBalancingAlgorithm) - $setArguments.Add('loadBalancingAlgorithm', $LoadBalancingAlgorithm) - $isNetModifyRequired = $true - } - - if ($networkTeam.TeamingMode -ne $TeamingMode) - { - Write-Verbose -Message ($localizedData.teamingModeDifferent -f $TeamingMode) - $setArguments.Add('teamingMode', $TeamingMode) - $isNetModifyRequired = $true - } - - if ($isNetModifyRequired) - { - Write-Verbose -Message ($localizedData.modifyTeam -f $Name) - Set-NetLbfoTeam @setArguments -ErrorAction Stop -Confirm:$false - } - - $netTeamMembers = Compare-Object ` - -ReferenceObject $TeamMembers ` - -DifferenceObject $networkTeam.Members - if ($null -ne $netTeamMembers) - { - Write-Verbose -Message ($localizedData.membersDifferent -f $Name) - $membersToRemove = ($netTeamMembers | Where-Object {$_.SideIndicator -eq '=>'}).InputObject - if ($membersToRemove) - { - Write-Verbose -Message ($localizedData.removingMembers -f ($membersToRemove -join ',')) - $null = Remove-NetLbfoTeamMember -Name $membersToRemove ` - -Team $Name ` - -ErrorAction Stop ` - -Confirm:$false - } - - $membersToAdd = ($netTeamMembers | Where-Object {$_.SideIndicator -eq '<='}).InputObject - if ($membersToAdd) - { - Write-Verbose -Message ($localizedData.addingMembers -f ($membersToAdd -join ',')) - $null = Add-NetLbfoTeamMember -Name $membersToAdd ` - -Team $Name ` - -ErrorAction Stop ` - -Confirm:$false - } - } - - } - else - { - Write-Verbose -Message ($localizedData.createTeam -f $Name) - try - { - $null = New-NetLbfoTeam ` - -Name $Name ` - -TeamMembers $teamMembers ` - -TeamingMode $TeamingMode ` - -LoadBalancingAlgorithm $loadBalancingAlgorithm ` - -ErrorAction Stop ` - -Confirm:$false - Write-Verbose -Message $localizedData.createdNetTeam - } - - catch - { - $errorId = 'TeamCreateError' - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidOperation - $errorMessage = $localizedData.failedToCreateTeam - $exception = New-Object -TypeName System.InvalidOperationException ` - -ArgumentList $errorMessage - $errorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord ` - -ArgumentList $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord) - } - } - } - else - { - Write-Verbose -Message ($localizedData.removeTeam -f $Name) - $null = Remove-NetLbfoTeam -Name $name -ErrorAction Stop -Confirm:$false - } -} - -<# - .SYNOPSIS - Tests is a specified Network Team is in the correct state. - - .PARAMETER Name - Specifies the name of the network team to create. - - .PARAMETER TeamMembers - Specifies the network interfaces that should be a part of the network team. - This is a comma-separated list. - - .PARAMETER TeamingMode - Specifies the teaming mode configuration. - - .PARAMETER LoadBalancingAlgorithm - Specifies the load balancing algorithm for the network team. - - .PARAMETER Ensure - Specifies if the network team should be created or deleted. -#> -Function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - Param - ( - [Parameter(Mandatory = $true)] - [string] - $Name, - - [Parameter(Mandatory = $true)] - [String[]] - $TeamMembers, - - [Parameter()] - [ValidateSet("SwitchIndependent", "LACP", "Static")] - [String] - $TeamingMode = "SwitchIndependent", - - [Parameter()] - [ValidateSet("Dynamic", "HyperVPort", "IPAddresses", "MacAddresses", "TransportPorts")] - [String] - $LoadBalancingAlgorithm = "HyperVPort", - - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present' - ) - - Write-Verbose -Message ($localizedData.GetTeamInfo -f $Name) - $networkTeam = Get-NetLbfoTeam -Name $Name -ErrorAction SilentlyContinue - - if ($ensure -eq 'Present') - { - if ($networkTeam) - { - Write-Verbose -Message ($localizedData.foundTeam -f $Name) - if ( - ($networkTeam.LoadBalancingAlgorithm -eq $LoadBalancingAlgorithm) -and - ($networkTeam.teamingMode -eq $TeamingMode) -and - ($null -eq (Compare-Object -ReferenceObject $TeamMembers -DifferenceObject $networkTeam.Members)) - ) - { - Write-Verbose -Message ($localizedData.teamExistsNoAction -f $Name) - return $true - } - else - { - Write-Verbose -Message ($localizedData.teamExistsWithDifferentConfig -f $Name) - return $false - } - } - else - { - Write-Verbose -Message ($localizedData.teamDoesNotExistShouldCreate -f $Name) - return $false - } - } - else - { - if ($networkTeam) - { - Write-Verbose -Message ($localizedData.teamExistsShouldRemove -f $Name) - return $false - } - else - { - Write-Verbose -Message ($localizedData.teamDoesNotExistNoAction -f $Name) - return $true - } - } -} diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetworkTeam/MSFT_xNetworkTeam.schema.mof b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetworkTeam/MSFT_xNetworkTeam.schema.mof deleted file mode 100644 index b5d6df48..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetworkTeam/MSFT_xNetworkTeam.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("1.1"), FriendlyName("xNetworkTeam")] -class MSFT_xNetworkTeam : OMI_BaseResource -{ - [Key, Description("Specifies the name of the network team to create.")] String Name; - [Required, Description("Specifies the network interfaces that should be a part of the network team. This is a comma-separated list.")] String TeamMembers[]; - [Write, Description("Specifies the teaming mode configuration."), ValueMap{"SwitchIndependent","LACP","Static"}, Values{"SwitchIndependent","LACP","Static"}] String TeamingMode; - [Write, Description("Specifies the load balancing algorithm for the network team."), ValueMap{"Dynamic","HyperVPort","IPAddresses","MacAddresses","TransportPorts"}, Values{"Dynamic","HyperVPort","IPAddresses","MacAddresses","TransportPorts"}] String LoadBalancingAlgorithm; - [Write, Description("Specifies if the network team should be created or deleted."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; -}; diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetworkTeam/en-US/MSFT_xNetworkTeam.strings.psd1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetworkTeam/en-US/MSFT_xNetworkTeam.strings.psd1 deleted file mode 100644 index a4a4b3b2..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetworkTeam/en-US/MSFT_xNetworkTeam.strings.psd1 +++ /dev/null @@ -1,24 +0,0 @@ -# Localized resources for MSFT_xNetworkTeam - -ConvertFrom-StringData @' - getTeamInfo = Getting network team information for {0}. - foundTeam = Found a network team with name {0}. - teamMembersExist = Members in the network team {0} exist as per the configuration. - teamNotFound = Network team with name {0} not found. - lbAlgoDifferent = Load Balancing Algo is different from the requested {0} algo. - teamingModeDifferent = Teaming mode is different from the requested {0} mode. - modifyTeam = Modifying the network team named {0}. - membersDifferent = Members within the team named {0} are different from that requested in the configuration. - removingMembers = Removing members {0} not specified in the configuration. - addingMembers = Adding members {0} that are not a part of the team configuration. - createTeam = Creating a network team with the name {0}. - removeTeam = Removing a network team with the name {0}. - teamExistsNoAction = Network team with name {0} exists. No action needed. - teamExistsWithDifferentConfig = Network team with name {0} exists but with different configuration. This will be modified. - teamDoesNotExistShouldCreate = Network team with name {0} does not exist. It will be created. - teamExistsShouldRemove = Network team with name {0} exists. It will be removed. - teamDoesNotExistNoAction = Network team with name {0} does not exist. No action needed. - waitingForTeam = Waiting for network team status to change to up. - createdNetTeam = Network Team was created successfully. - failedToCreateTeam = Failed to create the network team with specific configuration. -'@ diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetworkTeamInterface/MSFT_xNetworkTeamInterface.psm1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetworkTeamInterface/MSFT_xNetworkTeamInterface.psm1 deleted file mode 100644 index 4a681dda..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetworkTeamInterface/MSFT_xNetworkTeamInterface.psm1 +++ /dev/null @@ -1,245 +0,0 @@ -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Networking Common Modules -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` - -ChildPath 'NetworkingDsc.Common.psm1')) - -# Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` - -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$localizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xNetworkTeamInterface' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# - .SYNOPSIS - Returns the current state of a Network Team Interface in a Network Team. - - .PARAMETER Name - Specifies the name of the network team interface to create. - - .PARAMETER TeamName - Specifies the name of the network team on which this particular interface should exist. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $TeamName - ) - - $configuration = @{ - name = $Name - teamName = $TeamName - } - - Write-Verbose -Message ($localizedData.GetTeamNicInfo -f $Name) - $teamNic = Get-NetLbfoTeamNic -Name $Name -Team $TeamName -ErrorAction SilentlyContinue - - if ($teamNic) - { - Write-Verbose -Message ($localizedData.FoundTeamNic -f $Name) - $configuration.Add("vlanID", $teamNic.VlanID) - $configuration.Add("ensure", "Present") - } - else - { - Write-Verbose -Message ($localizedData.TeamNicNotFound -f $Name) - $configuration.Add("ensure", "Absent") - } - - return $configuration -} - -<# - .SYNOPSIS - Adds, updates or removes a Network Team Interface from a Network Team. - - .PARAMETER Name - Specifies the name of the network team interface to create. - - .PARAMETER TeamName - Specifies the name of the network team on which this particular interface should exist. - - .PARAMETER VlanID - Specifies VlanID to be set on network team interface. - - .PARAMETER Ensure - Specifies if the network team interface should be created or deleted. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $TeamName, - - [System.UInt32] - $VlanID, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present" - ) - - Write-Verbose -Message ($LocalizedData.GetTeamNicInfo -f $Name) - $teamNic = Get-NetLbfoTeamNic -Name $Name -Team $TeamName -ErrorAction SilentlyContinue - - if ($Ensure -eq "Present") - { - if ($teamNic) - { - Write-Verbose -Message ($LocalizedData.FoundTeamNic -f $Name) - if ($teamNic.VlanID -ne $VlanID) - { - Write-Verbose -Message ($LocalizedData.TeamNicVlanMismatch -f $VlanID) - $isNetModifyRequired = $true - } - - if ($isNetModifyRequired) - { - Write-Verbose -Message ($LocalizedData.ModifyTeamNic -f $Name) - if ($VlanID -eq 0) - { - Set-NetLbfoTeamNic -Name $Name -Team $TeamName -Default ` - -ErrorAction Stop -Confirm:$false - } - else - { - # Required in case of primary interface, whose name gets changed - # to include VLAN ID, if specified - Set-NetLbfoTeamNic -Name $Name -Team $TeamName -VlanID $VlanID ` - -ErrorAction Stop -Confirm:$false -PassThru ` - | Rename-NetAdapter -NewName $Name ` - -ErrorAction SilentlyContinue ` - -Confirm:$false - } - } - } - else - { - Write-Verbose -Message ($LocalizedData.CreateTeamNic -f $Name) - if ($VlanID -ne 0) - { - $null = Add-NetLbfoTeamNic -Name $Name -Team $TeamName -VlanID $VlanID ` - -ErrorAction Stop -Confirm:$false - Write-Verbose -Message ($LocalizedData.CreatedNetTeamNic -f $Name) - } - else - { - $errorId = "TeamNicCreateError" - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidOperation - $errorMessage = $LocalizedData.FailedToCreateTeamNic - $exception = New-Object -TypeName System.InvalidOperationException ` - -ArgumentList $errorMessage - $errorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord ` - -ArgumentList $exception, $errorId, $errorCategory, $null - $PSCmdlet.ThrowTerminatingError($errorRecord) - } - } - } - else - { - Write-Verbose -Message ($LocalizedData.RemoveTeamNic -f $Name) - $null = Remove-NetLbfoTeamNic -Team $teamNic.Team -VlanID $teamNic.VlanID ` - -ErrorAction Stop -Confirm:$false - } -} - -<# - .SYNOPSIS - Tests is a specified Network Team Interface is in the correct state. - - .PARAMETER Name - Specifies the name of the network team interface to create. - - .PARAMETER TeamName - Specifies the name of the network team on which this particular interface should exist. - - .PARAMETER VlanID - Specifies VlanID to be set on network team interface. - - .PARAMETER Ensure - Specifies if the network team interface should be created or deleted. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $TeamName, - - [System.UInt32] - $VlanID, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present" - ) - - Write-Verbose -Message ($LocalizedData.GetTeamNicInfo -f $Name) - $teamNic = Get-NetLbfoTeamNic -Name $Name -Team $TeamName -ErrorAction SilentlyContinue - - if ($Ensure -eq "Present") - { - if ($teamNic) - { - Write-Verbose -Message ($LocalizedData.FoundTeamNic -f $Name) - if ($teamNic.VlanID -eq $VlanID) - { - Write-Verbose -Message ($LocalizedData.TeamNicExistsNoAction -f $Name) - return $true - } - else - { - Write-Verbose -Message ($LocalizedData.TeamNicExistsWithDifferentConfig -f $Name) - return $false - } - } - else - { - Write-Verbose -Message ($LocalizedData.TeamNicDoesNotExistShouldCreate -f $Name) - return $false - } - } - else - { - if ($teamNic) - { - Write-Verbose -Message ($LocalizedData.TeamNicExistsShouldRemove -f $Name) - return $false - } - else - { - Write-Verbose -Message ($LocalizedData.TeamNicExistsNoAction -f $Name) - return $true - } - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetworkTeamInterface/MSFT_xNetworkTeamInterface.schema.mof b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetworkTeamInterface/MSFT_xNetworkTeamInterface.schema.mof deleted file mode 100644 index 82967f02..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetworkTeamInterface/MSFT_xNetworkTeamInterface.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ - -[ClassVersion("1.0"), FriendlyName("xNetworkTeamInterface")] -class MSFT_xNetworkTeamInterface : OMI_BaseResource -{ - [Key, Description("Specifies the name of the network team interface to create.")] String Name; - [Required, Description("Specifies the name of the network team on which this particular interface should exist.")] String TeamName; - [Write, Description("Specifies VlanID to be set on network team interface.")] Uint32 VlanID; - [Write, Description("Specifies if the network team interface should be created or deleted."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; -}; diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetworkTeamInterface/en-US/MSFT_xNetworkTeamInterface.strings.psd1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetworkTeamInterface/en-US/MSFT_xNetworkTeamInterface.strings.psd1 deleted file mode 100644 index 136cce2e..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xNetworkTeamInterface/en-US/MSFT_xNetworkTeamInterface.strings.psd1 +++ /dev/null @@ -1,19 +0,0 @@ -# Localized resources for MSFT_xNetwrkTeamInterface - -ConvertFrom-StringData @" - getTeamNicInfo = Getting network team interface information for {0}. - foundTeamNic = Found a network team interface with name {0}. - teamNicNotFound = Network team interface with name {0} not found. - teamNicVlanMismatch = Vlan ID is different from the requested ID of {0}. - modifyTeamNic = Modifying the network team interface named {0}. - createTeamNic = Creating a network team interface with the name {0}. - removeTeamNic = Removing a network team interface with the name {0}. - teamNicExistsNoAction = Network team interface with name {0} exists. No action needed. - teamNicExistsWithDifferentConfig = Network team interface with name {0} exists but with different configuration. This will be modified. - teamNicDoesNotExistShouldCreate = Network team interface with name {0} does not exist. It will be created. - teamNicExistsShouldRemove = Network team interface with name {0} exists. It will be removed. - teamNicDoesNotExistNoAction = Network team interface with name {0} does not exist. No action needed. - waitingForTeamNic = Waiting for network team interface status to change to up. - createdNetTeamNic = Network Team Interface was created successfully. - failedToCreateTeamNic = Failed to create the network team interface with specific configuration. -"@ diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xRoute/MSFT_xRoute.psm1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xRoute/MSFT_xRoute.psm1 deleted file mode 100644 index 0dedecd8..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xRoute/MSFT_xRoute.psm1 +++ /dev/null @@ -1,675 +0,0 @@ -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Networking Common Modules -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` - -ChildPath 'NetworkingDsc.Common.psm1')) - -# Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` - -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$localizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xRoute' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# - .SYNOPSIS - Returns the current state of a Route for an interface. - - .PARAMETER InterfaceAlias - Specifies the alias of a network interface. - - .PARAMETER AddressFamily - Specify the IP address family. - - .PARAMETER DestinationPrefix - Specifies a destination prefix of an IP route. - A destination prefix consists of an IP address prefix and a prefix length, separated by a slash (/). - - .PARAMETER NextHop - Specifies the next hop for the IP route. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $InterfaceAlias, - - [Parameter(Mandatory = $true)] - [ValidateSet('IPv4', 'IPv6')] - [String] $AddressFamily, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $DestinationPrefix, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $NextHop - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.GettingRouteMessage) ` - -f $AddressFamily,$InterfaceAlias,$DestinationPrefix,$NextHop ` - ) -join '' ) - - # Lookup the existing Route - $route = Get-Route @PSBoundParameters - - $returnValue = @{ - InterfaceAlias = $InterfaceAlias - AddressFamily = $AddressFamily - DestinationPrefix = $DestinationPrefix - NextHop = $NextHop - } - if ($route) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.RouteExistsMessage) ` - -f $AddressFamily,$InterfaceAlias,$DestinationPrefix,$NextHop ` - ) -join '' ) - - $returnValue += @{ - Ensure = 'Present' - RouteMetric = [Uint16] $route.RouteMetric - Publish = $route.Publish - PreferredLifetime = [Double] $route.PreferredLifetime.TotalSeconds - } - } - else - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.RouteDoesNotExistMessage) ` - -f $AddressFamily,$InterfaceAlias,$DestinationPrefix,$NextHop ` - ) -join '' ) - - $returnValue += @{ - Ensure = 'Absent' - } - } - - $returnValue -} # Get-TargetResource - -<# - .SYNOPSIS - Sets a Route for an interface. - - .PARAMETER InterfaceAlias - Specifies the alias of a network interface. - - .PARAMETER AddressFamily - Specify the IP address family. - - .PARAMETER DestinationPrefix - Specifies a destination prefix of an IP route. - A destination prefix consists of an IP address prefix and a prefix length, separated by a slash (/). - - .PARAMETER NextHop - Specifies the next hop for the IP route. - - .PARAMETER Ensure - Specifies whether the route should exist. - - .PARAMETER RouteMetric - Specifies an integer route metric for an IP route. - - .PARAMETER Publish - Specifies the publish setting of an IP route. - - .PARAMETER PreferredLifetime - Specifies a preferred lifetime in seconds of an IP route. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $InterfaceAlias, - - [Parameter(Mandatory = $true)] - [ValidateSet('IPv4', 'IPv6')] - [String] - $AddressFamily, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $DestinationPrefix, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $NextHop, - - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present', - - [Uint16] - $RouteMetric = 256, - - [ValidateSet('No', 'Yes', 'Age')] - [String] - $Publish = 'No', - - [Double] - $PreferredLifetime - ) - - # Remove any parameters that can't be splatted. - $null = $PSBoundParameters.Remove('Ensure') - - # Lookup the existing Route - $route = Get-Route @PSBoundParameters - - if ($Ensure -eq 'Present') - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.EnsureRouteExistsMessage) ` - -f $AddressFamily,$InterfaceAlias,$DestinationPrefix,$NextHop ` - ) -join '' ) - - if ($route) - { - # The Route exists - update it - Set-NetRoute @PSBoundParameters ` - -Confirm:$false ` - -ErrorAction Stop - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.RouteUpdatedMessage) ` - -f $AddressFamily,$InterfaceAlias,$DestinationPrefix,$NextHop ` - ) -join '' ) - } - else - { - # The Route does not exit - create it - New-NetRoute @PSBoundParameters ` - -ErrorAction Stop - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.RouteCreatedMessage) ` - -f $AddressFamily,$InterfaceAlias,$DestinationPrefix,$NextHop ` - ) -join '' ) - } - } - else - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.EnsureRouteDoesNotExistMessage) ` - -f $AddressFamily,$InterfaceAlias,$DestinationPrefix,$NextHop ` - ) -join '' ) - - if ($route) - { - <# - The Route exists - remove it - Use the parameters passed to Set-TargetResource to delete the appropriate route. - Clear the Publish and PreferredLifetime parameters so they aren't passed to the - Remove-NetRoute cmdlet. - #> - - $null = $PSBoundParameters.Remove('Publish') - $null = $PSBoundParameters.Remove('PreferredLifetime') - - Remove-NetRoute @PSBoundParameters ` - -Confirm:$false ` - -ErrorAction Stop - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.RouteRemovedMessage) ` - -f $AddressFamily,$InterfaceAlias,$DestinationPrefix,$NextHop ` - ) -join '' ) - } # if - } # if -} # Set-TargetResource - -<# - .SYNOPSIS - Tests the state of a Route on an interface. - - .PARAMETER InterfaceAlias - Specifies the alias of a network interface. - - .PARAMETER AddressFamily - Specify the IP address family. - - .PARAMETER DestinationPrefix - Specifies a destination prefix of an IP route. - A destination prefix consists of an IP address prefix and a prefix length, separated by a slash (/). - - .PARAMETER NextHop - Specifies the next hop for the IP route. - - .PARAMETER Ensure - Specifies whether the route should exist. - - .PARAMETER RouteMetric - Specifies an integer route metric for an IP route. - - .PARAMETER Publish - Specifies the publish setting of an IP route. - - .PARAMETER PreferredLifetime - Specifies a preferred lifetime in seconds of an IP route. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $InterfaceAlias, - - [Parameter(Mandatory = $true)] - [ValidateSet('IPv4', 'IPv6')] - [String] - $AddressFamily, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $DestinationPrefix, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $NextHop, - - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present', - - [Uint16] - $RouteMetric = 256, - - [ValidateSet('No', 'Yes', 'Age')] - [String] - $Publish = 'No', - - [Double] - $PreferredLifetime - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.TestingRouteMessage) ` - -f $AddressFamily,$InterfaceAlias,$DestinationPrefix,$NextHop ` - ) -join '' ) - - # Flag to signal whether settings are correct - [Boolean] $desiredConfigurationMatch = $true - - # Remove any parameters that can't be splatted. - $null = $PSBoundParameters.Remove('Ensure') - - # Check the parameters - Assert-ResourceProperty @PSBoundParameters - - # Lookup the existing Route - $route = Get-Route @PSBoundParameters - - if ($Ensure -eq 'Present') - { - # The route should exist - if ($route) - { - # The route exists and does - but check the parameters - if (($PSBoundParameters.ContainsKey('RouteMetric')) ` - -and ($route.RouteMetric -ne $RouteMetric)) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.RoutePropertyNeedsUpdateMessage) ` - -f $AddressFamily,$InterfaceAlias,$DestinationPrefix,$NextHop,'RouteMetric' ` - ) -join '' ) - $desiredConfigurationMatch = $false - } - - if (($PSBoundParameters.ContainsKey('Publish')) ` - -and ($route.Publish -ne $Publish)) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.RoutePropertyNeedsUpdateMessage) ` - -f $AddressFamily,$InterfaceAlias,$DestinationPrefix,$NextHop,'Publish' ` - ) -join '' ) - $desiredConfigurationMatch = $false - } - - if (($PSBoundParameters.ContainsKey('PreferredLifetime')) ` - -and ($route.PreferredLifetime.TotalSeconds -ne $PreferredLifetime)) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.RoutePropertyNeedsUpdateMessage) ` - -f $AddressFamily,$InterfaceAlias,$DestinationPrefix,$NextHop,'PreferredLifetime' ` - ) -join '' ) - $desiredConfigurationMatch = $false - } - } - else - { - # The route doesn't exist but should - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.RouteDoesNotExistButShouldMessage) ` - -f $AddressFamily,$InterfaceAlias,$DestinationPrefix,$NextHop ` - ) -join '' ) - $desiredConfigurationMatch = $false - } - } - else - { - # The route should not exist - if ($route) - { - # The route exists but should not - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.RouteExistsButShouldNotMessage) ` - -f $AddressFamily,$InterfaceAlias,$DestinationPrefix,$NextHop ` - ) -join '' ) - $desiredConfigurationMatch = $false - } - else - { - # The route does not exist and should not - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($LocalizedData.RouteDoesNotExistAndShouldNotMessage) ` - -f $AddressFamily,$InterfaceAlias,$DestinationPrefix,$NextHop ` - ) -join '' ) - } - } # if - return $desiredConfigurationMatch -} # Test-TargetResource - -<# - .SYNOPSIS - This function looks up the route using the parameters and returns - it. If the route is not found $null is returned. - - .PARAMETER InterfaceAlias - Specifies the alias of a network interface. - - .PARAMETER AddressFamily - Specify the IP address family. - - .PARAMETER DestinationPrefix - Specifies a destination prefix of an IP route. - A destination prefix consists of an IP address prefix and a prefix length, separated by a slash (/). - - .PARAMETER NextHop - Specifies the next hop for the IP route. - - .PARAMETER Ensure - Specifies whether the route should exist. - - .PARAMETER RouteMetric - Specifies an integer route metric for an IP route. - - .PARAMETER Publish - Specifies the publish setting of an IP route. - - .PARAMETER PreferredLifetime - Specifies a preferred lifetime in seconds of an IP route. - -#> -Function Get-Route -{ - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $InterfaceAlias, - - [Parameter(Mandatory = $true)] - [ValidateSet('IPv4', 'IPv6')] - [String] - $AddressFamily, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $DestinationPrefix, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $NextHop, - - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present', - - [Uint16] - $RouteMetric = 256, - - [ValidateSet('No', 'Yes', 'Age')] - [String] - $Publish = 'No', - - [Double] - $PreferredLifetime - ) - - try - { - $route = Get-NetRoute ` - -InterfaceAlias $InterfaceAlias ` - -AddressFamily $AddressFamily ` - -DestinationPrefix $DestinationPrefix ` - -NextHop $NextHop ` - -ErrorAction Stop - } - catch [Microsoft.PowerShell.Cmdletization.Cim.CimJobException] - { - $route = $null - } - catch - { - Throw $_ - } - Return $route -} - -<# - .SYNOPSIS - This function validates the parameters passed. Called by Test-Resource. - Will throw an error if any parameters are invalid. - - .PARAMETER InterfaceAlias - Specifies the alias of a network interface. - - .PARAMETER AddressFamily - Specify the IP address family. - - .PARAMETER DestinationPrefix - Specifies a destination prefix of an IP route. - A destination prefix consists of an IP address prefix and a prefix length, separated by a slash (/). - - .PARAMETER NextHop - Specifies the next hop for the IP route. - - .PARAMETER Ensure - Specifies whether the route should exist. - - .PARAMETER RouteMetric - Specifies an integer route metric for an IP route. - - .PARAMETER Publish - Specifies the publish setting of an IP route. - - .PARAMETER PreferredLifetime - Specifies a preferred lifetime in seconds of an IP route. -#> -Function Assert-ResourceProperty -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $InterfaceAlias, - - [Parameter(Mandatory = $true)] - [ValidateSet('IPv4', 'IPv6')] - [String] - $AddressFamily, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $DestinationPrefix, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $NextHop, - - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present', - - [Uint16] - $RouteMetric = 256, - - [ValidateSet('No', 'Yes', 'Age')] - [String] - $Publish = 'No', - - [Double] - $PreferredLifetime - ) - - # Validate the Adapter exists - if (-not (Get-NetAdapter | Where-Object -Property Name -EQ $InterfaceAlias )) - { - $errorId = 'InterfaceNotAvailable' - $errorCategory = [System.Management.Automation.ErrorCategory]::DeviceError - $errorMessage = $($LocalizedData.InterfaceNotAvailableError) -f $InterfaceAlias - $exception = New-Object -TypeName System.InvalidOperationException ` - -ArgumentList $errorMessage - $errorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord ` - -ArgumentList $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord) - } - - # Validate the DestinationPrefix Parameter - $Components = $DestinationPrefix -split '/' - $Prefix = $Components[0] - $Subnet = $Components[1] - - if (-not ([System.Net.Ipaddress]::TryParse($Prefix, [ref]0))) - { - $errorId = 'AddressFormatError' - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidArgument - $errorMessage = $($LocalizedData.AddressFormatError) -f $Prefix - $exception = New-Object -TypeName System.InvalidOperationException ` - -ArgumentList $errorMessage - $errorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord ` - -ArgumentList $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord) - } - - $detectedAddressFamily = ([System.Net.IPAddress] $Prefix).AddressFamily.ToString() - if (($detectedAddressFamily -eq [System.Net.Sockets.AddressFamily]::InterNetwork.ToString()) ` - -and ($AddressFamily -ne 'IPv4')) - { - $errorId = 'AddressMismatchError' - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidArgument - $errorMessage = $($LocalizedData.AddressIPv4MismatchError) -f $Prefix,$AddressFamily - $exception = New-Object -TypeName System.InvalidOperationException ` - -ArgumentList $errorMessage - $errorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord ` - -ArgumentList $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord) - } - - if (($detectedAddressFamily -eq [System.Net.Sockets.AddressFamily]::InterNetworkV6.ToString()) ` - -and ($AddressFamily -ne 'IPv6')) - { - $errorId = 'AddressMismatchError' - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidArgument - $errorMessage = $($LocalizedData.AddressIPv6MismatchError) -f $Prefix,$AddressFamily - $exception = New-Object -TypeName System.InvalidOperationException ` - -ArgumentList $errorMessage - $errorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord ` - -ArgumentList $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord) - } - - # Validate the NextHop Parameter - if (-not ([System.Net.Ipaddress]::TryParse($NextHop, [ref]0))) - { - $errorId = 'AddressFormatError' - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidArgument - $errorMessage = $($LocalizedData.AddressFormatError) -f $NextHop - $exception = New-Object -TypeName System.InvalidOperationException ` - -ArgumentList $errorMessage - $errorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord ` - -ArgumentList $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord) - } - - $detectedAddressFamily = ([System.Net.IPAddress] $NextHop).AddressFamily.ToString() - if (($detectedAddressFamily -eq [System.Net.Sockets.AddressFamily]::InterNetwork.ToString()) ` - -and ($AddressFamily -ne 'IPv4')) - { - $errorId = 'AddressMismatchError' - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidArgument - $errorMessage = $($LocalizedData.AddressIPv4MismatchError) -f $NextHop,$AddressFamily - $exception = New-Object -TypeName System.InvalidOperationException ` - -ArgumentList $errorMessage - $errorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord ` - -ArgumentList $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord) - } - - if (($detectedAddressFamily -eq [System.Net.Sockets.AddressFamily]::InterNetworkV6.ToString()) ` - -and ($AddressFamily -ne 'IPv6')) - { - $errorId = 'AddressMismatchError' - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidArgument - $errorMessage = $($LocalizedData.AddressIPv6MismatchError) -f $NextHop,$AddressFamily - $exception = New-Object -TypeName System.InvalidOperationException ` - -ArgumentList $errorMessage - $errorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord ` - -ArgumentList $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord) - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xRoute/MSFT_xRoute.schema.mof b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xRoute/MSFT_xRoute.schema.mof deleted file mode 100644 index 3d3e1429..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xRoute/MSFT_xRoute.schema.mof +++ /dev/null @@ -1,12 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xRoute")] -class MSFT_xRoute : OMI_BaseResource -{ - [Key, Description("Specifies the alias of a network interface.")] string InterfaceAlias; - [Key, Description("Specifies the IP address family."), ValueMap{"IPv4", "IPv6"},Values{"IPv4", "IPv6"}] string AddressFamily; - [Key, Description("Specifies a destination prefix of an IP route. A destination prefix consists of an IP address prefix and a prefix length, separated by a slash (/).")] String DestinationPrefix; - [Key, Description("Specifies the next hop for the IP route.")] String NextHop; - [Write, Description("Specifies whether the route should exist."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, Description("Specifies an integer route metric for an IP route.")] Uint16 RouteMetric; - [Write, Description("Specifies the publish setting of an IP route."), ValueMap{"No","Yes","Age"}, Values{"No","Yes","Age"}] String Publish; - [Write, Description("Specifies a preferred lifetime in seconds of an IP route.")] Real64 PreferredLifetime; -}; diff --git a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xRoute/en-US/MSFT_xRoute.strings.psd1 b/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xRoute/en-US/MSFT_xRoute.strings.psd1 deleted file mode 100644 index e767619e..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/DSCResources/MSFT_xRoute/en-US/MSFT_xRoute.strings.psd1 +++ /dev/null @@ -1,22 +0,0 @@ -# Localized resources for MSFT_xRoute - -ConvertFrom-StringData @' - GettingRouteMessage = Getting {0} Route on "{1}" dest {2} nexthop {3}. - RouteExistsMessage = {0} Route on "{1}" dest {2} nexthop {3} exists. - RouteDoesNotExistMessage = {0} Route on "{1}" dest {2} nexthop {3} does not exist. - SettingRouteMessage = Setting {0} Route on "{1}" dest {2} nexthop {3}. - EnsureRouteExistsMessage = Ensuring {0} Route on "{1}" dest {2} nexthop {3} exists. - EnsureRouteDoesNotExistMessage = Ensuring {0} Route on "{1}" dest {2} nexthop {3} does not exist. - RouteCreatedMessage = {0} Route on "{1}" dest {2} nexthop {3} has been created. - RouteUpdatedMessage = {0} Route on "{1}" dest {2} nexthop {3} has been updated. - RouteRemovedMessage = {0} Route on "{1}" dest {2} nexthop {3} has been removed. - TestingRouteMessage = Testing {0} Route on "{1}" dest {2} nexthop {3}. - RoutePropertyNeedsUpdateMessage = {4} property on {0} Route on "{1}" dest {2} nexthop {3} is different. Change required. - RouteDoesNotExistButShouldMessage = {0} Route on "{1}" dest {2} nexthop {3} does not exist but should. Change required. - RouteExistsButShouldNotMessage = {0} Route on "{1}" dest {2} nexthop {3} exists but should not. Change required. - RouteDoesNotExistAndShouldNotMessage = {0} Route on "{1}" dest {2} nexthop {3} does not exist and should not. Change not required. - InterfaceNotAvailableError = Interface "{0}" is not available. Please select a valid interface and try again. - AddressFormatError = Address "{0}" is not in the correct format. Please correct the Address parameter in the configuration and try again. - AddressIPv4MismatchError = Address "{0}" is in IPv4 format, which does not match address family {1}. Please correct either of them in the configuration and try again. - AddressIPv6MismatchError = Address "{0}" is in IPv6 format, which does not match address family {1}. Please correct either of them in the configuration and try again. -'@ diff --git a/lib/puppet_x/dsc_resources/xNetworking/LICENSE b/lib/puppet_x/dsc_resources/xNetworking/LICENSE deleted file mode 100644 index a1d2d916..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2017 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/lib/puppet_x/dsc_resources/xNetworking/Modules/NetworkingDsc.Common/NetworkingDsc.Common.psm1 b/lib/puppet_x/dsc_resources/xNetworking/Modules/NetworkingDsc.Common/NetworkingDsc.Common.psm1 deleted file mode 100644 index 5b7521ff..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/Modules/NetworkingDsc.Common/NetworkingDsc.Common.psm1 +++ /dev/null @@ -1,428 +0,0 @@ -# Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` - -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` - -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$script:localizedData = Get-LocalizedData ` - -ResourceName 'NetworkingDsc.Common' ` - -ResourcePath $PSScriptRoot - -<# - .SYNOPSIS - Converts any IP Addresses containing CIDR notation filters in an array to use Subnet Mask - notation. - - .PARAMETER Address - The array of addresses to that need to be converted. -#> -function Convert-CIDRToSubhetMask -{ - [CmdletBinding()] - [OutputType([ Microsoft.Management.Infrastructure.CimInstance])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String[]] $Address - ) - - $Results = @() - foreach ($Entry in $Address) - { - if (-not $Entry.Contains(':') -and -not $Entry.Contains('-')) - { - $EntrySplit = $Entry -split '/' - if (-not [String]::IsNullOrEmpty($EntrySplit[1])) - { - # There was a / so this contains a Subnet Mask or CIDR - $Prefix = $EntrySplit[0] - $Postfix = $EntrySplit[1] - if ($Postfix -match '^[0-9]*$') - { - # The postfix contains CIDR notation so convert this to Subnet Mask - $Cidr = [Int] $Postfix - $SubnetMaskInt64 = ([convert]::ToInt64(('1' * $Cidr + '0' * (32 - $Cidr)), 2)) - $SubnetMask = @( - ([math]::Truncate($SubnetMaskInt64 / 16777216)) - ([math]::Truncate(($SubnetMaskInt64 % 16777216) / 65536)) - ([math]::Truncate(($SubnetMaskInt64 % 65536)/256)) - ([math]::Truncate($SubnetMaskInt64 % 256)) - ) - } - else - { - $SubnetMask = $Postfix -split '\.' - } - # Apply the Subnet Mast to the IP Address so that we end up with a correctly - # masked IP Address that will match what the Firewall rule returns. - $MaskedIp = $Prefix -split '\.' - for ([int] $Octet = 0; $Octet -lt 4; $Octet++) - { - $MaskedIp[$Octet] = $MaskedIp[$Octet] -band $SubnetMask[$Octet] - } - $Entry = '{0}/{1}' -f ($MaskedIp -join '.'),($SubnetMask -join '.') - } - } - $Results += $Entry - } - return $Results -} # Convert-CIDRToSubhetMask - -<# - .SYNOPSIS - This function will find a network adapter based on the provided - search parameters. - - .PARAMETER Name - This is the name of network adapter to find. - - .PARAMETER PhysicalMediaType - This is the media type of the network adapter to find. - - .PARAMETER Status - This is the status of the network adapter to find. - - .PARAMETER MacAddress - This is the MAC address of the network adapter to find. - - .PARAMETER InterfaceDescription - This is the interface description of the network adapter to find. - - .PARAMETER InterfaceIndex - This is the interface index of the network adapter to find. - - .PARAMETER InterfaceGuid - This is the interface GUID of the network adapter to find. - - .PARAMETER DriverDescription - This is the driver description of the network adapter. - - .PARAMETER InterfaceNumber - This is the interface number of the network adapter if more than one - are returned by the parameters. - - .PARAMETER IgnoreMultipleMatchingAdapters - This switch will suppress an error occurring if more than one matching - adapter matches the parameters passed. -#> -function Find-NetworkAdapter -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter()] - [System.String] - $Name, - - [Parameter()] - [System.String] - $PhysicalMediaType, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [ValidateSet('Up','Disconnected','Disabled')] - [System.String] - $Status = 'Up', - - [Parameter()] - [System.String] - $MacAddress, - - [Parameter()] - [System.String] - $InterfaceDescription, - - [Parameter()] - [System.UInt32] - $InterfaceIndex, - - [Parameter()] - [System.String] - $InterfaceGuid, - - [Parameter()] - [System.String] - $DriverDescription, - - [Parameter()] - [System.UInt32] - $InterfaceNumber = 1, - - [Parameter()] - [System.Boolean] - $IgnoreMultipleMatchingAdapters = $false - ) - - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($LocalizedData.FindingNetAdapterMessage) - ) -join '') - - $adapterFilters = @() - if($PSBoundParameters.ContainsKey('Name')) - { - $adapterFilters += @('($_.Name -eq $Name)') - } # if - - if($PSBoundParameters.ContainsKey('PhysicalMediaType')) - { - $adapterFilters += @('($_.PhysicalMediaType -eq $PhysicalMediaType)') - } # if - - if($PSBoundParameters.ContainsKey('Status')) { - $adapterFilters += @('($_.Status -eq $Status)') - } # if - - if($PSBoundParameters.ContainsKey('MacAddress')) - { - $adapterFilters += @('($_.MacAddress -eq $MacAddress)') - } # if - - if($PSBoundParameters.ContainsKey('InterfaceDescription')) - { - $adapterFilters += @('($_.InterfaceDescription -eq $InterfaceDescription)') - } # if - - if($PSBoundParameters.ContainsKey('InterfaceIndex')) - { - $adapterFilters += @('($_.InterfaceIndex -eq $InterfaceIndex)') - } # if - - if($PSBoundParameters.ContainsKey('InterfaceGuid')) - { - $adapterFilters += @('($_.InterfaceGuid -eq $InterfaceGuid)') - } # if - - if($PSBoundParameters.ContainsKey('DriverDescription')) - { - $adapterFilters += @('($_.DriverDescription -eq $DriverDescription)') - } # if - - if ($adapterFilters.Count -eq 0) - { - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($LocalizedData.AllNetAdaptersFoundMessage) - ) -join '') - - $matchingAdapters = @(Get-NetAdapter) - } - else - { - # Join all the filters together - $adapterFilterScript = '(' + ($adapterFilters -join ' -and ') + ')' - $matchingAdapters = @(Get-NetAdapter | - Where-Object -FilterScript ([ScriptBlock]::Create($adapterFilterScript))) - } - - # Were any adapters found matching the criteria? - if ($matchingAdapters.Count -eq 0) - { - New-InvalidOperationException ` - -Message ($LocalizedData.NetAdapterNotFoundError) - - # Return a null so that ErrorAction SilentlyContinue works correctly - return $null - } - else - { - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($LocalizedData.NetAdapterFoundMessage -f $matchingAdapters.Count) - ) -join '') - - if ($matchingAdapters.Count -gt 1) - { - if ($IgnoreMultipleMatchingAdapters) - { - # Was the number of matching adapters found matching the adapter number? - if (($InterfaceNumber -gt 1) -and ($InterfaceNumber -gt $matchingAdapters.Count)) - { - New-InvalidOperationException ` - -Message ($LocalizedData.InvalidNetAdapterNumberError ` - -f $matchingAdapters.Count,$InterfaceNumber) - - # Return a null so that ErrorAction SilentlyContinue works correctly - return $null - } # if - } - else - { - New-InvalidOperationException ` - -Message ($LocalizedData.MultipleMatchingNetAdapterFound ` - -f $matchingAdapters.Count) - - # Return a null so that ErrorAction SilentlyContinue works correctly - return $null - } # if - } # if - } # if - - # Identify the exact adapter from the adapters that match - $exactAdapter = $matchingAdapters[$InterfaceNumber - 1] - - $returnValue = [PSCustomObject] @{ - Name = $exactAdapter.Name - PhysicalMediaType = $exactAdapter.PhysicalMediaType - Status = $exactAdapter.Status - MacAddress = $exactAdapter.MacAddress - InterfaceDescription = $exactAdapter.InterfaceDescription - InterfaceIndex = $exactAdapter.InterfaceIndex - InterfaceGuid = $exactAdapter.InterfaceGuid - MatchingAdapterCount = $matchingAdapters.Count - } - - return $returnValue -} # Find-NetworkAdapter - -<# - .SYNOPSIS - Returns the DNS Client Server static address that are assigned to a network - adapter. This is required because Get-DnsClientServerAddress always returns - the currently assigned server addresses whether regardless if they were - assigned as static or by DHCP. - - The only way that could be found to do this is to query the registry. - - .PARAMETER InterfaceAlias - Alias of the network interface to get the static DNS Server addresses from. - - .PARAMETER AddressFamily - IP address family. -#> -function Get-DnsClientServerStaticAddress -{ - [CmdletBinding()] - [OutputType([String[]])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $InterfaceAlias, - - [Parameter(Mandatory = $true)] - [ValidateSet('IPv4', 'IPv6')] - [String] - $AddressFamily - ) - - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($LocalizedData.GettingDNSServerStaticAddressMessage) -f $AddressFamily,$InterfaceAlias - ) -join '') - - # Look up the interface Guid - $adapter = Get-NetAdapter ` - -InterfaceAlias $InterfaceAlias ` - -ErrorAction SilentlyContinue - - if (-not $adapter) - { - New-InvalidOperationException ` - -Message ($LocalizedData.InterfaceAliasNotFoundError ` - -f $InterfaceAlias) - - # Return null to support ErrorAction Silently Continue - return $null - } # if - - $interfaceGuid = $adapter.InterfaceGuid.ToLower() - - if ($AddressFamily -eq 'IPv4') - { - $interfaceRegKeyPath = "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\$interfaceGuid\" - } - else - { - $interfaceRegKeyPath = "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters\Interfaces\$interfaceGuid\" - } # if - - - $interfaceInformation = Get-ItemProperty ` - -Path $interfaceRegKeyPath ` - -ErrorAction SilentlyContinue - $nameServerAddressString = $interfaceInformation.NameServer - - # Are any statically assigned addresses for this adapter? - if ([String]::IsNullOrWhiteSpace($nameServerAddressString)) - { - # Static DNS Server addresses not found so return empty array - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($LocalizedData.DNSServerStaticAddressNotSetMessage) -f $AddressFamily,$InterfaceAlias - ) -join '') - - return $null - } - else - { - # Static DNS Server addresses found so split them into an array using comma - Write-Verbose -Message ( @("$($MyInvocation.MyCommand): " - $($LocalizedData.DNSServerStaticAddressFoundMessage) -f $AddressFamily,$InterfaceAlias,$nameServerAddressString - ) -join '') - - return @($nameServerAddressString -split ',') - } # if -} # Get-DnsClientServerStaticAddress - -<# -.SYNOPSIS - Gets the IP Address prefix from a provided IP Address in CIDR notation. - -.PARAMETER IPAddress - IP Address to get prefix for, can be in CIDR notation. - -.PARAMETER AddressFamily - Address family for provided IP Address, defaults to IPv4. - -#> -function Get-IPAddressPrefix -{ - [cmdletbinding()] - param - ( - [parameter(Mandatory=$True, ValueFromPipeline)] - [string[]]$IPAddress, - - [parameter()] - [ValidateSet('IPv4','IPv6')] - [string]$AddressFamily = 'IPv4' - ) - - process - { - foreach ($singleIP in $IPAddress) - { - $prefixLength = ($singleIP -split '/')[1] - - If (-not ($prefixLength) -and $AddressFamily -eq 'IPv4') - { - if ($singleIP.split('.')[0] -in (0..127)) - { - $prefixLength = 8 - } - elseif ($singleIP.split('.')[0] -in (128..191)) - { - $prefixLength = 16 - } - elseif ($singleIP.split('.')[0] -in (192..223)) - { - $prefixLength = 24 - } - } - elseif (-not ($prefixLength) -and $AddressFamily -eq 'IPv6') - { - $prefixLength = 64 - } - - [PSCustomObject]@{ - IPAddress = $singleIP.split('/')[0] - prefixLength = $prefixLength - } - } - } -} - -Export-ModuleMember -Function ` - Convert-CIDRToSubhetMask, ` - Find-NetworkAdapter, - Get-DnsClientServerStaticAddress, - Get-IPAddressPrefix diff --git a/lib/puppet_x/dsc_resources/xNetworking/Modules/NetworkingDsc.Common/en-us/NetworkingDsc.Common.strings.psd1 b/lib/puppet_x/dsc_resources/xNetworking/Modules/NetworkingDsc.Common/en-us/NetworkingDsc.Common.strings.psd1 deleted file mode 100644 index d9d14cd7..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/Modules/NetworkingDsc.Common/en-us/NetworkingDsc.Common.strings.psd1 +++ /dev/null @@ -1,12 +0,0 @@ -ConvertFrom-StringData @' - FindingNetAdapterMessage = Finding network adapters matching the parameters. - AllNetAdaptersFoundMessage = Found all network adapters because no filter parameters provided. - NetAdapterFoundMessage = {0} network adapters were found matching the parameters. - NetAdapterNotFoundError = A network adapter matching the parameters was not found. Please correct the properties and try again. - InterfaceAliasNotFoundError = A network adapter with the alias '{0}' could not be found. - MultipleMatchingNetAdapterFound = Please adjust the parameters or specify IgnoreMultipleMatchingAdapters to only use the first and try again. - InvalidNetAdapterNumberError = network adapter interface number {0} was specified but only {1} was found. Please correct the interface number and try again. - GettingDNSServerStaticAddressMessage = Getting staticly assigned DNS server {0} address for interface alias '{1}'. - DNSServerStaticAddressNotSetMessage = Statically assigned DNS server {0} address for interface alias '{1}' is not set. - DNSServerStaticAddressFoundMessage = Statically assigned DNS server {0} address for interface alias '{1}' is '{2}'. -'@ diff --git a/lib/puppet_x/dsc_resources/xNetworking/Modules/NetworkingDsc.ResourceHelper/NetworkingDsc.ResourceHelper.psm1 b/lib/puppet_x/dsc_resources/xNetworking/Modules/NetworkingDsc.ResourceHelper/NetworkingDsc.ResourceHelper.psm1 deleted file mode 100644 index 75700854..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/Modules/NetworkingDsc.ResourceHelper/NetworkingDsc.ResourceHelper.psm1 +++ /dev/null @@ -1,173 +0,0 @@ -<# - .SYNOPSIS - Tests if the specified command can be found. - - .PARAMETER name - The name of the command to test. -#> -function Test-Command -{ - param - ( - [String] $Name - ) - - return ($null -ne (Get-Command -Name $Name -ErrorAction Continue 2> $null)) -} - -<# - .SYNOPSIS - Tests if the current machine is a Nano server. -#> -function Test-IsNanoServer -{ - if(Test-Command -Name Get-ComputerInfo) - { - $computerInfo = Get-ComputerInfo - - if("Server" -eq $computerInfo.OsProductType ` - -and "NanoServer" -eq $computerInfo.OsServerLevel) - { - return $true - } - } - - return $false -} - -<# - .SYNOPSIS - Creates and throws an invalid argument exception - - .PARAMETER Message - The message explaining why this error is being thrown - - .PARAMETER ArgumentName - The name of the invalid argument that is causing this error to be thrown -#> -function New-InvalidArgumentException -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Message, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $ArgumentName - ) - - $argumentException = New-Object -TypeName 'ArgumentException' -ArgumentList @( $Message, - $ArgumentName ) - $newObjectParams = @{ - TypeName = 'System.Management.Automation.ErrorRecord' - ArgumentList = @( $argumentException, $ArgumentName, 'InvalidArgument', $null ) - } - $errorRecord = New-Object @newObjectParams - - throw $errorRecord -} - -<# - .SYNOPSIS - Creates and throws an invalid operation exception - - .PARAMETER Message - The message explaining why this error is being thrown - - .PARAMETER ErrorRecord - The error record containing the exception that is causing this terminating error -#> -function New-InvalidOperationException -{ - [CmdletBinding()] - param - ( - [ValidateNotNullOrEmpty()] - [String] - $Message, - - [ValidateNotNull()] - [System.Management.Automation.ErrorRecord] - $ErrorRecord - ) - - if ($null -eq $Message) - { - $invalidOperationException = New-Object -TypeName 'InvalidOperationException' - } - elseif ($null -eq $ErrorRecord) - { - $invalidOperationException = - New-Object -TypeName 'InvalidOperationException' -ArgumentList @( $Message ) - } - else - { - $invalidOperationException = - New-Object -TypeName 'InvalidOperationException' -ArgumentList @( $Message, - $ErrorRecord.Exception ) - } - - $newObjectParams = @{ - TypeName = 'System.Management.Automation.ErrorRecord' - ArgumentList = @( $invalidOperationException.ToString(), 'MachineStateIncorrect', - 'InvalidOperation', $null ) - } - $errorRecordToThrow = New-Object @newObjectParams - throw $errorRecordToThrow -} - -<# - .SYNOPSIS - Retrieves the localized string data based on the machine's culture. - Falls back to en-US strings if the machine's culture is not supported. - - .PARAMETER ResourceName - The name of the resource as it appears before '.strings.psd1' of the localized string file. - - For example: - For WindowsOptionalFeature: MSFT_xWindowsOptionalFeature - For Service: MSFT_xServiceResource - For Registry: MSFT_xRegistryResource -#> -function Get-LocalizedData -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $ResourceName, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $ResourcePath - ) - - $localizedStringFileLocation = Join-Path -Path $ResourcePath -ChildPath $PSUICulture - - if (-not (Test-Path -Path $localizedStringFileLocation)) - { - # Fallback to en-US - $localizedStringFileLocation = Join-Path -Path $ResourcePath -ChildPath 'en-US' - } - - Import-LocalizedData ` - -BindingVariable 'localizedData' ` - -FileName "$ResourceName.strings.psd1" ` - -BaseDirectory $localizedStringFileLocation - - return $localizedData -} - -Export-ModuleMember -Function ` - Test-IsNanoServer, ` - New-InvalidArgumentException, ` - New-InvalidOperationException, ` - Get-LocalizedData diff --git a/lib/puppet_x/dsc_resources/xNetworking/PSScriptAnalyzerSettings.psd1 b/lib/puppet_x/dsc_resources/xNetworking/PSScriptAnalyzerSettings.psd1 deleted file mode 100644 index ba07a45a..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/PSScriptAnalyzerSettings.psd1 +++ /dev/null @@ -1,10 +0,0 @@ -@{ - ExcludeRules=@('PSDSCDscExamplesPresent', - 'PSDSCDscTestsPresent', - 'PSUseBOMForUnicodeEncodedFile', - 'PSUseShouldProcessForStateChangingFunctions', - 'PSUseSingularNouns', - 'PSUseToExportFieldsInManifest', - 'PSUseUTF8EncodingForHelpFile', - 'PSUseDeclaredVarsMoreThanAssignments') -} diff --git a/lib/puppet_x/dsc_resources/xNetworking/xNetworking.psd1 b/lib/puppet_x/dsc_resources/xNetworking/xNetworking.psd1 deleted file mode 100644 index 4650ee86..00000000 --- a/lib/puppet_x/dsc_resources/xNetworking/xNetworking.psd1 +++ /dev/null @@ -1,112 +0,0 @@ -@{ -# Version number of this module. -ModuleVersion = '5.1.0.0' - -# ID used to uniquely identify this module -GUID = 'e6647cc3-ce9c-4c86-9eb8-2ee8919bf358' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2017 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'Module with DSC Resources for Networking area' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Minimum version of the common language runtime (CLR) required by this module -CLRVersion = '4.0' - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess -# NestedModules = @() - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/xNetworking/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/xNetworking' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - ReleaseNotes = '- MSFT_xDhcpClient: - - Corrected style and formatting to meet HQRM guidelines. - - Converted exceptions to use ResourceHelper functions. -- README.MD: - - Cleaned up badges by putting them into a table. -- MSFT_xDnsConnectionSuffix: - - Corrected style and formatting to meet HQRM guidelines. - - Converted exceptions to use ResourceHelper functions. -- README.MD: - - Converted badges to use branch header as used in xSQLServer. -- Added standard .markdownlint.json to configure rules to run on - Markdown files. -- MSFT_xDnsClientGlobalSetting: - - Corrected style and formatting to meet HQRM guidelines. - - Converted exceptions to use ResourceHelper functions. -- Updated year to 2017 in LICENSE and module manifest. -- MSFT_xDnsServerAddress: - - Fix error when setting address on adapter where NameServer - Property does not exist in registry for interface - see - [issue 237](https://github.com/PowerShell/xNetworking/issues/237). - - Corrected style and formatting to meet HQRM guidelines. -- MSFT_xIPAddress: - - Improved examples to clarify how to set IP Address prefix - - see [issue 239](https://github.com/PowerShell/xNetworking/issues/239). -- MSFT_xFirewall: - - Fixed bug with DisplayName not being set correctly in some - situations - see [issue 234](https://github.com/PowerShell/xNetworking/issues/234). - - Corrected style and formatting to meet HQRM guidelines. - - Converted exceptions to use ResourceHelper functions. -- Added .github support files: - - CONTRIBUTING.md - - ISSUE_TEMPLATE.md - - PULL_REQUEST_TEMPLATE.md -- Opted into Common Tests "Validate Module Files" and "Validate Script Files". -- Converted files with UTF8 with BOM over to UTF8 - fixes [Issue 250](https://github.com/PowerShell/xNetworking/issues/250). -- MSFT_xFirewallProfile: - - Created new resource configuring firewall profiles. -- MSFT_xNetConnectionProfile: - - Corrected style and formatting to meet HQRM guidelines. - - Added validation for provided parameters. - - Prevent testing parameter values of connection that aren"t set in resource - - fixes [Issue 254](https://github.com/PowerShell/xNetworking/issues/254). - - Improved unit test coverage for this resource. - -' - - } # End of PSData hashtable - -} # End of PrivateData hashtable -} - - - - - - - - - - diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCPullServerSetup/PublishModulesAndMofsToPullServer.psm1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCPullServerSetup/PublishModulesAndMofsToPullServer.psm1 deleted file mode 100644 index b53d9f90..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCPullServerSetup/PublishModulesAndMofsToPullServer.psm1 +++ /dev/null @@ -1,302 +0,0 @@ -<# -.Synopsis - Package DSC modules and mof configuration document and publish them on an enterprise DSC pull server in the required format. -.DESCRIPTION - Uses Publish-DSCModulesAndMof function to package DSC modules into zip files with the version info. - Publishes the zip modules on "$env:ProgramFiles\WindowsPowerShell\DscService\Modules". - Publishes all mof configuration documents that are present in the $Source folder on "$env:ProgramFiles\WindowsPowerShell\DscService\Configuration"- - Use $Force to overwrite the version of the module that exists in the PowerShell module path with the version from the $source folder. - Use $ModuleNameList to specify the names of the modules to be published if the modules do not exist in $Source folder. -.EXAMPLE - $ModuleList = @("xWebAdministration", "xPhp") - Publish-DSCModuleAndMof -Source C:\LocalDepot -ModuleNameList $ModuleList -.EXAMPLE - Publish-DSCModuleAndMof -Source C:\LocalDepot -Force - -#> - -# Tools to use to package DSC modules and mof configuration document and publish them on enterprise DSC pull server in the required format -function Publish-DSCModuleAndMof -{ - [CmdletBinding()] - param( - # The folder that contains the configuration mof documents and modules to be published on Pull server. - # Everything in this folder will be packaged and published. - [Parameter(Mandatory=$True)] - [string]$Source = $pwd, - - # Switch to overwrite the module in PSModulePath with the version provided in $Sources. - [switch]$Force, - - # Package and publish the modules listed in $ModuleNameList based on PowerShell module path content. - [string[]]$ModuleNameList - ) - - # Create working directory - $tempFolder = "$pwd\temp" - New-Item -Path $tempFolder -ItemType Directory -Force -ErrorAction SilentlyContinue - - # Copy the mof documents from the $Source to working dir - Copy-Item -Path "$Source\*.mof" -Destination $tempFolder -Force -Verbose - - # Start Deployment! - Log -Scope $MyInvocation -Message 'Start Deployment' - CreateZipFromPSModulePath -ListModuleNames $ModuleNameList -Destination $tempFolder - CreateZipFromSource -Source $Source -Destination $tempFolder - # Generate the checkSum file for all the zip and mof files. - New-DSCCheckSum -Path $tempFolder -Force - # Publish mof and modules to pull server repositories - PublishModulesAndChecksum -Source $tempFolder - PublishMofDocuments -Source $tempFolder - # Deployment is complete! - Remove-Item -Path $tempFolder -Recurse -Force -ErrorAction SilentlyContinue - Log -Scope $MyInvocation -Message 'End Deployment' - -} - -#Package the modules using powershell module path -function CreateZipFromPSModulePath -{ - param($ListModuleNames, $Destination) - - # Move all required modules from powershell module path to a temp folder and package them - if ([string]::IsNullOrEmpty($ListModuleNames)) - { - Log -Scope $MyInvocation -Message "No additional modules are specified to be packaged." - } - - foreach ($module in $ListModuleNames) - { - $allVersions = Get-Module -Name $module -ListAvailable -Verbose - # Package all versions of the module - foreach ($moduleVersion in $allVersions) - { - $name = $moduleVersion.Name - $source = "$Destination\$name" - # Create package zip - $path = $moduleVersion.ModuleBase - $version = $moduleVersion.Version.ToString() - Log -Scope $MyInvocation -Message "Zipping $name ($version)" - Compress-Archive -Path "$path\*" -DestinationPath "$source.zip" -Verbose -Force - $newName = "$Destination\$name" + "_" + "$version" + ".zip" - # Rename the module folder to contain the version info. - if (Test-Path $newName) - { - Remove-Item $newName -Recurse -Force - } - Rename-Item -Path "$source.zip" -NewName $newName -Force - } - } - -} - -# Function to package modules using a given folder after installing to psmodule path. -function CreateZipFromSource -{ - param($Source, $Destination) - # for each module under $Source folder create a zip package that has the same name as the folder. - $allModulesInSource = Get-ChildItem -Path $Source -Directory - $modules = @() - - foreach ($item in $allModulesInSource) - { - $name = $Item.Name - $alreadyExists = Get-Module -Name $name -ListAvailable -Verbose - if (($alreadyExists -eq $null) -or ($Force)) - { - # Install the modules into PowerShell module path and overwrite the content - Copy-Item -Path $item.FullName -Recurse -Force -Destination "$env:ProgramFiles\WindowsPowerShell\Modules" -Verbose - } - else - { - Write-Warning "Skipping module overwrite. Module with the name $name already exists." - Write-Warning "Please specify -Force to overwrite the module with the local version of the module located in $Source or list names of the modules in ModuleNameList parameter to be packaged from PowerShell module pat instead and remove them from $Source folder" - } - $modules += @("$name") - } - # Package the module in $destination - CreateZipFromPSModulePath -ListModuleNames $modules -Destination $Destination -} - - -# Deploy modules to the Pull sever repository. -function PublishModulesAndChecksum -{ - param($Source) - # Check if the current machine is a server sku. - $moduleRepository = "$env:ProgramFiles\WindowsPowerShell\DscService\Modules" - if ((Get-Module ServerManager -ListAvailable) -and (Test-Path $moduleRepository)) - { - Log -Scope $MyInvocation -Message "Copying modules and checksums to [$moduleRepository]." - Copy-Item -Path "$Source\*.zip*" -Destination $moduleRepository -Force -Verbose - } - else - { - Write-Warning "Copying modules to Pull server module repository skipped because the machine is not a server sku or Pull server endpoint is not deployed." - } - -} - -# function deploy configuration and their checksums. -function PublishMofDocuments -{ - param($Source) - # Check if the current machine is a server sku. - $mofRepository = "$env:ProgramFiles\WindowsPowerShell\DscService\Configuration" - if ((Get-Module ServerManager -ListAvailable) -and (Test-Path $mofRepository)) - { - Log -Scope $MyInvocation -Message "Copying mofs and checksums to [$mofRepository]." - Copy-Item -Path "$Source\*.mof*" -Destination $mofRepository -Force -Verbose - } - else - { - Write-Warning "Copying configuration(s) to Pull server configuration repository skipped because the machine is not a server sku or Pull server endpoint is not deployed." - } -} - -Function Log -{ - Param( - $Date = $(Get-Date), - $Scope, - $Message - ) - - Write-Verbose "$Date [$($Scope.MyCommand)] :: $Message" -} - - -<# -.Synopsis - Deploy DSC modules to the pullserver. -.DESCRIPTION - Publish DSC module using Module Info object as an input. - The cmdlet will figure out the location of the module repository using web.config of the pullserver. -.EXAMPLE - Get-Module | Publish-ModuleToPullServer -#> -function Publish-ModuleToPullServer -{ - [CmdletBinding()] - [Alias("pmp")] - [OutputType([void])] - Param - ( - # Name of the module. - [Parameter(Mandatory=$true, - ValueFromPipelineByPropertyName=$true, - Position=0)] - $Name, - - # This is the location of the base of the module. - [Parameter(Mandatory=$true, - ValueFromPipelineByPropertyName=$true, - Position=1)] - $ModuleBase, - - # This is the version of the module - [Parameter(Mandatory=$true, - ValueFromPipelineByPropertyName=$true, - Position=2)] - $Version, - - $PullServerWebConfig = "$env:SystemDrive\inetpub\wwwroot\PSDSCPullServer\web.config", - - $OutputFolderPath = $null - ) - - Begin - { - if (-not($OutputFolderPath)) - { - if ( -not(Test-Path $PullServerWebConfig)) - { - throw "Web.Config of the pullserver does not exist on the default path $PullServerWebConfig. Please provide the location of your pullserver web configuration using the parameter -PullServerWebConfig or an alternate path where you want to publish the pullserver modules to" - } - else - { - # Pull Server exist figure out the module path of the pullserver and use this value as output folder path. - $webConfigXml = [xml](cat $PullServerWebConfig) - $moduleXElement = $webConfigXml.SelectNodes("//appSettings/add[@key = 'ModulePath']") - $OutputFolderPath = $moduleXElement.Value - } - } - } - Process - { - Write-Verbose "Name: $Name , ModuleBase : $ModuleBase ,Version: $Version" - $targetPath = Join-Path $OutputFolderPath "$($Name)_$($Version).zip" - - if (Test-Path $targetPath) - { - Compress-Archive -DestinationPath $targetPath -Path "$($ModuleBase)\*" -Update -Verbose - } - else - { - Compress-Archive -DestinationPath $targetPath -Path "$($ModuleBase)\*" -Verbose - } - } - End - { - # Now that all the modules are published generate thier checksum. - New-DscChecksum -Path $OutputFolderPath - - } -} - -<# -.Synopsis - Deploy DSC Configuration document to the pullserver. -.DESCRIPTION - Publish Mof file to the pullserver. It takes File Info object as pipeline input. It also auto detects the location of the configuration repository using the web.config of the pullserver. -.EXAMPLE - Dir \*.mof | Publish-MOFToPullServer -#> -function Publish-MOFToPullServer -{ - [CmdletBinding()] - [Alias("pcp")] - [OutputType([void])] - Param - ( - # Mof file Name - [Parameter(Mandatory=$true, - ValueFromPipelineByPropertyName=$true, - Position=0)] - $FullName, - - $PullServerWebConfig = "$env:SystemDrive\inetpub\wwwroot\PSDSCPullServer\web.config" - ) - - Begin - { - $webConfigXml = [xml](cat $PullServerWebConfig) - $configXElement = $webConfigXml.SelectNodes("//appSettings/add[@key = 'ConfigurationPath']") - $OutputFolderPath = $configXElement.Value - } - Process - { - $fileInfo = [System.IO.FileInfo]::new($FullName) - if ($fileInfo.Extension -eq '.mof') - { - if (Test-Path $FullName) - { - copy $FullName $OutputFolderPath -Verbose -Force - } - else - { - Throw "File not found at $FullName" - } - } - else - { - throw "Invalid file $FullName. Only mof files can be copied to the pullserver configuration repository" - } - } - End - { - New-DscChecksum -Path $OutputFolderPath -Force - } -} - -Export-ModuleMember -Function Publish-* diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xArchive/MSFT_xArchive.psm1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xArchive/MSFT_xArchive.psm1 deleted file mode 100644 index 192de024..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xArchive/MSFT_xArchive.psm1 +++ /dev/null @@ -1,1604 +0,0 @@ -$errorActionPreference = 'Stop' -Set-StrictMode -Version 'Latest' - -<# - Import CommonResourceHelper for: - Get-LocalizedData, - Test-IsNanoServer, - New-InvalidOperationException, - New-InvalidArgumentException -#> -$script:dscResourcesFolderFilePath = Split-Path $PSScriptRoot -Parent -$script:commonResourceHelperFilePath = Join-Path -Path $script:dscResourcesFolderFilePath -ChildPath 'CommonResourceHelper.psm1' -Import-Module -Name $script:commonResourceHelperFilePath - -# Localized messages for verbose and error statements in this resource -$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_xArchive' - -Add-Type -AssemblyName 'System.IO.Compression' - -# This resource has not yet been tested on a Nano server. -if (-not (Test-IsNanoServer)) -{ - Add-Type -AssemblyName 'System.IO.Compression.FileSystem' -} - -<# - .SYNOPSIS - Retrieves the current state of the archive resource with the specified path and - destination. - - The returned object provides the following properties: - Path: The specified path. - Destination: The specified destination. - Ensure: Present if the archive at the specified path is expanded at the specified - destination. Absent if the archive at the specified path is not expanded at the - specified destination. - - .PARAMETER Path - The path to the archive file that should or should not be expanded at the specified - destination. - - .PARAMETER Destination - The path where the archive file should or should not be expanded. - - .PARAMETER Validate - Specifies whether or not to validate that a file at the destination with the same name as a - file in the archive actually matches that corresponding file in the archive by the - specified checksum method. - - If a file does not match it will be considered not present. - - The default value is false. - - .PARAMETER Checksum - The Checksum method to use to validate whether or not a file at the destination with the - same name as a file in the archive actually matches that corresponding file in the archive. - - An invalid argument exception will be thrown if Checksum is specified while Validate is - specified as false. - - ModifiedDate will check that the LastWriteTime property of the file at the destination - matches the LastWriteTime property of the file in the archive. - CreatedDate will check that the CreationTime property of the file at the destination - matches the CreationTime property of the file in the archive. - SHA-1, SHA-256, and SHA-512 will check that the hash of the file at the destination by the - specified SHA method matches the hash of the file in the archive by the specified SHA - method. - - The default value is ModifiedDate. - - .PARAMETER Credential - The credential of a user account with permissions to access the specified archive path and - destination if needed. -#> -function Get-TargetResource -{ - [OutputType([Hashtable])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Destination, - - [Parameter()] - [Boolean] - $Validate = $false, - - [Parameter()] - [ValidateSet('SHA-1', 'SHA-256', 'SHA-512', 'CreatedDate', 'ModifiedDate')] - [String] - $Checksum = 'ModifiedDate', - - [Parameter()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential - ) - - if ($PSBoundParameters.ContainsKey('Checksum') -and -not $Validate) - { - $errorMessage = $script:localizedData.ChecksumSpecifiedAndValidateFalse -f $Checksum, $Path, $Destination - New-InvalidArgumentException -ArgumentName 'Checksum or Validate' -Message $errorMessage - } - - $archiveState = @{ - Path = $Path - Destination = $Destination - } - - # In case an error occurs, we assume that the archive is not expanded at the destination - $archiveExpandedAtDestination = $false - - $psDrive = $null - - if ($PSBoundParameters.ContainsKey('Credential')) - { - $psDrive = Mount-PSDriveWithCredential -Path $Path -Credential $Credential - } - - try - { - Assert-PathExistsAsLeaf -Path $Path - Assert-DestinationDoesNotExistAsFile -Destination $Destination - - Write-Verbose -Message ($script:localizedData.RetrievingArchiveState -f $Path, $Destination) - - $testArchiveExistsAtDestinationParameters = @{ - ArchiveSourcePath = $Path - Destination = $Destination - } - - if ($Validate) - { - $testArchiveExistsAtDestinationParameters['Checksum'] = $Checksum - } - - if (Test-Path -LiteralPath $Destination) - { - Write-Verbose -Message ($script:localizedData.DestinationExists -f $Destination) - - $archiveExpandedAtDestination = Test-ArchiveExistsAtDestination @testArchiveExistsAtDestinationParameters - } - else - { - Write-Verbose -Message ($script:localizedData.DestinationDoesNotExist -f $Destination) - } - } - finally - { - if ($null -ne $psDrive) - { - Write-Verbose -Message ($script:localizedData.RemovingPSDrive -f $psDrive.Root) - - $null = Remove-PSDrive -Name $psDrive -Force -ErrorAction 'SilentlyContinue' - } - } - - if ($archiveExpandedAtDestination) - { - $archiveState['Ensure'] = 'Present' - } - else - { - $archiveState['Ensure'] = 'Absent' - } - - return $archiveState -} - -<# - .SYNOPSIS - Expands the archive (.zip) file at the specified path to the specified destination or - removes the expanded archive (.zip) file at the specified path from the specified - destination. - - .PARAMETER Path - The path to the archive file that should be expanded to or removed from the specified - destination. - - .PARAMETER Destination - The path where the specified archive file should be expanded to or removed from. - - .PARAMETER Ensure - Specifies whether or not the expanded content of the archive file at the specified path - should exist at the specified destination. - - To update the specified destination to have the expanded content of the archive file at the - specified path, specify this property as Present. - To remove the expanded content of the archive file at the specified path from the specified - destination, specify this property as Absent. - - The default value is Present. - - .PARAMETER Validate - Specifies whether or not to validate that a file at the destination with the same name as a - file in the archive actually matches that corresponding file in the archive by the - specified checksum method. - - If the file does not match and Ensure is specified as Present and Force is not specified, - the resource will throw an error that the file at the destination cannot be overwritten. - If the file does not match and Ensure is specified as Present and Force is specified, the - file at the destination will be overwritten. - If the file does not match and Ensure is specified as Absent, the file at the destination - will not be removed. - - The default value is false. - - .PARAMETER Checksum - The Checksum method to use to validate whether or not a file at the destination with the - same name as a file in the archive actually matches that corresponding file in the archive. - - An invalid argument exception will be thrown if Checksum is specified while Validate is - specified as false. - - ModifiedDate will check that the LastWriteTime property of the file at the destination - matches the LastWriteTime property of the file in the archive. - CreatedDate will check that the CreationTime property of the file at the destination - matches the CreationTime property of the file in the archive. - SHA-1, SHA-256, and SHA-512 will check that the hash of the file at the destination by the - specified SHA method matches the hash of the file in the archive by the specified SHA - method. - - The default value is ModifiedDate. - - .PARAMETER Credential - The credential of a user account with permissions to access the specified archive path and - destination if needed. - - .PARAMETER Force - Specifies whether or not any existing files or directories at the destination with the same - name as a file or directory in the archive should be overwritten to match the file or - directory in the archive. - - When this property is false, an error will be thrown if an item at the destination needs to - be overwritten. - - The default value is false. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Destination, - - [Parameter()] - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present', - - [Parameter()] - [Boolean] - $Validate = $false, - - [Parameter()] - [ValidateSet('SHA-1', 'SHA-256', 'SHA-512', 'CreatedDate', 'ModifiedDate')] - [String] - $Checksum = 'ModifiedDate', - - [Parameter()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [Parameter()] - [Boolean] - $Force = $false - ) - - if ($PSBoundParameters.ContainsKey('Checksum') -and -not $Validate) - { - $errorMessage = $script:localizedData.ChecksumSpecifiedAndValidateFalse -f $Checksum, $Path, $Destination - New-InvalidArgumentException -ArgumentName 'Checksum or Validate' -Message $errorMessage - } - - $psDrive = $null - - if ($PSBoundParameters.ContainsKey('Credential')) - { - $psDrive = Mount-PSDriveWithCredential -Path $Path -Credential $Credential - } - - try - { - Assert-PathExistsAsLeaf -Path $Path - Assert-DestinationDoesNotExistAsFile -Destination $Destination - - Write-Verbose -Message ($script:localizedData.SettingArchiveState -f $Path, $Destination) - - $expandArchiveToDestinationParameters = @{ - ArchiveSourcePath = $Path - Destination = $Destination - Force = $Force - } - - $removeArchiveFromDestinationParameters = @{ - ArchiveSourcePath = $Path - Destination = $Destination - } - - if ($Validate) - { - $expandArchiveToDestinationParameters['Checksum'] = $Checksum - $removeArchiveFromDestinationParameters['Checksum'] = $Checksum - } - - if (Test-Path -LiteralPath $Destination) - { - Write-Verbose -Message ($script:localizedData.DestinationExists -f $Destination) - - if ($Ensure -eq 'Present') - { - Expand-ArchiveToDestination @expandArchiveToDestinationParameters - } - else - { - Remove-ArchiveFromDestination @removeArchiveFromDestinationParameters - } - } - else - { - Write-Verbose -Message ($script:localizedData.DestinationDoesNotExist -f $Destination) - - if ($Ensure -eq 'Present') - { - Write-Verbose -Message ($script:localizedData.CreatingDirectoryAtDestination -f $Destination) - - $null = New-Item -Path $Destination -ItemType 'Directory' - Expand-ArchiveToDestination @expandArchiveToDestinationParameters - } - } - - Write-Verbose -Message ($script:localizedData.ArchiveStateSet -f $Path, $Destination) - } - finally - { - if ($null -ne $psDrive) - { - Write-Verbose -Message ($script:localizedData.RemovingPSDrive -f $psDrive.Root) - - $null = Remove-PSDrive -Name $psDrive -Force -ErrorAction 'SilentlyContinue' - } - } -} - -<# - .SYNOPSIS - Tests whether or not the archive (.zip) file at the specified path is expanded at the - specified destination. - - .PARAMETER Path - The path to the archive file that should or should not be expanded at the specified - destination. - - .PARAMETER Destination - The path where the archive file should or should not be expanded. - - .PARAMETER Ensure - Specifies whether or not the archive file should be expanded to the specified destination. - - To test whether the archive file is expanded at the specified destination, specify this - property as Present. - To test whether the archive file is not expanded at the specified destination, specify this - property as Absent. - - The default value is Present. - - .PARAMETER Validate - Specifies whether or not to validate that a file at the destination with the same name as a - file in the archive actually matches that corresponding file in the archive by the - specified checksum method. - - If a file does not match it will be considered not present. - - The default value is false. - - .PARAMETER Checksum - The Checksum method to use to validate whether or not a file at the destination with the - same name as a file in the archive actually matches that corresponding file in the archive. - - An invalid argument exception will be thrown if Checksum is specified while Validate is - specified as false. - - ModifiedDate will check that the LastWriteTime property of the file at the destination - matches the LastWriteTime property of the file in the archive. - CreatedDate will check that the CreationTime property of the file at the destination - matches the CreationTime property of the file in the archive. - SHA-1, SHA-256, and SHA-512 will check that the hash of the file at the destination by the - specified SHA method matches the hash of the file in the archive by the specified SHA - method. - - The default value is ModifiedDate. - - .PARAMETER Credential - The credential of a user account with permissions to access the specified archive path and - destination if needed. - - .PARAMETER Force - Not used in Test-TargetResource. -#> -function Test-TargetResource -{ - [OutputType([Boolean])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Destination, - - [Parameter()] - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present', - - [Parameter()] - [Boolean] - $Validate = $false, - - [Parameter()] - [ValidateSet('SHA-1', 'SHA-256', 'SHA-512', 'CreatedDate', 'ModifiedDate')] - [String] - $Checksum = 'ModifiedDate', - - [Parameter()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [Parameter()] - [Boolean] - $Force = $false - ) - - $getTargetResourceParameters = @{ - Path = $Path - Destination = $Destination - } - - $optionalGetTargetResourceParameters = @( 'Validate', 'Checksum', 'Credential' ) - - foreach ($optionalGetTargetResourceParameter in $optionalGetTargetResourceParameters) - { - if ($PSBoundParameters.ContainsKey($optionalGetTargetResourceParameter)) - { - $getTargetResourceParameters[$optionalGetTargetResourceParameter] = $PSBoundParameters[$optionalGetTargetResourceParameter] - } - } - - $archiveResourceState = Get-TargetResource @getTargetResourceParameters - - Write-Verbose -Message ($script:localizedData.TestingArchiveState -f $Path, $Destination) - - $archiveInDesiredState = $archiveResourceState.Ensure -ieq $Ensure - - return $archiveInDesiredState -} - -<# - .SYNOPSIS - Creates a new GUID. - This is a wrapper function for unit testing. -#> -function New-Guid -{ - [OutputType([Guid])] - [CmdletBinding()] - param () - - return [Guid]::NewGuid() -} - -<# - .SYNOPSIS - Invokes the cmdlet New-PSDrive with the specified parameters. - This is a wrapper function for unit testing due to a bug in Pester. - Issue has been filed here: https://github.com/pester/Pester/issues/728 - - .PARAMETER Parameters - A hashtable of parameters to splat to New-PSDrive. -#> -function Invoke-NewPSDrive -{ - [OutputType([System.Management.Automation.PSDriveInfo])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [Hashtable] - $Parameters - ) - - return New-PSDrive @Parameters -} - -<# - .SYNOPSIS - Mounts a PSDrive to access the specified path with the permissions granted by the specified - credential. - - .PARAMETER Path - The path to which to mount a PSDrive. - - .PARAMETER Credential - The credential of the user account with permissions to access the specified path. -#> -function Mount-PSDriveWithCredential -{ - [OutputType([System.Management.Automation.PSDriveInfo])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential - ) - - $newPSDrive = $null - - if (Test-Path -LiteralPath $Path -ErrorAction 'SilentlyContinue') - { - Write-Verbose -Message ($script:localizedData.PathAccessiblePSDriveNotNeeded -f $Path) - } - else - { - $pathIsADirectory = $Path.EndsWith('\') - - if ($pathIsADirectory) - { - $pathToPSDriveRoot = $Path - } - else - { - $lastIndexOfBackslash = $Path.LastIndexOf('\') - $pathDoesNotContainADirectory = $lastIndexOfBackslash -eq -1 - - if ($pathDoesNotContainADirectory) - { - $errorMessage = $script:localizedData.PathDoesNotContainValidPSDriveRoot -f $Path - New-InvalidArgumentException -ArgumentName 'Path' -Message $errorMessage - } - else - { - $pathToPSDriveRoot = $Path.Substring(0, $lastIndexOfBackslash) - } - } - - $newPSDriveParameters = @{ - Name = New-Guid - PSProvider = 'FileSystem' - Root = $pathToPSDriveRoot - Scope = 'Script' - Credential = $Credential - } - - try - { - Write-Verbose -Message ($script:localizedData.CreatingPSDrive -f $pathToPSDriveRoot, $Credential.UserName) - $newPSDrive = Invoke-NewPSDrive -Parameters $newPSDriveParameters - } - catch - { - $errorMessage = $script:localizedData.ErrorCreatingPSDrive -f $pathToPSDriveRoot, $Credential.UserName - New-InvalidOperationException -Message $errorMessage -ErrorRecord $_ - } - } - - return $newPSDrive -} - -<# - .SYNOPSIS - Throws an invalid argument exception if the specified path does not exist or is not a path - leaf. - - .PARAMETER Path - The path to assert. -#> -function Assert-PathExistsAsLeaf -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path - ) - - $pathExistsAsLeaf = Test-Path -LiteralPath $Path -PathType 'Leaf' -ErrorAction 'SilentlyContinue' - - if (-not $pathExistsAsLeaf) - { - $errorMessage = $script:localizedData.PathDoesNotExistAsLeaf -f $Path - New-InvalidArgumentException -ArgumentName 'Path' -Message $errorMessage - } -} - -<# - .SYNOPSIS - Throws an invalid argument exception if the specified destination path already exists as a - file. - - .PARAMETER Destination - The destination path to assert. -#> -function Assert-DestinationDoesNotExistAsFile -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Destination - ) - - $itemAtDestination = Get-Item -LiteralPath $Destination -ErrorAction 'SilentlyContinue' - - $itemAtDestinationExists = $null -ne $itemAtDestination - $itemAtDestinationIsFile = $itemAtDestination -is [System.IO.FileInfo] - - if ($itemAtDestinationExists -and $itemAtDestinationIsFile) - { - $errorMessage = $script:localizedData.DestinationExistsAsFile -f $Destination - New-InvalidArgumentException -ArgumentName 'Destination' -Message $errorMessage - } -} - -<# - .SYNOPSIS - Opens the archive at the given path. - This is a wrapper function for unit testing. - - .PARAMETER Path - The path to the archive to open. -#> -function Open-Archive -{ - [OutputType([System.IO.Compression.ZipArchive])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path - ) - - Write-Verbose -Message ($script:localizedData.OpeningArchive -f $Path) - - try - { - $archive = [System.IO.Compression.ZipFile]::OpenRead($Path) - } - catch - { - $errorMessage = $script:localizedData.ErrorOpeningArchive -f $Path - New-InvalidOperationException -Message $errorMessage -ErrorRecord $_ - } - - return $archive -} - -<# - .SYNOPSIS - Closes the specified archive. - This is a wrapper function for unit testing. - - .PARAMETER Archive - The archive to close. -#> -function Close-Archive -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.IO.Compression.ZipArchive] - $Archive - ) - - Write-Verbose -Message ($script:localizedData.ClosingArchive -f $Path) - $null = $Archive.Dispose() -} - -<# - .SYNOPSIS - Retrieves the archive entries from the specified archive. - This is a wrapper function for unit testing. - - .PARAMETER Archive - The archive of which to retrieve the archive entries. -#> -function Get-ArchiveEntries -{ - [OutputType([System.IO.Compression.ZipArchiveEntry[]])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.IO.Compression.ZipArchive] - $Archive - ) - - return $Archive.Entries -} - -<# - .SYNOPSIS - Retrieves the full name of the specified archive entry. - This is a wrapper function for unit testing. - - .PARAMETER ArchiveEntry - The archive entry to retrieve the full name of. -#> -function Get-ArchiveEntryFullName -{ - [OutputType([String])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.IO.Compression.ZipArchiveEntry] - $ArchiveEntry - ) - - return $ArchiveEntry.FullName -} - -<# - .SYNOPSIS - Opens the specified archive entry. - This is a wrapper function for unit testing. - - .PARAMETER ArchiveEntry - The archive entry to open. -#> -function Open-ArchiveEntry -{ - [OutputType([System.IO.Stream])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.IO.Compression.ZipArchiveEntry] - $ArchiveEntry - ) - - Write-Verbose -Message ($script:localizedData.OpeningArchiveEntry -f $ArchiveEntry.FullName) - return $ArchiveEntry.Open() -} - -<# - .SYNOPSIS - Closes the specified stream. - This is a wrapper function for unit testing. - - .PARAMETER Stream - The stream to close. -#> -function Close-Stream -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.IO.Stream] - $Stream - ) - - $null = $Stream.Dispose() -} - -<# - .SYNOPSIS - Tests if the given checksum method name is the name of a SHA checksum method. - - .PARAMETER Checksum - The name of the checksum method to test. -#> -function Test-ChecksumIsSha -{ - [OutputType([Boolean])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Checksum - ) - - return ($Checksum.Length -ge 'SHA'.Length) -and ($Checksum.Substring(0, 3) -ieq 'SHA') -} - -<# - .SYNOPSIS - Converts the specified DSC hash algorithm name (with a hyphen) to a PowerShell hash - algorithm name (without a hyphen). The in-box PowerShell Get-FileHash cmdlet will only hash - algorithm names without hypens. - - .PARAMETER DscHashAlgorithmName - The DSC hash algorithm name to convert. -#> -function ConvertTo-PowerShellHashAlgorithmName -{ - [OutputType([String])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $DscHashAlgorithmName - ) - - return $DscHashAlgorithmName.Replace('-', '') -} - -<# - .SYNOPSIS - Tests if the hash of the specified file matches the hash of the specified archive entry - using the specified hash algorithm. - - .PARAMETER FilePath - The path to the file to test the hash of. - - .PARAMETER CacheEntry - The cache entry to test the hash of. - - .PARAMETER HashAlgorithmName - The name of the hash algorithm to use to retrieve the hashes of the file and archive entry. -#> -function Test-FileHashMatchesArchiveEntryHash -{ - [OutputType([Boolean])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $FilePath, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.IO.Compression.ZipArchiveEntry] - $ArchiveEntry, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $HashAlgorithmName - ) - - $archiveEntryFullName = Get-ArchiveEntryFullName -ArchiveEntry $ArchiveEntry - - Write-Verbose -Message ($script:localizedData.ComparingHashes -f $FilePath, $archiveEntryFullName, $HashAlgorithmName) - - $fileHashMatchesArchiveEntryHash = $false - - $powerShellHashAlgorithmName = ConvertTo-PowerShellHashAlgorithmName -DscHashAlgorithmName $HashAlgorithmName - - $openStreams = @() - - try - { - $archiveEntryStream = Open-ArchiveEntry -ArchiveEntry $ArchiveEntry - $openStreams += $archiveEntryStream - - # The Open mode will open the file for reading without modifying the file - $fileStreamMode = [System.IO.FileMode]::Open - - $fileStream = New-Object -TypeName 'System.IO.FileStream' -ArgumentList @( $FilePath, $fileStreamMode ) - $openStreams += $fileStream - - $fileHash = Get-FileHash -InputStream $fileStream -Algorithm $powerShellHashAlgorithmName - $archiveEntryHash = Get-FileHash -InputStream $archiveEntryStream -Algorithm $powerShellHashAlgorithmName - - $hashAlgorithmsMatch = $fileHash.Algorithm -eq $archiveEntryHash.Algorithm - $hashesMatch = $fileHash.Hash -eq $archiveEntryHash.Hash - - $fileHashMatchesArchiveEntryHash = $hashAlgorithmsMatch -and $hashesMatch - } - catch - { - $errorMessage = $script:localizedData.ErrorComparingHashes -f $FilePath, $archiveEntryFullName, $HashAlgorithmName - New-InvalidOperationException -Message $errorMessage -ErrorRecord $_ - } - finally - { - foreach ($openStream in $openStreams) - { - Close-Stream -Stream $openStream - } - } - - return $fileHashMatchesArchiveEntryHash -} - -<# - .SYNOPSIS - Retrieves the timestamp of the specified file for the specified checksum method. - - .PARAMETER File - The file to retrieve the timestamp of. - - .PARAMETER Checksum - The checksum method to retrieve the timestamp for. - - .NOTES - The returned date is normalized to the General (G) date format. - https://technet.microsoft.com/en-us/library/ee692801.aspx -#> -function Get-TimestampForChecksum -{ - [OutputType([System.DateTime])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.IO.FileInfo] - $File, - - [Parameter(Mandatory = $true)] - [ValidateSet('CreatedDate', 'ModifiedDate')] - [String] - $Checksum - ) - - $relevantTimestamp = $null - - if ($Checksum -ieq 'CreatedDate') - { - $relevantTimestamp = Get-Date -Date $File.CreationTime.DateTime -Format 'G' - } - elseif ($Checksum -ieq 'ModifiedDate') - { - $relevantTimestamp = Get-Date -Date $File.LastWriteTime.DateTime -Format 'G' - } - - return $relevantTimestamp -} - -<# - .SYNOPSIS - Retrieves the last write time of the specified archive entry. - This is a wrapper function for unit testing. - - .PARAMETER ArchiveEntry - The archive entry to retrieve the last write time of. - - .NOTES - The returned date is normalized to the General (G) date format. - https://technet.microsoft.com/en-us/library/ee692801.aspx -#> -function Get-ArchiveEntryLastWriteTime -{ - [OutputType([System.DateTime])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.IO.Compression.ZipArchiveEntry] - $ArchiveEntry - ) - - return (Get-Date -Date $ArchiveEntry.LastWriteTime.DateTime -Format 'G') -} - -<# - .SYNOPSIS - Tests if the specified file matches the specified archive entry based on the specified - checksum method. - - .PARAMETER File - The file to test against the specified archive entry. - - .PARAMETER ArchiveEntry - The archive entry to test against the specified file. - - .PARAMETER Checksum - The checksum method to use to determine whether or not the specified file matches the - specified archive entry. -#> -function Test-FileMatchesArchiveEntryByChecksum -{ - [OutputType([Boolean])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.IO.FileInfo] - $File, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.IO.Compression.ZipArchiveEntry] - $ArchiveEntry, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Checksum - ) - - $archiveEntryFullName = Get-ArchiveEntryFullName -ArchiveEntry $ArchiveEntry - - Write-Verbose -Message ($script:localizedData.TestingIfFileMatchesArchiveEntryByChecksum -f $File.FullName, $archiveEntryFullName, $Checksum) - - $fileMatchesArchiveEntry = $false - - if (Test-ChecksumIsSha -Checksum $Checksum) - { - $fileHashMatchesArchiveEntryHash = Test-FileHashMatchesArchiveEntryHash -FilePath $File.FullName -ArchiveEntry $ArchiveEntry -HashAlgorithmName $Checksum - - if ($fileHashMatchesArchiveEntryHash) - { - Write-Verbose -Message ($script:localizedData.FileMatchesArchiveEntryByChecksum -f $File.FullName, $archiveEntryFullName, $Checksum) - - $fileMatchesArchiveEntry = $true - } - else - { - Write-Verbose -Message ($script:localizedData.FileDoesNotMatchArchiveEntryByChecksum -f $File.FullName, $archiveEntryFullName, $Checksum) - } - } - else - { - $fileTimestampForChecksum = Get-TimestampForChecksum -File $File -Checksum $Checksum - - $archiveEntryLastWriteTime = Get-ArchiveEntryLastWriteTime -ArchiveEntry $ArchiveEntry - - if ($fileTimestampForChecksum.Equals($archiveEntryLastWriteTime)) - { - Write-Verbose -Message ($script:localizedData.FileMatchesArchiveEntryByChecksum -f $File.FullName, $archiveEntryFullName, $Checksum) - - $fileMatchesArchiveEntry = $true - } - else - { - Write-Verbose -Message ($script:localizedData.FileDoesNotMatchArchiveEntryByChecksum -f $File.FullName, $archiveEntryFullName, $Checksum) - } - } - - return $fileMatchesArchiveEntry -} - -<# - .SYNOPSIS - Tests if the specified archive exists in its expanded form at the destination. - - .PARAMETER Archive - The archive to test for existence at the specified destination. - - .PARAMETER Destination - The path to the destination to check for the presence of the expanded form of the specified - archive. - - .PARAMETER Checksum - The checksum method to use to determine whether a file in the archive matches a file at the - destination. - - If not provided, only the existence of the items in the archive will be checked. -#> -function Test-ArchiveExistsAtDestination -{ - [OutputType([Boolean])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $ArchiveSourcePath, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Destination, - - [Parameter()] - [ValidateSet('SHA-1', 'SHA-256', 'SHA-512', 'CreatedDate', 'ModifiedDate')] - [String] - $Checksum - ) - - Write-Verbose -Message ($script:localizedData.TestingIfArchiveExistsAtDestination -f $Destination) - - $archiveExistsAtDestination = $true - - $archive = Open-Archive -Path $ArchiveSourcePath - - try - { - $archiveEntries = Get-ArchiveEntries -Archive $archive - - foreach ($archiveEntry in $archiveEntries) - { - $archiveEntryFullName = Get-ArchiveEntryFullName -ArchiveEntry $archiveEntry - $archiveEntryPathAtDestination = Join-Path -Path $Destination -ChildPath $archiveEntryFullName - - $archiveEntryItemAtDestination = Get-Item -LiteralPath $archiveEntryPathAtDestination -ErrorAction 'SilentlyContinue' - - if ($null -eq $archiveEntryItemAtDestination) - { - Write-Verbose -Message ($script:localizedData.ItemWithArchiveEntryNameDoesNotExist -f $archiveEntryPathAtDestination) - - $archiveExistsAtDestination = $false - break - } - else - { - Write-Verbose -Message ($script:localizedData.ItemWithArchiveEntryNameExists -f $archiveEntryPathAtDestination) - - if ($archiveEntryFullName.EndsWith('\')) - { - if (-not ($archiveEntryItemAtDestination -is [System.IO.DirectoryInfo])) - { - Write-Verbose -Message ($script:localizedData.ItemWithArchiveEntryNameIsNotDirectory -f $archiveEntryPathAtDestination) - - $archiveExistsAtDestination = $false - break - } - } - else - { - if ($archiveEntryItemAtDestination -is [System.IO.FileInfo]) - { - if ($PSBoundParameters.ContainsKey('Checksum')) - { - if (-not (Test-FileMatchesArchiveEntryByChecksum -File $archiveEntryItemAtDestination -ArchiveEntry $archiveEntry -Checksum $Checksum)) - { - $archiveExistsAtDestination = $false - break - } - } - } - else - { - Write-Verbose -Message ($script:localizedData.ItemWithArchiveEntryNameIsNotFile -f $archiveEntryPathAtDestination) - - $archiveExistsAtDestination = $false - break - } - } - } - } - } - finally - { - Close-Archive -Archive $archive - } - - if ($archiveExistsAtDestination) - { - Write-Verbose -Message ($script:localizedData.ArchiveExistsAtDestination -f $ArchiveSourcePath, $Destination) - } - else - { - Write-Verbose -Message ($script:localizedData.ArchiveDoesNotExistAtDestination -f $ArchiveSourcePath, $Destination) - } - - return $archiveExistsAtDestination -} - -<# - .SYNOPSIS - Copies the contents of the specified source stream to the specified destination stream. - This is a wrapper function for unit testing. - - .PARAMETER SourceStream - The stream to copy from. - - .PARAMETER DestinationStream - The stream to copy to. -#> -function Copy-FromStreamToStream -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.IO.Stream] - $SourceStream, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.IO.Stream] - $DestinationStream - ) - - $null = $SourceStream.CopyTo($DestinationStream) -} - -<# - .SYNOPSIS - Copies the specified archive entry to the specified destination path. - - .PARAMETER ArchiveEntry - The archive entry to copy to the destination. - - .PARAMETER DestinationPath - The destination file path to copy the archive entry to. -#> -function Copy-ArchiveEntryToDestination -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.IO.Compression.ZipArchiveEntry] - $ArchiveEntry, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $DestinationPath - ) - - Write-Verbose -Message ($script:localizedData.CopyingArchiveEntryToDestination -f $DestinationPath) - - $archiveEntryFullName = Get-ArchiveEntryFullName -ArchiveEntry $ArchiveEntry - - if ($archiveEntryFullName.EndsWith('\')) - { - $null = New-Item -Path $DestinationPath -ItemType 'Directory' - } - else - { - $openStreams = @() - - try - { - $archiveEntryStream = Open-ArchiveEntry -ArchiveEntry $ArchiveEntry - $openStreams += $archiveEntryStream - - # The Create mode will create a new file if it does not exist or overwrite the file if it already exists - $destinationStreamMode = [System.IO.FileMode]::Create - - $destinationStream = New-Object -TypeName 'System.IO.FileStream' -ArgumentList @( $DestinationPath, $destinationStreamMode ) - $openStreams += $destinationStream - - Copy-FromStreamToStream -SourceStream $archiveEntryStream -DestinationStream $destinationStream - } - catch - { - $errorMessage = $script:localizedData.ErrorCopyingFromArchiveToDestination -f $DestinationPath - New-InvalidOperationException -Message $errorMessage -ErrorRecord $_ - } - finally - { - foreach ($openStream in $openStreams) - { - Close-Stream -Stream $openStream - } - } - - $newArchiveFileInfo = New-Object -TypeName 'System.IO.FileInfo' -ArgumentList @( $DestinationPath ) - - $updatedTimestamp = Get-ArchiveEntryLastWriteTime -ArchiveEntry $ArchiveEntry - - $null = Set-ItemProperty -LiteralPath $DestinationPath -Name 'LastWriteTime' -Value $updatedTimestamp - $null = Set-ItemProperty -LiteralPath $DestinationPath -Name 'LastAccessTime' -Value $updatedTimestamp - $null = Set-ItemProperty -LiteralPath $DestinationPath -Name 'CreationTime' -Value $updatedTimestamp - } -} - -<# - .SYNOPSIS - Expands the archive at the specified source path to the specified destination path. - - .PARAMETER ArchiveSourcePath - The source path of the archive to expand to the specified destination path. - - .PARAMETER Destination - The destination path at which to expand the archive at the specified source path. - - .PARAMETER Checksum - The checksum method to use to determine if a file at the destination already matches a file - in the archive. - - .PARAMETER Force - Specifies whether or not to overwrite files that exist at the destination but do not match - the file of the same name in the archive based on the specified checksum method. -#> -function Expand-ArchiveToDestination -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $ArchiveSourcePath, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Destination, - - [Parameter()] - [ValidateSet('SHA-1', 'SHA-256', 'SHA-512', 'CreatedDate', 'ModifiedDate')] - [String] - $Checksum, - - [Parameter()] - [Boolean] - $Force = $false - ) - - Write-Verbose -Message ($script:localizedData.ExpandingArchiveToDestination -f $ArchiveSourcePath, $Destination) - - $archive = Open-Archive -Path $ArchiveSourcePath - - try - { - $archiveEntries = Get-ArchiveEntries -Archive $archive - - foreach ($archiveEntry in $archiveEntries) - { - $archiveEntryFullName = Get-ArchiveEntryFullName -ArchiveEntry $archiveEntry - $archiveEntryPathAtDestination = Join-Path -Path $Destination -ChildPath $archiveEntryFullName - - $archiveEntryIsDirectory = $archiveEntryFullName.EndsWith('\') - - $archiveEntryItemAtDestination = Get-Item -LiteralPath $archiveEntryPathAtDestination -ErrorAction 'SilentlyContinue' - - if ($null -eq $archiveEntryItemAtDestination) - { - Write-Verbose -Message ($script:localizedData.ItemWithArchiveEntryNameDoesNotExist -f $archiveEntryPathAtDestination) - - if (-not $archiveEntryIsDirectory) - { - $parentDirectory = Split-Path -Path $archiveEntryPathAtDestination -Parent - - if (-not (Test-Path -Path $parentDirectory)) - { - Write-Verbose -Message ($script:localizedData.CreatingParentDirectory -f $parentDirectory) - - $null = New-Item -Path $parentDirectory -ItemType 'Directory' - } - } - - Copy-ArchiveEntryToDestination -ArchiveEntry $archiveEntry -DestinationPath $archiveEntryPathAtDestination - } - else - { - Write-Verbose -Message ($script:localizedData.ItemWithArchiveEntryNameExists -f $archiveEntryPathAtDestination) - - $overwriteArchiveEntry = $true - - if ($archiveEntryIsDirectory) - { - $overwriteArchiveEntry = -not ($archiveEntryItemAtDestination -is [System.IO.DirectoryInfo]) - } - elseif ($archiveEntryItemAtDestination -is [System.IO.FileInfo]) - { - if ($PSBoundParameters.ContainsKey('Checksum')) - { - $overwriteArchiveEntry = -not (Test-FileMatchesArchiveEntryByChecksum -File $archiveEntryItemAtDestination -ArchiveEntry $archiveEntry -Checksum $Checksum) - } - else - { - $overwriteArchiveEntry = $false - } - } - - if ($overwriteArchiveEntry) - { - if ($Force) - { - Write-Verbose -Message ($script:localizedData.OverwritingItem -f $archiveEntryPathAtDestination) - - $null = Remove-Item -LiteralPath $archiveEntryPathAtDestination - Copy-ArchiveEntryToDestination -ArchiveEntry $archiveEntry -DestinationPath $archiveEntryPathAtDestination - } - else - { - New-InvalidOperationException -Message ($script:localizedData.ForceNotSpecifiedToOverwriteItem -f $archiveEntryPathAtDestination, $archiveEntryFullName) - } - } - } - } - } - finally - { - Close-Archive -Archive $archive - } -} - -<# - .SYNOPSIS - Removes the specified directory from the specified destination path. - - .PARAMETER Directory - The partial path under the destination path of the directory to remove. - - .PARAMETER Destination - The destination from which to remove the directory. -#> -function Remove-DirectoryFromDestination -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String[]] - $Directory, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Destination - ) - - # Sort-Object requires the use of a pipe to function properly - $Directory = $Directory | Sort-Object -Descending -Unique - - foreach ($directoryToRemove in $Directory) - { - $directoryPathAtDestination = Join-Path -Path $Destination -ChildPath $directoryToRemove - $directoryExists = Test-Path -LiteralPath $directoryPathAtDestination -PathType 'Container' - - if ($directoryExists) - { - $directoryChildItems = Get-ChildItem -LiteralPath $directoryPathAtDestination -ErrorAction 'SilentlyContinue' - $directoryIsEmpty = $null -eq $directoryChildItems - - if ($directoryIsEmpty) - { - Write-Verbose -Message ($script:localizedData.RemovingDirectory -f $directoryPathAtDestination) - - $null = Remove-Item -LiteralPath $directoryPathAtDestination - } - else - { - Write-Verbose -Message ($script:localizedData.DirectoryIsNotEmpty -f $directoryPathAtDestination) - } - } - } -} - -<# - .SYNOPSIS - Removes the specified archive from the specified destination. - - .PARAMETER Archive - The archive to remove from the specified destination. - - .PARAMETER Destination - The path to the destination to remove the specified archive from. - - .PARAMETER Checksum - The checksum method to use to determine whether a file in the archive matches a file at the - destination. - - If not provided, only the existence of the items in the archive will be checked. -#> -function Remove-ArchiveFromDestination -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $ArchiveSourcePath, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Destination, - - [Parameter()] - [ValidateSet('SHA-1', 'SHA-256', 'SHA-512', 'CreatedDate', 'ModifiedDate')] - [String] - $Checksum - ) - - Write-Verbose -Message ($script:localizedData.RemovingArchiveFromDestination -f $Destination) - - $archive = Open-Archive -Path $ArchiveSourcePath - - try - { - $directoriesToRemove = @() - - $archiveEntries = Get-ArchiveEntries -Archive $archive - - foreach ($archiveEntry in $archiveEntries) - { - $archiveEntryFullName = Get-ArchiveEntryFullName -ArchiveEntry $archiveEntry - $archiveEntryPathAtDestination = Join-Path -Path $Destination -ChildPath $archiveEntryFullName - - $archiveEntryIsDirectory = $archiveEntryFullName.EndsWith('\') - - $itemAtDestination = Get-Item -LiteralPath $archiveEntryPathAtDestination -ErrorAction 'SilentlyContinue' - - if ($null -eq $itemAtDestination) - { - Write-Verbose -Message ($script:localizedData.ItemWithArchiveEntryNameDoesNotExist -f $archiveEntryPathAtDestination) - } - else - { - Write-Verbose -Message ($script:localizedData.ItemWithArchiveEntryNameExists -f $archiveEntryPathAtDestination) - - $itemAtDestinationIsDirectory = $itemAtDestination -is [System.IO.DirectoryInfo] - $itemAtDestinationIsFile = $itemAtDestination -is [System.IO.FileInfo] - - $removeArchiveEntry = $false - - if ($archiveEntryIsDirectory -and $itemAtDestinationIsDirectory) - { - $removeArchiveEntry = $true - $directoriesToRemove += $archiveEntryFullName - - } - elseif ((-not $archiveEntryIsDirectory) -and $itemAtDestinationIsFile) - { - $removeArchiveEntry = $true - - if ($PSBoundParameters.ContainsKey('Checksum')) - { - $removeArchiveEntry = Test-FileMatchesArchiveEntryByChecksum -File $itemAtDestination -ArchiveEntry $archiveEntry -Checksum $Checksum - } - - if ($removeArchiveEntry) - { - Write-Verbose -Message ($script:localizedData.RemovingFile -f $archiveEntryPathAtDestination) - $null = Remove-Item -LiteralPath $archiveEntryPathAtDestination - } - } - else - { - Write-Verbose -Message ($script:localizedData.CouldNotRemoveItemOfIncorrectType -f $archiveEntryPathAtDestination, $archiveEntryFullName) - } - - if ($removeArchiveEntry) - { - $parentDirectory = Split-Path -Path $archiveEntryFullName -Parent - - while (-not [String]::IsNullOrEmpty($parentDirectory)) - { - $directoriesToRemove += $parentDirectory - $parentDirectory = Split-Path -Path $parentDirectory -Parent - } - } - } - } - - if ($directoriesToRemove.Count -gt 0) - { - $null = Remove-DirectoryFromDestination -Directory $directoriesToRemove -Destination $Destination - } - - Write-Verbose -Message ($script:localizedData.ArchiveRemovedFromDestination -f $Destination) - - } - finally - { - Close-Archive -Archive $archive - } -} diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xArchive/MSFT_xArchive.schema.mof b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xArchive/MSFT_xArchive.schema.mof deleted file mode 100644 index 1acddc30..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xArchive/MSFT_xArchive.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ -[ClassVersion("1.0.0.0"),FriendlyName("xArchive")] -class MSFT_xArchive : OMI_BaseResource -{ - [Key, Description("The path to the archive file that should be expanded to or removed from the specified destination.")] String Path; - [Key, Description("The path where the specified archive file should be expanded to or removed from.")] String Destination; - [Write, Description("Specifies whether or not the expanded content of the archive file at the specified path should exist at the specified destination. To update the specified destination to have the expanded content of the archive file at the specified path, specify this property as Present. To remove the expanded content of the archive file at the specified path from the specified destination, specify this property as Absent. The default value is Present."), ValueMap{"Present", "Absent"}, Values{"Present", "Absent"}] String Ensure; - [Write, Description("Specifies whether or not to validate that a file at the destination with the same name as a file in the archive actually matches that corresponding file in the archive by the specified checksum method. If the file does not match and Ensure is specified as Present and Force is not specified, the resource will throw an error that the file at the desintation cannot be overwritten. If the file does not match and Ensure is specified as Present and Force is specified, the file at the desintation will be overwritten. If the file does not match and Ensure is specified as Absent, the file at the desintation will not be removed. The default value is false.")] Boolean Validate; - [Write, Description("The Checksum method to use to validate whether or not a file at the destination with the same name as a file in the archive actually matches that corresponding file in the archive. An invalid argument exception will be thrown if Checksum is specified while Validate is specified as false. ModifiedDate will check that the LastWriteTime property of the file at the destination matches the LastWriteTime property of the file in the archive. CreatedDate will check that the CreationTime property of the file at the destination matches the CreationTime property of the file in the archive. SHA-1, SHA-256, and SHA-512 will check that the hash of the file at the destination by the specified SHA method matches the hash of the file in the archive by the specified SHA method. The default value is ModifiedDate.") ,ValueMap{"SHA-1", "SHA-256", "SHA-512", "CreatedDate", "ModifiedDate"}, Values{"SHA-1", "SHA-256", "SHA-512", "CreatedDate", "ModifiedDate"}] String Checksum; - [Write, Description("The credential of a user account with permissions to access the specified archive path and destination if needed.") ,EmbeddedInstance("MSFT_Credential")] String Credential; - [Write, Description("Specifies whether or not any existing files or directories at the destination with the same name as a file or directory in the archive should be overwritten to match the file or directory in the archive. When this property is false, an error will be thrown if an item at the destination needs to be overwritten. The default value is false.")] Boolean Force; -}; diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xArchive/en-US/MSFT_xArchive.schema.mfl b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xArchive/en-US/MSFT_xArchive.schema.mfl deleted file mode 100644 index fc681d9170f4ba9cbe228bd9d4b5f745801434c3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5900 zcmdT|+fEcg5Upnu|6$^jCQ6iuiTbqMA`!*78+jnaEW3kDTz1G_Kw|uL^_;3{dwQn&uH^JD6Byuh>#$Mrn4>NW!x~?l?`G}FJq%zmJvC8|d zpAlvs$XkqGLYGaQH^8h!&SZwqRK}`P4?9r$86?i|JHltGpZ30A(Bc?tN4kQuxh8@J zC#u6phIl&C(HIs`<{0l{eQ$D8$cykF%PH2-GOjtsn-p)jyX`y0>KOJX7)!EQlr+VR z1X8)PS+Sy68a^G!i2v+)2zg!1qt#>if~OCem9MXf(S>SBE1ET~NAKn^TgHC#gCc@? zH0nL2TR0K=tKnd0#&fmP9pjsR;m)$`3j@p;W1MHjnJG@$&#y<#{LRU&@)7UHA;Q!l zQSXT|uWgc2=V=kRNp{SE#Zcw6c|f%!+DbWOkg?loa~oJOR^_q0%+7*%F*1;wWa9){ zbBxi7T%!L^vol=58^b2gZGWb>Vb}HI%GFTmApV7zSUjU290R#Iq9;B69KT0+qW>7q zMLd}y7K>_IV9``_KrDZc%k)>%Iw|9L{se z*^Wm~Zr zDE{V^ZqKqT^21qdk-*m>%nYm(M%f%jkPG~#wh^QgZ_5>w5c-O@JbZ6H#B-SG3d{Zx zFr`$dr&S+TSxm4ebN>u~%rtiw;{+-|O>*5S1&X2$Ask$lp1J{~R>eVtw#jWL1jvRZ@r#66WGaB~e7M$IZl6{|tx zE_vzs{Xa%!vb_V=Ga8O_nTt_qf^J}*^$N_!tWFs9d~cMGV8$XMVsXr5vSKZtphe9x zpRHDQy;IR|+9P(}L)j-XYxv%16E-o%<+b)1$IdZ4`(3PHFSVaV$QadIl4ag<#TVA+ z&5SMklh0Q^_fprJ(V;0b(+4(SA^A#thUkQsMar+YjPvhtx(N;1Q0mGXu;qz7)0+$T zv?^=zLf^PL!;P$A=IRpu#w^c{tk~-<>r3sGmT4H)SA62R8z)@-M;~n0s|h*YcDQbd z(yDl0r4RkmWr6nWRLAz_TovAY6eHDgnTj_@WRLah39w{kXHkI}X0ExDHvp`>Sy9gs za~WBEg>N0?DWVMTx{OP963lY8j`1OXI#qZUYklAGJ0G=5u^fjOFWFbbnJugm7Vol* zg&_uuq1e^#+23W+!nUkER=@JM7W6{iU^%`}hE>qa13VpeJbc5BgQH=*ufxQj5A&P( zuIX;&7-#p-m4ma9=HEHmB{Dxy!lF-uwK^+LfLb v_A$kpyQ*5SRqRK2`?=@|Ie#@?kSk4?Ef-n5Rn1H&*1f(@GzR?0?j3#uHD4NC diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xArchive/en-US/MSFT_xArchive.strings.psd1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xArchive/en-US/MSFT_xArchive.strings.psd1 deleted file mode 100644 index f82caed1..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xArchive/en-US/MSFT_xArchive.strings.psd1 +++ /dev/null @@ -1,57 +0,0 @@ -# Localized MSFT_xArchive.strings.psd1 - -ConvertFrom-StringData @' - RetrievingArchiveState = Retrieving the state of the archive with path {0} and destination {1}... - SettingArchiveState = Setting the state of the archive with path {0} and destination {1}... - ArchiveStateSet = The state of the archive with path {0} and destination {1} has been set. - TestingArchiveState = Testing whether or not the state of the archive with path {0} and destination {1} matches the desired state... - - PathAccessiblePSDriveNotNeeded = The path {0} is accessible. A new PSDrive is not needed. - CreatingPSDrive = Creating a PSDrive to access the path {0} with permissions from the user {1}... - RemovingPSDrive = Removing the mounted PSDrive {0}... - - DestinationExists = A directory already exists at the destination path {0}. - DestinationDoesNotExist = A directory does not exist at the destination path {0}. - CreatingDirectoryAtDestination = Creating the root directory at the destination path {0}... - - TestingIfArchiveExistsAtDestination = Testing if the archive at the destination path {0} exists... - ArchiveExistsAtDestination = The archive at path {0} exists at the destination {1}. - ArchiveDoesNotExistAtDestination = The archive at path {0} does not exist at the destination {1}. - - OpeningArchive = Opening the archive at path {0}... - ClosingArchive = Closing the archive at path {0}... - - OpeningArchiveEntry = Opening the archive entry {0}... - - ItemWithArchiveEntryNameExists = An item with the same name as the archive entry exists at the destination path {0}. - ItemWithArchiveEntryNameDoesNotExist = An item with the same name as the archive entry does not exist at the destination path {0}. - ItemWithArchiveEntryNameIsNotDirectory = The item at the destination path {0} has the same name as a directory archive entry but is not a directory. - ItemWithArchiveEntryNameIsNotFile = The item at the destination path {0} has the same name as a file archive entry but is not a file. - - TestingIfFileMatchesArchiveEntryByChecksum = Testing if the file at {0} matches the archive entry at {1} by the checksum method {2}... - ComparingHashes = Comparing the hash of the file at {0} to the hash of the archive entry at {1} with the hash algorithm {2}... - FileMatchesArchiveEntryByChecksum = The file at {0} matches the archive entry at {1} by the checksum method {2}. - FileDoesNotMatchArchiveEntryByChecksum = The file at {0} does not match the archive entry at {1} by the checksum method {2}. - - ExpandingArchiveToDestination = Expanding the archive at {0} to the destination {1}... - CreatingParentDirectory = Creating an archive entry parent directory at the path {0}... - OverwritingItem = Overwriting the item at the path {0}... - CopyingArchiveEntryToDestination = Copying the corresponding archive entry to the path {0}... - - RemovingArchiveFromDestination = Removing archive from the destination path {0}... - RemovingDirectory = Removing the directory at path {0}... - RemovingFile = Removing the file at path {0}... - CouldNotRemoveItemOfIncorrectType = The file at {0} does not match the item type (file, directory, or other) or the archive entry at {1}, so it will not be removed. - ArchiveRemovedFromDestination = Archive removed from the destination path {0}. - - ChecksumSpecifiedAndValidateFalse = The Checksum parameter was specified as {0} but the Validate parameter is set to false for the archive with path {1} and destination {2}. Please specify the Validate parameter as true to use the Checksum parameter. - PathDoesNotContainValidPSDriveRoot = The path {0} cannot be accessed because it does not contain any directories to use as the root of a PSDrive. - ErrorCreatingPSDrive = An error occurred while attempting to create a PSDrive to access the path {0} under the user {1}. - PathDoesNotExistAsLeaf = The path {0} does not exist or is not a path leaf. - DestinationExistsAsFile = A file exists at the desintation path {0}. - ErrorOpeningArchive = An error occurred while attempting to open the archive at path {0}. - ErrorCopyingFromArchiveToDestination = An error occurred while attempting copy from the archive to the destination path {0}. - DirectoryIsNotEmpty = The directory at path {0} is not empty, so it will not be removed. - ErrorComparingHashes = An error occurred while comparing the hash of the file at {0} to the archive entry {1} with the hash algorithm {2}. - ForceNotSpecifiedToOverwriteItem = An item already exists at {0} that does not match the item in the archive at {1}, but the Force parameter has not been specified to overwrite this item. -'@ diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xDSCWebService/MSFT_xDSCWebService.Schema.mof b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xDSCWebService/MSFT_xDSCWebService.Schema.mof deleted file mode 100644 index 19faeb18..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xDSCWebService/MSFT_xDSCWebService.Schema.mof +++ /dev/null @@ -1,19 +0,0 @@ -[ClassVersion("1.0.0"), FriendlyName("xDSCWebService")] -class MSFT_xDSCWebService : OMI_BaseResource -{ - [Key] string EndpointName; - [required, Description("Can take the value AllowUnencryptedTraffic for setting up a non SSL based endpoint")] - string CertificateThumbPrint; - [write] uint32 Port; - [write] string PhysicalPath; - [write,ValueMap{"Present", "Absent"},Values{"Present", "Absent"}] string Ensure; - [write,ValueMap{"Started","Stopped"},Values{"Started", "Stopped"}] string State; - [write] string DatabasePath; - [write] string ModulePath; - [write] string ConfigurationPath; - [read] string DSCServerUrl; - [write] string RegistrationKeyPath; - [write] boolean AcceptSelfSignedCertificates; - [required, Description("This property will ensure that the Pull Server is created with the most secure practices")] boolean UseSecurityBestPractices; - [write,ValueMap{"SecureTLSProtocols"},Values{"SecureTLSProtocols"}] string DisableSecurityBestPractices []; -}; diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xDSCWebService/MSFT_xDSCWebService.psm1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xDSCWebService/MSFT_xDSCWebService.psm1 deleted file mode 100644 index 048d9475..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xDSCWebService/MSFT_xDSCWebService.psm1 +++ /dev/null @@ -1,691 +0,0 @@ -# Import the helper functions -Import-Module $PSScriptRoot\PSWSIISEndpoint.psm1 -Verbose:$false -Import-Module $PSScriptRoot\UseSecurityBestPractices.psm1 -Verbose:$false - -# The Get-TargetResource cmdlet. -function Get-TargetResource -{ - [OutputType([Hashtable])] - param - ( - # Prefix of the WCF SVC File - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string]$EndpointName, - - # Thumbprint of the Certificate in CERT:\LocalMachine\MY\ for Pull Server - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string]$CertificateThumbPrint, - - # Pull Server is created with the most secure practices - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [bool]$UseSecurityBestPractices, - - # Exceptions of security best practices - [ValidateSet("SecureTLSProtocols")] - [string[]] $DisableSecurityBestPractices - ) - - $webSite = Get-Website -Name $EndpointName - - if ($webSite) - { - $Ensure = 'Present' - $AcceptSelfSignedCertificates = $false - - # Get Full Path for Web.config file - $webConfigFullPath = Join-Path $website.physicalPath "web.config" - - # Get module and configuration path - $modulePath = Get-WebConfigAppSetting -WebConfigFullPath $webConfigFullPath -AppSettingName "ModulePath" - $ConfigurationPath = Get-WebConfigAppSetting -WebConfigFullPath $webConfigFullPath -AppSettingName "ConfigurationPath" - $RegistrationKeyPath = Get-WebConfigAppSetting -WebConfigFullPath $webConfigFullPath -AppSettingName "RegistrationKeyPath" - - # Get database path - switch ((Get-WebConfigAppSetting -WebConfigFullPath $webConfigFullPath -AppSettingName "dbprovider")) - { - "ESENT" { - $databasePath = Get-WebConfigAppSetting -WebConfigFullPath $webConfigFullPath -AppSettingName "dbconnectionstr" | Split-Path -Parent - } - - "System.Data.OleDb" { - $connectionString = Get-WebConfigAppSetting -WebConfigFullPath $webConfigFullPath -AppSettingName "dbconnectionstr" - if ($connectionString -match 'Data Source=(.*)\\Devices\.mdb') - { - $databasePath = $Matches[0] - } - } - } - - $UrlPrefix = $website.bindings.Collection[0].protocol + "://" - - $fqdn = $env:COMPUTERNAME - if ($env:USERDNSDOMAIN) - { - $fqdn = $env:COMPUTERNAME + "." + $env:USERDNSDOMAIN - } - - $iisPort = $website.bindings.Collection[0].bindingInformation.Split(":")[1] - - $svcFileName = (Get-ChildItem -Path $website.physicalPath -Filter "*.svc").Name - - $serverUrl = $UrlPrefix + $fqdn + ":" + $iisPort + "/" + $svcFileName - - $webBinding = Get-WebBinding -Name $EndpointName - - # This is the 64 bit module - $certNativeModule = Get-WebConfigModulesSetting -WebConfigFullPath $webConfigFullPath -ModuleName "IISSelfSignedCertModule" - if($certNativeModule) - { - $AcceptSelfSignedCertificates = $true - } - - # This is the 32 bit module - $certNativeModule = Get-WebConfigModulesSetting -WebConfigFullPath $webConfigFullPath -ModuleName "IISSelfSignedCertModule(32bit)" - if($certNativeModule) - { - $AcceptSelfSignedCertificates = $true - } - } - else - { - $Ensure = 'Absent' - } - - @{ - EndpointName = $EndpointName - CertificateThumbPrint = if($CertificateThumbPrint -eq 'AllowUnencryptedTraffic'){$CertificateThumbPrint} else {(Get-WebBinding -Name $EndpointName).CertificateHash} - Port = $iisPort - PhysicalPath = $website.physicalPath - State = $webSite.state - DatabasePath = $databasePath - ModulePath = $modulePath - ConfigurationPath = $ConfigurationPath - DSCServerUrl = $serverUrl - Ensure = $Ensure - RegistrationKeyPath = $RegistrationKeyPath - AcceptSelfSignedCertificates = $AcceptSelfSignedCertificates - UseSecurityBestPractices = $UseSecurityBestPractices - DisableSecurityBestPractices = $DisableSecurityBestPractices - } -} - -# The Set-TargetResource cmdlet. -function Set-TargetResource -{ - param - ( - # Prefix of the WCF SVC File - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string]$EndpointName, - - # Port number of the DSC Pull Server IIS Endpoint - [Uint32]$Port = 8080, - - # Physical path for the IIS Endpoint on the machine (usually under inetpub) - [string]$PhysicalPath = "$env:SystemDrive\inetpub\$EndpointName", - - # Thumbprint of the Certificate in CERT:\LocalMachine\MY\ for Pull Server - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string]$CertificateThumbPrint, - - [ValidateSet("Present", "Absent")] - [string]$Ensure = "Present", - - [ValidateSet("Started", "Stopped")] - [string]$State = "Started", - - # Location on the disk where the database is stored - [ValidateNotNullOrEmpty()] - [System.String] - $DatabasePath = "$env:PROGRAMFILES\WindowsPowerShell\DscService", - - # Location on the disk where the Modules are stored - [string]$ModulePath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Modules", - - # Location on the disk where the Configuration is stored - [string]$ConfigurationPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration", - - # Location on the disk where the RegistrationKeys file is stored - [string]$RegistrationKeyPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService", - - # Add the IISSelfSignedCertModule native module to prevent self-signed certs being rejected. - [boolean]$AcceptSelfSignedCertificates = $true, - - # Pull Server is created with the most secure practices - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [bool]$UseSecurityBestPractices, - - # Exceptions of security best practices - [ValidateSet("SecureTLSProtocols")] - [string[]] $DisableSecurityBestPractices - ) - - # Check parameter values - if ($UseSecurityBestPractices -and ($CertificateThumbPrint -eq "AllowUnencryptedTraffic")) - { - throw "Error: Cannot use best practice security settings with unencrypted traffic. Please set UseSecurityBestPractices to `$false or use a certificate to encrypt pull server traffic." - # No need to proceed any more - return - } - - # Initialize with default values - $script:appCmd = "$env:windir\system32\inetsrv\appcmd.exe" - - $pathPullServer = "$pshome\modules\PSDesiredStateConfiguration\PullServer" - $jet4provider = "System.Data.OleDb" - $jet4database = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=$DatabasePath\Devices.mdb;" - $eseprovider = "ESENT"; - $esedatabase = "$DatabasePath\Devices.edb"; - - $culture = Get-Culture - $language = $culture.TwoLetterISOLanguageName - # the two letter iso languagename is not actually implemented in the source path, it's always 'en' - if (-not (Test-Path $pathPullServer\$language\Microsoft.Powershell.DesiredStateConfiguration.Service.Resources.dll)) { - $language = 'en' - } - - $os = [System.Environment]::OSVersion.Version - $IsBlue = $false; - if($os.Major -eq 6 -and $os.Minor -eq 3) - { - $IsBlue = $true; - } - - $isDownlevelOfBlue = $false; - if($os.Major -eq 6 -and $os.Minor -lt 3) - { - $isDownlevelOfBlue= $true; - } - - # Use Pull Server values for defaults - $webConfigFileName = "$pathPullServer\PSDSCPullServer.config" - $svcFileName = "$pathPullServer\PSDSCPullServer.svc" - $pswsMofFileName = "$pathPullServer\PSDSCPullServer.mof" - $pswsDispatchFileName = "$pathPullServer\PSDSCPullServer.xml" - - # ============ Absent block to remove existing site ========= - if(($Ensure -eq "Absent")) - { - $website = Get-Website -Name $EndpointName - if($website -ne $null) - { - # there is a web site, but there shouldn't be one - Write-Verbose "Removing web site $EndpointName" - PSWSIISEndpoint\Remove-PSWSEndpoint -SiteName $EndpointName - } - - # we are done here, all stuff below is for 'Present' - return - } - # =========================================================== - - Write-Verbose "Create the IIS endpoint" - PSWSIISEndpoint\New-PSWSEndpoint -site $EndpointName ` - -path $PhysicalPath ` - -cfgfile $webConfigFileName ` - -port $Port ` - -applicationPoolIdentityType LocalSystem ` - -app $EndpointName ` - -svc $svcFileName ` - -mof $pswsMofFileName ` - -dispatch $pswsDispatchFileName ` - -asax "$pathPullServer\Global.asax" ` - -dependentBinaries "$pathPullServer\Microsoft.Powershell.DesiredStateConfiguration.Service.dll" ` - -language $language ` - -dependentMUIFiles "$pathPullServer\$language\Microsoft.Powershell.DesiredStateConfiguration.Service.Resources.dll" ` - -certificateThumbPrint $CertificateThumbPrint ` - -EnableFirewallException $true -Verbose - - Update-LocationTagInApplicationHostConfigForAuthentication -WebSite $EndpointName -Authentication "anonymous" - Update-LocationTagInApplicationHostConfigForAuthentication -WebSite $EndpointName -Authentication "basic" - Update-LocationTagInApplicationHostConfigForAuthentication -WebSite $EndpointName -Authentication "windows" - - if ($IsBlue) - { - Write-Verbose "Set values into the web.config that define the repository for BLUE OS" - PSWSIISEndpoint\Set-AppSettingsInWebconfig -path $PhysicalPath -key "dbprovider" -value $eseprovider - PSWSIISEndpoint\Set-AppSettingsInWebconfig -path $PhysicalPath -key "dbconnectionstr"-value $esedatabase - Set-BindingRedirectSettingInWebConfig -path $PhysicalPath - } - else - { - if($isDownlevelOfBlue) - { - Write-Verbose "Set values into the web.config that define the repository for non-BLUE Downlevel OS" - $repository = Join-Path "$DatabasePath" "Devices.mdb" - Copy-Item "$pathPullServer\Devices.mdb" $repository -Force - - PSWSIISEndpoint\Set-AppSettingsInWebconfig -path $PhysicalPath -key "dbprovider" -value $jet4provider - PSWSIISEndpoint\Set-AppSettingsInWebconfig -path $PhysicalPath -key "dbconnectionstr" -value $jet4database - } - else - { - Write-Verbose "Set values into the web.config that define the repository later than BLUE OS" - Write-Verbose "Only ESENT is supported on Windows Server 2016" - - PSWSIISEndpoint\Set-AppSettingsInWebconfig -path $PhysicalPath -key "dbprovider" -value $eseprovider - PSWSIISEndpoint\Set-AppSettingsInWebconfig -path $PhysicalPath -key "dbconnectionstr"-value $esedatabase - } - } - - Write-Verbose "Pull Server: Set values into the web.config that indicate the location of repository, configuration, modules" - - # Create the application data directory calculated above - $null = New-Item -path $DatabasePath -itemType "directory" -Force - - $null = New-Item -path "$ConfigurationPath" -itemType "directory" -Force - - PSWSIISEndpoint\Set-AppSettingsInWebconfig -path $PhysicalPath -key "ConfigurationPath" -value $ConfigurationPath - - $null = New-Item -path "$ModulePath" -itemType "directory" -Force - - PSWSIISEndpoint\Set-AppSettingsInWebconfig -path $PhysicalPath -key "ModulePath" -value $ModulePath - - $null = New-Item -path "$RegistrationKeyPath" -itemType "directory" -Force - - PSWSIISEndpoint\Set-AppSettingsInWebconfig -path $PhysicalPath -key "RegistrationKeyPath" -value $RegistrationKeyPath - - if($AcceptSelfSignedCertificates) - { - Copy-Item "$pathPullServer\IISSelfSignedCertModule.dll" $env:windir\System32\inetsrv -Force - Copy-Item "$env:windir\SysWOW64\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\PullServer\IISSelfSignedCertModule.dll" $env:windir\SysWOW64\inetsrv -Force - - & $script:appCmd install module /name:"IISSelfSignedCertModule(32bit)" /image:$env:windir\SysWOW64\inetsrv\IISSelfSignedCertModule.dll /add:false /lock:false /preCondition:bitness32 - & $script:appCmd add module /name:"IISSelfSignedCertModule(32bit)" /app.name:"PSDSCPullServer/" - } - else - { - if($AcceptSelfSignedCertificates -and ($AcceptSelfSignedCertificates -eq $false)) - { - & $script:appCmd delete module /name:"IISSelfSignedCertModule(32bit)" /app.name:"PSDSCPullServer/" - } - } - - if($UseSecurityBestPractices) - { - UseSecurityBestPractices\Set-UseSecurityBestPractices -DisableSecurityBestPractices $DisableSecurityBestPractices - } -} - -# The Test-TargetResource cmdlet. -function Test-TargetResource -{ - [OutputType([Boolean])] - param - ( - # Prefix of the WCF SVC File - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string]$EndpointName, - - # Port number of the DSC Pull Server IIS Endpoint - [Uint32]$Port = 8080, - - # Physical path for the IIS Endpoint on the machine (usually under inetpub) - [string]$PhysicalPath = "$env:SystemDrive\inetpub\$EndpointName", - - # Thumbprint of the Certificate in CERT:\LocalMachine\MY\ for Pull Server - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string]$CertificateThumbPrint = "AllowUnencryptedTraffic", - - [ValidateSet("Present", "Absent")] - [string]$Ensure = "Present", - - [ValidateSet("Started", "Stopped")] - [string]$State = "Started", - - # Location on the disk where the database is stored - [ValidateNotNullOrEmpty()] - [System.String] - $DatabasePath = "$env:PROGRAMFILES\WindowsPowerShell\DscService", - - # Location on the disk where the Modules are stored - [string]$ModulePath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Modules", - - # Location on the disk where the Configuration is stored - [string]$ConfigurationPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration", - - # Location on the disk where the RegistrationKeys file is stored - [string]$RegistrationKeyPath, - - # Are self-signed certs being accepted for client auth. - [boolean]$AcceptSelfSignedCertificates, - - # Pull Server is created with the most secure practices - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [bool]$UseSecurityBestPractices, - - # Exceptions of security best practices - [ValidateSet("SecureTLSProtocols")] - [string[]] $DisableSecurityBestPractices - ) - - $desiredConfigurationMatch = $true; - - $website = Get-Website -Name $EndpointName - $stop = $true - - Do - { - Write-Verbose "Check Ensure" - if(($Ensure -eq "Present" -and $website -eq $null)) - { - $DesiredConfigurationMatch = $false - Write-Verbose "The Website $EndpointName is not present" - break - } - if(($Ensure -eq "Absent" -and $website -ne $null)) - { - $DesiredConfigurationMatch = $false - Write-Verbose "The Website $EndpointName is present but should not be" - break - } - if(($Ensure -eq "Absent" -and $website -eq $null)) - { - $DesiredConfigurationMatch = $true - Write-Verbose "The Website $EndpointName is not present as requested" - break - } - # the other case is: Ensure and exist, we continue with more checks - - Write-Verbose "Check Port" - $actualPort = $website.bindings.Collection[0].bindingInformation.Split(":")[1] - if ($Port -ne $actualPort) - { - $DesiredConfigurationMatch = $false - Write-Verbose "Port for the Website $EndpointName does not match the desired state." - break - } - - Write-Verbose "Check Physical Path property" - if(Test-WebsitePath -EndpointName $EndpointName -PhysicalPath $PhysicalPath) - { - $DesiredConfigurationMatch = $false - Write-Verbose "Physical Path of Website $EndpointName does not match the desired state." - break - } - - Write-Verbose "Check State" - if($website.state -ne $State -and $State -ne $null) - { - $DesiredConfigurationMatch = $false - Write-Verbose "The state of Website $EndpointName does not match the desired state." - break - } - - Write-Verbose "Get Full Path for Web.config file" - $webConfigFullPath = Join-Path $website.physicalPath "web.config" - if ($IsComplianceServer -eq $false) - { - Write-Verbose "Check DatabasePath" - switch ((Get-WebConfigAppSetting -WebConfigFullPath $webConfigFullPath -AppSettingName "dbprovider")) - { - "ESENT" { - $expectedConnectionString = "$DatabasePath\Devices.edb" - } - "System.Data.OleDb" { - $expectedConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=$DatabasePath\Devices.mdb;" - } - default { - $expectedConnectionString = [System.String]::Empty - } - } - if (([System.String]::IsNullOrEmpty($expectedConnectionString))) - { - $DesiredConfigurationMatch = $false - Write-Verbose "The DB provider does not have a valid value: 'ESENT' or 'System.Data.OleDb'" - break - } - - if (-not (Test-WebConfigAppSetting -WebConfigFullPath $webConfigFullPath -AppSettingName "dbconnectionstr" -ExpectedAppSettingValue $expectedConnectionString)) - { - $DesiredConfigurationMatch = $false - break - } - - Write-Verbose "Check ModulePath" - if ($ModulePath) - { - if (-not (Test-WebConfigAppSetting -WebConfigFullPath $webConfigFullPath -AppSettingName "ModulePath" -ExpectedAppSettingValue $ModulePath)) - { - $DesiredConfigurationMatch = $false - break - } - } - - Write-Verbose "Check ConfigurationPath" - if ($ConfigurationPath) - { - if (-not (Test-WebConfigAppSetting -WebConfigFullPath $webConfigFullPath -AppSettingName "ConfigurationPath" -ExpectedAppSettingValue $ConfigurationPath)) - { - $DesiredConfigurationMatch = $false - break - } - } - - Write-Verbose "Check RegistrationKeyPath" - if ($RegistrationKeyPath) - { - if (-not (Test-WebConfigAppSetting -WebConfigFullPath $webConfigFullPath -AppSettingName "RegistrationKeyPath" -ExpectedAppSettingValue $RegistrationKeyPath)) - { - $DesiredConfigurationMatch = $false - break - } - } - - Write-Verbose "Check AcceptSelfSignedCertificates" - if ($AcceptSelfSignedCertificates) - { - if (-not (Test-WebConfigModulesSetting -WebConfigFullPath $webConfigFullPath -ModuleName "IISSelfSignedCertModule(32bit)" -ExpectedInstallationStatus $AcceptSelfSignedCertificates)) - { - $DesiredConfigurationMatch = $false - break - } - } - } - - Write-Verbose "Check UseSecurityBestPractices" - if ($UseSecurityBestPractices) - { - if (-not (UseSecurityBestPractices\Test-UseSecurityBestPractices -DisableSecurityBestPractices $DisableSecurityBestPractices)) - { - $desiredConfigurationMatch = $false; - Write-Verbose "The state of security settings does not match the desired state." - break - } - } - $stop = $false - } - While($stop) - - $desiredConfigurationMatch; -} - -# Helper function used to validate website path -function Test-WebsitePath -{ - param - ( - [string] $EndpointName, - [string] $PhysicalPath - ) - - $pathNeedsUpdating = $false - - if((Get-ItemProperty "IIS:\Sites\$EndpointName" -Name physicalPath) -ne $PhysicalPath) - { - $pathNeedsUpdating = $true - } - - $pathNeedsUpdating -} - -# Helper function to Test the specified Web.Config App Setting -function Test-WebConfigAppSetting -{ - param - ( - [string] $WebConfigFullPath, - [string] $AppSettingName, - [string] $ExpectedAppSettingValue - ) - - $returnValue = $true - - if (Test-Path $WebConfigFullPath) - { - $webConfigXml = [xml](get-content $WebConfigFullPath) - $root = $webConfigXml.get_DocumentElement() - - foreach ($item in $root.appSettings.add) - { - if( $item.key -eq $AppSettingName ) - { - break - } - } - - if($item.value -ne $ExpectedAppSettingValue) - { - $returnValue = $false - Write-Verbose "The state of Web.Config AppSetting $AppSettingName does not match the desired state." - } - - } - $returnValue -} - -# Helper function to Get the specified Web.Config App Setting -function Get-WebConfigAppSetting -{ - param - ( - [string] $WebConfigFullPath, - [string] $AppSettingName - ) - - $appSettingValue = "" - if (Test-Path $WebConfigFullPath) - { - $webConfigXml = [xml](get-content $WebConfigFullPath) - $root = $webConfigXml.get_DocumentElement() - - foreach ($item in $root.appSettings.add) - { - if( $item.key -eq $AppSettingName ) - { - $appSettingValue = $item.value - break - } - } - } - - $appSettingValue -} - -# Helper function to Test the specified Web.Config Modules Setting -function Test-WebConfigModulesSetting -{ - param - ( - [string] $WebConfigFullPath, - [string] $ModuleName, - [boolean] $ExpectedInstallationStatus - ) - - $returnValue = $false - - if (Test-Path $WebConfigFullPath) - { - $webConfigXml = [xml](get-content $WebConfigFullPath) - $root = $webConfigXml.get_DocumentElement() - - foreach ($item in $root."system.webServer".modules.add) - { - if( $item.name -eq $ModuleName ) - { - if($ExpectedInstallationStatus -eq $true) - { - $returnValue = $true - } - break - } - } - } - - if(($ExpectedInstallationStatus -eq $false) -and ($returnValue -eq $false)) - { - $returnValue = $true - } - - $returnValue -} - -# Helper function to Get the specified Web.Config Modules Setting -function Get-WebConfigModulesSetting -{ - param - ( - [string] $WebConfigFullPath, - [string] $ModuleName - ) - - $moduleValue = "" - if (Test-Path $WebConfigFullPath) - { - $webConfigXml = [xml](get-content $WebConfigFullPath) - $root = $webConfigXml.get_DocumentElement() - - foreach ($item in $root."system.webServer".modules.add) - { - if( $item.name -eq $ModuleName ) - { - $moduleValue = $item.name - break - } - } - } - - $moduleValue -} - -# Helper to get current script Folder -function Get-ScriptFolder -{ - $Invocation = (Get-Variable MyInvocation -Scope 1).Value - Split-Path $Invocation.MyCommand.Path -} - -# Allow this Website to enable/disable specific Auth Schemes by adding tag in applicationhost.config -function Update-LocationTagInApplicationHostConfigForAuthentication -{ - param ( - # Name of the WebSite - [String] $WebSite, - - # Authentication Type - [ValidateSet('anonymous', 'basic', 'windows')] - [String] $Authentication - ) - - [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Web.Administration") | Out-Null - - $webAdminSrvMgr = [Microsoft.Web.Administration.ServerManager]::OpenRemote("127.0.0.1") - - $appHostConfig = $webAdminSrvMgr.GetApplicationHostConfiguration() - - $authenticationType = $Authentication + "Authentication" - $appHostConfigSection = $appHostConfig.GetSection("system.webServer/security/authentication/$authenticationType", $WebSite) - $appHostConfigSection.OverrideMode="Allow" - $webAdminSrvMgr.CommitChanges() -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xDSCWebService/PSWSIISEndpoint.psm1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xDSCWebService/PSWSIISEndpoint.psm1 deleted file mode 100644 index 11cb3c74..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xDSCWebService/PSWSIISEndpoint.psm1 +++ /dev/null @@ -1,709 +0,0 @@ -# This module file contains a utility to perform PSWS IIS Endpoint setup -# Module exports New-PSWSEndpoint function to perform the endpoint setup -# -#Copyright (c) Microsoft Corporation, 2014 -# - -# name and description for the Firewall rules. Used in multiple locations -$FireWallRuleDisplayName = "Desired State Configuration - Pull Server Port:{0}" -$FireWallRuleDescription = "Inbound traffic for IIS site on Port:{0} for DSC pull server. Created by DSCWebService resource" - -# Validate supplied configuration to setup the PSWS Endpoint -# Function checks for the existence of PSWS Schema files, IIS config -# Also validate presence of IIS on the target machine -# -function Initialize-Endpoint -{ - param ( - $site, - $path, - $cfgfile, - $port, - $app, - $applicationPoolIdentityType, - $svc, - $mof, - $dispatch, - $asax, - $dependentBinaries, - $language, - $dependentMUIFiles, - $psFiles, - $removeSiteFiles = $false, - $certificateThumbPrint) - - if (!(Test-Path $cfgfile)) - { - throw "ERROR: $cfgfile does not exist" - } - - if (!(Test-Path $svc)) - { - throw "ERROR: $svc does not exist" - } - - if (!(Test-Path $mof)) - { - throw "ERROR: $mof does not exist" - } - - if (!(Test-Path $asax)) - { - throw "ERROR: $asax does not exist" - } - - if ($certificateThumbPrint -ne "AllowUnencryptedTraffic") - { - Write-Verbose "Verify that the certificate with the provided thumbprint exists in CERT:\LocalMachine\MY\" - $certificate = Get-childItem CERT:\LocalMachine\MY\ | Where {$_.Thumbprint -eq $certificateThumbPrint} - if (!$Certificate) - { - throw "ERROR: Certificate with thumbprint $certificateThumbPrint does not exist in CERT:\LocalMachine\MY\" - } - } - - Test-IISInstall - - $appPool = "PSWS" - - - Write-Verbose "Delete the App Pool if it exists" - Remove-AppPool -apppool $appPool - - Write-Verbose "Remove the site if it already exists" - Update-Site -siteName $site -siteAction Remove - - # check for existing binding, there should be no binding with the same port - if ((Get-WebBinding | where bindingInformation -eq "*:$($port):").count -gt 0) - { - throw "ERROR: Port $port is already used, please review existing sites and change the port to be used." - } - - if ($removeSiteFiles) - { - if(Test-Path $path) - { - Remove-Item -Path $path -Recurse -Force - } - } - - Copy-Files -path $path -cfgfile $cfgfile -svc $svc -mof $mof -dispatch $dispatch -asax $asax -dependentBinaries $dependentBinaries -language $language -dependentMUIFiles $dependentMUIFiles -psFiles $psFiles - - New-IISWebSite -site $site -path $path -port $port -app $app -apppool $appPool -applicationPoolIdentityType $applicationPoolIdentityType -certificateThumbPrint $certificateThumbPrint -} - -# Validate if IIS and all required dependencies are installed on the target machine -# -function Test-IISInstall -{ - Write-Verbose "Checking IIS requirements" - $iisVersion = (Get-ItemProperty HKLM:\SOFTWARE\Microsoft\InetStp -ErrorAction silentlycontinue).MajorVersion - - if ($iisVersion -lt 7) - { - throw "ERROR: IIS Version detected is $iisVersion , must be running higher than 7.0" - } - - $wsRegKey = (Get-ItemProperty hklm:\SYSTEM\CurrentControlSet\Services\W3SVC -ErrorAction silentlycontinue).ImagePath - if ($wsRegKey -eq $null) - { - throw "ERROR: Cannot retrive W3SVC key. IIS Web Services may not be installed" - } - - if ((Get-Service w3svc).Status -ne "running") - { - throw "ERROR: service W3SVC is not running" - } -} - -# Verify if a given IIS Site exists -# -function Test-IISSiteExists -{ - param ($siteName) - - if (Get-Website -Name $siteName) - { - return $true - } - - return $false -} - -# Perform an action (such as stop, start, delete) for a given IIS Site -# -function Update-Site -{ - param ( - [Parameter(ParameterSetName = 'SiteName', Mandatory, Position = 0)] - [ValidateNotNullOrEmpty()] - [String]$siteName, - - [Parameter(ParameterSetName = 'Site', Mandatory, Position = 0)] - $site, - - [Parameter(ParameterSetName = 'SiteName', Mandatory, Position = 1)] - [Parameter(ParameterSetName = 'Site', Mandatory, Position = 1)] - [String]$siteAction) - - [String]$name = $null - if ($PSCmdlet.ParameterSetName -eq 'SiteName') - { - $name = $siteName - } - elseif ($PSCmdlet.ParameterSetName -eq 'Site') - { - $name = $site.Name - } - - if (Test-IISSiteExists -siteName $name) - { - switch ($siteAction) - { - "Start" {Start-Website -Name "$name"} - "Stop" {Stop-Website -Name "$name" -ErrorAction SilentlyContinue} - "Remove" {Remove-Website -Name "$name"} - } - Write-Verbose "p11" - } -} - -# Delete the given IIS Application Pool -# This is required to cleanup any existing conflicting apppools before setting up the endpoint -# -function Remove-AppPool -{ - param ($appPool) - - # without this tests we may get a breaking error here, despite SilentlyContinue - if (Test-Path "IIS:\AppPools\$appPool") - { - Remove-WebAppPool -Name $appPool -ErrorAction SilentlyContinue - } -} - -# Generate an IIS Site Id while setting up the endpoint -# The Site Id will be the max available in IIS config + 1 -# -function New-SiteID -{ - return ((Get-Website | % { $_.Id } | Measure-Object -Maximum).Maximum + 1) -} - -# Validate the PSWS config files supplied and copy to the IIS endpoint in inetpub -# -function Copy-Files -{ - param ( - $path, - $cfgfile, - $svc, - $mof, - $dispatch, - $asax, - $dependentBinaries, - $language, - $dependentMUIFiles, - $psFiles) - - if (!(Test-Path $cfgfile)) - { - throw "ERROR: $cfgfile does not exist" - } - - if (!(Test-Path $svc)) - { - throw "ERROR: $svc does not exist" - } - - if (!(Test-Path $mof)) - { - throw "ERROR: $mof does not exist" - } - - if (!(Test-Path $asax)) - { - throw "ERROR: $asax does not exist" - } - - if (!(Test-Path $path)) - { - $null = New-Item -ItemType container -Path $path - } - - foreach ($dependentBinary in $dependentBinaries) - { - if (!(Test-Path $dependentBinary)) - { - throw "ERROR: $dependentBinary does not exist" - } - } - - foreach ($dependentMUIFile in $dependentMUIFiles) - { - if (!(Test-Path $dependentMUIFile)) - { - throw "ERROR: $dependentMUIFile does not exist" - } - } - - Write-Verbose "Create the bin folder for deploying custom dependent binaries required by the endpoint" - $binFolderPath = Join-Path $path "bin" - $null = New-Item -path $binFolderPath -itemType "directory" -Force - Copy-Item $dependentBinaries $binFolderPath -Force - - if ($language) - { - $muiPath = Join-Path $binFolderPath $language - - if (!(Test-Path $muiPath)) - { - $null = New-Item -ItemType container $muiPath - } - Copy-Item $dependentMUIFiles $muiPath -Force - } - - foreach ($psFile in $psFiles) - { - if (!(Test-Path $psFile)) - { - throw "ERROR: $psFile does not exist" - } - - Copy-Item $psFile $path -Force - } - - Copy-Item $cfgfile (Join-Path $path "web.config") -Force - Copy-Item $svc $path -Force - Copy-Item $mof $path -Force - - if ($dispatch) - { - Copy-Item $dispatch $path -Force - } - - if ($asax) - { - Copy-Item $asax $path -Force - } -} - -# Setup IIS Apppool, Site and Application -# -function New-IISWebSite -{ - param ( - $site, - $path, - $port, - $app, - $appPool, - $applicationPoolIdentityType, - $certificateThumbPrint) - - $siteID = New-SiteID - - Write-Verbose "Adding App Pool" - $null = New-WebAppPool -Name $appPool - - Write-Verbose "Set App Pool Properties" - $appPoolIdentity = 4 - if ($applicationPoolIdentityType) - { - # LocalSystem = 0, LocalService = 1, NetworkService = 2, SpecificUser = 3, ApplicationPoolIdentity = 4 - if ($applicationPoolIdentityType -eq "LocalSystem") - { - $appPoolIdentity = 0 - } - elseif ($applicationPoolIdentityType -eq "LocalService") - { - $appPoolIdentity = 1 - } - elseif ($applicationPoolIdentityType -eq "NetworkService") - { - $appPoolIdentity = 2 - } - } - - $appPoolItem = Get-Item IIS:\AppPools\$appPool - $appPoolItem.managedRuntimeVersion = "v4.0" - $appPoolItem.enable32BitAppOnWin64 = $true - $appPoolItem.processModel.identityType = $appPoolIdentity - $appPoolItem | Set-Item - - Write-Verbose "Add and Set Site Properties" - if ($certificateThumbPrint -eq "AllowUnencryptedTraffic") - { - $webSite = New-WebSite -Name $site -Id $siteID -Port $port -IPAddress "*" -PhysicalPath $path -ApplicationPool $appPool - } - else - { - $webSite = New-WebSite -Name $site -Id $siteID -Port $port -IPAddress "*" -PhysicalPath $path -ApplicationPool $appPool -Ssl - - # Remove existing binding for $port - Remove-Item IIS:\SSLBindings\0.0.0.0!$port -ErrorAction Ignore - - # Create a new binding using the supplied certificate - $null = Get-Item CERT:\LocalMachine\MY\$certificateThumbPrint | New-Item IIS:\SSLBindings\0.0.0.0!$port - } - - Update-Site -siteName $site -siteAction Start -} - -# Allow Clients outsite the machine to access the setup endpoint on a User Port -# -function New-FirewallRule -{ - param ($firewallPort) - - $script:netsh = "$env:windir\system32\netsh.exe" - - Write-Verbose "Disable Inbound Firewall Notification" - & $script:netsh advfirewall set currentprofile settings inboundusernotification disable - - # remove all existing rules with that displayName - & $script:netsh advfirewall firewall delete rule name=DSCPullServer_IIS_Port protocol=tcp localport=$firewallPort | Out-Null - - Write-Verbose "Add Firewall Rule for port $firewallPort" - & $script:netsh advfirewall firewall add rule name=DSCPullServer_IIS_Port dir=in action=allow protocol=TCP localport=$firewallPort -} - -# Enable & Clear PSWS Operational/Analytic/Debug ETW Channels -# -function Enable-PSWSETW -{ - # Disable Analytic Log - & $script:wevtutil sl Microsoft-Windows-ManagementOdataService/Analytic /e:false /q | Out-Null - - # Disable Debug Log - & $script:wevtutil sl Microsoft-Windows-ManagementOdataService/Debug /e:false /q | Out-Null - - # Clear Operational Log - & $script:wevtutil cl Microsoft-Windows-ManagementOdataService/Operational | Out-Null - - # Enable/Clear Analytic Log - & $script:wevtutil sl Microsoft-Windows-ManagementOdataService/Analytic /e:true /q | Out-Null - - # Enable/Clear Debug Log - & $script:wevtutil sl Microsoft-Windows-ManagementOdataService/Debug /e:true /q | Out-Null -} - -<# -.Synopsis - Create PowerShell WebServices IIS Endpoint -.DESCRIPTION - Creates a PSWS IIS Endpoint by consuming PSWS Schema and related dependent files -.EXAMPLE - New a PSWS Endpoint [@ http://Server:39689/PSWS_Win32Process] by consuming PSWS Schema Files and any dependent scripts/binaries - New-PSWSEndpoint -site Win32Process -path $env:SystemDrive\inetpub\PSWS_Win32Process -cfgfile Win32Process.config -port 39689 -app Win32Process -svc PSWS.svc -mof Win32Process.mof -dispatch Win32Process.xml -dependentBinaries ConfigureProcess.ps1, Rbac.dll -psFiles Win32Process.psm1 -#> -function New-PSWSEndpoint -{ -[CmdletBinding()] - param ( - - # Unique Name of the IIS Site - [String] $site = "PSWS", - - # Physical path for the IIS Endpoint on the machine (under inetpub) - [String] $path = "$env:SystemDrive\inetpub\PSWS", - - # Web.config file - [String] $cfgfile = "web.config", - - # Port # for the IIS Endpoint - [Int] $port = 8080, - - # IIS Application Name for the Site - [String] $app = "PSWS", - - # IIS App Pool Identity Type - must be one of LocalService, LocalSystem, NetworkService, ApplicationPoolIdentity - [ValidateSet('LocalService', 'LocalSystem', 'NetworkService', 'ApplicationPoolIdentity')] - [String] $applicationPoolIdentityType, - - # WCF Service SVC file - [String] $svc = "PSWS.svc", - - # PSWS Specific MOF Schema File - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [String] $mof, - - # PSWS Specific Dispatch Mapping File [Optional] - [ValidateNotNullOrEmpty()] - [String] $dispatch, - - # Global.asax file [Optional] - [ValidateNotNullOrEmpty()] - [String] $asax, - - # Any dependent binaries that need to be deployed to the IIS endpoint, in the bin folder - [ValidateNotNullOrEmpty()] - [String[]] $dependentBinaries, - - # MUI Language [Optional] - [ValidateNotNullOrEmpty()] - [String] $language, - - # Any dependent binaries that need to be deployed to the IIS endpoint, in the bin\mui folder [Optional] - [ValidateNotNullOrEmpty()] - [String[]] $dependentMUIFiles, - - # Any dependent PowerShell Scipts/Modules that need to be deployed to the IIS endpoint application root - [ValidateNotNullOrEmpty()] - [String[]] $psFiles, - - # True to remove all files for the site at first, false otherwise - [Boolean]$removeSiteFiles = $false, - - # Enable Firewall Exception for the supplied port - [Boolean] $EnableFirewallException, - - # Enable and Clear PSWS ETW - [switch] $EnablePSWSETW, - - # Thumbprint of the Certificate in CERT:\LocalMachine\MY\ for Pull Server - [String] $certificateThumbPrint = "AllowUnencryptedTraffic") - - $script:wevtutil = "$env:windir\system32\Wevtutil.exe" - - $svcName = Split-Path $svc -Leaf - $protocol = "https:" - if ($certificateThumbPrint -eq "AllowUnencryptedTraffic") - { - $protocol = "http:" - } - - # Get Machine Name - $cimInstance = Get-CimInstance -ClassName Win32_ComputerSystem -Verbose:$false - - Write-Verbose ("Setting up endpoint at - $protocol//" + $cimInstance.Name + ":" + $port + "/" + $svcName) - Initialize-Endpoint -site $site -path $path -cfgfile $cfgfile -port $port -app $app ` - -applicationPoolIdentityType $applicationPoolIdentityType -svc $svc -mof $mof ` - -dispatch $dispatch -asax $asax -dependentBinaries $dependentBinaries ` - -language $language -dependentMUIFiles $dependentMUIFiles -psFiles $psFiles ` - -removeSiteFiles $removeSiteFiles -certificateThumbPrint $certificateThumbPrint - - if ($EnableFirewallException -eq $true) - { - Write-Verbose "Enabling firewall exception for port $port" - $null = New-FirewallRule $port - } - - if ($EnablePSWSETW) - { - Enable-PSWSETW - } -} - -<# -.Synopsis - Removes a DSC WebServices IIS Endpoint -.DESCRIPTION - Removes a PSWS IIS Endpoint -.EXAMPLE - Remove the endpoint with the specified name - Remove-PSWSEndpoint -siteName PSDSCPullServer -#> -function Remove-PSWSEndpoint -{ -[CmdletBinding()] - param ( - # Unique Name of the IIS Site - [String] $siteName - ) - - # get the site to remove - $site = Get-Item -Path "IIS:\sites\$siteName" - # and the pool it is using - $pool = $site.applicationPool - - # get the path so we can delete the files - $filePath = $site.PhysicalPath - # get the port number for the Firewall rule - $bindings = (Get-WebBinding -Name $siteName).bindingInformation - $port = [regex]::match($bindings,':(\d+):').Groups[1].Value - - # remove the actual site. - Remove-Website -Name $siteName - # there may be running requests, wait a little - # I had an issue where the files were still in use - # when I tried to delete them - Start-Sleep -Milliseconds 200 - - # remove the files for the site - If (Test-Path $filePath) - { - Get-ChildItem $filePath -Recurse | Remove-Item -Recurse - Remove-Item $filePath - } - - # find out whether any other site is using this pool - $filter = "/system.applicationHost/sites/site/application[@applicationPool='" + $pool + "']" - $apps = (Get-WebConfigurationProperty -Filter $filter -PSPath "machine/webroot/apphost" -name path).ItemXPath - if ($apps.count -eq 1) - { - # if we are the only site in the pool, remove the pool as well. - Remove-WebAppPool -Name $pool - } - - - # remove all rules with that name - $ruleName = ($($FireWallRuleDisplayName) -f $port) - Get-NetFirewallRule | Where-Object DisplayName -eq "$ruleName" | Remove-NetFirewallRule - -} - -<# -.Synopsis - Set the option into the web.config for an endpoint -.DESCRIPTION - Set the options into the web.config for an endpoint allowing customization. -.EXAMPLE -#> -function Set-AppSettingsInWebconfig -{ - param ( - - # Physical path for the IIS Endpoint on the machine (possibly under inetpub) - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [String] $path, - - # Key to add/update - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [String] $key, - - # Value - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [String] $value - - ) - - $webconfig = Join-Path $path "web.config" - [bool] $Found = $false - - if (Test-Path $webconfig) - { - $xml = [xml](get-content $webconfig) - $root = $xml.get_DocumentElement() - - foreach( $item in $root.appSettings.add) - { - if( $item.key -eq $key ) - { - $item.value = $value; - $Found = $true; - } - } - - if( -not $Found) - { - $newElement = $xml.CreateElement("add") - $nameAtt1 = $xml.CreateAttribute("key") - $nameAtt1.psbase.value = $key; - $null = $newElement.SetAttributeNode($nameAtt1) - - $nameAtt2 = $xml.CreateAttribute("value") - $nameAtt2.psbase.value = $value; - $null = $newElement.SetAttributeNode($nameAtt2) - - $null = $xml.configuration["appSettings"].AppendChild($newElement) - } - } - - $xml.Save($webconfig) -} - -<# -.Synopsis - Set the binding redirect setting in the web.config to redirect 10.0.0.0 version of microsoft.isam.esent.interop to 6.3.0.0. -.DESCRIPTION - This function creates the following section in the web.config: - - - - - - - - -#> -function Set-BindingRedirectSettingInWebConfig -{ - param ( - - # Physical path for the IIS Endpoint on the machine (possibly under inetpub) - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [String] $path, - - # old version of the assembly - [String] $oldVersion = "10.0.0.0", - - # new version to redirect to - [String] $newVersion = "6.3.0.0" - - ) - - $webconfig = Join-Path $path "web.config" - - if (Test-Path $webconfig) - { - $xml = [xml](get-content $webconfig) - - if(-not($xml.get_DocumentElement().runtime)) - { - # Create the section - $runtimeSetting = $xml.CreateElement("runtime") - - # Create the section - $assemblyBindingSetting = $xml.CreateElement("assemblyBinding") - $xmlnsAttribute = $xml.CreateAttribute("xmlns") - $xmlnsAttribute.Value = "urn:schemas-microsoft-com:asm.v1" - $assemblyBindingSetting.Attributes.Append($xmlnsAttribute) - - # The section goes inside - $null = $runtimeSetting.AppendChild($assemblyBindingSetting) - - # Create the section - $dependentAssemblySetting = $xml.CreateElement("dependentAssembly") - - #The section goes inside - $null = $assemblyBindingSetting.AppendChild($dependentAssemblySetting) - - # Create the section - $assemblyIdentitySetting = $xml.CreateElement("assemblyIdentity") - $nameAttribute = $xml.CreateAttribute("name") - $nameAttribute.Value = "microsoft.isam.esent.interop" - $publicKeyTokenAttribute = $xml.CreateAttribute("publicKeyToken") - $publicKeyTokenAttribute.Value = "31bf3856ad364e35" - $null = $assemblyIdentitySetting.Attributes.Append($nameAttribute) - $null = $assemblyIdentitySetting.Attributes.Append($publicKeyTokenAttribute) - - # section goes inside - $dependentAssemblySetting.AppendChild($assemblyIdentitySetting) - - # Create the section - $bindingRedirectSetting = $xml.CreateElement("bindingRedirect") - $oldVersionAttribute = $xml.CreateAttribute("oldVersion") - $newVersionAttribute = $xml.CreateAttribute("newVersion") - $oldVersionAttribute.Value = $oldVersion - $newVersionAttribute.Value = $newVersion - $null = $bindingRedirectSetting.Attributes.Append($oldVersionAttribute) - $null = $bindingRedirectSetting.Attributes.Append($newVersionAttribute) - - # The section goes inside section - $dependentAssemblySetting.AppendChild($bindingRedirectSetting) - - # The section goes inside section - $xml.configuration.AppendChild($runtimeSetting) - - $xml.Save($webconfig) - } - } -} - -Export-ModuleMember -function New-PSWSEndpoint, Set-AppSettingsInWebconfig, Set-BindingRedirectSettingInWebConfig, Remove-PSWSEndpoint diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xDSCWebService/SecureTLSProtocols.psm1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xDSCWebService/SecureTLSProtocols.psm1 deleted file mode 100644 index 5029ff8a..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xDSCWebService/SecureTLSProtocols.psm1 +++ /dev/null @@ -1,48 +0,0 @@ -# This module file contains a utility to test and set TLS protocol according best practices -# -# Copyright (c) Microsoft Corporation, 2016 -# - -# ============ Best Practice Security Settings Block ========= -$insecureProtocols = @("SSL 2.0", "SSL 3.0", "TLS 1.0", "PCT 1.0", "Multi-Protocol Unified Hello") -$secureProtocols = @("TLS 1.1", "TLS 1.2") - -# =========================================================== - -function Test-SChannelProtocol -{ - foreach ($protocol in $insecureProtocols) - { - $registryPath = "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\$protocol\Server" - if ((Test-Path $registryPath) -and ($null -ne (Get-ItemProperty -Path $registryPath)) -and ((Get-ItemProperty -Path $registryPath).Enabled -ne 0)) - { - return $false - } - } - foreach ($protocol in $secureProtocols) - { - $registryPath = "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\$protocol\Server" - if ((-not (Test-Path $registryPath)) -or ($null -eq (Get-ItemProperty -Path $registryPath)) -or ((Get-ItemProperty -Path $registryPath).Enabled -eq 0)) - { - return $false - } - } - return $true -} - -function Set-SChannelProtocol -{ - foreach ($protocol in $insecureProtocols) - { - $registryPath = "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\$protocol\Server" - New-Item -Path $registryPath -Force | Out-Null - New-ItemProperty -Path $registryPath -Name Enabled -Value 0 -PropertyType 'DWord' -Force | Out-Null - } - foreach ($protocol in $secureProtocols) - { - $registryPath = "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\$protocol\Server" - New-Item -Path $registryPath -Force | Out-Null - New-ItemProperty -Path $registryPath -Name Enabled -Value '0xffffffff' -PropertyType 'DWord' -Force | Out-Null - New-ItemProperty -Path $registryPath -Name DisabledByDefault -Value 0 -PropertyType 'DWord' -Force | Out-Null - } -} diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xDSCWebService/UseSecurityBestPractices.psm1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xDSCWebService/UseSecurityBestPractices.psm1 deleted file mode 100644 index a9dc7a7c..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xDSCWebService/UseSecurityBestPractices.psm1 +++ /dev/null @@ -1,38 +0,0 @@ -# This module file contains a utility to switch on/off the security best practices -# -# Copyright (c) Microsoft Corporation, 2016 -# - -Import-Module $PSScriptRoot\SecureTLSProtocols.psm1 -Verbose:$false - -# This list corresponds to the ValueMap definition of DisableSecurityBestPractices parameter defined in MSFT_xDSCWebService.Schema.mof -$SecureTLSProtocols = "SecureTLSProtocols"; - -<# - .SYNOPSIS - This function tests whether the node uses security best practices for non-disabled items -#> -function Test-UseSecurityBestPractices -{ - param([string[]] $DisableSecurityBestPractices) - - $usedProtocolsBestPractices = ($DisableSecurityBestPractices -icontains $SecureTLSProtocols) -or (Test-SChannelProtocol) - - return $usedProtocolsBestPractices -} - -<# - .SYNOPSIS - This function sets the node to use security best practices for non-disabled items -#> -function Set-UseSecurityBestPractices -{ - param([string[]] $DisableSecurityBestPractices) - - if (-not ($DisableSecurityBestPractices -icontains $SecureTLSProtocols)) - { - Set-SChannelProtocol - } -} - -Export-ModuleMember -function *-UseSecurityBestPractices diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xEnvironmentResource/MSFT_xEnvironmentResource.psm1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xEnvironmentResource/MSFT_xEnvironmentResource.psm1 deleted file mode 100644 index 52f9bfa8..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xEnvironmentResource/MSFT_xEnvironmentResource.psm1 +++ /dev/null @@ -1,1145 +0,0 @@ -$errorActionPreference = 'Stop' -Set-StrictMode -Version 'Latest' - -# Import CommonResourceHelper for Get-LocalizedData -$script:dscResourcesFolderFilePath = Split-Path $PSScriptRoot -Parent -$script:commonResourceHelperFilePath = Join-Path -Path $script:dscResourcesFolderFilePath -ChildPath 'CommonResourceHelper.psm1' -Import-Module -Name $script:commonResourceHelperFilePath - -$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_xEnvironmentResource' - -$script:envVarRegPathMachine = 'HKLM:\System\CurrentControlSet\Control\Session Manager\Environment' -$script:envVarRegPathUser = 'HKCU:\Environment' - -$script:maxSystemEnvVariableLength = 1024 -$script:maxUserEnvVariableLength = 255 - -<# - .SYNOPSIS - Retrieves the state of the environment variable. If both Machine and Process Target are - specified, only the machine value will be returned. - - .PARAMETER Name - The name of the environment variable to retrieve. - - .PARAMETER Target - Indicates where to retrieve the variable: The machine or the process. If both are indicated - then only the value from the machine is returned. - The default is both since that is the default for the rest of the resource. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Name, - - [ValidateSet('Process', 'Machine')] - [ValidateNotNullOrEmpty()] - [String[]] - $Target = ('Process', 'Machine') - ) - - $valueToReturn = $null - - if ($Target -contains 'Machine') - { - $environmentVaraible = Get-EnvironmentVariableWithoutExpanding -Name $Name -ErrorAction 'SilentlyContinue' - - if ($null -ne $environmentVaraible) - { - $valueToReturn = $environmentVaraible.$Name - } - } - else - { - $valueToReturn = Get-ProcessEnvironmentVariable -Name $Name - } - - $environmentResource = @{ - Name = $Name - Value = $null - Ensure = 'Absent' - } - - if ($null -eq $valueToReturn) - { - Write-Verbose -Message ($script:localizedData.EnvVarNotFound -f $Name) - } - else - { - Write-Verbose -Message ($script:localizedData.EnvVarFound -f $Name, $valueToReturn) - $environmentResource.Ensure = 'Present' - $environmentResource.Value = $valueToReturn - } - - return $environmentResource -} - -<# - .SYNOPSIS - Creates, modifies, or removes an environment variable. - - .PARAMETER Name - The name of the environment variable to create, modify, or remove. - - .PARAMETER Value - The value to set the environment variable to. - If a value is not provided, the variable cannot be created. - If Ensure is set to Present, the variable does not already exist, and a value is not - specified, an error will be thrown indicating that the variable cannot be created without - a specified value. If Ensure is set to Present, the variable already exists, and no value - is specified, nothing will be changed. - - .PARAMETER Ensure - Specifies whether the variable should exist or not. - To ensure that the variable or value does exist, set this property to Present. - To ensure that the variable or value does not exist, set this property to Absent. - The default value is Present. - - .PARAMETER Path - Indicates whether or not this is a path variable. If this property is set to True, - the value provided through the Value property will be appended to (or removed from if - Ensure is set to Absent) the existing value. - If this property is set to False, the existing value will be replaced by the new Value. - The default value is False. - - .PARAMETER Target - Indicates where to set the environment variable: The machine, the process, or both. - The default is both: ('Process', 'Machine') -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Name, - - [ValidateNotNull()] - [String] - $Value = [String]::Empty, - - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present', - - [Boolean] - $Path = $false, - - [ValidateSet('Process', 'Machine')] - [ValidateNotNullOrEmpty()] - [String[]] - $Target = ('Process', 'Machine') - ) - - $valueSpecified = ($Value -ne [String]::Empty) - $currentValueFromMachine = $null - $currentValueFromProcess = $null - $currentPropertiesFromMachine = $null - - $setMachineVariable = ($Target -contains 'Machine') - $setProcessVariable = ($Target -contains 'Process') - - if ($setMachineVariable) - { - if ($Path) - { - $currentPropertiesFromMachine = Get-EnvironmentVariableWithoutExpanding -Name $Name -ErrorAction 'SilentlyContinue' - - if ($null -ne $currentPropertiesFromMachine) - { - $currentValueFromMachine = $currentPropertiesFromMachine.$Name - } - } - else - { - $currentPropertiesFromMachine = Get-ItemProperty -Path $script:envVarRegPathMachine -Name $Name -ErrorAction 'SilentlyContinue' - $currentValueFromMachine = Get-EnvironmentVariable -Name $Name -Target 'Machine' - } - } - - if ($setProcessVariable) - { - $currentValueFromProcess = Get-EnvironmentVariable -Name $Name -Target 'Process' - } - - # A different value of the environment variable needs to be displayed depending on the Target - $currentValueToDisplay = '' - if ($setMachineVariable -and $setProcessVariable) - { - $currentValueToDisplay = "Machine: $currentValueFromMachine, Process: $currentValueFromProcess" - } - elseif ($setMachineVariable) - { - $currentValueToDisplay = $currentValueFromMachine - } - else - { - $currentValueToDisplay = $currentValueFromProcess - } - - if ($Ensure -eq 'Present') - { - $createMachineVariable = ((-not $setMachineVariable) -or ($null -eq $currentPropertiesFromMachine) -or ($currentValueFromMachine -eq [String]::Empty)) - $createProcessVariable = ((-not $setProcessVariable) -or ($null -eq $currentValueFromProcess) -or ($currentValueFromProcess -eq [String]::Empty)) - - if ($createMachineVariable -and $createProcessVariable) - { - - if (-not $valueSpecified) - { - <# - If the environment variable doesn't exist and no value is passed in - then there is nothing to set - so throw an error. - #> - - New-InvalidOperationException -Message ($script:localizedData.CannotSetValueToEmpty -f $Name) - } - - <# - Given the specified $Name environment variable hasn't been created or set - simply create one with the specified value and return. - Both path and non-path cases are covered by this. - #> - - Set-EnvironmentVariable -Name $Name -Value $Value -Target $Target - - Write-Verbose -Message ($script:localizedData.EnvVarCreated -f $Name, $Value) - return - } - - if (-not $valueSpecified) - { - <# - Given no $Value was specified to be set and the variable exists, - we'll leave the existing variable as is. - This covers both path and non-path variables. - #> - - Write-Verbose -Message ($script:localizedData.EnvVarUnchanged -f $Name, $currentValueToDisplay) - return - } - - # Check if an empty, whitespace or semi-colon only string has been specified. If yes, return unchanged. - $trimmedValue = $Value.Trim(';').Trim() - - if ([String]::IsNullOrEmpty($trimmedValue)) - { - Write-Verbose -Message ($script:localizedData.EnvVarPathUnchanged -f $Name, $currentValueToDisplay) - return - } - - if (-not $Path) - { - # For non-path variables, simply set the specified $Value as the new value of the specified - # variable $Name for the given $Target - - if (($setMachineVariable -and ($Value -cne $currentValueFromMachine)) -or ` - ($setProcessVariable -and ($Value -cne $currentValueFromProcess))) - { - Set-EnvironmentVariable -Name $Name -Value $Value -Target $Target - Write-Verbose -Message ($script:localizedData.EnvVarUpdated -f $Name, $currentValueToDisplay, $Value) - } - else - { - Write-Verbose -Message ($script:localizedData.EnvVarUnchanged -f $Name, $currentValueToDisplay) - } - - return - } - - # If the control reaches here, the specified variable exists, it is a path variable, and a value has been specified to be set. - - if ($setMachineVariable) - { - $valueUnchanged = Test-PathsInValue -ExistingPaths $currentValueFromMachine -QueryPaths $trimmedValue -FindCriteria 'All' - - if ($currentValueFromMachine -and -not $valueUnchanged) - { - $updatedValue = Add-PathsToValue -CurrentValue $currentValueFromMachine -NewValue $trimmedValue - Set-EnvironmentVariable -Name $Name -Value $updatedValue -Target @('Machine') - Write-Verbose -Message ($script:localizedData.EnvVarPathUpdated -f $Name, $currentValueFromMachine, $updatedValue) - } - else - { - Write-Verbose -Message ($script:localizedData.EnvVarPathUnchanged -f $Name, $currentValueFromMachine) - } - } - - if ($setProcessVariable) - { - $valueUnchanged = Test-PathsInValue -ExistingPaths $currentValueFromProcess -QueryPaths $trimmedValue -FindCriteria 'All' - - if ($currentValueFromProcess -and -not $valueUnchanged) - { - $updatedValue = Add-PathsToValue -CurrentValue $currentValueFromProcess -NewValue $trimmedValue - Set-EnvironmentVariable -Name $Name -Value $updatedValue -Target @('Process') - Write-Verbose -Message ($script:localizedData.EnvVarPathUpdated -f $Name, $currentValueFromProcess, $updatedValue) - } - else - { - Write-Verbose -Message ($script:localizedData.EnvVarPathUnchanged -f $Name, $currentValueFromProcess) - } - } - } - - # Ensure = 'Absent' - else - { - $machineVariableRemoved = ((-not $setMachineVariable) -or ($null -eq $currentPropertiesFromMachine)) - $processVariableRemoved = ((-not $setProcessVariable) -or ($null -eq $currentValueFromProcess)) - - if ($machineVariableRemoved -and $processVariableRemoved) - { - # Variable not found, condition is satisfied and there is nothing to set/remove, return - Write-Verbose -Message ($script:localizedData.EnvVarNotFound -f $Name) - return - } - - if ((-not $ValueSpecified) -or (-not $Path)) - { - <# - If $Value is not specified or if $Value is a non-path variable, - simply remove the environment variable. - #> - - Remove-EnvironmentVariable -Name $Name -Target $Target - - Write-Verbose -Message ($script:localizedData.EnvVarRemoved -f $Name) - return - } - - # Check if an empty string or semi-colon only string has been specified as $Value. If yes, return unchanged as we don't need to remove anything. - $trimmedValue = $Value.Trim(';').Trim() - - if ([String]::IsNullOrEmpty($trimmedValue)) - { - Write-Verbose -Message ($script:localizedData.EnvVarPathUnchanged -f $Name, $currentValueToDisplay) - return - } - - # If the control reaches here: target variable is an existing environment path-variable and a specified $Value needs be removed from it - - if ($setMachineVariable) - { - $finalPath = $null - - if ($currentValueFromMachine) - { - <# - If this value returns $null or an empty string, than the entire path should be removed. - If it returns the same value as the path that was passed in, than nothing needs to be - updated, otherwise, only the specified paths were removed but there are still others - that need to be left in, so the path variable is updated to remove only the specified paths. - #> - $finalPath = Remove-PathsFromValue -CurrentValue $currentValueFromMachine -PathsToRemove $trimmedValue - } - - if ([String]::IsNullOrEmpty($finalPath)) - { - Remove-EnvironmentVariable -Name $Name -Target @('Machine') - Write-Verbose -Message ($script:localizedData.EnvVarRemoved -f $Name) - } - elseif ($finalPath -ceq $currentValueFromMachine) - { - Write-Verbose -Message ($script:localizedData.EnvVarPathUnchanged -f $Name, $currentValueFromMachine) - } - else - { - Set-EnvironmentVariable -Name $Name -Value $finalPath -Target @('Machine') - Write-Verbose -Message ($script:localizedData.EnvVarPathUpdated -f $Name, $currentValueFromMachine, $finalPath) - } - } - - if ($setProcessVariable) - { - $finalPath = $null - - if ($currentValueFromProcess) - { - <# - If this value returns $null or an empty string, than the entire path should be removed. - If it returns the same value as the path that was passed in, than nothing needs to be - updated, otherwise, only the specified paths were removed but there are still others - that need to be left in, so the path variable is updated to remove only the specified paths. - #> - $finalPath = Remove-PathsFromValue -CurrentValue $currentValueFromProcess -PathsToRemove $trimmedValue - } - - if ([String]::IsNullOrEmpty($finalPath)) - { - Remove-EnvironmentVariable -Name $Name -Target @('Process') - Write-Verbose -Message ($script:localizedData.EnvVarRemoved -f $Name) - } - elseif ($finalPath -ceq $currentValueFromProcess) - { - Write-Verbose -Message ($script:localizedData.EnvVarPathUnchanged -f $Name, $currentValueFromProcess) - } - else - { - Set-EnvironmentVariable -Name $Name -Value $finalPath -Target @('Process') - Write-Verbose -Message ($script:localizedData.EnvVarPathUpdated -f $Name, $currentValueFromProcess, $finalPath) - } - } - } -} - -<# - .SYNOPSIS - Tests if the environment variable is in the desired state. - - .PARAMETER Name - The name of the environment variable to test. - - .PARAMETER Value - The value of the environment variable to test. If no value is specified then only the - existence of the variable will be checked. - - .PARAMETER Ensure - Specifies whether the variable should exist or not. - To test that the variable does exist, set this property to Present. - To test that the variable does not exist, set this property to Absent. - The default value is Present. - - .PARAMETER Path - Indicates whether or not this is a path variable. If this property is set to True, - the value(s) provided through the Value property will be checked against all existing - values already set in this variable. - If this property is set to False, the value will be compared directly to the existing value. - The default value is False. - - .PARAMETER Target - Indicates where to test the environment variable: The machine, the process, or both. - The default is both: ('Process', 'Machine') -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Name, - - [ValidateNotNull()] - [String] - $Value, - - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present', - - [Boolean] - $Path = $false, - - [ValidateSet('Process', 'Machine')] - [ValidateNotNullOrEmpty()] - [String[]] - $Target = ('Process', 'Machine') - ) - - $valueSpecified = $PSBoundParameters.ContainsKey('Value') -and ($Value -ne [String]::Empty) - $currentValueFromMachine = $null - $currentValueFromProcess = $null - $currentPropertiesFromMachine = $null - - $checkMachineTarget = ($Target -contains 'Machine') - $checkProcessTarget = ($Target -contains 'Process') - - if ($checkMachineTarget) - { - if ($Path) - { - $currentPropertiesFromMachine = Get-EnvironmentVariableWithoutExpanding -Name $Name -ErrorAction 'SilentlyContinue' - - if ($null -ne $currentPropertiesFromMachine) - { - $currentValueFromMachine = $currentPropertiesFromMachine.$Name - } - } - else - { - $currentPropertiesFromMachine = Get-ItemProperty -Path $script:envVarRegPathMachine -Name $Name -ErrorAction 'SilentlyContinue' - $currentValueFromMachine = Get-EnvironmentVariable -Name $Name -Target 'Machine' - } - } - - if ($checkProcessTarget) - { - $currentValueFromProcess = Get-EnvironmentVariable -Name $Name -Target 'Process' - } - - # A different value of the environment variable needs to be displayed depending on the Target - $currentValueToDisplay = '' - if ($checkMachineTarget -and $checkProcessTarget) - { - $currentValueToDisplay = "Machine: $currentValueFromMachine, Process: $currentValueFromProcess" - } - elseif ($checkMachineTarget) - { - $currentValueToDisplay = $currentValueFromMachine - } - else - { - $currentValueToDisplay = $currentValueFromProcess - } - - if (($checkMachineTarget -and ($null -eq $currentPropertiesFromMachine)) -or ($checkProcessTarget -and ($null -eq $currentValueFromProcess))) - { - # Variable not found - Write-Verbose ($script:localizedData.EnvVarNotFound -f $Name) - return ($Ensure -eq 'Absent') - } - - if (-not $valueSpecified) - { - Write-Verbose ($script:localizedData.EnvVarFound -f $Name, $currentValueToDisplay) - return ($Ensure -eq 'Present') - } - - if (-not $Path) - { - # For this non-path variable, make sure that the specified $Value matches the current value. - - if (($checkMachineTarget -and ($Value -cne $currentValueFromMachine)) -or ` - ($checkProcessTarget -and ($Value -cne $currentValueFromProcess))) - { - Write-Verbose ($script:localizedData.EnvVarFoundWithMisMatchingValue -f $Name, $currentValueToDisplay, $Value) - return ($Ensure -eq 'Absent') - } - else - { - Write-Verbose ($script:localizedData.EnvVarFound -f $Name, $currentValueToDisplay) - return ($Ensure -eq 'Present') - } - } - - # If the control reaches here, the expected environment variable exists, it is a path variable and a $Value is specified to test against - if ($Ensure -eq 'Present') - { - if ($checkMachineTarget) - { - if (-not (Test-PathsInValue -ExistingPaths $currentValueFromMachine -QueryPaths $Value -FindCriteria 'All')) - { - # If the control reached here some part of the specified path ($Value) was not found in the existing variable, return failure - Write-Verbose ($script:localizedData.EnvVarFoundWithMisMatchingValue -f $Name, $currentValueToDisplay, $Value) - return $false - } - } - - if ($checkProcessTarget) - { - if (-not (Test-PathsInValue -ExistingPaths $currentValueFromProcess -QueryPaths $Value -FindCriteria 'All')) - { - # If the control reached here some part of the specified path ($Value) was not found in the existing variable, return failure - Write-Verbose ($script:localizedData.EnvVarFoundWithMisMatchingValue -f $Name, $currentValueToDisplay, $Value) - return $false - } - } - - # The specified path was completely present in the existing environment variable, return success - Write-Verbose ($script:localizedData.EnvVarFound -f $Name, $currentValueToDisplay) - return $true - } - # Ensure = 'Absent' - else - { - if ($checkMachineTarget) - { - if (Test-PathsInValue -ExistingPaths $currentValueFromMachine -QueryPaths $Value -FindCriteria 'Any') - { - # One of the specified paths in $Value exists in the environment variable path, thus the test fails - Write-Verbose ($script:localizedData.EnvVarFound -f $Name, $currentValueFromMachine) - return $false - } - } - - if ($checkProcessTarget) - { - if (Test-PathsInValue -ExistingPaths $currentValueFromProcess -QueryPaths $Value -FindCriteria 'Any') - { - # One of the specified paths in $Value exists in the environment variable path, thus the test fails - Write-Verbose ($script:localizedData.EnvVarFound -f $Name, $currentValueFromProcess) - return $false - } - } - - # If the control reached here, none of the specified paths were found in the existing path-variable, return success - Write-Verbose ($script:localizedData.EnvVarFoundWithMisMatchingValue -f $Name, $currentValueToDisplay, $Value) - return $true - } -} - -<# - .SYNOPSIS - Retrieves the value of the environment variable from the given Target. - - .PARAMETER Name - The name of the environment variable to retrieve the value from. - - .PARAMETER Target - Indicates where to retrieve the environment variable from. Currently, only - Process and Machine are being used, but User is included for future extension - of this resource. -#> -function Get-EnvironmentVariable -{ - [CmdletBinding()] - [OutputType([String])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Name, - - [Parameter(Mandatory = $true)] - [ValidateSet('Process', 'Machine')] - [String] - $Target - ) - - $valueToReturn = $null - - if ($Target -eq 'Process') - { - $valueToReturn = Get-ProcessEnvironmentVariable -Name $Name - } - elseif ($Target -eq 'Machine') - { - $retrievedProperty = Get-ItemProperty -Path $script:envVarRegPathMachine -Name $Name -ErrorAction 'SilentlyContinue' - - if ($null -ne $retrievedProperty) - { - $valueToReturn = $retrievedProperty.$Name - } - } - elseif ($Target -eq 'User') - { - $retrievedProperty = Get-ItemProperty -Path $script:envVarRegPathUser -Name $Name -ErrorAction 'SilentlyContinue' - - if ($null -ne $retrievedProperty) - { - $valueToReturn = $retrievedProperty.$Name - } - } - - return $valueToReturn -} - -<# - .SYNOPSIS - Wrapper function to retrieve an environment variable from the current process. - - .PARAMETER Name - The name of the variable to retrieve - -#> -function Get-ProcessEnvironmentVariable -{ - [CmdletBinding()] - [OutputType([String])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Name - ) - - return [System.Environment]::GetEnvironmentVariable($Name) -} - -<# - .SYNOPSIS - If there are any paths in NewPaths that aren't in CurrentValue they will be added - to the current paths value and a String will be returned containing all old paths - and new paths. Otherwise the original value will be returned unchanged. - - .PARAMETER CurrentValue - A semicolon-separated String containing the current path values. - - .PARAMETER NewPaths - A semicolon-separated String containing any paths that should be added to - the current value. If CurrentValue already contains a path, it will not be added. -#> -function Add-PathsToValue -{ - [CmdletBinding()] - [OutputType([String])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $CurrentValue, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $NewValue - ) - - $finalValue = $CurrentValue + ';' - $currentPaths = $CurrentValue -split ';' - $newPaths = $NewValue -split ';' - - foreach ($path in $newPaths) - { - if ($currentPaths -notcontains $path) - { - <# - If the control reached here, we didn't find this $specifiedPath in the $currentPaths, - so add it. - #> - - $finalValue += ($path + ';') - } - } - - # Remove any extraneous ';' at the end (and potentially start - as a side-effect) of the value to be set - return $finalValue.Trim(';') -} - -<# - .SYNOPSIS - If there are any paths in PathsToRemove that aren't in CurrentValue they will be removed - from the current paths value and either the new value will be returned if there are still - paths that remain, or an empty string will be returned if all paths were removed. - If none of the paths in PathsToRemove are in CurrentValue then this function will - return CurrentValue since nothing needs to be changed. - - .PARAMETER CurrentValue - A semicolon-separated String containing the current path values. - - .PARAMETER PathsToRemove - A semicolon-separated String containing any paths that should be removed from - the current value. -#> -function Remove-PathsFromValue -{ - [OutputType([String])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $CurrentValue, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $PathsToRemove - ) - - $finalPath = '' - $specifiedPaths = $PathsToRemove -split ';' - $currentPaths = $CurrentValue -split ';' - $varAltered = $false - - foreach ($subpath in $currentPaths) - { - if ($specifiedPaths -contains $subpath) - { - <# - Found this $subpath as one of the $specifiedPaths, skip adding this to the final - value/path of this variable and mark the variable as altered. - #> - $varAltered = $true - } - else - { - # the current $subpath was not part of the $specifiedPaths (to be removed) so keep this $subpath in the finalPath - $finalPath += $subpath + ';' - } - } - - # Remove any extraneous ';' at the end (and potentially start - as a side-effect) of the $finalPath - $finalPath = $finalPath.Trim(';') - - if ($varAltered) - { - return $finalPath - } - else - { - return $CurrentValue - } -} - -<# - .SYNOPSIS - Sets the value of the environment variable with the given name if a value is specified. - If no value is specified, then the environment variable will be removed. - - .PARAMETER Name - The name of the environment variable to set or remove. - - .PARAMETER Value - The value to set the environment variable to. If not provided, then the variable will - be removed. - - .PARAMETER Target - Indicates where to set or remove the environment variable: The machine, the process, or both. - The logic for User is also included here for future expansion of this resource. -#> -function Set-EnvironmentVariable -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Name, - - [String] - $Value, - - [Parameter(Mandatory = $true)] - [ValidateSet('Process', 'Machine')] - [String[]] - $Target - ) - - $valueSpecified = $PSBoundParameters.ContainsKey('Value') - - try - { - # If the Value is set to [String]::Empty then nothing should be updated for the process - if (($Target -contains 'Process') -and (-not $valueSpecified -or ($Value -ne [String]::Empty))) - { - if (-not $valueSpecified) - { - Set-ProcessEnvironmentVariable -Name $Name -Value $null - } - else - { - Set-ProcessEnvironmentVariable -Name $Name -Value $Value - } - } - - if ($Target -contains 'Machine') - { - if ($Name.Length -ge $script:maxSystemEnvVariableLength) - { - New-InvalidArgumentException -Message $script:localizedData.ArgumentTooLong -ArgumentName $Name - } - - $path = $script:envVarRegPathMachine - - if (-not $valueSpecified) - { - $environmentKey = Get-ItemProperty -Path $path -Name $Name -ErrorAction 'SilentlyContinue' - - if ($environmentKey) - { - Remove-ItemProperty -Path $path -Name $Name - } - else - { - $message = ($script:localizedData.RemoveNonExistentVarError -f $Name) - New-InvalidArgumentException -Message $message -ArgumentName $Name - } - } - else - { - Set-ItemProperty -Path $path -Name $Name -Value $Value - $environmentKey = Get-ItemProperty -Path $path -Name $Name -ErrorAction 'SilentlyContinue' - - if ($null -eq $environmentKey) - { - $message = ($script:localizedData.GetItemPropertyFailure -f $Name, $path) - New-InvalidArgumentException -Message $message -ArgumentName $Name - } - } - } - - # The User feature of this resource is not yet implemented. - if ($Target -contains 'User') - { - if ($Name.Length -ge $script:maxUserEnvVariableLength) - { - New-InvalidArgumentException -Message $script:localizedData.ArgumentTooLong -ArgumentName $Name - } - - $path = $script:envVarRegPathUser - - if (-not $valueSpecified) - { - $environmentKey = Get-ItemProperty -Path $path -Name $Name -ErrorAction 'SilentlyContinue' - - if ($environmentKey) - { - Remove-ItemProperty -Path $path -Name $Name - } - else - { - $message = ($script:localizedData.RemoveNonExistentVarError -f $Name) - New-InvalidArgumentException -Message $message -ArgumentName $Name - } - } - else - { - Set-ItemProperty -Path $path -Name $Name -Value $Value - $environmentKey = Get-ItemProperty -Path $path -Name $Name -ErrorAction 'SilentlyContinue' - - if ($null -eq $environmentKey) - { - $message = ($script:localizedData.GetItemPropertyFailure -f $Name, $path) - New-InvalidArgumentException -Message $message -ArgumentName $Name - } - } - } - } - catch - { - New-InvalidOperationException -Message ($script:localizedData.EnvVarSetError -f $Name, $Value) ` - -ErrorRecord $_ - } - -} - -<# - .SYNOPSIS - Wrapper function to set an environment variable for the current process. - - .PARAMETER Name - The name of the environment variable to set. - - .PARAMETER Value - The value to set the environment variable to. - -#> -function Set-ProcessEnvironmentVariable -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Name, - - [String] - $Value = [String]::Empty - ) - - [System.Environment]::SetEnvironmentVariable($Name, $Value) -} - -<# - .SYNOPSIS - Removes an environment variable from the given target(s) by calling Set-EnvironmentVariable - with no Value specified. - - .PARAMETER Name - The name of the environment variable to remove. - - .PARAMETER Target - Indicates where to remove the environment variable from: The machine, the process, or both. -#> -function Remove-EnvironmentVariable -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Name, - - [Parameter(Mandatory = $true)] - [ValidateSet('Process', 'Machine')] - [String[]] - $Target - ) - - try - { - Set-EnvironmentVariable -Name $Name -Target $Target - } - catch - { - New-InvalidOperationException -Message ($script:localizedData.EnvVarRemoveError -f $Name) ` - -ErrorRecord $_ - } -} - -<# - .SYNOPSIS - Tests all of the paths in QueryPaths against those in ExistingPaths. - If FindCriteria is set to 'All' then it will only return True if all of the - paths in QueryPaths are in ExistingPaths, otherwise it will return False. - If FindCriteria is set to 'Any' then it will return True if any of the paths - in QueryPaths are in ExistingPaths, otherwise it will return False. - - .PARAMETER ExistingPaths - A semicolon-separated String containing the path values to test against. - - .PARAMETER QueryPaths - A semicolon-separated String containing the path values to ensure are either - included or not included in ExistingPaths. - - .PARAMETER FindCriteria - Set to either 'All' or 'Any' to indicate whether all of the paths in QueryPaths - should be included in ExistingPaths or any of them. -#> -function Test-PathsInValue -{ - [OutputType([Boolean])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [String] - $ExistingPaths, - - [Parameter(Mandatory = $true)] - [String] - $QueryPaths, - - [Parameter(Mandatory = $true)] - [ValidateSet('Any', 'All')] - [String] - $FindCriteria - ) - - $existingPathList = $ExistingPaths -split ';' - $queryPathList = $QueryPaths -split ';' - - switch ($FindCriteria) - { - 'Any' - { - foreach ($queryPath in $queryPathList) - { - if ($existingPathList -contains $queryPath) - { - # Found this $queryPath in the existing paths, return $true - return $true - } - } - - # If the control reached here, none of the QueryPaths were found in ExistingPaths - return $false - } - - 'All' - { - foreach ($queryPath in $queryPathList) - { - if ($queryPath) - { - if ($existingPathList -notcontains $queryPath) - { - # The current $queryPath wasn't found in any of the $existingPathList, return false - return $false - } - } - } - - # If the control reached here, all of the QueryPaths were found in ExistingPaths - return $true - } - } -} - -<# - .SYNOPSIS - Retrieves the Environment variable with the given name from the registry on the machine. - It returns the result as an object containing a Hashtable with the environment variable - name and its current value on the machine. This is to most closely represent what the - actual API call returns. If an environment variable with the given name is not found, then - $null will be returned. - - .PARAMETER Name - The name of the environment variable to retrieve the value of. -#> -function Get-EnvironmentVariableWithoutExpanding -{ - [OutputType([System.Management.Automation.PSObject])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [String] - $Name - ) - - $path = $script:envVarRegPathMachine - $pathTokens = $path.Split('\',[System.StringSplitOptions]::RemoveEmptyEntries) - $entry = $pathTokens[1..($pathTokens.Count - 1)] -join '\' - - # Since the target registry path coming to this function is hardcoded for local machine - $hive = [Microsoft.Win32.Registry]::LocalMachine - - $noteProperties = @{} - - try - { - $key = $hive.OpenSubKey($entry) - - $valueNames = $key.GetValueNames() - if ($valueNames -inotcontains $Name) - { - return $null - } - - [String] $value = Get-KeyValue -Name $Name -Key $key - $noteProperties.Add($Name, $value) - } - finally - { - if ($key) - { - $key.Close() - } - } - - [System.Management.Automation.PSObject] $propertyResults = New-Object -TypeName System.Management.Automation.PSObject -Property $noteProperties - - return $propertyResults -} - -<# - .SYNOPSIS - Wrapper function to get the value of the environment variable with the given name - from the specified registry key. - - .PARAMETER Name - The name of the environment variable to retrieve the value of. - - .PARAMETER Key - The key to retrieve the environment variable from. -#> -function Get-KeyValue -{ - [OutputType([String])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [String] - $Name, - - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [Microsoft.Win32.RegistryKey] - $Key - ) - - return $Key.GetValue($Name, $null, [Microsoft.Win32.RegistryValueOptions]::DoNotExpandEnvironmentNames) -} diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xEnvironmentResource/MSFT_xEnvironmentResource.schema.mof b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xEnvironmentResource/MSFT_xEnvironmentResource.schema.mof deleted file mode 100644 index bcb2fb70..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xEnvironmentResource/MSFT_xEnvironmentResource.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("1.0.0"), FriendlyName("xEnvironment")] -class MSFT_xEnvironmentResource : OMI_BaseResource -{ - [Key, Description("The name of the environment variable for which you want to ensure a specific state.")] String Name; - [Write, Description("The desired value for the environment variable.")] String Value; - [Write, Description("Specifies if the environment varaible should exist."), ValueMap{"Present", "Absent"}, Values{"Present", "Absent"}] String Ensure; - [Write, Description("Indicates whether or not the environment variable is the Path variable.")] Boolean Path; - [Write, Description("Indicates the target where the environment variable should be set."), ValueMap{"Process", "Machine"}, Values{"Process", "Machine"}] String Target[]; -}; diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xEnvironmentResource/en-US/MSFT_xEnvironmentResource.schema.mfl b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xEnvironmentResource/en-US/MSFT_xEnvironmentResource.schema.mfl deleted file mode 100644 index d3524d3cde9ee1448a670422970838095d667845..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1522 zcmbVMT}#4X7(LfP|KX*pf{HG>sjjjNB+W?aMntBr6m*K4Rz!cjI_G(3PAQ!cZSHxW zuk*2eeKv575HUKKppP*UUPp+qk3H1U=v-D&x#>q3F~yCSb%4%)|2x3jDGut0tkC8G+88h^#xXZP zVCQrGU)tozcIo1f&lO_1BW8cEGv-i66<0hf^GvuasG)^ZoZ!rQHJP)E9d0(@oS1*k za&E{_>rZwbY?~}M+NjFP5~~W0xxgeM83f2$&PYs`^~5q;pO zkH>M5;bAj+?>Bigq~4Bx4XD@D_?Y9`mXU3?e*Br2Z|~X?TXL>5=JM(mFxz`xJoikc zfgum+NxfysR;(8@dgen=VnvseI;qA&Am@aftgD>l{S@);o#VeK`5h@73r6m3l3cm^ z-mh1x!1*KlKFGrk^FIH_Id_u$J+ZHs@Okud;9}?eSeI37TbJ0_T#s(~?Wt!rYM=>^ I@gu!|1Aqz%BLDyZ diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xEnvironmentResource/en-US/MSFT_xEnvironmentResource.strings.psd1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xEnvironmentResource/en-US/MSFT_xEnvironmentResource.strings.psd1 deleted file mode 100644 index d1d097fc..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xEnvironmentResource/en-US/MSFT_xEnvironmentResource.strings.psd1 +++ /dev/null @@ -1,21 +0,0 @@ -# Localized resources for MSFT_xEnvironmentResource - -ConvertFrom-StringData @' - ArgumentTooLong = Argument is too long. - CannotSetValueToEmpty = Cannot create environment variable with an empty value. Set Ensure = Absent to remove environment variable '{0}'. - EnvVarCreated = Environment variable '{0}' created with value '{1}'. - EnvVarSetError = Failed to set environment variable '{0}' to value '{1}'. - EnvVarPathSetError = Failed to add path '{0}' to environment variable '{1}' holding value '{2}'. - EnvVarRemoveError = Failed to remove environment variable '{0}' holding value '{1}'. - EnvVarPathRemoveError = Failed to remove path '{0}' from variable '{1}' holding value '{2}'. - EnvVarUnchanged = Environment variable '{0}' with value '{1}' was not updated. - EnvVarUpdated = Environment variable '{0}' updated from value '{1}' to value '{2}'. - EnvVarPathUnchanged = Path environment variable '{0}' with value '{1}' was not updated. - EnvVarPathUpdated = Environment variable '{0}' updated from value '{1}' to value '{2}'. - EnvVarNotFound = Environment variable '{0}' does not exist. - EnvVarFound = Environment variable '{0}' with value '{1}' was successfully found. - EnvVarFoundWithMisMatchingValue = Environment variable '{0}' with value '{1}' mismatched the specified value '{2}'. - EnvVarRemoved = Environment variable '{0}' removed. - GetItemPropertyFailure = Failed to get the item property for variable '{0}' with path '{1}'. - RemoveNonExistentVarError = Environment variable '{0}' cannot be removed because it does not exist. -'@ diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xGroupResource/MSFT_xGroupResource.psm1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xGroupResource/MSFT_xGroupResource.psm1 deleted file mode 100644 index 9f7f3835..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xGroupResource/MSFT_xGroupResource.psm1 +++ /dev/null @@ -1,2572 +0,0 @@ -<# - Implementatation Notes - - Managing Disposable Objects - The types PrincipalContext, Principal, and DirectoryEntry are used througout the code and - all are disposable. However, in many cases, disposing the object immediately causes - subsequent operations to fail or duplicate disposes calls to occur. - - To simplify management of these disposables, each public entry point defines a $disposables - ArrayList variable and passes it to secondary functions that may need to create disposable - objects. The public entry point is then required to dispose the contents of the list in a - finally block. - - Managing PrincipalContext Instances - To use the AccountManagement APIs to connect to the local machine or a domain, a - PrincipalContext is needed. - - For the local groups and users, a PrincipalContext reflecting the current user can be - created. - - For the default domain, the domain where the machine is joined, explicit credentials are - needed since the default user context is SYSTEM which has no rights to the domain. - - Additional PrincipalContext instances may be needed when the machine is in a domain that is - part of a multi-domain forest. For example, Microsoft uses a multi-domain forest that - includes domains such as ntdev, redmond, wingroup and a group may have members that - span multiple domains. Unless the enterprise implements the Global Catalog, - something that Microsoft does not do, a unique PrincipalContext is needed to resolve - accounts in each of the domains. - - To manage the use of PrincipalContext across domains, public entry points define a - $principalContextCache hashtable and pass it to support functions that need to resolve a group - or group member. Consumers of a PrincipalContext call Get-PrincipalContext with a scope - (domain name or machine name). Get-PrincipalContext returns an existing hashtable entry or - creates a new entry. Note that a PrincipalContext to a target domain requires connecting - to the domain. The hashtable avoids subsequent connection calls. Also note that - Get-PrincipalContext takes a Credential parameter for the case where a new PrincipalContext - is needed. The implicit assumption is that the credential provided for the primary domain - also has rights to resolve accounts in any of the other domains. - - Resolving Group Members - The original implementation assumed that group members could be resolved using the machine - PrincipalContext or the logged on user. In practice this is not reliable since the resource - is typically run under the SYSTEM account and this account is not guaranteed to have rights - to resolve domain accounts. Additionally, the APIs for enumerating group members do not - provide a facility for passing additional credentials resulting in domain members failing - to resolve. - - To address this, group members are enumerated by first converting the GroupPrincipal to a - DirectoryEntry and enumerating its child members. The returned DirectoryEntry instances are - then resolved to Principal objects using a PrincipalContext appropriate for the target - domain. - - Handling Stale Group Members - A group may have stale members if the machine was moved from one domain to a another - foreign domain or when accounts are deleted (domain or local). At this point, members that - were defined in the original domain or were deleted are now stale and cannot be resolved - using Principal::FindByIdentity. The original implementation failed at this point - preventing any operations against the group. The current implementation calls Write-Warning - with the associated SID of the member that cannot be resolved then continues the operation. -#> - -$errorActionPreference = 'Stop' -Set-StrictMode -Version 'Latest' - -# Import CommonResourceHelper for Test-IsNanoServer -$script:dscResourcesFolderFilePath = Split-Path $PSScriptRoot -Parent -$script:commonResourceHelperFilePath = Join-Path -Path $script:dscResourcesFolderFilePath -ChildPath 'CommonResourceHelper.psm1' -Import-Module -Name $script:commonResourceHelperFilePath - -$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_xGroupResource' - -if (-not (Test-IsNanoServer)) -{ - Add-Type -AssemblyName 'System.DirectoryServices.AccountManagement' -} - -<# - .SYNOPSIS - Retrieves the current state of the group with the specified name. - - .PARAMETER GroupName - The name of the group to retrieve the current state of. - - .PARAMETER Credential - A credential to resolve non-local group members. -#> -function Get-TargetResource -{ - [OutputType([Hashtable])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $GroupName, - - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential - ) - - Assert-GroupNameValid -GroupName $GroupName - - if (Test-IsNanoServer) - { - Write-Verbose -Message ($script:localizedData.InvokingFunctionForGroup -f 'Get-TargetResourceOnNanoServer', $GroupName) - return Get-TargetResourceOnNanoServer @PSBoundParameters - } - else - { - Write-Verbose -Message ($script:localizedData.InvokingFunctionForGroup -f 'Get-TargetResourceOnFullSKU', $GroupName) - return Get-TargetResourceOnFullSKU @PSBoundParameters - } -} - -<# - .SYNOPSIS - Creates, modifies, or removes a group. - - .PARAMETER GroupName - The name of the group to create, modify, or remove. - - .PARAMETER Ensure - Specifies whether the group should exist or not. - - To ensure that the group does exist, set this property to present. - To ensure that the group does not exist, set this property to Absent. - - The default value is Present. - - .PARAMETER Description - The description the group should have. - - .PARAMETER Members - The members the group should have. - - This property will replace all the current group members with the specified members. - - Members should be specified as strings in the format of their domain qualified name - (domain\username), their UPN (username@domainname), their distinguished name (CN=username,DC=...), - or their username (for local machine accounts). - - Using either the MembersToExclude or MembersToInclude properties in the same configuration - as this property will generate an error. - - .PARAMETER MembersToInclude - The members the group should include. - - This property will only add members to a group. - - Members should be specified as strings in the format of their domain qualified name - (domain\username), their UPN (username@domainname), their distinguished name (CN=username,DC=...), - or their username (for local machine accounts). - - Using the Members property in the same configuration as this property will generate an error. - - .PARAMETER MembersToExclude - The members the group should exclude. - - This property will only remove members from a group. - - Members should be specified as strings in the format of their domain qualified name - (domain\username), their UPN (username@domainname), their distinguished name (CN=username,DC=...), - or their username (for local machine accounts). - - Using the Members property in the same configuration as this property will generate an error. - - .PARAMETER Credential - A credential to resolve and add non-local group members. - - An error will occur if this account does not have the appropriate Active Directory permissions to add all - non-local accounts to the group. - - .NOTES - ShouldProcess PSSA rule is suppressed because Set-TargetResourceOnFullSKU and - Set-TargetResourceOnNanoServer call ShouldProcess. -#> -function Set-TargetResource -{ - [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSShouldProcess', '')] - [CmdletBinding(SupportsShouldProcess = $true)] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $GroupName, - - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present', - - [String] - $Description, - - [String[]] - $Members, - - [String[]] - $MembersToInclude, - - [String[]] - $MembersToExclude, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential - ) - - Write-Verbose ($script:localizedData.SetTargetResourceStartMessage -f $GroupName) - - Assert-GroupNameValid -GroupName $GroupName - - if (Test-IsNanoServer) - { - Set-TargetResourceOnNanoServer @PSBoundParameters - } - else - { - Set-TargetResourceOnFullSKU @PSBoundParameters - } - - Write-Verbose ($script:localizedData.SetTargetResourceEndMessage -f $GroupName) -} - -<# - .SYNOPSIS - Tests if the group with the specified name is in the desired state. - - .PARAMETER GroupName - The name of the group to test the state of. - - .PARAMETER Ensure - Indicates if the group should exist or not. - - Set this property to "Absent" to test that the group does not exist. - Setting it to "Present" (the default value) tests that the group exists. - - .PARAMETER Description - The description of the group to test for. - - .PARAMETER Members - The list of members the group should have. - - The value of this property is an array of strings of the formats domain qualified name - (domain\username), UPN (username@domainname), distinguished name (CN=username,DC=...) and/or - a unqualified (username) for local machine accounts. - - If you set this property in a configuration, do not use either the MembersToExclude or - MembersToInclude property. Doing so will generate an error. - - .PARAMETER MembersToInclude - A list of members that should be in the group. - - The value of this property is an array of strings of the formats domain qualified name - (domain\username), UPN (username@domainname), distinguished name (CN=username,DC=...) and/or - a unqualified (username) for local machine accounts. - - If you set this property in a configuration, do not use the Members property. - Doing so will generate an error. - - .PARAMETER MembersToExclude - A list of members that should not be in the group. - - The value of this property is an array of strings of the formats domain qualified name - (domain\username), UPN (username@domainname), distinguished name (CN=username,DC=...) and/or - a unqualified (username) for local machine accounts. - - If you set this property in a configuration, do not use the Members property. - Doing so will generate an error. - - .PARAMETER Credential - The credentials required to resolve non-local group members -#> -function Test-TargetResource -{ - [OutputType([Boolean])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $GroupName, - - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present', - - [String] - $Description, - - [String[]] - $Members, - - [String[]] - $MembersToInclude, - - [String[]] - $MembersToExclude, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential - ) - - Assert-GroupNameValid -GroupName $GroupName - - if (Test-IsNanoServer) - { - Write-Verbose ($script:localizedData.InvokingFunctionForGroup -f 'Test-TargetResourceOnNanoServer', $GroupName) - return Test-TargetResourceOnNanoServer @PSBoundParameters - } - else - { - Write-Verbose ($script:localizedData.InvokingFunctionForGroup -f 'Test-TargetResourceOnFullSKU', $GroupName) - return Test-TargetResourceOnFullSKU @PSBoundParameters - } -} - -<# - .SYNOPSIS - Retrieves the current state of the group with the specified name on a full server. - - .PARAMETER GroupName - The name of the group to retrieve the current state of. - - .PARAMETER Credential - A credential to resolve non-local group members. -#> -function Get-TargetResourceOnFullSKU -{ - [OutputType([Hashtable])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $GroupName, - - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential - ) - - $principalContextCache = @{} - $disposables = New-Object -TypeName 'System.Collections.ArrayList' - - try - { - $principalContext = Get-PrincipalContext ` - -PrincipalContextCache $principalContextCache ` - -Disposables $Disposables ` - -Scope $env:COMPUTERNAME - - $group = Get-Group -GroupName $GroupName -PrincipalContext $principalContext - - if ($null -ne $group) - { - $null = $disposables.Add($group) - - # The group was found. Find the group members. - $members = Get-MembersOnFullSKU -Group $group -PrincipalContextCache $principalContextCache ` - -Credential $Credential -Disposables $disposables - - return @{ - GroupName = $group.Name - Ensure = 'Present' - Description = $group.Description - Members = $members - } - } - else - { - # The group was not found. - return @{ - GroupName = $GroupName - Ensure = 'Absent' - } - } - } - finally - { - Remove-DisposableObject -Disposables $disposables - } -} - -<# - .SYNOPSIS - Retrieves the current state of the group with the specified name on Nano Server. - - .PARAMETER GroupName - The name of the group to retrieve the current state of. - - .PARAMETER Credential - A credential to resolve non-local group members. -#> -function Get-TargetResourceOnNanoServer -{ - [OutputType([Hashtable])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $GroupName, - - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential - ) - - try - { - $group = Get-LocalGroup -Name $GroupName -ErrorAction 'Stop' - } - catch - { - if ($_.CategoryInfo.Reason -eq 'GroupNotFoundException') - { - # The group was not found. - return @{ - GroupName = $GroupName - Ensure = 'Absent' - } - } - - New-InvalidOperationException -ErrorRecord $_ - } - - # The group was found. Find the group members. - $members = Get-MembersOnNanoServer -Group $group - - return @{ - GroupName = $group.Name - Ensure = 'Present' - Description = $group.Description - Members = $members - } -} - -<# - .SYNOPSIS - The Set-TargetResource cmdlet on a full server. - - .PARAMETER GroupName - The name of the group for which you want to ensure a specific state. - - .PARAMETER Ensure - Indicates if the group should exist or not. - - Set this property to Present to ensure that the group exists. - Set this property to Absent to ensure that the group does not exist. - - The default value is Present. - - .PARAMETER Description - The description of the group. - - .PARAMETER Members - Use this property to replace the current group membership with the specified members. - - The value of this property is an array of strings of the formats domain qualified name - (domain\username), UPN (username@domainname), distinguished name (CN=username,DC=...) and/or - an unqualified (username) for local machine accounts. - - If you set this property in a configuration, do not use either the MembersToExclude or - MembersToInclude property. Doing so will generate an error. - - .PARAMETER MembersToInclude - Use this property to add members to the existing membership of the group. - - The value of this property is an array of strings of the formats domain qualified name - (domain\username), UPN (username@domainname), distinguished name (CN=username,DC=...) and/or - a unqualified (username) for local machine accounts. - - If you set this property in a configuration, do not use the Members property. - Doing so will generate an error. - - .PARAMETER MembersToExclude - Use this property to remove members from the existing membership of the group. - - The value of this property is an array of strings of the formats domain qualified name - (domain\username), UPN (username@domainname), distinguished name (CN=username,DC=...) and/or - a unqualified (username) for local machine accounts. - - If you set this property in a configuration, do not use the Members property. - Doing so will generate an error. - - .PARAMETER Credential - The credentials required to access remote resources. Note: This account must have the - appropriate Active Directory permissions to add all non-local accounts to the group. - Otherwise, an error will occur. -#> -function Set-TargetResourceOnFullSKU -{ - [CmdletBinding(SupportsShouldProcess = $true)] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $GroupName, - - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present', - - [String] - $Description, - - [String[]] - $Members, - - [String[]] - $MembersToInclude, - - [String[]] - $MembersToExclude, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential - ) - - $principalContextCache = @{} - $disposables = New-Object -TypeName 'System.Collections.ArrayList' - - try - { - $principalContext = Get-PrincipalContext ` - -PrincipalContextCache $principalContextCache ` - -Disposables $disposables ` - -Scope $env:computerName - - # Try to find a group by its name. - $group = Get-Group -GroupName $GroupName -PrincipalContext $principalContext - $groupOriginallyExists = $null -ne $group - - if ($Ensure -eq 'Present') - { - $shouldProcessTarget = $script:localizedData.GroupWithName -f $GroupName - if ($groupOriginallyExists) - { - $null = $disposables.Add($group) - $whatIfShouldProcess = $PSCmdlet.ShouldProcess($shouldProcessTarget, $script:localizedData.SetOperation) - } - else - { - $whatIfShouldProcess = $PSCmdlet.ShouldProcess($shouldProcessTarget, $script:localizedData.AddOperation) - } - - if ($whatIfShouldProcess) - { - $saveChanges = $false - - if (-not $groupOriginallyExists) - { - $localPrincipalContext = Get-PrincipalContext -PrincipalContextCache $principalContextCache ` - -Disposables $disposables -Scope $env:COMPUTERNAME - - $group = New-Object -TypeName 'System.DirectoryServices.AccountManagement.GroupPrincipal' ` - -ArgumentList @( $localPrincipalContext ) - $null = $disposables.Add($group) - - $group.Name = $GroupName - $saveChanges = $true - } - - # Set group properties. - - if ($PSBoundParameters.ContainsKey('Description') -and $Description -ne $group.Description) - { - $group.Description = $Description - $saveChanges = $true - } - - $actualMembersAsPrincipals = $null - - <# - Group members can be updated in two ways: - 1. Supplying the Members parameter - this causes the membership to be replaced - with the members defined in Members. - - NOTE: If Members is empty, the group membership is cleared. - - 2. Providing MembersToInclude and/or MembersToExclude - - this adds/removes members from the list. - - If Members is mutually exclusive with MembersToInclude and MembersToExclude - If Members is not defined then MembersToInclude or MembersToExclude - must contain at least one entry. - #> - if ($PSBoundParameters.ContainsKey('Members')) - { - foreach ($incompatibleParameterName in @( 'MembersToInclude', 'MembersToExclude' )) - { - if ($PSBoundParameters.ContainsKey($incompatibleParameterName)) - { - New-InvalidArgumentException -ArgumentName $incompatibleParameterName ` - -Message ($script:localizedData.MembersAndIncludeExcludeConflict -f 'Members', $incompatibleParameterName) - } - } - - if ($groupOriginallyExists) - { - $actualMembersAsPrincipals = @( Get-MembersAsPrincipalsList ` - -Group $group ` - -PrincipalContextCache $principalContextCache ` - -Disposables $disposables ` - -Credential $Credential - ) - } - - if ($Members.Count -eq 0 -and $null -ne $actualMembersAsPrincipals -and $actualMembersAsPrincipals.Count -ne 0) - { - Clear-GroupMembers -Group $group - $saveChanges = $true - } - elseif ($Members.Count -ne 0) - { - # Remove duplicate names as strings. - $uniqueMembers = $Members | Select-Object -Unique - - # Resolve the names to actual principal objects. - $membersAsPrincipals = @( ConvertTo-UniquePrincipalsList ` - -MemberNames $uniqueMembers ` - -PrincipalContextCache $principalContextCache ` - -Disposables $disposables ` - -Credential $Credential ) - - if ($null -ne $actualMembersAsPrincipals -and $actualMembersAsPrincipals.Count -gt 0) - { - foreach ($memberAsPrincipal in $membersAsPrincipals) - { - if ($actualMembersAsPrincipals -notcontains $memberAsPrincipal) - { - Add-GroupMember -Group $group -MemberAsPrincipal $memberAsPrincipal - $saveChanges = $true - } - } - - foreach ($actualMemberAsPrincipal in $actualMembersAsPrincipals) - { - if ($membersAsPrincipals -notcontains $actualMemberAsPrincipal) - { - Remove-GroupMember -Group $group -MemberAsPrincipal $actualMemberAsPrincipal - $saveChanges = $true - } - } - } - else - { - # Set the members of the group - foreach ($memberAsPrincipal in $membersAsPrincipals) - { - Add-GroupMember -Group $group -MemberAsPrincipal $memberAsPrincipal - } - - $saveChanges = $true - } - } - else - { - Write-Verbose -Message ($script:localizedData.GroupAndMembersEmpty -f $GroupName) - } - } - elseif ($PSBoundParameters.ContainsKey('MembersToInclude') -or $PSBoundParameters.ContainsKey('MembersToExclude')) - { - if ($groupOriginallyExists) - { - $actualMembersAsPrincipals = @( Get-MembersAsPrincipalsList ` - -Group $group ` - -PrincipalContextCache $principalContextCache ` - -Disposables $disposables ` - -Credential $Credential - ) - } - - $membersToIncludeAsPrincipals = $null - $uniqueMembersToInclude = $MembersToInclude | Select-Object -Unique - - if ($null -eq $uniqueMembersToInclude) - { - Write-Verbose -Message $script:localizedData.MembersToIncludeEmpty - } - else - { - # Resolve the names to actual principal objects. - $membersToIncludeAsPrincipals = @( ConvertTo-UniquePrincipalsList ` - -MemberNames $uniqueMembersToInclude ` - -PrincipalContextCache $principalContextCache ` - -Disposables $disposables ` - -Credential $Credential - ) - } - - $membersToExcludeAsPrincipals = $null - $uniqueMembersToExclude = $MembersToExclude | Select-Object -Unique - - if ($null -eq $uniqueMembersToExclude) - { - Write-Verbose -Message $script:localizedData.MembersToExcludeEmpty - } - else - { - # Resolve the names to actual principal objects. - $membersToExcludeAsPrincipals = @( ConvertTo-UniquePrincipalsList ` - -MemberNames $uniqueMembersToExclude ` - -PrincipalContextCache $principalContextCache ` - -Disposables $disposables ` - -Credential $Credential - ) - } - - foreach ($includedPrincipal in $membersToIncludeAsPrincipals) - { - <# - Throw an error if any common principals were provided in MembersToInclude - and MembersToExclude. - #> - if ($membersToExcludeAsPrincipals -contains $includedPrincipal) - { - New-InvalidArgumentException -ArgumentName 'MembersToInclude and MembersToExclude' ` - -Message ($script:localizedData.IncludeAndExcludeConflict -f $includedPrincipal.SamAccountName, - 'MembersToInclude', 'MembersToExclude') - } - - if ($actualMembersAsPrincipals -notcontains $includedPrincipal) - { - Add-GroupMember -Group $group -MemberAsPrincipal $includedPrincipal - $saveChanges = $true - } - } - - foreach ($excludedPrincipal in $membersToExcludeAsPrincipals) - { - if ($actualMembersAsPrincipals -contains $excludedPrincipal) - { - Remove-GroupMember -Group $group -MemberAsPrincipal $excludedPrincipal - $saveChanges = $true - } - } - } - - if ($saveChanges) - { - Save-Group -Group $group - - # Send an operation success verbose message. - if ($groupOriginallyExists) - { - Write-Verbose -Message ($script:localizedData.GroupUpdated -f $GroupName) - } - else - { - Write-Verbose -Message ($script:localizedData.GroupCreated -f $GroupName) - } - } - else - { - Write-Verbose -Message ($script:localizedData.NoConfigurationRequired -f $GroupName) - } - } - } - else - { - if ($groupOriginallyExists) - { - if ($PSCmdlet.ShouldProcess(($script:localizedData.GroupWithName -f $GroupName), $script:localizedData.RemoveOperation)) - { - # Don't add group to $disposables since Delete also disposes. - Remove-Group -Group $group - Write-Verbose -Message ($script:localizedData.GroupRemoved -f $GroupName) - } - else - { - $null = $disposables.Add($group) - } - } - else - { - Write-Verbose -Message ($script:localizedData.NoConfigurationRequiredGroupDoesNotExist -f $GroupName) - } - } - } - finally - { - Remove-DisposableObject -Disposables $disposables - } -} - -<# - .SYNOPSIS - The Set-TargetResource cmdlet on Nano Server. - - .PARAMETER GroupName - The name of the group for which you want to ensure a specific state. - - .PARAMETER Ensure - Indicates if the group should exist or not. - - Set this property to Present to ensure that the group exists. - Set this property to Absent to ensure that the group does not exist. - - The default value is Present. - - .PARAMETER Description - The description of the group. - - .PARAMETER Members - Use this property to replace the current group membership with the specified members. - - The value of this property is an array of strings of the formats domain qualified name - (domain\username), UPN (username@domainname), distinguished name (CN=username,DC=...) and/or - a unqualified (username) for local machine accounts. - - If you set this property in a configuration, do not use either the MembersToExclude or - MembersToInclude property. Doing so will generate an error. - - .PARAMETER MembersToInclude - Use this property to add members to the existing membership of the group. - - The value of this property is an array of strings of the formats domain qualified name - (domain\username), UPN (username@domainname), distinguished name (CN=username,DC=...) and/or - a unqualified (username) for local machine accounts. - - If you set this property in a configuration, do not use the Members property. - Doing so will generate an error. - - .PARAMETER MembersToExclude - Use this property to remove members from the existing membership of the group. - - The value of this property is an array of strings of the formats domain qualified name - (domain\username), UPN (username@domainname), distinguished name (CN=username,DC=...) and/or - a unqualified (username) for local machine accounts. - - If you set this property in a configuration, do not use the Members property. - Doing so will generate an error. - - .PARAMETER Credential - Not used on Nano Server. - Only local users are accessible from the resource. -#> -function Set-TargetResourceOnNanoServer -{ - [CmdletBinding(SupportsShouldProcess = $true)] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $GroupName, - - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present', - - [String] - $Description, - - [String[]] - $Members, - - [String[]] - $MembersToInclude, - - [String[]] - $MembersToExclude, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential - ) - - try - { - $group = Get-LocalGroup -Name $GroupName -ErrorAction 'Stop' - $groupOriginallyExists = $true - } - catch [System.Exception] - { - if ($_.CategoryInfo.Reason -eq 'GroupNotFoundException') - { - # A group with the provided name does not exist. - Write-Verbose -Message ($script:localizedData.GroupDoesNotExist -f $GroupName) - $groupOriginallyExists = $false - } - else - { - New-InvalidOperationException -ErrorRecord $_ - } - } - - if ($Ensure -eq 'Present') - { - $whatIfShouldProcess = - if ($groupOriginallyExists) - { - $PSCmdlet.ShouldProcess(($script:localizedData.GroupWithName -f $GroupName), - $script:localizedData.SetOperation) - } - else - { - $PSCmdlet.ShouldProcess(($script:localizedData.GroupWithName -f $GroupName), - $script:localizedData.AddOperation) - } - - if ($whatIfShouldProcess) - { - if (-not $groupOriginallyExists) - { - $group = New-LocalGroup -Name $GroupName - Write-Verbose -Message ($script:localizedData.GroupCreated -f $GroupName) - } - - # Set the group properties. - if ($PSBoundParameters.ContainsKey('Description') -and - ((-not $groupOriginallyExists) -or ($Description -ne $group.Description))) - { - Set-LocalGroup -Name $GroupName -Description $Description - } - - if ($PSBoundParameters.ContainsKey('Members')) - { - foreach ($incompatibleParameterName in @( 'MembersToInclude', 'MembersToExclude' )) - { - if ($PSBoundParameters.ContainsKey($incompatibleParameterName)) - { - New-InvalidArgumentException -ArgumentName $incompatibleParameterName ` - -Message ($script:localizedData.MembersAndIncludeExcludeConflict -f 'Members', $incompatibleParameterName) - } - } - - $groupMembers = Get-MembersOnNanoServer -Group $group - - # Remove duplicate names as strings. - $uniqueMembers = $Members | Select-Object -Unique - - # Remove unspecified members - foreach ($groupMember in $groupMembers) - { - if ($uniqueMembers -notcontains $groupMember) - { - Remove-LocalGroupMember -Group $GroupName -Member $groupMember - } - } - - # Add specified missing members - foreach ($uniqueMember in $uniqueMembers) - { - if ($groupMembers -notcontains $uniqueMember) - { - Add-LocalGroupMember -Group $GroupName -Member $uniqueMember - } - } - } - elseif ($PSBoundParameters.ContainsKey('MembersToInclude') -or $PSBoundParameters.ContainsKey('MembersToExclude')) - { - [array]$groupMembers = Get-MembersOnNanoServer -Group $group - - $uniqueMembersToInclude = $MembersToInclude | Select-Object -Unique - $uniqueMembersToExclude = $MembersToExclude | Select-Object -Unique - - <# - Both MembersToInclude and MembersToExclude were provided. - Check if they have common principals. - #> - foreach ($includedMember in $uniqueMembersToInclude) - { - foreach($excludedMember in $uniqueMembersToExclude) - { - if ($includedMember -eq $excludedMember) - { - New-InvalidArgumentException -ArgumentName 'MembersToInclude and MembersToExclude' ` - -Message ($script:localizedData.IncludeAndExcludeConflict -f $includedMember, 'MembersToInclude', - 'MembersToExclude') - } - } - } - - foreach ($includedMember in $uniqueMembersToInclude) - { - if ($groupMembers -notcontains $includedMember) - { - Add-LocalGroupMember -Group $GroupName -Member $includedMember - } - } - - foreach($excludedMember in $uniqueMembersToExclude) - { - if ($groupMembers -contains $excludedMember) - { - Remove-LocalGroupMember -Group $GroupName -Member $excludedMember - } - } - } - } - } - else - { - # Ensure is set to "Absent". - if ($groupOriginallyExists) - { - $whatIfShouldProcess = $PSCmdlet.ShouldProcess( - ($script:localizedData.GroupWithName -f $GroupName), $script:localizedData.RemoveOperation) - if ($whatIfShouldProcess) - { - # The group exists. Remove the group by the provided name. - Remove-LocalGroup -Name $GroupName - Write-Verbose -Message ($script:localizedData.GroupRemoved -f $GroupName) - } - } - else - { - Write-Verbose -Message ($script:localizedData.NoConfigurationRequiredGroupDoesNotExist -f $GroupName) - } - } -} - -<# - .SYNOPSIS - The Test-TargetResource cmdlet on a full server. - Tests if the group being managed is in the desired state. - - .PARAMETER GroupName - The name of the group for which you want to test a specific state. - - .PARAMETER Ensure - Indicates if the group should exist or not. - - Set this property to Present to ensure that the group exists. - Set this property to Absent to ensure that the group does not exist. - - The default value is Present. - - .PARAMETER Description - The description of the group to test for. - - .PARAMETER Members - Use this property to test if the existing membership of the group matches - the list provided. - - The value of this property is an array of strings of the formats domain qualified name - (domain\username), UPN (username@domainname), distinguished name (CN=username,DC=...) and/or - a unqualified (username) for local machine accounts. - - If you set this property in a configuration, do not use either the MembersToExclude or - MembersToInclude property. Doing so will generate an error. - - .PARAMETER MembersToInclude - Use this property to test if members need to be added to the existing membership - of the group. - - The value of this property is an array of strings of the formats domain qualified name - (domain\username), UPN (username@domainname), distinguished name (CN=username,DC=...) and/or - a unqualified (username) for local machine accounts. - - If you set this property in a configuration, do not use the Members property. - Doing so will generate an error. - - .PARAMETER MembersToExclude - Use this property to test if members need to removed from the existing membership - of the group. - - The value of this property is an array of strings of the formats domain qualified name - (domain\username), UPN (username@domainname), distinguished name (CN=username,DC=...) and/or - a unqualified (username) for local machine accounts. - - If you set this property in a configuration, do not use the Members property. - Doing so will generate an error. - - .PARAMETER Credential - The credentials required to resolve non-local group members -#> -function Test-TargetResourceOnFullSKU -{ - [OutputType([Boolean])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $GroupName, - - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present', - - [String] - $Description, - - [String[]] - $Members, - - [String[]] - $MembersToInclude, - - [String[]] - $MembersToExclude, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential - ) - - $principalContextCache = @{} - $disposables = New-Object -TypeName 'System.Collections.ArrayList' - - try - { - $principalContext = Get-PrincipalContext ` - -PrincipalContextCache $PrincipalContextCache ` - -Disposables $disposables ` - -Scope $env:computerName - - $group = Get-Group -GroupName $GroupName -PrincipalContext $principalContext - - if ($null -eq $group) - { - Write-Verbose -Message ($script:localizedData.GroupDoesNotExist -f $GroupName) - return $Ensure -eq 'Absent' - } - - $null = $disposables.Add($group) - Write-Verbose -Message ($script:localizedData.GroupExists -f $GroupName) - - # Validate separate properties. - if ($Ensure -eq 'Absent') - { - Write-Verbose -Message ($script:localizedData.PropertyMismatch -f 'Ensure', 'Absent', 'Present') - return $false - } - - if ($PSBoundParameters.ContainsKey('Description') -and $Description -ne $group.Description) - { - Write-Verbose -Message ($script:localizedData.PropertyMismatch -f 'Description', $Description, $group.Description) - return $false - } - - if ($PSBoundParameters.ContainsKey('Members')) - { - foreach ($incompatibleParameterName in @( 'MembersToInclude', 'MembersToExclude' )) - { - if ($PSBoundParameters.ContainsKey($incompatibleParameterName)) - { - New-InvalidArgumentException -ArgumentName $incompatibleParameterName ` - -Message ($script:localizedData.MembersAndIncludeExcludeConflict -f 'Members', $incompatibleParameterName) - } - } - - $actualMembersAsPrincipals = @( Get-MembersAsPrincipalsList ` - -Group $group ` - -PrincipalContextCache $principalContextCache ` - -Disposables $disposables ` - -Credential $Credential - ) - - $uniqueMembers = $Members | Select-Object -Unique - - if ($null -eq $uniqueMembers) - { - return ($null -eq $actualMembersAsPrincipals -or $actualMembersAsPrincipals.Count -eq 0) - } - else - { - if ($null -eq $actualMembersAsPrincipals -or $actualMembersAsPrincipals.Count -eq 0) - { - return $false - } - - # Resolve the names to actual principal objects. - $expectedMembersAsPrincipals = @( ConvertTo-UniquePrincipalsList ` - -MemberNames $uniqueMembers ` - -PrincipalContextCache $principalContextCache ` - -Disposables $disposables ` - -Credential $Credential - ) - - if ($expectedMembersAsPrincipals.Count -ne $actualMembersAsPrincipals.Count) - { - Write-Verbose -Message ($script:localizedData.MembersNumberMismatch -f 'Members', - $expectedMembersAsPrincipals.Count, $actualMembersAsPrincipals.Count) - return $false - } - - # Compare the two member lists. - foreach ($expectedMemberAsPrincipal in $expectedMembersAsPrincipals) - { - if ($actualMembersAsPrincipals -notcontains $expectedMemberAsPrincipal) - { - Write-Verbose -Message ($script:localizedData.MembersMemberMismatch -f $expectedMemberAsPrincipal.SamAccountName, - 'Members', $group.SamAccountName) - return $false - } - } - } - } - elseif ($PSBoundParameters.ContainsKey('MembersToInclude') -or $PSBoundParameters.ContainsKey('MembersToExclude')) - { - $actualMembersAsPrincipals = @( Get-MembersAsPrincipalsList ` - -Group $group ` - -PrincipalContextCache $principalContextCache ` - -Disposables $disposables ` - -Credential $Credential - ) - - $membersToIncludeAsPrincipals = $null - $uniqueMembersToInclude = $MembersToInclude | Select-Object -Unique - - if ($null -eq $uniqueMembersToInclude) - { - Write-Verbose -Message $script:localizedData.MembersToIncludeEmpty - } - else - { - # Resolve the names to actual principal objects. - $membersToIncludeAsPrincipals = @( ConvertTo-UniquePrincipalsList ` - -MemberNames $uniqueMembersToInclude ` - -PrincipalContextCache $principalContextCache ` - -Disposables $disposables ` - -Credential $Credential - ) - } - - $membersToExcludeAsPrincipals = $null - $uniqueMembersToExclude = $MembersToExclude | Select-Object -Unique - - if ($null -eq $uniqueMembersToExclude) - { - Write-Verbose -Message $script:localizedData.MembersToExcludeEmpty - } - else - { - # Resolve the names to actual principal objects. - $membersToExcludeAsPrincipals = @( ConvertTo-UniquePrincipalsList ` - -MemberNames $uniqueMembersToExclude ` - -PrincipalContextCache $principalContextCache ` - -Disposables $disposables ` - -Credential $Credential - ) - } - - foreach ($includedPrincipal in $membersToIncludeAsPrincipals) - { - <# - Throw an error if any common principals were provided in MembersToInclude - and MembersToExclude. - #> - if ($membersToExcludeAsPrincipals -contains $includedPrincipal) - { - New-InvalidArgumentException -ArgumentName 'MembersToInclude and MembersToExclude' ` - -Message ($script:localizedData.IncludeAndExcludeConflict -f $includedPrincipal.SamAccountName, - 'MembersToInclude', 'MembersToExclude') - } - - if ($actualMembersAsPrincipals -notcontains $includedPrincipal) - { - return $false - } - } - - foreach ($excludedPrincipal in $membersToExcludeAsPrincipals) - { - if ($actualMembersAsPrincipals -contains $excludedPrincipal) - { - return $false - } - } - } - } - finally - { - Remove-DisposableObject -Disposables $disposables - } - - return $true -} - -<# - .SYNOPSIS - The Test-TargetResource cmdlet on a Nano server - Tests if the group being managed is in the desired state. - - .PARAMETER GroupName - The name of the group for which you want to test a specific state. - - .PARAMETER Ensure - Indicates if the group should exist or not. - - Set this property to Present to ensure that the group exists. - Set this property to Absent to ensure that the group does not exist. - - The default value is Present. - - .PARAMETER Description - The description of the group to test for. - - .PARAMETER Members - Use this property to test if the existing membership of the group matches - the list provided. - - The value of this property is an array of strings of the formats domain qualified name - (domain\username), UPN (username@domainname), distinguished name (CN=username,DC=...) and/or - a unqualified (username) for local machine accounts. - - If you set this property in a configuration, do not use either the MembersToExclude or - MembersToInclude property. Doing so will generate an error. - - .PARAMETER MembersToInclude - Use this property to test if members need to be added to the existing membership - of the group. - - The value of this property is an array of strings of the formats domain qualified name - (domain\username), UPN (username@domainname), distinguished name (CN=username,DC=...) and/or - a unqualified (username) for local machine accounts. - - If you set this property in a configuration, do not use the Members property. - Doing so will generate an error. - - .PARAMETER MembersToExclude - Use this property to test if members need to removed from the existing membership - of the group. - - The value of this property is an array of strings of the formats domain qualified name - (domain\username), UPN (username@domainname), distinguished name (CN=username,DC=...) and/or - a unqualified (username) for local machine accounts. - - If you set this property in a configuration, do not use the Members property. - Doing so will generate an error. - - .PARAMETER Credential - The credentials required to resolve non-local group members -#> -function Test-TargetResourceOnNanoServer -{ - [OutputType([Boolean])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $GroupName, - - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present', - - [String] - $Description, - - [String[]] - $Members, - - [String[]] - $MembersToInclude, - - [String[]] - $MembersToExclude, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential - ) - - try - { - $group = Get-LocalGroup -Name $GroupName -ErrorAction Stop - } - catch [System.Exception] - { - if ($_.CategoryInfo.Reason -eq 'GroupNotFoundException') - { - # A group with the provided name does not exist. - Write-Verbose -Message ($script:localizedData.GroupDoesNotExist -f $GroupName) - - return ($Ensure -eq 'Absent') - } - - New-InvalidOperationException -ErrorRecord $_ - } - - # A group with the provided name exists. - Write-Verbose -Message ($script:localizedData.GroupExists -f $GroupName) - - # Validate separate properties. - if ($Ensure -eq 'Absent') - { - Write-Verbose -Message ($script:localizedData.PropertyMismatch -f 'Ensure', 'Absent', 'Present') - return $false - } - - if ($PSBoundParameters.ContainsKey('Description') -and $Description -ne $group.Description) - { - Write-Verbose -Message ($script:localizedData.PropertyMismatch -f 'Description', $Description, $group.Description) - return $false - } - - if ($PSBoundParameters.ContainsKey('Members')) - { - foreach ($incompatibleParameterName in @( 'MembersToInclude', 'MembersToExclude' )) - { - if ($PSBoundParameters.ContainsKey($incompatibleParameterName)) - { - New-InvalidArgumentException -ArgumentName $incompatibleParameterName ` - -Message ($script:localizedData.MembersAndIncludeExcludeConflict -f 'Members', $incompatibleParameterName) - } - } - - [array]$groupMembers = Get-MembersOnNanoServer -Group $group - - # Remove duplicate names as strings. - $uniqueMembers = $Members | Select-Object -Unique - - if ($null -eq $uniqueMembers) - { - return ($null -eq $groupMembers -or $groupMembers.Count -eq 0) - } - else - { - if ($null -eq $groupMembers -or $uniqueMembers.Count -ne $groupMembers.Count) - { - return $false - } - - foreach ($groupMember in $groupMembers) - { - if ($uniqueMembers -notcontains $groupMember) - { - return $false - } - } - } - } - elseif ($PSBoundParameters.ContainsKey('MembersToInclude') -or $PSBoundParameters.ContainsKey('MembersToExclude')) - { - $groupMembers = Get-MembersOnNanoServer -Group $group - - $uniqueMembersToInclude = $MembersToInclude | Select-Object -Unique - $uniqueMembersToExclude = $MembersToExclude | Select-Object -Unique - - <# - Both MembersToInclude and MembersToExclude were provided. - Check if they have common principals. - #> - foreach ($includedMember in $uniqueMembersToInclude) - { - foreach($excludedMember in $uniqueMembersToExclude) - { - if ($includedMember -eq $excludedMember) - { - New-InvalidArgumentException -ArgumentName 'MembersToInclude and MembersToExclude' ` - -Message ($script:localizedData.IncludeAndExcludeConflict -f $includedMember, 'MembersToInclude', - 'MembersToExclude') - } - } - } - - foreach ($includedMember in $uniqueMembersToInclude) - { - if ($groupMembers -notcontains $includedMember) - { - return $false - } - } - - foreach($excludedMember in $uniqueMembersToExclude) - { - if ($groupMembers -contains $excludedMember) - { - return $false - } - } - } - - # All properties match. Return $true. - return $true -} - -<# - .SYNOPSIS - Retrieves the members of a group on a Nano server. - - .PARAMETER Group - The LocalGroup Object to retrieve members for. -#> -function Get-MembersOnNanoServer -{ - [OutputType([System.String[]])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [Microsoft.PowerShell.Commands.LocalGroup] - $Group - ) - - $memberNames = New-Object -TypeName 'System.Collections.ArrayList' - - # Get the group members. - $groupMembers = Get-LocalGroupMember -Group $Group - - foreach ($groupMember in $groupMembers) - { - if ($groupMember.PrincipalSource -ieq 'Local') - { - $localMemberName = $groupMember.Name.Substring($groupMember.Name.IndexOf('\') + 1) - $null = $memberNames.Add($localMemberName) - } - else - { - Write-Verbose -Message ($script:localizedData.MemberIsNotALocalUser -f $groupMember.Name,$groupMember.PrincipalSource) - $domainMemberName = $groupMember.Name - $null = $memberNames.Add($domainMemberName) - } - } - - return $memberNames.ToArray() -} - -<# - .SYNOPSIS - Retrieves the members of the given a group on a full server. - - .PARAMETER Group - The GroupPrincipal Object to retrieve members for. - - .PARAMETER PrincipalContextCache - A hashtable cache of PrincipalContext instances for each scope. - This is used to cache PrincipalContext instances for cases where it is used multiple times. - - .PARAMETER Disposables - The ArrayList of disposable objects to which to add any objects that need to be disposed. - - .PARAMETER Credential - The network credential to use when explicit credentials are needed for the target domain. -#> -function Get-MembersOnFullSKU -{ - [OutputType([System.String[]])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [System.DirectoryServices.AccountManagement.GroupPrincipal] - $Group, - - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [Hashtable] - [AllowEmptyCollection()] - $PrincipalContextCache, - - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [System.Collections.ArrayList] - [AllowEmptyCollection()] - $Disposables, - - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential - ) - - $members = New-Object -TypeName 'System.Collections.ArrayList' - - $membersAsPrincipals = @( Get-MembersAsPrincipalsList ` - -Group $Group ` - -PrincipalContextCache $PrincipalContextCache ` - -Disposables $Disposables ` - -Credential $Credential - ) - - foreach ($memberAsPrincipal in $membersAsPrincipals) - { - if ($memberAsPrincipal.ContextType -eq [System.DirectoryServices.AccountManagement.ContextType]::Domain) - { - # Select only the first part of the full domain name. - $domainName = $memberAsPrincipal.Context.Name - - $domainNameDotIndex = $domainName.IndexOf('.') - if ($domainNameDotIndex -ne -1) - { - $domainName = $domainName.Substring(0, $domainNameDotIndex) - } - - if ($memberAsPrincipal.StructuralObjectClass -ieq 'computer') - { - $null = $members.Add($domainName + '\' + $memberAsPrincipal.Name) - } - else - { - $null = $members.Add($domainName + '\' + $memberAsPrincipal.SamAccountName) - } - } - else - { - $null = $members.Add($memberAsPrincipal.Name) - } - } - - return $members.ToArray() -} - -<# - .SYNOPSIS - Retrieves the members of a group as Principal instances. - - .PARAMETER Group - The group to retrieve members for. - - .PARAMETER PrincipalContextCache - A hashtable cache of PrincipalContext instances for each scope. - This is used to cache PrincipalContext instances for cases where it is used multiple times. - - .PARAMETER Disposables - The ArrayList of disposable objects to which to add any objects that need to be disposed. - - .PARAMETER Credential - The network credential to use when explicit credentials are needed for the target domain. -#> -function Get-MembersAsPrincipalsList -{ - [OutputType([System.DirectoryServices.AccountManagement.Principal[]])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [System.DirectoryServices.AccountManagement.GroupPrincipal] - $Group, - - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [Hashtable] - [AllowEmptyCollection()] - $PrincipalContextCache, - - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [System.Collections.ArrayList] - [AllowEmptyCollection()] - $Disposables, - - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential - ) - - $principals = New-Object -TypeName 'System.Collections.ArrayList' - - <# - This logic enumerates the group members using the underlying DirectoryEntry API. This is - needed because enumerating the group members as principal instances causes a resolve to - occur. Since there is no facility for passing credentials to perform the resolution, any - members that cannot be resolved using the current user will fail (such as when this - resource runs as SYSTEM). Dropping down to the underyling DirectoryEntry API allows us to - access the account's SID which can then be used to resolve the associated principal using - explicit credentials. - #> - $groupDirectoryMembers = Get-GroupMembersFromDirectoryEntry -Group $Group - - foreach ($groupDirectoryMember in $groupDirectoryMembers) - { - # Extract the ObjectSid from the underlying DirectoryEntry - $memberDirectoryEntry = New-Object -TypeName 'System.DirectoryServices.DirectoryEntry' ` - -ArgumentList @( $groupDirectoryMember ) - $null = $disposables.Add($memberDirectoryEntry) - - $memberDirectoryEntryPathParts = $memberDirectoryEntry.Path.Split('/') - - if ($memberDirectoryEntryPathParts.Count -eq 4) - { - # Parsing WinNT://domainname/accountname or WinNT://machinename/accountname - $scope = $memberDirectoryEntryPathParts[2] - $accountName = $memberDirectoryEntryPathParts[3] - } - elseif ($memberDirectoryEntryPathParts.Count -eq 5) - { - # Parsing WinNT://domainname/machinename/accountname - $scope = $memberDirectoryEntryPathParts[3] - $accountName = $memberDirectoryEntryPathParts[4] - } - else - { - <# - The account is stale either becuase it was deleted or the machine was moved to a - new domain without removing the domain members from the group. If we consider this - a fatal error, the group is no longer managable by the DSC resource. Writing a - warning allows the operation to complete while leaving the stale member in the - group. - #> - Write-Warning -Message ($script:localizedData.MemberNotValid -f $memberDirectoryEntry.Path) - continue - } - - $principalContext = Get-PrincipalContext ` - -Scope $scope ` - -Credential $Credential ` - -PrincipalContextCache $PrincipalContextCache ` - -Disposables $Disposables - - # If local machine qualified, get the PrincipalContext for the local machine - if (Test-IsLocalMachine -Scope $scope) - { - Write-Verbose -Message ($script:localizedData.ResolvingLocalAccount -f $accountName) - } - # The account is domain qualified - credential required to resolve it. - elseif ($null -ne $principalContext) - { - Write-Verbose -Message ($script:localizedData.ResolvingDomainAccount -f $accountName, $scope) - } - else - { - <# - The provided name is not scoped to the local machine and no credential was - provided. This is an unsupported use case. A credential is required to resolve - off-box. - #> - New-InvalidArgumentException -ArgumentName 'Credential' ` - -Message ($script:localizedData.DomainCredentialsRequired -f $accountName) - } - - # Create a SID to enable comparison againt the expected member's SID. - $memberSidBytes = $memberDirectoryEntry.Properties['ObjectSid'].Value - $memberSid = New-Object -TypeName 'System.Security.Principal.SecurityIdentifier' ` - -ArgumentList @( $memberSidBytes, 0 ) - - $principal = Resolve-SidToPrincipal -PrincipalContext $principalContext -Sid $memberSid -Scope $scope - $null = $disposables.Add($principal) - - $null = $principals.Add($principal) - } - - return $principals.ToArray() -} - -<# - .SYNOPSIS - Throws an error if a group name contains invalid characters. - - .PARAMETER GroupName - The group name to test. -#> -function Assert-GroupNameValid -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $GroupName - ) - - $invalidCharacters = @( '\', '/', '"', '[', ']', ':', '|', '<', '>', '+', '=', ';', ',', '?', '*', '@' ) - - if ($GroupName.IndexOfAny($invalidCharacters) -ne -1) - { - New-InvalidArgumentException -ArgumentName 'GroupName' ` - -Message ($script:localizedData.InvalidGroupName -f $GroupName, [String]::Join(' ', $invalidCharacters)) - } - - $nameContainsOnlyWhitspaceOrDots = $true - - # Check if the name consists of only periods and/or white spaces. - for ($groupNameIndex = 0; $groupNameIndex -lt $GroupName.Length; $groupNameIndex++) - { - if (-not [Char]::IsWhiteSpace($GroupName, $groupNameIndex) -and $GroupName[$groupNameIndex] -ne '.') - { - $nameContainsOnlyWhitspaceOrDots = $false - break - } - } - - if ($nameContainsOnlyWhitspaceOrDots) - { - New-InvalidArgumentException -ArgumentName 'GroupName' ` - -Message ($script:localizedData.InvalidGroupName -f $GroupName, [String]::Join(' ', $invalidCharacters)) - } -} - -<# - .SYNOPSIS - Resolves an array of member names to Principal instances. - - .PARAMETER MemberNames - The member names to convert to Principal instances. - - .PARAMETER PrincipalContextCache - A hashtable cache of PrincipalContext instances for each scope. - This is used to cache PrincipalContext instances for cases where it is used multiple times. - - .PARAMETER Disposables - The ArrayList of disposable objects to which to add any objects that need to be disposed. - - .PARAMETER Credential - The network credential to use when explicit credentials are needed for the target domain. -#> -function ConvertTo-UniquePrincipalsList -{ - [OutputType([System.DirectoryServices.AccountManagement.Principal[]])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [String[]] - $MemberNames, - - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [Hashtable] - [AllowEmptyCollection()] - $PrincipalContextCache, - - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [System.Collections.ArrayList] - [AllowEmptyCollection()] - $Disposables, - - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential - ) - - $principals = @() - - foreach ($memberName in $MemberNames) - { - $principal = ConvertTo-Principal ` - -MemberName $memberName ` - -PrincipalContextCache $PrincipalContextCache ` - -Disposables $Disposables ` - -Credential $Credential - - if ($null -ne $principal) - { - # Do not add duplicate entries - if ($principal.ContextType -eq [System.DirectoryServices.AccountManagement.ContextType]::Domain) - { - $duplicatePrincipal = $principals | Where-Object -FilterScript { $_.DistinguishedName -ieq $principal.DistinguishedName } - - if ($null -eq $duplicatePrincipal) - { - $principals += $principal - } - } - else - { - $duplicatePrincipal = $principals | Where-Object -FilterScript { $_.SamAccountName -ieq $principal.SamAccountName } - - if ($null -eq $duplicatePrincipal) - { - $principals += $principal - } - } - } - } - - return $principals -} - -<# - .SYNOPSIS - Resolves a member name to a Principal instance. - - .PARAMETER MemberName - The member name to convert to a Principal instance. - - .PARAMETER PrincipalContextCache - A hashtable cache of PrincipalContext instances for each scope. - This is used to cache PrincipalContext instances for cases where it is used multiple times. - - .PARAMETER Disposables - The ArrayList of disposable objects to which to add any objects that need to be disposed. - - .PARAMETER Credential - The network credential to use when explicit credentials are needed for the target domain. - - .NOTES - ConvertTo-Principal will fail if a machine name is specified as domainname\machinename. It - will succeed if the machine name is specified as the SAM name (domainname\machinename$) or - as the unqualified machine name. - - Split-MemberName splits the scope and account name to avoid this problem. -#> -function ConvertTo-Principal -{ - [OutputType([System.DirectoryServices.AccountManagement.Principal])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [String] - $MemberName, - - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [Hashtable] - [AllowEmptyCollection()] - $PrincipalContextCache, - - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [System.Collections.ArrayList] - [AllowEmptyCollection()] - $Disposables, - - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential - ) - - # The scope of the the object name when in the form of scope\name, UPN, or DN - $scope, $identityValue = Split-MemberName -MemberName $MemberName - - if (Test-IsLocalMachine -Scope $scope) - { - # If local machine qualified, get the PrincipalContext for the local machine - Write-Verbose -Message ($script:localizedData.ResolvingLocalAccount -f $identityValue) - } - elseif ($null -ne $Credential) - { - # The account is domain qualified - a credential is provided to resolve it. - Write-Verbose -Message ($script:localizedData.ResolvingDomainAccount -f $identityValue, $scope) - } - else - { - <# - The provided name is not scoped to the local machine and no credentials were provided. - If the object is a domain qualified name, we can try to resolve the user with domain - trust, if setup. When using domain trust, we use the object name to resolve. Object - name can be in different formats such as a domain qualified name, UPN, or a - distinguished name for the scope - #> - - Write-Verbose -Message ($script:localizedData.ResolvingDomainAccountWithTrust -f $MemberName) - $identityValue = $MemberName - } - - $principalContext = Get-PrincipalContext ` - -Scope $scope ` - -PrincipalContextCache $PrincipalContextCache ` - -Disposables $Disposables ` - -Credential $Credential - - try - { - $principal = Find-Principal -PrincipalContext $principalContext -IdentityValue $identityValue - } - catch [System.Runtime.InteropServices.COMException] - { - New-InvalidArgumentException -ArgumentName $MemberName ` - -Message ( $script:localizedData.UnableToResolveAccount -f $MemberName, $_.Exception.Message, $_.Exception.HResult ) - } - - if ($null -eq $principal) - { - New-InvalidArgumentException -ArgumentName $MemberName -Message ($script:localizedData.CouldNotFindPrincipal -f $MemberName) - } - - return $principal -} - -<# - .SYNOPSIS - Resolves a SID to a principal. - - .PARAMETER Sid - The security identifier to resolve to a Principal. - - .PARAMETER PrincipalContext - The PrincipalContext to use to resolve the Principal. - - .PARAMETER Scope - The scope of the PrincipalContext. -#> -function Resolve-SidToPrincipal -{ - [OutputType([System.DirectoryServices.AccountManagement.Principal])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [System.Security.Principal.SecurityIdentifier] - $Sid, - - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [System.DirectoryServices.AccountManagement.PrincipalContext] - $PrincipalContext, - - [Parameter(Mandatory = $true)] - [String] - $Scope - ) - - $principal = Find-Principal -PrincipalContext $PrincipalContext -IdentityValue $Sid.Value -IdentityType ([System.DirectoryServices.AccountManagement.IdentityType]::Sid) - - if ($null -eq $principal) - { - if (Test-IsLocalMachine -Scope $Scope) - { - New-InvalidArgumentException -ArgumentName 'Members, MembersToInclude, or MembersToExclude' -Message ($script:localizedData.CouldNotFindPrincipal -f $Sid.Value) - } - else - { - New-InvalidArgumentException -ArgumentName 'Members, MembersToInclude, MembersToExclude, or Credential' -Message ($script:localizedData.CouldNotFindPrincipal -f $Sid.Value) - } - } - - return $principal -} - -<# - .SYNOPSIS - Retrieves a PrincipalContext to use to resolve an object in the given scope. - - .PARAMETER Scope - The scope to retrieve the principal context for. - - .PARAMETER Credential - The network credential to use when explicit credentials are needed for the target domain. - - .PARAMETER PrincipalContextCache - A hashtable cache of PrincipalContext instances for each scope. - This is used to cache PrincipalContext instances for cases where it is used multiple times. - - .PARAMETER Disposables - The ArrayList of disposable objects to which to add any objects that need to be disposed. - - .NOTES - When a new PrincipalContext is created, it is added to the Disposables list - as well as the PrincipalContextCache. -#> -function Get-PrincipalContext -{ - [OutputType([System.DirectoryServices.AccountManagement.PrincipalContext])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Scope, - - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [Hashtable] - [AllowEmptyCollection()] - $PrincipalContextCache, - - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [System.Collections.ArrayList] - [AllowEmptyCollection()] - $Disposables - ) - - $principalContext = $null - - if (Test-IsLocalMachine -Scope $Scope) - { - # Check for a cached PrincipalContext for the local machine. - if ($PrincipalContextCache.ContainsKey($env:computerName)) - { - $principalContext = $PrincipalContextCache[$env:computerName] - } - else - { - # Create a PrincipalContext for the local machine - $principalContext = New-Object -TypeName 'System.DirectoryServices.AccountManagement.PrincipalContext' ` - -ArgumentList @( [System.DirectoryServices.AccountManagement.ContextType]::Machine ) - - # Cache the PrincipalContext for this scope for subsequent calls. - $null = $PrincipalContextCache.Add($env:computerName, $principalContext) - $null = $Disposables.Add($principalContext) - } - } - elseif ($PrincipalContextCache.ContainsKey($Scope)) - { - $principalContext = $PrincipalContextCache[$Scope] - } - elseif ($null -ne $Credential) - { - # Create a PrincipalContext targeting $Scope using the network credentials that were passed in. - $credentialDomain = $Credential.GetNetworkCredential().Domain - $credentialUserName = $Credential.GetNetworkCredential().UserName - if ($credentialDomain -ne [String]::Empty) - { - $principalContextName = "$credentialDomain\$credentialUserName" - } - else - { - $principalContextName = $credentialUserName - } - - $principalContext = New-Object -TypeName 'System.DirectoryServices.AccountManagement.PrincipalContext' ` - -ArgumentList @( [System.DirectoryServices.AccountManagement.ContextType]::Domain, $Scope, - $principalContextName, $Credential.GetNetworkCredential().Password ) - - # Cache the PrincipalContext for this scope for subsequent calls. - $null = $PrincipalContextCache.Add($Scope, $principalContext) - $null = $Disposables.Add($principalContext) - } - else - { - # Get a PrincipalContext for the current user in the target domain (even for local System account). - $principalContext = New-Object -TypeName 'System.DirectoryServices.AccountManagement.PrincipalContext' ` - -ArgumentList @( [System.DirectoryServices.AccountManagement.ContextType]::Domain, $Scope ) - - # Cache the PrincipalContext for this scope for subsequent calls. - $null = $PrincipalContextCache.Add($Scope, $principalContext) - $null = $Disposables.Add($principalContext) - } - - return $principalContext -} - -<# - .SYNOPSIS - Determines if a scope represents the current machine. - - .PARAMETER Scope - The scope to test. -#> -function Test-IsLocalMachine -{ - [OutputType([Boolean])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Scope - ) - - $localMachineScopes = @( '.', $env:computerName, 'localhost', '127.0.0.1', 'NT Authority', 'NT Service', 'BuiltIn' ) - - if ($localMachineScopes -icontains $Scope) - { - return $true - } - - <# - Determine if we have an ip address that matches an ip address on one of the network - adapters. This is likely overkill. Consider removing it. - #> - if ($Scope.Contains('.')) - { - $win32NetworkAdapterConfigurations = @( Get-CimInstance -ClassName 'Win32_NetworkAdapterConfiguration' ) - foreach ($win32NetworkAdapterConfiguration in $win32NetworkAdapterConfigurations) - { - if ($null -ne $win32NetworkAdapterConfiguration.IPAddress) - { - foreach ($ipAddress in $win32NetworkAdapterConfiguration.IPAddress) - { - if ($ipAddress -eq $Scope) - { - return $true - } - } - } - } - } - - return $false -} - -<# - .SYNOPSIS - Splits a member name into the scope and the account name. - - - .DESCRIPTION - The returned $scope is used to determine where to perform the resolution, the local machine - or a target domain. The returned $accountName is the name of the account to resolve. - - The following details the formats that are handled as well as how the values are - determined: - - Domain Qualified Names: (domainname\username) - - The value is split on the first '\' character with the left hand side returned as the scope - and the right hand side returned as the account name. - - UPN: (username@domainname) - - The value is split on the first '@' character with the left hand side returned as the - account name and the right hand side returned as the scope. - - Distinguished Name: - - The value at the first occurance of 'DC=' is used to extract the unqualified domain name. - The incoming string is returned, as is, for the account name. - - Unqualified Account Names: - - The incoming string is returned as the account name and the local machine name is returned - as the scope. Note that values that do not fall into the above categories are interpreted - as unqualified account names. - - .PARAMETER MemberName - The full name of the member to split. - - .NOTES - ConvertTo-Principal will fail if a machine name is specified as domainname\machinename. It - will succeed if the machine name is specified as the SAM name (domainname\machinename$) or - as the unqualified machine name. - - Split-MemberName splits the scope and account name to avoid this problem. -#> -function Split-MemberName -{ - [OutputType([System.String[]])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $MemberName - ) - - # Assume no scope is defined or $FullName is a DistinguishedName - $scope = $env:computerName - $accountName = $MemberName - - # Parse domain or machine qualified account name - $separatorIndex = $MemberName.IndexOf('\') - if ($separatorIndex -ne -1) - { - $scope = $MemberName.Substring(0, $separatorIndex) - - if (Test-IsLocalMachine -Scope $scope) - { - $scope = $env:computerName - } - - $accountName = $MemberName.Substring($separatorIndex + 1) - - return [System.String[]] @( $scope, $accountName ) - } - - # Parse UPN for the scope - $separatorIndex = $MemberName.IndexOf('@') - if ($separatorIndex -ne -1) - { - $scope = $MemberName.Substring($separatorIndex + 1) - $accountName = $MemberName.Substring(0, $separatorIndex) - - return [System.String[]] @( $scope, $accountName ) - } - - # Parse distinguished name for the scope - $distinguishedNamePrefix = 'DC=' - - $separatorIndex = $MemberName.IndexOf($distinguishedNamePrefix, [System.StringComparison]::OrdinalIgnoreCase) - if ($separatorIndex -ne -1) - { - <# - For member names in the distinguished name format, the account name returned should be - the entire distinguished name. - See the initialization of $accountName above. - #> - - $startScopeIndex = $separatorIndex + $distinguishedNamePrefix.Length - $endScopeIndex = $MemberName.IndexOf(',', $startScopeIndex) - - if ($endScopeIndex -gt $startScopeIndex) - { - $scopeLength = $endScopeIndex - $separatorIndex - $distinguishedNamePrefix.Length - $scope = $MemberName.Substring($startScopeIndex, $scopeLength) - - return [System.String[]] @( $scope, $accountName ) - } - } - - return [System.String[]] @( $scope, $accountName ) -} - -<# - .SYNOPSIS - Finds a principal by identity. - Wrapper function for testing. - - .PARAMETER PrincipalContext - The principal context to find the principal in. - - .PARAMETER IdentityValue - The identity value to find the principal by (e.g. username). - - .PARAMETER IdentityType - The identity type of the principal to find. -#> -function Find-Principal -{ - [OutputType([System.DirectoryServices.AccountManagement.Principal])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.DirectoryServices.AccountManagement.PrincipalContext] - $PrincipalContext, - - [Parameter(Mandatory = $true)] - [String] - $IdentityValue, - - [System.DirectoryServices.AccountManagement.IdentityType] - $IdentityType - ) - - if ($PSBoundParameters.ContainsKey('IdentityType')) - { - return [System.DirectoryServices.AccountManagement.Principal]::FindByIdentity($PrincipalContext, $IdentityType, $IdentityValue) - } - else - { - return [System.DirectoryServices.AccountManagement.Principal]::FindByIdentity($PrincipalContext, $IdentityValue) - } - -} - -<# - .SYNOPSIS - Retrieves a local Windows group. - - .PARAMETER GroupName - The name of the group to retrieve. - - .PARAMETER Disposables - The ArrayList of disposable objects to which to add any objects that need to be disposed. - - .PARAMETER PrincipalContextCache - A hashtable cache of PrincipalContext instances for each scope. - This is used to cache PrincipalContext instances for cases where it is used multiple times. - - .NOTES - The returned value is NOT added to the $disposables list because the caller may need to - call $group.Delete() which also disposes it. -#> -function Get-Group -{ - [OutputType([System.DirectoryServices.AccountManagement.GroupPrincipal])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $GroupName, - - [Parameter(Mandatory = $true)] - [System.DirectoryServices.AccountManagement.PrincipalContext] - $PrincipalContext - ) - - $principalContext = Get-PrincipalContext ` - -PrincipalContextCache $PrincipalContextCache ` - -Disposables $Disposables ` - -Scope $env:COMPUTERNAME - - try - { - $group = [System.DirectoryServices.AccountManagement.GroupPrincipal]::FindByIdentity($PrincipalContext, $GroupName) - } - catch - { - $group = $null - } - - return $group -} - -<# - .SYNOPSIS - Retrieves the members of a group from the underlying directory entry. - - .PARAMETER Group - The group to retrieve the members of. -#> -function Get-GroupMembersFromDirectoryEntry -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [System.DirectoryServices.AccountManagement.GroupPrincipal] - $Group - ) - - $groupDirectoryEntry = $Group.GetUnderlyingObject() - return $groupDirectoryEntry.Invoke('Members') -} - -<# - .SYNOPSIS - Clears the members of the specified group. - This is a wrapper function for testing purposes. - - .PARAMETER Group - The group to clear the members of. -#> -function Clear-GroupMembers -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [System.DirectoryServices.AccountManagement.GroupPrincipal] - $Group - ) - - $Group.Members.Clear() -} - -<# - .SYNOPSIS - Adds the specified member to the specified group. - This is a wrapper function for testing purposes. - - .PARAMETER Group - The group to add the member to. - - .PARAMETER MemberAsPrincipal - The member to add to the group as a principal. -#> -function Add-GroupMember -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [System.DirectoryServices.AccountManagement.GroupPrincipal] - $Group, - - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [System.DirectoryServices.AccountManagement.Principal] - $MemberAsPrincipal - ) - - $Group.Members.Add($MemberAsPrincipal) -} - -<# - .SYNOPSIS - Removes the specified member from the specified group. - This is a wrapper function for testing purposes. - - .PARAMETER Group - The group to remove the member from. - - .PARAMETER MemberAsPrincipal - The member to remove from the group as a principal. -#> -function Remove-GroupMember -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [System.DirectoryServices.AccountManagement.GroupPrincipal] - $Group, - - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [System.DirectoryServices.AccountManagement.Principal] - $MemberAsPrincipal - ) - - $Group.Members.Remove($MemberAsPrincipal) -} - -<# - .SYNOPSIS - Deletes the specified group. - This is a wrapper function for testing purposes. - - .PARAMETER Group - The group to delete. -#> -function Remove-Group -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [System.DirectoryServices.AccountManagement.GroupPrincipal] - $Group - ) - - $Group.Delete() -} - -<# - .SYNOPSIS - Saves the specified group. - This is a wrapper function for testing purposes. - - .PARAMETER Group - The group to save. -#> -function Save-Group -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [System.DirectoryServices.AccountManagement.GroupPrincipal] - $Group - ) - - $Group.Save() -} - -<# - .SYNOPSIS - Disposes of the contents of an array list containing IDisposable objects. - - .PARAMETER Disosables - The array list of IDisposable Objects to dispose of. -#> -function Remove-DisposableObject -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [System.Collections.ArrayList] - [AllowEmptyCollection()] - $Disposables - ) - - foreach ($disposable in $Disposables) - { - if ($disposable -is [System.IDisposable]) - { - $disposable.Dispose() - } - } -} diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xGroupResource/MSFT_xGroupResource.schema.mof b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xGroupResource/MSFT_xGroupResource.schema.mof deleted file mode 100644 index 7bb15eeb..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xGroupResource/MSFT_xGroupResource.schema.mof +++ /dev/null @@ -1,12 +0,0 @@ - -[ClassVersion("1.0.0"),FriendlyName("xGroup")] -class MSFT_xGroupResource : OMI_BaseResource -{ - [Key, Description("The name of the group to create, modify, or remove.")] String GroupName; - [Write, ValueMap{"Present", "Absent"}, Values{"Present", "Absent"}, Description("Indicates if the group should exist or not.")] String Ensure; - [Write, Description("The description the group should have.")] String Description; - [Write, Description("The members the group should have.")] String Members[]; - [Write, Description("The members the group should include.")] String MembersToInclude[]; - [Write, Description("The members the group should exclude.")] String MembersToExclude[]; - [Write, EmbeddedInstance("MSFT_Credential"), Description("A credential to resolve non-local group members.")] String Credential; -}; diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xGroupResource/en-US/MSFT_xGroupResource.schema.mfl b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xGroupResource/en-US/MSFT_xGroupResource.schema.mfl deleted file mode 100644 index a9784482fc0f6c7b93239de11cca847fdc6be7a7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1694 zcmcgsO;5r=6r8h(|Do}ui5d@H)Dt2aA|HuzBZMFzlC*`igLT_I>Ll@kN@PaUBoEa$7Y=}vS&6A z9i9gK-(`jlvke&$@GN1REIR98V9`F$y4?A+41Vjx+zE$b9EyZKk;NoD4QW-ibK*SV z{+i!{)eP;thg0sWD51s<-EV_u9xAA#NLz(Aby>wT+PK68t}Iszhd3Z2pY>vXJoC6G z8|@SmPuA-y55iEVcbT5I7Tw3XmvVnt1&`iMJTl8WaqYeZF(yvM%PZFfFH6oA{OT_I z^iH^{ -function Get-TargetResource -{ - [OutputType([Hashtable])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $ProductId, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path - ) - - $identifyingNumber = Convert-ProductIdToIdentifyingNumber -ProductId $ProductId - - $packageResourceResult = @{} - - $productEntry = Get-ProductEntry -IdentifyingNumber $identifyingNumber - - if ($null -eq $productEntry) - { - $packageResourceResult = @{ - Ensure = 'Absent' - ProductId = $identifyingNumber - } - - Write-Verbose -Message ($script:localizedData.GetTargetResourceNotFound -f $ProductId) - } - else - { - $packageResourceResult = Get-ProductEntryInfo -ProductEntry $productEntry - $packageResourceResult['ProductId'] = $identifyingNumber - $packageResourceResult['Ensure'] = 'Present' - - Write-Verbose -Message ($script:localizedData.GetTargetResourceFound -f $ProductId) - } - - return $packageResourceResult -} - -<# - .SYNOPSIS - Installs or uninstalls the MSI file at the given path. - - .PARAMETER ProductId - The identifying number used to find the package, usually a GUID. - - .PARAMETER Path - The path to the MSI file to install or uninstall. - - .PARAMETER Ensure - Indicates whether the given MSI file should be installed or uninstalled. - Set this property to Present to install the MSI, and Absent to uninstall - the MSI. - - .PARAMETER Arguments - The arguments to pass to the MSI package during installation or uninstallation - if needed. - - .PARAMETER Credential - The credential of a user account to be used to mount a UNC path if needed. - - .PARAMETER LogPath - The path to the log file to log the output from the MSI execution. - - .PARAMETER FileHash - The expected hash value of the MSI file at the given path. - - .PARAMETER HashAlgorithm - The algorithm used to generate the given hash value. - - .PARAMETER SignerSubject - The subject that should match the signer certificate of the digital signature of the MSI file. - - .PARAMETER SignerThumbprint - The certificate thumbprint that should match the signer certificate of the digital signature of the MSI file. - - .PARAMETER ServerCertificateValidationCallback - PowerShell code to be used to validate SSL certificates for paths using HTTPS. - - .PARAMETER RunAsCredential - The credential of a user account under which to run the installation or uninstallation of the MSI package. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $ProductId, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present', - - [String] - $Arguments, - - [PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [String] - $LogPath, - - [String] - $FileHash, - - [ValidateSet('SHA1', 'SHA256', 'SHA384', 'SHA512', 'MD5', 'RIPEMD160')] - [String] - $HashAlgorithm = 'SHA256', - - [String] - $SignerSubject, - - [String] - $SignerThumbprint, - - [String] - $ServerCertificateValidationCallback, - - [System.Management.Automation.PSCredential] - [System.Management.Automation.CredentialAttribute()] - $RunAsCredential - ) - - $uri = Convert-PathToUri -Path $Path - $identifyingNumber = Convert-ProductIdToIdentifyingNumber -ProductId $ProductId - - # Ensure that the actual file extension is checked if a query string is passed in - if ($null -ne $uri.LocalPath) - { - $uriLocalPath = (Split-Path -Path $uri.LocalPath -Leaf) - Assert-PathExtensionValid -Path $uriLocalPath - } - else - { - Assert-PathExtensionValid -Path $Path - } - - <# - Path gets overwritten in the download code path. Retain the user's original Path so as - to provide a more descriptive error message in case the install succeeds but the named - package can't be found on the system afterward. - #> - $originalPath = $Path - - Write-Verbose -Message $script:localizedData.PackageConfigurationStarting - - $psDrive = $null - $downloadedFileName = $null - - $exitCode = 0 - - try - { - if ($PSBoundParameters.ContainsKey('LogPath')) - { - New-LogFile -LogPath $LogPath - } - - # Download or mount file as necessary - if ($Ensure -eq 'Present') - { - $localPath = $Path - - if ($null -ne $uri.LocalPath) - { - $localPath = $uri.LocalPath - } - - if ($uri.IsUnc) - { - $psDriveArgs = @{ - Name = [Guid]::NewGuid() - PSProvider = 'FileSystem' - Root = Split-Path -Path $localPath - } - - if ($PSBoundParameters.ContainsKey('Credential')) - { - $psDriveArgs['Credential'] = $Credential - } - - $psDrive = New-PSDrive @psDriveArgs - $Path = Join-Path -Path $psDrive.Root -ChildPath (Split-Path -Path $localPath -Leaf) - } - elseif (@( 'http', 'https' ) -contains $uri.Scheme) - { - $outStream = $null - - try - { - if (-not (Test-Path -Path $script:packageCacheLocation -PathType 'Container')) - { - Write-Verbose -Message ($script:localizedData.CreatingCacheLocation) - $null = New-Item -Path $script:packageCacheLocation -ItemType 'Directory' - } - - $destinationPath = Join-Path -Path $script:packageCacheLocation -ChildPath (Split-Path -Path $localPath -Leaf) - - try - { - Write-Verbose -Message ($script:localizedData.CreatingTheDestinationCacheFile) - $outStream = New-Object -TypeName 'System.IO.FileStream' -ArgumentList @( $destinationPath, 'Create' ) - } - catch - { - # Should never happen since we own the cache directory - New-InvalidOperationException -Message ($script:localizedData.CouldNotOpenDestFile -f $destinationPath) -ErrorRecord $_ - } - - try - { - $responseStream = Get-WebRequestResponse -Uri $uri -ServerCertificateValidationCallback $ServerCertificateValidationCallback - - Copy-ResponseStreamToFileStream -ResponseStream $responseStream -FileStream $outStream - } - finally - { - if ($null -ne $responseStream) - { - Close-Stream -Stream $responseStream - } - } - } - finally - { - if ($null -ne $outStream) - { - Close-Stream -Stream $outStream - } - } - - Write-Verbose -Message ($script:localizedData.RedirectingPackagePathToCacheFileLocation) - $Path = $destinationPath - $downloadedFileName = $destinationPath - } - - # At this point the Path should be valid if this is an install case - if (-not (Test-Path -Path $Path -PathType 'Leaf')) - { - New-InvalidOperationException -Message ($script:localizedData.PathDoesNotExist -f $Path) - } - - Assert-FileValid -Path $Path -HashAlgorithm $HashAlgorithm -FileHash $FileHash -SignerSubject $SignerSubject -SignerThumbprint $SignerThumbprint - - # Check if the MSI package specifies the ProductCode, and if so make sure they match - $productCode = Get-MsiProductCode -Path $Path - - if ((-not [String]::IsNullOrEmpty($identifyingNumber)) -and ($identifyingNumber -ne $productCode)) - { - New-InvalidArgumentException -ArgumentName 'ProductId' -Message ($script:localizedData.InvalidId -f $identifyingNumber, $productCode) - } - } - - $exitCode = Start-MsiProcess -IdentifyingNumber $identifyingNumber -Path $Path -Ensure $Ensure -Arguments $Arguments -LogPath $LogPath -RunAsCredential $RunAsCredential - } - finally - { - if ($null -ne $psDrive) - { - $null = Remove-PSDrive -Name $psDrive -Force - } - } - - if ($null -ne $downloadedFileName) - { - <# - This is deliberately not in the finally block because we want to leave the downloaded - file on disk if an error occurred as a debugging aid for the user. - #> - $null = Remove-Item -Path $downloadedFileName - } - - <# - Check if a reboot is required, if so notify CA. The MSFT_ServerManagerTasks provider is - missing on some client SKUs (worked on both Server and Client Skus in Windows 10). - #> - $serverFeatureData = Invoke-CimMethod -Name 'GetServerFeature' ` - -Namespace 'root\microsoft\windows\servermanager' ` - -Class 'MSFT_ServerManagerTasks' ` - -Arguments @{ BatchSize = 256 } ` - -ErrorAction 'Ignore' - - $registryData = Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Name 'PendingFileRenameOperations' -ErrorAction 'Ignore' - - $rebootRequired = (($exitcode -eq 3010) -or ($exitcode -eq 1641) -or ($null -ne $registryData)) - - if (($serverFeatureData -and $serverFeatureData.RequiresReboot) -or $rebootRequired) - { - Write-Verbose $script:localizedData.MachineRequiresReboot - $global:DSCMachineStatus = 1 - } - elseif ($Ensure -eq 'Present') - { - $productEntry = Get-ProductEntry -IdentifyingNumber $identifyingNumber - - if ($null -eq $productEntry) - { - New-InvalidOperationException -Message ($script:localizedData.PostValidationError -f $originalPath) - } - } - - if ($Ensure -eq 'Present') - { - Write-Verbose -Message $script:localizedData.PackageInstalled - } - else - { - Write-Verbose -Message $script:localizedData.PackageUninstalled - } -} - -<# - .SYNOPSIS - Tests if the MSI file with the given product ID is installed or uninstalled. - - .PARAMETER ProductId - The identifying number used to find the package, usually a GUID. - - .PARAMETER Path - Not Used in Test-TargetResource - - .PARAMETER Ensure - Indicates whether the MSI file should be installed or uninstalled. - Set this property to Present if the MSI file should be installed. Set - this property to Absent if the MSI file should be uninstalled. - - .PARAMETER Arguments - Not Used in Test-TargetResource - - .PARAMETER Credential - Not Used in Test-TargetResource - - .PARAMETER LogPath - Not Used in Test-TargetResource - - .PARAMETER FileHash - Not Used in Test-TargetResource - - .PARAMETER HashAlgorithm - Not Used in Test-TargetResource - - .PARAMETER SignerSubject - Not Used in Test-TargetResource - - .PARAMETER SignerThumbprint - Not Used in Test-TargetResource - - .PARAMETER ServerCertificateValidationCallback - Not Used in Test-TargetResource - - .PARAMETER RunAsCredential - Not Used in Test-TargetResource -#> -function Test-TargetResource -{ - [OutputType([Boolean])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $ProductId, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present', - - [String] - $Arguments, - - [PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [String] - $LogPath, - - [String] - $FileHash, - - [ValidateSet('SHA1', 'SHA256', 'SHA384', 'SHA512', 'MD5', 'RIPEMD160')] - [String] - $HashAlgorithm = 'SHA256', - - [String] - $SignerSubject, - - [String] - $SignerThumbprint, - - [String] - $ServerCertificateValidationCallback, - - [System.Management.Automation.PSCredential] - [System.Management.Automation.CredentialAttribute()] - $RunAsCredential - ) - - $identifyingNumber = Convert-ProductIdToIdentifyingNumber -ProductId $ProductId - - $productEntry = Get-ProductEntry -IdentifyingNumber $identifyingNumber - - if ($null -ne $productEntry) - { - $displayName = Get-ProductEntryValue -ProductEntry $productEntry -Property 'DisplayName' - Write-Verbose -Message ($script:localizedData.PackageAppearsInstalled -f $displayName) - } - else - { - Write-Verbose -Message ($script:localizedData.PackageDoesNotAppearInstalled -f $ProductId) - } - - return (($null -ne $productEntry -and $Ensure -eq 'Present') -or ($null -eq $productEntry -and $Ensure -eq 'Absent')) -} - -<# - .SYNOPSIS - Asserts that the path extension is '.msi' - - .PARAMETER Path - The path to the file to validate the extension of. -#> -function Assert-PathExtensionValid -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path - ) - - $pathExtension = [System.IO.Path]::GetExtension($Path) - Write-Verbose -Message ($script:localizedData.ThePathExtensionWasPathExt -f $pathExtension) - - if ($pathExtension.ToLower() -ne '.msi') - { - New-InvalidArgumentException -ArgumentName 'Path' -Message ($script:localizedData.InvalidBinaryType -f $Path) - } -} - -<# - .SYNOPSIS - Converts the given path to a URI and returns the URI object. - Throws an exception if the path's scheme as a URI is not valid. - - .PARAMETER Path - The path to the file to retrieve as a URI. -#> -function Convert-PathToUri -{ - [OutputType([Uri])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path - ) - - try - { - $uri = [Uri]$Path - } - catch - { - New-InvalidArgumentException -ArgumentName 'Path' -Message ($script:localizedData.InvalidPath -f $Path) - } - - $validUriSchemes = @( 'file', 'http', 'https' ) - - if ($validUriSchemes -notcontains $uri.Scheme) - { - Write-Verbose -Message ($script:localizedData.TheUriSchemeWasUriScheme -f $uri.Scheme) - New-InvalidArgumentException -ArgumentName 'Path' -Message ($script:localizedData.InvalidPath -f $Path) - } - - return $uri -} - -<# - .SYNOPSIS - Converts the product ID to the identifying number format. - - .PARAMETER ProductId - The product ID to convert to an identifying number. -#> -function Convert-ProductIdToIdentifyingNumber -{ - [OutputType([String])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $ProductId - ) - - try - { - Write-Verbose -Message ($script:localizedData.ParsingProductIdAsAnIdentifyingNumber -f $ProductId) - $identifyingNumber = '{{{0}}}' -f [Guid]::Parse($ProductId).ToString().ToUpper() - - Write-Verbose -Message ($script:localizedData.ParsedProductIdAsIdentifyingNumber -f $ProductId, $identifyingNumber) - return $identifyingNumber - } - catch - { - New-InvalidArgumentException -ArgumentName 'ProductId' -Message ($script:localizedData.InvalidIdentifyingNumber -f $ProductId) - } -} - - -<# - .SYNOPSIS - Retrieves the product entry for the package with the given identifying number. - - .PARAMETER IdentifyingNumber - The identifying number of the product entry to retrieve. -#> -function Get-ProductEntry -{ - [OutputType([Microsoft.Win32.RegistryKey])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [String] - $IdentifyingNumber - ) - - $uninstallRegistryKey = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall' - $uninstallRegistryKeyWow64 = 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall' - - $productEntry = $null - - if (-not [String]::IsNullOrEmpty($IdentifyingNumber)) - { - $productEntryKeyLocation = Join-Path -Path $uninstallRegistryKey -ChildPath $IdentifyingNumber - $productEntry = Get-Item -Path $productEntryKeyLocation -ErrorAction 'SilentlyContinue' - - if ($null -eq $productEntry) - { - $productEntryKeyLocation = Join-Path -Path $uninstallRegistryKeyWow64 -ChildPath $IdentifyingNumber - $productEntry = Get-Item $productEntryKeyLocation -ErrorAction 'SilentlyContinue' - } - } - - return $productEntry -} - -<# - .SYNOPSIS - Retrieves the information for the given product entry and returns it as a hashtable. - - .PARAMETER ProductEntry - The product entry to retrieve the information for. -#> -function Get-ProductEntryInfo -{ - [OutputType([Hashtable])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [Microsoft.Win32.RegistryKey] - $ProductEntry - ) - - $installDate = Get-ProductEntryValue -ProductEntry $ProductEntry -Property 'InstallDate' - - if ($null -ne $installDate) - { - try - { - $installDate = '{0:d}' -f [DateTime]::ParseExact($installDate, 'yyyyMMdd',[System.Globalization.CultureInfo]::CurrentCulture).Date - } - catch - { - $installDate = $null - } - } - - $publisher = Get-ProductEntryValue -ProductEntry $ProductEntry -Property 'Publisher' - - $estimatedSizeInKB = Get-ProductEntryValue -ProductEntry $ProductEntry -Property 'EstimatedSize' - - if ($null -ne $estimatedSizeInKB) - { - $estimatedSizeInMB = $estimatedSizeInKB / 1024 - } - - $displayVersion = Get-ProductEntryValue -ProductEntry $ProductEntry -Property 'DisplayVersion' - - $comments = Get-ProductEntryValue -ProductEntry $ProductEntry -Property 'Comments' - - $displayName = Get-ProductEntryValue -ProductEntry $ProductEntry -Property 'DisplayName' - - $installSource = Get-ProductEntryValue -ProductEntry $ProductEntry -Property 'InstallSource' - - return @{ - Name = $displayName - InstallSource = $installSource - InstalledOn = $installDate - Size = $estimatedSizeInMB - Version = $displayVersion - PackageDescription = $comments - Publisher = $publisher - } -} - -<# - .SYNOPSIS - Retrieves the value of the given property for the given product entry. - This is a wrapper for unit testing. - - .PARAMETER ProductEntry - The product entry object to retrieve the property value from. - - .PARAMETER Property - The property to retrieve the value of from the product entry. -#> -function Get-ProductEntryValue -{ - [OutputType([Object])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [Microsoft.Win32.RegistryKey] - $ProductEntry, - - [Parameter(Mandatory = $true)] - [String] - $Property - ) - - return $ProductEntry.GetValue($Property) -} - -<# - .SYNOPSIS - Removes the file at the given path if it exists and creates a new file - to be written to. - - .PARAMETER LogPath - The path where the log file should be created. -#> -function New-LogFile -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [String] - $LogPath - ) - - try - { - <# - Pre-verify the log path exists and is writable ahead of time so the user won't - have to detect why the MSI log path doesn't exist. - #> - if (Test-Path -Path $LogPath) - { - $null = Remove-Item -Path $LogPath - } - - $null = New-Item -Path $LogPath -Type 'File' - } - catch - { - New-InvalidOperationException -Message ($script:localizedData.CouldNotOpenLog -f $LogPath) -ErrorRecord $_ - } -} - -<# - .SYNOPSIS - Retrieves the WebRequest response as a stream for the MSI file with the given URI. - - .PARAMETER Uri - The Uri to retrieve the WebRequest from. - - .PARAMETER ServerCertificationValidationCallback - The callback code to validate the SSL certificate for HTTPS URI schemes. -#> -function Get-WebRequestResponse -{ - [OutputType([System.IO.Stream])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [Uri] - $Uri, - - [String] - $ServerCertificateValidationCallback - ) - - try - { - $uriScheme = $Uri.Scheme - - Write-Verbose -Message ($script:localizedData.CreatingTheSchemeStream -f $uriScheme) - $webRequest = Get-WebRequest -Uri $Uri - - Write-Verbose -Message ($script:localizedData.SettingDefaultCredential) - $webRequest.Credentials = [System.Net.CredentialCache]::DefaultCredentials - $webRequest.AuthenticationLevel = [System.Net.Security.AuthenticationLevel]::None - - if ($uriScheme -eq 'http') - { - # Default value is MutualAuthRequested, which applies to the https scheme - Write-Verbose -Message ($script:localizedData.SettingAuthenticationLevel) - $webRequest.AuthenticationLevel = [System.Net.Security.AuthenticationLevel]::None - } - elseif ($uriScheme -eq 'https' -and -not [String]::IsNullOrEmpty($ServerCertificateValidationCallback)) - { - Write-Verbose -Message $script:localizedData.SettingCertificateValidationCallback - $webRequest.ServerCertificateValidationCallBack = (Get-ScriptBlock -FunctionName $ServerCertificateValidationCallback) - } - - Write-Verbose -Message ($script:localizedData.GettingTheSchemeResponseStream -f $uriScheme) - $responseStream = Get-WebRequestResponseStream -WebRequest $webRequest - - return $responseStream - } - catch - { - New-InvalidOperationException -Message ($script:localizedData.CouldNotGetResponseFromWebRequest -f $uriScheme, $Uri.OriginalString) -ErrorRecord $_ - } -} - -<# - .SYNOPSIS - Creates a WebRequst object based on the given Uri and returns it. - This is a wrapper for unit testing - - .PARAMETER Uri - The URI object to create the WebRequest from -#> -function Get-WebRequest -{ - [OutputType([System.Net.WebRequest])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [Uri] - $Uri - ) - - return [System.Net.WebRequest]::Create($Uri) -} - -<# - .SYNOPSIS - Retrieves the response stream from the given WebRequest object. - This is a wrapper for unit testing. - - .PARAMETER WebRequest - The WebRequest object to retrieve the response stream from. -#> -function Get-WebRequestResponseStream -{ - [OutputType([System.IO.Stream])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.Net.WebRequest] - $WebRequest - ) - - return (([System.Net.HttpWebRequest]$WebRequest).GetResponse()).GetResponseStream() -} - -<# - .SYNOPSIS - Converts the given function into a script block and returns it. - This is a wrapper for unit testing - - .PARAMETER Function - The name of the function to convert to a script block -#> -function Get-ScriptBlock -{ - [OutputType([ScriptBlock])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [String] - $FunctionName - ) - - return [ScriptBlock]::Create($FunctionName) -} - -<# - .SYNOPSIS - Copies the given response stream to the given file stream. - - .PARAMETER ResponseStream - The response stream to copy over. - - .PARAMETER FileStream - The file stream to copy to. -#> -function Copy-ResponseStreamToFileStream -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.IO.Stream] - $ResponseStream, - - [Parameter(Mandatory = $true)] - [System.IO.Stream] - $FileStream - ) - - try - { - Write-Verbose -Message ($script:localizedData.CopyingTheSchemeStreamBytesToTheDiskCache) - $null = $ResponseStream.CopyTo($FileStream) - $null = $ResponseStream.Flush() - $null = $FileStream.Flush() - } - catch - { - New-InvalidOperationException -Message ($script:localizedData.ErrorCopyingDataToFile) -ErrorRecord $_ - } -} - -<# - .SYNOPSIS - Closes the given stream. - Wrapper function for unit testing. - - .PARAMETER Stream - The stream to close. -#> -function Close-Stream -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.IO.Stream] - $Stream - ) - - $null = $Stream.Close() -} - -<# - .SYNOPSIS - Asserts that the file at the given path has a valid hash, signer thumbprint, and/or - signer subject. If only Path is provided, then this function will never throw. - If FileHash is provided and HashAlgorithm is not, then Sha-256 will be used as the hash - algorithm by default. - - .PARAMETER Path - The path to the file to check. - - .PARAMETER FileHash - The hash that should match the hash of the file. - - .PARAMETER HashAlgorithm - The algorithm to use to retrieve the file hash. - - .PARAMETER SignerThumbprint - The certificate thumbprint that should match the file's signer certificate. - - .PARAMETER SignerSubject - The certificate subject that should match the file's signer certificate. -#> -function Assert-FileValid -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [String] - $Path, - - [String] - $FileHash, - - [String] - $HashAlgorithm = 'SHA256', - - [String] - $SignerThumbprint, - - [String] - $SignerSubject - ) - - if (-not [String]::IsNullOrEmpty($FileHash)) - { - Assert-FileHashValid -Path $Path -Hash $FileHash -Algorithm $HashAlgorithm - } - - if (-not [String]::IsNullOrEmpty($SignerThumbprint) -or -not [String]::IsNullOrEmpty($SignerSubject)) - { - Assert-FileSignatureValid -Path $Path -Thumbprint $SignerThumbprint -Subject $SignerSubject - } -} - -<# - .SYNOPSIS - Asserts that the hash of the file at the given path matches the given hash. - - .PARAMETER Path - The path to the file to check the hash of. - - .PARAMETER Hash - The hash to check against. - - .PARAMETER Algorithm - The algorithm to use to retrieve the file's hash. - Default is 'Sha256' -#> -function Assert-FileHashValid -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [String] - $Path, - - [Parameter(Mandatory = $true)] - [String] - $Hash, - - [String] - $Algorithm = 'SHA256' - ) - - Write-Verbose -Message ($script:localizedData.CheckingFileHash -f $Path, $Hash, $Algorithm) - - $fileHash = Get-FileHash -LiteralPath $Path -Algorithm $Algorithm - - if ($fileHash.Hash -ne $Hash) - { - New-InvalidArgumentException -ArgumentName 'FileHash' -Message ($script:localizedData.InvalidFileHash -f $Path, $Hash, $Algorithm) - } -} - -<# - .SYNOPSIS - Asserts that the signature of the file at the given path is valid. - - .PARAMETER Path - The path to the file to check the signature of - - .PARAMETER Thumbprint - The certificate thumbprint that should match the file's signer certificate. - - .PARAMETER Subject - The certificate subject that should match the file's signer certificate. -#> -function Assert-FileSignatureValid -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [String] - $Path, - - [String] - $Thumbprint, - - [String] - $Subject - ) - - Write-Verbose -Message ($script:localizedData.CheckingFileSignature -f $Path) - - $signature = Get-AuthenticodeSignature -LiteralPath $Path - - if ($signature.Status -ne [System.Management.Automation.SignatureStatus]::Valid) - { - New-InvalidArgumentException -ArgumentName 'Path' -Message ($script:localizedData.InvalidFileSignature -f $Path, $signature.Status) - } - else - { - Write-Verbose -Message ($script:localizedData.FileHasValidSignature -f $Path, $signature.SignerCertificate.Thumbprint, $signature.SignerCertificate.Subject) - } - - if (-not [String]::IsNullOrEmpty($Subject) -and ($signature.SignerCertificate.Subject -notlike $Subject)) - { - New-InvalidArgumentException -ArgumentName 'SignerSubject' -Message ($script:localizedData.WrongSignerSubject -f $Path, $Subject) - } - - if (-not [String]::IsNullOrEmpty($Thumbprint) -and ($signature.SignerCertificate.Thumbprint -ne $Thumbprint)) - { - New-InvalidArgumentException -ArgumentName 'SignerThumbprint' -Message ($script:localizedData.WrongSignerThumbprint -f $Path, $Thumbprint) - } -} - -<# - .SYNOPSIS - Starts the given MSI installation or uninstallation either as a process or - under a user credential if RunAsCredential is specified. - - .PARAMETER IdentifyingNumber - The identifying number used to find the package. - - .PARAMETER Path - The path to the MSI file to install or uninstall. - - .PARAMETER Ensure - Indicates whether the given MSI file should be installed or uninstalled. - - .PARAMETER Arguments - The arguments to pass to the MSI package. - - .PARAMETER LogPath - The path to the log file to log the output from the MSI execution. - - .PARAMETER RunAsCredential - The credential of a user account under which to run the installation or uninstallation. -#> -function Start-MsiProcess -{ - [OutputType([Int32])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $IdentifyingNumber, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present', - - [String] - $Arguments, - - [String] - $LogPath, - - [System.Management.Automation.PSCredential] - [System.Management.Automation.CredentialAttribute()] - $RunAsCredential - ) - - $startInfo = New-Object -TypeName 'System.Diagnostics.ProcessStartInfo' - - # Necessary for I/O redirection - $startInfo.UseShellExecute = $false - - $startInfo.FileName = "$env:winDir\system32\msiexec.exe" - - if ($Ensure -eq 'Present') - { - $startInfo.Arguments = '/i "{0}"' -f $Path - } - # Ensure -eq 'Absent' - else - { - $productEntry = Get-ProductEntry -IdentifyingNumber $identifyingNumber - - $id = Split-Path -Path $productEntry.Name -Leaf - $startInfo.Arguments = ('/x{0}' -f $id) - } - - if (-not [String]::IsNullOrEmpty($LogPath)) - { - $startInfo.Arguments += (' /log "{0}"' -f $LogPath) - } - - $startInfo.Arguments += ' /quiet /norestart' - - if (-not [String]::IsNullOrEmpty($Arguments)) - { - # Append any specified arguments with a space - $startInfo.Arguments += (' {0}' -f $Arguments) - } - - Write-Verbose -Message ($script:localizedData.StartingWithStartInfoFileNameStartInfoArguments -f $startInfo.FileName, $startInfo.Arguments) - - $exitCode = 0 - - try - { - if (-not [String]::IsNullOrEmpty($RunAsCredential)) - { - $commandLine = ('"{0}" {1}' -f $startInfo.FileName, $startInfo.Arguments) - $exitCode = Invoke-PInvoke -CommandLine $commandLine -RunAsCredential $RunAsCredential - } - else - { - $process = New-Object -TypeName 'System.Diagnostics.Process' - $process.StartInfo = $startInfo - $exitCode = Invoke-Process -Process $process - } - } - catch - { - New-InvalidOperationException -Message ($script:localizedData.CouldNotStartProcess -f $Path) -ErrorRecord $_ - } - - return $exitCode -} - -<# - .SYNOPSIS - Runs a process as the specified user via PInvoke. Returns the exitCode that - PInvoke returns. - - .PARAMETER CommandLine - The command line (including arguments) of the process to start. - - .PARAMETER RunAsCredential - The user credential to start the process as. -#> -function Invoke-PInvoke -{ - [OutputType([System.Int32])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [String] - $CommandLine, - - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - [System.Management.Automation.CredentialAttribute()] - $RunAsCredential - ) - - Register-PInvoke - [System.Int32] $exitCode = 0 - - $null = [Source.NativeMethods]::CreateProcessAsUser($CommandLine, ` - $RunAsCredential.GetNetworkCredential().Domain, ` - $RunAsCredential.GetNetworkCredential().UserName, ` - $RunAsCredential.GetNetworkCredential().Password, ` - [ref] $exitCode - ) - - return $exitCode -} - -<# - .SYNOPSIS - Starts and waits for a process. - - .PARAMETER Process - The System.Diagnositics.Process object to start. -#> -function Invoke-Process -{ - [OutputType([System.Int32])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.Diagnostics.Process] - $Process - ) - - $null = $Process.Start() - - $null = $Process.WaitForExit() - return $Process.ExitCode -} - -<# - .SYNOPSIS - Retrieves product code from the MSI at the given path. - - .PARAMETER Path - The path to the MSI to retrieve the product code from. -#> -function Get-MsiProductCode -{ - [OutputType([String])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path - ) - - $msiTools = Get-MsiTool - - $productCode = $msiTools::GetProductCode($Path) - - return $productCode -} - -<# - .SYNOPSIS - Retrieves the MSI tools type. -#> -function Get-MsiTool -{ - [OutputType([System.Type])] - [CmdletBinding()] - param () - - # Check if the variable is already defined - if ($null -ne $script:msiTools) - { - return $script:msiTools - } - - $msiToolsCodeDefinition = @' - [DllImport("msi.dll", CharSet = CharSet.Unicode, PreserveSig = true, SetLastError = true, ExactSpelling = true)] - private static extern UInt32 MsiOpenPackageExW(string szPackagePath, int dwOptions, out IntPtr hProduct); - [DllImport("msi.dll", CharSet = CharSet.Unicode, PreserveSig = true, SetLastError = true, ExactSpelling = true)] - private static extern uint MsiCloseHandle(IntPtr hAny); - [DllImport("msi.dll", CharSet = CharSet.Unicode, PreserveSig = true, SetLastError = true, ExactSpelling = true)] - private static extern uint MsiGetPropertyW(IntPtr hAny, string name, StringBuilder buffer, ref int bufferLength); - private static string GetPackageProperty(string msi, string property) - { - IntPtr MsiHandle = IntPtr.Zero; - try - { - var res = MsiOpenPackageExW(msi, 1, out MsiHandle); - if (res != 0) - { - return null; - } - int length = 256; - var buffer = new StringBuilder(length); - res = MsiGetPropertyW(MsiHandle, property, buffer, ref length); - return buffer.ToString(); - } - finally - { - if (MsiHandle != IntPtr.Zero) - { - MsiCloseHandle(MsiHandle); - } - } - } - public static string GetProductCode(string msi) - { - return GetPackageProperty(msi, "ProductCode"); - } - public static string GetProductName(string msi) - { - return GetPackageProperty(msi, "ProductName"); - } -'@ - - # Check if the the type is already defined - if (([System.Management.Automation.PSTypeName]'Microsoft.Windows.DesiredStateConfiguration.xPackageResource.MsiTools').Type) - { - $script:msiTools = ([System.Management.Automation.PSTypeName]'Microsoft.Windows.DesiredStateConfiguration.xPackageResource.MsiTools').Type - } - else - { - $script:msiTools = Add-Type ` - -Namespace 'Microsoft.Windows.DesiredStateConfiguration.xPackageResource' ` - -Name 'MsiTools' ` - -Using 'System.Text' ` - -MemberDefinition $msiToolsCodeDefinition ` - -PassThru - } - - return $script:msiTools -} - -<# - .SYNOPSIS - Registers PInvoke to run a process as a user. -#> -function Register-PInvoke -{ - [CmdletBinding()] - param () - - $programSource = @' - using System; - using System.Collections.Generic; - using System.Text; - using System.Security; - using System.Runtime.InteropServices; - using System.Diagnostics; - using System.Security.Principal; - using System.ComponentModel; - using System.IO; - namespace Source - { - [SuppressUnmanagedCodeSecurity] - public static class NativeMethods - { - //The following structs and enums are used by the various Win32 API's that are used in the code below - [StructLayout(LayoutKind.Sequential)] - public struct STARTUPINFO - { - public Int32 cb; - public string lpReserved; - public string lpDesktop; - public string lpTitle; - public Int32 dwX; - public Int32 dwY; - public Int32 dwXSize; - public Int32 dwXCountChars; - public Int32 dwYCountChars; - public Int32 dwFillAttribute; - public Int32 dwFlags; - public Int16 wShowWindow; - public Int16 cbReserved2; - public IntPtr lpReserved2; - public IntPtr hStdInput; - public IntPtr hStdOutput; - public IntPtr hStdError; - } - [StructLayout(LayoutKind.Sequential)] - public struct PROCESS_INFORMATION - { - public IntPtr hProcess; - public IntPtr hThread; - public Int32 dwProcessID; - public Int32 dwThreadID; - } - [Flags] - public enum LogonType - { - LOGON32_LOGON_INTERACTIVE = 2, - LOGON32_LOGON_NETWORK = 3, - LOGON32_LOGON_BATCH = 4, - LOGON32_LOGON_SERVICE = 5, - LOGON32_LOGON_UNLOCK = 7, - LOGON32_LOGON_NETWORK_CLEARTEXT = 8, - LOGON32_LOGON_NEW_CREDENTIALS = 9 - } - [Flags] - public enum LogonProvider - { - LOGON32_PROVIDER_DEFAULT = 0, - LOGON32_PROVIDER_WINNT35, - LOGON32_PROVIDER_WINNT40, - LOGON32_PROVIDER_WINNT50 - } - [StructLayout(LayoutKind.Sequential)] - public struct SECURITY_ATTRIBUTES - { - public Int32 Length; - public IntPtr lpSecurityDescriptor; - public bool bInheritHandle; - } - public enum SECURITY_IMPERSONATION_LEVEL - { - SecurityAnonymous, - SecurityIdentification, - SecurityImpersonation, - SecurityDelegation - } - public enum TOKEN_TYPE - { - TokenPrimary = 1, - TokenImpersonation - } - [StructLayout(LayoutKind.Sequential, Pack = 1)] - internal struct TokPriv1Luid - { - public int Count; - public long Luid; - public int Attr; - } - public const int GENERIC_ALL_ACCESS = 0x10000000; - public const int CREATE_NO_WINDOW = 0x08000000; - internal const int SE_PRIVILEGE_ENABLED = 0x00000002; - internal const int TOKEN_QUERY = 0x00000008; - internal const int TOKEN_ADJUST_PRIVILEGES = 0x00000020; - internal const string SE_INCRASE_QUOTA = "SeIncreaseQuotaPrivilege"; - [DllImport("kernel32.dll", - EntryPoint = "CloseHandle", SetLastError = true, - CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] - public static extern bool CloseHandle(IntPtr handle); - [DllImport("advapi32.dll", - EntryPoint = "CreateProcessAsUser", SetLastError = true, - CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] - public static extern bool CreateProcessAsUser( - IntPtr hToken, - string lpApplicationName, - string lpCommandLine, - ref SECURITY_ATTRIBUTES lpProcessAttributes, - ref SECURITY_ATTRIBUTES lpThreadAttributes, - bool bInheritHandle, - Int32 dwCreationFlags, - IntPtr lpEnvrionment, - string lpCurrentDirectory, - ref STARTUPINFO lpStartupInfo, - ref PROCESS_INFORMATION lpProcessInformation - ); - [DllImport("advapi32.dll", EntryPoint = "DuplicateTokenEx")] - public static extern bool DuplicateTokenEx( - IntPtr hExistingToken, - Int32 dwDesiredAccess, - ref SECURITY_ATTRIBUTES lpThreadAttributes, - Int32 ImpersonationLevel, - Int32 dwTokenType, - ref IntPtr phNewToken - ); - [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] - public static extern Boolean LogonUser( - String lpszUserName, - String lpszDomain, - String lpszPassword, - LogonType dwLogonType, - LogonProvider dwLogonProvider, - out IntPtr phToken - ); - [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)] - internal static extern bool AdjustTokenPrivileges( - IntPtr htok, - bool disall, - ref TokPriv1Luid newst, - int len, - IntPtr prev, - IntPtr relen - ); - [DllImport("kernel32.dll", ExactSpelling = true)] - internal static extern IntPtr GetCurrentProcess(); - [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)] - internal static extern bool OpenProcessToken( - IntPtr h, - int acc, - ref IntPtr phtok - ); - [DllImport("kernel32.dll", ExactSpelling = true)] - internal static extern int WaitForSingleObject( - IntPtr h, - int milliseconds - ); - [DllImport("kernel32.dll", ExactSpelling = true)] - internal static extern bool GetExitCodeProcess( - IntPtr h, - out int exitcode - ); - [DllImport("advapi32.dll", SetLastError = true)] - internal static extern bool LookupPrivilegeValue( - string host, - string name, - ref long pluid - ); - public static void CreateProcessAsUser(string strCommand, string strDomain, string strName, string strPassword, ref int ExitCode ) - { - var hToken = IntPtr.Zero; - var hDupedToken = IntPtr.Zero; - TokPriv1Luid tp; - var pi = new PROCESS_INFORMATION(); - var sa = new SECURITY_ATTRIBUTES(); - sa.Length = Marshal.SizeOf(sa); - Boolean bResult = false; - try - { - bResult = LogonUser( - strName, - strDomain, - strPassword, - LogonType.LOGON32_LOGON_BATCH, - LogonProvider.LOGON32_PROVIDER_DEFAULT, - out hToken - ); - if (!bResult) - { - throw new Win32Exception("Logon error #" + Marshal.GetLastWin32Error().ToString()); - } - IntPtr hproc = GetCurrentProcess(); - IntPtr htok = IntPtr.Zero; - bResult = OpenProcessToken( - hproc, - TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, - ref htok - ); - if(!bResult) - { - throw new Win32Exception("Open process token error #" + Marshal.GetLastWin32Error().ToString()); - } - tp.Count = 1; - tp.Luid = 0; - tp.Attr = SE_PRIVILEGE_ENABLED; - bResult = LookupPrivilegeValue( - null, - SE_INCRASE_QUOTA, - ref tp.Luid - ); - if(!bResult) - { - throw new Win32Exception("Lookup privilege error #" + Marshal.GetLastWin32Error().ToString()); - } - bResult = AdjustTokenPrivileges( - htok, - false, - ref tp, - 0, - IntPtr.Zero, - IntPtr.Zero - ); - if(!bResult) - { - throw new Win32Exception("Token elevation error #" + Marshal.GetLastWin32Error().ToString()); - } - bResult = DuplicateTokenEx( - hToken, - GENERIC_ALL_ACCESS, - ref sa, - (int)SECURITY_IMPERSONATION_LEVEL.SecurityIdentification, - (int)TOKEN_TYPE.TokenPrimary, - ref hDupedToken - ); - if(!bResult) - { - throw new Win32Exception("Duplicate Token error #" + Marshal.GetLastWin32Error().ToString()); - } - var si = new STARTUPINFO(); - si.cb = Marshal.SizeOf(si); - si.lpDesktop = ""; - bResult = CreateProcessAsUser( - hDupedToken, - null, - strCommand, - ref sa, - ref sa, - false, - 0, - IntPtr.Zero, - null, - ref si, - ref pi - ); - if(!bResult) - { - throw new Win32Exception("Create process as user error #" + Marshal.GetLastWin32Error().ToString()); - } - int status = WaitForSingleObject(pi.hProcess, -1); - if(status == -1) - { - throw new Win32Exception("Wait during create process failed user error #" + Marshal.GetLastWin32Error().ToString()); - } - bResult = GetExitCodeProcess(pi.hProcess, out ExitCode); - if(!bResult) - { - throw new Win32Exception("Retrieving status error #" + Marshal.GetLastWin32Error().ToString()); - } - } - finally - { - if (pi.hThread != IntPtr.Zero) - { - CloseHandle(pi.hThread); - } - if (pi.hProcess != IntPtr.Zero) - { - CloseHandle(pi.hProcess); - } - if (hDupedToken != IntPtr.Zero) - { - CloseHandle(hDupedToken); - } - } - } - } - } -'@ - $null = Add-Type -TypeDefinition $programSource -ReferencedAssemblies 'System.ServiceProcess' -} diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xMsiPackage/MSFT_xMsiPackage.schema.mof b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xMsiPackage/MSFT_xMsiPackage.schema.mof deleted file mode 100644 index 314ba8fd..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xMsiPackage/MSFT_xMsiPackage.schema.mof +++ /dev/null @@ -1,23 +0,0 @@ -[ClassVersion("1.0.0"),FriendlyName("xMsiPackage")] -class MSFT_xMsiPackage : OMI_BaseResource -{ - [Key, Description("The identifying number used to find the package, usually a GUID.")] String ProductId; - [Required, Description("The path to the MSI file that should be installed or uninstalled.")] String Path; - [Write, Description("Specifies whether or not the MSI file should be installed or uninstalled."), ValueMap{"Present", "Absent"}, Values{"Present", "Absent"}] String Ensure; - [Write, Description("The arguments to be passed to the MSI package during installation or uninstallation.")] String Arguments; - [Write, Description("The credential of a user account to be used to mount a UNC path if needed."), EmbeddedInstance("MSFT_Credential")] String Credential; - [Write, Description("The path to the log file to log the output from the MSI execution.")] String LogPath; - [Write, Description("The expected hash value of the MSI file at the given path.")] String FileHash; - [Write, Description("The algorithm used to generate the given hash value."), ValueMap{"SHA1", "SHA256", "SHA384", "SHA512", "MD5", "RIPEMD160"}, Values{"SHA1", "SHA256", "SHA384", "SHA512", "MD5", "RIPEMD160"}] String HashAlgorithm; - [Write, Description("The subject that should match the signer certificate of the digital signature of the MSI file.")] String SignerSubject; - [Write, Description("The certificate thumbprint that should match the signer certificate of the digital signature of the MSI file.")] String SignerThumbprint; - [Write, Description("PowerShell code that should be used to validate SSL certificates for paths using HTTPS.")] String ServerCertificateValidationCallback; - [Write, Description("The credential of a user account under which to run the installation or uninstallation of the MSI package."), EmbeddedInstance("MSFT_Credential")] String RunAsCredential; - [Read, Description("The display name of the MSI package.")] String Name; - [Read, Description("The path to the MSI package.")] String InstallSource; - [Read, Description("The date that the MSI package was installed on or serviced on, whichever is later.")] String InstalledOn; - [Read, Description("The size of the MSI package in MB.")] UInt32 Size; - [Read, Description("The version number of the MSI package.")] String Version; - [Read, Description("The description of the MSI package.")] String PackageDescription; - [Read, Description("The publisher of the MSI package.")] String Publisher; -}; diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xMsiPackage/en-US/MSFT_xMsiPackage.schema.mfl b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xMsiPackage/en-US/MSFT_xMsiPackage.schema.mfl deleted file mode 100644 index 79cf61d24e274f2c05fa4abd0461103be74c4768..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4568 zcmc(jNpBND5QXcE#D5rZ3Q~j+n*^Lp5=2BoEbPDmp~#7s7`!odSjArl-q$tFcn#B_ z2q9;d?yi3I>Q!|OKYzTjUF+D?&MddSO>CyWV;k9)-LR&eYb>+RcBmPBt6NL+-s^8K zywAhRv0Z5GS$NaeyiCtiJ+*Z=lda5#S~2>)>d+dtueV)U90UuuwAW3&d8A)WvpbsI z4i>icd}w?2LMZ*(v~A5gup`^i*n!4Cip>+dXSeNPu=Q4RuG=-C8ff2XK*gM=^66xw zKkR=bTl<>xB&_S$%Yd--5v$*V?M$=Z*mI445vD)0*bhF90>fRc>C4NWY>dR$&`xD1 z*V8h07aH%|2fgpemoJ*JYzLOl^%mwQLS05^6RWV(&?+MC80xwo3*UuS&*XpG9?$vs zXW!Tt6vXCOoE_*o4*nb~b~^tmG#y_6bi=^2h=1&J)c%utMcl;?v4A8RW}(>$f3 z;f2SfA9g2J^WK)()-7TNQgRM2JU62Et4iL|oUSakq~eKubA6rauA_QZJ^OanAWic% z=3n$~ATOvb5j#H3gpt3*1=MlO>v46o2f=n-USlB*XGgVnB6g@UuCR02naWO9=z}`9 zj4+-QoEaV+&KBZRdJ*wtVt-uZxu0a4PnXradMc|#?^%H=%{%nn)9&O1+zf@URG90I zlXIkB9{7tjhU@a)^Nifmcoxo>vVN3WZU}G9?$~{Mkf6HgV{HX>n%7jzQ+p?$h^j}# zYvwR`&pSGRnZ~{Td*!F2=oMUK8iNzEj%dd^y{rW4OHaR<>PUCBnrzpldfr+r9ZkXegf)AMcKYUiN4D$>% z*LYKnr+N{cTs;a(AztW%{)7lFXOy2SbVaCu84dlT16j{BYVZp9Ox<8pr*I=!&BH$4 zEk>I|oP`HpEgy~===ulMDz%5?0P;a&W8d==sycTPi1MOyv8hpWwNDtTEC hcGn_E^MbybuAeGJC8Ea0?}@9)|N6>~j`(|_?qBd+6#4)F diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xMsiPackage/en-US/MSFT_xMsiPackage.strings.psd1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xMsiPackage/en-US/MSFT_xMsiPackage.strings.psd1 deleted file mode 100644 index ccb92120..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xMsiPackage/en-US/MSFT_xMsiPackage.strings.psd1 +++ /dev/null @@ -1,44 +0,0 @@ -# Localized resources for MSFT_xMsiPackage - -ConvertFrom-StringData @' - CheckingFileHash = Checking file '{0}' for expected {2} hash value of {1} - CheckingFileSignature = Checking file '{0}' for valid digital signature - CopyingTheSchemeStreamBytesToTheDiskCache = Copying the stream bytes to the disk cache - CouldNotGetResponseFromWebRequest = An error occurred while trying to get the {0} response for file {1} - CouldNotOpenDestFile = Could not open the file {0} for writing - CouldNotOpenLog = The specified LogPath ({0}) could not be opened - CouldNotStartProcess = The process {0} could not be started - CreatingCacheLocation = Creating cache location - CreatingTheDestinationCacheFile = Creating the destination cache file - CreatingTheSchemeStream = Creating the {0} stream - ErrorCopyingDataToFile = Encountered an error while copying the response to the output stream - FileHasValidSignature = File '{0}' contains a valid digital signature. Signer Thumbprint: {1}, Subject: {2} - GetTargetResourceFound = Successfully retrieved package {0} - GetTargetResourceNotFound = Unable to find package: {0} - GettingTheSchemeResponseStream = Getting the {0} response stream - InvalidBinaryType = The specified Path ({0}) does not appear to specify an MSI file and as such is not supported - InvalidFileHash = File '{0}' does not match expected {2} hash value of {1} - InvalidFileSignature = File '{0}' does not have a valid Authenticode signature. Status: {1} - InvalidId = The specified IdentifyingNumber ({0}) does not match the IdentifyingNumber ({1}) in the MSI file - InvalidIdentifyingNumber = The specified IdentifyingNumber ({0}) is not a valid GUID - InvalidPath = The specified Path ({0}) is not in a valid format. Valid formats are local paths, UNC, HTTP, and HTTPS - MachineRequiresReboot = The machine requires a reboot - PackageAppearsInstalled = The package {0} is installed - PackageConfigurationStarting = Package configuration starting - PackageDoesNotAppearInstalled = The package {0} is not installed - PathDoesNotExist = The given Path ({0}) could not be found - PackageInstalled = Package has been installed - PackageUninstalled = Package has been uninstalled - ParsedProductIdAsIdentifyingNumber = Parsed {0} as {1} - ParsingProductIdAsAnIdentifyingNumber = Parsing {0} as an identifyingNumber - PostValidationError = Package from {0} was installed, but the specified ProductId does not match package details - RedirectingPackagePathToCacheFileLocation = Redirecting package path to cache file location - SettingAuthenticationLevel = Setting authentication level to None - SettingCertificateValidationCallback = Assigning user-specified certificate verification callback - SettingDefaultCredential = Setting default credential - StartingWithStartInfoFileNameStartInfoArguments = Starting {0} with {1} - ThePathExtensionWasPathExt = The path extension was {0} - TheUriSchemeWasUriScheme = The uri scheme was {0} - WrongSignerSubject = File '{0}' was not signed by expected signer subject '{1}' - WrongSignerThumbprint = File '{0}' was not signed by expected signer certificate thumbprint '{1}' -'@ diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xPSSessionConfiguration/MSFT_xPSSessionConfiguration.psm1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xPSSessionConfiguration/MSFT_xPSSessionConfiguration.psm1 deleted file mode 100644 index f9539faf..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xPSSessionConfiguration/MSFT_xPSSessionConfiguration.psm1 +++ /dev/null @@ -1,796 +0,0 @@ -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData @' -CheckEndpointMessage = Checking if session configuration {0} exists ... -EndpointNameMessage = Session configuration {0} is {1} - -CheckPropertyMessage = Checking if session configuration {0} is {1} ... -NotDesiredPropertyMessage = Session configuration {0} is NOT {1}, but {2} -DesiredPropertyMessage = Session configuration {0} is {1} -SetPropertyMessage = Session configuration {0} is now {1} - -WhitespacedStringMessage = The session configuration {0} should not be white-spaced string -StartupPathNotFoundMessage = Startup path {0} not found -EmptyCredentialMessage = The value of RunAsCredential can not be an empty credential -WrongStartupScriptExtensionMessage = The startup script should have a 'ps1' extension, and not '{0}' - -GetTargetResourceStartMessage = Begin executing Get functionality on the session configuration {0}. -GetTargetResourceEndMessage = End executing Get functionality on the session configuration {0}. -SetTargetResourceStartMessage = Begin executing Set functionality on the session configuration {0}. -SetTargetResourceEndMessage = End executing Set functionality on the session configuration {0}. -TestTargetResourceStartMessage = Begin executing Test functionality on the session configuration {0}. -TestTargetResourceEndMessage = End executing Test functionality on the session configuration {0}. - -EnsureSessionConfigurationMessage = Ensure the specified session configuration is "{0}" -'@ -} - -<# - .SYNOPSIS - Returns the current state of the specified PSSessionConfiguration - - .PARAMETER Name - Specifies the name of the session configuration. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [String] - $Name - ) - - Write-Verbose ($LocalizedData.GetTargetResourceStartMessage -f $Name) - - # Try getting the specified endpoint - $endpoint = Get-PSSessionConfiguration -Name $Name -ErrorAction SilentlyContinue -Verbose:$false - - # If endpoint is null, it is absent - if ($null -eq $endpoint) - { - $ensure = 'Absent' - } - - # If endpoint is present, check other properties - else - { - $ensure = 'Present' - - # If runAsUser is specified, return only the username in the credential property - if ($endpoint.RunAsUser) - { - $newCimInstanceParams = @{ - ClassName = 'MSFT_Credential' - Property = @{ - Username = [String] $endpoint.RunAsUser - Password = [String] $null - } - Namespace = 'root/microsoft/windows/desiredstateconfiguration' - ClientOnly = $true - } - $convertToCimCredential = New-CimInstance @newCimInstanceParams - } - $accessMode = Get-EndpointAccessMode -Endpoint $endpoint - } - - @{ - Name = $Name - RunAsCredential = [CimInstance]$convertToCimCredential - SecurityDescriptorSDDL = $endpoint.Permission - StartupScript = $endpoint.StartupScript - AccessMode = $accessMode - Ensure = $ensure - } - - Write-Verbose ($LocalizedData.GetTargetResourceEndMessage -f $Name) -} - -<# - .SYNOPSIS - Ensures the specified PSSessionConfiguration is in its desired state - - .PARAMETER Name - Specifies the name of the session configuration. - - .PARAMETER StartupScript - Specifies the startup script for the configuration. - Enter the fully qualified path of a Windows PowerShell script. - - .PARAMETER RunAsCredential - Specifies the credential for commands of this session configuration. - - .PARAMETER SecurityDescriptorSDDL - Specifies the Security Descriptor Definition Language (SDDL) string for the configuration. - - .PARAMETER AccessMode - Enables and disables the session configuration and determines whether it can be used for - remote or local sessions on the computer. - - The acceptable values for this parameter are: - - Disabled - - Local - - Remote - - The default value is "Remote". - - .PARAMETER Ensure - Indicates if the session configuration should exist. - - To ensure that it does, set this property to "Present". - To ensure that it does not exist, set the property to "Absent". - - The default value is "Present". -#> -function Set-TargetResource -{ - [CmdletBinding(SupportsShouldProcess = $true)] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars','')] - param - ( - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [String] - $Name, - - [AllowEmptyString()] - [String] - $StartupScript, - - [PSCredential] - $RunAsCredential, - - [String] - $SecurityDescriptorSDDL, - - [ValidateSet('Local','Remote', 'Disabled')] - [String] - $AccessMode = 'Remote', - - [ValidateSet('Present','Absent')] - [String] - $Ensure = 'Present' - ) - - Write-Verbose ($LocalizedData.SetTargetResourceStartMessage -f $Name) - - #Check if the session configuration exists - Write-Verbose -Message ($LocalizedData.CheckEndpointMessage -f $Name) - - # Try to get a named session configuration - $endpoint = Get-PSSessionConfiguration -Name $Name -ErrorAction SilentlyContinue -Verbose:$false - - if ($PSCmdlet.ShouldProcess(($LocalizedData.EnsureSessionConfigurationMessage -f $Ensure))) - { - # If endpoint is present, set ensure correctly - if ($endpoint) - { - Write-Verbose -Message ($LocalizedData.EndpointNameMessage -f $Name, 'present') - - # If the endpoint should be absent, delete the endpoint - if ($Ensure -eq 'Absent') - { - try - { - <# - Set the following preference so the functions inside Unregister-PSSessionConfig - doesn't get these settings - #> - $oldDebugPrefernce = $DebugPreference - $oldVerbosePreference = $VerbosePreference - $DebugPreference = $VerbosePreference = "SilentlyContinue" - - $unregisterPSSessionConfigParams = @{ - Name = $Name - Force = $true - NoServiceRestart = $true - ErrorAction = 'Stop' - } - $null = Unregister-PSSessionConfiguration @unregisterPSSessionConfigParams - - # Reset the following preference to older values - $DebugPreference = $oldDebugPrefernce - $VerbosePreference = $oldVerbosePreference - - Write-Verbose -Message ($LocalizedData.EndpointNameMessage -f $Name, 'absent') - - $restartNeeded = $true - } - catch - { - $invokeThrowErrorHelperParams = @{ - ErrorId = 'UnregisterPSSessionConfigurationFailed' - ErrorMessage = $_.Exception - ErrorCategory = 'InvalidOperation' - } - Invoke-ThrowErrorHelper @invokeThrowErrorHelperParams - } - - } - - # else validate endpoint properties and return the result - else - { - # Remove Name and Ensure from the bound Parameters for splatting - if ($PSBoundParameters.ContainsKey('Name')) - { - $null = $PSBoundParameters.Remove('Name') - } - if ($PSBoundParameters.ContainsKey('Ensure')) - { - $null = $PSBoundParameters.Remove('Ensure') - } - - [Hashtable]$validatedProperties = ( - Get-ValidatedResourcePropertyTable -Endpoint $endpoint @PSBoundParameters -Apply) - $null = $validatedProperties.Add('Name',$Name) - - # If the $validatedProperties contain more than 1 key, something needs to be changed - if ($validatedProperties.count -gt 1) - { - try - { - $setPSSessionConfigurationParams = $validatedProperties.psobject.Copy() - $setPSSessionConfigurationParams['Force'] = $true - $setPSSessionConfigurationParams['NoServiceRestart'] = $true - $setPSSessionConfigurationParams['Verbose'] = $false - $null = Set-PSSessionConfiguration @setPSSessionConfigurationParams - $restartNeeded = $true - - # Write verbose message for all the properties, except Name, that are changing - Write-EndpointMessage -Parameters $validatedProperties -keysToSkip 'Name' - } - catch - { - $invokeThrowErrorHelperParams = @{ - ErrorId = 'SetPSSessionConfigurationFailed' - ErrorMessage = $_.Exception - ErrorCategory = 'InvalidOperation' - } - Invoke-ThrowErrorHelper @invokeThrowErrorHelperParams - } - } - } - } - else - { - # Named session configuration is absent - Write-Verbose -Message ($LocalizedData.EndpointNameMessage -f $Name, 'absent') - - # If the endpoint should have been present, create it - if ($Ensure -eq 'Present') - { - # Remove Ensure,Verbose,Debug from the bound Parameters for splatting - foreach ($key in @('Ensure', 'Verbose', 'Debug')) - { - if ($PSBoundParameters.ContainsKey($key)) - { - $null = $PSBoundParameters.Remove($key) - } - } - - # Register the endpoint with specified properties - try - { - <# - Set the following preference so the functions inside - Unregister-PSSessionConfig doesn't get these settings - #> - $oldDebugPrefernce = $DebugPreference - $oldVerbosePreference = $VerbosePreference - $DebugPreference = $VerbosePreference = "SilentlyContinue" - - $null = Register-PSSessionConfiguration @PSBoundParameters -Force -NoServiceRestart - - # Reset the following preference to older values - $DebugPreference = $oldDebugPrefernce - $VerbosePreference = $oldVerbosePreference - - # If access mode is specified, set it on the endpoint - if ($PSBoundParameters.ContainsKey('AccessMode') -and $AccessMode -ne 'Remote') - { - $setPSSessionConfigurationParams = @{ - Name = $Name - AccessMode = $AccessMode - Force = $true - NoServiceRestart = $true - Verbose = $false - } - $null = Set-PSSessionConfiguration @setPSSessionConfigurationParams - } - - $restartNeeded = $true - - Write-Verbose -Message ($LocalizedData.EndpointNameMessage -f $Name,'present') - } - catch - { - $invokeThrowErrorHelperParams = @{ - ErrorId = 'RegisterOrSetPSSessionConfigurationFailed' - ErrorMessage = $_.Exception - ErrorCategory = 'InvalidOperation' - } - Invoke-ThrowErrorHelper @invokeThrowErrorHelperParams - } - } - } - - <# - Any change to existing endpoint or creating new endpoint requires WinRM restart. - Since DSC(CIM) uses WSMan as well it will stop responding. - Hence telling the DSC Engine to restart the machine - #> - if ($restartNeeded) - { - $global:DscMachineStatus = 1 - } - } - - Write-Verbose ($LocalizedData.SetTargetResourceEndMessage -f $Name) -} - -<# - .SYNOPSIS - Tests if the specified PSSessionConfiguration is in its desired state - - .PARAMETER Name - Specifies the name of the session configuration. - - .PARAMETER StartupScript - Specifies the startup script for the configuration. - Enter the fully qualified path of a Windows PowerShell script. - - .PARAMETER RunAsCredential - Specifies the credential for commands of this session configuration. - - .PARAMETER SecurityDescriptorSDDL - Specifies the Security Descriptor Definition Language (SDDL) string for the configuration. - - .PARAMETER AccessMode - Enables and disables the session configuration and determines whether it can be used for - remote or local sessions on the computer. - - The acceptable values for this parameter are: - - Disabled - - Local - - Remote - - The default value is "Remote". - - .PARAMETER Ensure - Indicates if the session configuration should exist. - - To test that it does, set this property to "Present". - To test that it does not exist, set the property to "Absent". - - The default value is "Present". -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [String]$Name, - - [AllowEmptyString()] - [String]$StartupScript, - - [PSCredential]$RunAsCredential, - - [String]$SecurityDescriptorSDDL, - - [ValidateSet('Local','Remote', 'Disabled')] - [String]$AccessMode = 'Remote', - - [ValidateSet('Present','Absent')] - [String]$Ensure = 'Present' - ) - - Write-Verbose ($LocalizedData.TestTargetResourceStartMessage -f $Name) - -#region Input Validation - # Check if the endpoint name is blank/whitespaced string - if ([String]::IsNullOrWhiteSpace($Name)) - { - $invokeThrowErrorHelperParams = @{ - ErrorId = 'BlankString' - ErrorMessage = $LocalizedData.WhitespacedStringMessage -f 'name' - ErrorCategory = 'SyntaxError' - } - Invoke-ThrowErrorHelper @invokeThrowErrorHelperParams - } - - # Check for Startup script path and extension - if ($PSBoundParameters.ContainsKey('StartupScript')) - { - # Check if startup script path is valid - if (!(Test-Path $StartupScript)) - { - $invokeThrowErrorHelperParams = @{ - ErrorId = 'PathNotFound' - ErrorMessage = $LocalizedData.StartupPathNotFoundMessage -f $StartupScript - ErrorCategory = 'ObjectNotFound' - } - Invoke-ThrowErrorHelper @invokeThrowErrorHelperParams - } - - # Check the startup script extension - $startupScriptFileExtension = $StartupScript.Split('.')[-1] - if ($startupScriptFileExtension -ne 'ps1') - { - $invokeThrowErrorHelperParams = @{ - ErrorId = 'WrongFileExtension' - ErrorMessage = - $LocalizedData.WrongStartupScriptExtensionMessage -f $startupScriptFileExtension - ErrorCategory = 'InvalidData' - } - Invoke-ThrowErrorHelper @invokeThrowErrorHelperParams - } - } - - # Check if SecurityDescriptorSDDL is whitespaced - if ($PSBoundParameters.ContainsKey('SecurityDescriptorSDDL') -and - [String]::IsNullOrWhiteSpace($SecurityDescriptorSDDL)) - { - $invokeThrowErrorHelperParams = @{ - ErrorId = 'BlankString' - ErrorMessage = $LocalizedData.WhitespacedStringMessage -f 'securityDescriptorSddl' - ErrorCategory = 'SyntaxError' - } - Invoke-ThrowErrorHelper @invokeThrowErrorHelperParams - } - - # Check if the RunAsCredential is not empty - if ($PSBoundParameters.ContainsKey('RunAsCredential') -and - ($RunAsCredential -eq [PSCredential]::Empty)) - { - $invokeThrowErrorHelperParams = @{ - ErrorId = 'EmptyCredential' - ErrorMessage = $LocalizedData.EmptyCredentialMessage - ErrorCategory = 'InvalidArgument' - } - Invoke-ThrowErrorHelper @invokeThrowErrorHelperParams - } -#endregion - - #Check if the session configuration exists - Write-Verbose -Message ($LocalizedData.CheckEndpointMessage -f $Name) - - try - { - # Try to get a named session configuration - $endpoint = Get-PSSessionConfiguration -Name $Name -ErrorAction Stop -Verbose:$false - - Write-Verbose -Message ($LocalizedData.EndpointNameMessage -f $Name,'present') - - # If the endpoint shouldn't be present, return false - if ($Ensure -eq 'Absent') - { - return $false - } - # else validate endpoint properties and return the result - else - { - # Remove Name and Ensure from the bound Parameters for splatting - if ($PSBoundParameters.ContainsKey('Name')) - { - $null = $PSBoundParameters.Remove('Name') - } - if ($PSBoundParameters.ContainsKey('Ensure')) - { - $null = $PSBoundParameters.Remove('Ensure') - } - - return (Get-ValidatedResourcePropertyTable -Endpoint $endpoint @PSBoundParameters) - } - } - catch [Microsoft.PowerShell.Commands.WriteErrorException] - { - Write-Verbose -Message ($LocalizedData.EndpointNameMessage -f $Name,'absent') - - return ($Ensure -eq 'Absent') - } - - Write-Verbose ($LocalizedData.TestTargetResourceEndMessage -f $Name) -} - -<# - .SYNOPSIS - Helper function to translate the endpoint's accessmode - to the "Disabled","Local","Remote" values - - .PARAMETER Endpoint - Specifies a valid session configuration endpoint object -#> -function Get-EndpointAccessMode -{ - param - ( - [Parameter(Mandatory)] - $Endpoint - ) - - if (-not $endpoint.Enabled) - { - return 'Disabled' - } - elseif ($endpoint.Permission -and - ($endpoint.Permission).contains('NT AUTHORITY\NETWORK AccessDenied')) - { - return 'Local' - } - else - { - return 'Remote' - } -} - -<# - .SYNOPSIS - Helper function to write verbose messages for collection of properties - - .PARAMETER Parameters - Specifies a properties Hashtable. - - .PARAMETER KeysToSkip - Specifies an array of Hashtable keys to ignore. - -#> -function Write-EndpointMessage -{ - param - ( - [Parameter(Mandatory)] - [Hashtable] - $Parameters, - - [Parameter(Mandatory)] - [String[]] - $KeysToSkip - ) - - foreach($key in $Parameters.keys) - { - if ($KeysToSkip -notcontains $key) - { - Write-Verbose -Message ($LocalizedData.SetPropertyMessage -f $key, $Parameters[$key]) - } - } -} - -<# - .SYNOPSIS - Helper function to get a Hashtable of validated endpoint properties - - .PARAMETER Endpoint - Specifies a valid session configuration endpoint. - - .PARAMETER StartupScript - Specifies the startup script for the configuration. - Enter the fully qualified path of a Windows PowerShell script. - - .PARAMETER RunAsCredential - Specifies the credential for commands of this session configuration. - - .PARAMETER SecurityDescriptorSDDL - Specifies the Security Descriptor Definition Language (SDDL) string for the configuration. - - .PARAMETER AccessMode - Enables and disables the session configuration and determines whether it can be used for - remote or local sessions on the computer. - - The acceptable values for this parameter are: - - Disabled - - Local - - Remote - - .PARAMETER Apply - Indicates that this function should return a hashtable of validated endpoint properties. - By default, this function returns the value $false. -#> -function Get-ValidatedResourcePropertyTable -{ - param - ( - [Parameter(Mandatory)] - $Endpoint, - - [String] - $StartupScript, - - [PSCredential] - $RunAsCredential, - - [String] - $SecurityDescriptorSDDL, - - [ValidateSet('Local','Remote','Disabled')] - [String] - $AccessMode, - - [Switch] - $Apply - ) - - if ($Apply) - { - $validatedProperties = @{} - } - - # Check if the SDDL is same as specified - if ($PSBoundParameters.ContainsKey('SecurityDescriptorSDDL')) - { - $querySDDLMessage = $LocalizedData.CheckPropertyMessage -f 'SDDL', - $SecurityDescriptorSDDL - Write-Verbose -Message $querySDDLMessage - - # If endpoint SDDL is not same as specified - if ($endpoint.SecurityDescriptorSddl -and - ($endpoint.SecurityDescriptorSddl -ne $SecurityDescriptorSDDL)) - { - $notDesiredSDDLMessage = $LocalizedData.NotDesiredPropertyMessage -f 'SDDL', - $SecurityDescriptorSDDL, $endpoint.SecurityDescriptorSddl - Write-Verbose -Message $notDesiredSDDLMessage - - if ($Apply) - { - $validatedProperties['SecurityDescriptorSddl'] = $SecurityDescriptorSDDL - } - else - { - return $false - } - } - # If endpoint SDDL is same as specified - else - { - Write-Verbose -Message ($LocalizedData.DesiredPropertyMessage -f 'SDDL', - $SecurityDescriptorSDDL) - } - } - - # Check the RunAs user is same as specified - if ($PSBoundParameters.ContainsKey('RunAsCredential')) - { - Write-Verbose -Message ($LocalizedData.CheckPropertyMessage -f 'RunAs user', - $RunAsCredential.UserName) - - # If endpoint RunAsUser is not same as specified - if ($endpoint.RunAsUser -ne $RunAsCredential.UserName) - { - Write-Verbose -Message ($LocalizedData.NotDesiredPropertyMessage -f 'RunAs user', - $RunAsCredential.UserName, $endpoint.RunAsUser) - - if ($Apply) - { - $validatedProperties['RunAsCredential'] = $RunAsCredential - } - else - { - return $false - } - } - # If endpoint RunAsUser is same as specified - else - { - Write-Verbose -Message ($LocalizedData.DesiredPropertyMessage -f 'RunAs user', - $RunAsCredential.UserName) - } - } - - # Check if the StartupScript is same as specified - if ($PSBoundParameters.ContainsKey('StartupScript')) - { - Write-Verbose -Message ($LocalizedData.CheckPropertyMessage -f 'startup script', - $StartupScript) - - # If endpoint StartupScript is not same as specified - if ($endpoint.StartupScript -ne $StartupScript) - { - Write-Verbose -Message ($LocalizedData.NotDesiredPropertyMessage -f 'startup script', - $StartupScript, $endpoint.StartupScript) - - if ($Apply) - { - $validatedProperties['StartupScript'] = $StartupScript - } - else - { - return $false - } - } - # If endpoint StartupScript is same as specified - else - { - Write-Verbose -Message ($LocalizedData.DesiredPropertyMessage -f 'startup script', - $StartupScript) - } - } - - # Check if AccessMode is same as specified - if ($PSBoundParameters.ContainsKey('AccessMode')) - { - Write-Verbose -Message ($LocalizedData.CheckPropertyMessage -f 'acess mode', $AccessMode) - - $curAccessMode = Get-EndpointAccessMode -Endpoint $Endpoint - - # If endpoint access mode is not same as specified - if ($curAccessMode -ne $AccessMode) - { - Write-Verbose -Message ($LocalizedData.NotDesiredPropertyMessage -f 'access mode', - $AccessMode, $curAccessMode) - - if ($Apply) - { - $validatedProperties['AccessMode'] = $AccessMode - } - else - { - return $false - } - } - # If endpoint access mode is same as specified - else - { - Write-Verbose -Message ($LocalizedData.DesiredPropertyMessage -f 'access mode', - $AccessMode) - } - } - - if ($Apply) - { - return $validatedProperties - } - else - { - return ($Ensure -eq 'Present') - } -} - -<# - .SYNOPSIS - Invoke this helper function to throw a terminating error. - - .PARAMETER ErrorId - Specifies a developer-defined identifier of the error. - This identifier must be a non-localized string for a specific error type. - - .PARAMETER ExceptionMessage - Specifies the message that describes the error. - - .PARAMETER ErrorCategory - Specifies the category of the error. -#> -function Invoke-ThrowErrorHelper -{ - param - ( - [Parameter(Mandatory)] - [String] - $ErrorId, - - [Parameter(Mandatory)] - [String] - $ErrorMessage, - - [Parameter(Mandatory)] - [System.Management.Automation.ErrorCategory] - $ErrorCategory - ) - - $exception = New-Object System.InvalidOperationException $ErrorMessage - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $ErrorId, - $ErrorCategory, $null - - throw $errorRecord -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xPSSessionConfiguration/MSFT_xPSSessionConfiguration.schema.mof b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xPSSessionConfiguration/MSFT_xPSSessionConfiguration.schema.mof deleted file mode 100644 index 3240aa79..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xPSSessionConfiguration/MSFT_xPSSessionConfiguration.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xPSEndpoint")] -class MSFT_xPSSessionConfiguration : OMI_BaseResource -{ - [Key, Description("Name of the PS Remoting Endpoint")] String Name; - [Write, Description("Whether to create the endpoint or delete it"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, Description("Path for the startup script")] String StartupScript; - [Write, EmbeddedInstance("MSFT_Credential"), Description("Credential for Running under different user context")] String RunAsCredential; - [Write, Description("SDDL for allowed users to connect to this endpoint")] String SecurityDescriptorSDDL; - [Write, Description("Whether the endpoint is remotely accessible or has local access only or no access"), ValueMap{"Local","Remote", "Disabled"}, Values{"Local","Remote","Disabled"}] String AccessMode; -}; - diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xPackageResource/MSFT_xPackageResource.psm1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xPackageResource/MSFT_xPackageResource.psm1 deleted file mode 100644 index 565acd17..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xPackageResource/MSFT_xPackageResource.psm1 +++ /dev/null @@ -1,1970 +0,0 @@ -# Suppress Global Vars PSSA Error because $global:DSCMachineStatus must be allowed -[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', '')] -[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '')] -param() - -$errorActionPreference = 'Stop' -Set-StrictMode -Version 'Latest' - -# Import CommonResourceHelper for Get-LocalizedData -$script:dscResourcesFolderFilePath = Split-Path $PSScriptRoot -Parent -$script:commonResourceHelperFilePath = Join-Path -Path $script:dscResourcesFolderFilePath -ChildPath 'CommonResourceHelper.psm1' -Import-Module -Name $script:commonResourceHelperFilePath - -# Localized messages for verbose and error statements in this resource -$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_xPackageResource' - -$script:packageCacheLocation = "$env:programData\Microsoft\Windows\PowerShell\Configuration\BuiltinProvCache\MSFT_xPackageResource" -$script:msiTools = $null - -function Get-TargetResource -{ - [OutputType([Hashtable])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [AllowEmptyString()] - [String] - $Name, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [Parameter(Mandatory = $true)] - [AllowEmptyString()] - [String] - $ProductId, - - [Boolean] - $CreateCheckRegValue = $false, - - [ValidateSet('LocalMachine','CurrentUser')] - [String] - $InstalledCheckRegHive = 'LocalMachine', - - [String] - $InstalledCheckRegKey, - - [String] - $InstalledCheckRegValueName, - - [String] - $InstalledCheckRegValueData - ) - - Assert-PathExtensionValid -Path $Path - $uri = Convert-PathToUri -Path $Path - $identifyingNumber = [String]::Empty - - if (-not [String]::IsNullOrEmpty($ProductId)) - { - $identifyingNumber = Convert-ProductIdToIdentifyingNumber -ProductId $ProductId - } - - $packageResourceResult = @{} - - $getProductEntryParameters = @{ - Name = $Name - IdentifyingNumber = $identifyingNumber - } - - $checkRegistryValueParameters = @{ - CreateCheckRegValue = $CreateCheckRegValue - InstalledCheckRegHive = $InstalledCheckRegHive - InstalledCheckRegKey = $InstalledCheckRegKey - InstalledCheckRegValueName = $InstalledCheckRegValueName - InstalledCheckRegValueData = $InstalledCheckRegValueData - } - - if ($CreateCheckRegValue) - { - Assert-RegistryParametersValid -InstalledCheckRegKey $InstalledCheckRegKey -InstalledCheckRegValueName $InstalledCheckRegValueName -InstalledCheckRegValueData $InstalledCheckRegValueData - - $getProductEntryParameters += $checkRegistryValueParameters - $packageResourceResult += $checkRegistryValueParameters - } - - $productEntry = Get-ProductEntry @getProductEntryParameters - - if ($null -eq $productEntry) - { - $packageResourceResult += @{ - Ensure = 'Absent' - Name = $Name - ProductId = $identifyingNumber - Path = $Path - Installed = $false - } - - return $packageResourceResult - } - elseif ($CreateCheckRegValue) - { - $packageResourceResult += @{ - Ensure = 'Present' - Name = $Name - ProductId = $identifyingNumber - Path = $Path - Installed = $true - } - - return $packageResourceResult - } - - <# - Identifying number can still be null here (e.g. remote MSI with Name specified, local EXE). - If the user gave a product ID just pass it through, otherwise get it from the product. - #> - if ($null -eq $identifyingNumber -and $null -ne $productEntry.Name) - { - $identifyingNumber = Split-Path -Path $productEntry.Name -Leaf - } - - $installDate = $productEntry.GetValue('InstallDate') - - if ($null -ne $installDate) - { - try - { - $installDate = '{0:d}' -f [DateTime]::ParseExact($installDate, 'yyyyMMdd',[System.Globalization.CultureInfo]::CurrentCulture).Date - } - catch - { - $installDate = $null - } - } - - $publisher = Get-LocalizedRegistryKeyValue -RegistryKey $productEntry -ValueName 'Publisher' - - $estimatedSize = $productEntry.GetValue('EstimatedSize') - - if ($null -ne $estimatedSize) - { - $estimatedSize = $estimatedSize / 1024 - } - - $displayVersion = $productEntry.GetValue('DisplayVersion') - - $comments = $productEntry.GetValue('Comments') - - $displayName = Get-LocalizedRegistryKeyValue -RegistryKey $productEntry -ValueName 'DisplayName' - - $packageResourceResult += @{ - Ensure = 'Present' - Name = $displayName - Path = $Path - InstalledOn = $installDate - ProductId = $identifyingNumber - Size = $estimatedSize - Installed = $true - Version = $displayVersion - PackageDescription = $comments - Publisher = $publisher - } - - return $packageResourceResult -} - -function Set-TargetResource -{ - [CmdletBinding(SupportsShouldProcess = $true)] - param - ( - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present', - - [Parameter(Mandatory = $true)] - [AllowEmptyString()] - [String] - $Name, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [Parameter(Mandatory = $true)] - [AllowEmptyString()] - [String] - $ProductId, - - [String] - $Arguments, - - [PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - # Return codes 1641 and 3010 indicate success when a restart is requested per installation - [ValidateNotNullOrEmpty()] - [UInt32[]] - $ReturnCode = @( 0, 1641, 3010 ), - - [String] - $LogPath, - - [String] - $FileHash, - - [ValidateSet('SHA1', 'SHA256', 'SHA384', 'SHA512', 'MD5', 'RIPEMD160')] - [String] - $HashAlgorithm, - - [String] - $SignerSubject, - - [String] - $SignerThumbprint, - - [String] - $ServerCertificateValidationCallback, - - [Boolean] - $CreateCheckRegValue = $false, - - [ValidateSet('LocalMachine','CurrentUser')] - [String] - $InstalledCheckRegHive = 'LocalMachine', - - [String] - $InstalledCheckRegKey, - - [String] - $InstalledCheckRegValueName, - - [String] - $InstalledCheckRegValueData, - - [System.Management.Automation.PSCredential] - [System.Management.Automation.CredentialAttribute()] - $RunAsCredential - ) - - $ErrorActionPreference = 'Stop' - - if (Test-TargetResource @PSBoundParameters) - { - return - } - - Assert-PathExtensionValid -Path $Path - $uri = Convert-PathToUri -Path $Path - - if (-not [String]::IsNullOrEmpty($ProductId)) - { - $identifyingNumber = Convert-ProductIdToIdentifyingNumber -ProductId $ProductId - } - else - { - $identifyingNumber = $ProductId - } - - $productEntry = Get-ProductEntry -Name $Name -IdentifyingNumber $identifyingNumber - - <# - Path gets overwritten in the download code path. Retain the user's original Path in case - the install succeeded but the named package wasn't present on the system afterward so we - can give a better error message. - #> - $originalPath = $Path - - Write-Verbose -Message $script:localizedData.PackageConfigurationStarting - - $logStream = $null - $psDrive = $null - $downloadedFileName = $null - - try - { - $fileExtension = [System.IO.Path]::GetExtension($Path).ToLower() - if (-not [String]::IsNullOrEmpty($LogPath)) - { - try - { - if ($fileExtension -eq '.msi') - { - <# - We want to pre-verify the log path exists and is writable ahead of time - even in the MSI case, as detecting WHY the MSI log path doesn't exist would - be rather problematic for the user. - #> - if ((Test-Path -Path $LogPath) -and $PSCmdlet.ShouldProcess($script:localizedData.RemoveExistingLogFile, $null, $null)) - { - Remove-Item -Path $LogPath - } - - if ($PSCmdlet.ShouldProcess($script:localizedData.CreateLogFile, $null, $null)) - { - New-Item -Path $LogPath -Type 'File' | Out-Null - } - } - elseif ($PSCmdlet.ShouldProcess($script:localizedData.CreateLogFile, $null, $null)) - { - $logStream = New-Object -TypeName 'System.IO.StreamWriter' -ArgumentList @( $LogPath, $false ) - } - } - catch - { - New-InvalidOperationException -Message ($script:localizedData.CouldNotOpenLog -f $LogPath) -ErrorRecord $_ - } - } - - # Download or mount file as necessary - if (-not ($fileExtension -eq '.msi' -and $Ensure -eq 'Absent')) - { - if ($uri.IsUnc -and $PSCmdlet.ShouldProcess($script:localizedData.MountSharePath, $null, $null)) - { - $psDriveArgs = @{ - Name = [Guid]::NewGuid() - PSProvider = 'FileSystem' - Root = Split-Path -Path $uri.LocalPath - } - - # If we pass a null for Credential, a dialog will pop up. - if ($null -ne $Credential) - { - $psDriveArgs['Credential'] = $Credential - } - - $psDrive = New-PSDrive @psDriveArgs - $Path = Join-Path -Path $psDrive.Root -ChildPath (Split-Path -Path $uri.LocalPath -Leaf) - } - elseif (@( 'http', 'https' ) -contains $uri.Scheme -and $Ensure -eq 'Present' -and $PSCmdlet.ShouldProcess($script:localizedData.DownloadHTTPFile, $null, $null)) - { - $uriScheme = $uri.Scheme - $outStream = $null - $responseStream = $null - - try - { - Write-Verbose -Message ($script:localizedData.CreatingCacheLocation) - - if (-not (Test-Path -Path $script:packageCacheLocation -PathType 'Container')) - { - New-Item -Path $script:packageCacheLocation -ItemType 'Directory' | Out-Null - } - - $destinationPath = Join-Path -Path $script:packageCacheLocation -ChildPath (Split-Path -Path $uri.LocalPath -Leaf) - - Write-Verbose -Message ($script:localizedData.NeedtodownloadfilefromschemedestinationwillbedestName -f $uriScheme, $destinationPath) - - try - { - Write-Verbose -Message ($script:localizedData.CreatingTheDestinationCacheFile) - $outStream = New-Object -TypeName 'System.IO.FileStream' -ArgumentList @( $destinationPath, 'Create' ) - } - catch - { - # Should never happen since we own the cache directory - New-InvalidOperationException -Message ($script:localizedData.CouldNotOpenDestFile -f $destinationPath) -ErrorRecord $_ - } - - try - { - Write-Verbose -Message ($script:localizedData.CreatingTheSchemeStream -f $uriScheme) - $webRequest = [System.Net.WebRequest]::Create($uri) - - Write-Verbose -Message ($script:localizedData.SettingDefaultCredential) - $webRequest.Credentials = [System.Net.CredentialCache]::DefaultCredentials - - if ($uriScheme -eq 'http') - { - # Default value is MutualAuthRequested, which applies to the https scheme - Write-Verbose -Message ($script:localizedData.SettingAuthenticationLevel) - $webRequest.AuthenticationLevel = [System.Net.Security.AuthenticationLevel]::None - } - elseif ($uriScheme -eq 'https' -and -not [String]::IsNullOrEmpty($ServerCertificateValidationCallback)) - { - Write-Verbose -Message 'Assigning user-specified certificate verification callback' - $serverCertificateValidationScriptBlock = [ScriptBlock]::Create($ServerCertificateValidationCallback) - $webRequest.ServerCertificateValidationCallBack = $serverCertificateValidationScriptBlock - } - - Write-Verbose -Message ($script:localizedData.Gettingtheschemeresponsestream -f $uriScheme) - $responseStream = (([System.Net.HttpWebRequest]$webRequest).GetResponse()).GetResponseStream() - } - catch - { - Write-Verbose -Message ($script:localizedData.ErrorOutString -f ($_ | Out-String)) - New-InvalidOperationException -Message ($script:localizedData.CouldNotGetHttpStream -f $uriScheme, $Path) -ErrorRecord $_ - } - - try - { - Write-Verbose -Message ($script:localizedData.CopyingTheSchemeStreamBytesToTheDiskCache -f $uriScheme) - $responseStream.CopyTo($outStream) - $responseStream.Flush() - $outStream.Flush() - } - catch - { - New-InvalidOperationException -Message ($script:localizedData.ErrorCopyingDataToFile -f $Path, $destinationPath) -ErrorRecord $_ - } - } - finally - { - if ($null -ne $outStream) - { - $outStream.Close() - } - - if ($null -ne $responseStream) - { - $responseStream.Close() - } - } - - Write-Verbose -Message ($script:localizedData.RedirectingPackagePathToCacheFileLocation) - $Path = $destinationPath - $downloadedFileName = $destinationPath - } - - # At this point the Path ought to be valid unless it's a MSI uninstall case - if (-not (Test-Path -Path $Path -PathType 'Leaf')) - { - New-InvalidOperationException -Message ($script:localizedData.PathDoesNotExist -f $Path) - } - - Assert-FileValid -Path $Path -HashAlgorithm $HashAlgorithm -FileHash $FileHash -SignerSubject $SignerSubject -SignerThumbprint $SignerThumbprint - } - - $startInfo = New-Object -TypeName 'System.Diagnostics.ProcessStartInfo' - - # Necessary for I/O redirection and just generally a good idea - $startInfo.UseShellExecute = $false - - $process = New-Object -TypeName 'System.Diagnostics.Process' - $process.StartInfo = $startInfo - - # Concept only, will never touch disk - $errorLogPath = $LogPath + '.err' - - if ($fileExtension -eq '.msi') - { - $startInfo.FileName = "$env:winDir\system32\msiexec.exe" - - if ($Ensure -eq 'Present') - { - # Check if the MSI package specifies the ProductName and Code - $productName = Get-MsiProductName -Path $Path - $productCode = Get-MsiProductCode -Path $Path - - if ((-not [String]::IsNullOrEmpty($Name)) -and ($productName -ne $Name)) - { - New-InvalidArgumentException -ArgumentName 'Name' -Message ($script:localizedData.InvalidNameOrId -f $Name, $identifyingNumber, $productName, $productCode) - } - - if ((-not [String]::IsNullOrEmpty($identifyingNumber)) -and ($identifyingNumber -ne $productCode)) - { - New-InvalidArgumentException -ArgumentName 'ProductId' -Message ($script:localizedData.InvalidNameOrId -f $Name, $identifyingNumber, $productName, $productCode) - } - - $startInfo.Arguments = '/i "{0}"' -f $Path - } - else - { - $productEntry = Get-ProductEntry -Name $Name -IdentifyingNumber $identifyingNumber - - # We may have used the Name earlier, now we need the actual ID - $id = Split-Path -Path $productEntry.Name -Leaf - $startInfo.Arguments = '/x{0}' -f $id - } - - if ($LogPath) - { - $startInfo.Arguments += ' /log "{0}"' -f $LogPath - } - - $startInfo.Arguments += ' /quiet /norestart' - - if ($Arguments) - { - # Append any specified arguments with a space (#195) - $startInfo.Arguments += ' {0}' -f $Arguments - } - } - else - { - # EXE - Write-Verbose -Message $script:localizedData.TheBinaryIsAnExe - - if ($Ensure -eq 'Present') - { - $startInfo.FileName = $Path - $startInfo.Arguments = $Arguments - - if ($LogPath) - { - Write-Verbose -Message ($script:localizedData.UserHasRequestedLoggingNeedToAttachEventHandlersToTheProcess) - $startInfo.RedirectStandardError = $true - $startInfo.RedirectStandardOutput = $true - - Register-ObjectEvent -InputObject $process -EventName 'OutputDataReceived' -SourceIdentifier $LogPath - Register-ObjectEvent -InputObject $process -EventName 'ErrorDataReceived' -SourceIdentifier $errorLogPath - } - } - else - { - # Absent case - $startInfo.FileName = "$env:winDir\system32\msiexec.exe" - - # We may have used the Name earlier, now we need the actual ID - if ($null -eq $productEntry -or $null -eq $productEntry.Name) - { - $id = $Path - } - else - { - $id = Split-Path -Path $productEntry.Name -Leaf - } - - $startInfo.Arguments = "/x $id /quiet /norestart" - - if ($LogPath) - { - $startInfo.Arguments += ' /log "{0}"' -f $LogPath - } - - if ($Arguments) - { - # Append the specified arguments with a space (#195) - $startInfo.Arguments += ' {0}' -f $Arguments - } - } - } - - Write-Verbose -Message ($script:localizedData.StartingWithStartInfoFileNameStartInfoArguments -f $startInfo.FileName, $startInfo.Arguments) - - if ($PSCmdlet.ShouldProcess(($script:localizedData.StartingProcessMessage -f $startInfo.FileName, $startInfo.Arguments), $null, $null)) - { - try - { - [int] $exitCode = 0 - if($PSBoundParameters.ContainsKey('RunAsCredential')) - { - $commandLine = '"{0}" {1}' -f $startInfo.FileName, $startInfo.Arguments - $exitCode = Invoke-PInvoke -CommandLine $commandLine -Credential $RunAsCredential - } - else - { - $process = Invoke-Process -Process $process -LogStream ($null -ne $logStream) - $exitCode = $process.ExitCode - } - } - catch - { - New-InvalidOperationException -Message ($script:localizedData.CouldNotStartProcess -f $Path) -ErrorRecord $_ - } - - if ($logStream) - { - #We have to re-mux these since they appear to us as different streams - #The underlying Win32 APIs prevent this problem, as would constructing a script - #on the fly and executing it, but the former is highly problematic from PowerShell - #and the latter doesn't let us get the return code for UI-based EXEs - $outputEvents = Get-Event -SourceIdentifier $LogPath - $errorEvents = Get-Event -SourceIdentifier $errorLogPath - $masterEvents = @() + $outputEvents + $errorEvents - $masterEvents = $masterEvents | Sort-Object -Property TimeGenerated - - foreach($event in $masterEvents) - { - $logStream.Write($event.SourceEventArgs.Data); - } - - Remove-Event -SourceIdentifier $LogPath - Remove-Event -SourceIdentifier $errorLogPath - } - - if (-not ($ReturnCode -contains $exitCode)) - { - # Some .exe files do not support uninstall - if ($Ensure -eq 'Absent' -and $fileExtension -eq '.exe' -and $exitCode -eq '1620') - { - Write-Warning -Message ($script:localizedData.ExeCouldNotBeUninstalled -f $Path) - } - else - { - New-InvalidOperationException ($script:localizedData.UnexpectedReturnCode -f $exitCode.ToString()) - } - } - } - } - finally - { - if ($psDrive) - { - Remove-PSDrive -Name $psDrive -Force - } - - if ($logStream) - { - $logStream.Dispose() - } - } - - if ($downloadedFileName -and $PSCmdlet.ShouldProcess($script:localizedData.RemoveDownloadedFile, $null, $null)) - { - <# - This is deliberately not in the finally block because we want to leave the downloaded - file on disk if an error occurred as a debugging aid for the user. - #> - Remove-Item -Path $downloadedFileName - } - - $operationMessageString = $script:localizedData.PackageUninstalled - if ($Ensure -eq 'Present') - { - $operationMessageString = $script:localizedData.PackageInstalled - } - - if ($CreateCheckRegValue) - { - $registryValueString = '{0}\{1}\{2}' -f $InstalledCheckRegHive, $InstalledCheckRegKey, $InstalledCheckRegValueName - if ($Ensure -eq 'Present') - { - Write-Verbose -Message ($script:localizedData.CreatingRegistryValue -f $registryValueString) - Set-RegistryValue -RegistryHive $InstalledCheckRegHive -Key $InstalledCheckRegKey -Value $InstalledCheckRegValueName -Data $InstalledCheckRegValueData - } - else - { - Write-Verbose ($script:localizedData.RemovingRegistryValue -f $registryValueString) - Remove-RegistryValue -RegistryHive $InstalledCheckRegHive -Key $InstalledCheckRegKey -Value $InstalledCheckRegValueName - } - } - - <# - Check if a reboot is required, if so notify CA. The MSFT_ServerManagerTasks provider is - missing on some client SKUs (worked on both Server and Client Skus in Windows 10). - #> - - $serverFeatureData = Invoke-CimMethod -Name 'GetServerFeature' -Namespace 'root\microsoft\windows\servermanager' -Class 'MSFT_ServerManagerTasks' -Arguments @{ BatchSize = 256 } -ErrorAction 'Ignore' - $registryData = Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Name 'PendingFileRenameOperations' -ErrorAction 'Ignore' - - if (($serverFeatureData -and $serverFeatureData.RequiresReboot) -or $registryData -or $exitcode -eq 3010 -or $exitcode -eq 1641) - { - Write-Verbose $script:localizedData.MachineRequiresReboot - $global:DSCMachineStatus = 1 - } - elseif ($Ensure -eq 'Present') - { - $getProductEntryParameters = @{ - Name = $Name - IdentifyingNumber = $identifyingNumber - } - - $checkRegistryValueParameters = @{ - CreateCheckRegValue = $CreateCheckRegValue - InstalledCheckRegHive = $InstalledCheckRegHive - InstalledCheckRegKey = $InstalledCheckRegKey - InstalledCheckRegValueName = $InstalledCheckRegValueName - InstalledCheckRegValueData = $InstalledCheckRegValueData - } - - if ($CreateCheckRegValue) - { - $getProductEntryParameters += $checkRegistryValueParameters - } - - $productEntry = Get-ProductEntry @getProductEntryParameters - - if ($null -eq $productEntry) - { - New-InvalidOperationException -Message ($script:localizedData.PostValidationError -f $originalPath) - } - } - - Write-Verbose -Message $operationMessageString - Write-Verbose -Message $script:localizedData.PackageConfigurationComplete -} - -function Test-TargetResource -{ - [OutputType([Boolean])] - [CmdletBinding()] - param - ( - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present', - - [Parameter(Mandatory = $true)] - [AllowEmptyString()] - [String] - $Name, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [Parameter(Mandatory = $true)] - [AllowEmptyString()] - [String] - $ProductId, - - [String] - $Arguments, - - [PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - # Return codes 1641 and 3010 indicate success when a restart is requested per installation - [ValidateNotNullOrEmpty()] - [UInt32[]] - $ReturnCode = @( 0, 1641, 3010 ), - - [String] - $LogPath, - - [String] - $FileHash, - - [ValidateSet('SHA1', 'SHA256', 'SHA384', 'SHA512', 'MD5', 'RIPEMD160')] - [String] - $HashAlgorithm, - - [String] - $SignerSubject, - - [String] - $SignerThumbprint, - - [String] - $ServerCertificateValidationCallback, - - [Boolean] - $CreateCheckRegValue = $false, - - [ValidateSet('LocalMachine','CurrentUser')] - [String] - $InstalledCheckRegHive = 'LocalMachine', - - [String] - $InstalledCheckRegKey, - - [String] - $InstalledCheckRegValueName, - - [String] - $InstalledCheckRegValueData, - - [PSCredential] - $RunAsCredential - ) - - Assert-PathExtensionValid -Path $Path - $uri = Convert-PathToUri -Path $Path - $identifyingNumber = $null - - if (-not [String]::IsNullOrEmpty($ProductId)) - { - $identifyingNumber = Convert-ProductIdToIdentifyingNumber -ProductId $ProductId - } - - $getProductEntryParameters = @{ - Name = $Name - IdentifyingNumber = $identifyingNumber - } - - $checkRegistryValueParameters = @{ - CreateCheckRegValue = $CreateCheckRegValue - InstalledCheckRegHive = $InstalledCheckRegHive - InstalledCheckRegKey = $InstalledCheckRegKey - InstalledCheckRegValueName = $InstalledCheckRegValueName - InstalledCheckRegValueData = $InstalledCheckRegValueData - } - - if ($CreateCheckRegValue) - { - Assert-RegistryParametersValid -InstalledCheckRegKey $InstalledCheckRegKey -InstalledCheckRegValueName $InstalledCheckRegValueName -InstalledCheckRegValueData $InstalledCheckRegValueData - $getProductEntryParameters += $checkRegistryValueParameters - } - - $productEntry = Get-ProductEntry @getProductEntryParameters - - Write-Verbose -Message ($script:localizedData.EnsureIsEnsure -f $Ensure) - - if ($null -eq $productEntry) - { - Write-Verbose -Message ($script:localizedData.ProductIsProduct -f $productEntry) - } - else - { - Write-Verbose -Message 'Product installation cannot be determined' - } - - Write-Verbose -Message ($script:localizedData.ProductAsBooleanIs -f [Boolean]$productEntry) - - if ($null -ne $productEntry) - { - if ($CreateCheckRegValue) - { - Write-Verbose -Message ($script:localizedData.PackageAppearsInstalled -f $Name) - } - else - { - $displayName = Get-LocalizedRegistryKeyValue -RegistryKey $productEntry -ValueName 'DisplayName' - Write-Verbose -Message ($script:localizedData.PackageAppearsInstalled -f $displayName) - } - } - else - { - $displayName = $null - - if (-not [String]::IsNullOrEmpty($Name)) - { - $displayName = $Name - } - else - { - $displayName = $ProductId - } - - Write-Verbose -Message ($script:localizedData.PackageDoesNotAppearInstalled -f $displayName) - } - - return ($null -ne $productEntry -and $Ensure -eq 'Present') -or ($null -eq $productEntry -and $Ensure -eq 'Absent') -} - -<# - .SYNOPSIS - Asserts that the path extension is valid - either .msi or .exe. - - .PARAMETER Path - The path to validate the extension of. -#> -function Assert-PathExtensionValid -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path - ) - - $pathExtension = [System.IO.Path]::GetExtension($Path) - Write-Verbose -Message ($script:localizedData.ThePathExtensionWasPathExt -f $pathExtension) - - $validPathExtensions = @( '.msi', '.exe' ) - - if ($validPathExtensions -notcontains $pathExtension.ToLower()) - { - New-InvalidArgumentException -ArgumentName 'Path' -Message ($script:localizedData.InvalidBinaryType -f $Path) - } -} - -<# - .SYNOPSIS - Converts the given path to a URI. - Throws an exception if the path's scheme as a URI is not valid. - - .PARAMETER Path - The path to retrieve as a URI. -#> -function Convert-PathToUri -{ - [OutputType([Uri])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path - ) - - try - { - $uri = [Uri] $Path - } - catch - { - New-InvalidArgumentException -ArgumentName 'Path' -Message ($script:localizedData.InvalidPath -f $Path) - } - - $validUriSchemes = @( 'file', 'http', 'https' ) - - if ($validUriSchemes -notcontains $uri.Scheme) - { - Write-Verbose -Message ($Localized.TheUriSchemeWasUriScheme -f $uri.Scheme) - New-InvalidArgumentException -ArgumentName 'Path' -Message ($script:localizedData.InvalidPath -f $Path) - } - - return $uri -} - -<# - .SYNOPSIS - Retrieves the product ID as an identifying number. - - .PARAMETER ProductId - The product id to retrieve as an identifying number. -#> -function Convert-ProductIdToIdentifyingNumber -{ - [OutputType([String])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $ProductId - ) - - try - { - Write-Verbose -Message ($script:localizedData.ParsingProductIdAsAnIdentifyingNumber -f $ProductId) - $identifyingNumber = '{{{0}}}' -f [Guid]::Parse($ProductId).ToString().ToUpper() - - Write-Verbose -Message ($script:localizedData.ParsedProductIdAsIdentifyingNumber -f $ProductId, $identifyingNumber) - return $identifyingNumber - } - catch - { - New-InvalidArgumentException -ArgumentName 'ProductId' -Message ($script:localizedData.InvalidIdentifyingNumber -f $ProductId) - } -} - -<# - .SYNOPSIS - Asserts that the InstalledCheckRegKey, InstalledCheckRegValueName, and - InstalledCheckRegValueData parameter required for retrieving package installation status - from a registry are not null or empty. - - .PARAMETER InstalledCheckRegKey - The InstalledCheckRegKey parameter to check. - - .PARAMETER InstalledCheckRegValueName - The InstalledCheckRegValueName parameter to check. - - .PARAMETER InstalledCheckRegValueData - The InstalledCheckRegValueData parameter to check. - - .NOTES - This could be done with parameter validation. - It is implemented this way to provide a clearer error message. -#> -function Assert-RegistryParametersValid -{ - [CmdletBinding()] - param - ( - [String] - $InstalledCheckRegKey, - - [String] - $InstalledCheckRegValueName, - - [String] - $InstalledCheckRegValueData - ) - - foreach ($parameter in $PSBoundParameters.Keys) - { - if ([String]::IsNullOrEmpty($PSBoundParameters[$parameter])) - { - New-InvalidArgumentException -ArgumentName $parameter -Message ($script:localizedData.ProvideParameterForRegistryCheck -f $parameter) - } - } -} - -<# - .SYNOPSIS - Retrieves the product entry for the package with the given name and/or identifying number. - - .PARAMETER Name - The name of the product entry to retrieve. - - .PARAMETER CreateCheckRegValue - Indicates whether or not to retrieve the package installation status from a registry. - - .PARAMETER IdentifyingNumber - The identifying number of the product entry to retrieve. - - .PARAMETER InstalledCheckRegHive - The registry hive to check for package installation status. - - .PARAMETER InstalledCheckRegKey - The registry key to open to check for package installation status. - - .PARAMETER InstalledCheckRegValueName - The registry value name to check for package installation status. - - .PARAMETER InstalledCheckRegValueData - The value to compare against the retrieved registry value to check for package installation. -#> -function Get-ProductEntry -{ - [CmdletBinding()] - param - ( - [String] - $Name, - - [String] - $IdentifyingNumber, - - [Switch] - $CreateCheckRegValue, - - [ValidateSet('LocalMachine', 'CurrentUser')] - [String] - $InstalledCheckRegHive = 'LocalMachine', - - [String] - $InstalledCheckRegKey, - - [String] - $InstalledCheckRegValueName, - - [String] - $InstalledCheckRegValueData - ) - - $uninstallRegistryKey = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall' - $uninstallRegistryKeyWow64 = 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall' - - $productEntry = $null - - if (-not [String]::IsNullOrEmpty($IdentifyingNumber)) - { - $productEntryKeyLocation = Join-Path -Path $uninstallRegistryKey -ChildPath $IdentifyingNumber - $productEntry = Get-Item -Path $productEntryKeyLocation -ErrorAction 'SilentlyContinue' - - if ($null -eq $productEntry) - { - $productEntryKeyLocation = Join-Path -Path $uninstallRegistryKeyWow64 -ChildPath $IdentifyingNumber - $productEntry = Get-Item $productEntryKeyLocation -ErrorAction 'SilentlyContinue' - } - } - else - { - foreach ($registryKeyEntry in (Get-ChildItem -Path @( $uninstallRegistryKey, $uninstallRegistryKeyWow64) -ErrorAction 'Ignore' )) - { - if ($Name -eq (Get-LocalizedRegistryKeyValue -RegistryKey $registryKeyEntry -ValueName 'DisplayName')) - { - $productEntry = $registryKeyEntry - break - } - } - } - - if ($null -eq $productEntry) - { - if ($CreateCheckRegValue) - { - $installValue = $null - - $win32OperatingSystem = Get-CimInstance -ClassName 'Win32_OperatingSystem' -ErrorAction 'SilentlyContinue' - - # If 64-bit OS, check 64-bit registry view first - if ($win32OperatingSystem.OSArchitecture -ieq '64-bit') - { - $installValue = Get-RegistryValueWithErrorsIgnored -Key $InstalledCheckRegKey -Value $InstalledCheckRegValueName -RegistryHive $InstalledCheckRegHive -RegistryView 'Registry64' - } - - if ($null -eq $installValue) - { - $installValue = Get-RegistryValueWithErrorsIgnored -Key $InstalledCheckRegKey -Value $InstalledCheckRegValueName -RegistryHive $InstalledCheckRegHive -RegistryView 'Registry32' - } - - if ($null -ne $installValue) - { - if ($InstalledCheckRegValueData -and $installValue -eq $InstalledCheckRegValueData) - { - $productEntry = @{ - Installed = $true - } - } - } - } - } - - return $productEntry -} - -<# - .SYNOPSIS - Retrieves a value from a registry without throwing errors. - - .PARAMETER Key - The key of the registry to get the value from. - - .PARAMETER Value - The name of the value to retrieve. - - .PARAMETER RegistryHive - The registry hive to retrieve the value from. - - .PARAMETER RegistyView - The registry view to retrieve the value from. -#> -function Get-RegistryValueWithErrorsIgnored -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [String] - $Key, - - [Parameter(Mandatory = $true)] - [String] - $Value, - - [Parameter(Mandatory = $true)] - [Microsoft.Win32.RegistryHive] - $RegistryHive, - - [Parameter(Mandatory = $true)] - [Microsoft.Win32.RegistryView] - $RegistryView - ) - - $registryValue = $null - - try - { - $baseRegistryKey = [Microsoft.Win32.RegistryKey]::OpenBaseKey($RegistryHive, $RegistryView) - $subRegistryKey = $baseRegistryKey.OpenSubKey($Key) - - if ($null -ne $subRegistryKey) - { - $registryValue = $subRegistryKey.GetValue($Value) - } - } - catch - { - $exceptionText = ($_ | Out-String).Trim() - Write-Verbose -Message "An exception occured while attempting to retrieve a registry value: $exceptionText" - } - - return $registryValue -} - -<# - .SYNOPSIS - Retrieves a localized registry key value. - - .PARAMETER RegistryKey - The registry key to retrieve the value from. - - .PARAMETER ValueName - The name of the value to retrieve. -#> -function Get-LocalizedRegistryKeyValue -{ - [CmdletBinding()] - param - ( - [Object] - $RegistryKey, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $ValueName - ) - - $localizedRegistryKeyValue = $RegistryKey.GetValue('{0}_Localized' -f $ValueName) - - if ($null -eq $localizedRegistryKeyValue) - { - $localizedRegistryKeyValue = $RegistryKey.GetValue($ValueName) - } - - return $localizedRegistryKeyValue -} - -<# - .SYNOPSIS - Asserts that the file at the given path is valid. - - .PARAMETER Path - The path to the file to check. - - .PARAMETER FileHash - The hash that should match the hash of the file. - - .PARAMETER HashAlgorithm - The algorithm to use to retrieve the file hash. - - .PARAMETER SignerThumbprint - The certificate thumbprint that should match the file's signer certificate. - - .PARAMETER SignerSubject - The certificate subject that should match the file's signer certificate. -#> -function Assert-FileValid -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [String] - $Path, - - [String] - $FileHash, - - [String] - $HashAlgorithm, - - [String] - $SignerThumbprint, - - [String] - $SignerSubject - ) - - if (-not [String]::IsNullOrEmpty($FileHash)) - { - Assert-FileHashValid -Path $Path -Hash $FileHash -Algorithm $HashAlgorithm - } - - if (-not [String]::IsNullOrEmpty($SignerThumbprint) -or -not [String]::IsNullOrEmpty($SignerSubject)) - { - Assert-FileSignatureValid -Path $Path -Thumbprint $SignerThumbprint -Subject $SignerSubject - } -} - -<# - .SYNOPSIS - Asserts that the hash of the file at the given path matches the given hash. - - .PARAMETER Path - The path to the file to check the hash of. - - .PARAMETER Hash - The hash to check against. - - .PARAMETER Algorithm - The algorithm to use to retrieve the file's hash. -#> -function Assert-FileHashValid -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [String] - $Path, - - [Parameter(Mandatory)] - [String] - $Hash, - - [String] - $Algorithm = 'SHA256' - ) - - if ([String]::IsNullOrEmpty($Algorithm)) - { - $Algorithm = 'SHA256' - } - - Write-Verbose -Message ($script:localizedData.CheckingFileHash -f $Path, $Hash, $Algorithm) - - $fileHash = Get-FileHash -LiteralPath $Path -Algorithm $Algorithm -ErrorAction 'Stop' - - if ($fileHash.Hash -ne $Hash) - { - throw ($script:localizedData.InvalidFileHash -f $Path, $Hash, $Algorithm) - } -} - -<# - .SYNOPSIS - Asserts that the signature of the file at the given path is valid. - - .PARAMETER Path - The path to the file to check the signature of - - .PARAMETER Thumbprint - The certificate thumbprint that should match the file's signer certificate. - - .PARAMETER Subject - The certificate subject that should match the file's signer certificate. -#> -function Assert-FileSignatureValid -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [String] - $Path, - - [String] - $Thumbprint, - - [String] - $Subject - ) - - Write-Verbose -Message ($script:localizedData.CheckingFileSignature -f $Path) - - $signature = Get-AuthenticodeSignature -LiteralPath $Path -ErrorAction 'Stop' - - if ($signature.Status -ne [System.Management.Automation.SignatureStatus]::Valid) - { - throw ($script:localizedData.InvalidFileSignature -f $Path, $signature.Status) - } - else - { - Write-Verbose -Message ($script:localizedData.FileHasValidSignature -f $Path, $signature.SignerCertificate.Thumbprint, $signature.SignerCertificate.Subject) - } - - if ($null -ne $Subject -and ($signature.SignerCertificate.Subject -notlike $Subject)) - { - throw ($script:localizedData.WrongSignerSubject -f $Path, $Subject) - } - - if ($null -ne $Thumbprint -and ($signature.SignerCertificate.Thumbprint -ne $Thumbprint)) - { - throw ($script:localizedData.WrongSignerThumbprint -f $Path, $Thumbprint) - } -} - -<# - .SYNOPSIS - Retrieves the name of a product from an msi. - - .PARAMETER Path - The path to the msi to retrieve the name from. -#> -function Get-MsiProductName -{ - [OutputType([String])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path - ) - - $msiTools = Get-MsiTool - - $productName = $msiTools::GetProductName($Path) - - return $productName -} - -<# - .SYNOPSIS - Retrieves the code of a product from an msi. - - .PARAMETER Path - The path to the msi to retrieve the code from. -#> -function Get-MsiProductCode -{ - [OutputType([String])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path - ) - - $msiTools = Get-MsiTool - - $productCode = $msiTools::GetProductCode($Path) - - return $productCode -} - -<# - .SYNOPSIS - Retrieves the MSI tools type. -#> -function Get-MsiTool -{ - [OutputType([System.Type])] - [CmdletBinding()] - param () - - if ($null -ne $script:msiTools) - { - return $script:msiTools - } - - $msiToolsCodeDefinition = @' - [DllImport("msi.dll", CharSet = CharSet.Unicode, PreserveSig = true, SetLastError = true, ExactSpelling = true)] - private static extern UInt32 MsiOpenPackageExW(string szPackagePath, int dwOptions, out IntPtr hProduct); - - [DllImport("msi.dll", CharSet = CharSet.Unicode, PreserveSig = true, SetLastError = true, ExactSpelling = true)] - private static extern uint MsiCloseHandle(IntPtr hAny); - - [DllImport("msi.dll", CharSet = CharSet.Unicode, PreserveSig = true, SetLastError = true, ExactSpelling = true)] - private static extern uint MsiGetPropertyW(IntPtr hAny, string name, StringBuilder buffer, ref int bufferLength); - - private static string GetPackageProperty(string msi, string property) - { - IntPtr MsiHandle = IntPtr.Zero; - try - { - var res = MsiOpenPackageExW(msi, 1, out MsiHandle); - if (res != 0) - { - return null; - } - - int length = 256; - var buffer = new StringBuilder(length); - res = MsiGetPropertyW(MsiHandle, property, buffer, ref length); - return buffer.ToString(); - } - finally - { - if (MsiHandle != IntPtr.Zero) - { - MsiCloseHandle(MsiHandle); - } - } - } - public static string GetProductCode(string msi) - { - return GetPackageProperty(msi, "ProductCode"); - } - - public static string GetProductName(string msi) - { - return GetPackageProperty(msi, "ProductName"); - } -'@ - - if (([System.Management.Automation.PSTypeName]'Microsoft.Windows.DesiredStateConfiguration.xPackageResource.MsiTools').Type) - { - $script:msiTools = ([System.Management.Automation.PSTypeName]'Microsoft.Windows.DesiredStateConfiguration.xPackageResource.MsiTools').Type - } - else - { - $script:msiTools = Add-Type ` - -Namespace 'Microsoft.Windows.DesiredStateConfiguration.xPackageResource' ` - -Name 'MsiTools' ` - -Using 'System.Text' ` - -MemberDefinition $msiToolsCodeDefinition ` - -PassThru - } - - return $script:msiTools -} - -<# - .SYNOPSIS - Runs a process as the specified user via PInvoke. - - .PARAMETER CommandLine - The command line (including arguments) of the process to start. - - .PARAMETER Credential - The user credential to start the process as. -#> -function Invoke-PInvoke -{ - [CmdletBinding()] - [OutputType([System.Int32])] - param - ( - [Parameter(Mandatory = $true)] - [String] - $CommandLine, - - [Parameter(Mandatory)] - [PSCredential] - [System.Management.Automation.CredentialAttribute()] - $Credential - ) - - Register-PInvoke - [System.Int32] $exitCode = 0 - - [Source.NativeMethods]::CreateProcessAsUser($CommandLine, ` - $Credential.GetNetworkCredential().Domain, ` - $Credential.GetNetworkCredential().UserName, ` - $Credential.GetNetworkCredential().Password, ` - [ref] $exitCode - ) - - return $exitCode; -} - -<# - .SYNOPSIS - Starts and waits for a process. - - .DESCRIPTION - Allows mocking and testing of process arguments. - - .PARAMETER Process - The System.Diagnositics.Process object to start. - - .PARAMETER LogStream - Redirect STDOUT and STDERR output. -#> -function Invoke-Process -{ - [CmdletBinding()] - [OutputType([System.Diagnostics.Process])] - param ( - [Parameter(Mandatory)] - [System.Diagnostics.Process] - $Process, - - [Parameter()] - [System.Boolean] - $LogStream - ) - - $Process.Start() | Out-Null - - if ($LogStream) - { - $Process.BeginOutputReadLine() - $Process.BeginErrorReadLine() - } - - $Process.WaitForExit() - return $Process -} - -<# - .SYNOPSIS - Sets the value of a registry key to the specified data. - - .PARAMETER Key - The registry key that contains the value to set. - - .PARAMETER Value - The value name of the registry key value to set. - - .PARAMETER RegistryHive - The registry hive that contains the registry key to set. - - .PARAMETER Data - The data to set the registry key value to. -#> -function Set-RegistryValue -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [String] - $Key, - - [Parameter(Mandatory = $true)] - [String] - $Value, - - [Parameter(Mandatory = $true)] - [Microsoft.Win32.RegistryHive] - $RegistryHive, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Data - ) - - try - { - $baseRegistryKey = [Microsoft.Win32.RegistryKey]::OpenBaseKey($RegistryHive, [Microsoft.Win32.RegistryView]::Default) - - # Opens the subkey with write access - $subRegistryKey = $baseRegistryKey.OpenSubKey($Key, $true) - - if ($null -eq $subRegistryKey) - { - Write-Verbose "Key: '$Key'" - $subRegistryKey = $baseRegistryKey.CreateSubKey($Key) - } - - $subRegistryKey.SetValue($Value, $Data) - $subRegistryKey.Close() - } - catch - { - New-InvalidOperationException -Message ($script:localizedData.ErrorSettingRegistryValue -f $Key, $Value, $Data) -ErrorRecord $_ - } -} - -<# - .SYNOPSIS - Removes the specified value of a registry key. - - .PARAMETER Key - The registry key that contains the value to remove. - - .PARAMETER Value - The value name of the registry key value to remove. - - .PARAMETER RegistryHive - The registry hive that contains the registry key to remove. -#> -function Remove-RegistryValue -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [String] - $Key, - - [Parameter(Mandatory = $true)] - [String] - $Value, - - [Parameter(Mandatory = $true)] - [Microsoft.Win32.RegistryHive] - $RegistryHive - ) - - try - { - $baseRegistryKey = [Microsoft.Win32.RegistryKey]::OpenBaseKey($RegistryHive, [Microsoft.Win32.RegistryView]::Default) - - $subRegistryKey = $baseRegistryKey.OpenSubKey($Key, $true) - $subRegistryKey.DeleteValue($Value) - $subRegistryKey.Close() - } - catch - { - New-InvalidOperationException -Message ($script:localizedData.ErrorRemovingRegistryValue -f $Key, $Value) -ErrorRecord $_ - } -} - -<# - .SYNOPSIS - Registers PInvoke to run a process as a user. -#> -function Register-PInvoke -{ - $programSource = @' - using System; - using System.Collections.Generic; - using System.Text; - using System.Security; - using System.Runtime.InteropServices; - using System.Diagnostics; - using System.Security.Principal; - using System.ComponentModel; - using System.IO; - - namespace Source - { - [SuppressUnmanagedCodeSecurity] - public static class NativeMethods - { - //The following structs and enums are used by the various Win32 API's that are used in the code below - - [StructLayout(LayoutKind.Sequential)] - public struct STARTUPINFO - { - public Int32 cb; - public string lpReserved; - public string lpDesktop; - public string lpTitle; - public Int32 dwX; - public Int32 dwY; - public Int32 dwXSize; - public Int32 dwXCountChars; - public Int32 dwYCountChars; - public Int32 dwFillAttribute; - public Int32 dwFlags; - public Int16 wShowWindow; - public Int16 cbReserved2; - public IntPtr lpReserved2; - public IntPtr hStdInput; - public IntPtr hStdOutput; - public IntPtr hStdError; - } - - [StructLayout(LayoutKind.Sequential)] - public struct PROCESS_INFORMATION - { - public IntPtr hProcess; - public IntPtr hThread; - public Int32 dwProcessID; - public Int32 dwThreadID; - } - - [Flags] - public enum LogonType - { - LOGON32_LOGON_INTERACTIVE = 2, - LOGON32_LOGON_NETWORK = 3, - LOGON32_LOGON_BATCH = 4, - LOGON32_LOGON_SERVICE = 5, - LOGON32_LOGON_UNLOCK = 7, - LOGON32_LOGON_NETWORK_CLEARTEXT = 8, - LOGON32_LOGON_NEW_CREDENTIALS = 9 - } - - [Flags] - public enum LogonProvider - { - LOGON32_PROVIDER_DEFAULT = 0, - LOGON32_PROVIDER_WINNT35, - LOGON32_PROVIDER_WINNT40, - LOGON32_PROVIDER_WINNT50 - } - [StructLayout(LayoutKind.Sequential)] - public struct SECURITY_ATTRIBUTES - { - public Int32 Length; - public IntPtr lpSecurityDescriptor; - public bool bInheritHandle; - } - - public enum SECURITY_IMPERSONATION_LEVEL - { - SecurityAnonymous, - SecurityIdentification, - SecurityImpersonation, - SecurityDelegation - } - - public enum TOKEN_TYPE - { - TokenPrimary = 1, - TokenImpersonation - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - internal struct TokPriv1Luid - { - public int Count; - public long Luid; - public int Attr; - } - - public const int GENERIC_ALL_ACCESS = 0x10000000; - public const int CREATE_NO_WINDOW = 0x08000000; - internal const int SE_PRIVILEGE_ENABLED = 0x00000002; - internal const int TOKEN_QUERY = 0x00000008; - internal const int TOKEN_ADJUST_PRIVILEGES = 0x00000020; - internal const string SE_INCRASE_QUOTA = "SeIncreaseQuotaPrivilege"; - - [DllImport("kernel32.dll", - EntryPoint = "CloseHandle", SetLastError = true, - CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] - public static extern bool CloseHandle(IntPtr handle); - - [DllImport("advapi32.dll", - EntryPoint = "CreateProcessAsUser", SetLastError = true, - CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] - public static extern bool CreateProcessAsUser( - IntPtr hToken, - string lpApplicationName, - string lpCommandLine, - ref SECURITY_ATTRIBUTES lpProcessAttributes, - ref SECURITY_ATTRIBUTES lpThreadAttributes, - bool bInheritHandle, - Int32 dwCreationFlags, - IntPtr lpEnvrionment, - string lpCurrentDirectory, - ref STARTUPINFO lpStartupInfo, - ref PROCESS_INFORMATION lpProcessInformation - ); - - [DllImport("advapi32.dll", EntryPoint = "DuplicateTokenEx")] - public static extern bool DuplicateTokenEx( - IntPtr hExistingToken, - Int32 dwDesiredAccess, - ref SECURITY_ATTRIBUTES lpThreadAttributes, - Int32 ImpersonationLevel, - Int32 dwTokenType, - ref IntPtr phNewToken - ); - - [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] - public static extern Boolean LogonUser( - String lpszUserName, - String lpszDomain, - String lpszPassword, - LogonType dwLogonType, - LogonProvider dwLogonProvider, - out IntPtr phToken - ); - - [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)] - internal static extern bool AdjustTokenPrivileges( - IntPtr htok, - bool disall, - ref TokPriv1Luid newst, - int len, - IntPtr prev, - IntPtr relen - ); - - [DllImport("kernel32.dll", ExactSpelling = true)] - internal static extern IntPtr GetCurrentProcess(); - - [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)] - internal static extern bool OpenProcessToken( - IntPtr h, - int acc, - ref IntPtr phtok - ); - - [DllImport("kernel32.dll", ExactSpelling = true)] - internal static extern int WaitForSingleObject( - IntPtr h, - int milliseconds - ); - - [DllImport("kernel32.dll", ExactSpelling = true)] - internal static extern bool GetExitCodeProcess( - IntPtr h, - out int exitcode - ); - - [DllImport("advapi32.dll", SetLastError = true)] - internal static extern bool LookupPrivilegeValue( - string host, - string name, - ref long pluid - ); - - public static void CreateProcessAsUser(string strCommand, string strDomain, string strName, string strPassword, ref int ExitCode ) - { - var hToken = IntPtr.Zero; - var hDupedToken = IntPtr.Zero; - TokPriv1Luid tp; - var pi = new PROCESS_INFORMATION(); - var sa = new SECURITY_ATTRIBUTES(); - sa.Length = Marshal.SizeOf(sa); - Boolean bResult = false; - try - { - bResult = LogonUser( - strName, - strDomain, - strPassword, - LogonType.LOGON32_LOGON_BATCH, - LogonProvider.LOGON32_PROVIDER_DEFAULT, - out hToken - ); - if (!bResult) - { - throw new Win32Exception("Logon error #" + Marshal.GetLastWin32Error().ToString()); - } - IntPtr hproc = GetCurrentProcess(); - IntPtr htok = IntPtr.Zero; - bResult = OpenProcessToken( - hproc, - TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, - ref htok - ); - if(!bResult) - { - throw new Win32Exception("Open process token error #" + Marshal.GetLastWin32Error().ToString()); - } - tp.Count = 1; - tp.Luid = 0; - tp.Attr = SE_PRIVILEGE_ENABLED; - bResult = LookupPrivilegeValue( - null, - SE_INCRASE_QUOTA, - ref tp.Luid - ); - if(!bResult) - { - throw new Win32Exception("Lookup privilege error #" + Marshal.GetLastWin32Error().ToString()); - } - bResult = AdjustTokenPrivileges( - htok, - false, - ref tp, - 0, - IntPtr.Zero, - IntPtr.Zero - ); - if(!bResult) - { - throw new Win32Exception("Token elevation error #" + Marshal.GetLastWin32Error().ToString()); - } - - bResult = DuplicateTokenEx( - hToken, - GENERIC_ALL_ACCESS, - ref sa, - (int)SECURITY_IMPERSONATION_LEVEL.SecurityIdentification, - (int)TOKEN_TYPE.TokenPrimary, - ref hDupedToken - ); - if(!bResult) - { - throw new Win32Exception("Duplicate Token error #" + Marshal.GetLastWin32Error().ToString()); - } - var si = new STARTUPINFO(); - si.cb = Marshal.SizeOf(si); - si.lpDesktop = ""; - bResult = CreateProcessAsUser( - hDupedToken, - null, - strCommand, - ref sa, - ref sa, - false, - 0, - IntPtr.Zero, - null, - ref si, - ref pi - ); - if(!bResult) - { - throw new Win32Exception("Create process as user error #" + Marshal.GetLastWin32Error().ToString()); - } - - int status = WaitForSingleObject(pi.hProcess, -1); - if(status == -1) - { - throw new Win32Exception("Wait during create process failed user error #" + Marshal.GetLastWin32Error().ToString()); - } - - bResult = GetExitCodeProcess(pi.hProcess, out ExitCode); - if(!bResult) - { - throw new Win32Exception("Retrieving status error #" + Marshal.GetLastWin32Error().ToString()); - } - } - finally - { - if (pi.hThread != IntPtr.Zero) - { - CloseHandle(pi.hThread); - } - if (pi.hProcess != IntPtr.Zero) - { - CloseHandle(pi.hProcess); - } - if (hDupedToken != IntPtr.Zero) - { - CloseHandle(hDupedToken); - } - } - } - } - } -'@ - Add-Type -TypeDefinition $programSource -ReferencedAssemblies 'System.ServiceProcess' -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xPackageResource/MSFT_xPackageResource.schema.mof b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xPackageResource/MSFT_xPackageResource.schema.mof deleted file mode 100644 index 6c7f46ac..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xPackageResource/MSFT_xPackageResource.schema.mof +++ /dev/null @@ -1,29 +0,0 @@ -[ClassVersion("1.0.0"),FriendlyName("xPackage")] -class MSFT_xPackageResource : OMI_BaseResource -{ - [write,ValueMap{"Present", "Absent"},Values{"Present", "Absent"}] string Ensure; - [Key] string Name; - [required] string Path; - [Key] string ProductId; - [write] string Arguments; - [write,EmbeddedInstance("MSFT_Credential")] string Credential; - [write] uint32 ReturnCode[]; - [write] string LogPath; - [read] string PackageDescription; - [read] string Publisher; - [read] string InstalledOn; - [read] uint32 Size; - [read] string Version; - [read] boolean Installed; - [write] string FileHash; - [write,ValueMap{"SHA1","SHA256","SHA384","SHA512","MD5","RIPEMD160"},Values{"SHA1","SHA256","SHA384","SHA512","MD5","RIPEMD160"}] string HashAlgorithm; - [write] string SignerSubject; - [write] string SignerThumbprint; - [write] string ServerCertificateValidationCallback; - [write,ValueMap{"LocalMachine","CurrentUser"},Values{"LocalMachine","CurrentUser"}] string InstalledCheckRegHive; - [write] string InstalledCheckRegKey; - [write] string InstalledCheckRegValueName; - [write] string InstalledCheckRegValueData; - [write] boolean CreateCheckRegValue; - [write,EmbeddedInstance("MSFT_Credential")] string RunAsCredential; -}; diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xPackageResource/en-US/MSFT_xPackageResource.schema.mfl b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xPackageResource/en-US/MSFT_xPackageResource.schema.mfl deleted file mode 100644 index e06b4ad3..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xPackageResource/en-US/MSFT_xPackageResource.schema.mfl +++ /dev/null @@ -1,32 +0,0 @@ -#pragma namespace("\\\\.\\root\\default") -instance of __namespace{ name="MS_409";}; -#pragma namespace("\\\\.\\root\\default\\MS_409") - -[AMENDMENT, LOCALE("MS_409")] -class MSFT_xPackageResource : OMI_BaseResource -{ - [Description("Indicates whether to Ensure that the package is Present or Absent (default Present)") : Amended] string Ensure; - [Key,Description("The name of the package to be added or removed") : Amended] string Name; - [Description("The path, URL or UNC path to the package") : Amended] string Path; - [Key,Description("The identifying number used to uniquely identify this package") : Amended] string ProductId; - [Description("The arguments to be passed to the package during addition or removal") : Amended] string Arguments; - [Description("The credentials to be used for mounting the UNC path (if applicable)") : Amended] string Credential; - [Description("The list of possible valid return codes for this install or removal") : Amended] uint32 ReturnCode[]; - [Description("The path to log the output of the MSI or EXE") : Amended] string LogPath; - [Description("The description of the identified package") : Amended] string PackageDescription; - [Description("The publisher for the identified package") : Amended] string Publisher; - [Description("The date that the identified package was last serviced or its install date, whichever is later") : Amended] string InstalledOn; - [Description("The size of the identified package") : Amended] uint32 Size; - [Description("The version number of the identified package") : Amended] string Version; - [Description("Whether the identified package is installed") : Amended] boolean Installed; - [Description("The credentials under which to run the installation") : Amended] string RunAsCredential; - [Description("The expected hash value of the file found in the Path location.") : Amended] string FileHash; - [Description("The algorithm used to generate the FileHash value. Defaults to SHA256") : Amended] string HashAlgorithm; - [Description("The subject that must match the signer certificate of the digital signature. Wildcards are allowed.") : Amended] string SignerSubject; - [Description("The certificate thumbprint which must match the signer certificate of the digital signature.") : Amended] string SignerThumbprint; - [Description("PowerShell code used to validate SSL certificates of HTTPS url assigned to Path.") : Amended] string ServerCertificateValidationCallback; - [Description("The Registry key to validate the package is installed") : Amended] string InstalledCheckRegKey; - [Description("The Registry value name to validate the package is installed") : Amended] string InstalledCheckRegValueName; - [Description("The Registry value to validate the package is installed") : Amended] string InstalledCheckRegValueData; -}; - diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xPackageResource/en-US/MSFT_xPackageResource.strings.psd1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xPackageResource/en-US/MSFT_xPackageResource.strings.psd1 deleted file mode 100644 index ebd8a560..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xPackageResource/en-US/MSFT_xPackageResource.strings.psd1 +++ /dev/null @@ -1,68 +0,0 @@ -# Localized resources for MSFT_xPackageResource - -ConvertFrom-StringData @' - InvalidIdentifyingNumber = The specified IdentifyingNumber ({0}) is not a valid Guid - InvalidPath = The specified Path ({0}) is not in a valid format. Valid formats are local paths, UNC, and HTTP - InvalidNameOrId = The specified Name ({0}) and IdentifyingNumber ({1}) do not match Name ({2}) and IdentifyingNumber ({3}) in the MSI file - NeedsMoreInfo = Either Name or ProductId is required - InvalidBinaryType = The specified Path ({0}) does not appear to specify an EXE or MSI file and as such is not supported - CouldNotOpenLog = The specified LogPath ({0}) could not be opened - CouldNotStartProcess = The process {0} could not be started - UnexpectedReturnCode = The return code {0} was not expected. Configuration is likely not correct - PathDoesNotExist = The given Path ({0}) could not be found - CouldNotOpenDestFile = Could not open the file {0} for writing - CouldNotGetHttpStream = Could not get the {0} stream for file {1} - ErrorCopyingDataToFile = Encountered error while writing the contents of {0} to {1} - PackageConfigurationComplete = Package configuration finished - PackageConfigurationStarting = Package configuration starting - InstalledPackage = Installed package - UninstalledPackage = Uninstalled package - NoChangeRequired = Package found in desired state, no action required - RemoveExistingLogFile = Remove existing log file - CreateLogFile = Create log file - MountSharePath = Mount share to get media - DownloadHTTPFile = Download the media over HTTP or HTTPS - StartingProcessMessage = Starting process {0} with arguments {1} - RemoveDownloadedFile = Remove the downloaded file - PackageInstalled = Package has been installed - PackageUninstalled = Package has been uninstalled - MachineRequiresReboot = The machine requires a reboot - PackageDoesNotAppearInstalled = The package {0} is not installed - PackageAppearsInstalled = The package {0} is installed - PostValidationError = Package from {0} was installed, but the specified ProductId and/or Name does not match package details - CheckingFileHash = Checking file '{0}' for expected {2} hash value of {1} - InvalidFileHash = File '{0}' does not match expected {2} hash value of {1}. - CheckingFileSignature = Checking file '{0}' for valid digital signature. - FileHasValidSignature = File '{0}' contains a valid digital signature. Signer Thumbprint: {1}, Subject: {2} - InvalidFileSignature = File '{0}' does not have a valid Authenticode signature. Status: {1} - WrongSignerSubject = File '{0}' was not signed by expected signer subject '{1}' - WrongSignerThumbprint = File '{0}' was not signed by expected signer certificate thumbprint '{1}' - CreatingRegistryValue = Creating package registry value of {0}. - RemovingRegistryValue = Removing package registry value of {0}. - ValidateStandardArgumentsPathwasPath = Validate-StandardArguments, Path was {0} - TheurischemewasuriScheme = The uri scheme was {0} - ThepathextensionwaspathExt = The path extension was {0} - ParsingProductIdasanidentifyingNumber = Parsing {0} as an identifyingNumber - ParsedProductIdasidentifyingNumber = Parsed {0} as {1} - EnsureisEnsure = Ensure is {0} - productisproduct = product {0} found - productasbooleanis = product as boolean is {0} - Creatingcachelocation = Creating cache location - NeedtodownloadfilefromschemedestinationwillbedestName = Need to download file from {0}, destination will be {1} - Creatingthedestinationcachefile = Creating the destination cache file - Creatingtheschemestream = Creating the {0} stream - Settingdefaultcredential = Setting default credential - Settingauthenticationlevel = Setting authentication level - Ignoringbadcertificates = Ignoring bad certificates - Gettingtheschemeresponsestream = Getting the {0} response stream - ErrorOutString = Error: {0} - Copyingtheschemestreambytestothediskcache = Copying the {0} stream bytes to the disk cache - Redirectingpackagepathtocachefilelocation = Redirecting package path to cache file location - ThebinaryisanEXE = The binary is an EXE - Userhasrequestedloggingneedtoattacheventhandlerstotheprocess = User has requested logging, need to attach event handlers to the process - StartingwithstartInfoFileNamestartInfoArguments = Starting {0} with {1} - ProvideParameterForRegistryCheck = Please provide the {0} parameter in order to check for installation status from a registry key. - ErrorSettingRegistryValue = An error occured while attempting to set the registry key {0} value {1} to {2} - ErrorRemovingRegistryValue = An error occured while attempting to remove the registry key {0} value {1} - ExeCouldNotBeUninstalled = The .exe file found at {0} could not be uninstalled. The uninstall functionality may not be implemented in this .exe file. -'@ diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xRegistryResource/MSFT_xRegistryResource.psm1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xRegistryResource/MSFT_xRegistryResource.psm1 deleted file mode 100644 index d7ab657f..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xRegistryResource/MSFT_xRegistryResource.psm1 +++ /dev/null @@ -1,1451 +0,0 @@ -$errorActionPreference = 'Stop' -Set-StrictMode -Version 'Latest' - -# Import CommonResourceHelper for Get-LocalizedData -$script:dscResourcesFolderFilePath = Split-Path $PSScriptRoot -Parent -$script:commonResourceHelperFilePath = Join-Path -Path $script:dscResourcesFolderFilePath -ChildPath 'CommonResourceHelper.psm1' -Import-Module -Name $script:commonResourceHelperFilePath - -# Localized messages for verbose and error statements in this resource -$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_xRegistryResource' - -$script:registryDriveRoots = @{ - 'HKCC' = 'HKEY_CURRENT_CONFIG' - 'HKCR' = 'HKEY_CLASSES_ROOT' - 'HKCU' = 'HKEY_CURRENT_USER' - 'HKLM' = 'HKEY_LOCAL_MACHINE' - 'HKUS' = 'HKEY_USERS' -} - -<# - .SYNOPSIS - Retrieves the current state of the Registry resource with the given Key. - - .PARAMETER Key - The path of the registry key to retrieve the state of. - This path must include the registry hive. - - .PARAMETER ValueName - The name of the registry value to retrieve the state of. - - .PARAMETER ValueData - Used only as a boolean flag (along with ValueType) to determine if the target entity is the - Default Value or the key itself. - - .PARAMETER ValueType - Used only as a boolean flag (along with ValueData) to determine if the target entity is the - Default Value or the key itself. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Key, - - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [String] - [AllowEmptyString()] - $ValueName, - - [String[]] - $ValueData, - - [ValidateSet('String', 'Binary', 'DWord', 'QWord', 'MultiString', 'ExpandString')] - [String] - $ValueType - ) - - Write-Verbose -Message ($script:localizedData.GetTargetResourceStartMessage -f $Key) - - $registryResource = @{ - Key = $Key - Ensure = 'Absent' - ValueName = $null - ValueType = $null - ValueData = $null - } - - # Retrieve the registry key at the specified path - $registryKey = Get-RegistryKey -RegistryKeyPath $Key - - # Check if the registry key exists - if ($null -eq $registryKey) - { - Write-Verbose -Message ($script:localizedData.RegistryKeyDoesNotExist -f $Key) - } - else - { - Write-Verbose -Message ($script:localizedData.RegistryKeyExists -f $Key) - - # Check if the user specified a value name to retrieve - $valueNameSpecified = (-not [String]::IsNullOrEmpty($ValueName)) -or $PSBoundParameters.ContainsKey('ValueType') -or $PSBoundParameters.ContainsKey('ValueData') - - if ($valueNameSpecified) - { - $valueDisplayName = Get-RegistryKeyValueDisplayName -RegistryKeyValueName $ValueName - $registryResource['ValueName'] = $valueDisplayName - - # If a value name was specified, retrieve the value with the specified name from the retrieved registry key - $registryKeyValue = Get-RegistryKeyValue -RegistryKey $registryKey -RegistryKeyValueName $ValueName - - # Check if the registry key value exists - if ($null -eq $registryKeyValue) - { - Write-Verbose -Message ($script:localizedData.RegistryKeyValueDoesNotExist -f $Key, $valueDisplayName) - } - else - { - Write-Verbose -Message ($script:localizedData.RegistryKeyValueExists -f $Key, $valueDisplayName) - - # If the registry key value exists, retrieve its type - $actualValueType = Get-RegistryKeyValueType -RegistryKey $registryKey -RegistryKeyValueName $ValueName - - # If the registry key value exists, convert it to a readable string - $registryKeyValueAsReadableString = @() + (ConvertTo-ReadableString -RegistryKeyValue $registryKeyValue -RegistryKeyValueType $actualValueType) - - $registryResource['Ensure'] = 'Present' - $registryResource['ValueType'] = $actualValueType - $registryResource['ValueData'] = $registryKeyValueAsReadableString - } - } - else - { - $registryResource['Ensure'] = 'Present' - } - } - - Write-Verbose -Message ($script:localizedData.GetTargetResourceEndMessage -f $Key) - - return $registryResource -} - -<# - .SYNOPSIS - Sets the Registry resource with the given Key to the specified state. - - .PARAMETER Key - The path of the registry key to set the state of. - This path must include the registry hive. - - .PARAMETER ValueName - The name of the registry value to set. - - To add or remove a registry key, specify this property as an empty string without - specifying ValueType or ValueData. To modify or remove the default value of a registry key, - specify this property as an empty string while also specifying ValueType or ValueData. - - .PARAMETER Ensure - Specifies whether or not the registry key with the given path and the registry key value with the given name should exist. - - To ensure that the registry key and value exists, set this property to Present. - To ensure that the registry key and value do not exist, set this property to Absent. - - The default value is Present. - - .PARAMETER ValueData - The data to set as the registry key value. - - .PARAMETER ValueType - The type of the value to set. - - The supported types are: - String (REG_SZ) - Binary (REG-BINARY) - Dword 32-bit (REG_DWORD) - Qword 64-bit (REG_QWORD) - Multi-string (REG_MULTI_SZ) - Expandable string (REG_EXPAND_SZ) - - .PARAMETER Hex - Specifies whether or not the value data should be expressed in hexadecimal format. - - If specified, DWORD/QWORD value data is presented in hexadecimal format. - Not valid for other value types. - - The default value is $false. - - .PARAMETER Force - Specifies whether or not to overwrite the registry key with the given path with the new - value if it is already present. -#> -function Set-TargetResource -{ - [CmdletBinding(SupportsShouldProcess = $true)] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Key, - - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [String] - [AllowEmptyString()] - $ValueName, - - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present', - - [ValidateNotNull()] - [String[]] - $ValueData = @(), - - [ValidateSet('String', 'Binary', 'DWord', 'QWord', 'MultiString', 'ExpandString')] - [String] - $ValueType = 'String', - - [Boolean] - $Hex = $false, - - [Boolean] - $Force = $false - ) - - Write-Verbose -Message ($script:localizedData.SetTargetResourceStartMessage -f $Key) - - # Retrieve the registry key at the specified path - $registryKey = Get-RegistryKey -RegistryKeyPath $Key -WriteAccessAllowed - - # Check if the registry key exists - if ($null -eq $registryKey) - { - Write-Verbose -Message ($script:localizedData.RegistryKeyDoesNotExist -f $Key) - - # Check if the user wants the registry key to exist - if ($Ensure -eq 'Present') - { - Write-Verbose -Message ($script:localizedData.CreatingRegistryKey -f $Key) - $registryKey = New-RegistryKey -RegistryKeyPath $Key - } - } - - # Check if the registry key exists - if ($null -ne $registryKey) - { - Write-Verbose -Message ($script:localizedData.RegistryKeyExists -f $Key) - - $valueNameSpecified = (-not [String]::IsNullOrEmpty($ValueName)) -or $PSBoundParameters.ContainsKey('ValueType') -or $PSBoundParameters.ContainsKey('ValueData') - - # Check if the user wants to set a registry key value - if ($valueNameSpecified) - { - # Retrieve the display name of the specified registry key value - $valueDisplayName = Get-RegistryKeyValueDisplayName -RegistryKeyValueName $ValueName - - # Retrieve the existing registry key value - $actualRegistryKeyValue = Get-RegistryKeyValue -RegistryKey $registryKey -RegistryKeyValueName $ValueName - - # Check if the user wants to add/modify or remove the registry key value - if ($Ensure -eq 'Present') - { - # Convert the specified registry key value to the specified type - $expectedRegistryKeyValue = switch ($ValueType) - { - 'Binary' { ConvertTo-Binary -RegistryKeyValue $ValueData; break } - 'DWord' { ConvertTo-DWord -RegistryKeyValue $ValueData -Hex $Hex; break } - 'MultiString' { ConvertTo-MultiString -RegistryKeyValue $ValueData; break } - 'QWord' { ConvertTo-QWord -RegistryKeyValue $ValueData -Hex $Hex; break } - default { ConvertTo-String -RegistryKeyValue $ValueData} - } - - # Retrieve the name of the registry key - $registryKeyName = Get-RegistryKeyName -RegistryKey $registryKey - - # Check if the registry key value exists - if ($null -eq $actualRegistryKeyValue) - { - # If the registry key value does not exist, set the new value - Write-Verbose -Message ($script:localizedData.SettingRegistryKeyValue -f $valueDisplayName, $Key) - $null = Set-RegistryKeyValue -RegistryKeyName $registryKeyName -RegistryKeyValueName $ValueName -RegistryKeyValue $expectedRegistryKeyValue -ValueType $ValueType - } - else - { - # If the registry key value exists, check if the specified registry key value matches the retrieved registry key value - if (Test-RegistryKeyValuesMatch -ExpectedRegistryKeyValue $expectedRegistryKeyValue -ActualRegistryKeyValue $actualRegistryKeyValue -RegistryKeyValueType $ValueType) - { - # If the specified registry key value matches the retrieved registry key value, no change is needed - Write-Verbose -Message ($script:localizedData.RegistryKeyValueAlreadySet -f $valueDisplayName, $Key) - } - else - { - # If the specified registry key value matches the retrieved registry key value, check if the user wants to overwrite the value - if (-not $Force) - { - # If the user does not want to overwrite the value, throw an error - New-InvalidOperationException -Message ($script:localizedData.CannotOverwriteExistingRegistryKeyValueWithoutForce -f $Key, $valueDisplayName) - } - else - { - # If the user does want to overwrite the value, overwrite the value - Write-Verbose -Message ($script:localizedData.OverwritingRegistryKeyValue -f $valueDisplayName, $Key) - $null = Set-RegistryKeyValue -RegistryKeyName $registryKeyName -RegistryKeyValueName $ValueName -RegistryKeyValue $expectedRegistryKeyValue -ValueType $ValueType - } - } - } - } - else - { - # Check if the registry key value exists - if ($null -ne $actualRegistryKeyValue) - { - Write-Verbose -Message ($script:localizedData.RemovingRegistryKeyValue -f $valueDisplayName, $Key) - - # If the specified registry key value exists, check if the user specified a registry key value with a name to remove - if (-not [String]::IsNullOrEmpty($ValueName)) - { - # If the user specified a registry key value with a name to remove, remove the registry key value with the specified name - $null = Remove-ItemProperty -Path $Key -Name $ValueName -Force - } - else - { - # If the user did not specify a registry key value with a name to remove, remove the default registry key value - $null = Remove-DefaultRegistryKeyValue -RegistryKey $registryKey - } - } - } - } - else - { - # Check if the user wants to remove the registry key - if ($Ensure -eq 'Absent') - { - # Retrieve the number of subkeys the registry key has - $registryKeySubKeyCount = Get-RegistryKeySubKeyCount -RegistryKey $registryKey - - # Check if the registry key has subkeys and the user does not want to forcibly remove the registry key - if ($registryKeySubKeyCount -gt 0 -and -not $Force) - { - New-InvalidOperationException -Message ($script:localizedData.CannotRemoveExistingRegistryKeyWithSubKeysWithoutForce -f $Key) - } - else - { - # Remove the registry key - Write-Verbose -Message ($script:localizedData.RemovingRegistryKey -f $Key) - $null = Remove-Item -Path $Key -Recurse -Force - } - } - } - } - - Write-Verbose -Message ($script:localizedData.SetTargetResourceEndMessage -f $Key) -} - -<# - .SYNOPSIS - Tests if the Registry resource with the given key is in the specified state. - - .PARAMETER Key - The path of the registry key to test the state of. - This path must include the registry hive. - - .PARAMETER ValueName - The name of the registry value to check for. - Specify this property as an empty string ('') to check the default value of the registry key. - - .PARAMETER Ensure - Specifies whether or not the registry key and value should exist. - - To test that they exist, set this property to "Present". - To test that they do not exist, set the property to "Absent". - The default value is "Present". - - .PARAMETER ValueData - The data the registry key value should have. - - .PARAMETER ValueType - The type of the value. - - The supported types are: - String (REG_SZ) - Binary (REG-BINARY) - Dword 32-bit (REG_DWORD) - Qword 64-bit (REG_QWORD) - Multi-string (REG_MULTI_SZ) - Expandable string (REG_EXPAND_SZ) - - .PARAMETER Hex - Not used in Test-TargetResource. - - .PARAMETER Force - Not used in Test-TargetResource. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Key, - - [Parameter(Mandatory = $true)] - [AllowEmptyString()] - [ValidateNotNull()] - [String] - $ValueName, - - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present', - - [ValidateNotNull()] - [String[]] - $ValueData = @(), - - [ValidateSet('String', 'Binary', 'DWord', 'QWord', 'MultiString', 'ExpandString')] - [String] - $ValueType = 'String', - - [Boolean] - $Hex = $false, - - [Boolean] - $Force = $false - ) - - Write-Verbose -Message ($script:localizedData.TestTargetResourceStartMessage -f $Key) - - $registryResourceInDesiredState = $false - - $getTargetResourceParameters = @{ - Key = $Key - ValueName = $ValueName - } - - if ($PSBoundParameters.ContainsKey('ValueType')) - { - $getTargetResourceParameters['ValueType'] = $ValueType - } - - if ($PSBoundParameters.ContainsKey('ValueData')) - { - $getTargetResourceParameters['ValueData'] = $ValueData - } - - $registryResource = Get-TargetResource @getTargetResourceParameters - - # Check if the user specified a value name to retrieve - $valueNameSpecified = (-not [String]::IsNullOrEmpty($ValueName)) -or $PSBoundParameters.ContainsKey('ValueType') -or $PSBoundParameters.ContainsKey('ValueData') - - if ($valueNameSpecified) - { - $valueDisplayName = Get-RegistryKeyValueDisplayName -RegistryKeyValueName $ValueName - - if ($registryResource.Ensure -eq 'Absent') - { - Write-Verbose -Message ($script:localizedData.RegistryKeyValueDoesNotExist -f $Key, $valueDisplayName) - $registryResourceInDesiredState = $Ensure -eq 'Absent' - } - else - { - Write-Verbose -Message ($script:localizedData.RegistryKeyValueExists -f $Key, $valueDisplayName) - - if ($Ensure -eq 'Absent') - { - $registryResourceInDesiredState = $false - } - elseif ($PSBoundParameters.ContainsKey('ValueType') -and $ValueType -ne $registryResource.ValueType) - { - Write-Verbose -Message ($script:localizedData.RegistryKeyValueTypeDoesNotMatch -f $valueDisplayName, $Key, $ValueType, $registryResource.ValueType) - - $registryResourceInDesiredState = $false - } - elseif ($PSBoundParameters.ContainsKey('ValueData')) - { - # Need to get the actual registry key value since Get-TargetResource returns - $registryKey = Get-RegistryKey -RegistryKeyPath $Key - $actualRegistryKeyValue = Get-RegistryKeyValue -RegistryKey $registryKey -RegistryKeyValueName $ValueName - - if (-not $PSBoundParameters.ContainsKey('ValueType') -and $null -ne $registryResource.ValueType) - { - $ValueType = $registryResource.ValueType - } - - # Convert the specified registry key value to the specified type - $expectedRegistryKeyValue = switch ($ValueType) - { - 'Binary' { ConvertTo-Binary -RegistryKeyValue $ValueData; break } - 'DWord' { ConvertTo-DWord -RegistryKeyValue $ValueData -Hex $Hex; break } - 'MultiString' { ConvertTo-MultiString -RegistryKeyValue $ValueData; break } - 'QWord' { ConvertTo-QWord -RegistryKeyValue $ValueData -Hex $Hex; break } - default { ConvertTo-String -RegistryKeyValue $ValueData; break } - } - - if (-not (Test-RegistryKeyValuesMatch -ExpectedRegistryKeyValue $expectedRegistryKeyValue -ActualRegistryKeyValue $actualRegistryKeyValue -RegistryKeyValueType $ValueType)) - { - Write-Verbose -Message ($script:localizedData.RegistryKeyValueDoesNotMatch -f $valueDisplayName, $Key, $ValueData, $registryResource.ValueData) - - $registryResourceInDesiredState = $false - } - else - { - $registryResourceInDesiredState = $true - } - } - else - { - $registryResourceInDesiredState = $true - } - } - } - else - { - if ($registryResource.Ensure -eq 'Present') - { - Write-Verbose -Message ($script:localizedData.RegistryKeyExists -f $Key) - $registryResourceInDesiredState = $Ensure -eq 'Present' - } - else - { - Write-Verbose -Message ($script:localizedData.RegistryKeyDoesNotExist -f $Key) - $registryResourceInDesiredState = $Ensure -eq 'Absent' - } - } - - Write-Verbose -Message ($script:localizedData.TestTargetResourceEndMessage -f $Key) - - return $registryResourceInDesiredState -} - -<# - .SYNOPSIS - Retrieves the root of the specified path. - - .PARAMETER Path - The path to retrieve the root of. -#> -function Get-PathRoot -{ - [OutputType([String])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path - ) - - $pathParent = Split-Path -Path $Path -Parent - $pathRoot = $Path - - while (-not [String]::IsNullOrEmpty($pathParent)) - { - $pathRoot = Split-Path -Path $pathParent -Leaf - $pathParent = Split-Path -Path $pathParent -Parent - } - - return $pathRoot -} - -<# - .SYNOPSIS - Converts the specified registry drive root to its corresponding registry drive name. - - .PARAMETER RegistryDriveRoot - The registry drive root to convert. -#> -function ConvertTo-RegistryDriveName -{ - [OutputType([String])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $RegistryDriveRoot - ) - - $registryDriveName = $null - - if ($script:registryDriveRoots.ContainsValue($RegistryDriveRoot)) - { - foreach ($registryDriveRootsKey in $script:registryDriveRoots.Keys) - { - if ($script:registryDriveRoots[$registryDriveRootsKey] -ieq $RegistryDriveRoot) - { - $registryDriveName = $registryDriveRootsKey - break - } - } - } - - return $registryDriveName -} - -<# - .SYNOPSIS - Retrieves the name of the registry drive at the root of the the specified registry key path. - - .PARAMETER RegistryKeyPath - The registry key path to retrieve the registry drive name from. -#> -function Get-RegistryDriveName -{ - [OutputType([String])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $RegistryKeyPath - ) - - $registryKeyPathRoot = Get-PathRoot -Path $RegistryKeyPath - $registryKeyPathRoot = $registryKeyPathRoot.TrimEnd('\') - - if ($registryKeyPathRoot.Contains(':')) - { - $registryDriveName = $registryKeyPathRoot.TrimEnd(':') - - if (-not $script:registryDriveRoots.ContainsKey($registryDriveName)) - { - New-InvalidArgumentException -ArgumentName 'Key' -Message ($script:localizedData.InvalidRegistryDrive -f $registryDriveName) - } - } - else - { - $registryDriveName = ConvertTo-RegistryDriveName -RegistryDriveRoot $registryKeyPathRoot - - if ([String]::IsNullOrEmpty($registryDriveName)) - { - New-InvalidArgumentException -ArgumentName 'Key' -Message ($script:localizedData.InvalidRegistryDrive -f $registryKeyPathRoot) - } - } - - return $registryDriveName -} - -<# - .SYNOPSIS - Mounts the registry drive with the specified name. - - .PARAMETER RegistryKeyName - The name of the registry drive to mount. -#> -function Mount-RegistryDrive -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $RegistryDriveName - ) - - $registryDriveInfo = Get-PSDrive -Name $RegistryDriveName -ErrorAction 'SilentlyContinue' - - if ($null -eq $registryDriveInfo) - { - $newPSDriveParameters = @{ - Name = $RegistryDriveName - Root = $script:registryDriveRoots[$RegistryDriveName] - PSProvider = 'Registry' - Scope = 'Script' - } - - $registryDriveInfo = New-PSDrive @newPSDriveParameters - } - - # Validate that the specified PSDrive is valid - if (($null -eq $registryDriveInfo) -or ($null -eq $registryDriveInfo.Provider) -or ($registryDriveInfo.Provider.Name -ine 'Registry')) - { - New-InvalidOperationException -Message ($script:localizedData.RegistryDriveCouldNotBeMounted -f $RegistryDriveName) - } -} - -<# - .SYNOPSIS - Opens the specified registry sub key under the specified registry parent key. - This is a wrapper function for unit testing. - - .PARAMETER ParentKey - The parent registry key which contains the sub key to open. - - .PARAMETER SubKey - The sub key to open. - - .PARAMETER WriteAccessAllowed - Specifies whether or not to open the sub key with permissions to write to it. -#> -function Open-RegistrySubKey -{ - [OutputType([Microsoft.Win32.RegistryKey])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [Microsoft.Win32.RegistryKey] - $ParentKey, - - [Parameter(Mandatory = $true)] - [String] - [AllowEmptyString()] - $SubKey, - - [Parameter()] - [Switch] - $WriteAccessAllowed - ) - - return $ParentKey.OpenSubKey($SubKey, $WriteAccessAllowed) -} - -<# - .SYNOPSIS - Opens and retrieves the registry key at the specified path. - - .PARAMETER RegistryKeyPath - The path to the registry key to open. - The path must include the registry drive. - - .PARAMETER WriteAccessAllowed - Specifies whether or not to open the key with permissions to write to it. - - .NOTES - This method is used instead of Get-Item so that there is no ambiguity between - forward slashes as path separators vs literal characters in a key name - (which is valid in the registry). - -#> -function Get-RegistryKey -{ - [OutputType([Microsoft.Win32.RegistryKey])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $RegistryKeyPath, - - [Switch] - $WriteAccessAllowed - ) - - # Parse the registry drive from the specified registry key path - $registryDriveName = Get-RegistryDriveName -RegistryKeyPath $RegistryKeyPath - - # Mount the registry drive if needed - Mount-RegistryDrive -RegistryDriveName $registryDriveName - - # Retrieve the registry drive key - $registryDriveKey = Get-Item -LiteralPath ($registryDriveName + ':') - - # Parse the registry drive subkey from the specified registry key path - $indexOfBackSlashInPath = $RegistryKeyPath.IndexOf('\') - if ($indexOfBackSlashInPath -ge 0 -and $indexOfBackSlashInPath -lt ($RegistryKeyPath.Length - 1)) - { - $registryDriveSubKey = $RegistryKeyPath.Substring($RegistryKeyPath.IndexOf('\') + 1) - } - else - { - $registryDriveSubKey = '' - } - - # Open the registry drive subkey - $registryKey = Open-RegistrySubKey -ParentKey $registryDriveKey -SubKey $registryDriveSubKey -WriteAccessAllowed:$WriteAccessAllowed - - # Return the opened registry key - return $registryKey -} - -<# - .SYNOPSIS - Retrieves the display name of the default registry key value if needed. - - .PARAMETER RegistryKeyValueName - The name of the registry key value to retrieve the display name of. -#> -function Get-RegistryKeyValueDisplayName -{ - [OutputType([String])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [String] - [AllowNull()] - [AllowEmptyString()] - $RegistryKeyValueName - ) - - $registryKeyValueDisplayName = $RegistryKeyValueName - - if ([String]::IsNullOrEmpty($RegistryKeyValueName)) - { - $registryKeyValueDisplayName = $script:localizedData.DefaultValueDisplayName - } - - return $registryKeyValueDisplayName -} - -<# - .SYNOPSIS - Retrieves the registry key value with the specified name from the specified registry key. - This is a wrapper function for unit testing. - - .PARAMETER RegistryKey - The registry key to retrieve the value from. - - .PARAMETER RegistryKeyValueName - The name of the registry key value to retrieve. -#> -function Get-RegistryKeyValue -{ - [OutputType([Object[]])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [Microsoft.Win32.RegistryKey] - $RegistryKey, - - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [String] - [AllowEmptyString()] - $RegistryKeyValueName - ) - - $registryValueOptions = [Microsoft.Win32.RegistryValueOptions]::DoNotExpandEnvironmentNames - $registryKeyValue = $RegistryKey.GetValue($RegistryKeyValueName, $null, $registryValueOptions) - return ,$registryKeyValue -} - -<# - .SYNOPSIS - Retrieves the type of the registry key value with the specified name from the the specified - registry key. - This is a wrapper function for unit testing. - - .PARAMETER RegistryKey - The registry key to retrieve the type of the value from. - - .PARAMETER RegistryKeyValueName - The name of the registry key value to retrieve the type of. -#> -function Get-RegistryKeyValueType -{ - [OutputType([Type])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [Microsoft.Win32.RegistryKey] - $RegistryKey, - - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [String] - [AllowEmptyString()] - $RegistryKeyValueName - ) - - return $RegistryKey.GetValueKind($RegistryKeyValueName) -} - -<# - .SYNOPSIS - Converts the specified byte array to a hex string. - - .PARAMETER ByteArray - The byte array to convert. -#> -function Convert-ByteArrayToHexString -{ - [OutputType([String])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [Object[]] - [AllowEmptyCollection()] - $ByteArray - ) - - $hexString = '' - - foreach ($byte in $ByteArray) - { - $hexString += ('{0:x2}' -f $byte) - } - - return $hexString -} - -<# - .SYNOPSIS - Converts the specified registry key value to a readable string. - - .PARAMETER RegistryKeyValue - The registry key value to convert. - - .PARAMETER RegistryKeyValueType - The type of the registry key value to convert. -#> -function ConvertTo-ReadableString -{ - [OutputType([String])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [Object[]] - [AllowNull()] - [AllowEmptyCollection()] - $RegistryKeyValue, - - [Parameter(Mandatory = $true)] - [ValidateSet('String', 'Binary', 'DWord', 'QWord', 'MultiString', 'ExpandString')] - [String] - $RegistryKeyValueType - ) - - $registryKeyValueAsString = [String]::Empty - - if ($null -ne $RegistryKeyValue) - { - # For Binary type data, convert the received bytes back to a readable hex-string - if ($RegistryKeyValueType -eq 'Binary') - { - $RegistryKeyValue = Convert-ByteArrayToHexString -ByteArray $RegistryKeyValue - } - - if ($RegistryKeyValueType -ne 'MultiString') - { - $RegistryKeyValue = [String[]]@() + $RegistryKeyValue - } - - if ($RegistryKeyValue.Count -eq 1 -and -not [String]::IsNullOrEmpty($RegistryKeyValue[0])) - { - $registryKeyValueAsString = $RegistryKeyValue[0].ToString() - } - elseif ($RegistryKeyValue.Count -gt 1) - { - $registryKeyValueAsString = "($($RegistryKeyValue -join ', '))" - } - } - - return $registryKeyValueAsString -} - -<# - .SYNOPSIS - Creates a new subkey with the specified name under the specified registry key. - This is a wrapper function for unit testing. - - .PARAMETER ParentRegistryKey - The parent registry key to create the new subkey under. - - .PARAMETER SubKeyName - The name of the new subkey to create. -#> -function New-RegistrySubKey -{ - [OutputType([Microsoft.Win32.RegistryKey])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [Microsoft.Win32.RegistryKey] - $ParentRegistryKey, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $SubKeyName - ) - - return $ParentRegistryKey.CreateSubKey($SubKeyName) -} - -<# - .SYNOPSIS - Creates a new registry key at the specified registry key path. - - .PARAMETER RegistryKeyPath - The path at which to create the registry key. - This path must include the registry drive. -#> -function New-RegistryKey -{ - [OutputType([Microsoft.Win32.RegistryKey])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $RegistryKeyPath - ) - - # registry key names can contain forward slashes, so we can't use Split-Path here (it will split on /) - $lastSep = $RegistryKeyPath.LastIndexOf('\') - $parentRegistryKeyPath = $RegistryKeyPath.Substring(0, $lastSep) - $newRegistryKeyName = $RegistryKeyPath.Substring($lastSep + 1) - - $parentRegistryKey = Get-RegistryKey -RegistryKeyPath $parentRegistryKeyPath -WriteAccessAllowed - - if ($null -eq $parentRegistryKey) - { - # If the parent registry key does not exist, create it - $parentRegistryKey = New-RegistryKey -RegistryKeyPath $parentRegistryKeyPath - } - - $newRegistryKey = New-RegistrySubKey -ParentRegistryKey $parentRegistryKey -SubKeyName $newRegistryKeyName - - return $newRegistryKey -} - -<# - .SYNOPSIS - Retrieves the name of the specified registry key. - This is a wrapper function for unit testing. - - .PARAMETER RegistryKey - The registry key to retrieve the name of. -#> -function Get-RegistryKeyName -{ - [OutputType([String])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [Microsoft.Win32.RegistryKey] - $RegistryKey - ) - - return $RegistryKey.Name -} - -<# - .SYNOPSIS - Converts the specified registry key value to a byte array for the Binary registry type. - - .PARAMETER RegistryKeyValue - The registry key value to convert. -#> -function ConvertTo-Binary -{ - [OutputType([Byte[]])] - [CmdletBinding()] - param - ( - [Parameter()] - [AllowNull()] - [String[]] - [AllowEmptyCollection()] - $RegistryKeyValue - ) - - if (($null -ne $RegistryKeyValue) -and ($RegistryKeyValue.Count -gt 1)) - { - New-InvalidArgumentException -ArgumentName 'ValueData' -Message ($script:localizedData.ArrayNotAllowedForExpectedType -f 'Binary') - } - - $binaryRegistryKeyValue = [Byte[]] @() - - if (($null -ne $RegistryKeyValue) -and ($RegistryKeyValue.Count -eq 1) -and (-not [String]::IsNullOrEmpty($RegistryKeyValue[0]))) - { - $singleRegistryKeyValue = $RegistryKeyValue[0] - - if ($singleRegistryKeyValue.StartsWith('0x')) - { - $singleRegistryKeyValue = $singleRegistryKeyValue.Substring('0x'.Length) - } - - if (($singleRegistryKeyValue.Length % 2) -ne 0) - { - $singleRegistryKeyValue = $singleRegistryKeyValue.PadLeft($singleRegistryKeyValue.Length + 1, '0') - } - - try - { - for ($singleRegistryKeyValueIndex = 0 ; $singleRegistryKeyValueIndex -lt ($singleRegistryKeyValue.Length - 1) ; $singleRegistryKeyValueIndex = $singleRegistryKeyValueIndex + 2) - { - $binaryRegistryKeyValue += [Byte]::Parse($singleRegistryKeyValue.Substring($singleRegistryKeyValueIndex, 2), 'HexNumber') - } - } - catch - { - New-InvalidArgumentException -ArgumentName 'ValueData' -Message ($script:localizedData.BinaryDataNotInHexFormat -f $singleRegistryKeyValue) - } - } - - return $binaryRegistryKeyValue -} - -<# - .SYNOPSIS - Converts the specified registry key value to an Int32 for the DWord registry type. - - .PARAMETER RegistryKeyValue - The registry key value to convert. -#> -function ConvertTo-DWord -{ - [OutputType([System.Int32])] - [CmdletBinding()] - param - ( - [Parameter()] - [AllowNull()] - [String[]] - [AllowEmptyCollection()] - $RegistryKeyValue, - - [Parameter()] - [Boolean] - $Hex = $false - ) - - if (($null -ne $RegistryKeyValue) -and ($RegistryKeyValue.Count -gt 1)) - { - New-InvalidArgumentException -ArgumentName 'ValueData' -Message ($script:localizedData.ArrayNotAllowedForExpectedType -f 'Dword') - } - - $dwordRegistryKeyValue = [System.Int32] 0 - - if (($null -ne $RegistryKeyValue) -and ($RegistryKeyValue.Count -eq 1) -and (-not [String]::IsNullOrEmpty($RegistryKeyValue[0]))) - { - $singleRegistryKeyValue = $RegistryKeyValue[0] - - if ($Hex) - { - if ($singleRegistryKeyValue.StartsWith('0x')) - { - $singleRegistryKeyValue = $singleRegistryKeyValue.Substring('0x'.Length) - } - - $currentCultureInfo = [System.Globalization.CultureInfo]::CurrentCulture - $referenceValue = $null - - if ([System.Int32]::TryParse($singleRegistryKeyValue, 'HexNumber', $currentCultureInfo, [Ref] $referenceValue)) - { - $dwordRegistryKeyValue = $referenceValue - } - else - { - New-InvalidArgumentException -ArgumentName 'ValueData' -Message ($script:localizedData.DWordDataNotInHexFormat -f $singleRegistryKeyValue) - } - } - else - { - $dwordRegistryKeyValue = [System.Int32]::Parse($singleRegistryKeyValue) - } - } - - return $dwordRegistryKeyValue -} - -<# - .SYNOPSIS - Converts the specified registry key value to a string array for the MultiString registry type. - - .PARAMETER RegistryKeyValue - The registry key value to convert. -#> -function ConvertTo-MultiString -{ - [OutputType([String[]])] - [CmdletBinding()] - param - ( - [Parameter()] - [AllowNull()] - [String[]] - [AllowEmptyCollection()] - $RegistryKeyValue - ) - - $multiStringRegistryKeyValue = [String[]] @() - - if (($null -ne $RegistryKeyValue) -and ($RegistryKeyValue.Length -gt 0)) - { - $multiStringRegistryKeyValue = [String[]]$RegistryKeyValue - } - - return $multiStringRegistryKeyValue -} - -<# - .SYNOPSIS - Converts the specified registry key value to an Int64 for the QWord registry type. - - .PARAMETER RegistryKeyValue - The registry key value to convert. -#> -function ConvertTo-QWord -{ - [OutputType([System.Int64])] - [CmdletBinding()] - param - ( - [Parameter()] - [AllowNull()] - [String[]] - [AllowEmptyCollection()] - $RegistryKeyValue, - - [Parameter()] - [Boolean] - $Hex = $false - ) - - if (($null -ne $RegistryKeyValue) -and ($RegistryKeyValue.Count -gt 1)) - { - New-InvalidArgumentException -ArgumentName 'ValueData' -Message ($script:localizedData.ArrayNotAllowedForExpectedType -f 'Qword') - } - - $qwordRegistryKeyValue = [System.Int64] 0 - - if (($null -ne $RegistryKeyValue) -and ($RegistryKeyValue.Count -eq 1) -and (-not [String]::IsNullOrEmpty($RegistryKeyValue[0]))) - { - $singleRegistryKeyValue = $RegistryKeyValue[0] - - if ($Hex) - { - if ($singleRegistryKeyValue.StartsWith('0x')) - { - $singleRegistryKeyValue = $singleRegistryKeyValue.Substring('0x'.Length) - } - - $currentCultureInfo = [System.Globalization.CultureInfo]::CurrentCulture - $referenceValue = $null - - if ([System.Int64]::TryParse($singleRegistryKeyValue, 'HexNumber', $currentCultureInfo, [Ref] $referenceValue)) - { - $qwordRegistryKeyValue = $referenceValue - } - else - { - New-InvalidArgumentException -ArgumentName 'ValueData' -Message ($script:localizedData.QWordDataNotInHexFormat -f $singleRegistryKeyValue) - } - } - else - { - $qwordRegistryKeyValue = [System.Int64]::Parse($singleRegistryKeyValue) - } - } - - return $qwordRegistryKeyValue -} - -<# - .SYNOPSIS - Converts the specified registry key value to a string for the String or ExpandString registry types. - - .PARAMETER RegistryKeyValue - The registry key value to convert. -#> -function ConvertTo-String -{ - [OutputType([String])] - [CmdletBinding()] - param - ( - [Parameter()] - [AllowNull()] - [String[]] - [AllowEmptyCollection()] - $RegistryKeyValue - ) - - if (($null -ne $RegistryKeyValue) -and ($RegistryKeyValue.Count -gt 1)) - { - New-InvalidArgumentException -ArgumentName 'ValueData' -Message ($script:localizedData.ArrayNotAllowedForExpectedType -f 'String or ExpandString') - } - - $registryKeyValueAsString = [String]::Empty - - if (($null -ne $RegistryKeyValue) -and ($RegistryKeyValue.Count -eq 1)) - { - $registryKeyValueAsString = [String]$RegistryKeyValue[0] - } - - return $registryKeyValueAsString -} - -<# - .SYNOPSIS - Sets the specified registry key value with the specified name to the specified value. - This is a wrapper function for unit testing. - - .PARAMETER RegistryKeyName - The name of the registry key that the value to set is under. - - .PARAMETER RegistryKeyValueName - The name of the registry key value to set. - - .PARAMETER RegistryKeyValue - The new value to set the registry key value to. - - .PARAMETER RegistryKeyValueType - The type of the new value to set the registry key value to. -#> -function Set-RegistryKeyValue -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $RegistryKeyName, - - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [String] - [AllowEmptyString()] - $RegistryKeyValueName, - - [Parameter(Mandatory = $true)] - [Object] - [AllowNull()] - $RegistryKeyValue, - - [Parameter(Mandatory = $true)] - [ValidateSet('String', 'Binary', 'DWord', 'QWord', 'MultiString', 'ExpandString')] - [String] - $ValueType - ) - - if ($ValueType -eq 'Binary') - { - $RegistryKeyValue = [Byte[]]$RegistryKeyValue - } - elseif ($ValueType -eq 'MultiString') - { - $RegistryKeyValue = [String[]]$RegistryKeyValue - } - - $null = [Microsoft.Win32.Registry]::SetValue($RegistryKeyName, $RegistryKeyValueName, $RegistryKeyValue, $ValueType) -} - -<# - .SYNOPSIS - Tests if the actual registry key value matches the expected registry key value. - - .PARAMETER ExpectedRegistryKeyValue - The expected registry key value to test against. - - .PARAMETER ActualRegistryKeyValue - The actual registry key value to test. - - .PARAMETER RegistryKeyValueType - The type of the registry key values. -#> -function Test-RegistryKeyValuesMatch -{ - [OutputType([Boolean])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [Object] - [AllowNull()] - $ExpectedRegistryKeyValue, - - [Parameter(Mandatory = $true)] - [Object] - [AllowNull()] - $ActualRegistryKeyValue, - - [Parameter(Mandatory = $true)] - [ValidateSet('String', 'Binary', 'DWord', 'QWord', 'MultiString', 'ExpandString')] - [String] - $RegistryKeyValueType - ) - - $registryKeyValuesMatch = $true - - if ($RegistryKeyValueType -eq 'Multistring' -or $RegistryKeyValueType -eq 'Binary') - { - if ($null -eq $ExpectedRegistryKeyValue) - { - $ExpectedRegistryKeyValue = @() - } - - if ($null -eq $ActualRegistryKeyValue) - { - $ActualRegistryKeyValue = @() - } - - $registryKeyValuesMatch = $null -eq (Compare-Object -ReferenceObject $ExpectedRegistryKeyValue -DifferenceObject $ActualRegistryKeyValue) - } - else - { - if ($null -eq $ExpectedRegistryKeyValue) - { - $ExpectedRegistryKeyValue = '' - } - - if ($null -eq $ActualRegistryKeyValue) - { - $ActualRegistryKeyValue = '' - } - - $registryKeyValuesMatch = $ExpectedRegistryKeyValue -ieq $ActualRegistryKeyValue - } - - return $registryKeyValuesMatch -} - -<# - .SYNOPSIS - Removes the default value of the specified registry key. - This is a wrapper function for unit testing. - - .PARAMETER RegistryKey - The registry key to remove the default value of. -#> -function Remove-DefaultRegistryKeyValue -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [Microsoft.Win32.RegistryKey] - $RegistryKey - ) - - $null = $RegistryKey.DeleteValue('') -} - -<# - .SYNOPSIS - Retrieves the number of subkeys under the specified registry key. - This is a wrapper function for unit testing. - - .PARAMETER RegistryKey - The registry key to retrieve the subkeys of. -#> -function Get-RegistryKeySubKeyCount -{ - [OutputType([Int])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [Microsoft.Win32.RegistryKey] - $RegistryKey - ) - - return $RegistryKey.SubKeyCount -} diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xRegistryResource/MSFT_xRegistryResource.schema.mof b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xRegistryResource/MSFT_xRegistryResource.schema.mof deleted file mode 100644 index d280b4d7..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xRegistryResource/MSFT_xRegistryResource.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ -[ClassVersion("1.0.0"), FriendlyName("xRegistry")] -class MSFT_xRegistryResource : OMI_BaseResource -{ - [Key, Description("The path of the registry key to add, modify, or remove. This path must include the registry hive/drive.")] String Key; - [Key, Description("The name of the registry value. To add or remove a registry key, specify this property as an empty string without specifying ValueType or ValueData. To modify or remove the default value of a registry key, specify this property as an empty string while also specifying ValueType or ValueData.")] String ValueName; - [Write, Description("The data the specified registry key value should have as a string or an array of strings (MultiString only).")] String ValueData[]; - [Write, Description("The type the specified registry key value should have."), ValueMap{"String", "Binary", "DWord", "QWord", "MultiString", "ExpandString"},Values{"String", "Binary", "DWord", "QWord", "MultiString", "ExpandString"}] String ValueType; - [Write, Description("Specifies whether or not the registry key or value should exist. To add or modify a registry key or value, set this property to Present. To remove a registry key or value, set the property to Absent."), ValueMap{"Present", "Absent"},Values{"Present", "Absent"}] String Ensure; - [Write, Description("Specifies whether or not the specified DWord or QWord registry key data is provided in a hexadecimal format. Not valid for types other than DWord and QWord. The default value is $false.")] Boolean Hex; - [Write, Description("Specifies whether or not to overwrite the specified registry key value if it already has a value or whether or not to delete a registry key that has subkeys. The default value is $false.")] Boolean Force; -}; diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xRegistryResource/en-US/MSFT_xRegistryResource.schema.mfl b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xRegistryResource/en-US/MSFT_xRegistryResource.schema.mfl deleted file mode 100644 index 6d08b1cd..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xRegistryResource/en-US/MSFT_xRegistryResource.schema.mfl +++ /dev/null @@ -1,11 +0,0 @@ -[Description("Provides a mechanism to manage registry keys and values on a target node.") : Amended,AMENDMENT, LOCALE("MS_409")] -class MSFT_xRegistryResource : OMI_BaseResource -{ - [Key,Description("The path of the registry key to add, modify, or remove. This path must include the registry hive/drive.") : Amended] String Key; - [Key,Description("The name of the registry value. To add or remove a registry key, specify this property as an empty string without specifying ValueType or ValueData. To modify or remove the default value of a registry key, specify this property as an empty string while also specifying ValueType or ValueData.") : Amended] String ValueName; - [Description("The data the specified registry key value should have as a string or an array of strings (MultiString only).") : Amended] String ValueData[]; - [Description("The type the specified registry key value should have.") : Amended] String ValueType; - [Description("Specifies whether or not the registry key or value should exist. To add or modify a registry key or value, set this property to Present. To remove a registry key or value, set the property to Absent.") : Amended] String Ensure; - [Description("Specifies whether or not the specified DWord or QWord registry key data is provided in a hexadecimal format. Not valid for types other than DWord and QWord. The default value is $false.") : Amended] Boolean Hex; - [Description("Specifies whether or not to overwrite the specified registry key value if it already has a value or whether or not to delete a registry key that has subkeys. The default value is $false.") : Amended] Boolean Force; -}; diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xRegistryResource/en-US/MSFT_xRegistryResource.strings.psd1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xRegistryResource/en-US/MSFT_xRegistryResource.strings.psd1 deleted file mode 100644 index e300f3e6..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xRegistryResource/en-US/MSFT_xRegistryResource.strings.psd1 +++ /dev/null @@ -1,38 +0,0 @@ -# Localized resources for MSFT_xRegistryResource - -ConvertFrom-StringData @' - DefaultValueDisplayName = (Default) - - GetTargetResourceStartMessage = Get-TargetResource is starting for Registry resource with Key {0} - GetTargetResourceEndMessage = Get-TargetResource has finished for Registry resource with Key {0} - RegistryKeyDoesNotExist = The registry key at path {0} does not exist. - RegistryKeyExists = The registry key at path {0} exists. - RegistryKeyValueDoesNotExist = The registry key at path {0} does not have a value named {1}. - RegistryKeyValueExists = The registry key at path {0} has a value named {1}. - - SetTargetResourceStartMessage = Set-TargetResource is starting for Registry resource with Key {0} - SetTargetResourceEndMessage = Set-TargetResource has finished for Registry resource with Key {0} - CreatingRegistryKey = Creating registry key at path {0}... - SettingRegistryKeyValue = Setting the value {0} under the registry key at path {1}... - OverwritingRegistryKeyValue = Overwriting the value {0} under the registry key at path {1}... - RemovingRegistryKey = Removing registry key at path {0}... - RegistryKeyValueAlreadySet = The value {0} under the registry key at path {1} has already been set to the specified value. - RemovingRegistryKeyValue = Removing the value {0} from the registry key at path {1}... - - TestTargetResourceStartMessage = Test-TargetResource is starting for Registry resource with Key {0} - TestTargetResourceEndMessage = Test-TargetResource has finished for Registry resource with Key {0} - RegistryKeyValueTypeDoesNotMatch = The type of the value {0} under the registry key at path {1} does not match the expected type. Expected {2} but was {3}. - RegistryKeyValueDoesNotMatch = The value {0} under the registry key at path {1} does not match the expected value. Expected {2} but was {3}. - - CannotRemoveExistingRegistryKeyWithSubKeysWithoutForce = The registry key at path {0} has subkeys. To remove this registry key please specifiy the Force parameter as $true. - CannotOverwriteExistingRegistryKeyValueWithoutForce = The registry key at path {0} already has a value with the name {1}. To overwrite this registry key value please specifiy the Force parameter as $true. - CannotRemoveExistingRegistryKeyValueWithoutForce = The registry key at path {0} already has a value with the name {1}. To remove this registry key value please specifiy the Force parameter as $true. - RegistryDriveInvalid = The registry drive specified in the registry key path {0} is missing or invalid. - ArrayNotAllowedForExpectedType = The specified value data has been declared as a string array, but the registry key type {0} cannot be converted from an array. Please declare the value data as only one string or use the registry type MultiString. - DWordDataNotInHexFormat = The specified registry key value data {0} is not in the correct hex format to parse as an Int32 (dword). - QWordDataNotInHexFormat = The specified registry key value data {0} is not in the correct hex format to parse as an Int64 (qword). - BinaryDataNotInHexFormat = The specified registry key value data {0} is not in the correct hex format to parse as a Byte array (Binary). - InvalidRegistryDrive = The registry drive {0} is invalid. Please update the Key parameter to include a valid registry drive. - InvalidRegistryDriveAbbreviation = The registry drive abbreviation {0} is invalid. Please update the Key parameter to include a valid registry drive. - RegistryDriveCouldNotBeMounted = The registry drive with the abbreviation {0} could not be mounted. -'@ diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xRemoteFile/MSFT_xRemoteFile.psm1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xRemoteFile/MSFT_xRemoteFile.psm1 deleted file mode 100644 index ecf0ec15..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xRemoteFile/MSFT_xRemoteFile.psm1 +++ /dev/null @@ -1,586 +0,0 @@ -$moduleRoot = Split-Path ` - -Path $MyInvocation.MyCommand.Path ` - -Parent - -#region LocalizedData -$Culture = 'en-us' -if (Test-Path -Path (Join-Path -Path $moduleRoot -ChildPath $PSUICulture)) -{ - $Culture = $PSUICulture -} -Import-LocalizedData ` - -BindingVariable LocalizedData ` - -Filename MSFT_xRemoteFile.psd1 ` - -BaseDirectory $moduleRoot ` - -UICulture $Culture -#endregion - -# Path where cache will be stored. It's cleared whenever LCM gets new configuration. -$script:cacheLocation = "$env:ProgramData\Microsoft\Windows\PowerShell\Configuration\BuiltinProvCache\MSFT_xRemoteFile" - -<# -.Synopsis -The Get-TargetResource function is used to fetch the status of file specified in DestinationPath on the target machine. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $DestinationPath, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Uri - ) - - # Check whether DestinationPath is existing file - $ensure = "Absent" - $pathItemType = Get-PathItemType -path $DestinationPath - switch($pathItemType) - { - "File" - { - Write-Verbose -Message $($LocalizedData.DestinationPathIsExistingFile ` - -f ${DestinationPath}) - $ensure = "Present" - } - - "Directory" - { - Write-Verbose -Message $($LocalizedData.DestinationPathIsExistingPath ` - -f ${DestinationPath}) - - # If it's existing directory, let's check whether expectedDestinationPath exists - $uriFileName = Split-Path $Uri -Leaf - $expectedDestinationPath = Join-Path $DestinationPath $uriFileName - if (Test-Path $expectedDestinationPath) - { - Write-Verbose -Message $($LocalizedData.FileExistsInDestinationPath ` - -f ${uriFileName}) - $ensure = "Present" - } - } - - "Other" - { - Write-Verbose -Message $($LocalizedData.DestinationPathUnknownType ` - -f ${DestinationPath},${pathItemType}) - } - - "NotExists" - { - Write-Verbose -Message $($LocalizedData.DestinationPathDoesNotExist ` - -f ${DestinationPath}) - } - } - - $returnValue = @{ - DestinationPath = $DestinationPath - Uri = $Uri - Ensure = $ensure - } - - $returnValue -} - -<# -.Synopsis -The Set-TargetResource function is used to download file found under Uri location to DestinationPath -Additional parameters can be specified to configure web request -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $DestinationPath, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Uri, - - [System.String] - $UserAgent, - - [Microsoft.Management.Infrastructure.CimInstance[]] - $Headers, - - [System.Management.Automation.PSCredential] - $Credential, - - [parameter(Mandatory = $false)] - [System.Boolean] - $MatchSource = $true, - - [Uint32] - $TimeoutSec, - - [System.String] - $Proxy, - - [System.Management.Automation.PSCredential] - $ProxyCredential - ) - - # Validate Uri - if (-not (Test-UriScheme -uri $Uri -scheme "http|https|file")) - { - $errorMessage = $($LocalizedData.InvalidWebUriError) ` - -f ${Uri} - New-InvalidDataException ` - -errorId "UriValidationFailure" ` - -errorMessage $errorMessage - } - - # Validate DestinationPath scheme - if (-not (Test-UriScheme -uri $DestinationPath -scheme "file")) - { - $errorMessage = $($LocalizedData.InvalidDestinationPathSchemeError ` - -f ${DestinationPath}) - New-InvalidDataException ` - -errorId "DestinationPathSchemeValidationFailure" ` - -errorMessage $errorMessage - } - - # Validate DestinationPath is not UNC path - if ($DestinationPath.StartsWith("\\")) - { - $errorMessage = $($LocalizedData.DestinationPathIsUncError ` - -f ${DestinationPath}) - New-InvalidDataException ` - -errorId "DestinationPathIsUncFailure" ` - -errorMessage $errorMessage - } - - # Validate DestinationPath does not contain invalid characters - @('*','?','"','<','>','|') | % { - if ($DestinationPath.Contains($_) ){ - $errorMessage = $($LocalizedData.DestinationPathHasInvalidCharactersError ` - -f ${DestinationPath}) - New-InvalidDataException ` - -errorId "DestinationPathHasInvalidCharactersError" ` - -errorMessage $errorMessage - } - } - - # Validate DestinationPath does not end with / or \ (Invoke-WebRequest requirement) - if ($DestinationPath.EndsWith('/') -or $DestinationPath.EndsWith('\')){ - $errorMessage = $($LocalizedData.DestinationPathEndsWithInvalidCharacterError ` - -f ${DestinationPath}) - New-InvalidDataException ` - -errorId "DestinationPathEndsWithInvalidCharacterError" ` - -errorMessage $errorMessage - } - - # Check whether DestinationPath's parent directory exists. Create if it doesn't. - $destinationPathParent = Split-Path $DestinationPath -Parent - if (-not (Test-Path $destinationPathParent)) - { - $null = New-Item -ItemType Directory -Path $destinationPathParent -Force - } - - # Check whether DestinationPath's leaf is an existing folder - $uriFileName = Split-Path $Uri -Leaf - if (Test-Path $DestinationPath -PathType Container) - { - $DestinationPath = Join-Path $DestinationPath $uriFileName - } - - # Remove DestinationPath and MatchSource from parameters as they are not parameters of Invoke-WebRequest - $null = $PSBoundParameters.Remove("DestinationPath") - $null = $PSBoundParameters.Remove("MatchSource") - - # Convert headers to hashtable - $null = $PSBoundParameters.Remove("Headers") - $headersHashtable = $null - - if ($Headers -ne $null) - { - $headersHashtable = Convert-KeyValuePairArrayToHashtable -array $Headers - } - - # Invoke web request - try - { - Write-Verbose -Message $($LocalizedData.DownloadingURI ` - -f ${DestinationPath},${URI}) - Invoke-WebRequest @PSBoundParameters -Headers $headersHashtable -outFile $DestinationPath - } - catch [System.OutOfMemoryException] - { - $errorMessage = $($LocalizedData.DownloadOutOfMemoryException ` - -f $_) - New-InvalidDataException ` - -errorId "SystemOutOfMemoryException" ` - -errorMessage $errorMessage - } - catch [System.Exception] - { - $errorMessage = $($LocalizedData.DownloadException ` - -f $_) - New-InvalidDataException ` - -errorId "SystemException" ` - -errorMessage $errorMessage - } - - # Update cache - if (Test-Path -Path $DestinationPath) - { - $downloadedFile = Get-Item -Path $DestinationPath - $lastWriteTime = $downloadedFile.LastWriteTimeUtc - $filesize = $downloadedFile.Length - $inputObject = @{} - $inputObject["LastWriteTime"] = $lastWriteTime - $inputObject["FileSize"] = $filesize - Update-Cache -DestinationPath $DestinationPath -Uri $Uri -InputObject $inputObject - } -} - -<# -.Synopsis -The Test-TargetResource function is used to validate if the DestinationPath exists on the machine. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $DestinationPath, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Uri, - - [System.String] - $UserAgent, - - [Microsoft.Management.Infrastructure.CimInstance[]] - $Headers, - - [System.Management.Automation.PSCredential] - $Credential, - - [parameter(Mandatory = $false)] - [System.Boolean] - $MatchSource = $true, - - [Uint32] - $TimeoutSec, - - [System.String] - $Proxy, - - [System.Management.Automation.PSCredential] - $ProxyCredential - ) - - # Check whether DestinationPath points to existing file or directory - $fileExists = $false - $uriFileName = Split-Path $Uri -Leaf - $pathItemType = Get-PathItemType -Path $DestinationPath - switch($pathItemType) - { - "File" - { - Write-Verbose -Message $($LocalizedData.DestinationPathIsExistingFile ` - -f ${DestinationPath}) - - if ($MatchSource) { - $file = Get-Item -Path $DestinationPath - # Getting cache. It's cleared every time user runs Start-DscConfiguration - $cache = Get-Cache -DestinationPath $DestinationPath -Uri $Uri - - if ($cache -ne $null ` - -and ($cache.LastWriteTime -eq $file.LastWriteTimeUtc) ` - -and ($cache.FileSize -eq $file.Length)) - { - Write-Verbose -Message $($LocalizedData.CacheReflectsCurrentState) - $fileExists = $true - } - else - { - Write-Verbose -Message $($LocalizedData.CacheIsEmptyOrNotMatchCurrentState) - } - } - else - { - Write-Verbose -Message $($LocalizedData.MatchSourceFalse) - $fileExists = $true - } - } - - "Directory" - { - Write-Verbose -Message $($LocalizedData.DestinationPathIsExistingPath ` - -f ${DestinationPath}) - - $expectedDestinationPath = Join-Path -Path $DestinationPath -ChildPath $uriFileName - - if (Test-Path -Path $expectedDestinationPath) - { - if ($MatchSource) - { - $file = Get-Item -Path $expectedDestinationPath - $cache = Get-Cache -DestinationPath $expectedDestinationPath -Uri $Uri - if ($cache -ne $null -and ($cache.LastWriteTime -eq $file.LastWriteTimeUtc)) - { - Write-Verbose -Message $($LocalizedData.CacheReflectsCurrentState) - $fileExists = $true - } - else - { - Write-Verbose -Message $($LocalizedData.CacheIsEmptyOrNotMatchCurrentState) - } - } - else - { - Write-Verbose -Message $($LocalizedData.MatchSourceFalse) - $fileExists = $true - } - } - } - - "Other" - { - Write-Verbose -Message $($LocalizedData.DestinationPathUnknownType ` - -f ${DestinationPath},${pathItemType}) - } - - "NotExists" - { - Write-Verbose -Message $($LocalizedData.DestinationPathDoesNotExist ` - -f ${DestinationPath}) - } - } - - $result = $fileExists - - $result -} - -<# -.Synopsis -Throws terminating error of category InvalidData with specified errorId and errorMessage -#> -function New-InvalidDataException -{ - param( - [parameter(Mandatory = $true)] - [System.String] - $errorId, - - [parameter(Mandatory = $true)] - [System.String] - $errorMessage - ) - - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidData - $exception = New-Object ` - -TypeName System.InvalidOperationException ` - -ArgumentList $errorMessage - $errorRecord = New-Object ` - -TypeName System.Management.Automation.ErrorRecord ` - -ArgumentList $exception, $errorId, $errorCategory, $null - throw $errorRecord -} - -<# -.Synopsis -Checks whether given URI represents specific scheme -.Description -Most common schemes: file, http, https, ftp -We can also specify logical expressions like: [http|https] -#> -function Test-UriScheme -{ - param ( - [parameter(Mandatory = $true)] - [System.String] - $uri, - - [parameter(Mandatory = $true)] - [System.String] - $scheme - ) - $newUri = $uri -as [System.URI] - $newUri.AbsoluteURI -ne $null -and $newUri.Scheme -match $scheme -} - -<# -.Synopsis -Gets type of the item which path points to. -.Outputs -File, Directory, Other or NotExists -#> -function Get-PathItemType -{ - param ( - [parameter(Mandatory = $true)] - [System.String] - $path - ) - - $type = $null - - # Check whether path exists - if (Test-Path $path) - { - # Check type of the path - $pathItem = Get-Item -Path $path - $pathItemType = $pathItem.GetType().Name - if ($pathItemType -eq "FileInfo") - { - $type = "File" - } - elseif ($pathItemType -eq "DirectoryInfo") - { - $type = "Directory" - } - else - { - $type = "Other" - } - } - else - { - $type = "NotExists" - } - - return $type -} - -<# -.Synopsis -Converts CimInstance array of type KeyValuePair to hashtable -#> -function Convert-KeyValuePairArrayToHashtable -{ - param ( - [parameter(Mandatory = $true)] - [Microsoft.Management.Infrastructure.CimInstance[]] - $array - ) - - $hashtable = @{} - foreach($item in $array) - { - $hashtable += @{$item.Key = $item.Value} - } - - return $hashtable -} - -<# -.Synopsis -Gets cache for specific DestinationPath and Uri -#> -function Get-Cache -{ - param ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $DestinationPath, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Uri - ) - - $cacheContent = $null - $key = Get-CacheKey -DestinationPath $DestinationPath -Uri $Uri - $path = Join-Path -Path $script:cacheLocation -ChildPath $key - - Write-Verbose -Message $($LocalizedData.CacheLookingForPath ` - -f ${Path}) - - if(-not (Test-Path -Path $path)) - { - Write-Verbose -Message $($LocalizedData.CacheNotFoundForPath ` - -f ${DestinationPath},${Uri},${Key}) - - $cacheContent = $null - } - else - { - $cacheContent = Import-CliXml -Path $path - Write-Verbose -Message $($LocalizedData.CacheFoundForPath ` - -f ${DestinationPath},${Uri},${Key}) - } - - return $cacheContent -} - -<# -.Synopsis -Creates or updates cache for specific DestinationPath and Uri -#> -function Update-Cache -{ - param ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $DestinationPath, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Uri, - - [parameter(Mandatory = $true)] - [Object] - $InputObject - ) - - $key = Get-CacheKey -DestinationPath $DestinationPath -Uri $Uri - $path = Join-Path -Path $script:cacheLocation -ChildPath $key - - if(-not (Test-Path -Path $script:cacheLocation)) - { - $null = New-Item -ItemType Directory -Path $script:cacheLocation - } - - Write-Verbose -Message $($LocalizedData.UpdatingCache ` - -f ${DestinationPath},${Uri},${Key}) - - Export-CliXml -Path $path -InputObject $InputObject -Force -} - -<# -.Synopsis -Returns cache key for given parameters -#> -function Get-CacheKey -{ - param ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $DestinationPath, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Uri - ) - return [string]::Join("", @($DestinationPath, $Uri)).GetHashCode().ToString() -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xRemoteFile/MSFT_xRemoteFile.schema.mof b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xRemoteFile/MSFT_xRemoteFile.schema.mof deleted file mode 100644 index 623ac347..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xRemoteFile/MSFT_xRemoteFile.schema.mof +++ /dev/null @@ -1,18 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xRemoteFile")] -class MSFT_xRemoteFile : OMI_BaseResource -{ - [Key, Description("Path under which downloaded or copied file should be accessible after operation.")] String DestinationPath; - [Required, Description("Uri of a file which should be copied or downloaded. This parameter supports HTTP and HTTPS values.")] String Uri; - [Write, Description("User agent for the web request.")] String UserAgent; - [Write, EmbeddedInstance("MSFT_KeyValuePair"), Description("Headers of the web request.")] String Headers[]; - [Write, EmbeddedInstance("MSFT_Credential"), Description("Specifies a user account that has permission to send the request.")] String Credential; - [Write, Description("A boolean value to indicate whether the remote file should be re-downloaded if the file in the DestinationPath was modified locally.")] Boolean MatchSource; - [Write, Description("Specifies how long the request can be pending before it times out.")] Uint32 TimeoutSec; - [Write, Description("Uses a proxy server for the request, rather than connecting directly to the Internet resource. Should be the URI of a network proxy server (e.g 'http://10.20.30.1').")] String Proxy; - [Write, EmbeddedInstance("MSFT_Credential"), Description("Specifies a user account that has permission to use the proxy server that is specified by the Proxy parameter.")] String ProxyCredential; - [Read, ValueMap{"Present", "Absent"}, Values{"Present", "Absent"}, Description("Says whether DestinationPath exists on the machine")] String Ensure; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xRemoteFile/en-us/MSFT_xRemoteFile.psd1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xRemoteFile/en-us/MSFT_xRemoteFile.psd1 deleted file mode 100644 index da903d7d..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xRemoteFile/en-us/MSFT_xRemoteFile.psd1 +++ /dev/null @@ -1,22 +0,0 @@ -ConvertFrom-StringData @' - DestinationPathIsExistingFile=DestinationPath '{0}' is existing file on the machine. - DestinationPathIsExistingPath=DestinationPath '{0}' is existing directory on the machine. - FileExistsInDestinationPath=File '{0}' exists in DestinationPath. - DestinationPathUnknownType=DestinationPath '{0}' has unknown type '{1}'. - DestinationPathDoesNotExist=DestinationPath '{0}' doesn't exist on the machine. - InvalidWebUriError=Specified URI is not valid: "{0}". Only http, https or file paths are accepted. - InvalidDestinationPathSchemeError=Specified DestinationPath is not valid: "{0}". DestinationPath should be absolute path. - DestinationPathIsUncError=Specified DestinationPath is not valid: "{0}". DestinationPath should be local path instead of UNC path. - DestinationPathHasInvalidCharactersError=Specified DestinationPath is not valid: "{0}". DestinationPath should be contains following characters: * ? " < > | - DestinationPathEndsWithInvalidCharacterError=Specified DestinationPath is not valid: "{0}". DestinationPath should not end with / or \\ - DownloadOutOfMemoryException=Invoking web request failed with OutOfMemoryException- Possible cause is the requested file being too big. {0} - DownloadException=Invoking web request failed with error. {0} - DownloadingURI=Downloading '{1}' to '{0}'. - CacheReflectsCurrentState=Cache reflects current state. No need for downloading file. - CacheIsEmptyOrNotMatchCurrentState=Cache is empty or it doesn't reflect current state. File will be downloaded. - MatchSourceFalse=MatchSource is false. No need for downloading file. - CacheLookingForPath=Looking for cache path '{0}'. - CacheNotFoundForPath=No cache found for DestinationPath '{0}' and Uri '{1}' CacheKey '{2}'. - CacheFoundForPath=Found cache found for DestinationPath '{0}' and Uri '{1}' CacheKey '{2}'. - UpdatingCache=Updating cache for DestinationPath '{0}' and Uri '{1}' CacheKey '{2}'. -'@ diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xScriptResource/MSFT_xScriptResource.psm1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xScriptResource/MSFT_xScriptResource.psm1 deleted file mode 100644 index 441449a9..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xScriptResource/MSFT_xScriptResource.psm1 +++ /dev/null @@ -1,283 +0,0 @@ -$errorActionPreference = 'Stop' -Set-StrictMode -Version 'Latest' - -# Import CommonResourceHelper for Get-LocalizedData -$script:dscResourcesFolderFilePath = Split-Path $PSScriptRoot -Parent -$script:commonResourceHelperFilePath = Join-Path -Path $script:dscResourcesFolderFilePath -ChildPath 'CommonResourceHelper.psm1' -Import-Module -Name $script:commonResourceHelperFilePath - -# Localized messages for verbose and error statements in this resource -$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_xScriptResource' - -<# - .SYNOPSIS - Runs the given get script. - Should return a hashtable. - - .PARAMETER GetScript - The script to retrieve the current state of the resource. - - .PARAMETER SetScript - Not used in Get-TargetResource. - - .PARAMETER TestScript - Not used in Get-TargetResource. - - .PARAMETER Credential - The Credential to run the get script under if needed. -#> -function Get-TargetResource -{ - [OutputType([Hashtable])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $GetScript, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $SetScript, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $TestScript, - - [Parameter()] - [ValidateNotNull()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential - ) - - Write-Verbose -Message $script:localizedData.GetTargetResourceStartVerboseMessage - - $invokeScriptParameters = @{ - ScriptBlock = [ScriptBlock]::Create($GetScript) - } - - if ($PSBoundParameters.ContainsKey('Credential')) - { - $invokeScriptParameters['Credential'] = $Credential - } - - $invokeScriptResult = Invoke-Script @invokeScriptParameters - - if ($invokeScriptResult -is [System.Management.Automation.ErrorRecord]) - { - New-InvalidOperationException -Message $script:localizedData.GetScriptThrewError -ErrorRecord $invokeScriptResult - } - - $invokeScriptResultAsHashTable = $invokeScriptResult -as [Hashtable] - - if ($null -eq $invokeScriptResultAsHashTable) - { - New-InvalidArgumentException -ArgumentName 'TestScript' -Message $script:localizedData.GetScriptDidNotReturnHashtable - } - - Write-Verbose -Message $script:localizedData.GetTargetResourceEndVerboseMessage - - return $invokeScriptResultAsHashTable -} - -<# - .SYNOPSIS - Runs the given set script. - Should not return. - - .PARAMETER GetScript - Not used in Set-TargetResource. - - .PARAMETER SetScript - The script to set the resource to the desired state. - - .PARAMETER TestScript - Not used in Set-TargetResource. - - .PARAMETER Credential - The Credential to run the set script under if needed. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $GetScript, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $SetScript, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $TestScript, - - [Parameter()] - [ValidateNotNull()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential - ) - - Write-Verbose -Message $script:localizedData.SetTargetResourceStartVerboseMessage - - $invokeScriptParameters = @{ - ScriptBlock = [ScriptBlock]::Create($SetScript) - } - - if ($PSBoundParameters.ContainsKey('Credential')) - { - $invokeScriptParameters['Credential'] = $Credential - } - - $invokeScriptResult = Invoke-Script @invokeScriptParameters - - if ($invokeScriptResult -is [System.Management.Automation.ErrorRecord]) - { - New-InvalidOperationException -Message $script:localizedData.SetScriptThrewError -ErrorRecord $invokeScriptResult - } - - Write-Verbose -Message $script:localizedData.SetTargetResourceEndVerboseMessage -} - -<# - .SYNOPSIS - Runs the given test script. - Should return true if the resource is in the desired state and false otherwise. - - .PARAMETER GetScript - Not used in Test-TargetResource. - - .PARAMETER SetScript - Not used in Test-TargetResource. - - .PARAMETER TestScript - The script to validate whether or not the resource is in the desired state. - - .PARAMETER Credential - The Credential to run the test script under if needed. -#> -function Test-TargetResource -{ - [OutputType([Boolean])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $GetScript, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $SetScript, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $TestScript, - - [Parameter()] - [ValidateNotNull()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential - ) - - Write-Verbose -Message $script:localizedData.TestTargetResourceStartVerboseMessage - - $invokeScriptParameters = @{ - ScriptBlock = [ScriptBlock]::Create($TestScript) - } - - if ($PSBoundParameters.ContainsKey('Credential')) - { - $invokeScriptParameters['Credential'] = $Credential - } - - $invokeScriptResult = Invoke-Script @invokeScriptParameters - - # If the script is returing multiple objects, then we consider the last object to be the result of the script execution. - if ($invokeScriptResult -is [Object[]] -and $invokeScriptResult.Count -gt 0) - { - $invokeScriptResult = $invokeScriptResult[$invokeScriptResult.Count - 1] - } - - if ($invokeScriptResult -is [System.Management.Automation.ErrorRecord]) - { - New-InvalidOperationException -Message $script:localizedData.TestScriptThrewError -ErrorRecord $invokeScriptResult - } - - if ($null -eq $invokeScriptResult -or -not ($invokeScriptResult -is [Boolean])) - { - New-InvalidArgumentException -ArgumentName 'TestScript' -Message $script:localizedData.TestScriptDidNotReturnBoolean - } - - Write-Verbose -Message $script:localizedData.TestTargetResourceEndVerboseMessage - - return $invokeScriptResult -} - -<# - .SYNOPSIS - Invokes the given script block. - - The output of the script will be returned unless the script throws an error. - If the script throws an error, the ErrorRecord will be returned rather than thrown. - - .PARAMETER ScriptBlock - The script block to invoke. - - .PARAMETER Credential - The credential to run the script under if needed. -#> -function Invoke-Script -{ - [OutputType([Object])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ScriptBlock] - $ScriptBlock, - - [Parameter()] - [ValidateNotNull()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential - ) - - $scriptResult = $null - - try - { - Write-Verbose -Message ($script:localizedData.ExecutingScriptMessage -f $ScriptBlock) - - if ($null -ne $Credential) - { - $scriptResult = Invoke-Command -ScriptBlock $ScriptBlock -Credential $Credential -ComputerName . - } - else - { - $scriptResult = & $ScriptBlock - } - } - catch - { - # Surfacing the error thrown by the execution of the script - $scriptResult = $_ - } - - return $scriptResult -} diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xScriptResource/MSFT_xScriptResource.schema.mof b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xScriptResource/MSFT_xScriptResource.schema.mof deleted file mode 100644 index 321232a0..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xScriptResource/MSFT_xScriptResource.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ - -[ClassVersion("1.0.0"),FriendlyName("xScript")] -class MSFT_xScriptResource : OMI_BaseResource -{ - [Key, Description("A string that can be used to create a PowerShell script block that retrieves the current state of the resource.")] String GetScript; - [Key, Description("A string that can be used to create a PowerShell script block that sets the resource to the desired state.")] String SetScript; - [Key, Description("A string that can be used to create a PowerShell script block that validates whether or not the resource is in the desired state.")] String TestScript; - [Write, EmbeddedInstance("MSFT_Credential"), Description("The credential of the user account to run the script under if needed.")] String Credential; - [Read, Description("The result from the GetScript script block.")] String Result; -}; diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xScriptResource/en-US/MSFT_xScriptResource.schema.mfl b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xScriptResource/en-US/MSFT_xScriptResource.schema.mfl deleted file mode 100644 index 6e031a66d5b6159b85939fcc703cf8a624e63f4b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1936 zcmds&PjAye5XI+=#CKTr1QMz^Z~;!C1%xOR)w#8(GPX-15(oKDON999!0+wEI8HE9 zB`zQ<@$Am{&CHvf*&pA}?br&dEwjqz_SqW#S613RJFuzESk)HL$!29OQidEh`z^bL z<*XaDf$s|}u8=ERvVO_Bu?I*=l!B#T%YMqbMi;Pd*~@-;PHh2tV{3GZMA$Q|1Cb_n z#CsW0Qv1lRuuAOmi08Hy>lW<{-8%w8s(aJxF)$4!#ydT=N9JPwWNRU)mR> zK8iCu4H;G(r`W&3_F4SCuw5&me~mr@)_TtEHArjX8?WmGJ8`dym+<7QrR)SEQiXzj z042cUu)d17z@mxT6pNnUWQ1Q~EvQ0fpRiXg-II_!hQh9q#ZFi0ES@x3l?Op8lg;s!Gj(!ChX&m^!p$*!yK3>!}{nd2ohr!=QKd z|G?li*=z3P8y0jLZ{mq|#wymDYCdgrCOangnf95f-s-LX4&U9>{1fBjeLs!)sK*tv zB2stFW9G_kyRW?Sm2ZlDhE`MB^VT`4;=0eTj;MZvXm0rI)c5mp zN56@6w@c4JPUD=`9ie&9&(+~=rkUpTYN@uexnjMFcU4!<{i!g#FSh5|Z8ABAiJBWy Rcfp#wB#n2B=km?`{S&t%PMZJ# diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xScriptResource/en-US/MSFT_xScriptResource.strings.psd1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xScriptResource/en-US/MSFT_xScriptResource.strings.psd1 deleted file mode 100644 index ade8a719..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xScriptResource/en-US/MSFT_xScriptResource.strings.psd1 +++ /dev/null @@ -1,16 +0,0 @@ -# Localized MSFT_xScriptResource.strings.psd1 - -ConvertFrom-StringData @' - GetTargetResourceStartVerboseMessage = Begin executing get script. - GetScriptThrewError = The get script threw an error. - GetScriptDidNotReturnHashtable = The get script did not return a hashtable. - GetTargetResourceEndVerboseMessage = End executing get script. - SetTargetResourceStartVerboseMessage = Begin executing set script. - SetScriptThrewError = The set script threw an error. - SetTargetResourceEndVerboseMessage = End executing set script. - TestTargetResourceStartVerboseMessage = Begin executing test script. - TestScriptThrewError = The test script threw an error. - TestScriptDidNotReturnBoolean = The test script did not return a boolean. - TestTargetResourceEndVerboseMessage = End executing test script. - ExecutingScriptMessage = Executing script: {0} -'@ diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xUserResource/MSFT_xUserResource.psm1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xUserResource/MSFT_xUserResource.psm1 deleted file mode 100644 index aed7515a..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xUserResource/MSFT_xUserResource.psm1 +++ /dev/null @@ -1,1341 +0,0 @@ -# User name and password needed for this resource and Write-Verbose Used in helper functions -[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPassWordParams', '')] -[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSDSCUseVerboseMessageInDSCResource', '')] -param () - -Import-Module -Name (Join-Path -Path (Split-Path $PSScriptRoot -Parent) ` - -ChildPath 'CommonResourceHelper.psm1') - -# Localized messages for Write-Verbose statements in this resource -$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_xUserResource' - -if (-not (Test-IsNanoServer)) -{ - Add-Type -AssemblyName 'System.DirectoryServices.AccountManagement' -} - -<# - .SYNOPSIS - Retrieves the user with the given username - - .PARAMETER UserName - The name of the user to retrieve. -#> -function Get-TargetResource -{ - [OutputType([System.Collections.Hashtable])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $UserName - ) - - if (Test-IsNanoServer) - { - Get-TargetResourceOnNanoServer @PSBoundParameters - } - else - { - Get-TargetResourceOnFullSKU @PSBoundParameters - } -} - -<# - .SYNOPSIS - Creates, modifies, or deletes a user. - - .PARAMETER UserName - The name of the user to create, modify, or delete. - - .PARAMETER Ensure - Specifies whether the user should exist or not. - By default this is set to Present. - - .PARAMETER FullName - The (optional) full name or display name of the user. - If not provided this value will remain blank. - - .PARAMETER Description - Optional description for the user. - - .PARAMETER Password - The desired password for the user. - - .PARAMETER Disabled - Specifies whether the user should be disabled or not. - By default this is set to $false - - .PARAMETER PasswordNeverExpires - Specifies whether the password should ever expire or not. - By default this is set to $false - - .PARAMETER PasswordChangeRequired - Specifies whether the user must reset their password or not. - By default this is set to $false - - .PARAMETER PasswordChangeNotAllowed - Specifies whether the user is allowed to change their password or not. - By default this is set to $false - - .NOTES - If Ensure is set to 'Present' then the password parameter is required. -#> -function Set-TargetResource -{ - # Should process is called in a helper functions but not directly in Set-TargetResource - [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSShouldProcess', '')] - [CmdletBinding(SupportsShouldProcess = $true)] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $UserName, - - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure = 'Present', - - [System.String] - $FullName, - - [System.String] - $Description, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Password, - - [System.Boolean] - $Disabled, - - [System.Boolean] - $PasswordNeverExpires, - - [System.Boolean] - $PasswordChangeRequired, - - [System.Boolean] - $PasswordChangeNotAllowed - ) - - if (Test-IsNanoServer) - { - Set-TargetResourceOnNanoServer @PSBoundParameters - } - else - { - Set-TargetResourceOnFullSKU @PSBoundParameters - } -} - -<# - .SYNOPSIS - Tests if a user is in the desired state. - - .PARAMETER UserName - The name of the user to test the state of. - - .PARAMETER Ensure - Specifies whether the user should exist or not. - By default this is set to Present - - .PARAMETER FullName - The full name/display name that the user should have. - If not provided, this value will not be tested. - - .PARAMETER Description - The description that the user should have. - If not provided, this value will not be tested. - - .PARAMETER Password - The password the user should have. - - .PARAMETER Disabled - Specifies whether the user account should be disabled or not. - - .PARAMETER PasswordNeverExpires - Specifies whether the password should ever expire or not. - - .PARAMETER PasswordChangeRequired - Not used in Test-TargetResource as there is no easy way to test this value. - - .PARAMETER PasswordChangeNotAllowed - Specifies whether the user should be allowed to change their password or not. -#> -function Test-TargetResource -{ - [OutputType([System.Boolean])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $UserName, - - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure = 'Present', - - [System.String] - $FullName, - - [System.String] - $Description, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Password, - - [System.Boolean] - $Disabled, - - [System.Boolean] - $PasswordNeverExpires, - - [System.Boolean] - $PasswordChangeRequired, - - [System.Boolean] - $PasswordChangeNotAllowed - ) - - if (Test-IsNanoServer) - { - Test-TargetResourceOnNanoServer @PSBoundParameters - } - else - { - Test-TargetResourceOnFullSKU @PSBoundParameters - } -} - - -<# - .SYNOPSIS - Retrieves the user with the given username when on a full server - - .PARAMETER UserName - The name of the user to retrieve. -#> -function Get-TargetResourceOnFullSKU -{ - [OutputType([System.Collections.Hashtable])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $UserName - ) - - Set-StrictMode -Version Latest - - Assert-UserNameValid -UserName $UserName - - # Try to find a user by a name - $principalContext = New-Object ` - -TypeName System.DirectoryServices.AccountManagement.PrincipalContext ` - -ArgumentList ([System.DirectoryServices.AccountManagement.ContextType]::Machine) - - try - { - Write-Verbose -Message 'Starting Get-TargetResource on FullSKU' - $user = [System.DirectoryServices.AccountManagement.UserPrincipal]::FindByIdentity($principalContext, $UserName) - if ($null -ne $user) - { - # The user is found. Return all user properties and Ensure='Present'. - $returnValue = @{ - UserName = $user.Name - Ensure = 'Present' - FullName = $user.DisplayName - Description = $user.Description - Disabled = -not $user.Enabled - PasswordNeverExpires = $user.PasswordNeverExpires - PasswordChangeRequired = $null - PasswordChangeNotAllowed = $user.UserCannotChangePassword - } - - return $returnValue - } - - # The user is not found. Return Ensure = Absent. - return @{ - UserName = $UserName - Ensure = 'Absent' - } - } - catch - { - New-ConnectionException -ErrorId 'MultipleMatches' -ErrorMessage ($script:localizedData.MultipleMatches + $_) - } - finally - { - if ($null -ne $user) - { - $user.Dispose() - } - - $principalContext.Dispose() - } -} - -<# - .SYNOPSIS - Creates, modifies, or deletes a user when on a full server. - - .PARAMETER UserName - The name of the user to create, modify, or delete. - - .PARAMETER Ensure - Specifies whether the user should exist or not. - By default this is set to Present - - .PARAMETER FullName - The (optional) full name or display name of the user. - If not provided this value will remain blank. - - .PARAMETER Description - Optional description for the user. - - .PARAMETER Password - The desired password for the user. - - .PARAMETER Disabled - Specifies whether the user should be disabled or not. - By default this is set to $false - - .PARAMETER PasswordNeverExpires - Specifies whether the password should ever expire or not. - By default this is set to $false - - .PARAMETER PasswordChangeRequired - Specifies whether the user must reset their password or not. - By default this is set to $false - - .PARAMETER PasswordChangeNotAllowed - Specifies whether the user is allowed to change their password or not. - By default this is set to $false - - .NOTES - If Ensure is set to 'Present' then the Password parameter is required. -#> -function Set-TargetResourceOnFullSKU -{ - [CmdletBinding(SupportsShouldProcess = $true)] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $UserName, - - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure = 'Present', - - [System.String] - $FullName, - - [System.String] - $Description, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Password, - - [System.Boolean] - $Disabled, - - [System.Boolean] - $PasswordNeverExpires, - - [System.Boolean] - $PasswordChangeRequired, - - [System.Boolean] - $PasswordChangeNotAllowed - ) - - Set-StrictMode -Version Latest - - Write-Verbose -Message ($script:localizedData.ConfigurationStarted -f $UserName) - - Assert-UserNameValid -UserName $UserName - - - # Try to find a user by name. - $principalContext = New-Object ` - -TypeName System.DirectoryServices.AccountManagement.PrincipalContext ` - -ArgumentList ([System.DirectoryServices.AccountManagement.ContextType]::Machine) - - try - { - try - { - $user = [System.DirectoryServices.AccountManagement.UserPrincipal]::FindByIdentity($principalContext, $UserName) - } - catch - { - New-InvalidOperationException -Message ($script:localizedData.MultipleMatches + $_) - } - - if ($Ensure -eq 'Present') - { - $whatIfShouldProcess = $true - $userExists = $false - $saveChanges = $false - - if ($null -eq $user) - { - # A user does not exist. Check WhatIf for adding a user - $whatIfShouldProcess = $pscmdlet.ShouldProcess($script:localizedData.UserWithName -f $UserName, $script:localizedData.AddOperation) - } - else - { - # A user exists - $userExists = $true - - # Check WhatIf for setting a user - $whatIfShouldProcess = $pscmdlet.ShouldProcess($script:localizedData.UserWithName -f $UserName, $script:localizedData.SetOperation) - } - - if ($whatIfShouldProcess) - { - if (-not $userExists) - { - # The user with the provided name does not exist so add a new user - $user = New-Object ` - -TypeName System.DirectoryServices.AccountManagement.UserPrincipal ` - -ArgumentList $principalContext - $user.Name = $UserName - $saveChanges = $true - } - - # Set user properties. - if ($PSBoundParameters.ContainsKey('FullName') -and ((-not $userExists) -or ($FullName -ne $user.DisplayName))) - { - $user.DisplayName = $FullName - $saveChanges = $true - } - else - { - if (-not $userExists) - { - # For a newly created user, set the DisplayName property to an empty string since by default DisplayName is set to user's name - $user.DisplayName = [String]::Empty - } - } - - if ($PSBoundParameters.ContainsKey('Description') -and ((-not $userExists) -or ($Description -ne $user.Description))) - { - $user.Description = $Description - $saveChanges = $true - } - - # Set the password regardless of the state of the user - if ($PSBoundParameters.ContainsKey('Password')) - { - $user.SetPassword($Password.GetNetworkCredential().Password) - $saveChanges = $true - } - - if ($PSBoundParameters.ContainsKey('Disabled') -and ((-not $userExists) -or ($Disabled -eq $user.Enabled))) - { - $user.Enabled = -not $Disabled - $saveChanges = $true - } - - if ($PSBoundParameters.ContainsKey('PasswordNeverExpires') -and ((-not $userExists) -or ($PasswordNeverExpires -ne $user.PasswordNeverExpires))) - { - $user.PasswordNeverExpires = $PasswordNeverExpires - $saveChanges = $true - } - - if ($PSBoundParameters.ContainsKey('PasswordChangeRequired')) - { - if ($PasswordChangeRequired) - { - # Expire the password which will force the user to change the password at the next logon - $user.ExpirePasswordNow() - $saveChanges = $true - } - } - - if ($PSBoundParameters.ContainsKey('PasswordChangeNotAllowed') -and ((-not $userExists) -or ($PasswordChangeNotAllowed -ne $user.UserCannotChangePassword))) - { - $user.UserCannotChangePassword = $PasswordChangeNotAllowed - $saveChanges = $true - - } - - if ($saveChanges) - { - $user.Save() - - # Send an operation success verbose message - if ($userExists) - { - Write-Verbose -Message ($script:localizedData.UserUpdated -f $UserName) - } - else - { - Write-Verbose -Message ($script:localizedData.UserCreated -f $UserName) - } - } - else - { - Write-Verbose -Message ($script:localizedData.NoConfigurationRequired -f $UserName) - } - } - } - else - { - # Ensure is set to 'Absent' - if ($user -ne $null) - { - # The user exists - if ($pscmdlet.ShouldProcess($script:localizedData.UserWithName -f $UserName, $script:localizedData.RemoveOperation)) - { - # Remove the user - $user.Delete() - } - - Write-Verbose -Message ($script:localizedData.UserRemoved -f $UserName) - } - else - { - Write-Verbose -Message ($script:localizedData.NoConfigurationRequiredUserDoesNotExist -f $UserName) - } - } - } - catch - { - New-InvalidOperationException -Message $_ - } - finally - { - if ($null -ne $user) - { - $user.Dispose() - } - - $principalContext.Dispose() - } - - Write-Verbose -Message ($script:localizedData.ConfigurationCompleted -f $UserName) -} - -<# - .SYNOPSIS - Tests if a user is in the desired state when on a full server. - - .PARAMETER UserName - The name of the user to test the state of. - - .PARAMETER Ensure - Specifies whether the user should exist or not. - By default this is set to Present - - .PARAMETER FullName - The full name/display name that the user should have. - If not provided, this value will not be tested. - - .PARAMETER Description - The description that the user should have. - If not provided, this value will not be tested. - - .PARAMETER Password - The password the user should have. - - .PARAMETER Disabled - Specifies whether the user account should be disabled or not. - - .PARAMETER PasswordNeverExpires - Specifies whether the password should ever expire or not. - - .PARAMETER PasswordChangeRequired - Not used in Test-TargetResource as there is no easy way to test this value. - - .PARAMETER PasswordChangeNotAllowed - Specifies whether the user should be allowed to change their password or not. -#> -function Test-TargetResourceOnFullSKU -{ - [OutputType([System.Boolean])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $UserName, - - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure = 'Present', - - [System.String] - $FullName, - - [System.String] - $Description, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Password, - - [System.Boolean] - $Disabled, - - [System.Boolean] - $PasswordNeverExpires, - - [System.Boolean] - $PasswordChangeRequired, - - [System.Boolean] - $PasswordChangeNotAllowed - ) - - Set-StrictMode -Version Latest - - Assert-UserNameValid -UserName $UserName - - # Try to find a user by a name - $principalContext = New-Object System.DirectoryServices.AccountManagement.PrincipalContext ` - -ArgumentList ([System.DirectoryServices.AccountManagement.ContextType]::Machine) - - try - { - $user = [System.DirectoryServices.AccountManagement.UserPrincipal]::FindByIdentity($principalContext, $UserName) - if ($null -eq $user) - { - # A user with the provided name does not exist - Write-Verbose -Message ($script:localizedData.UserDoesNotExist -f $UserName) - - if ($Ensure -eq 'Absent') - { - return $true - } - else - { - return $false - } - } - - # A user with the provided name exists - Write-Verbose -Message ($script:localizedData.UserExists -f $UserName) - - # Validate separate properties - if ($Ensure -eq 'Absent') - { - # The Ensure property does not match - Write-Verbose -Message ($script:localizedData.PropertyMismatch -f 'Ensure', 'Absent', 'Present') - return $false - } - - if ($PSBoundParameters.ContainsKey('FullName') -and $FullName -ne $user.DisplayName) - { - # The FullName property does not match - Write-Verbose -Message ($script:localizedData.PropertyMismatch -f 'FullName', $FullName, $user.DisplayName) - return $false - } - - if ($PSBoundParameters.ContainsKey('Description') -and $Description -ne $user.Description) - { - # The Description property does not match - Write-Verbose -Message ($script:localizedData.PropertyMismatch -f 'Description', $Description, $user.Description) - return $false - } - - # Password - if ($PSBoundParameters.ContainsKey('Password')) - { - if (-not $principalContext.ValidateCredentials($UserName, $Password.GetNetworkCredential().Password)) - { - # The Password property does not match - Write-Verbose -Message ($script:localizedData.PasswordPropertyMismatch -f 'Password') - return $false - } - } - - if ($PSBoundParameters.ContainsKey('Disabled') -and $Disabled -eq $user.Enabled) - { - # The Disabled property does not match - Write-Verbose -Message ($script:localizedData.PropertyMismatch -f 'Disabled', $Disabled, $user.Enabled) - return $false - } - - if ($PSBoundParameters.ContainsKey('PasswordNeverExpires') -and $PasswordNeverExpires -ne $user.PasswordNeverExpires) - { - # The PasswordNeverExpires property does not match - Write-Verbose -Message ($script:localizedData.PropertyMismatch -f 'PasswordNeverExpires', $PasswordNeverExpires, $user.PasswordNeverExpires) - return $false - } - - if ($PSBoundParameters.ContainsKey('PasswordChangeNotAllowed') -and $PasswordChangeNotAllowed -ne $user.UserCannotChangePassword) - { - # The PasswordChangeNotAllowed property does not match - Write-Verbose -Message ($script:localizedData.PropertyMismatch -f 'PasswordChangeNotAllowed', $PasswordChangeNotAllowed, $user.UserCannotChangePassword) - return $false - } - } - catch - { - New-ConnectionException -ErrorId 'ConnectionError' -ErrorMessage ($script:localizedData.ConnectionError + $_) - } - - finally - { - if ($null -ne $user) - { - $user.Dispose() - } - - $principalContext.Dispose() - - } - - # All properties match - Write-Verbose -Message ($script:localizedData.AllUserPropertisMatch -f 'User', $UserName) - return $true -} - - -<# - .SYNOPSIS - Retrieves the user with the given username when on Nano Server. - - .PARAMETER UserName - The name of the user to retrieve. -#> -function Get-TargetResourceOnNanoServer -{ - [OutputType([System.Collections.Hashtable])] - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $UserName - ) - - Set-StrictMode -Version Latest - - Assert-UserNameValid -UserName $UserName - - # Try to find a user by a name - try - { - Write-Verbose -Message 'Starting Get-TargetResource on NanoServer' - [Microsoft.PowerShell.Commands.LocalUser] $user = Get-LocalUser -Name $UserName -ErrorAction Stop - } - catch [System.Exception] - { - if ($_.CategoryInfo.ToString().Contains('UserNotFoundException')) - { - # The user is not found - return @{ - UserName = $UserName - Ensure = 'Absent' - } - } - New-InvalidOperationException -ErrorRecord $_ - } - - # The user is found. Return all user properties and Ensure = 'Present'. - $returnValue = @{ - UserName = $user.Name - Ensure = 'Present' - FullName = $user.FullName - Description = $user.Description - Disabled = -not $user.Enabled - PasswordChangeRequired = $null - PasswordChangeNotAllowed = -not $user.UserMayChangePassword - } - - if ($user.PasswordExpires) - { - $returnValue.Add('PasswordNeverExpires', $false) - } - else - { - $returnValue.Add('PasswordNeverExpires', $true) - } - - return $returnValue -} - -<# - .SYNOPSIS - Creates, modifies, or deletes a user when on Nano Server. - - .PARAMETER UserName - The name of the user to create, modify, or delete. - - .PARAMETER Ensure - Specifies whether the user should exist or not. - By default this is set to Present - - .PARAMETER FullName - The (optional) full name or display name of the user. - If not provided this value will remain blank. - - .PARAMETER Description - Optional description for the user. - - .PARAMETER Password - The desired password for the user. - - .PARAMETER Disabled - Specifies whether the user should be disabled or not. - By default this is set to $false - - .PARAMETER PasswordNeverExpires - Specifies whether the password should ever expire or not. - By default this is set to $false - - .PARAMETER PasswordChangeRequired - Specifies whether the user must reset their password or not. - By default this is set to $false - - .PARAMETER PasswordChangeNotAllowed - Specifies whether the user is allowed to change their password or not. - By default this is set to $false - - .NOTES - If Ensure is set to 'Present' then the Password parameter is required. -#> -function Set-TargetResourceOnNanoServer -{ - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $UserName, - - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure = 'Present', - - [System.String] - $FullName, - - [System.String] - $Description, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Password, - - [System.Boolean] - $Disabled, - - [System.Boolean] - $PasswordNeverExpires, - - [System.Boolean] - $PasswordChangeRequired, - - [System.Boolean] - $PasswordChangeNotAllowed - ) - - Set-StrictMode -Version Latest - - Write-Verbose -Message ($script:localizedData.ConfigurationStarted -f $UserName) - - Assert-UserNameValid -UserName $UserName - - # Try to find a user by a name. - $userExists = $false - - try - { - [Microsoft.PowerShell.Commands.LocalUser] $user = Get-LocalUser -Name $UserName -ErrorAction Stop - $userExists = $true - } - catch [System.Exception] - { - if ($_.CategoryInfo.ToString().Contains('UserNotFoundException')) - { - # The user is not found. - Write-Verbose -Message ($script:localizedData.UserDoesNotExist -f $UserName) - } - else - { - New-InvalidOperationException -ErrorRecord $_ - } - } - - if ($Ensure -eq 'Present') - { - # Ensure is set to 'Present' - - if (-not $userExists) - { - # The user with the provided name does not exist so add a new user - New-LocalUser -Name $UserName -NoPassword - Write-Verbose -Message ($script:localizedData.UserCreated -f $UserName) - } - - # Set user properties - if ($PSBoundParameters.ContainsKey('FullName')) - { - if (-not $userExists -or $FullName -ne $user.FullName) - { - if ($FullName -eq $null) - { - Set-LocalUser -Name $UserName -FullName ([String]::Empty) - } - else - { - Set-LocalUser -Name $UserName -FullName $FullName - } - } - } - else - { - if (-not $userExists) - { - # For a newly created user, set the DisplayName property to an empty string since by default DisplayName is set to user's name. - Set-LocalUser -Name $UserName -FullName ([String]::Empty) - } - } - - if ($PSBoundParameters.ContainsKey('Description') -and ((-not $userExists) -or ($Description -ne $user.Description))) - { - if ($null -eq $Description) - { - Set-LocalUser -Name $UserName -Description ([String]::Empty) - } - else - { - Set-LocalUser -Name $UserName -Description $Description - } - } - - # Set the password regardless of the state of the user - if ($PSBoundParameters.ContainsKey('Password')) - { - Set-LocalUser -Name $UserName -Password $Password.Password - } - - if ($PSBoundParameters.ContainsKey('Disabled') -and ((-not $userExists) -or ($Disabled -eq $user.Enabled))) - { - if ($Disabled) - { - Disable-LocalUser -Name $UserName - } - else - { - Enable-LocalUser -Name $UserName - } - } - - $existingUserPasswordNeverExpires = (($userExists) -and ($null -eq $user.PasswordExpires)) - if ($PSBoundParameters.ContainsKey('PasswordNeverExpires') -and ((-not $userExists) -or ($PasswordNeverExpires -ne $existingUserPasswordNeverExpires))) - { - Set-LocalUser -Name $UserName -PasswordNeverExpires:$passwordNeverExpires - } - - if ($PSBoundParameters.ContainsKey('PasswordChangeRequired') -and ($PasswordChangeRequired)) - { - Set-LocalUser -Name $UserName -AccountExpires ([DateTime]::Now) - } - - # NOTE: The parameter name and the property name have opposite meaning. - [System.Boolean] $expected = -not $PasswordChangeNotAllowed - $actual = $expected - - if ($userExists) - { - $actual = $user.UserMayChangePassword - } - - if ($PSBoundParameters.ContainsKey('PasswordChangeNotAllowed') -and ((-not $userExists) -or ($expected -ne $actual))) - { - Set-LocalUser -Name $UserName -UserMayChangePassword $expected - } - } - else - { - # Ensure is set to 'Absent' - if ($userExists) - { - # The user exists - Remove-LocalUser -Name $UserName - - Write-Verbose -Message ($script:localizedData.UserRemoved -f $UserName) - } - else - { - Write-Verbose -Message ($script:localizedData.NoConfigurationRequiredUserDoesNotExist -f $UserName) - } - } - - Write-Verbose -Message ($script:localizedData.ConfigurationCompleted -f $UserName) -} - -<# - .SYNOPSIS - Tests if a user is in the desired state when on Nano Server. - - .PARAMETER UserName - The name of the user to test the state of. - - .PARAMETER Ensure - Specifies whether the user should exist or not. - By default this is set to Present - - .PARAMETER FullName - The full name/display name that the user should have. - If not provided, this value will not be tested. - - .PARAMETER Description - The description that the user should have. - If not provided, this value will not be tested. - - .PARAMETER Password - The password the user should have. - - .PARAMETER Disabled - Specifies whether the user account should be disabled or not. - - .PARAMETER PasswordNeverExpires - Specifies whether the password should ever expire or not. - - .PARAMETER PasswordChangeRequired - Not used in Test-TargetResource as there is no easy way to test this value. - - .PARAMETER PasswordChangeNotAllowed - Specifies whether the user should be allowed to change their password or not. -#> -function Test-TargetResourceOnNanoServer -{ - [OutputType([System.Boolean])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $UserName, - - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure = 'Present', - - [System.String] - $FullName, - - [System.String] - $Description, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Password, - - [System.Boolean] - $Disabled, - - [System.Boolean] - $PasswordNeverExpires, - - [System.Boolean] - $PasswordChangeRequired, - - [System.Boolean] - $PasswordChangeNotAllowed - ) - - Set-StrictMode -Version Latest - - Assert-UserNameValid -UserName $UserName - - # Try to find a user by a name - try - { - [Microsoft.PowerShell.Commands.LocalUser] $user = Get-LocalUser -Name $UserName -ErrorAction Stop - } - catch [System.Exception] - { - if ($_.CategoryInfo.ToString().Contains('UserNotFoundException')) - { - # The user is not found - if ($Ensure -eq 'Absent') - { - return $true - } - else - { - return $false - } - } - New-InvalidOperationException -ErrorRecord $_ - } - - # A user with the provided name exists - Write-Verbose -Message ($script:localizedData.UserExists -f $UserName) - - # Validate separate properties - if ($Ensure -eq 'Absent') - { - # The Ensure property does not match - Write-Verbose -Message ($script:localizedData.PropertyMismatch -f 'Ensure', 'Absent', 'Present') - return $false - } - - if ($PSBoundParameters.ContainsKey('FullName') -and $FullName -ne $user.FullName) - { - # The FullName property does not match - Write-Verbose -Message ($script:localizedData.PropertyMismatch -f 'FullName', $FullName, $user.FullName) - return $false - } - - if ($PSBoundParameters.ContainsKey('Description') -and $Description -ne $user.Description) - { - # The Description property does not match - Write-Verbose -Message ($script:localizedData.PropertyMismatch -f 'Description', $Description, $user.Description) - return $false - } - - if ($PSBoundParameters.ContainsKey('Password')) - { - if(-not (Test-CredentialsValidOnNanoServer -UserName $UserName -Password $Password.Password)) - { - # The Password property does not match - Write-Verbose -Message ($script:localizedData.PasswordPropertyMismatch -f 'Password') - return $false - } - } - - if ($PSBoundParameters.ContainsKey('Disabled') -and ($Disabled -eq $user.Enabled)) - { - # The Disabled property does not match - Write-Verbose -Message ($script:localizedData.PropertyMismatch -f 'Disabled', $Disabled, $user.Enabled) - return $false - } - - $existingUserPasswordNeverExpires = ($null -eq $user.PasswordExpires) - if ($PSBoundParameters.ContainsKey('PasswordNeverExpires') -and $PasswordNeverExpires -ne $existingUserPasswordNeverExpires) - { - # The PasswordNeverExpires property does not match - Write-Verbose -Message ($script:localizedData.PropertyMismatch -f 'PasswordNeverExpires', $PasswordNeverExpires, $existingUserPasswordNeverExpires) - return $false - } - - if ($PSBoundParameters.ContainsKey('PasswordChangeNotAllowed') -and $PasswordChangeNotAllowed -ne (-not $user.UserMayChangePassword)) - { - # The PasswordChangeNotAllowed property does not match - Write-Verbose -Message ($script:localizedData.PropertyMismatch -f 'PasswordChangeNotAllowed', $PasswordChangeNotAllowed, (-not $user.UserMayChangePassword)) - return $false - } - - # All properties match. Return $true. - Write-Verbose -Message ($script:localizedData.AllUserPropertisMatch -f 'User', $UserName) - return $true -} - -<# - .SYNOPSIS - Checks that the username does not contain invalid characters. - - .PARAMETER UserName - The username to validate. -#> -function Assert-UserNameValid -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $UserName - ) - - # Check if the name consists of only periods and/or white spaces - $wrongName = $true - - for ($i = 0; $i -lt $UserName.Length; $i++) - { - if (-not [Char]::IsWhiteSpace($UserName, $i) -and $UserName[$i] -ne '.') - { - $wrongName = $false - break - } - } - - $invalidChars = @('\','/','"','[',']',':','|','<','>','+','=',';',',','?','*','@') - - if ($wrongName) - { - New-InvalidArgumentException ` - -Message ($script:localizedData.InvalidUserName -f $UserName, [String]::Join(' ', $invalidChars)) ` - -ArgumentName 'UserName' - } - - if ($UserName.IndexOfAny($invalidChars) -ne -1) - { - New-InvalidArgumentException ` - -Message ($script:localizedData.InvalidUserName -f $UserName, [String]::Join(' ', $invalidChars)) ` - -ArgumentName 'UserName' - } -} - -<# - .SYNOPSIS - Creates a new Connection error record and throws it. - - .PARAMETER ErrorId - The ID for the error record to be thrown. - - .PARAMETER ErrorMessage - Message to be included in the error record to be thrown. -#> -function New-ConnectionException -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $ErrorId, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $ErrorMessage - ) - - $errorCategory = [System.Management.Automation.ErrorCategory]::ConnectionError - $exception = New-Object ` - -TypeName System.ArgumentException ` - -ArgumentList $ErrorMessage - $errorRecord = New-Object ` - -TypeName System.Management.Automation.ErrorRecord ` - -ArgumentList @($exception, $ErrorId, $errorCategory, $null) - throw $errorRecord -} - -<# - .SYNOPSIS - Tests the local user's credentials on the local machine. - - .PARAMETER UserName - The username to validate the credentials of. - - .PARAMETER Password - The password of the given user. -#> -function Test-CredentialsValidOnNanoServer -{ - [OutputType([System.Boolean])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $UserName, - - [ValidateNotNullOrEmpty()] - [SecureString] - $Password - ) - - $source = @' - [Flags] - private enum LogonType - { - Logon32LogonInteractive = 2, - Logon32LogonNetwork, - Logon32LogonBatch, - Logon32LogonService, - Logon32LogonUnlock, - Logon32LogonNetworkCleartext, - Logon32LogonNewCredentials - } - - [Flags] - private enum LogonProvider - { - Logon32ProviderDefault = 0, - Logon32ProviderWinnt35, - Logon32ProviderWinnt40, - Logon32ProviderWinnt50 - } - - [DllImport("api-ms-win-security-logon-l1-1-1.dll", CharSet = CharSet.Unicode, SetLastError = true)] - private static extern Boolean LogonUser( - String lpszUserName, - String lpszDomain, - IntPtr lpszPassword, - LogonType dwLogonType, - LogonProvider dwLogonProvider, - out IntPtr phToken - ); - - - [DllImport("api-ms-win-core-handle-l1-1-0.dll", - EntryPoint = "CloseHandle", SetLastError = true, - CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)] - internal static extern bool CloseHandle(IntPtr handle); - - public static bool ValidateCredentials(string username, SecureString password) - { - IntPtr tokenHandle = IntPtr.Zero; - IntPtr unmanagedPassword = IntPtr.Zero; - - unmanagedPassword = SecureStringMarshal.SecureStringToCoTaskMemUnicode(password); - - try - { - return LogonUser( - username, - null, - unmanagedPassword, - LogonType.Logon32LogonInteractive, - LogonProvider.Logon32ProviderDefault, - out tokenHandle); - } - catch - { - return false; - } - finally - { - if (tokenHandle != IntPtr.Zero) - { - CloseHandle(tokenHandle); - } - if (unmanagedPassword != IntPtr.Zero) { - Marshal.ZeroFreeCoTaskMemUnicode(unmanagedPassword); - } - unmanagedPassword = IntPtr.Zero; - } - } -'@ - - Add-Type -PassThru -Namespace Microsoft.Windows.DesiredStateConfiguration.NanoServer.UserResource ` - -Name CredentialsValidationTool -MemberDefinition $source -Using System.Security -ReferencedAssemblies System.Security.SecureString.dll | Out-Null - return [Microsoft.Windows.DesiredStateConfiguration.NanoServer.UserResource.CredentialsValidationTool]::ValidateCredentials($UserName, $Password) -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xUserResource/MSFT_xUserResource.schema.mof b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xUserResource/MSFT_xUserResource.schema.mof deleted file mode 100644 index 8e6c4fdf..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xUserResource/MSFT_xUserResource.schema.mof +++ /dev/null @@ -1,13 +0,0 @@ -[ClassVersion("1.0.0"), FriendlyName("xUser")] -class MSFT_xUserResource : OMI_BaseResource -{ - [Key,Description("The name of the User to Create/Modify/Delete")] String UserName; - [Write,Description("An enumerated value that describes if the user is expected to exist on the machine"),ValueMap{"Present", "Absent"},Values{"Present", "Absent"}] String Ensure; - [Write,Description("The display name of the user")] String FullName; - [Write,Description("A description for the user")] String Description; - [Write,Description("The password for the user"),EmbeddedInstance("MSFT_Credential")] String Password; - [Write,Description("Value used to disable/enable a user account")] Boolean Disabled; - [Write,Description("Value used to set whether a user's password expires or not")] Boolean PasswordNeverExpires; - [Write,Description("Value used to require a user to change their password")] Boolean PasswordChangeRequired; - [Write,Description("Value used to set whether a user can/cannot change their password")] Boolean PasswordChangeNotAllowed; -}; diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xUserResource/en-US/MSFT_xUserResource.schema.mfl b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xUserResource/en-US/MSFT_xUserResource.schema.mfl deleted file mode 100644 index 92809e05005678b0cda60bd15d840e353532144a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2418 zcmc&#O;6iE6r6LV{)bgAr4k}N^wRbeQjkzdK!w5qA(S|#jb!Z94p3C_*MXV0b~ZR9 zf}|?4{IR=l-^aY!@%`Niz9L3}2swrrVa#WS6l-YU5WhGo;J7B6443?h`0dL1OU}j^ za6IO!!v%WW+rv+@NjMjAlyJpc=KSh$E;3&!cNN%Rr1zZv%)3PoF+B{->pI6BY@y2> z{reE>wA#fU+FaY^n)2-60B87!5BOxhPVp9R7$ae56wwzDT{Q2>-f+`Un5!$@Tv0J@Yy#B~&N;|JUOq`&m3zskl8A oMSszd)$4TJ@ieOHX8HC#)$IR9qibwxnPO*TskFoM;I@1}0CgvzUjP6A diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xUserResource/en-US/MSFT_xUserResource.strings.psd1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xUserResource/en-US/MSFT_xUserResource.strings.psd1 deleted file mode 100644 index aff537e0..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xUserResource/en-US/MSFT_xUserResource.strings.psd1 +++ /dev/null @@ -1,23 +0,0 @@ -# Localized resources for xUser - -ConvertFrom-StringData @' - UserWithName = User: {0} - RemoveOperation = Remove - AddOperation = Add - SetOperation = Set - ConfigurationStarted = Configuration of user {0} started. - ConfigurationCompleted = Configuration of user {0} completed successfully. - UserCreated = User {0} created successfully. - UserUpdated = User {0} properties updated successfully. - UserRemoved = User {0} removed successfully. - NoConfigurationRequired = User {0} exists on this node with the desired properties. No action required. - NoConfigurationRequiredUserDoesNotExist = User {0} does not exist on this node. No action required. - InvalidUserName = The name {0} cannot be used. Names may not consist entirely of periods and/or spaces, or contain these characters: {1} - UserExists = A user with the name {0} exists. - UserDoesNotExist = A user with the name {0} does not exist. - PropertyMismatch = The value of the {0} property is expected to be {1} but it is {2}. - PasswordPropertyMismatch = The value of the {0} property does not match. - AllUserPropertisMatch = All {0} {1} properties match. - ConnectionError = There could be a possible connection error while trying to use the System.DirectoryServices API's. - MultipleMatches = There could be a possible multiple matches exception while trying to use the System.DirectoryServices API's. -'@ diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsFeature/MSFT_xWindowsFeature.psm1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsFeature/MSFT_xWindowsFeature.psm1 deleted file mode 100644 index 41074694..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsFeature/MSFT_xWindowsFeature.psm1 +++ /dev/null @@ -1,554 +0,0 @@ -# Global needed to indicate if a restart is required -[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', '')] -param () - -Import-Module -Name (Join-Path -Path (Split-Path $PSScriptRoot -Parent) ` - -ChildPath 'CommonResourceHelper.psm1') - -# Localized messages for verbose and error messages in this resource -$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_xWindowsFeature' - -<# - .SYNOPSIS - Retrieves the status of the role or feature with the given name on the target machine. - - .PARAMETER Name - The name of the role or feature to retrieve - - .PARAMETER Credential - The credential (if required) to retrieve the role or feature. - Optional. - - .NOTES - If the specified role or feature does not contain any subfeatures then - IncludeAllSubFeature will be set to $false. If the specified feature contains one - or more subfeatures then IncludeAllSubFeature will be set to $true only if all the - subfeatures are installed. Otherwise, IncludeAllSubFeature will be set to $false. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Name, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential - ) - - Write-Verbose -Message ($script:localizedData.GetTargetResourceStartMessage -f $Name) - - Import-ServerManager - - Write-Verbose -Message ($script:localizedData.QueryFeature -f $Name) - - $isWinServer2008R2SP1 = Test-IsWinServer2008R2SP1 - if ($isWinServer2008R2SP1 -and $PSBoundParameters.ContainsKey('Credential')) - { - $feature = Invoke-Command -ScriptBlock { Get-WindowsFeature -Name $Name } ` - -ComputerName . ` - -Credential $Credential ` - } - else - { - $feature = Get-WindowsFeature @PSBoundParameters - } - - Assert-SingleFeatureExists -Feature $feature -Name $Name - - $includeAllSubFeature = $true - - if ($feature.SubFeatures.Count -eq 0) - { - $includeAllSubFeature = $false - } - else - { - foreach ($currentSubFeatureName in $feature.SubFeatures) - { - - $getWindowsFeatureParameters = @{ - Name = $currentSubFeatureName - } - - if ($PSBoundParameters.ContainsKey('Credential')) - { - $getWindowsFeatureParameters['Credential'] = $Credential - } - - if ($isWinServer2008R2SP1 -and $PSBoundParameters.ContainsKey('Credential')) - { - <# - Calling Get-WindowsFeature through Invoke-Command to start a new process with - the given credential since Get-WindowsFeature doesn't support the Credential - attribute on this server. - #> - $subFeature = Invoke-Command -ScriptBlock { Get-WindowsFeature -Name $currentSubFeatureName } ` - -ComputerName . ` - -Credential $Credential ` - } - else - { - $subFeature = Get-WindowsFeature @getWindowsFeatureParameters - } - - Assert-SingleFeatureExists -Feature $subFeature -Name $currentSubFeatureName - - if (-not $subFeature.Installed) - { - $includeAllSubFeature = $false - break - } - } - } - - if ($feature.Installed) - { - $ensureResult = 'Present' - } - else - { - $ensureResult = 'Absent' - } - - Write-Verbose -Message ($script:localizedData.GetTargetResourceEndMessage -f $Name) - - # Add all feature properties to the hash table - return @{ - Name = $Name - DisplayName = $feature.DisplayName - Ensure = $ensureResult - IncludeAllSubFeature = $includeAllSubFeature - } -} - -<# - .SYNOPSIS - Installs or uninstalls the role or feature with the given name on the target machine - with the option of installing or uninstalling all subfeatures as well. - - .PARAMETER Name - The name of the role or feature to install or uninstall. - - .PARAMETER Ensure - Specifies whether the role or feature should be installed ('Present') - or uninstalled ('Absent'). - By default this is set to Present. - - .PARAMETER IncludeAllSubFeature - Specifies whether or not all subfeatures should be installed or uninstalled with - the specified role or feature. Default is false. - If this property is true and Ensure is set to Present, all subfeatures will be installed. - If this property is false and Ensure is set to Present, subfeatures will not be installed or uninstalled. - If Ensure is set to Absent, all subfeatures will be uninstalled. - - .PARAMETER Credential - The credential (if required) to install or uninstall the role or feature. - Optional. - - .PARAMETER LogPath - The custom path to the log file to log this operation. - If not passed in, the default log path will be used (%windir%\logs\ServerManager.log). -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Name, - - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present', - - [Boolean] - $IncludeAllSubFeature = $false, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [ValidateNotNullOrEmpty()] - [String] - $LogPath - ) - - Write-Verbose -Message ($script:localizedData.SetTargetResourceStartMessage -f $Name) - - Import-ServerManager - - $isWinServer2008R2SP1 = Test-IsWinServer2008R2SP1 - - if ($Ensure -eq 'Present') - { - $addWindowsFeatureParameters = @{ - Name = $Name - IncludeAllSubFeature = $IncludeAllSubFeature - } - - if ($PSBoundParameters.ContainsKey('LogPath')) - { - $addWindowsFeatureParameters['LogPath'] = $LogPath - } - - Write-Verbose -Message ($script:localizedData.InstallFeature -f $Name) - - if ($isWinServer2008R2SP1 -and $PSBoundParameters.ContainsKey('Credential')) - { - <# - Calling Add-WindowsFeature through Invoke-Command to start a new process with - the given credential since Add-WindowsFeature doesn't support the Credential - attribute on this server. - #> - $feature = Invoke-Command -ScriptBlock { Add-WindowsFeature @addWindowsFeatureParameters } ` - -ComputerName . ` - -Credential $Credential - } - else - { - if ($PSBoundParameters.ContainsKey('Credential')) - { - $addWindowsFeatureParameters['Credential'] = $Credential - } - - $feature = Add-WindowsFeature @addWindowsFeatureParameters - } - - if ($null -ne $feature -and $feature.Success) - { - Write-Verbose -Message ($script:localizedData.InstallSuccess -f $Name) - - # Check if reboot is required, if so notify the Local Configuration Manager. - if ($feature.RestartNeeded -eq 'Yes') - { - Write-Verbose -Message $script:localizedData.RestartNeeded - $global:DSCMachineStatus = 1 - } - } - else - { - New-InvalidOperationException -Message ($script:localizedData.FeatureInstallationFailureError -f $Name) - } - } - # Ensure = 'Absent' - else - { - $removeWindowsFeatureParameters = @{ - Name = $Name - } - - if ($PSBoundParameters.ContainsKey('LogPath')) - { - $removeWindowsFeatureParameters['LogPath'] = $LogPath - } - - Write-Verbose -Message ($script:localizedData.UninstallFeature -f $Name) - - if ($isWinServer2008R2SP1 -and $PSBoundParameters.ContainsKey('Credential')) - { - <# - Calling Remove-WindowsFeature through Invoke-Command to start a new process with - the given credential since Remove-WindowsFeature doesn't support the Credential - attribute on this server. - #> - $feature = Invoke-Command -ScriptBlock { Remove-WindowsFeature @removeWindowsFeatureParameters } ` - -ComputerName . ` - -Credential $Credential - } - else - { - if ($PSBoundParameters.ContainsKey('Credential')) - { - $addWindowsFeatureParameters['Credential'] = $Credential - } - - $feature = Remove-WindowsFeature @removeWindowsFeatureParameters - } - - if ($null -ne $feature -and $feature.Success) - { - Write-Verbose ($script:localizedData.UninstallSuccess -f $Name) - - # Check if reboot is required, if so notify the Local Configuration Manager. - if ($feature.RestartNeeded -eq 'Yes') - { - Write-Verbose -Message $script:localizedData.RestartNeeded - $global:DSCMachineStatus = 1 - } - } - else - { - New-InvalidOperationException -Message ($script:localizedData.FeatureUninstallationFailureError -f $Name) - } - } - - Write-Verbose -Message ($script:localizedData.SetTargetResourceEndMessage -f $Name) -} - -<# - .SYNOPSIS - Tests if the role or feature with the given name is in the desired state. - - .PARAMETER Name - The name of the role or feature to test the state of. - - .PARAMETER Ensure - Specifies whether the role or feature should be installed ('Present') - or uninstalled ('Absent'). - By default this is set to Present. - - .PARAMETER IncludeAllSubFeature - Specifies whether the subfeatures of the indicated role or feature should also be checked - to ensure they are in the desired state. If Ensure is set to 'Present' and this is set to - $true then each subfeature is checked to ensure it is installed as well. If Ensure is set to - Absent and this is set to $true, then each subfeature is checked to ensure it is uninstalled. - As of now, this test can't be used to check if a feature is Installed but all of its - subfeatures are uninstalled. - By default this is set to $false. - - .PARAMETER Credential - The Credential (if required) to test the status of the role or feature. - Optional. - - .PARAMETER LogPath - The path to the log file to log this operation. - Not used in Test-TargetResource. - -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Name, - - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present', - - [Boolean] - $IncludeAllSubFeature = $false, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [ValidateNotNullOrEmpty()] - [String] - $LogPath - - ) - - Write-Verbose -Message ($script:localizedData.TestTargetResourceStartMessage -f $Name) - - Import-ServerManager - - $testTargetResourceResult = $false - - $getWindowsFeatureParameters = @{ - Name = $Name - } - - if ($PSBoundParameters.ContainsKey('Credential')) - { - $getWindowsFeatureParameters['Credential'] = $Credential - } - - Write-Verbose -Message ($script:localizedData.QueryFeature -f $Name) - - $isWinServer2008R2SP1 = Test-IsWinServer2008R2SP1 - if ($isWinServer2008R2SP1 -and $PSBoundParameters.ContainsKey('Credential')) - { - <# - Calling Get-WindowsFeature through Invoke-Command to start a new process with - the given credential since Get-WindowsFeature doesn't support the Credential - attribute on this server. - #> - $feature = Invoke-Command -ScriptBlock { Get-WindowsFeature -Name $Name } ` - -ComputerName . ` - -Credential $Credential - } - else - { - $feature = Get-WindowsFeature @getWindowsFeatureParameters - } - - Assert-SingleFeatureExists -Feature $feature -Name $Name - - # Check if the feature is in the requested Ensure state. - if (($Ensure -eq 'Present' -and $feature.Installed -eq $true) -or ` - ($Ensure -eq 'Absent' -and $feature.Installed -eq $false)) - { - $testTargetResourceResult = $true - - if ($IncludeAllSubFeature) - { - # Check if each subfeature is in the requested state. - foreach ($currentSubFeatureName in $feature.SubFeatures) - { - $getWindowsFeatureParameters['Name'] = $currentSubFeatureName - - if ($isWinServer2008R2SP1 -and $PSBoundParameters.ContainsKey('Credential')) - { - <# - Calling Get-WindowsFeature through Invoke-Command to start a new process with - the given credential since Get-WindowsFeature doesn't support the Credential - attribute on this server. - #> - $subFeature = Invoke-Command -ScriptBlock { Get-WindowsFeature -Name $currentSubFeatureName } ` - -ComputerName . ` - -Credential $Credential - } - else - { - $subFeature = Get-WindowsFeature @getWindowsFeatureParameters - } - - Assert-SingleFeatureExists -Feature $subFeature -Name $currentSubFeatureName - - if (-not $subFeature.Installed -and $Ensure -eq 'Present') - { - $testTargetResourceResult = $false - break - } - - if ($subFeature.Installed -and $Ensure -eq 'Absent') - { - $testTargetResourceResult = $false - break - } - } - } - } - else - { - # Ensure is not in the correct state - $testTargetResourceResult = $false - } - - Write-Verbose -Message ($script:localizedData.TestTargetResourceEndMessage -f $Name) - - return $testTargetResourceResult -} - - -<# - .SYNOPSIS - Asserts that a single instance of the given role or feature exists. - - .PARAMETER Feature - The role or feature object to check. - - .PARAMETER Name - The name of the role or feature to include in any error messages that are thrown. - (Not used to assert validity of the feature). -#> -function Assert-SingleFeatureExists -{ - [CmdletBinding()] - param - ( - [PSObject] - $Feature, - - [String] - $Name - ) - - if ($null -eq $Feature) - { - New-InvalidOperationException -Message ($script:localizedData.FeatureNotFoundError -f $Name) - } - - if ($Feature.Count -gt 1) - { - New-InvalidOperationException -Message ($script:localizedData.MultipleFeatureInstancesError -f $Name) - } -} - -<# - .SYNOPSIS - Sets up the ServerManager module on the target node. - Throws an error if not on a machine running Windows Server. -#> -function Import-ServerManager -{ - param - () - - <# - Enable ServerManager-PSH-Cmdlets feature if OS is WS2008R2 Core. - Datacenter = 12, Standard = 13, Enterprise = 14 - #> - $serverCoreOSCodes = @( 12, 13, 14 ) - - $operatingSystem = Get-CimInstance -Class 'Win32_OperatingSystem' - - # Check if this operating system needs an update to the ServerManager cmdlets - if ($operatingSystem.Version.StartsWith('6.1.') -and ` - $serverCoreOSCodes -contains $operatingSystem.OperatingSystemSKU) - { - Write-Verbose -Message $script:localizedData.EnableServerManagerPSHCmdletsFeature - - <# - ServerManager-PSH-Cmdlets has a depndency on Powershell 2 update: MicrosoftWindowsPowerShell, - so enabling the MicrosoftWindowsPowerShell update. - #> - $null = Dism\online\enable-feature\FeatureName:MicrosoftWindowsPowerShell - $null = Dism\online\enable-feature\FeatureName:ServerManager-PSH-Cmdlets - } - - try - { - Import-Module -Name 'ServerManager' -ErrorAction Stop - } - catch [System.Management.Automation.RuntimeException] { - if ($_.Exception.Message -like "*Some or all identity references could not be translated*") - { - Write-Verbose $_.Exception.Message - } - else - { - Write-Verbose -Message $script:localizedData.ServerManagerModuleNotFoundMessage - New-InvalidOperationException -Message $script:localizedData.SkuNotSupported - } - } - catch - { - Write-Verbose -Message $script:localizedData.ServerManagerModuleNotFoundMessage - New-InvalidOperationException -Message $script:localizedData.SkuNotSupported - } -} - -<# - .SYNOPSIS - Tests if the machine is a Windows Server 2008 R2 SP1 machine. - - .NOTES - Since Assert-PrequisitesValid ensures that ServerManager is available on the machine, - this function only checks the OS version. -#> -function Test-IsWinServer2008R2SP1 -{ - param - () - - return ([Environment]::OSVersion.Version.ToString().Contains('6.1.')) -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsFeature/MSFT_xWindowsFeature.schema.mof b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsFeature/MSFT_xWindowsFeature.schema.mof deleted file mode 100644 index 579850ed..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsFeature/MSFT_xWindowsFeature.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xWindowsFeature")] -class MSFT_xWindowsFeature : OMI_BaseResource -{ - [Key, Description("The name of the role or feature to install or uninstall.")] String Name; - [Write, Description("Specifies whether the role or feature should be installed or uninstalled. To install the feature, set this property to Present. To uninstall the feature, set the property to Absent."), ValueMap{"Present", "Absent"}, Values{"Present", "Absent"}] String Ensure; - [Write, Description("Specifies whether the subfeatures of the main feature should also be installed.")] Boolean IncludeAllSubFeature; - [Write, Description("The path to the log file to log this operation.")] String LogPath; - [Write, Description("A credential, if needed, to install or uninstall the role or feature."), EmbeddedInstance("MSFT_Credential")] String Credential; - [Read, Description("The display name of the retrieved role or feature.")] String DisplayName; -}; diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsFeature/en-US/MSFT_xWindowsFeature.schema.mfl b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsFeature/en-US/MSFT_xWindowsFeature.schema.mfl deleted file mode 100644 index 950c2f25877366cd1d5ae7da9b129c2ff3a22aa1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2160 zcmchYL2uJQ5QXQA#DB0jfmBr-xBw@&NhL%|D-x-Ps;ZLOEs=~95{FVD{yOlzSucr` zI0`*fQ4)K1cIM5@o40>{Us}gc(2&iYRO7vLo4_ku(DvKxtg$B`k8O+=6HO-ZpQh-qa-}dSh?kGh%d!dbgh^C zR-h7sj`i)B|F7JwF5 zD(Of4foXn~Cn0&@Oi3j)2fRLM*vTv4i&WXc?^JL_8YH~9$ zDDZDHZ|xouZ-AF|t}jtEd8_O+BUOzv%+r+YC!X1i9q~WR&w0&takW~BwTWflc;Z4^ zwA4n9EyQY@md&1aK{v1G@+tbNSfj0au*z}ifV#P^9IF3n-=$5Oxdfl8&L#tP^ZSUi zL93)=3G-aKA}m~WQoI+;fDkto;IWk&)Ot51KQTRWC9=K%jV4X=Aq9>5ab0$Sb&+xM z6I6b8rp-z2d7Sea#bdKc!Kb@MvlLi9#$&iEG~?2+yxx^k$84HiYS*UaT -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [String] - $Name - ) - - Write-Verbose -Message ($LocalizedData.GetTargetResourceStartMessage -f $Name) - - Assert-ResourcePrerequisitesValid - - $windowsOptionalFeature = Dism\Get-WindowsOptionalFeature -FeatureName $Name -Online - - <# - $windowsOptionalFeatureProperties and this section of code are needed because an error will be thrown if a property - is not found in WMF 4 instead of returning null. - #> - $windowsOptionalFeatureProperties = @{} - $propertiesNeeded = @( 'LogPath', 'State', 'CustomProperties', 'FeatureName', 'LogLevel', 'Description', 'DisplayName' ) - - foreach ($property in $propertiesNeeded) - { - try - { - $windowsOptionalFeatureProperties[$property] = $windowsOptionalFeature.$property - } - catch - { - $windowsOptionalFeatureProperties[$property] = $null - } - } - - $windowsOptionalFeatureResource = @{ - LogPath = $windowsOptionalFeatureProperties.LogPath - Ensure = Convert-FeatureStateToEnsure -State $windowsOptionalFeatureProperties.State - CustomProperties = - Convert-CustomPropertyArrayToStringArray -CustomProperties $windowsOptionalFeatureProperties.CustomProperties - Name = $windowsOptionalFeatureProperties.FeatureName - LogLevel = $windowsOptionalFeatureProperties.LogLevel - Description = $windowsOptionalFeatureProperties.Description - DisplayName = $windowsOptionalFeatureProperties.DisplayName - } - - Write-Verbose -Message ($script:localizedData.GetTargetResourceEndMessage -f $Name) - - return $windowsOptionalFeatureResource -} - -<# - .SYNOPSIS - Enables or disables a Windows optional feature - - .PARAMETER Name - The name of the feature to enable or disable. - - .PARAMETER Ensure - Specifies whether the feature should be enabled or disabled. - To enable the feature, set this property to Present. - To disable the feature, set the property to Absent. - - .PARAMETER RemoveFilesOnDisable - Specifies that all files associated with the feature should be removed if the feature is - being disabled. - - .PARAMETER NoWindowsUpdateCheck - Specifies whether or not DISM contacts Windows Update (WU) when searching for the source - files to enable the feature. - If $true, DISM will not contact WU. - - .PARAMETER LogPath - The path to the log file to log this operation. - There is no default value, but if not set, the log will appear at - %WINDIR%\Logs\Dism\dism.log. - - .PARAMETER LogLevel - The maximum output level to show in the log. - Accepted values are: "ErrorsOnly" (only errors are logged), "ErrorsAndWarning" (errors and - warnings are logged), and "ErrorsAndWarningAndInformation" (errors, warnings, and debug - information are logged). -#> -function Set-TargetResource -{ - [CmdletBinding(SupportsShouldProcess = $true)] - param - ( - [Parameter(Mandatory = $true)] - [String] - $Name, - - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present', - - [Boolean] - $RemoveFilesOnDisable, - - [Boolean] - $NoWindowsUpdateCheck, - - [String] - $LogPath, - - [ValidateSet('ErrorsOnly', 'ErrorsAndWarning', 'ErrorsAndWarningAndInformation')] - [String] - $LogLevel = 'ErrorsAndWarningAndInformation' - ) - - Write-Verbose -Message ($script:localizedData.SetTargetResourceStartMessage -f $Name) - - Assert-ResourcePrerequisitesValid - - $dismLogLevel = switch ($LogLevel) - { - 'ErrorsOnly' { 'Errors'; break } - 'ErrorsAndWarning' { 'Warnings'; break } - 'ErrorsAndWarningAndInformation' { 'WarningsInfo'; break } - } - - # Construct splatting hashtable for DISM cmdlets - $dismCmdletParameters = @{ - FeatureName = $Name - Online = $true - LogLevel = $dismLogLevel - NoRestart = $true - } - - if ($PSBoundParameters.ContainsKey('LogPath')) - { - $dismCmdletParameters['LogPath'] = $LogPath - } - - if ($Ensure -eq 'Present') - { - if ($PSCmdlet.ShouldProcess($Name, $script:localizedData.ShouldProcessEnableFeature)) - { - if ($NoWindowsUpdateCheck) - { - $dismCmdletParameters['LimitAccess'] = $true - } - - $windowsOptionalFeature = Dism\Enable-WindowsOptionalFeature @dismCmdletParameters - } - - Write-Verbose -Message ($script:localizedData.FeatureInstalled -f $Name) - } - else - { - if ($PSCmdlet.ShouldProcess($Name, $script:localizedData.ShouldProcessDisableFeature)) - { - if ($RemoveFilesOnDisable) - { - $dismCmdletParameters['Remove'] = $true - } - - $windowsOptionalFeature = Dism\Disable-WindowsOptionalFeature @dismCmdletParameters - } - - Write-Verbose -Message ($script:localizedData.FeatureUninstalled -f $Name) - } - - <# - $restartNeeded and this section of code are needed because an error will be thrown if the - RestartNeeded property is not found in WMF 4. - #> - try - { - $restartNeeded = $windowsOptionalFeature.RestartNeeded - } - catch - { - $restartNeeded = $false - } - - # Indicate we need a restart if needed - if ($restartNeeded) - { - Write-Verbose -Message $script:localizedData.RestartNeeded - $global:DSCMachineStatus = 1 - } - - Write-Verbose -Message ($script:localizedData.SetTargetResourceEndMessage -f $Name) -} - -<# - .SYNOPSIS - Tests if a Windows optional feature is in the specified state. - - .PARAMETER Name - The name of the feature to test the state of. - - .PARAMETER Ensure - Specifies whether the feature should be enabled or disabled. - To test if the feature is enabled, set this property to Present. - To test if the feature is disabled, set this property to Absent. - - .PARAMETER RemoveFilesOnDisable - Not used in Test-TargetResource. - - .PARAMETER NoWindowsUpdateCheck - Not used in Test-TargetResource. - - .PARAMETER LogPath - Not used in Test-TargetResource. - - .PARAMETER LogLevel - Not used in Test-TargetResource. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [String] - $Name, - - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present', - - [Boolean] - $RemoveFilesOnDisable, - - [Boolean] - $NoWindowsUpdateCheck, - - [String] - $LogPath, - - [ValidateSet('ErrorsOnly', 'ErrorsAndWarning', 'ErrorsAndWarningAndInformation')] - [String] - $LogLevel = 'ErrorsAndWarningAndInformation' - ) - - Write-Verbose -Message ($script:localizedData.TestTargetResourceStartMessage -f $Name) - - Assert-ResourcePrerequisitesValid - - $windowsOptionalFeature = Dism\Get-WindowsOptionalFeature -FeatureName $Name -Online - - $featureIsInDesiredState = $false - - if ($null -eq $windowsOptionalFeature -or $windowsOptionalFeature.State -eq 'Disabled') - { - $featureIsInDesiredState = $Ensure -eq 'Absent' - } - elseif ($windowsOptionalFeature.State -eq 'Enabled') - { - $featureIsInDesiredState = $Ensure -eq 'Present' - } - - Write-Verbose -Message ($script:localizedData.TestTargetResourceEndMessage -f $Name) - - return $featureIsInDesiredState -} - -<# - .SYNOPSIS - Converts a list of CustomProperty objects into an array of Strings. - - .PARAMETER CustomProperties - The list of CustomProperty objects to be converted. - Each CustomProperty object should have Name, Value, and Path properties. -#> -function Convert-CustomPropertyArrayToStringArray -{ - [CmdletBinding()] - [OutputType([String[]])] - param - ( - [PSCustomObject[]] - $CustomProperties - ) - - $propertiesAsStrings = [String[]] @() - - foreach ($customProperty in $CustomProperties) - { - if ($null -ne $customProperty) - { - $propertiesAsStrings += "Name = $($customProperty.Name), Value = $($customProperty.Value), Path = $($customProperty.Path)" - } - } - - return $propertiesAsStrings -} - -<# - .SYNOPSIS - Converts the string state returned by the DISM Get-WindowsOptionalFeature cmdlet to Present or Absent. - - .PARAMETER State - The state to be converted to either Present or Absent. - Should be either Enabled or Disabled. -#> -function Convert-FeatureStateToEnsure -{ - [CmdletBinding()] - [OutputType([String])] - param - ( - [Parameter(Mandatory = $true)] - [String] - $State - ) - - if ($State -eq 'Disabled') - { - return 'Absent' - } - elseif ($State -eq 'Enabled') - { - return 'Present' - } - else - { - Write-Warning ($script:localizedData.CouldNotConvertFeatureState -f $State) - return $State - } -} - -<# - .SYNOPSIS - Throws errors if the prerequisites for using WindowsOptionalFeature are not met on the - target machine. - - Current prerequisites are: - - Must be running either a Windows client, at least Windows Server 2012, or Nano Server - - Must be running as an administrator - - The DISM PowerShell module must be available for import -#> -function Assert-ResourcePrerequisitesValid -{ - [CmdletBinding()] - param () - - Write-Verbose -Message $script:localizedData.ValidatingPrerequisites - - # Check that we're running on Server 2012 (or later) or on a client SKU - $operatingSystem = Get-CimInstance -ClassName 'Win32_OperatingSystem' - - if (($operatingSystem.ProductType -eq 2) -and ([System.Int32] $operatingSystem.BuildNumber -lt 9600)) - { - New-InvalidOperationException -Message $script:localizedData.NotSupportedSku - } - - # Check that we are running as an administrator - $windowsIdentity = [System.Security.Principal.WindowsIdentity]::GetCurrent() - $windowsPrincipal = New-Object -TypeName 'System.Security.Principal.WindowsPrincipal' -ArgumentList @( $windowsIdentity ) - - $adminRole = [System.Security.Principal.WindowsBuiltInRole]::Administrator - if (-not $windowsPrincipal.IsInRole($adminRole)) - { - New-InvalidOperationException -Message $script:localizedData.ElevationRequired - } - - # Check that Dism PowerShell module is available - Import-Module -Name 'Dism' -ErrorVariable 'errorsFromDismImport' -ErrorAction 'SilentlyContinue' -Force - - if ($errorsFromDismImport.Count -gt 0) - { - New-InvalidOperationException -Message $script:localizedData.DismNotAvailable - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsOptionalFeature/MSFT_xWindowsOptionalFeature.schema.mof b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsOptionalFeature/MSFT_xWindowsOptionalFeature.schema.mof deleted file mode 100644 index 05f30ecb..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsOptionalFeature/MSFT_xWindowsOptionalFeature.schema.mof +++ /dev/null @@ -1,14 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xWindowsOptionalFeature")] -class MSFT_xWindowsOptionalFeature : OMI_BaseResource -{ - [Key, Description("The name of the feature to enable or disable.")] String Name; - [Write, Description("Specifies whether the feature should be enabled or disabled. To enable the feature, set this property to Present. To disable the feature, set the property to Absent."), ValueMap{"Present", "Absent"}, Values{"Present", "Absent"}] String Ensure; - [Write, Description("Specifies that all files associated with the feature should be removed if the feature is being disabled.")] Boolean RemoveFilesOnDisable; - [Write, Description("Specifies whether or not DISM contacts Windows Update (WU) when searching for the source files to enable the feature. If $true, DISM will not contact WU.")] Boolean NoWindowsUpdateCheck; - [Write, Description("The maximum output level to show in the log. Accepted values are: ErrorsOnly (only errors are logged), ErrorsAndWarning (errors and warnings are logged), and ErrorsAndWarningAndInformation (errors, warnings, and debug information are logged)."), ValueMap{"ErrorsOnly", "ErrorsAndWarning", "ErrorsAndWarningAndInformation"}, Values{"ErrorsOnly", "ErrorsAndWarning", "ErrorsAndWarningAndInformation"}] String LogLevel; - [Write, Description("The path to the log file to log this operation.")] String LogPath; - [Read, Description("The custom properties retrieved from the Windows optional feature as an array of strings.")] String CustomProperties[]; - [Read, Description("The description retrieved from the Windows optional feature.")] String Description; - [Read, Description("The display name retrieved from the Windows optional feature.")] String DisplayName; -}; diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsOptionalFeature/en-US/MSFT_xWindowsOptionalFeature.schema.mfl b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsOptionalFeature/en-US/MSFT_xWindowsOptionalFeature.schema.mfl deleted file mode 100644 index dc56b8ac6bd6bd92aafa493b2f184cfe5bc4f19e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3260 zcmcImO>fgc5S=SX{D&3dkV*(~-~yb|HkB&Uq#~&}R8^J6PKj{iD0UhU;;&QQoAF|= z(r^G~kHDSdWe zY=&o!xNsD*)Et8p4Avvy*=*vIyo_LhYFNlEMuWoo$G_NjBOZaL7@W?5ZH_l;XQOBh zGqLPKpJ5%@N>np9>S0w+R8o^S5!B%jwQc=1TcSFs+PuJG3SYuw>M+J{j>vd6&oQPS zM3Pr5)iwP%Ta4N+OI_qmX=j(-x8u_TvaHAyi;;ts>fgQ`Z;BXwVfHyZlOiAI__cUi zwxk+muCn~!Al}^9F23aU4!qwNr%*S$Pq0W)8D5)V6sUxKydA<)s(!FCIn7XS{RC&4 zheOOAW0b*rt7K25d{gfN7|880s>KL3!+}Xw+#L3%crs_g>f_`Bs);lvR8R-=7g`T3 zx9AI%Gl5p8h=FHkhI6YK7glg)sE=t=^=?))bL~{4^a@y4&|O?qG4BnPV5;$+hW^pJ zi|=ZDkDemnN{bTJSI|OUG1Q|3F`bDzia%nwyfdNQlCzlp(@#pj2){_8;r?s zsnP^HZ?!UXfq~tTUDUGT9ySu?h*4#HV(no)ys_S_5I5>A(TdZ-7yr&WYdd*b|0TH7A5v)%P_AX|DEfs zmidlTveX{?d4Zx0@+o-DRM%8~*pYnSrdI79VBE0(&Qz1!<9!XYl37&VA)D@UjIU{p zImGy_@MOQWyA4tKyT`tJ-*z87s`$jN?YX7?*tss{s#SfU{ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Name, - - [Parameter(Mandatory = $true)] - [ValidateSet('Present', 'Absent')] - [String] - $Ensure, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $SourcePath, - - [ValidateNotNullOrEmpty()] - [String] - $LogPath - ) - - $windowsPackageCab = @{ - Name = $Name - Ensure = 'Present' - SourcePath = $SourcePath - LogPath = $LogPath - } - - $getWindowsPackageParams = @{ - PackageName = $Name - Online = $true - } - - if ($PSBoundParameters.ContainsKey('LogPath')) - { - $getWindowsPackageParams['LogPath'] = $LogPath - } - - Write-Verbose -Message ($script:localizedData.RetrievingPackage -f $Name) - - try - { - $windowsPackageInfo = Dism\Get-WindowsPackage @getWindowsPackageParams - } - catch - { - $windowsPackageInfo = $null - } - - if ($null -eq $windowsPackageInfo -or -not ($windowsPackageInfo.PackageState -in @( 'Installed', 'InstallPending' ))) - { - $windowsPackageCab.Ensure = 'Absent' - } - - Write-Verbose -Message ($script:localizedData.PackageEnsureState -f $Name, $windowsPackageCab.Ensure) - - return $windowsPackageCab -} - -<# - .SYNOPSIS - Installs or uninstalls a package from a windows cabinet (cab) file. - - .PARAMETER Name - The name of the package to install or uninstall. - - .PARAMETER Ensure - Specifies whether the package should be installed or uninstalled. - To install the package, set this property to Present. - To uninstall the package, set the property to Absent. - - .PARAMETER SourcePath - The path to the cab file to install or uninstall the package from. - - .PARAMETER LogPath - The path to a file to log this operation to. - There is no default value, but if not set, the log will appear at %WINDIR%\Logs\Dism\dism.log. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Name, - - [Parameter(Mandatory = $true)] - [ValidateSet('Present', 'Absent')] - [String] - $Ensure, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $SourcePath, - - [ValidateNotNullOrEmpty()] - [String] - $LogPath - ) - - Write-Verbose -Message ($script:localizedData.SetTargetResourceStarting -f $Name) - - if (-not (Test-Path -Path $SourcePath)) - { - New-InvalidArgumentException -ArgumentName 'SourcePath' -Message ($script:localizedData.SourcePathDoesNotExist -f $SourcePath) - } - - if ($Ensure -ieq 'Present') - { - Write-Verbose -Message ($script:localizedData.AddingPackage -f $SourcePath) - Dism\Add-WindowsPackage -PackagePath $SourcePath -LogPath $LogPath -Online - } - else - { - Write-Verbose -Message ($script:localizedData.RemovingPackage -f $SourcePath) - Dism\Remove-WindowsPackage -PackagePath $SourcePath -LogPath $LogPath -Online - } - - Write-Verbose -Message ($script:localizedData.SetTargetResourceFinished -f $Name) -} - -<# - .SYNOPSIS - Tests whether a package in a windows cabinet (cab) file is installed or uninstalled. - - .PARAMETER Name - The name of the cab package to test for installation. - - .PARAMETER Ensure - Specifies whether to test if the package is installed or uninstalled. - To test if the package is installed, set this property to Present. - To test if the package is uninstalled, set the property to Absent. - - .PARAMETER SourcePath - Not used in Test-TargetResource. - - .PARAMETER LogPath - The path to a file to log this operation to. - There is no default value, but if not set, the log will appear at %WINDIR%\Logs\Dism\dism.log. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Name, - - [Parameter(Mandatory = $true)] - [ValidateSet('Present', 'Absent')] - [String] - $Ensure, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $SourcePath, - - [ValidateNotNullOrEmpty()] - [String] - $LogPath - ) - - $getTargetResourceParams = @{ - Name = $Name - Ensure = $Ensure - SourcePath = $SourcePath - } - - if ($PSBoundParameters.ContainsKey('LogPath')) - { - $getTargetResourceParams['LogPath'] = $LogPath - } - - $windowsPackageCab = Get-TargetResource @getTargetResourceParams - - if ($windowsPackageCab.Ensure -ieq $Ensure) - { - Write-Verbose -Message ($script:localizedData.EnsureStatesMatch -f $Name) - return $true - } - else - { - Write-Verbose -Message ($script:localizedData.EnsureStatesDoNotMatch -f $Name) - return $false - } -} - -Export-ModuleMember -Function '*-TargetResource' diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsPackageCab/MSFT_xWindowsPackageCab.schema.mof b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsPackageCab/MSFT_xWindowsPackageCab.schema.mof deleted file mode 100644 index cd778302..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsPackageCab/MSFT_xWindowsPackageCab.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xWindowsPackageCab")] -class MSFT_xWindowsPackageCab : OMI_BaseResource -{ - [Key, Description("The name of the package to install or uninstall.")] String Name; - [Required, Description("Specifies whether the package should be installed or uninstalled. To install the package, set this property to Present. To uninstall the package, set the property to Absent."), ValueMap{"Present", "Absent"}, Values{"Present", "Absent"}] String Ensure; - [Required, Description("The path to the cab file to install or uninstall the package from.")] String SourcePath; - [Write, Description("The path to a file to log the operation to.")] String LogPath; -}; diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsPackageCab/en-US/MSFT_xWindowsPackageCab.schema.mfl b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsPackageCab/en-US/MSFT_xWindowsPackageCab.schema.mfl deleted file mode 100644 index 553df028..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsPackageCab/en-US/MSFT_xWindowsPackageCab.schema.mfl +++ /dev/null @@ -1,8 +0,0 @@ -[Description("This resource is used to install or uninstall a package from a windows cabinet (cab) file.") : Amended,AMENDMENT, LOCALE("MS_409")] -class MSFT_xWindowsPackageCab : OMI_BaseResource -{ - [Key, Description("The name of the package to install or uninstall.") : Amended] String Name; - [Description("Specifies whether the package should be installed or uninstalled. To install the package, set this property to Present. To uninstall the package, set the property to Absent.") : Amended] String Ensure; - [Description("The path to the cab file to install or uninstall the package from.") : Amended] String SourcePath; - [Description("The path to a file to log the operation to.") : Amended] String LogPath; -}; diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsPackageCab/en-US/MSFT_xWindowsPackageCab.strings.psd1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsPackageCab/en-US/MSFT_xWindowsPackageCab.strings.psd1 deleted file mode 100644 index 5b9faf70..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsPackageCab/en-US/MSFT_xWindowsPackageCab.strings.psd1 +++ /dev/null @@ -1,13 +0,0 @@ -# Localized resources for xWindowsPackageCab - -ConvertFrom-StringData @' - RetrievingPackage = Retrieving information for the package {0} - PackageEnsureState = The package {0} is currently {1} - SourcePathDoesNotExist = Could not find the source file at path {0} - SetTargetResourceStarting = Starting configuration of the WindowsPackageCab resource {0} - SetTargetResourceFinished = Finished configuration of WindowsPackageCab resource {0} - AddingPackage = Adding a package from the source at path {0} - RemovingPackage = Removing package from the source at path {0} - EnsureStatesMatch = Ensure states match for package {0} - EnsureStatesDoNotMatch = Ensure states do not match for package {0} -'@ diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsProcess/MSFT_xWindowsProcess.psm1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsProcess/MSFT_xWindowsProcess.psm1 deleted file mode 100644 index 0700a6b9..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsProcess/MSFT_xWindowsProcess.psm1 +++ /dev/null @@ -1,1491 +0,0 @@ -$errorActionPreference = 'Stop' -Set-StrictMode -Version 'Latest' - -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` - -ChildPath 'CommonResourceHelper.psm1') - -# Localized messages for verbose and error statements in this resource -$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_xWindowsProcess' - -<# - .SYNOPSIS - Retrieves the current state of the Windows process(es) with the specified - executable and arguments. - - If more than one process is found, only the information of the first process is retrieved. - ProcessCount will contain the actual number of processes that were found. - - .PARAMETER Path - The path to the process executable. If this is the file name of the executable - (not the fully qualified path), the DSC resource will search the environment Path variable - ($env:Path) to find the executable file. If the value of this property is a fully qualified - path, DSC will use the given Path variable to find the file. If the path is not found it - will throw an error. Relative paths are not allowed. - - .PARAMETER Arguments - The arguments to the process as a single string. - - .PARAMETER Credential - The credential of the user account to start the process under. -#> -function Get-TargetResource -{ - [OutputType([Hashtable])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [Parameter(Mandatory = $true)] - [AllowEmptyString()] - [String] - $Arguments, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential - ) - - Write-Verbose -Message ($script:localizedData.GetTargetResourceStartMessage -f $Path) - - $Path = Expand-Path -Path $Path - - $getProcessCimInstanceArguments = @{ - Path = $Path - Arguments = $Arguments - } - - if ($PSBoundParameters.ContainsKey('Credential')) - { - $getProcessCimInstanceArguments['Credential'] = $Credential - } - - $processCimInstance = @( Get-ProcessCimInstance @getProcessCimInstanceArguments ) - - $processToReturn = @{} - - if ($processCimInstance.Count -eq 0) - { - $processToReturn = @{ - Path = $Path - Arguments = $Arguments - Ensure ='Absent' - } - } - else - { - $processId = $processCimInstance[0].ProcessId - $getProcessResult = Get-Process -ID $processId - - $processToReturn = @{ - Path = $Path - Arguments = $Arguments - PagedMemorySize = $getProcessResult.PagedMemorySize64 - NonPagedMemorySize = $getProcessResult.NonpagedSystemMemorySize64 - VirtualMemorySize = $getProcessResult.VirtualMemorySize64 - HandleCount = $getProcessResult.HandleCount - Ensure = 'Present' - ProcessId = $processId - ProcessCount = $processCimInstance.Count - } - } - - Write-Verbose -Message ($script:localizedData.GetTargetResourceEndMessage -f $Path) - return $processToReturn -} - -<# - .SYNOPSIS - Sets the Windows process with the specified executable path and arguments - to the specified state. - - If multiple process are found, the specified state will be set for all of them. - - .PARAMETER Path - The path to the process executable. If this is the file name of the executable - (not the fully qualified path), the DSC resource will search the environment Path variable - ($env:Path) to find the executable file. If the value of this property is a fully qualified - path, DSC will use the given Path variable to find the file. If the path is not found it - will throw an error. Relative paths are not allowed. - - .PARAMETER Arguments - The arguments to pass to the process as a single string. - - .PARAMETER Credential - The credential of the user account to start the process under. - - .PARAMETER Ensure - Specifies whether or not the process should exist. - To start or modify a process, set this property to Present. - To stop a process, set this property to Absent. - The default value is Present. - - .PARAMETER StandardOutputPath - The file path to write the standard output to. Any existing file at this path - will be overwritten.This property cannot be specified at the same time as Credential - when running the process as a local user. - - .PARAMETER StandardErrorPath - The file path to write the standard error output to. Any existing file at this path - will be overwritten. - - .PARAMETER StandardInputPath - The file path to get standard input from. This property cannot be specified at the - same time as Credential when running the process as a local user. - - .PARAMETER WorkingDirectory - The file path to use as the working directory for the process. Any existing file - at this path will be overwritten. This property cannot be specified at the same time - as Credential when running the process as a local user. -#> -function Set-TargetResource -{ - [CmdletBinding(SupportsShouldProcess = $true)] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [Parameter(Mandatory = $true)] - [AllowEmptyString()] - [String] - $Arguments, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present', - - [String] - $StandardOutputPath, - - [String] - $StandardErrorPath, - - [String] - $StandardInputPath, - - [String] - $WorkingDirectory - ) - - Write-Verbose -Message ($script:localizedData.SetTargetResourceStartMessage -f $Path) - - Assert-PsDscContextNotRunAsUser - - $Path = Expand-Path -Path $Path - - $getProcessCimInstanceArguments = @{ - Path = $Path - Arguments = $Arguments - } - - if ($PSBoundParameters.ContainsKey('Credential')) - { - $getProcessCimInstanceArguments['Credential'] = $Credential - } - - $processCimInstance = @( Get-ProcessCimInstance @getProcessCimInstanceArguments ) - - if ($Ensure -eq 'Absent') - { - $assertHashtableParams = @{ - Hashtable = $PSBoundParameters - Key = @( 'StandardOutputPath', - 'StandardErrorPath', - 'StandardInputPath', - 'WorkingDirectory' ) - } - Assert-HashtableDoesNotContainKey @assertHashtableParams - - $whatIfShouldProcess = $PSCmdlet.ShouldProcess($Path, $script:localizedData.StoppingProcessWhatif) - if ($processCimInstance.Count -gt 0 -and $whatIfShouldProcess) - { - # If there are multiple process Ids, all will be included to be stopped - $processIds = $processCimInstance.ProcessId - - # Redirecting error output to standard output while we try to stop the processes - $stopProcessError = Stop-Process -Id $processIds -Force 2>&1 - - if ($null -eq $stopProcessError) - { - Write-Verbose -Message ($script:localizedData.ProcessesStopped -f $Path, ($processIds -join ',')) - } - else - { - $errorMessage = ($script:localizedData.ErrorStopping -f $Path, - ($processIds -join ','), - ($stopProcessError | Out-String)) - - New-InvalidOperationException -Message $errorMessage - } - <# - Before returning from Set-TargetResource we have to ensure a subsequent - Test-TargetResource is going to work - #> - if (-not (Wait-ProcessCount -ProcessSettings $getProcessCimInstanceArguments -ProcessCount 0)) - { - $message = $script:localizedData.ErrorStopping -f $Path, ($processIds -join ','), - $script:localizedData.FailureWaitingForProcessesToStop - - New-InvalidOperationException -Message $message - } - } - else - { - Write-Verbose -Message ($script:localizedData.ProcessAlreadyStopped -f $Path) - } - } - # Ensure = 'Present' - else - { - $shouldBeRootedPathArguments = @( 'StandardInputPath', - 'WorkingDirectory', - 'StandardOutputPath', - 'StandardErrorPath' ) - - foreach ($shouldBeRootedPathArgument in $shouldBeRootedPathArguments) - { - if (-not [String]::IsNullOrEmpty($PSBoundParameters[$shouldBeRootedPathArgument])) - { - $assertPathArgumentRootedParams = @{ - PathArgumentName = $shouldBeRootedPathArgument - PathArgument = $PSBoundParameters[$shouldBeRootedPathArgument] - } - Assert-PathArgumentRooted @assertPathArgumentRootedParams - } - } - - $shouldExistPathArguments = @( 'StandardInputPath', 'WorkingDirectory' ) - - foreach ($shouldExistPathArgument in $shouldExistPathArguments) - { - if (-not [String]::IsNullOrEmpty($PSBoundParameters[$shouldExistPathArgument])) - { - $assertPathArgumentValidParams = @{ - PathArgumentName = $shouldExistPathArgument - PathArgument = $PSBoundParameters[$shouldExistPathArgument] - } - Assert-PathArgumentValid @assertPathArgumentValidParams - } - } - - if ($processCimInstance.Count -eq 0) - { - $startProcessArguments = @{ - FilePath = $Path - } - - $startProcessOptionalArgumentMap = @{ - Credential = 'Credential' - RedirectStandardOutput = 'StandardOutputPath' - RedirectStandardError = 'StandardErrorPath' - RedirectStandardInput = 'StandardInputPath' - WorkingDirectory = 'WorkingDirectory' - } - - foreach ($startProcessOptionalArgumentName in $startProcessOptionalArgumentMap.Keys) - { - $parameterKey = $startProcessOptionalArgumentMap[$startProcessOptionalArgumentName] - $parameterValue = $PSBoundParameters[$parameterKey] - - if (-not [String]::IsNullOrEmpty($parameterValue)) - { - $startProcessArguments[$startProcessOptionalArgumentName] = $parameterValue - } - } - - if (-not [String]::IsNullOrEmpty($Arguments)) - { - $startProcessArguments['ArgumentList'] = $Arguments - } - - if ($PSCmdlet.ShouldProcess($Path, $script:localizedData.StartingProcessWhatif)) - { - <# - Start-Process calls .net Process.Start() - If -Credential is present Process.Start() uses win32 api CreateProcessWithLogonW - http://msdn.microsoft.com/en-us/library/0w4h05yb(v=vs.110).aspx - CreateProcessWithLogonW cannot be called as LocalSystem user. - Details http://msdn.microsoft.com/en-us/library/windows/desktop/ms682431(v=vs.85).aspx - (section Remarks/Windows XP with SP2 and Windows Server 2003) - - In this case we call another api. - #> - if (($PSBoundParameters.ContainsKey('Credential')) -and (Test-IsRunFromLocalSystemUser)) - { - # Throw an exception if any of the below parameters are included with Credential passed - foreach ($key in @('StandardOutputPath','StandardInputPath','WorkingDirectory')) - { - if ($PSBoundParameters.Keys -contains $key) - { - $newInvalidArgumentExceptionParams = @{ - ArgumentName = $key - Message = $script:localizedData.ErrorParametersNotSupportedWithCredential - } - New-InvalidArgumentException @newInvalidArgumentExceptionParams - } - } - try - { - Start-ProcessAsLocalSystemUser -Path $Path -Arguments $Arguments -Credential $Credential - } - catch - { - throw (New-Object -TypeName 'System.Management.Automation.ErrorRecord' ` - -ArgumentList @( $_.Exception, 'Win32Exception', 'OperationStopped', $null )) - } - } - # Credential not passed in or running from a LocalSystem - else - { - try - { - Start-Process @startProcessArguments - } - catch [System.Exception] - { - $errorMessage = ($script:localizedData.ErrorStarting -f $Path, $_.Exception.Message) - - New-InvalidOperationException -Message $errorMessage - } - } - - Write-Verbose -Message ($script:localizedData.ProcessesStarted -f $Path) - - # Before returning from Set-TargetResource we have to ensure a subsequent Test-TargetResource is going to work - if (-not (Wait-ProcessCount -ProcessSettings $getProcessCimInstanceArguments -ProcessCount 1)) - { - $message = $script:localizedData.ErrorStarting -f $Path, - $script:localizedData.FailureWaitingForProcessesToStart - - New-InvalidOperationException -Message $message - } - } - } - else - { - Write-Verbose -Message ($script:localizedData.ProcessAlreadyStarted -f $Path) - } - } - - Write-Verbose -Message ($script:localizedData.SetTargetResourceEndMessage -f $Path) -} - -<# - .SYNOPSIS - Tests if the Windows process with the specified executable path and arguments is in - the specified state. - - .PARAMETER Path - The path to the process executable. If this is the file name of the executable - (not the fully qualified path), the DSC resource will search the environment Path variable - ($env:Path) to find the executable file. If the value of this property is a fully qualified - path, DSC will use the given Path variable to find the file. If the path is not found it - will throw an error. Relative paths are not allowed. - - .PARAMETER Arguments - The arguments to pass to the process as a single string. - - .PARAMETER Credential - The credential of the user account the process should be running under. - - .PARAMETER Ensure - Specifies whether or not the process should exist. - If the process should exist, set this property to Present. - If the process should not exist, set this property to Absent. - The default value is Present. - - .PARAMETER StandardOutputPath - Not used in Test-TargetResource. - - .PARAMETER StandardErrorPath - Not used in Test-TargetResource. - - .PARAMETER StandardInputPath - Not used in Test-TargetResource. - - .PARAMETER WorkingDirectory - Not used in Test-TargetResource. -#> -function Test-TargetResource -{ - [OutputType([Boolean])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [Parameter(Mandatory = $true)] - [AllowEmptyString()] - [String] - $Arguments, - - [ValidateNotNullOrEmpty()] - [PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present', - - [String] - $StandardOutputPath, - - [String] - $StandardErrorPath, - - [String] - $StandardInputPath, - - [String] - $WorkingDirectory - ) - - Write-Verbose -Message ($script:localizedData.TestTargetResourceStartMessage -f $Path) - - Assert-PsDscContextNotRunAsUser - - $Path = Expand-Path -Path $Path - - $getProcessCimInstanceArguments = @{ - Path = $Path - Arguments = $Arguments - } - - if ($PSBoundParameters.ContainsKey('Credential')) - { - $getProcessCimInstanceArguments['Credential'] = $Credential - } - - $processCimInstances = @( Get-ProcessCimInstance @getProcessCimInstanceArguments ) - - Write-Verbose -Message ($script:localizedData.TestTargetResourceEndMessage -f $Path) - - if ($Ensure -eq 'Absent') - { - return ($processCimInstances.Count -eq 0) - } - else - { - return ($processCimInstances.Count -gt 0) - } -} - -<# - .SYNOPSIS - Expands a relative leaf path into a full, rooted path. Throws an invalid argument exception - if the path is not valid. - - .PARAMETER Path - The relative leaf path to expand. -#> -function Expand-Path -{ - [OutputType([String])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path - ) - - $Path = [Environment]::ExpandEnvironmentVariables($Path) - - # Check to see if the path is rooted. If so, return it as is. - if ([IO.Path]::IsPathRooted($Path)) - { - if (-not (Test-Path -Path $Path -PathType 'Leaf')) - { - New-InvalidArgumentException -ArgumentName 'Path' -Message ($script:localizedData.FileNotFound -f $Path) - } - - return $Path - } - - # Check to see if the path to the file exists in the current location. If so, return the full rooted path. - $rootedPath = [System.IO.Path]::GetFullPath($Path) - if ([System.IO.File]::Exists($rootedPath)) - { - return $rootedPath - } - - # If the path is not found, throw an exception - New-InvalidArgumentException -ArgumentName 'Path' -Message ($script:localizedData.FileNotFound -f $Path) -} - -<# - .SYNOPSIS - Retrieves any process CIM instance objects that match the given path, arguments, and credential. - - .PARAMETER Path - The executable path of the process to retrieve. - - .PARAMETER Arguments - The arguments of the process to retrieve as a single string. - - .PARAMETER Credential - The credential of the user account of the process to retrieve - - .PARAMETER UseGetCimInstanceThreshold - If the number of processes returned by the Get-Process method is greater than or equal to - this value, this function will retrieve all processes at the executable path. This will - help the function execute faster. Otherwise, this function will retrieve each process - CIM instance with the process IDs retrieved from Get-Process. -#> -function Get-ProcessCimInstance -{ - [OutputType([CimInstance[]])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [ValidateRange(0, [Int]::MaxValue)] - [Int] - $UseGetCimInstanceThreshold = 8 - ) - - $processName = [IO.Path]::GetFileNameWithoutExtension($Path) - - $getProcessResult = @( Get-Process -Name $processName -ErrorAction 'SilentlyContinue' ) - - $processCimInstances = @() - - if ($getProcessResult.Count -ge $UseGetCimInstanceThreshold) - { - - $escapedPathForWqlFilter = ConvertTo-EscapedStringForWqlFilter -FilterString $Path - $wqlFilter = "ExecutablePath = '$escapedPathForWqlFilter'" - - $processCimInstances = Get-CimInstance -ClassName 'Win32_Process' -Filter $wqlFilter - } - else - { - foreach ($process in $getProcessResult) - { - if ($process.Path -ieq $Path) - { - Write-Verbose -Message ($script:localizedData.VerboseInProcessHandle -f $process.Id) - $getCimInstanceParams = @{ - ClassName = 'Win32_Process' - Filter = "ProcessId = $($process.Id)" - ErrorAction = 'SilentlyContinue' - } - $processCimInstances += Get-CimInstance @getCimInstanceParams - } - } - } - - if ($PSBoundParameters.ContainsKey('Credential')) - { - $splitCredentialResult = Split-Credential -Credential $Credential - $domain = $splitCredentialResult.Domain - $userName = $splitCredentialResult.UserName - $processesWithCredential = @() - - foreach ($process in $processCimInstances) - { - if ((Get-ProcessOwner -Process $process) -eq "$domain\$userName") - { - $processesWithCredential += $process - } - } - $processCimInstances = $processesWithCredential - } - - if ($null -eq $Arguments) - { - $Arguments = [String]::Empty - } - - $processesWithMatchingArguments = @() - - foreach ($process in $processCimInstances) - { - if ((Get-ArgumentsFromCommandLineInput -CommandLineInput $process.CommandLine) -eq $Arguments) - { - $processesWithMatchingArguments += $process - } - } - - return $processesWithMatchingArguments -} - -<# - .SYNOPSIS - Converts a string to an escaped string to be used in a WQL filter such as the one passed in - the Filter parameter of Get-WmiObject. - - .PARAMETER FilterString - The string to convert. -#> -function ConvertTo-EscapedStringForWqlFilter -{ - [OutputType([String])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $FilterString - ) - - return $FilterString.Replace("\","\\").Replace('"','\"').Replace("'","\'") -} - -<# - .SYNOPSIS - Retrieves the owner of a Process. - - .PARAMETER Process - The Process to retrieve the owner of. - - .NOTES - If the process was killed by the time this function is called, this function will throw a - WMIMethodException with the message "Not found". -#> -function Get-ProcessOwner -{ - [OutputType([String])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [Object] - $Process - ) - - $owner = Get-ProcessOwnerCimInstance -Process $Process -ErrorAction 'SilentlyContinue' - - if ($null -ne $owner) - { - if ($null -ne $owner.Domain) - { - return ($owner.Domain + '\' + $owner.User) - } - else - { - # return the default domain - return ($env:computerName + '\' + $owner.User) - } - } - - return '' -} - -<# - .SYNOPSIS - Wrapper function to retrieve the CIM instance of the owner of a process - - .PARAMETER Process - The process to retrieve the CIM instance of the owner of. - - .NOTES - If the process was killed by the time this function is called, this function will throw a - WMIMethodException with the message "Not found". -#> -function Get-ProcessOwnerCimInstance -{ - [OutputType([CimInstance])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [Object] - $Process - ) - - return Invoke-CimMethod -InputObject $Process -MethodName 'GetOwner' -ErrorAction 'SilentlyContinue' -} - -<# - .SYNOPSIS - Retrieves the 'arguments' part of command line input. - - .PARAMETER CommandLineInput - The command line input to retrieve the arguments from. - - .EXAMPLE - Get-ArgumentsFromCommandLineInput -CommandLineInput 'C:\temp\a.exe X Y Z' - Returns 'X Y Z'. -#> -function Get-ArgumentsFromCommandLineInput -{ - [OutputType([String])] - [CmdletBinding()] - param - ( - [String] - $CommandLineInput - ) - - if ([String]::IsNullOrWhitespace($CommandLineInput)) - { - return [String]::Empty - } - - $CommandLineInput = $CommandLineInput.Trim() - - if ($CommandLineInput.StartsWith('"')) - { - $endOfCommandChar = [Char]'"' - } - else - { - $endOfCommandChar = [Char]' ' - } - - $endofCommandIndex = $CommandLineInput.IndexOf($endOfCommandChar, 1) - - if ($endofCommandIndex -eq -1) - { - return [String]::Empty - } - - return $CommandLineInput.Substring($endofCommandIndex + 1).Trim() -} - -<# - .SYNOPSIS - Throws an invalid argument exception if the given hashtable contains the given key(s). - - .PARAMETER Hashtable - The hashtable to check the keys of. - - .PARAMETER Key - The key(s) that should not be in the hashtable. -#> -function Assert-HashtableDoesNotContainKey -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [Hashtable] - $Hashtable, - - [Parameter(Mandatory = $true)] - [String[]] - $Key - ) - - foreach ($keyName in $Key) - { - if ($Hashtable.ContainsKey($keyName)) - { - New-InvalidArgumentException -ArgumentName $keyName ` - -Message ($script:localizedData.ParameterShouldNotBeSpecified -f $keyName) - } - } -} - -<# - .SYNOPSIS - Waits for the given amount of time for the given number of processes with the given settings - to be running. If not all processes are running by 'WaitTime', the function returns - false, otherwise it returns true. - - .PARAMETER ProcessSettings - The settings for the running process(es) that we're getting the count of. - - .PARAMETER ProcessCount - The number of processes running to wait for. - - .PARAMETER WaitTime - The amount of milliseconds to wait for all processes to be running. - Default is 2000. -#> -function Wait-ProcessCount -{ - [OutputType([Boolean])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [Hashtable] - $ProcessSettings, - - [Parameter(Mandatory = $true)] - [ValidateRange(0, [Int]::MaxValue)] - [Int] - $ProcessCount, - - [Int] - $WaitTime = 200000 - ) - - $startTime = [DateTime]::Now - - do - { - $actualProcessCount = @( Get-ProcessCimInstance @ProcessSettings ).Count - } while ($actualProcessCount -ne $ProcessCount -and ([DateTime]::Now - $startTime).TotalMilliseconds -lt $WaitTime) - - return $actualProcessCount -eq $ProcessCount -} - -<# - .SYNOPSIS - Throws an error if the given path argument is not rooted. - - .PARAMETER PathArgumentName - The name of the path argument that should be rooted. - - .PARAMETER PathArgument - The path arguments that should be rooted. -#> -function Assert-PathArgumentRooted -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $PathArgumentName, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $PathArgument - ) - - if (-not ([IO.Path]::IsPathRooted($PathArgument))) - { - $message = $script:localizedData.PathShouldBeAbsolute -f $PathArgumentName, $PathArgument - - New-InvalidArgumentException -ArgumentName 'Path' ` - -Message $message - } -} - -<# - .SYNOPSIS - Throws an error if the given path argument does not exist. - - .PARAMETER PathArgumentName - The name of the path argument that should exist. - - .PARAMETER PathArgument - The path argument that should exist. -#> -function Assert-PathArgumentValid -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $PathArgumentName, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $PathArgument - ) - - if (-not (Test-Path -Path $PathArgument)) - { - $message = $script:localizedData.PathShouldExist -f $PathArgument, $PathArgumentName - - New-InvalidArgumentException -ArgumentName 'Path' ` - -Message $message - } -} - -<# - .SYNOPSIS - Tests if the current user is from the local system. -#> -function Test-IsRunFromLocalSystemUser -{ - [OutputType([Boolean])] - [CmdletBinding()] - param () - - $identity = [Security.Principal.WindowsIdentity]::GetCurrent() - $principal = New-Object -TypeName Security.Principal.WindowsPrincipal -ArgumentList $identity - - return $principal.Identity.IsSystem -} - -<# - .SYNOPSIS - Starts the process with the given credential when the user is a local system user. - - .PARAMETER Path - The path to the process executable. - - .PARAMETER Arguments - Indicates a string of arguments to pass to the process as-is. - - .PARAMETER Credential - Indicates the credential for starting the process. -#> -function Start-ProcessAsLocalSystemUser -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [Parameter(Mandatory = $true)] - [AllowEmptyString()] - [String] - $Arguments, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential - ) - - $splitCredentialResult = Split-Credential -Credential $Credential - - <# - Internally we use win32 api LogonUser() with - dwLogonType == LOGON32_LOGON_NETWORK_CLEARTEXT. - - It grants the process ability for second-hop. - #> - Import-DscNativeMethods - - [PSDesiredStateConfiguration.NativeMethods]::CreateProcessAsUser( "$Path $Arguments", $splitCredentialResult.Domain, - $splitCredentialResult.UserName, $Credential.Password, - $false, [Ref]$null ) -} - -<# - .SYNOPSIS - Splits a credential into a username and domain without calling GetNetworkCredential. - Calls to GetNetworkCredential expose the password as plain text in memory. - - .PARAMETER Credential - The credential to pull the username and domain out of. - - .NOTES - Supported formats: DOMAIN\username, username@domain -#> -function Split-Credential -{ - [OutputType([Hashtable])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential - ) - - $wrongFormat = $false - - if ($Credential.UserName.Contains('\')) - { - $credentialSegments = $Credential.UserName.Split('\') - - if ($credentialSegments.Length -gt 2) - { - # i.e. domain\user\foo - $wrongFormat = $true - } - else - { - $domain = $credentialSegments[0] - $userName = $credentialSegments[1] - } - } - elseif ($Credential.UserName.Contains('@')) - { - $credentialSegments = $Credential.UserName.Split('@') - - if ($credentialSegments.Length -gt 2) - { - # i.e. user@domain@foo - $wrongFormat = $true - } - else - { - $UserName = $credentialSegments[0] - $Domain = $credentialSegments[1] - } - } - else - { - # support for default domain (localhost) - $domain = $env:computerName - $userName = $Credential.UserName - } - - if ($wrongFormat) - { - $message = $script:localizedData.ErrorInvalidUserName -f $Credential.UserName - - New-InvalidArgumentException -ArgumentName 'Credential' -Message $message - } - - return @{ - Domain = $domain - UserName = $userName - } -} - -<# - .SYNOPSIS - Asserts that the PsDscContext is not run as user. - Throws an invalid argument exception if DSC is running as a specific user - (the PsDscRunAsCredential parameter was provided to DSC). - - .NOTES - Strict mode is turned off for this function since it does not recognize $PsDscContext -#> -function Assert-PsDscContextNotRunAsUser -{ - [CmdletBinding()] - param - () - - Set-StrictMode -Off - - if ($null -ne $PsDscContext.RunAsUser) - { - $newInvalidArgumentExceptionParams = @{ - ArgumentName = 'PsDscRunAsCredential' - Message = ($script:localizedData.ErrorRunAsCredentialParameterNotSupported -f $PsDscContext.RunAsUser) - } - New-InvalidArgumentException @newInvalidArgumentExceptionParams - } -} - -<# - .SYNOPSIS - Imports the DSC native methods so that a process can be started with a credential - for a user from the local system. - Currently Start-Process, which is the command used otherwise, cannot do this. -#> -function Import-DscNativeMethods -{ -$dscNativeMethodsSource = @" - -using System; -using System.Collections.Generic; -using System.Text; -using System.Security; -using System.Runtime.InteropServices; -using System.Diagnostics; -using System.Security.Principal; -#if !CORECLR -using System.ComponentModel; -#endif -using System.IO; - -namespace PSDesiredStateConfiguration -{ -#if !CORECLR - [SuppressUnmanagedCodeSecurity] -#endif - public static class NativeMethods - { - //The following structs and enums are used by the various Win32 API's that are used in the code below - - [StructLayout(LayoutKind.Sequential)] - public struct STARTUPINFO - { - public Int32 cb; - public string lpReserved; - public string lpDesktop; - public string lpTitle; - public Int32 dwX; - public Int32 dwY; - public Int32 dwXSize; - public Int32 dwXCountChars; - public Int32 dwYCountChars; - public Int32 dwFillAttribute; - public Int32 dwFlags; - public Int16 wShowWindow; - public Int16 cbReserved2; - public IntPtr lpReserved2; - public IntPtr hStdInput; - public IntPtr hStdOutput; - public IntPtr hStdError; - } - - [StructLayout(LayoutKind.Sequential)] - public struct PROCESS_INFORMATION - { - public IntPtr hProcess; - public IntPtr hThread; - public Int32 dwProcessID; - public Int32 dwThreadID; - } - - [Flags] - public enum LogonType - { - LOGON32_LOGON_INTERACTIVE = 2, - LOGON32_LOGON_NETWORK = 3, - LOGON32_LOGON_BATCH = 4, - LOGON32_LOGON_SERVICE = 5, - LOGON32_LOGON_UNLOCK = 7, - LOGON32_LOGON_NETWORK_CLEARTEXT = 8, - LOGON32_LOGON_NEW_CREDENTIALS = 9 - } - - [Flags] - public enum LogonProvider - { - LOGON32_PROVIDER_DEFAULT = 0, - LOGON32_PROVIDER_WINNT35, - LOGON32_PROVIDER_WINNT40, - LOGON32_PROVIDER_WINNT50 - } - [StructLayout(LayoutKind.Sequential)] - public struct SECURITY_ATTRIBUTES - { - public Int32 Length; - public IntPtr lpSecurityDescriptor; - public bool bInheritHandle; - } - - public enum SECURITY_IMPERSONATION_LEVEL - { - SecurityAnonymous, - SecurityIdentification, - SecurityImpersonation, - SecurityDelegation - } - - public enum TOKEN_TYPE - { - TokenPrimary = 1, - TokenImpersonation - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - internal struct TokPriv1Luid - { - public int Count; - public long Luid; - public int Attr; - } - - public const int GENERIC_ALL_ACCESS = 0x10000000; - public const int CREATE_NO_WINDOW = 0x08000000; - internal const int SE_PRIVILEGE_ENABLED = 0x00000002; - internal const int TOKEN_QUERY = 0x00000008; - internal const int TOKEN_ADJUST_PRIVILEGES = 0x00000020; - internal const string SE_INCRASE_QUOTA = "SeIncreaseQuotaPrivilege"; - -#if CORECLR - [DllImport("api-ms-win-core-handle-l1-1-0.dll", -#else - [DllImport("kernel32.dll", -#endif - EntryPoint = "CloseHandle", SetLastError = true, - CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] - public static extern bool CloseHandle(IntPtr handle); - -#if CORECLR - [DllImport("api-ms-win-core-processthreads-l1-1-2.dll", -#else - [DllImport("advapi32.dll", -#endif - EntryPoint = "CreateProcessAsUser", SetLastError = true, - CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] - public static extern bool CreateProcessAsUser( - IntPtr hToken, - string lpApplicationName, - string lpCommandLine, - ref SECURITY_ATTRIBUTES lpProcessAttributes, - ref SECURITY_ATTRIBUTES lpThreadAttributes, - bool bInheritHandle, - Int32 dwCreationFlags, - IntPtr lpEnvrionment, - string lpCurrentDirectory, - ref STARTUPINFO lpStartupInfo, - ref PROCESS_INFORMATION lpProcessInformation - ); - -#if CORECLR - [DllImport("api-ms-win-security-base-l1-1-0.dll", EntryPoint = "DuplicateTokenEx")] -#else - [DllImport("advapi32.dll", EntryPoint = "DuplicateTokenEx")] -#endif - public static extern bool DuplicateTokenEx( - IntPtr hExistingToken, - Int32 dwDesiredAccess, - ref SECURITY_ATTRIBUTES lpThreadAttributes, - Int32 ImpersonationLevel, - Int32 dwTokenType, - ref IntPtr phNewToken - ); - -#if CORECLR - [DllImport("api-ms-win-security-logon-l1-1-1.dll", CharSet = CharSet.Unicode, SetLastError = true)] -#else - [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] -#endif - public static extern Boolean LogonUser( - String lpszUserName, - String lpszDomain, - IntPtr lpszPassword, - LogonType dwLogonType, - LogonProvider dwLogonProvider, - out IntPtr phToken - ); - -#if CORECLR - [DllImport("api-ms-win-security-base-l1-1-0.dll", ExactSpelling = true, SetLastError = true)] -#else - [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)] -#endif - internal static extern bool AdjustTokenPrivileges( - IntPtr htok, - bool disall, - ref TokPriv1Luid newst, - int len, - IntPtr prev, - IntPtr relen - ); - -#if CORECLR - [DllImport("api-ms-win-downlevel-kernel32-l1-1-0.dll", ExactSpelling = true)] -#else - [DllImport("kernel32.dll", ExactSpelling = true)] -#endif - internal static extern IntPtr GetCurrentProcess(); - -#if CORECLR - [DllImport("api-ms-win-downlevel-advapi32-l1-1-1.dll", ExactSpelling = true, SetLastError = true)] -#else - [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)] -#endif - internal static extern bool OpenProcessToken( - IntPtr h, - int acc, - ref IntPtr phtok - ); - -#if CORECLR - [DllImport("api-ms-win-downlevel-kernel32-l1-1-0.dll", ExactSpelling = true)] -#else - [DllImport("kernel32.dll", ExactSpelling = true)] -#endif - internal static extern int WaitForSingleObject( - IntPtr h, - int milliseconds - ); - -#if CORECLR - [DllImport("api-ms-win-downlevel-kernel32-l1-1-0.dll", ExactSpelling = true)] -#else - [DllImport("kernel32.dll", ExactSpelling = true)] -#endif - internal static extern bool GetExitCodeProcess( - IntPtr h, - out int exitcode - ); - -#if CORECLR - [DllImport("api-ms-win-downlevel-advapi32-l4-1-0.dll", SetLastError = true)] -#else - [DllImport("advapi32.dll", SetLastError = true)] -#endif - internal static extern bool LookupPrivilegeValue( - string host, - string name, - ref long pluid - ); - - internal static void ThrowException( - string message - ) - { -#if CORECLR - throw new Exception(message); -#else - throw new Win32Exception(message); -#endif - } - - public static void CreateProcessAsUser(string strCommand, string strDomain, string strName, SecureString secureStringPassword, bool waitForExit, ref int ExitCode) - { - var hToken = IntPtr.Zero; - var hDupedToken = IntPtr.Zero; - TokPriv1Luid tp; - var pi = new PROCESS_INFORMATION(); - var sa = new SECURITY_ATTRIBUTES(); - sa.Length = Marshal.SizeOf(sa); - Boolean bResult = false; - try - { - IntPtr unmanagedPassword = IntPtr.Zero; - try - { -#if CORECLR - unmanagedPassword = SecureStringMarshal.SecureStringToCoTaskMemUnicode(secureStringPassword); -#else - unmanagedPassword = Marshal.SecureStringToGlobalAllocUnicode(secureStringPassword); -#endif - bResult = LogonUser( - strName, - strDomain, - unmanagedPassword, - LogonType.LOGON32_LOGON_NETWORK_CLEARTEXT, - LogonProvider.LOGON32_PROVIDER_DEFAULT, - out hToken - ); - } - finally - { - Marshal.ZeroFreeGlobalAllocUnicode(unmanagedPassword); - } - if (!bResult) - { - ThrowException("$($script:localizedData.UserCouldNotBeLoggedError)" + Marshal.GetLastWin32Error().ToString()); - } - IntPtr hproc = GetCurrentProcess(); - IntPtr htok = IntPtr.Zero; - bResult = OpenProcessToken( - hproc, - TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, - ref htok - ); - if (!bResult) - { - ThrowException("$($script:localizedData.OpenProcessTokenError)" + Marshal.GetLastWin32Error().ToString()); - } - tp.Count = 1; - tp.Luid = 0; - tp.Attr = SE_PRIVILEGE_ENABLED; - bResult = LookupPrivilegeValue( - null, - SE_INCRASE_QUOTA, - ref tp.Luid - ); - if (!bResult) - { - ThrowException("$($script:localizedData.PrivilegeLookingUpError)" + Marshal.GetLastWin32Error().ToString()); - } - bResult = AdjustTokenPrivileges( - htok, - false, - ref tp, - 0, - IntPtr.Zero, - IntPtr.Zero - ); - if (!bResult) - { - ThrowException("$($script:localizedData.TokenElevationError)" + Marshal.GetLastWin32Error().ToString()); - } - - bResult = DuplicateTokenEx( - hToken, - GENERIC_ALL_ACCESS, - ref sa, - (int)SECURITY_IMPERSONATION_LEVEL.SecurityIdentification, - (int)TOKEN_TYPE.TokenPrimary, - ref hDupedToken - ); - if (!bResult) - { - ThrowException("$($script:localizedData.DuplicateTokenError)" + Marshal.GetLastWin32Error().ToString()); - } - var si = new STARTUPINFO(); - si.cb = Marshal.SizeOf(si); - si.lpDesktop = ""; - bResult = CreateProcessAsUser( - hDupedToken, - null, - strCommand, - ref sa, - ref sa, - false, - 0, - IntPtr.Zero, - null, - ref si, - ref pi - ); - if (!bResult) - { - ThrowException("$($script:localizedData.CouldNotCreateProcessError)" + Marshal.GetLastWin32Error().ToString()); - } - if (waitForExit) { - int status = WaitForSingleObject(pi.hProcess, -1); - if(status == -1) - { - ThrowException("$($script:localizedData.WaitFailedError)" + Marshal.GetLastWin32Error().ToString()); - } - - bResult = GetExitCodeProcess(pi.hProcess, out ExitCode); - if(!bResult) - { - ThrowException("$($script:localizedData.RetriveStatusError)" + Marshal.GetLastWin32Error().ToString()); - } - } - } - finally - { - if (pi.hThread != IntPtr.Zero) - { - CloseHandle(pi.hThread); - } - if (pi.hProcess != IntPtr.Zero) - { - CloseHandle(pi.hProcess); - } - if (hDupedToken != IntPtr.Zero) - { - CloseHandle(hDupedToken); - } - } - } - } -} - -"@ - # if not on Nano: - Add-Type -TypeDefinition $dscNativeMethodsSource -ReferencedAssemblies 'System.ServiceProcess' -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsProcess/MSFT_xWindowsProcess.schema.mof b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsProcess/MSFT_xWindowsProcess.schema.mof deleted file mode 100644 index f9f0e1d5..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsProcess/MSFT_xWindowsProcess.schema.mof +++ /dev/null @@ -1,18 +0,0 @@ -[ClassVersion("1.0.0"), FriendlyName("xWindowsProcess")] -class MSFT_xWindowsProcess : OMI_BaseResource -{ - [Key, Description("The full path or file name to the process executable to start or stop.")] String Path; - [Key, Description("A string of arguments to pass to the process executable. Pass in an empty string if no arguments are needed.")] String Arguments; - [Write, EmbeddedInstance("MSFT_Credential"), Description("The credential to run the process under.")] String Credential; - [Write, ValueMap{"Present", "Absent"}, Values{"Present", "Absent"}, Description("Indicates whether the process is present (running) or absent (not running).")] String Ensure; - [Write, Description("The path to write the standard output stream to.")] String StandardOutputPath; - [Write, Description("The path to write the standard error stream to.")] String StandardErrorPath; - [Write, Description("The path to receive standard input from.")] String StandardInputPath; - [Write, Description("The directory to run the processes under.")] String WorkingDirectory; - [Read, Description("The amount of paged memory, in bytes, allocated for the process.")] UInt64 PagedMemorySize; - [Read, Description("The amount of nonpaged memory, in bytes, allocated for the process.")] UInt64 NonPagedMemorySize; - [Read, Description("The amount of virtual memory, in bytes, allocated for the process.")] UInt64 VirtualMemorySize; - [Read, Description("The number of handles opened by the process.")] SInt32 HandleCount; - [Read, Description("The unique identifier of the process.")] SInt32 ProcessId; - [Read, Description("The number of instances of the given process that are currently running.")] SInt32 ProcessCount; -}; diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsProcess/en-US/MSFT_xWindowsProcess.schema.mfl b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsProcess/en-US/MSFT_xWindowsProcess.schema.mfl deleted file mode 100644 index 461fd731eb5d66ec4e5b22b6cbb9918dbe4129b3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3574 zcmd6qQBM<55QXR2#Q(7I2@^w%8WZ)Y0!AWGV^JQ^kV;$F*luy#3YGBJ)$`ryrCZuk zwqP`*%l6)xxo2k1%$@%JwQuXzw4NPWZmFGEU(c>(wqg%#*N(N9*qQBVHM53xP9^(Z zvR!GQ*VBF;-nur>8>@-zAn`+5jj)$kU8^0vAIfH3wo++!wAPm#JFM01sGuF~bIPjF zJe1r^eJa5YXqx&w()VrKupRl~|97>P*p^joO?z9~!%7S#9E46J4A_i5z!b!q{gw2(Mz;;rq7`)_NDQ4r0sFLzg35yI|ySm_qtRnTk75{z9D7QCRFz(hKPR|z~X%8@}d zuF9|4XKB*UigwRKTw20O7542ynn{qXOxTU9^Lo>CrEKW5o~&}-&7!t@S=F%*cy>=^ zBNaBUf3JMF3!@u)=6Vths{SNABe$E{jh(j)SE>1;^=iTPtPZf4z2n|i#wQrd?E+uC zTJOrEjZ4dS;}2P;52v~b$5~NL1CsP)ohAMi*^MCUz?H zT0v)Chq}IwK59+?&vVTmep@=4?E;pXko?s5+j~o|g9ZPS&pQDVocx=fGjB4>40I0n z;J?rHrwK&2&vz!@I$|q5knYa3UZ2-(mK0tgVe$`_!Ju!du0Zn}t)> zbh1}iIkuvc+IQ*F4gI%)&n--~MW1HR0oPaAB;Lv2D4RlF4(qH)(<@>R_xU>JAmTle sAM|>9ivI>0&*8{$hx>d>1enRW%Y2?`hfGaQD9d|%HAfdC|M^w&2SZe9TmS$7 diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsProcess/en-US/MSFT_xWindowsProcess.strings.psd1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsProcess/en-US/MSFT_xWindowsProcess.strings.psd1 deleted file mode 100644 index 66d9234c..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/MSFT_xWindowsProcess/en-US/MSFT_xWindowsProcess.strings.psd1 +++ /dev/null @@ -1,36 +0,0 @@ -# Localized resources for MSFT_xWindowsProcess - -ConvertFrom-StringData @' - CouldNotCreateProcessError = Could not create process. Error code: - DuplicateTokenError = Duplicate token. Error code: - FileNotFound = File '{0}' not found in the environment path. - ErrorInvalidUserName = Invalid username: {0}. Username cannot contain multiple '@' or multiple '\' - ErrorParametersNotSupportedWithCredential = Can't specify StandardOutputPath, StandardInputPath or WorkingDirectory when trying to run a process under a local user. - ErrorRunAsCredentialParameterNotSupported = The PsDscRunAsCredential parameter is not supported by the Process resource. To start the process with user '{0}', add the Credential parameter. - ErrorStarting = Failure starting process matching path '{0}'. Message: {1}. - ErrorStopping = Failure stopping processes matching path '{0}' with IDs '({1})'. Message: {2}. - FailureWaitingForProcessesToStart = Failed to wait for processes to start. - FailureWaitingForProcessesToStop = Failed to wait for processes to stop. - GetTargetResourceStartMessage = Begin executing Get functionality for the process {0}. - GetTargetResourceEndMessage = End executing Get functionality for the process {0}. - OpenProcessTokenError = Error while opening process token. Error code: - ParameterShouldNotBeSpecified = Parameter {0} should not be specified. - PathShouldBeAbsolute = The path '{0}' should be absolute for argument '{1}'. - PathShouldExist = The path '{0}' should exist for argument '{1}'. - PrivilegeLookingUpError = Error while looking up privilege. Error code: - ProcessAlreadyStarted = Process matching path '{0}' found running. No action required. - ProcessAlreadyStopped = Process matching path '{0}' not found running. No action required. - ProcessesStarted = Processes matching path '{0}' started. - ProcessesStopped = Processes matching path '{0}' with IDs '({1})' stopped. - RetriveStatusError = Failed to retrieve status. Error code: - SetTargetResourceStartMessage = Begin executing Set functionality for the process {0}. - SetTargetResourceEndMessage = End executing Set functionality for the process {0}. - StartingProcessWhatif = Start-Process. - StoppingProcessWhatIf = Stop-Process. - TestTargetResourceStartMessage = Begin executing Test functionality for the process {0}. - TestTargetResourceEndMessage = End executing Test functionality for the process {0}. - TokenElevationError = Error while getting token elevation. Error code: - UserCouldNotBeLoggedError = User could not be logged. Error code: - WaitFailedError = Failed while waiting for process. Error code: - VerboseInProcessHandle = In process handle {0}. -'@ diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xFileUpload/xFileUpload.psd1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xFileUpload/xFileUpload.psd1 deleted file mode 100644 index 76adcf9b..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xFileUpload/xFileUpload.psd1 +++ /dev/null @@ -1,89 +0,0 @@ -@{ - -# Script module or binary module file associated with this manifest. -RootModule = 'xFileUpload.schema.psm1' - -# Version number of this module. -ModuleVersion = '1.0' - -# ID used to uniquely identify this module -GUID = '1fbfd112-4272-4fb8-b31c-fb5b417484bc' - -# Author of this module -Author = 'kkaczma' - -# Company or vendor of this module -CompanyName = 'Unknown' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft. All rights reserved.' - -# Description of the functionality provided by this module -# Description = '' - -# Minimum version of the Windows PowerShell engine required by this module -# PowerShellVersion = '' - -# Name of the Windows PowerShell host required by this module -# PowerShellHostName = '' - -# Minimum version of the Windows PowerShell host required by this module -# PowerShellHostVersion = '' - -# Minimum version of Microsoft .NET Framework required by this module -# DotNetFrameworkVersion = '' - -# Minimum version of the common language runtime (CLR) required by this module -# CLRVersion = '' - -# Processor architecture (None, X86, Amd64) required by this module -# ProcessorArchitecture = '' - -# Modules that must be imported into the global environment prior to importing this module -# RequiredModules = @() - -# Assemblies that must be loaded prior to importing this module -# RequiredAssemblies = @() - -# Script files (.ps1) that are run in the caller's environment prior to importing this module. -# ScriptsToProcess = @() - -# Type files (.ps1xml) to be loaded when importing this module -# TypesToProcess = @() - -# Format files (.ps1xml) to be loaded when importing this module -# FormatsToProcess = @() - -# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess -# NestedModules = @() - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Variables to export from this module -VariablesToExport = '*' - -# Aliases to export from this module -AliasesToExport = '*' - -# List of all modules packaged with this module -# ModuleList = @() - -# List of all files packaged with this module -# FileList = @() - -# Private data to pass to the module specified in RootModule/ModuleToProcess -# PrivateData = '' - -# HelpInfo URI of this module -# HelpInfoURI = '' - -# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. -# DefaultCommandPrefix = '' - -} - - diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xFileUpload/xFileUpload.schema.psm1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xFileUpload/xFileUpload.schema.psm1 deleted file mode 100644 index 17c23d33..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xFileUpload/xFileUpload.schema.psm1 +++ /dev/null @@ -1,544 +0,0 @@ -Configuration xFileUpload -{ - <# - .SYNOPSIS - Configuration uploads file or folder to the smb share - .DESCRIPTION - .EXAMPLE - xFileUpload -destinationPath "\\machine\share" -sourcePath "C:\folder\file" -username "domain\user" -password "password" - .PARAMETER destinationPath - Upload destination (has to point to a share or it's existing subfolder) e.g. \\machinename\sharename\destinationfolder - .PARAMETER sourcePath - Upload source e.g. C:\folder\file.txt - .PARAMETER credential - Credentials to access share where file/folder should be uploaded - .PARAMETER certificateThumbprint - Thumbprint of the certificate which should be used for encryption/decryption - .NOTES - #> - - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")] - - param ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $destinationPath, - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $sourcePath, - [PSCredential] - $credential, - [String] - $certificateThumbprint - ) - - $cacheLocation = "$env:ProgramData\Microsoft\Windows\PowerShell\Configuration\BuiltinProvCache\MSFT_xFileUpload" - - if ($credential) - { - $username = $credential.UserName - - # Encrypt password - $password = Invoke-Command -ScriptBlock ([ScriptBlock]::Create($getEncryptedPassword)) -ArgumentList $credential, $certificateThumbprint - - } - - Script FileUpload - { - # Get script is not implemented cause reusing Script resource's schema does not make sense - GetScript = { - $returnValue = @{ - - } - - $returnValue - }; - - SetScript = { - - # Generating credential object if password and username are specified - $credential = $null - if (($using:password) -and ($using:username)) - { - # Validate that certificate thumbprint is specified - if(-not $using:certificateThumbprint) - { - $errorMessage = "Certificate thumbprint has to be specified if credentials are present." - Invoke-Command -ScriptBlock ([ScriptBlock]::Create($using:throwTerminatingError)) -ArgumentList "CertificateThumbprintIsRequired", $errorMessage, "InvalidData" - } - - Write-Debug "Username and password specified." - - # Decrypt password - $decryptedPassword = Invoke-Command -ScriptBlock ([ScriptBlock]::Create($using:getDecryptedPassword)) -ArgumentList $using:password, $using:certificateThumbprint - - # Generate credential - $securePassword = ConvertTo-SecureString $decryptedPassword -AsPlainText -Force - $credential = New-Object System.Management.Automation.PSCredential ($using:username, $securePassword) - } - - # Validate DestinationPath is UNC path - if (!($using:destinationPath -as [System.Uri]).isUnc) - { - $errorMessage = "Destination path $using:destinationPath is not a valid UNC path." - Invoke-Command -ScriptBlock ([ScriptBlock]::Create($using:throwTerminatingError)) -ArgumentList "DestinationPathIsNotUNCFailure", $errorMessage, "InvalidData" - } - - # Verify source is localpath - if (!(($using:sourcePath -as [System.Uri]).Scheme -match "file")) - { - $errorMessage = "Source path $using:sourcePath has to be local path." - Invoke-Command -ScriptBlock ([ScriptBlock]::Create($using:throwTerminatingError)) -ArgumentList "SourcePathIsNotLocalFailure", $errorMessage, "InvalidData" - } - - # Check whether source path is existing file or directory - $sourcePathType = $null - if (!(Test-Path $using:sourcePath)) - { - $errorMessage = "Source path $using:sourcePath does not exist." - Invoke-Command -ScriptBlock ([ScriptBlock]::Create($using:throwTerminatingError)) -ArgumentList "SourcePathDoesNotExistFailure", $errorMessage, "InvalidData" - } - else - { - $item = Get-Item $using:sourcePath - switch ($item.GetType().Name) - { - "FileInfo" { - $sourcePathType = "File" - } - - "DirectoryInfo" { - $sourcePathType = "Directory" - } - } - } - Write-Debug "SourcePath $using:sourcePath is of type: $sourcePathType" - - $psDrive = $null - - # Mount the drive only if credentials are specified and it's currently not accessible - if ($credential) - { - if (Test-Path $using:destinationPath -ErrorAction Ignore) - { - Write-Debug "Destination path $using:destinationPath is already accessible. No mount needed." - } - else - { - $psDriveArgs = @{ Name = ([guid]::NewGuid()); PSProvider = "FileSystem"; Root = $using:destinationPath; Scope = "Private"; Credential = $credential } - try - { - Write-Debug "Create psdrive with destination path $using:destinationPath..." - $psDrive = New-PSDrive @psDriveArgs -ErrorAction Stop - } - catch - { - $errorMessage = "Cannot access destination path $using:destinationPath with given Credential" - Invoke-Command -ScriptBlock ([ScriptBlock]::Create($using:throwTerminatingError)) -ArgumentList "DestinationPathNotAccessibleFailure", $errorMessage, "InvalidData" - } - } - } - - try - { - # Get expected destination path - $expectedDestinationPath = $null - if (!(Test-Path $using:destinationPath)) - { - # DestinationPath has to exist - $errorMessage = "Invalid parameter values: DestinationPath doesn't exist, but has to be existing directory." - Throw-TerminatingError -errorMessage $errorMessage -errorCategory "InvalidData" -errorId "DestinationPathDoesNotExistFailure" - } - else - { - $item = Get-Item $using:destinationPath - switch ($item.GetType().Name) - { - "FileInfo" { - # DestinationPath cannot be file - $errorMessage = "Invalid parameter values: DestinationPath is file, but has to be existing directory." - Invoke-Command -ScriptBlock ([ScriptBlock]::Create($using:throwTerminatingError)) -ArgumentList "DestinationPathCannotBeFileFailure", $errorMessage, "InvalidData" - } - - "DirectoryInfo" { - $expectedDestinationPath = Join-Path $using:destinationPath (Split-Path $using:sourcePath -Leaf) - } - } - Write-Debug "ExpectedDestinationPath is $expectedDestinationPath" - } - - # Copy destination path - try - { - Write-Debug "Copying $using:sourcePath to $using:destinationPath" - Copy-Item -path $using:sourcePath -Destination $using:destinationPath -Recurse -Force -ErrorAction Stop - } - catch - { - $errorMessage = "Couldn't copy source path $using:sourcePath to $using:destinationPath : $($_.Exception)" - Invoke-Command -ScriptBlock ([ScriptBlock]::Create($using:throwTerminatingError)) -ArgumentList "CopyDirectoryOverFileFailure", $errorMessage, "InvalidData" - } - - # Verify whether expectedDestinationPath was created - if (!(Test-Path $expectedDestinationPath)) - { - $errorMessage = "Destination path $using:destinationPath could not be created" - Invoke-Command -ScriptBlock ([ScriptBlock]::Create($using:throwTerminatingError)) -ArgumentList "DestinationPathNotCreatedFailure", $errorMessage, "InvalidData" - } - # If expectedDestinationPath exists - else - { - Write-Verbose "$sourcePathType $expectedDestinationPath has been successfully created" - - # Update cache - $uploadedItem = Get-Item $expectedDestinationPath - $lastWriteTime = $uploadedItem.LastWriteTimeUtc - $inputObject = @{} - $inputObject["LastWriteTimeUtc"] = $lastWriteTime - $key = [string]::Join("", @($using:destinationPath, $using:sourcePath, $expectedDestinationPath)).GetHashCode().ToString() - $path = Join-Path $using:cacheLocation $key - if(-not (Test-Path $using:cacheLocation)) - { - mkdir $using:cacheLocation | Out-Null - } - - Write-Debug "Updating cache for DestinationPath = $using:destinationPath and SourcePath = $using:sourcePath. CacheKey = $key" - Export-CliXml -Path $path -InputObject $inputObject -Force - } - } - finally - { - # Remove PSDrive - if($psDrive) - { - Write-Debug "Removing PSDrive on root $($psDrive.Root)" - Remove-PSDrive $psDrive -Force - } - } - }; - - TestScript = { - - # Generating credential object if password and username are specified - $credential = $null - if (($using:password) -and ($using:username)) - { - # Validate that certificate thumbprint is specified - if(-not $using:certificateThumbprint) - { - $errorMessage = "Certificate thumbprint has to be specified if credentials are present." - Invoke-Command -ScriptBlock ([ScriptBlock]::Create($using:throwTerminatingError)) -ArgumentList "CertificateThumbprintIsRequired", $errorMessage, "InvalidData" - } - - Write-Debug "Username and password specified. Generating credential" - - # Decrypt password - $decryptedPassword = Invoke-Command -ScriptBlock ([ScriptBlock]::Create($using:getDecryptedPassword)) -ArgumentList $using:password, $using:certificateThumbprint - - # Generate credential - $securePassword = ConvertTo-SecureString $decryptedPassword -AsPlainText -Force - $credential = New-Object System.Management.Automation.PSCredential ($using:username, $securePassword) - } - else - { - Write-Debug "No credentials specified" - } - - # Validate DestinationPath is UNC path - if (!($using:destinationPath -as [System.Uri]).isUnc) - { - $errorMessage = "Destination path $using:destinationPath is not a valid UNC path." - Invoke-Command -ScriptBlock ([ScriptBlock]::Create($using:throwTerminatingError)) -ArgumentList "DestinationPathIsNotUNCFailure", $errorMessage, "InvalidData" - - } - - # Check whether source path is existing file or directory (needed for expectedDestinationPath) - $sourcePathType = $null - if (!(Test-Path $using:sourcePath)) - { - $errorMessage = "Source path $using:sourcePath does not exist." - Invoke-Command -ScriptBlock ([ScriptBlock]::Create($using:throwTerminatingError)) -ArgumentList "SourcePathDoesNotExistFailure", $errorMessage, "InvalidData" - } - else - { - $item = Get-Item $using:sourcePath - switch ($item.GetType().Name) - { - "FileInfo" { - $sourcePathType = "File" - } - - "DirectoryInfo" { - $sourcePathType = "Directory" - } - } - } - Write-Debug "SourcePath $using:sourcePath is of type: $sourcePathType" - - $psDrive = $null - - # Mount the drive only if credentials are specified and it's currently not accessible - if ($credential) - { - if (Test-Path $using:destinationPath -ErrorAction Ignore) - { - Write-Debug "Destination path $using:destinationPath is already accessible. No mount needed." - } - else - { - $psDriveArgs = @{ Name = ([guid]::NewGuid()); PSProvider = "FileSystem"; Root = $using:destinationPath; Scope = "Private"; Credential = $credential } - try - { - Write-Debug "Create psdrive with destination path $using:destinationPath..." - $psDrive = New-PSDrive @psDriveArgs -ErrorAction Stop - } - catch - { - $errorMessage = "Cannot access destination path $using:destinationPath with given Credential" - Invoke-Command -ScriptBlock ([ScriptBlock]::Create($using:throwTerminatingError)) -ArgumentList "DestinationPathNotAccessibleFailure", $errorMessage, "InvalidData" - } - } - } - - try - { - # Get expected destination path - $expectedDestinationPath = $null - if (!(Test-Path $using:destinationPath)) - { - # DestinationPath has to exist - $errorMessage = "Invalid parameter values: DestinationPath doesn't exist or is not accessible. DestinationPath has to be existing directory." - Invoke-Command -ScriptBlock ([ScriptBlock]::Create($using:throwTerminatingError)) -ArgumentList "DestinationPathDoesNotExistFailure", $errorMessage, "InvalidData" - } - else - { - $item = Get-Item $using:destinationPath - switch ($item.GetType().Name) - { - "FileInfo" { - # DestinationPath cannot be file - $errorMessage = "Invalid parameter values: DestinationPath is file, but has to be existing directory." - Invoke-Command -ScriptBlock ([ScriptBlock]::Create($using:throwTerminatingError)) -ArgumentList "DestinationPathCannotBeFileFailure", $errorMessage, "InvalidData" - } - - "DirectoryInfo" { - $expectedDestinationPath = Join-Path $using:destinationPath (Split-Path $using:sourcePath -Leaf) - } - } - Write-Debug "ExpectedDestinationPath is $expectedDestinationPath" - } - - # Check whether ExpectedDestinationPath exists and has expected type - $itemExists = $false - if (!(Test-Path $expectedDestinationPath)) - { - Write-Debug "Expected destination path doesn't exist or is not accessible" - } - # If expectedDestinationPath exists - else - { - $expectedItem = Get-Item $expectedDestinationPath - $expectedItemType = $expectedItem.GetType().Name - - # If expectedDestinationPath has same type as sourcePathType, we need to verify cache to determine whether no upload is needed - if ((($expectedItemType -eq "FileInfo") -and ($sourcePathType -eq "File")) -or (($expectedItemType -eq "DirectoryInfo") -and ($sourcePathType -eq "Directory"))) - { - # Get cache - Write-Debug "Getting cache for $expectedDestinationPath" - $cacheContent = $null - $key = [string]::Join("", @($using:destinationPath, $using:sourcePath, $expectedDestinationPath)).GetHashCode().ToString() - $path = Join-Path $using:cacheLocation $key - Write-Debug "Looking for cache under $path" - if (!(Test-Path $path)) - { - Write-Debug "No cache found for DestinationPath = $using:destinationPath and SourcePath = $using:sourcePath. CacheKey = $key" - } - else - { - $cacheContent = Import-CliXml $path - Write-Debug "Found cache for DestinationPath = $using:destinationPath and SourcePath = $using:sourcePath. CacheKey = $key" - } - - # Verify whether cache reflects current state or upload is needed - if ($cacheContent -ne $null -and ($cacheContent.LastWriteTimeUtc -eq $expectedItem.LastWriteTimeUtc)) - { - # No upload needed - Write-Debug "Cache reflects current state. No need for upload." - $itemExists = $true - } - else - { - Write-Debug "Cache is empty or it doesn't reflect current state. Upload will be performed." - } - } - else - { - Write-Debug "Expected destination path: $expectedDestinationPath is of type $expectedItemType, although source path is $sourcePathType" - } - } - } - finally - { - # Remove PSDrive - if($psDrive) - { - Write-Debug "Removing PSDrive on root $($psDrive.Root)" - Remove-PSDrive $psDrive -Force - } - } - - return $itemExists - - }; - } -} - -# Encrypts password using the defined public key -$getEncryptedPassword = @' - param ( - [Parameter(Mandatory = $true)] - [PSCredential] $credential, - [Parameter(Mandatory = $true)] - [String] $certificateThumbprint - ) - - $value = $credential.GetNetworkCredential().Password - - $cert = Invoke-Command -ScriptBlock ([ScriptBlock]::Create($getCertificate)) -ArgumentList $certificateThumbprint - - $encryptedPassword = $null - - if($cert) - { - # Cast the public key correctly - $rsaProvider = [System.Security.Cryptography.RSACryptoServiceProvider]$cert.PublicKey.Key - - if($rsaProvider -eq $null) - { - $errorMessage = "Could not get public key from certificate with thumbprint: $certificateThumbprint . Please verify certificate is valid for encryption." - Invoke-Command -ScriptBlock ([ScriptBlock]::Create($throwTerminatingError)) -ArgumentList "DecryptionCertificateNotFound", $errorMessage, "InvalidOperation" - } - - # Convert to a byte array - $keybytes = [System.Text.Encoding]::UNICODE.GetBytes($value) - - # Add a null terminator to the byte array - $keybytes += 0 - $keybytes += 0 - - # Encrypt using the public key - $encbytes = $rsaProvider.Encrypt($keybytes, $false) - - # Return a string - $encryptedPassword = [Convert]::ToBase64String($encbytes) - } - else - { - $errorMessage = "Could not find certificate which matches thumbprint: $certificateThumbprint . Could not encrypt password" - Invoke-Command -ScriptBlock ([ScriptBlock]::Create($throwTerminatingError)) -ArgumentList "EncryptionCertificateNot", $errorMessage, "InvalidOperation" - } - - return $encryptedPassword -'@ - -# Retrieves certificate by thumbprint -$getCertificate = @' - param( - [Parameter(Mandatory = $true)] - [string] $certificateThumbprint - ) - - $cert = $null - - foreach($certIndex in Get-Childitem cert:\LocalMachine\My) - { - if($certIndex.Thumbprint -match $certificateThumbprint) - { - $cert = $certIndex - break - } - } - - if(-not $cert) - { - $errorMessage = "Error Reading certificate store for {0}. Please verify thumbprint is correct and certificate belongs to cert:\LocalMachine\My store." -f ${certificateThumbprint}; - Invoke-Command -ScriptBlock ([ScriptBlock]::Create($throwTerminatingError)) -ArgumentList "InvalidPathSpecified", $errorMessage, "InvalidOperation" - } - else - { - $cert - } -'@ - -# Throws terminating error specified errorCategory, errorId and errorMessage -$throwTerminatingError = @' - param( - [parameter(Mandatory = $true)] - [System.String] - $errorId, - [parameter(Mandatory = $true)] - [System.String] - $errorMessage, - [parameter(Mandatory = $true)] - $errorCategory - ) - - $exception = New-Object System.InvalidOperationException $errorMessage - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - throw $errorRecord -'@ - -# Decrypts password using the defined private key -$getDecryptedPassword = @' - param ( - [Parameter(Mandatory = $true)] - [String] $value, - [Parameter(Mandatory = $true)] - [String] $certificateThumbprint - ) - - $cert = $null - - foreach($certIndex in Get-Childitem cert:\LocalMachine\My) - { - if($certIndex.Thumbprint -match $certificateThumbprint) - { - $cert = $certIndex - break - } - } - - if(-not $cert) - { - $errorMessage = "Error Reading certificate store for {0}. Please verify thumbprint is correct and certificate belongs to cert:\LocalMachine\My store." -f ${certificateThumbprint}; - $exception = New-Object System.InvalidOperationException $errorMessage - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, "InvalidPathSpecified", "InvalidOperation", $null - throw $errorRecord - } - - $decryptedPassword = $null - - # Get RSA provider - $rsaProvider = [System.Security.Cryptography.RSACryptoServiceProvider]$cert.PrivateKey - - if($rsaProvider -eq $null) - { - $errorMessage = "Could not get private key from certificate with thumbprint: $certificateThumbprint . Please verify certificate is valid for decryption." - $exception = New-Object System.InvalidOperationException $errorMessage - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, "DecryptionCertificateNotFound", "InvalidOperation", $null - throw $errorRecord - } - - # Convert to bytes array - $encBytes = [Convert]::FromBase64String($value) - - # Decrypt bytes - $decryptedBytes = $rsaProvider.Decrypt($encBytes, $false) - - # Convert to string - $decryptedPassword = [System.Text.Encoding]::Unicode.GetString($decryptedBytes) - - return $decryptedPassword -'@ diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xGroupSet/xGroupSet.psd1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xGroupSet/xGroupSet.psd1 deleted file mode 100644 index f206dedf..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xGroupSet/xGroupSet.psd1 +++ /dev/null @@ -1,27 +0,0 @@ -@{ - -# Script module or binary module file associated with this manifest. -RootModule = 'xGroupSet.schema.psm1' - -# Version number of this module. -ModuleVersion = '0.1.0.0' - -# ID used to uniquely identify this module -GUID = 'c5e227b5-52dc-4653-b08f-6d94e06bb90b' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2016 Microsoft. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'Configures multiple xGroup resources with common settings but different names.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -} diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xGroupSet/xGroupSet.schema.psm1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xGroupSet/xGroupSet.schema.psm1 deleted file mode 100644 index a5d15433..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xGroupSet/xGroupSet.schema.psm1 +++ /dev/null @@ -1,68 +0,0 @@ -$errorActionPreference = 'Stop' -Set-StrictMode -Version 'Latest' - -# Import ResourceSetHelper for New-ResourceSetConfigurationScriptBlock -$script:dscResourcesFolderFilePath = Split-Path -Path $PSScriptRoot -Parent -$script:resourceSetHelperFilePath = Join-Path -Path $script:dscResourcesFolderFilePath -ChildPath 'ResourceSetHelper.psm1' -Import-Module -Name $script:resourceSetHelperFilePath - -<# - .SYNOPSIS - A composite DSC resource to configure a set of similar xGroup resources. - - .PARAMETER GroupName - An array of the names of the groups to configure. - - .PARAMETER Ensure - Specifies whether or not the set of groups should exist. - - Set this property to Present to create or modify a set of groups. - Set this property to Absent to remove a set of groups. - - .PARAMETER MembersToInclude - The members that should be included in each group in the set. - - .PARAMETER MembersToExclude - The members that should be excluded from each group in the set. - - .PARAMETER Credential - The credential to resolve all groups and user accounts. -#> -Configuration xGroupSet -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String[]] - $GroupName, - - [ValidateSet('Present', 'Absent')] - [String] - $Ensure, - - [String[]] - $MembersToInclude, - - [String[]] - $MembersToExclude, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential - ) - - $newResourceSetConfigurationParams = @{ - ResourceName = 'xGroup' - ModuleName = 'xPSDesiredStateConfiguration' - KeyParameterName = 'GroupName' - Parameters = $PSBoundParameters - } - - $configurationScriptBlock = New-ResourceSetConfigurationScriptBlock @newResourceSetConfigurationParams - - # This script block must be run directly in this configuration in order to resolve variables - . $configurationScriptBlock -} diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xProcessSet/xProcessSet.psd1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xProcessSet/xProcessSet.psd1 deleted file mode 100644 index 222858a1..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xProcessSet/xProcessSet.psd1 +++ /dev/null @@ -1,27 +0,0 @@ -@{ - -# Script module or binary module file associated with this manifest. -RootModule = 'xProcessSet.schema.psm1' - -# Version number of this module. -ModuleVersion = '0.1.0.0' - -# ID used to uniquely identify this module -GUID = '0cb71def-366f-4f3b-88a9-b9b37d266dd6' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2016 Microsoft. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'Provides a mechanism to configure and manage multiple xWindowsProcess resources on a target node.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -} diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xProcessSet/xProcessSet.schema.psm1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xProcessSet/xProcessSet.schema.psm1 deleted file mode 100644 index 803ceef9..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xProcessSet/xProcessSet.schema.psm1 +++ /dev/null @@ -1,96 +0,0 @@ -$errorActionPreference = 'Stop' -Set-StrictMode -Version 'Latest' - -# Import ResourceSetHelper for New-ResourceSetConfigurationScriptBlock -$script:dscResourcesFolderFilePath = Split-Path -Path $PSScriptRoot -Parent -$script:resourceSetHelperFilePath = Join-Path -Path $script:dscResourcesFolderFilePath -ChildPath 'ResourceSetHelper.psm1' -Import-Module -Name $script:resourceSetHelperFilePath - -<# - .SYNOPSIS - A composite DSC resource to configure a set of similar xWindowsProcess resources. - No arguments can be passed into these xWindowsProcess resources. - - .PARAMETER Path - The file paths to the executables of the processes to start or stop. Only the names of the - files may be specified if they are all accessible through the environment path. Relative - paths are not supported. - - .PARAMETER Ensure - Specifies whether or not the processes should exist. - - To start processes, set this property to Present. - To stop processes, set this property to Absent. - - .PARAMETER Credential - The credential of the user account to start the processes under. - - .PARAMETER StandardOutputPath - The file path to write the standard output to. Any existing file at this path - will be overwritten.This property cannot be specified at the same time as Credential - when running the processes as a local user. - - .PARAMETER StandardErrorPath - The file path to write the standard error output to. Any existing file at this path - will be overwritten. - - .PARAMETER StandardInputPath - The file path to get standard input from. This property cannot be specified at the - same time as Credential when running the processes as a local user. - - .PARAMETER WorkingDirectory - The file path to use as the working directory for the processes. Any existing file - at this path will be overwritten. This property cannot be specified at the same time - as Credential when running the processes as a local user. -#> -Configuration xProcessSet -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String[]] - $Path, - - [ValidateSet('Present', 'Absent')] - [String] - $Ensure, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [ValidateNotNullOrEmpty()] - [String] - $StandardOutputPath, - - [ValidateNotNullOrEmpty()] - [String] - $StandardErrorPath, - - [ValidateNotNullOrEmpty()] - [String] - $StandardInputPath, - - [ValidateNotNullOrEmpty()] - [String] - $WorkingDirectory - ) - - $newResourceSetConfigurationParams = @{ - ResourceName = 'xWindowsProcess' - ModuleName = 'xPSDesiredStateConfiguration' - KeyParameterName = 'Path' - Parameters = $PSBoundParameters - } - - # Arguments is a key parameter in xWindowsProcess resource. Adding it as a common parameter with an empty value string - $newResourceSetConfigurationParams['Parameters']['Arguments'] = '' - - $configurationScriptBlock = New-ResourceSetConfigurationScriptBlock @newResourceSetConfigurationParams - - # This script block must be run directly in this configuration in order to resolve variables - . $configurationScriptBlock -} diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xWindowsFeatureSet/xWindowsFeatureSet.psd1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xWindowsFeatureSet/xWindowsFeatureSet.psd1 deleted file mode 100644 index 6849d994..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xWindowsFeatureSet/xWindowsFeatureSet.psd1 +++ /dev/null @@ -1,27 +0,0 @@ -@{ - -# Script module or binary module file associated with this manifest. -RootModule = 'xWindowsFeatureSet.schema.psm1' - -# Version number of this module. -ModuleVersion = '0.1.0.0' - -# ID used to uniquely identify this module -GUID = 'b18a27e2-f710-4a4a-92b8-6cd076970eb2' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2016 Microsoft. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'Provides a mechanism to configure and manage multiple xWindowsFeature resources on a target node.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -} diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xWindowsFeatureSet/xWindowsFeatureSet.schema.psm1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xWindowsFeatureSet/xWindowsFeatureSet.schema.psm1 deleted file mode 100644 index 017b3a66..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xWindowsFeatureSet/xWindowsFeatureSet.schema.psm1 +++ /dev/null @@ -1,78 +0,0 @@ -$errorActionPreference = 'Stop' -Set-StrictMode -Version 'Latest' - -# Import ResourceSetHelper for New-ResourceSetConfigurationScriptBlock -$script:dscResourcesFolderFilePath = Split-Path -Path $PSScriptRoot -Parent -$script:resourceSetHelperFilePath = Join-Path -Path $script:dscResourcesFolderFilePath -ChildPath 'ResourceSetHelper.psm1' -Import-Module -Name $script:resourceSetHelperFilePath - -<# - .SYNOPSIS - A composite DSC resource to configure a set of similar xWindowsFeature resources. - - .PARAMETER Name - The name of the roles or features to install or uninstall. - - .PARAMETER Ensure - Specifies whether the roles or features should be installed or uninstalled. - - To install the features, set this property to Present. - To uninstall the features, set this property to Absent. - - .PARAMETER IncludeAllSubFeature - Specifies whether or not all subfeatures should be installed or uninstalled alongside the specified roles or features. - - If this property is true and Ensure is set to Present, all subfeatures will be installed. - If this property is false and Ensure is set to Present, subfeatures will not be installed or uninstalled. - If Ensure is set to Absent, all subfeatures will be uninstalled. - - .PARAMETER Credential - The credential of the user account under which to install or uninstall the roles or features. - - .PARAMETER LogPath - The custom file path to which to log this operation. - If not passed in, the default log path will be used (%windir%\logs\ServerManager.log). -#> -Configuration xWindowsFeatureSet -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String[]] - $Name, - - [ValidateSet('Present', 'Absent')] - [String] - $Ensure, - - [ValidateNotNullOrEmpty()] - [String] - $Source, - - [Boolean] - $IncludeAllSubFeature, - - [ValidateNotNull()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [ValidateNotNullOrEmpty()] - [String] - $LogPath - ) - - $newResourceSetConfigurationParams = @{ - ResourceName = 'xWindowsFeature' - ModuleName = 'xPSDesiredStateConfiguration' - KeyParameterName = 'Name' - Parameters = $PSBoundParameters - } - - $configurationScriptBlock = New-ResourceSetConfigurationScriptBlock @newResourceSetConfigurationParams - - # This script block must be run directly in this configuration in order to resolve variables - . $configurationScriptBlock -} diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xWindowsOptionalFeatureSet/xWindowsOptionalFeatureSet.psd1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xWindowsOptionalFeatureSet/xWindowsOptionalFeatureSet.psd1 deleted file mode 100644 index 4a4942fc..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xWindowsOptionalFeatureSet/xWindowsOptionalFeatureSet.psd1 +++ /dev/null @@ -1,27 +0,0 @@ -@{ - -# Script module or binary module file associated with this manifest. -RootModule = 'xWindowsOptionalFeatureSet.schema.psm1' - -# Version number of this module. -ModuleVersion = '0.1.0.0' - -# ID used to uniquely identify this module -GUID = 'a88c1458-db46-402c-947b-7d43ab57e27a' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2016 Microsoft. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'Provides a mechanism to configure and manage multiple xWindowsOptionalFeature resources on a target node.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -} diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xWindowsOptionalFeatureSet/xWindowsOptionalFeatureSet.schema.psm1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xWindowsOptionalFeatureSet/xWindowsOptionalFeatureSet.schema.psm1 deleted file mode 100644 index 6e1b65d6..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/DSCResources/xWindowsOptionalFeatureSet/xWindowsOptionalFeatureSet.schema.psm1 +++ /dev/null @@ -1,77 +0,0 @@ -$errorActionPreference = 'Stop' -Set-StrictMode -Version 'Latest' - -# Import ResourceSetHelper for New-ResourceSetConfigurationScriptBlock -$script:dscResourcesFolderFilePath = Split-Path -Path $PSScriptRoot -Parent -$script:resourceSetHelperFilePath = Join-Path -Path $script:dscResourcesFolderFilePath -ChildPath 'ResourceSetHelper.psm1' -Import-Module -Name $script:resourceSetHelperFilePath - -<# - .SYNOPSIS - A composite DSC resource to configure a set of similar xWindowsOptionalFeature resources. - - .PARAMETER Name - The names of the Windows optional features to enable or disable. - - .PARAMETER Ensure - Specifies whether the features should be enabled or disabled. - - To enable a set of features, set this property to Present. - To disable a set of features, set this property to Absent. - - .PARAMETER RemoveFilesOnDisable - Specifies whether or not to remove all files associated with the features when they are - disabled. - - .PARAMETER NoWindowsUpdateCheck - Specifies whether or not DISM should contact Windows Update (WU) when searching for the - source files to restore Windows optional features on an online image. - - .PARAMETER LogPath - The file path to which to log the opertation. - - .PARAMETER LogLevel - The level of detail to include in the log. -#> -Configuration xWindowsOptionalFeatureSet -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String[]] - $Name, - - [Parameter(Mandatory = $true)] - [ValidateSet('Present', 'Absent')] - [String] - $Ensure, - - [Boolean] - $RemoveFilesOnDisable, - - [Boolean] - $NoWindowsUpdateCheck, - - [ValidateNotNullOrEmpty()] - [String] - $LogPath, - - [ValidateSet('ErrorsOnly', 'ErrorsAndWarning', 'ErrorsAndWarningAndInformation')] - [String] - $LogLevel - ) - - $newResourceSetConfigurationParams = @{ - ResourceName = 'xWindowsOptionalFeature' - ModuleName = 'xPSDesiredStateConfiguration' - KeyParameterName = 'Name' - Parameters = $PSBoundParameters - } - - $configurationScriptBlock = New-ResourceSetConfigurationScriptBlock @newResourceSetConfigurationParams - - # This script block must be run directly in this configuration in order to resolve variables - . $configurationScriptBlock -} diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/ResourceDesignerScripts/GenerateXRemoteFileSchema.ps1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/ResourceDesignerScripts/GenerateXRemoteFileSchema.ps1 deleted file mode 100644 index 6ba3a5ff..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/ResourceDesignerScripts/GenerateXRemoteFileSchema.ps1 +++ /dev/null @@ -1,10 +0,0 @@ -$DestinationPath = New-xDscResourceProperty -Name DestinationPath -Type String -Attribute Key -Description 'Path under which downloaded or copied file should be accessible after operation.' -$Uri = New-xDscResourceProperty -Name Uri -Type String -Attribute Required -Description 'Uri of a file which should be copied or downloaded. This parameter supports HTTP and HTTPS values.' -$Headers = New-xDscResourceProperty -Name Headers -Type Hashtable[] -Attribute Write -Description 'Headers of the web request.' -$UserAgent = New-xDscResourceProperty -Name UserAgent -Type String -Attribute Write -Description 'User agent for the web request.' -$Ensure = New-xDscResourceProperty -Name Ensure -Type String -Attribute Read -ValidateSet "Present", "Absent" -Description 'Says whether DestinationPath exists on the machine' -$Credential = New-xDscResourceProperty -Name Credential -Type PSCredential -Attribute Write -Description 'Specifies a user account that has permission to send the request.' -#$CertificateThumbprint = New-xDscResourceProperty -Name CertificateThumbprint -Type String -Attribute Write -Description 'Digital public key certificate that is used to send the request.' - -New-xDscResource -Name MSFT_xRemoteFile -Property @($DestinationPath, $Uri, $Headers, $UserAgent, $Ensure, $Credential, $CertificateThumbprint) -ModuleName xPSDesiredStateConfiguration2 -FriendlyName xRemoteFile - diff --git a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/ResourceDesignerScripts/New-PSSessionConfigurationResource.ps1 b/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/ResourceDesignerScripts/New-PSSessionConfigurationResource.ps1 deleted file mode 100644 index 629a8a21..00000000 --- a/lib/puppet_x/dsc_resources/xPSDesiredStateConfiguration/ResourceDesignerScripts/New-PSSessionConfigurationResource.ps1 +++ /dev/null @@ -1,18 +0,0 @@ -Import-Module -Name 'xDSCResourceDesigner' - -$resProperties = @{ - Name = New-xDscResourceProperty -Description 'Name of the PS Remoting Endpoint' ` - -Name Name -Type String -Attribute Key - RunAsCred = New-xDscResourceProperty -Description 'Credential for Running under different user context' ` - -Name RunAsCredential -Type PSCredential -Attribute Write - SDDL = New-xDscResourceProperty -Description 'SDDL for allowed users to connect to this endpoint. 'Default' means the default SDDL' ` - -Name SecurityDescriptorSDDL -Type String -Attribute Write - StartupScript = New-xDscResourceProperty -Description 'Path for the startup script. Empty string clears the value'` - -Name StartupScriptPath -Type String -Attribute Write - Ensure = New-xDscResourceProperty -Description 'Whether to create the endpoint or delete it' ` - -Name Ensure -Type String -Attribute Write -ValidateSet 'Present','Absent' - AccessMode = New-xDscResourceProperty -Description 'Whether the endpoint is remotely accessible or has local access only or no access' ` - -Name AccessMode -Type String -Attribute Write -ValidateSet 'Local','Remote', 'Disabled' -} - -New-xDscResource -Name MSFT_xPSSessionConfiguration -Property $resProperties.Values -Path $home\desktop -ModuleName xPSDesiredStateConfiguration -FriendlyName xPSEndpoint -Force diff --git a/lib/puppet_x/dsc_resources/xPendingReboot/DSCResources/MSFT_xPendingReboot/MSFT_xPendingReboot.psm1 b/lib/puppet_x/dsc_resources/xPendingReboot/DSCResources/MSFT_xPendingReboot/MSFT_xPendingReboot.psm1 deleted file mode 100644 index 2b2695d4..00000000 --- a/lib/puppet_x/dsc_resources/xPendingReboot/DSCResources/MSFT_xPendingReboot/MSFT_xPendingReboot.psm1 +++ /dev/null @@ -1,135 +0,0 @@ -Function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([Hashtable])] - param - ( - [Parameter(Mandatory=$true)] - [string]$Name, - - [Parameter()] - [bool]$SkipCcmClientSDK - ) - - $ComponentBasedServicingKeys = (Get-ChildItem 'hklm:SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\').Name - if ($ComponentBasedServicingKeys) - { - $ComponentBasedServicing = $ComponentBasedServicingKeys.Split("\") -contains "RebootPending" - } - else - { - $ComponentBasedServicing = $false - } - - $WindowsUpdateKeys = (Get-ChildItem 'hklm:SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\').Name - if ($WindowsUpdateKeys) - { - $WindowsUpdate = $WindowsUpdateKeys.Split("\") -contains "RebootRequired" - } - else - { - $WindowsUpdate = $false - } - - $PendingFileRename = (Get-ItemProperty 'hklm:\SYSTEM\CurrentControlSet\Control\Session Manager\').PendingFileRenameOperations.Length -gt 0 - $ActiveComputerName = (Get-ItemProperty 'hklm:\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName').ComputerName - $PendingComputerName = (Get-ItemProperty 'hklm:\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName').ComputerName - $PendingComputerRename = $ActiveComputerName -ne $PendingComputerName - - - - if (-not $SkipCcmClientSDK) - { - $CCMSplat = @{ - NameSpace='ROOT\ccm\ClientSDK' - Class='CCM_ClientUtilities' - Name='DetermineIfRebootPending' - ErrorAction='Stop' - } - - Try { - $CCMClientSDK = Invoke-WmiMethod @CCMSplat - } - Catch - { - Write-Warning "Unable to query CCM_ClientUtilities: $_" - } - } - - $SCCMSDK = ($CCMClientSDK.ReturnValue -eq 0) -and ($CCMClientSDK.IsHardRebootPending -or $CCMClientSDK.RebootPending) - - return @{ - Name = $Name - ComponentBasedServicing = $ComponentBasedServicing - WindowsUpdate = $WindowsUpdate - PendingFileRename = $PendingFileRename - PendingComputerRename = $PendingComputerRename - CcmClientSDK = $SCCMSDK - } -} - -Function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory=$true)] - [string]$Name, - [bool]$SkipComponentBasedServicing, - [bool]$SkipWindowsUpdate, - [bool]$SkipPendingFileRename, - [bool]$SkipPendingComputerRename, - [bool]$SkipCcmClientSDK - ) - - $global:DSCMachineStatus = 1 -} - -Function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([Boolean])] - param - ( - [Parameter(Mandatory=$true)] - [string]$Name, - [bool]$SkipComponentBasedServicing, - [bool]$SkipWindowsUpdate, - [bool]$SkipPendingFileRename, - [bool]$SkipPendingComputerRename, - [bool]$SkipCcmClientSDK - ) - - $status = Get-TargetResource $Name -SkipCcmClientSDK $SkipCcmClientSDK - - if(-not $SkipComponentBasedServicing -and $status.ComponentBasedServicing) - { - Write-Verbose 'Pending component based servicing reboot found.' - return $false - } - - if(-not $SkipWindowsUpdate -and $status.WindowsUpdate) - { - Write-Verbose 'Pending Windows Update reboot found.' - return $false - } - - if(-not $SkipPendingFileRename -and $status.PendingFileRename) - { - Write-Verbose 'Pending file rename found.' - return $false - } - - if(-not $SkipPendingComputerRename -and $status.PendingComputerRename) - { - Write-Verbose 'Pending computer rename found.' - return $false - } - - Write-Verbose 'No pending reboots found.' - return $true -} - -Export-ModuleMember -Function *-TargetResource - -$regRebootLocations = $null diff --git a/lib/puppet_x/dsc_resources/xPendingReboot/DSCResources/MSFT_xPendingReboot/MSFT_xPendingReboot.schema.mof b/lib/puppet_x/dsc_resources/xPendingReboot/DSCResources/MSFT_xPendingReboot/MSFT_xPendingReboot.schema.mof deleted file mode 100644 index 9e358692..00000000 --- a/lib/puppet_x/dsc_resources/xPendingReboot/DSCResources/MSFT_xPendingReboot/MSFT_xPendingReboot.schema.mof +++ /dev/null @@ -1,20 +0,0 @@ -[ClassVersion("0.1.0.0"), FriendlyName("xPendingReboot")] -class MSFT_xPendingReboot : OMI_BaseResource -{ - [key, Description("Name of this pending reboot check")] string Name; - [write, Description("Specifies whether to skip reboots triggered by the Component-Based Servicing component")] boolean SkipComponentBasedServicing; - [read, Description("A value indicating whether the Component-Based Servicing component requested a reboot")] boolean ComponentBasedServicing; - - [write, Description("Specifies whether to skip reboots triggered by Windows Update")] boolean SkipWindowsUpdate; - [read, Description("A value indicating whether Windows Update requested a reboot")] boolean WindowsUpdate; - - [write, Description("Specifies whether to skip pending file rename reboots")] boolean SkipPendingFileRename; - [read, Description("A value indicating whether a pending file rename triggered a reboot")] boolean PendingFileRename; - - [write, Description("Specifies whether to skip reboots triggered by a pending computer rename")] boolean SkipPendingComputerRename; - [read, Description("A value indicating whether a pending computer rename triggered a reboot")] boolean PendingComputerRename; - - [write, Description("Specifies whether to skip reboots triggered by the ConfigMgr client")] boolean SkipCcmClientSDK; - [read, Description("A value indicating whether the ConfigMgr client triggered a reboot")] boolean CcmClientSDK; -}; - diff --git a/lib/puppet_x/dsc_resources/xPendingReboot/LICENSE b/lib/puppet_x/dsc_resources/xPendingReboot/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xPendingReboot/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xPendingReboot/xPendingReboot.psd1 b/lib/puppet_x/dsc_resources/xPendingReboot/xPendingReboot.psd1 deleted file mode 100644 index 421a09a4..00000000 --- a/lib/puppet_x/dsc_resources/xPendingReboot/xPendingReboot.psd1 +++ /dev/null @@ -1,57 +0,0 @@ -@{ -# Version number of this module. -ModuleVersion = '0.3.0.0' - -# ID used to uniquely identify this module -GUID = '21430f59-750c-4c3c-bb93-4633b5b784c8' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'This module identifies pending reboots in Windows Server and acts on them.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Minimum version of the common language runtime (CLR) required by this module -CLRVersion = '4.0' - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/xPendingReboot/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/xPendingReboot' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - # ReleaseNotes = '' - - } # End of PSData hashtable - -} # End of PrivateData hashtable -} - - diff --git a/lib/puppet_x/dsc_resources/xPhp/DscResources/xPhpProvision/xPhpProvision.Schema.psm1 b/lib/puppet_x/dsc_resources/xPhp/DscResources/xPhpProvision/xPhpProvision.Schema.psm1 deleted file mode 100644 index 6b21ace8..00000000 --- a/lib/puppet_x/dsc_resources/xPhp/DscResources/xPhpProvision/xPhpProvision.Schema.psm1 +++ /dev/null @@ -1,140 +0,0 @@ -# Composite configuration to install the IIS pre-requisites for php -Configuration IisPreReqs_php -{ - param - ( - [Parameter(Mandatory = $true)] - [Validateset("Present","Absent")] - [String] - $Ensure - ) - - foreach ($Feature in @("Web-Server","Web-Mgmt-Tools","web-Default-Doc","Web-Dir-Browsing","Web-Http-Errors","Web-Static-Content",` - "Web-Http-Logging","web-Stat-Compression","web-Filtering",` - "web-CGI","web-ISAPI-Ext","web-ISAPI-Filter")) - { - WindowsFeature "$Feature$Number" - { - Ensure = $Ensure - Name = $Feature - } - } -} - -# Composite configuration to install PHP on IIS -configuration xPhpProvision -{ - param( - [Parameter(Mandatory = $true)] - [switch] $installMySqlExt, - - [string] $PackageFolder = 'c:\package', - - [Parameter(Mandatory = $true)] - [string] $DownloadUri, - - [string] $Vc2012RedistDownloadUri = 'http://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x64.exe', - - [String] $DestinationPath = 'C:\php', - - [Parameter(Mandatory = $true)] - [string] $ConfigurationPath - ) - Import-DscResource -module xPsDesiredStateConfiguration - Import-DscResource -module xWebAdministration - - # Make sure the IIS Prerequisites for PHP are present - IisPreReqs_php Iis - { - Ensure = "Present" - - # Removed because this dependency does not work in Windows Server 2012 R2 and below - # This should work in WMF v5 and above - # DependsOn = "[File]PackagesFolder" - } - - # Download and install Visual C Redist2012 from chocolatey.org - Package vcRedist - { - Path = $Vc2012RedistDownloadUri - ProductId = "{CF2BEA3C-26EA-32F8-AA9B-331F7E34BA97}" - Name = "Microsoft Visual C++ 2012 x64 Minimum Runtime - 11.0.61030" - Arguments = "/install /passive /norestart" - } - - $phpZip = Join-Path $PackageFolder "php.zip" - - $phpDownloadUri = New-Object -TypeName System.Uri $DownloadURI - $archiveDependsOn = @() - if($phpDownloadUri.scheme -ieq "http") - { - # Make sure the PHP archine is in the package folder - xRemoteFile phpArchive - { - uri = $DownloadURI - DestinationPath = $phpZip - } - $archiveDependsOn += "[xRemoteFile]phpArchive" - } - else - { - $phpZip = $DownloadURI - } - - # Make sure the content of the PHP archine are in the PHP path - Archive php - { - Path = $phpZip - Destination = $DestinationPath - DependsOn = $archiveDependsOn - } - - if ($installMySqlExt ) - { - # Make sure the MySql extention for PHP is in the main PHP path - File phpMySqlExt - { - SourcePath = "$($DestinationPath)\ext\php_mysql.dll" - DestinationPath = "$($DestinationPath)\php_mysql.dll" - Ensure = "Present" - DependsOn = @("[Archive]PHP") - MatchSource = $true - } - } - - - # Make sure the php.ini is in the Php folder - File PhpIni - { - SourcePath = $ConfigurationPath - DestinationPath = "$($DestinationPath)\php.ini" - DependsOn = @("[Archive]PHP") - MatchSource = $true - } - - - # Make sure the php cgi module is registered with IIS - xIisModule phpHandler - { - Name = "phpFastCgi" - Path = "$($DestinationPath)\php-cgi.exe" - RequestPath = "*.php" - Verb = "*" - Ensure = "Present" - DependsOn = @("[Package]vcRedist","[File]PhpIni") - - # Removed because this dependency does not work in Windows Server 2012 R2 and below - # This should work in WMF v5 and above - # "[IisPreReqs_php]Iis" - } - - # Make sure the php binary folder is in the path - Environment PathPhp - { - Name = "Path" - Value = ";$($DestinationPath)" - Ensure = "Present" - Path = $true - DependsOn = "[Archive]PHP" - } -} diff --git a/lib/puppet_x/dsc_resources/xPhp/DscResources/xPhpProvision/xPhpProvision.psd1 b/lib/puppet_x/dsc_resources/xPhp/DscResources/xPhpProvision/xPhpProvision.psd1 deleted file mode 100644 index 8a07ca4d..00000000 --- a/lib/puppet_x/dsc_resources/xPhp/DscResources/xPhpProvision/xPhpProvision.psd1 +++ /dev/null @@ -1,94 +0,0 @@ -# -# Module manifest for module 'xPhpProvision' -# -# Generated on: 6/23/2014 -# - -@{ - -# Script module or binary module file associated with this manifest. -RootModule = 'xPhpProvision.Schema.psm1' - -# Version number of this module. -ModuleVersion = '1.0' - -# ID used to uniquely identify this module -GUID = 'fa278449-b3b6-49be-a776-558674ea02d0' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft. All rights reserved.' - -# Description of the functionality provided by this module -# Description = '' - -# Minimum version of the Windows PowerShell engine required by this module -# PowerShellVersion = '' - -# Name of the Windows PowerShell host required by this module -# PowerShellHostName = '' - -# Minimum version of the Windows PowerShell host required by this module -# PowerShellHostVersion = '' - -# Minimum version of Microsoft .NET Framework required by this module -# DotNetFrameworkVersion = '' - -# Minimum version of the common language runtime (CLR) required by this module -# CLRVersion = '' - -# Processor architecture (None, X86, Amd64) required by this module -# ProcessorArchitecture = '' - -# Modules that must be imported into the global environment prior to importing this module -# RequiredModules = @() - -# Assemblies that must be loaded prior to importing this module -# RequiredAssemblies = @() - -# Script files (.ps1) that are run in the caller's environment prior to importing this module. -# ScriptsToProcess = @() - -# Type files (.ps1xml) to be loaded when importing this module -# TypesToProcess = @() - -# Format files (.ps1xml) to be loaded when importing this module -# FormatsToProcess = @() - -# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess -# NestedModules = @() - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Variables to export from this module -VariablesToExport = '*' - -# Aliases to export from this module -AliasesToExport = '*' - -# List of all modules packaged with this module -# ModuleList = @() - -# List of all files packaged with this module -# FileList = @() - -# Private data to pass to the module specified in RootModule/ModuleToProcess -# PrivateData = '' - -# HelpInfo URI of this module -# HelpInfoURI = '' - -# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. -# DefaultCommandPrefix = '' - -} - diff --git a/lib/puppet_x/dsc_resources/xPhp/LICENSE b/lib/puppet_x/dsc_resources/xPhp/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xPhp/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xPhp/xPhp.psd1 b/lib/puppet_x/dsc_resources/xPhp/xPhp.psd1 deleted file mode 100644 index 80247edb..00000000 --- a/lib/puppet_x/dsc_resources/xPhp/xPhp.psd1 +++ /dev/null @@ -1,97 +0,0 @@ -# -# Module manifest for module 'xPhp' -# -# -# Generated on: 6/23/2014 -# - -@{ - -# Script module or binary module file associated with this manifest. -#RootModule = '' - -# Version number of this module. -ModuleVersion = '1.1.0.0' - -# ID used to uniquely identify this module -GUID = 'a7e316cc-d538-4c67-b72c-c89c8fc013cd' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'Module for configuring PHP' - -# Minimum version of the Windows PowerShell engine required by this module -# PowerShellVersion = '' - -# Name of the Windows PowerShell host required by this module -# PowerShellHostName = '' - -# Minimum version of the Windows PowerShell host required by this module -# PowerShellHostVersion = '' - -# Minimum version of Microsoft .NET Framework required by this module -# DotNetFrameworkVersion = '' - -# Minimum version of the common language runtime (CLR) required by this module -# CLRVersion = '' - -# Processor architecture (None, X86, Amd64) required by this module -# ProcessorArchitecture = '' - -# Modules that must be imported into the global environment prior to importing this module -# RequiredModules = @() - -# Assemblies that must be loaded prior to importing this module -# RequiredAssemblies = @() - -# Script files (.ps1) that are run in the caller's environment prior to importing this module. -# ScriptsToProcess = @() - -# Type files (.ps1xml) to be loaded when importing this module -# TypesToProcess = @() - -# Format files (.ps1xml) to be loaded when importing this module -# FormatsToProcess = @() - -# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess -# NestedModules = @() - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Variables to export from this module -VariablesToExport = '*' - -# Aliases to export from this module -AliasesToExport = '*' - -# List of all modules packaged with this module -# ModuleList = @() - -# List of all files packaged with this module -# FileList = @() - -# Private data to pass to the module specified in RootModule/ModuleToProcess -# PrivateData = '' - -# HelpInfo URI of this module -# HelpInfoURI = '' - -# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. -# DefaultCommandPrefix = '' - -} - - - diff --git a/lib/puppet_x/dsc_resources/xPowerShellExecutionPolicy/DSCResources/MSFT_xPowerShellExecutionPolicy/MSFT_xPowerShellExecutionPolicy.psm1 b/lib/puppet_x/dsc_resources/xPowerShellExecutionPolicy/DSCResources/MSFT_xPowerShellExecutionPolicy/MSFT_xPowerShellExecutionPolicy.psm1 deleted file mode 100644 index 0779375f..00000000 --- a/lib/puppet_x/dsc_resources/xPowerShellExecutionPolicy/DSCResources/MSFT_xPowerShellExecutionPolicy/MSFT_xPowerShellExecutionPolicy.psm1 +++ /dev/null @@ -1,78 +0,0 @@ -#--------------------------------------------------------------------------------- #The sample scripts are not supported under any Microsoft standard support #program or service. The sample scripts are provided AS IS without warranty #of any kind. Microsoft further disclaims all implied warranties including, #without limitation, any implied warranties of merchantability or of fitness for #a particular purpose. The entire risk arising out of the use or performance of #the sample scripts and documentation remains with you. In no event shall #Microsoft, its authors, or anyone else involved in the creation, production, or #delivery of the scripts be liable for any damages whatsoever (including, #without limitation, damages for loss of business profits, business interruption, #loss of business information, or other pecuniary loss) arising out of the use #of or inability to use the sample scripts or documentation, even if Microsoft #has been advised of the possibility of such damages #--------------------------------------------------------------------------------- - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Bypass","Restricted","AllSigned","RemoteSigned","Unrestricted")] - [System.String] - $ExecutionPolicy - ) - - #Gets the execution policies for the current session. - $returnValue = @{ExecutionPolicy = $(Get-ExecutionPolicy)} - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Bypass","Restricted","AllSigned","RemoteSigned","Unrestricted")] - [System.String] - $ExecutionPolicy - ) - - If($PSCmdlet.ShouldProcess("$ExecutionPolicy","Set-ExecutionPolicy")) - { - Try - { - Write-Verbose "Setting the execution policy of PowerShell." - Set-ExecutionPolicy -ExecutionPolicy $ExecutionPolicy -Force -ErrorAction Stop - } - Catch - { - if($_.toString() -like "Windows PowerShell updated your execution policy successfully*") # trap this error, it set correctlly. - { - Write-Verbose "$_" - } - else - { - throw - } - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Bypass","Restricted","AllSigned","RemoteSigned","Unrestricted")] - [System.String] - $ExecutionPolicy - ) - - If($(Get-ExecutionPolicy) -eq $ExecutionPolicy) - { - return $true - } - else - { - return $false - } -} - -Export-ModuleMember -Function *-TargetResource - diff --git a/lib/puppet_x/dsc_resources/xPowerShellExecutionPolicy/DSCResources/MSFT_xPowerShellExecutionPolicy/MSFT_xPowerShellExecutionPolicy.schema.mof b/lib/puppet_x/dsc_resources/xPowerShellExecutionPolicy/DSCResources/MSFT_xPowerShellExecutionPolicy/MSFT_xPowerShellExecutionPolicy.schema.mof deleted file mode 100644 index 9e8a35a4..00000000 --- a/lib/puppet_x/dsc_resources/xPowerShellExecutionPolicy/DSCResources/MSFT_xPowerShellExecutionPolicy/MSFT_xPowerShellExecutionPolicy.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xPowerShellExecutionPolicy")] -class MSFT_xPowerShellExecutionPolicy : OMI_BaseResource -{ - [Key, Description("Changes the user preference for the Windows PowerShell execution policy."), ValueMap{"Bypass","Restricted","AllSigned","RemoteSigned","Unrestricted"}, Values{"Bypass","Restricted","AllSigned","RemoteSigned","Unrestricted"}] String ExecutionPolicy; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xPowerShellExecutionPolicy/LICENSE b/lib/puppet_x/dsc_resources/xPowerShellExecutionPolicy/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xPowerShellExecutionPolicy/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xPowerShellExecutionPolicy/xPowerShellExecutionPolicy.psd1 b/lib/puppet_x/dsc_resources/xPowerShellExecutionPolicy/xPowerShellExecutionPolicy.psd1 deleted file mode 100644 index d3b4f6a8..00000000 --- a/lib/puppet_x/dsc_resources/xPowerShellExecutionPolicy/xPowerShellExecutionPolicy.psd1 +++ /dev/null @@ -1,61 +0,0 @@ -@{ -# Script module or binary module file associated with this manifest. - -# Version number of this module. -ModuleVersion = '1.1.0.0' - -# ID used to uniquely identify this module -GUID = 'ee440155-d4cc-4ec8-9822-2a9bd7d8c82f' - -# Author of this module -Author = 'OneScript Team' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'This DSC Resources can change the user preference for the Windows PowerShell execution policy.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Functions to export from this module -FunctionsToExport = 'Get-TargetResource', 'Test-TargetResource', 'Set-TargetResource' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Variables to export from this module -VariablesToExport = '*' - -# Aliases to export from this module -AliasesToExport = '*' - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/xPowerShellExecutionPolicy/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/xPowerShellExecutionPolicy' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - # ReleaseNotes = '' - - } # End of PSData hashtable - -} # End of PrivateData hashtable -} - diff --git a/lib/puppet_x/dsc_resources/xRemoteDesktopAdmin/DSCResources/xRemoteDesktopAdmin/xRemoteDesktopAdmin.psm1 b/lib/puppet_x/dsc_resources/xRemoteDesktopAdmin/DSCResources/xRemoteDesktopAdmin/xRemoteDesktopAdmin.psm1 deleted file mode 100644 index 7c4f41a3..00000000 --- a/lib/puppet_x/dsc_resources/xRemoteDesktopAdmin/DSCResources/xRemoteDesktopAdmin/xRemoteDesktopAdmin.psm1 +++ /dev/null @@ -1,157 +0,0 @@ -<# -This sample DSC Resource allows you to configure the Remote Desktop settings (under Remote Settings). -Leveraging the xFirewall resource (included in MSFT_xNetworking), firewall rules can also be configured. -Leveraging the Group resource (included in Windows), the "Remote Desktop Users" group can also be configured. -This sample has been tested with Windows Server 2012 R2 and WMF 5.0 Preview -Author: Tiander Turpijn, Microsoft Corporation - -Used parameters: -Ensure [string] translates to reg value fDenyTSConnections [Int] - Allow RDP connection: Present = 0 "Enabled", Absent = 1 "Disabled" -UserAuthentication [string] translates to reg value UserAuthentication [Int] - Allow only Network Level Authentication - connections: Secure = 1 "Secure", NonSecure = 0 "NonSecure" -#> - -#region GET RDP Settings -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory)] - [ValidateSet("Present","Absent")] - [System.String]$Ensure, - - [ValidateSet("NonSecure", "Secure")] - [System.String]$UserAuthentication - ) - - switch ($Ensure) { - "Present" {[System.Byte]$fDenyTSConnections = 0} - "Absent" {[System.Byte]$fDenyTSConnections = 1} - } - - switch ($UserAuthentication) { - "NonSecure" {[System.Byte]$UserAuthentication = 0} - "Secure" {[System.Byte]$UserAuthentication = 1} - } - - $GetDenyTSConnections = Get-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections" - $GetUserAuth = Get-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "UserAuthentication" - - $returnValue = @{ - Ensure = switch ($GetDenyTSConnections.fDenyTSConnections) { - 0 {"Present"} - 1 {"Absent"} - } - UserAuthentication = switch ($GetUserAuth.UserAuthentication) { - 0 {"NonSecure"} - 1 {"Secure"} - } - } - - $returnValue - } - -# Get-TargetResource 'Present' 'Secure' -Verbose -# Expectation is a hashtable with configuration of the machine. - -#endregion - -#region SET RDP Settings -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory)] - [ValidateSet("Present","Absent")] - [System.String]$Ensure, - - [ValidateSet("NonSecure", "Secure")] - [System.String]$UserAuthentication - ) - - switch ($Ensure) { - "Present" {[System.Byte]$fDenyTSConnections = 0} - "Absent" {[System.Byte]$fDenyTSConnections = 1} - } - - switch ($UserAuthentication) { - "NonSecure" {[System.Byte]$UserAuthentication = 0} - "Secure" {[System.Byte]$UserAuthentication = 1} - } - - $GetEnsure = (Get-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections").fDenyTSConnections - $GetUserAuthentiation = (Get-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "UserAuthentication").UserAuthentication - - #The make it so section - if ($fDenyTSConnections -ne $GetEnsure) { - Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server'-name "fDenyTSConnections" -Value $fDenyTSConnections - } - if ($UserAuthentication -ne $GetUserAuthentication) { - Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "UserAuthentication" -Value $UserAuthentication - } - } - -# Set-TargetResource 'Present' 'Secure' -Verbose -# Expectation is the computer will be configured to accept secure RDP connections. To verify, right click on the Windows button and open System - Remote Settings. - -#endregion - -#region TEST RDP Settings -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory)] - [ValidateSet("Present","Absent")] - [System.String]$Ensure, - - [ValidateSet("NonSecure", "Secure")] - [System.String]$UserAuthentication - ) - - switch ($Ensure) { - "Present" {[System.Byte]$fDenyTSConnections = 0} - "Absent" {[System.Byte]$fDenyTSConnections = 1} - } - - switch ($UserAuthentication) { - "NonSecure" {[System.Byte]$UserAuthentication = 0} - "Secure" {[System.Byte]$UserAuthentication = 1} - } - - $GetfDenyTSConnections = (Get-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections").fDenyTSConnections - $GetUserAuthentiation = (Get-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "UserAuthentication").UserAuthentication - - $bool = $false - - if ($fDenyTSConnections -eq $GetfDenyTSConnections -and $UserAuthentication -eq $GetUserAuthentiation) - { - Write-Verbose "RDP settings are matching the desired state" - $bool = $true - } - else - { - Write-Verbose "RDP settings are Non-Compliant!" - if ($fDenyTSConnections -ne $GetfDenyTSConnections) { - Write-Verbose "DenyTSConnections settings are non-compliant, Value should be $fDenyTSConnections - Detected value is: $GetfDenyTSConnections" - } - if ($UserAuthentication -ne $GetUserAuthentiation) { - Write-Verbose "UserAuthentication settings are non-compliant, Value should be $UserAuthentication - Detected value is: $GetUserAuthentiation" - } - } - - $bool - } - -# Test-TargetResource 'Present' 'Secure' -Verbose -# Expectation is a true/false output based on whether the machine matches the declared configuration. - -#endregion - - -Export-ModuleMember -Function *-TargetResource - diff --git a/lib/puppet_x/dsc_resources/xRemoteDesktopAdmin/DSCResources/xRemoteDesktopAdmin/xRemoteDesktopAdmin.schema.mof b/lib/puppet_x/dsc_resources/xRemoteDesktopAdmin/DSCResources/xRemoteDesktopAdmin/xRemoteDesktopAdmin.schema.mof deleted file mode 100644 index 7b883568..00000000 --- a/lib/puppet_x/dsc_resources/xRemoteDesktopAdmin/DSCResources/xRemoteDesktopAdmin/xRemoteDesktopAdmin.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xRemoteDesktopAdmin")] -class xRemoteDesktopAdmin : OMI_BaseResource -{ - [Key, Description("Determines whether or not the computer should accept remote connections. Present sets the value to Enabled and Absent sets the value to Disabled."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, Description("User Authentication. Setting this value to Secure configures the machine to require NLA."), ValueMap{"Secure","NonSecure"}, Values{"Secure","NonSecure"}] String UserAuthentication; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xRemoteDesktopAdmin/LICENSE b/lib/puppet_x/dsc_resources/xRemoteDesktopAdmin/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xRemoteDesktopAdmin/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xRemoteDesktopAdmin/xRemoteDesktopAdmin.psd1 b/lib/puppet_x/dsc_resources/xRemoteDesktopAdmin/xRemoteDesktopAdmin.psd1 deleted file mode 100644 index 6bbcc3c7..00000000 --- a/lib/puppet_x/dsc_resources/xRemoteDesktopAdmin/xRemoteDesktopAdmin.psd1 +++ /dev/null @@ -1,32 +0,0 @@ -@{ -# Version number of this module. -ModuleVersion = '1.1.0.0' - -# ID used to uniquely identify this module -GUID = '244cd1ea-c609-45b9-9538-a260c0930769' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2013 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'Module with DSC Resources for enabling adminsitrative Remote Desktop Connections' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Minimum version of the common language runtime (CLR) required by this module -CLRVersion = '4.0' - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' -} - diff --git a/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/DSCResources/MSFT_xRDRemoteApp/MSFT_xRDRemoteApp.psm1 b/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/DSCResources/MSFT_xRDRemoteApp/MSFT_xRDRemoteApp.psm1 deleted file mode 100644 index c3ff64f3..00000000 --- a/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/DSCResources/MSFT_xRDRemoteApp/MSFT_xRDRemoteApp.psm1 +++ /dev/null @@ -1,133 +0,0 @@ -Import-Module -Name "$PSScriptRoot\..\..\xRemoteDesktopSessionHostCommon.psm1" -if (!(Test-xRemoteDesktopSessionHostOsRequirement)) { Throw "The minimum OS requirement was not met."} -Import-Module RemoteDesktop -$localhost = [System.Net.Dns]::GetHostByName((hostname)).HostName - -####################################################################### -# The Get-TargetResource cmdlet. -####################################################################### -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory)] - [ValidateLength(1,15)] - [string] $CollectionName = "Tenant", - [parameter(Mandatory)] - [string] $DisplayName = "Calculator", - [parameter(Mandatory)] - [string] $FilePath = "C:\Windows\System32\calc.exe", - [parameter(Mandatory)] - [string] $Alias = "calc", - [string] $FileVirtualPath, - [string] $FolderName, - [string] $CommandLineSetting, - [string] $RequiredCommandLine, - [uint32] $IconIndex, - [string] $IconPath, - [string] $UserGroups, - [boolean] $ShowInWebAccess - ) - Write-Verbose "Getting published RemoteApp program $DisplayName, if one exists." - $CollectionName = Get-RDSessionCollection | % {Get-RDSessionHost $_.CollectionName} | ? {$_.SessionHost -ieq $localhost} | % {$_.CollectionName} - $remoteApp = Get-RDRemoteApp -CollectionName $CollectionName -DisplayName $DisplayName -Alias $Alias - - @{ - "CollectionName" = $remoteApp.CollectionName; - "DisplayName" = $remoteApp.DisplayName; - "FilePath" = $remoteApp.FilePath; - "Alias" = $remoteApp.Alias; - "FileVirtualPath" = $remoteApp.FileVirtualPath; - "FolderName" = $remoteApp.FolderName; - "CommandLineSetting" = $remoteApp.CommandLineSetting; - "RequiredCommandLine" = $remoteApp.RequiredCommandLine; - "IconIndex" = $remoteApp.IconIndex; - "IconPath" = $remoteApp.IconPath; - "UserGroups" = $remoteApp.UserGroups; - "ShowInWebAccess" = $remoteApp.ShowInWebAccess; - } -} - - -######################################################################## -# The Set-TargetResource cmdlet. -######################################################################## -function Set-TargetResource - -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory)] - [ValidateLength(1,15)] - [string] $CollectionName, - [parameter(Mandatory)] - [string] $DisplayName, - [parameter(Mandatory)] - [string] $FilePath, - [parameter(Mandatory)] - [string] $Alias, - [string] $FileVirtualPath, - [string] $FolderName, - [string] $CommandLineSetting, - [string] $RequiredCommandLine, - [uint32] $IconIndex, - [string] $IconPath, - [string] $UserGroups, - [boolean] $ShowInWebAccess - ) - Write-Verbose "Making updates to RemoteApp." - $CollectionName = Get-RDSessionCollection | % {Get-RDSessionHost $_.CollectionName} | ? {$_.SessionHost -ieq $localhost} | % {$_.CollectionName} - $PSBoundParameters.collectionName = $CollectionName - if (!$(Get-RDRemoteApp -Alias $Alias)) { - New-RDRemoteApp @PSBoundParameters - } - else { - Set-RDRemoteApp @PSBoundParameters - } -} - - -####################################################################### -# The Test-TargetResource cmdlet. -####################################################################### -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory)] - [ValidateLength(1,15)] - [string] $CollectionName, - [parameter(Mandatory)] - [string] $DisplayName, - [parameter(Mandatory)] - [string] $FilePath, - [parameter(Mandatory)] - [string] $Alias, - [string] $FileVirtualPath, - [string] $FolderName, - [string] $CommandLineSetting, - [string] $RequiredCommandLine, - [uint32] $IconIndex, - [string] $IconPath, - [string] $UserGroups, - [boolean] $ShowInWebAccess - ) - Write-Verbose "Testing if RemoteApp is published." - $collectionName = Get-RDSessionCollection | % {Get-RDSessionHost $_.CollectionName} | ? {$_.SessionHost -ieq $localhost} | % {$_.CollectionName} - $PSBoundParameters.Remove("Verbose") | out-null - $PSBoundParameters.Remove("Debug") | out-null - $PSBoundParameters.Remove("ConnectionBroker") | out-null - $Check = $true - - $Get = Get-TargetResource -CollectionName $CollectionName -DisplayName $DisplayName -FilePath $FilePath -Alias $Alias - $PSBoundParameters.keys | % {if ($PSBoundParameters[$_] -ne $Get[$_]) {$Check = $false} } - $Check -} - -Export-ModuleMember -Function *-TargetResource - diff --git a/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/DSCResources/MSFT_xRDRemoteApp/MSFT_xRDRemoteApp.schema.mof b/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/DSCResources/MSFT_xRDRemoteApp/MSFT_xRDRemoteApp.schema.mof deleted file mode 100644 index e167c280..00000000 --- a/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/DSCResources/MSFT_xRDRemoteApp/MSFT_xRDRemoteApp.schema.mof +++ /dev/null @@ -1,19 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xRDRemoteApp")] -class MSFT_xRDRemoteApp : OMI_BaseResource -{ - [key, Description("Specifies an alias for the RemoteApp program.")] string Alias; - [key, Description("Specifies the name of the personal virtual desktop collection or session collection. The cmdlet publishes the RemoteApp program to this collection. ")] string CollectionName; - [key, Description("Specifies a name to display to users for the RemoteApp program.")] string DisplayName; - [key, Description("Specifies a path for the executable file for the application. Do not include any environment variables.")] string FilePath; - [write, Description("Specifies a path for the application executable file. This path resolves to the same location as the value of the FilePath parameter, but it can include environment variables. ")] string FileVirtualPath; - [write, Description("Specifies the name of the folder that the RemoteApp program appears in on the Remote Desktop Web Access (RD Web Access) webpage and in the Start menu for subscribed RemoteApp and Desktop Connections. ")] string FolderName; - [write, Description("Specifies whether the RemoteApp program accepts command-line arguments from the client at connection time. The acceptable values for this parameter are: Allow, DoNotAllow, Require")] string CommandLineSetting; - [write, Description("Specifies a string that contains command-line arguments that the client can use at connection time with the RemoteApp program. ")] string RequiredCommandLine; - [write, Description("Specifies the index within the icon file (specified by the IconPath parameter) where the RemoteApp program's icon can be found.")] uint32 IconIndex; - [write, Description("Specifies the path to a file containing the icon to display for the RemoteApp program identified by the Alias parameter.")] string IconPath; - [write, Description("Specifies a domain group that can view the RemoteApp in RD Web Access, and in RemoteApp and Desktop Connections. To allow all users to see a RemoteApp program, provide a value of Null.")] string UserGroups; - [write, Description("Specifies whether to show the RemoteApp program in the RD Web Access server, and in RemoteApp and Desktop Connections that the user subscribes to. ")] boolean ShowInWebAccess; -}; - - diff --git a/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/DSCResources/MSFT_xRDSessionCollection/MSFT_xRDSessionCollection.psm1 b/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/DSCResources/MSFT_xRDSessionCollection/MSFT_xRDSessionCollection.psm1 deleted file mode 100644 index 12845d51..00000000 --- a/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/DSCResources/MSFT_xRDSessionCollection/MSFT_xRDSessionCollection.psm1 +++ /dev/null @@ -1,85 +0,0 @@ -Import-Module -Name "$PSScriptRoot\..\..\xRemoteDesktopSessionHostCommon.psm1" -if (!(Test-xRemoteDesktopSessionHostOsRequirement)) { Throw "The minimum OS requirement was not met."} -Import-Module RemoteDesktop -$localhost = [System.Net.Dns]::GetHostByName((hostname)).HostName - -####################################################################### -# The Get-TargetResource cmdlet. -####################################################################### -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory)] - [ValidateLength(1,15)] - [string] $CollectionName, - [parameter(Mandatory)] - [string] $SessionHost, - [string] $CollectionDescription, - [string] $ConnectionBroker - ) - Write-Verbose "Getting information about RDSH collection." - $Collection = Get-RDSessionCollection -ErrorAction SilentlyContinue - @{ - "CollectionName" = $Collection.CollectionName; - "CollectionDescription" = $Collection.CollectionDescription - "SessionHost" = $localhost - "ConnectionBroker" = $ConnectionBroker - } -} - - -######################################################################## -# The Set-TargetResource cmdlet. -######################################################################## -function Set-TargetResource - -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory)] - [ValidateLength(1,15)] - [string] $CollectionName, - [parameter(Mandatory)] - [string] $SessionHost, - [string] $CollectionDescription, - [string] $ConnectionBroker - ) - Write-Verbose "Creating a new RDSH collection." - if ($localhost -eq $ConnectionBroker) { - New-RDSessionCollection @PSBoundParameters - } - else { - $PSBoundParameters.Remove("Description") - Add-RDSessionHost @PSBoundParameters - } -} - - -####################################################################### -# The Test-TargetResource cmdlet. -####################################################################### -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory)] - [ValidateLength(1,15)] - [string] $CollectionName, - [parameter(Mandatory)] - [string] $SessionHost, - [string] $CollectionDescription, - [string] $ConnectionBroker - ) - Write-Verbose "Checking for existance of RDSH collection." - (Get-TargetResource @PSBoundParameters).CollectionName -ne $null -} - - -Export-ModuleMember -Function *-TargetResource - diff --git a/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/DSCResources/MSFT_xRDSessionCollection/MSFT_xRDSessionCollection.schema.mof b/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/DSCResources/MSFT_xRDSessionCollection/MSFT_xRDSessionCollection.schema.mof deleted file mode 100644 index 68330c36..00000000 --- a/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/DSCResources/MSFT_xRDSessionCollection/MSFT_xRDSessionCollection.schema.mof +++ /dev/null @@ -1,12 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xRDSessionCollection")] -class MSFT_xRDSessionCollection : OMI_BaseResource -{ - [key, Description("Specifies a name for the session collection. ")] string CollectionName; - [key, Description("Specifies an RD Session Host server to include in the session collection. ")] string SessionHost; - [write, Description("Specifies a description for the collection.")] string CollectionDescription; - [write, Description("Specifies the Remote Desktop Connection Broker (RD Connection Broker) server for a Remote Desktop deployment.")] string ConnectionBroker; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/DSCResources/MSFT_xRDSessionCollectionConfiguration/MSFT_xRDSessionCollectionConfiguration.psm1 b/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/DSCResources/MSFT_xRDSessionCollectionConfiguration/MSFT_xRDSessionCollectionConfiguration.psm1 deleted file mode 100644 index bdb56f0e..00000000 --- a/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/DSCResources/MSFT_xRDSessionCollectionConfiguration/MSFT_xRDSessionCollectionConfiguration.psm1 +++ /dev/null @@ -1,152 +0,0 @@ -Import-Module -Name "$PSScriptRoot\..\..\xRemoteDesktopSessionHostCommon.psm1" -if (!(Test-xRemoteDesktopSessionHostOsRequirement)) { Throw "The minimum OS requirement was not met."} -Import-Module RemoteDesktop -$localhost = [System.Net.Dns]::GetHostByName((hostname)).HostName - - -####################################################################### -# The Get-TargetResource cmdlet. -####################################################################### -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory)] - [ValidateLength(1,15)] - [string] $CollectionName, - [uint32] $ActiveSessionLimitMin, - [boolean] $AuthenticateUsingNLA, - [boolean] $AutomaticReconnectionEnabled, - [string] $BrokenConnectionAction, - [string] $ClientDeviceRedirectionOptions, - [boolean] $ClientPrinterAsDefault, - [boolean] $ClientPrinterRedirected, - [string] $CollectionDescription, - [string] $ConnectionBroker, - [string] $CustomRdpProperty, - [uint32] $DisconnectedSessionLimitMin, - [string] $EncryptionLevel, - [uint32] $IdleSessionLimitMin, - [uint32] $MaxRedirectedMonitors, - [boolean] $RDEasyPrintDriverEnabled, - [string] $SecurityLayer, - [boolean] $TemporaryFoldersDeletedOnExit, - [string] $UserGroup - ) - Write-Verbose "Getting currently configured RDSH Collection properties" - $collectionName = Get-RDSessionCollection | % {Get-RDSessionHost $_.CollectionName} | ? {$_.SessionHost -ieq $localhost} | % {$_.CollectionName} - - $collectionGeneral = Get-RDSessionCollectionConfiguration -CollectionName $CollectionName - $collectionClient = Get-RDSessionCollectionConfiguration -CollectionName $CollectionName -Client - $collectionConnection = Get-RDSessionCollectionConfiguration -CollectionName $CollectionName -Connection - $collectionSecurity = Get-RDSessionCollectionConfiguration -CollectionName $CollectionName -Security - $collectionUserGroup = Get-RDSessionCollectionConfiguration -CollectionName $CollectionName -UserGroup - @{ - "CollectionName" = $collectionGeneral.CollectionName; - "ActiveSessionLimitMin" = $collectionConnection.ActiveSessionLimitMin; - "AuthenticateUsingNLA" = $collectionSecurity.AuthenticateUsingNLA; - "AutomaticReconnectionEnabled" = $collectionConnection.AutomaticReconnectionEnabled; - "BrokenConnectionAction" = $collectionConnection.BrokenConnectionAction; - "ClientDeviceRedirectionOptions" = $collectionClient.ClientDeviceRedirectionOptions; - "ClientPrinterAsDefault" = $collectionClient.ClientPrinterAsDefault; - "ClientPrinterRedirected" = $collectionClient.ClientPrinterRedirected; - "CollectionDescription" = $collectionGeneral.CollectionDescription; - "CustomRdpProperty" = $collectionGeneral.CustomRdpProperty; - "DisconnectedSessionLimitMin" = $collectionGeneral.DisconnectedSessionLimitMin; - "EncryptionLevel" = $collectionSecurity.EncryptionLevel; - "IdleSessionLimitMin" = $collectionConnection.IdleSessionLimitMin; - "MaxRedirectedMonitors" = $collectionClient.MaxRedirectedMonitors; - "RDEasyPrintDriverEnabled" = $collectionClient.RDEasyPrintDriverEnabled; - "SecurityLayer" = $collectionSecurity.SecurityLayer; - "TemporaryFoldersDeletedOnExit" = $collectionConnection.TemporaryFoldersDeletedOnExit; - "UserGroup" = $collectionUserGroup.UserGroup; - } -} - - -######################################################################## -# The Set-TargetResource cmdlet. -######################################################################## -function Set-TargetResource - -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory)] - [ValidateLength(1,15)] - [string] $CollectionName, - [uint32] $ActiveSessionLimitMin, - [boolean] $AuthenticateUsingNLA, - [boolean] $AutomaticReconnectionEnabled, - [string] $BrokenConnectionAction, - [string] $ClientDeviceRedirectionOptions, - [boolean] $ClientPrinterAsDefault, - [boolean] $ClientPrinterRedirected, - [string] $CollectionDescription, - [string] $ConnectionBroker, - [string] $CustomRdpProperty, - [uint32] $DisconnectedSessionLimitMin, - [string] $EncryptionLevel, - [uint32] $IdleSessionLimitMin, - [uint32] $MaxRedirectedMonitors, - [boolean] $RDEasyPrintDriverEnabled, - [string] $SecurityLayer, - [boolean] $TemporaryFoldersDeletedOnExit, - [string] $UserGroup - ) - Write-Verbose "Setting DSC collection properties" - $discoveredCollectionName = Get-RDSessionCollection | % {Get-RDSessionHost $_.CollectionName} | ? {$_.SessionHost -ieq $localhost} | % {$_.CollectionName} - if ($collectionName -ne $discoveredCollectionName) {$PSBoundParameters.collectionName = $discoveredCollectionName} - Set-RDSessionCollectionConfiguration @PSBoundParameters -} - - -####################################################################### -# The Test-TargetResource cmdlet. -####################################################################### -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory)] - [ValidateLength(1,15)] - [string] $CollectionName, - [uint32] $ActiveSessionLimitMin, - [boolean] $AuthenticateUsingNLA, - [boolean] $AutomaticReconnectionEnabled, - [string] $BrokenConnectionAction, - [string] $ClientDeviceRedirectionOptions, - [boolean] $ClientPrinterAsDefault, - [boolean] $ClientPrinterRedirected, - [string] $CollectionDescription, - [string] $ConnectionBroker, - [string] $CustomRdpProperty, - [uint32] $DisconnectedSessionLimitMin, - [string] $EncryptionLevel, - [uint32] $IdleSessionLimitMin, - [uint32] $MaxRedirectedMonitors, - [boolean] $RDEasyPrintDriverEnabled, - [string] $SecurityLayer, - [boolean] $TemporaryFoldersDeletedOnExit, - [string] $UserGroup - ) - - Write-Verbose "Testing DSC collection properties" - $collectionName = Get-RDSessionCollection | % {Get-RDSessionHost $_.CollectionName} | ? {$_.SessionHost -ieq $localhost} | % {$_.CollectionName} - $PSBoundParameters.Remove("Verbose") | out-null - $PSBoundParameters.Remove("Debug") | out-null - $PSBoundParameters.Remove("ConnectionBroker") | out-null - $Check = $true - - $Get = Get-TargetResource -CollectionName $CollectionName - $PSBoundParameters.keys | % {if ($PSBoundParameters[$_] -ne $Get[$_]) {$Check = $false} } - $Check -} - -Export-ModuleMember -Function *-TargetResource - diff --git a/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/DSCResources/MSFT_xRDSessionCollectionConfiguration/MSFT_xRDSessionCollectionConfiguration.schema.mof b/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/DSCResources/MSFT_xRDSessionCollectionConfiguration/MSFT_xRDSessionCollectionConfiguration.schema.mof deleted file mode 100644 index 43f3a4ef..00000000 --- a/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/DSCResources/MSFT_xRDSessionCollectionConfiguration/MSFT_xRDSessionCollectionConfiguration.schema.mof +++ /dev/null @@ -1,33 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xRDSessionCollectionConfiguration")] -class MSFT_xRDSessionCollectionConfiguration : OMI_BaseResource -{ - [key, Description("Specifies the name of a session collection. ")] string CollectionName; - [write, Description("Specifies the maximum time, in minutes, an active session runs. After this period, the RD Session Host server ends the session. ")] uint32 ActiveSessionLimitMin; - [write, Description("Indicates whether to use Network Level Authentication (NLA). If this value is $True, Remote Desktop uses NLA to authenticate a user before the user sees a logon screen. ")] boolean AuthenticateUsingNLA; - [write, Description("Indicates whether the Remote Desktop client attempts to reconnect after a connection interruption. ")] boolean AutomaticReconnectionEnabled; - [write, Description("Specifies an action for an RD Session Host server to take after a connection interruption. The acceptable values for this parameter are: None, Disconnect, LogOff.")] string BrokenConnectionAction; - [write, Description("Specifies a type of client device to be redirected to an RD Session Host server in this session collection. The acceptable values for this parameter are: None, AudioVideoPlayBack, AudioRecording, COMPort, PlugAndPlayDevice, SmartCard, Clipboard, LPTPort, Drive, TimeZone. You can use binary-or to combine two or more values of this enum to specify multiple client device types.")] string ClientDeviceRedirectionOptions; - [write, Description("Indicates whether to use the client printer or server printer as the default printer. If this value is $True, use the client printer as default. If this value is $False, use the server as default.")] boolean ClientPrinterAsDefault; - [write, Description("Indicates whether to use client printer redirection, which routes print jobs from the Remote Desktop session to a printer attached to the client computer.")] boolean ClientPrinterRedirected; - [write, Description("Specifies a description of the session collection. ")] string CollectionDescription; - [write, Description("Specifies the Remote Desktop Connection Broker (RD Connection Broker) server for a Remote Desktop deployment.")] string ConnectionBroker; - [write, Description("Specifies Remote Desktop Protocol (RDP) settings to include in the .rdp files for all Windows Server 2012 RemoteApp programs and remote desktops published in this collection. ")] string CustomRdpProperty; - [write, Description("Specifies a length of time, in minutes. After client disconnection from a session for this period, the RD Session Host ends the session.")] uint32 DisconnectedSessionLimitMin; - [write, Description("Specifies the level of data encryption used for a Remote Desktop session. The acceptable values for this parameter are: Low, ClientCompatible, High, FipsCompliant. The default value is ClientCompatible.")] string EncryptionLevel; - [write, Description("Specifies the length of time, in minutes, to wait before an RD Session Host logs off or disconnects an idle session. The BrokenConnectionAction parameter determines whether to log off or disconnect. ")] uint32 IdleSessionLimitMin; - [write, Description("Specifies the maximum number of client monitors that an RD Session Host server can redirect to a remote session. The highest value for this parameter is 16.")] uint32 MaxRedirectedMonitors; - [write, Description("Specifies whether to enable the Remote Desktop Easy Print driver.")] boolean RDEasyPrintDriverEnabled; - [write, Description("Specifies which security protocol to use. The acceptable values for this parameter are: RDP, Negotiate, SSL. The default value is Negotiate.")] string SecurityLayer; - [write, Description("Specifies whether to delete temporary folders from the RD Session Host server for a disconnected session. ")] boolean TemporaryFoldersDeletedOnExit; - [write, Description("Specifies a domain group authorized to connect to the RD Session Host servers in a session collection. ")] string UserGroup; -}; - - - - - - - - - diff --git a/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/DSCResources/MSFT_xRDSessionDeployment/MSFT_xRDSessionDeployment.psm1 b/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/DSCResources/MSFT_xRDSessionDeployment/MSFT_xRDSessionDeployment.psm1 deleted file mode 100644 index 87ff0c68..00000000 --- a/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/DSCResources/MSFT_xRDSessionDeployment/MSFT_xRDSessionDeployment.psm1 +++ /dev/null @@ -1,76 +0,0 @@ -Import-Module -Name "$PSScriptRoot\..\..\xRemoteDesktopSessionHostCommon.psm1" -if (!(Test-xRemoteDesktopSessionHostOsRequirement)) { Throw "The minimum OS requirement was not met."} -Import-Module RemoteDesktop - -####################################################################### -# The Get-TargetResource cmdlet. -####################################################################### -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory)] - [string] $SessionHost, - [parameter(Mandatory)] - [string] $ConnectionBroker, - [parameter(Mandatory)] - [string] $WebAccessServer - ) - Write-Verbose "Getting list of RD Server roles." - $Deployed = Get-RDServer -ErrorAction SilentlyContinue - @{ - "SessionHost" = $Deployed | ? Roles -contains "RDS-RD-SERVER" | % Server; - "ConnectionBroker" = $Deployed | ? Roles -contains "RDS-CONNECTION-BROKER" | % Server; - "WebAccessServer" = $Deployed | ? Roles -contains "RDS-WEB-ACCESS" | % Server; - } -} - - -######################################################################## -# The Set-TargetResource cmdlet. -######################################################################## -function Set-TargetResource - -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory)] - [string] $SessionHost, - [parameter(Mandatory)] - [string] $ConnectionBroker, - [parameter(Mandatory)] - [string] $WebAccessServer - ) - - Write-Verbose "Initiating new RDSH deployment." - New-RDSessionDeployment @PSBoundParameters - $global:DSCMachineStatus = 1 -} - - -####################################################################### -# The Test-TargetResource cmdlet. -####################################################################### -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory)] - [string] $SessionHost, - [parameter(Mandatory)] - [string] $ConnectionBroker, - [parameter(Mandatory)] - [string] $WebAccessServer - ) - Write-Verbose "Checking RDSH role is deployed on this node." - (Get-TargetResource @PSBoundParameters).SessionHost -ieq $SessionHost -} - - -Export-ModuleMember -Function *-TargetResource - diff --git a/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/DSCResources/MSFT_xRDSessionDeployment/MSFT_xRDSessionDeployment.schema.mof b/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/DSCResources/MSFT_xRDSessionDeployment/MSFT_xRDSessionDeployment.schema.mof deleted file mode 100644 index ad5beaf0..00000000 --- a/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/DSCResources/MSFT_xRDSessionDeployment/MSFT_xRDSessionDeployment.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xRDSessionDeployment")] -class MSFT_xRDSessionDeployment : OMI_BaseResource -{ - [key, Description("Specifies the FQDN of a server to host the RD Session Host role service. ")] string SessionHost; - [key, Description("Specifies the FQDN of a server to host the RD Connection Broker role service.")] string ConnectionBroker; - [key, Description("Specifies the FQDN of a server to host the RD Web Access role service. ")] string WebAccessServer; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/LICENSE b/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/xRemoteDesktopSessionHost.psd1 b/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/xRemoteDesktopSessionHost.psd1 deleted file mode 100644 index 2eb6bb36..00000000 --- a/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/xRemoteDesktopSessionHost.psd1 +++ /dev/null @@ -1,61 +0,0 @@ -@{ -# Version number of this module. -ModuleVersion = '1.4.0.0' - -# ID used to uniquely identify this module -GUID = 'b42ff085-bd2b-4232-90ba-02b4c780e2d9' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'Module with DSC Resources for Remote Desktop Session Host' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Minimum version of the common language runtime (CLR) required by this module -CLRVersion = '4.0' - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -RootModule = 'xRemoteDesktopSessionHostCommon.psm1' - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/xRemoteDesktopSessionHost/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/xRemoteDesktopSessionHost' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - ReleaseNotes = '* Updated CollectionName parameter to validate length between 1 and 15 characters, and added tests to verify. - -' - - } # End of PSData hashtable - -} # End of PrivateData hashtable -} - - diff --git a/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/xRemoteDesktopSessionHostCommon.psm1 b/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/xRemoteDesktopSessionHostCommon.psm1 deleted file mode 100644 index 83aab734..00000000 --- a/lib/puppet_x/dsc_resources/xRemoteDesktopSessionHost/xRemoteDesktopSessionHostCommon.psm1 +++ /dev/null @@ -1,12 +0,0 @@ -function Test-xRemoteDesktopSessionHostOsRequirement -{ - return (Get-OsVersion) -ge (new-object 'Version' 6,2,9200,0) -} - -function Get-OsVersion -{ - return [Environment]::OSVersion.Version -} -Export-ModuleMember -Function @( - 'Test-xRemoteDesktopSessionHostOsRequirement' -) diff --git a/lib/puppet_x/dsc_resources/xRobocopy/DSCResources/MSFT_xRobocopy/MSFT_xRobocopy.psm1 b/lib/puppet_x/dsc_resources/xRobocopy/DSCResources/MSFT_xRobocopy/MSFT_xRobocopy.psm1 deleted file mode 100644 index 2b4df647..00000000 --- a/lib/puppet_x/dsc_resources/xRobocopy/DSCResources/MSFT_xRobocopy/MSFT_xRobocopy.psm1 +++ /dev/null @@ -1,301 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Source, - - [parameter(Mandatory = $true)] - [System.String] - $Destination, - - [System.String] - $Files, - - [System.UInt32] - $Retry, - - [System.UInt32] - $Wait, - - [System.Boolean] - $SubdirectoriesIncludingEmpty = $False, - - [System.Boolean] - $Restartable = $False, - - [System.Boolean] - $MultiThreaded = $False, - - [System.String] - $ExcludeFiles, - - [System.String] - $LogOutput, - - [System.Boolean] - $AppendLog = $False, - - [System.String[]] - $AdditionalArgs - ) - - $result = Test-TargetResource $Source $Destination $Files $Retry $Wait $SubdirectoriesIncludingEmpty $Restartable $MultiThreaded $ExcludeFiles $LogOutput $AppendLog $AdditionalArgs - $ensure = 'Absent' - if($result -eq $true) - { - $ensure = 'Present' - } - - $returnValue = @{ - Source = $Source - Destination = $Destination - Files = $Files - Retry = $Retry - Wait = $Wait - SubdirectoriesIncludingEmpty = $SubdirectoriesIncludingEmpty - Restartable = $Restartable - MultiThreaded = $MultiThreaded - ExcludeFiles = $ExcludeFiles - LogOutput = $LogOutput - AppendLog = $AppendLog - AdditionalArgs = $AdditionalArgs - Ensure = $ensure - } - - return $returnValue -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Source, - - [parameter(Mandatory = $true)] - [System.String] - $Destination, - - [System.String] - $Files, - - [System.UInt32] - $Retry, - - [System.UInt32] - $Wait, - - [System.Boolean] - $SubdirectoriesIncludingEmpty = $False, - - [System.Boolean] - $Restartable = $False, - - [System.Boolean] - $MultiThreaded = $False, - - [System.String] - $ExcludeFiles, - - [System.String] - $LogOutput, - - [System.Boolean] - $AppendLog = $False, - - [System.String[]] - $AdditionalArgs - ) - - $arguments = Get-RobocopyArguments $Source $Destination $Files $Retry $Wait $SubdirectoriesIncludingEmpty $Restartable $MultiThreaded $ExcludeFiles $LogOutput $AppendLog $AdditionalArgs - - Write-Verbose "Executing robocopy.exe with: $arguments" - &robocopy $arguments | Out-Null - if($LASTEXITCODE -ge 8) - { - throw "robocopy returned with errors! Exit code: $LASTEXITCODE! More info here:https://support.microsoft.com/en-us/kb/954404" - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Source, - - [parameter(Mandatory = $true)] - [System.String] - $Destination, - - [System.String] - $Files, - - [System.UInt32] - $Retry, - - [System.UInt32] - $Wait, - - [System.Boolean] - $SubdirectoriesIncludingEmpty = $False, - - [System.Boolean] - $Restartable = $False, - - [System.Boolean] - $MultiThreaded = $False, - - [System.String] - $ExcludeFiles, - - [System.String] - $LogOutput, - - [System.Boolean] - $AppendLog = $False, - - [System.String[]] - $AdditionalArgs - ) - - $arguments = Get-RobocopyArguments $Source $Destination $Files $Retry $Wait $SubdirectoriesIncludingEmpty $Restartable $MultiThreaded $ExcludeFiles $LogOutput $AppendLog $AdditionalArgs - - if(!$arguments.Contains('/L') -and !$arguments.Contains('/l')) - { - $arguments += '/L' - } - - &robocopy $arguments | Out-Null - - # https://support.microsoft.com/en-us/kb/954404 - # ROBOCOPY $LASTEXITCODE is a bitflag: - # 0: Source and destination are completely synchronized - # 1: One or more files were copied successfully (new files present) - # 2: extra files/directories detected - # 4: mismatched files/directories - # 8: copy errors and retries exceeded - # 16: serious error - if ($LASTEXITCODE -ge 1 -and $LASTEXITCODE -lt 8) - { - Write-Verbose "Source and destination are out of sync" - $result = $false - } - elseif ($LASTEXITCODE -eq 0) - { - Write-Verbose "Source and destination are completely synchronized" - $result = $true - } - else - { - throw "robocopy returned with errors! Exit code: $result! More info here:https://support.microsoft.com/en-us/kb/954404" - } - - return $result -} - -# Helper Functions -function Get-RobocopyArguments -{ - [CmdletBinding()] - [OutputType([System.String[]])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Source, - - [parameter(Mandatory = $true)] - [System.String] - $Destination, - - [System.String] - $Files, - - [System.UInt32] - $Retry, - - [System.UInt32] - $Wait, - - [System.Boolean] - $SubdirectoriesIncludingEmpty, - - [System.Boolean] - $Restartable, - - [System.Boolean] - $MultiThreaded, - - [System.String] - $ExcludeFiles, - - [System.String] - $LogOutput, - - [System.Boolean] - $AppendLog, - - [System.String[]] - $AdditionalArgs - ) - - [System.String[]]$arguments = @($Source, $Destination) - if($Files) - { - $arguments += $Files - } - if ($Retry) - { - $arguments += "/R:$Retry" - } - if ($Wait) - { - $arguments += "/W:$Wait" - } - if ($SubdirectoriesIncludingEmpty) - { - $arguments += '/E' - } - if ($Restartable) - { - $arguments += '/Z' - } - if ($MultiThreaded) - { - $arguments += '/MT' - } - if ($ExcludeFiles) - { - $arguments += @('/XF', $ExcludeFiles) - } - if ($ExcludeDirs) - { - $arguments += @('/XD', $ExcludeDirs) - } - if ($LogOutput -AND $AppendLog) - { - $arguments += "/LOG+:$LogOutput" - } - if ($LogOutput -AND !$AppendLog) - { - $arguments += "/LOG:$LogOutput" - } - if ($AdditionalArgs) - { - $arguments += $AdditionalArgs - } - - return $arguments -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xRobocopy/DSCResources/MSFT_xRobocopy/MSFT_xRobocopy.schema.mof b/lib/puppet_x/dsc_resources/xRobocopy/DSCResources/MSFT_xRobocopy/MSFT_xRobocopy.schema.mof deleted file mode 100644 index e1e278e7..00000000 --- a/lib/puppet_x/dsc_resources/xRobocopy/DSCResources/MSFT_xRobocopy/MSFT_xRobocopy.schema.mof +++ /dev/null @@ -1,18 +0,0 @@ -[ClassVersion("0.1.0.0"), FriendlyName("xRobocopy")] -class MSFT_xRobocopy : OMI_BaseResource -{ - [Key, Description("Source Directory, Drive or UNC path.")] String Source; - [Key, Description("Destination Dir, Drive or UNC path.")] String Destination; - [Write, Description("File(s) to copy (names/wildcards: default is all files).")] String Files; - [Write, Description("Number of Retries on failed copies: default 1 million.")] UInt32 Retry; - [Write, Description("Wait time between retries: default is 30 seconds.")] UInt32 Wait; - [Write, Description("Copy subdirectories, including Empty ones.")] Boolean SubdirectoriesIncludingEmpty; - [Write, Description("Copy files in restartable mode.")] Boolean Restartable; - [Write, Description("Do multi-threaded copies with n threads (default 8). N must be at least 1 and not greater than 128. This option is incompatible with the /IPG and /EFSRAW options. Redirect output using /LOG option for better performance.")] Boolean MultiThreaded; - [Write, Description("Exclude Files matching given names/paths/wildcards.")] String ExcludeFiles; - [Write, Description("Output status to LOG file.")] String LogOutput; - [Write, Description("Determine whether to overwrite log file or append.")] Boolean AppendLog; - [Write, Description("Robocopy has MANY configuration options. Too many to present them all as DSC parameters effectively. Use this option to set additional parameters. Each parameter should be a separate array member. This array will be combined with main argument array. For a list of options run Robocopy /??? in a shell window.")] String AdditionalArgs[]; - [Read, ValueMap{"Present", "Absent"}, Values{"Present", "Absent"}, Description("Will indicate whether Destination is in sync with Source")] String Ensure; -}; - diff --git a/lib/puppet_x/dsc_resources/xRobocopy/LICENSE b/lib/puppet_x/dsc_resources/xRobocopy/LICENSE deleted file mode 100644 index 5f178f93..00000000 --- a/lib/puppet_x/dsc_resources/xRobocopy/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Michael Greene - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - diff --git a/lib/puppet_x/dsc_resources/xRobocopy/Resources/xDscResourceDesigner_CreateScript.ps1 b/lib/puppet_x/dsc_resources/xRobocopy/Resources/xDscResourceDesigner_CreateScript.ps1 deleted file mode 100644 index a85abd93..00000000 --- a/lib/puppet_x/dsc_resources/xRobocopy/Resources/xDscResourceDesigner_CreateScript.ps1 +++ /dev/null @@ -1,162 +0,0 @@ -$modules = 'C:\Program Files\WindowsPowerShell\Modules\' -$modulename = 'xRobocopy' -$Description = 'This module is used to facilitate large file copies with complex requirements such as multithreading, restarts, and exclusions when recursing content.' - -if (!(test-path (join-path $modules $modulename))) { - - $modulefolder = mkdir (join-path $modules $modulename) - New-ModuleManifest -Path (join-path $modulefolder "$modulename.psd1") -Guid $([system.guid]::newguid().guid) -Author 'PowerShell DSC' -CompanyName 'Microsoft Corporation' -Copyright '2015' -ModuleVersion '0.1.0.0' -Description $Description -PowerShellVersion '4.0' - - $standard = @{ModuleName = $modulename - ClassVersion = '0.1.0.0' - Path = $modules - } - $P1 = @() - $P1 += New-xDscResourceProperty -Name Source -Type String -Attribute Key -Description 'Source Directory, Drive or UNC path.' - $P1 += New-xDscResourceProperty -Name Destination -Type String -Attribute Key -Description 'Destination Dir, Drive or UNC path.' - $P1 += New-xDscResourceProperty -Name Files -Type String -Attribute Write -Description 'File(s) to copy (names/wildcards: default is all files).' - $P1 += New-xDscResourceProperty -Name Retry -Type UInt32 -Attribute Write -Description 'Number of Retries on failed copies: default 1 million.' - $P1 += New-xDscResourceProperty -Name Wait -Type UInt32 -Attribute Write -Description 'Wait time between retries: default is 30 seconds.' - $P1 += New-xDscResourceProperty -Name SubdirectoriesIncludingEmpty -Type Boolean -Attribute Write -Description 'Copy subdirectories, including Empty ones.' - $P1 += New-xDscResourceProperty -Name Restartable -Type Boolean -Attribute Write -Description 'Copy files in restartable mode.' - $P1 += New-xDscResourceProperty -Name MultiThreaded -Type Boolean -Attribute Write -Description 'Do multi-threaded copies with n threads (default 8). N must be at least 1 and not greater than 128. This option is incompatible with the /IPG and /EFSRAW options. Redirect output using /LOG option for better performance.' - $P1 += New-xDscResourceProperty -Name ExcludeFiles -Type String -Attribute Write -Description 'Exclude Files matching given names/paths/wildcards.' - $P1 += New-xDscResourceProperty -Name LogOutput -Type String -Attribute Write -Description 'Output status to LOG file.' - $P1 += New-xDscResourceProperty -Name AppendLog -Type Boolean -Attribute Write -Description 'Determine whether to overwrite log file or append.' - $P1 += New-xDscResourceProperty -Name AdditionalArgs -Type String -Attribute Write -Description 'Robocopy has MANY configuration options. Too many to present them all as DSC parameters effectively. Use this option to set additional parameters. The string will be appended to the arguements list. For a list of options run Robocopy /??? in a shell window.' - New-xDscResource -Name MSFT_xRobocopy -Property $P1 -FriendlyName xRobocopy @standard -} - - -# Markdown Generator # -# This is a first draft. Expected to become 100% efficient in future version. Loop resources, import example from script, etc. - -if (!(test-path "$modules\$modulename\Resources\")){mkdir "$modules\$modulename\Resources\"} - -$MD = @" -Introduction -============ - -The **$ModuleName** module is a part of the Windows PowerShell Desired State Configuration (DSC) Resource Kit, which is a collection of DSC Resources. $Description, with simple declarative language. - -**All of the resources in the DSC Resource Kit are provided AS IS, and are not supported through any Microsoft standard support program or service. The "x" in $ModuleName stands for experimental**, which means that these resources will be **fix forward** and monitored by the module owner(s). - -Please leave comments, feature requests, and bug reports in the Q & A tab for -this module. - -If you would like to modify the **$ModuleName** module, feel free. When modifying, please update the module name, resource friendly name, and MOF class name (instructions below). As specified in the license, you may copy or modify this resource as long as they are used on the Windows Platform. - -For more information about Windows PowerShell Desired State Configuration, check out the blog posts on the [PowerShell Blog](http://blogs.msdn.com/b/powershell/) ([this](http://blogs.msdn.com/b/powershell/archive/2013/11/01/configuration-in-a-devops-world-windows-powershell-desired-state-configuration.aspx) is a good starting point). There are also great community resources, such as [PowerShell.org](http://powershell.org/wp/tag/dsc/), or [PowerShell Magazine](http://www.powershellmagazine.com/tag/dsc/). For more information on the DSC Resource Kit, checkout [this blog post](http://go.microsoft.com/fwlink/?LinkID=389546). - -Installation ------------- - -To install **$ModuleName** module - -- If you are using WMF4 / PowerShell Version 4: Unzip the content under the $env:ProgramFiles\WindowsPowerShell\Modules folder - -- If you are using WMF5 Preview: From an elevated PowerShell session run "Install-Module $ModuleName" - -To confirm installation - -- Run Get-DSCResource to see that the resources listed above are among the DSC Resources displayed - -Requirements ------------- - -This module requires the latest version of PowerShell (v4.0, which ships in -Windows 8.1 or Windows Server 2012R2). To easily use PowerShell 4.0 on older -operating systems, install WMF 4.0. Please read the installation instructions -that are present on both the download page and the release notes for WMF 4.0. - -Details -------- -**$Resource1** resource has following properties - -"@ -foreach ($res in $P1) {$MD += @" -- **$($res.Name)**: $($res.Description) - -"@ -} -$MD += @" - -Renaming Requirements ---------------------- - -When making changes to these resources, we suggest the following practice - -1. Update the following names by replacing MSFT with your company/community name -and replacing the **"x" with **"c" (short for "Community") or another prefix of your -choice - - Module name (ex: xModule becomes cModule) - - Resource folder (ex: MSFT\_xResource becomes Contoso\_xResource) - - Resource Name (ex: MSFT\_xResource becomes Contoso\_cResource) - - Resource Friendly Name (ex: xResource becomes cResource) - - MOF class name (ex: MSFT\_xResource becomes Contoso\_cResource) - - Filename for the .schema.mof (ex: MSFT\_xResource.schema.mof becomes Contoso\_cResource.schema.mof) - -2. Update module and metadata information in the module manifest -3. Update any configuration that use these resources - -We reserve resource and module names without prefixes ("x" or "c") for future use (e.g. "MSFT_Resource"). If the next version of Windows Server ships with a "WindowsEventForwarding" resource, we don't want to break any configurations that use any community modifications. Please keep a prefix such as "c" on all community modifications. - -Versions --------- - -**0.1.0.0** - -- Initial release with the following resources -"@ -foreach ($res in $P1) {$MD += @" - - $($res.Name) - -"@ - } -$MD += @' - -Examples --------- - -**Example 1**: Copy a directory from one location to another with multithreading and restartable mode. Note that this example is using PSRunAsCredential which is a common parameter only available in WMF5 and later. -```powershell - configuration DeployContent - { - param ( - [Parameter(Mandatory=$true)] - [ValidateNotNullorEmpty()] - [PsCredential] $Credential - ) - - Import-DscResource -ModuleName xRobocopy - Node 'localhost' - { - xRobocopy Content - { - Source = '\\server\share\ReleaseVersion' - Destination = 'C:\inetpub\wwwroot\sitename' - Multithread = $true - Restartable = $true - PSRunAsCredential = $Credential - } - } - } - $configData = @{ - AllNodes = @( - @{ - NodeName = 'localhost'; - CertificateId = 'Your Certificate thumbprint here' - } - ) - } - DeployContent -ConfigurationData $configData -Credential (get-credential) -OutputPath 'c:\DSC' - Start-DscConfiguration -Wait -Force -Verbose -Path 'c:\DSC' - - # Validate results - Get-ChildItem C:\inetpub\wwwroot\sitename -``` - -## Contributing -Please check out common DSC Resources [contributing guidelines](https://github.com/PowerShell/DscResource.Kit/blob/master/CONTRIBUTING.md). -'@ -$MD | Out-File "$modules\$modulename\Resources\ReadMe.md" diff --git a/lib/puppet_x/dsc_resources/xRobocopy/xRobocopy.psd1 b/lib/puppet_x/dsc_resources/xRobocopy/xRobocopy.psd1 deleted file mode 100644 index e67917ac..00000000 --- a/lib/puppet_x/dsc_resources/xRobocopy/xRobocopy.psd1 +++ /dev/null @@ -1,126 +0,0 @@ -# -# Module manifest for module 'xRobocopy' -# -# Generated by: PowerShell DSC -# -# Generated on: 6/15/2015 -# - -@{ - -# Script module or binary module file associated with this manifest. -# RootModule = '' - -# Version number of this module. -ModuleVersion = '2.0.0.0' - -# ID used to uniquely identify this module -GUID = '3c743236-35b8-4225-b76b-5e6117c0e477' - -# Author of this module -Author = 'PowerShell DSC' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '2015' - -# Description of the functionality provided by this module -Description = 'This module is used to facilitate large file copies with complex requirements such as multithreading, restarts, and exclusions when recursing content.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Name of the Windows PowerShell host required by this module -# PowerShellHostName = '' - -# Minimum version of the Windows PowerShell host required by this module -# PowerShellHostVersion = '' - -# Minimum version of Microsoft .NET Framework required by this module -# DotNetFrameworkVersion = '' - -# Minimum version of the common language runtime (CLR) required by this module -# CLRVersion = '' - -# Processor architecture (None, X86, Amd64) required by this module -# ProcessorArchitecture = '' - -# Modules that must be imported into the global environment prior to importing this module -# RequiredModules = @() - -# Assemblies that must be loaded prior to importing this module -# RequiredAssemblies = @() - -# Script files (.ps1) that are run in the caller's environment prior to importing this module. -# ScriptsToProcess = @() - -# Type files (.ps1xml) to be loaded when importing this module -# TypesToProcess = @() - -# Format files (.ps1xml) to be loaded when importing this module -# FormatsToProcess = @() - -# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess -# NestedModules = @() - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Variables to export from this module -VariablesToExport = '*' - -# Aliases to export from this module -AliasesToExport = '*' - -# DSC resources to export from this module -# DscResourcesToExport = @() - -# List of all modules packaged with this module -# ModuleList = @() - -# List of all files packaged with this module -# FileList = @() - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/xRobocopy/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/xRobocopy' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - ReleaseNotes = '* Improved Test-TargetResource method to run robocopy with the same parameters as in Set-TargetResource -* Bug fix in Test-TargetResource when evaluating return code from robocopy -* Updated example to use correct PsDscRunAsCredential parameter -* **Breaking Change:** Changed AditionalArgs parameter to Array of String -* Added additional examples with different copy options. - -' - - } # End of PSData hashtable - -} # End of PrivateData hashtable - -# HelpInfo URI of this module -# HelpInfoURI = '' - -# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. -# DefaultCommandPrefix = '' - -} - diff --git a/lib/puppet_x/dsc_resources/xSCDPM/DSCResources/MSFT_xSCDPMConsoleSetup/MSFT_xSCDPMConsoleSetup.psm1 b/lib/puppet_x/dsc_resources/xSCDPM/DSCResources/MSFT_xSCDPMConsoleSetup/MSFT_xSCDPMConsoleSetup.psm1 deleted file mode 100644 index d4dac30c..00000000 --- a/lib/puppet_x/dsc_resources/xSCDPM/DSCResources/MSFT_xSCDPMConsoleSetup/MSFT_xSCDPMConsoleSetup.psm1 +++ /dev/null @@ -1,184 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\DataProtectionManager", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "SCDPM\setup.exe" - if(!(Test-Path -Path $Path)) - { - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "setup.exe" - } - $Path = ResolvePath $Path - $Version = (Get-Item -Path $Path).VersionInfo.ProductVersion - - switch($Version) - { - "4.2.1205.0" - { - $IdentifyingNumber = "{DFF93860-2113-4207-A7AC-3901ABCE8002}" - } - "4.3.1012.0" - { - $IdentifyingNumber = "{846183DF-CF1D-4310-BA7A-EF5EFE46616A}" - } - Default - { - throw "Unknown version of Data Protection Manager!" - } - } - - if(Get-WmiObject -Class Win32_Product | Where-Object {$_.IdentifyingNumber -eq $IdentifyingNumber}) - { - $returnValue = @{ - Ensure = "Present" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - } - } - else - { - $returnValue = @{ - Ensure = "Absent" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\DataProtectionManager", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "SCDPM\setup.exe" - if(!(Test-Path -Path $Path)) - { - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "setup.exe" - } - $Path = ResolvePath $Path - - $Version = (Get-Item -Path $Path).VersionInfo.ProductVersion - - switch($Version) - { - "4.2.1205.0" - { - $IdentifyingNumber = "{DFF93860-2113-4207-A7AC-3901ABCE8002}" - } - "4.3.1012.0" - { - $IdentifyingNumber = "{846183DF-CF1D-4310-BA7A-EF5EFE46616A}" - } - Default - { - throw "Unknown version of Data Protection Manager!" - } - } - - $Path = ResolvePath "msiexec.exe" - switch($Ensure) - { - "Present" - { - $MSIPath = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "\SCDPM\DPM2012\dpmcli\dpmui.msi" - $Arguments = "/q /i $MSIPath ALLUSERS=2 BOOTSTRAPPED=1" - } - "Absent" - { - $Arguments = "" - } - } - - Write-Verbose "Path: $Path" - Write-Verbose "Arguments: $Arguments" - - $Process = StartWin32Process -Path $Path -Arguments $Arguments -Credential $SetupCredential - Write-Verbose $Process - WaitForWin32ProcessEnd -Path $Path -Arguments $Arguments -Credential $SetupCredential - - if(Test-Path -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations') - { - $global:DSCMachineStatus = 1 - } - else - { - if(!(Test-TargetResource @PSBoundParameters)) - { - throw "Set-TargetResouce failed" - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\DataProtectionManager", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - $result = ((Get-TargetResource @PSBoundParameters).Ensure -eq $Ensure) - - $result -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSCDPM/DSCResources/MSFT_xSCDPMConsoleSetup/MSFT_xSCDPMConsoleSetup.schema.mof b/lib/puppet_x/dsc_resources/xSCDPM/DSCResources/MSFT_xSCDPMConsoleSetup/MSFT_xSCDPMConsoleSetup.schema.mof deleted file mode 100644 index 0d6cb703..00000000 --- a/lib/puppet_x/dsc_resources/xSCDPM/DSCResources/MSFT_xSCDPMConsoleSetup/MSFT_xSCDPMConsoleSetup.schema.mof +++ /dev/null @@ -1,8 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSCDPMConsoleSetup")] -class MSFT_xSCDPMConsoleSetup : OMI_BaseResource -{ - [Key, Description("An enumerated value that describes if the DPM console is expected to be installed on the machine.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Required, Description("UNC path to the root of the source files for installation.")] String SourcePath; - [Write, Description("Folder within the source path containing the source files for installation.")] String SourceFolder; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the installation.")] String SetupCredential; -}; diff --git a/lib/puppet_x/dsc_resources/xSCDPM/DSCResources/MSFT_xSCDPMDatabaseServerSetup/MSFT_xSCDPMDatabaseServerSetup.psm1 b/lib/puppet_x/dsc_resources/xSCDPM/DSCResources/MSFT_xSCDPMDatabaseServerSetup/MSFT_xSCDPMDatabaseServerSetup.psm1 deleted file mode 100644 index a459d969..00000000 --- a/lib/puppet_x/dsc_resources/xSCDPM/DSCResources/MSFT_xSCDPMDatabaseServerSetup/MSFT_xSCDPMDatabaseServerSetup.psm1 +++ /dev/null @@ -1,178 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\DataProtectionManager", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "SCDPM\SQLPrepInstaller\SQLPrepInstaller_x64.exe" - if(!(Test-Path -Path $Path)) - { - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "SQLPrepInstaller\SQLPrepInstaller_x64.exe" - } - $Path = ResolvePath $Path - $Version = (Get-Item -Path $Path).VersionInfo.FileVersion - - switch($Version) - { - "4.2.1205.0" - { - $IdentifyingNumber = "{1CAEC48E-A90B-4AA2-BB81-ACAA3795430D}" - } - "4.3.1012.0" - { - $IdentifyingNumber = "{47FC5EEB-8197-4D77-8131-3FBA29508825}" - } - Default - { - throw "Unknown version of Data Protection Manager!" - } - } - - if(Get-WmiObject -Class Win32_Product | Where-Object {$_.IdentifyingNumber -eq $IdentifyingNumber}) - { - $returnValue = @{ - Ensure = "Present" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - } - } - else - { - $returnValue = @{ - Ensure = "Absent" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\DataProtectionManager", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "SCDPM\SQLPrepInstaller\SQLPrepInstaller_x64.exe" - if(!(Test-Path -Path $Path)) - { - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "SQLPrepInstaller\SQLPrepInstaller_x64.exe" - } - $Path = ResolvePath $Path - $Version = (Get-Item -Path $Path).VersionInfo.FileVersion - - switch($Version) - { - "4.2.1205.0" - { - $IdentifyingNumber = "{1CAEC48E-A90B-4AA2-BB81-ACAA3795430D}" - } - "4.3.1012.0" - { - $IdentifyingNumber = "{47FC5EEB-8197-4D77-8131-3FBA29508825}" - } - Default - { - throw "Unknown version of Data Protection Manager!" - } - } - - switch($Ensure) - { - "Present" - { - $Arguments = "/q" - } - "Absent" - { - $Path = "msiexec.exe" - $Path = ResolvePath $Path - - $Arguments = "/qn /x $IdentifyingNumber" - } - } - - Write-Verbose "Path: $Path" - Write-Verbose "Arguments: $Arguments" - - $Process = StartWin32Process -Path $Path -Arguments $Arguments -Credential $SetupCredential - Write-Verbose $Process - WaitForWin32ProcessEnd -Path $Path -Arguments $Arguments -Credential $SetupCredential - - if(Test-Path -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations') - { - $global:DSCMachineStatus = 1 - } - else - { - if(!(Test-TargetResource -SourcePath $SourcePath -SourceFolder $SourceFolder -SetupCredential $SetupCredential)) - { - throw "Set-TargetResouce failed" - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\DataProtectionManager", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - - $result = ((Get-TargetResource -SourcePath $SourcePath -SourceFolder $SourceFolder -SetupCredential $SetupCredential).Ensure -eq $Ensure) - - $result -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSCDPM/DSCResources/MSFT_xSCDPMDatabaseServerSetup/MSFT_xSCDPMDatabaseServerSetup.schema.mof b/lib/puppet_x/dsc_resources/xSCDPM/DSCResources/MSFT_xSCDPMDatabaseServerSetup/MSFT_xSCDPMDatabaseServerSetup.schema.mof deleted file mode 100644 index 6f572211..00000000 --- a/lib/puppet_x/dsc_resources/xSCDPM/DSCResources/MSFT_xSCDPMDatabaseServerSetup/MSFT_xSCDPMDatabaseServerSetup.schema.mof +++ /dev/null @@ -1,8 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSCDPMDatabaseServerSetup")] -class MSFT_xSCDPMDatabaseServerSetup : OMI_BaseResource -{ - [Write, Description("An enumerated value that describes if the DPM database support files are expected to be installed on the machine.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Key, Description("UNC path to the root of the source files for installation.")] String SourcePath; - [Write, Description("Folder within the source path containing the source files for installation.")] String SourceFolder; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the installation.")] String SetupCredential; -}; diff --git a/lib/puppet_x/dsc_resources/xSCDPM/DSCResources/MSFT_xSCDPMServerSetup/MSFT_xSCDPMServerSetup.psm1 b/lib/puppet_x/dsc_resources/xSCDPM/DSCResources/MSFT_xSCDPMServerSetup/MSFT_xSCDPMServerSetup.psm1 deleted file mode 100644 index a1e3f44c..00000000 --- a/lib/puppet_x/dsc_resources/xSCDPM/DSCResources/MSFT_xSCDPMServerSetup/MSFT_xSCDPMServerSetup.psm1 +++ /dev/null @@ -1,373 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\DataProtectionManager", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.String] - $UserName, - - [System.String] - $CompanyName, - - [System.String] - $ProductKey, - - [System.String] - $ProgramFiles, - - [parameter(Mandatory = $true)] - [System.String] - $YukonMachineName, - - [parameter(Mandatory = $true)] - [System.String] - $YukonInstanceName, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $YukonMachineCredential, - - [parameter(Mandatory = $true)] - [System.String] - $ReportingMachineName, - - [parameter(Mandatory = $true)] - [System.String] - $ReportingInstanceName, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $ReportingMachineCredential - ) - - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "SCDPM\setup.exe" - if(!(Test-Path -Path $Path)) - { - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "setup.exe" - } - $Path = ResolvePath $Path - $Version = (Get-Item -Path $Path).VersionInfo.ProductVersion - - switch($Version) - { - "4.2.1205.0" - { - $IdentifyingNumber = "{99EFD904-A89C-4116-91C9-80FD7FD40DA7}" - } - "4.3.1012.0" - { - $IdentifyingNumber = "{F8CD20E6-186D-4F7D-AAAB-5A3190DA8356}" - } - Default - { - throw "Unknown version of Data Protection Manager!" - } - } - - if(Get-WmiObject -Class Win32_Product | Where-Object {$_.IdentifyingNumber -eq $IdentifyingNumber}) - { - $UserName = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft Data Protection Manager\Setup" -Name "RegisteredUserName").RegisteredUserName - $CompanyName = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft Data Protection Manager\Setup" -Name "RegisteredOrgName").RegisteredOrgName - $ProgramFiles = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft Data Protection Manager\Setup" -Name "InstallPath").InstallPath - $YukonMachineName = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft Data Protection Manager\DB" -Name "SqlServer").SqlServer - $YukonInstanceName = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft Data Protection Manager\DB" -Name "InstanceName").InstanceName - $ReportingMachineName = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft Data Protection Manager\DB" -Name "ReportingServer").ReportingServer - $ReportingInstanceName = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft Data Protection Manager\DB" -Name "ReportingInstanceName").ReportingInstanceName - - $returnValue = @{ - Ensure = "Present" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - UserName = $UserName - CompanyName = $CompanyName - ProgramFiles = $ProgramFiles - YukonMachineName = $YukonMachineName - YukonInstanceName = $YukonInstanceName - ReportingMachineName = $ReportingMachineName - ReportingInstanceName = $ReportingInstanceName - } - } - else - { - $returnValue = @{ - Ensure = "Absent" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\DataProtectionManager", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.String] - $UserName = "UserName", - - [System.String] - $CompanyName = "CompanyName", - - [System.String] - $ProductKey, - - [System.String] - $ProgramFiles, - - [parameter(Mandatory = $true)] - [System.String] - $YukonMachineName, - - [parameter(Mandatory = $true)] - [System.String] - $YukonInstanceName, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $YukonMachineCredential, - - [parameter(Mandatory = $true)] - [System.String] - $ReportingMachineName, - - [parameter(Mandatory = $true)] - [System.String] - $ReportingInstanceName, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $ReportingMachineCredential - ) - - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "SCDPM\setup.exe" - if(!(Test-Path -Path $Path)) - { - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "setup.exe" - } - $Path = ResolvePath $Path - - $Version = (Get-Item -Path $Path).VersionInfo.ProductVersion - - switch($Version) - { - "4.2.1205.0" - { - $IdentifyingNumber = "{99EFD904-A89C-4116-91C9-80FD7FD40DA7}" - } - "4.3.1012.0" - { - $IdentifyingNumber = "{F8CD20E6-186D-4F7D-AAAB-5A3190DA8356}" - } - Default - { - throw "Unknown version of Data Protection Manager!" - } - } - - if ($PSBoundParameters.ContainsKey("ProgramFiles") -and (!($ProgramFiles -contains "%ProgramFiles%"))) - { - $ProgramFiles = $ProgramFiles.Replace("\Microsoft System Center 2012 R2\DPM","") - } - else - { - $ProgramFiles = [Environment]::ExpandEnvironmentVariables($ProgramFiles) - } - if($PSBoundParameters.ContainsKey("ProductKey")) - { - $autorun = Get-Content (Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "autorun.inf") - if ($autorun -contains "sku=evaluation") - { - Throw "ProductKey cannot be used with evaluation media!" - } - } - $TempFile = [IO.Path]::GetTempFileName() - $INIFile = @() - $INIFile += "[Options]" - $INIFileVars = @( - "UserName", - "CompanyName", - "ProductKey", - "ProgramFiles", - "YukonInstanceName", - "ReportingInstanceName" - ) - foreach($INIFileVar in $INIFileVars) - { - if((Get-Variable -Name $INIFileVar).Value -ne "") - { - $INIFile += "$INIFileVar=" + (Get-Variable -Name $INIFileVar).Value - } - } - $INIFileVars = @( - "YukonMachineName", - "ReportingMachineName" - ) - foreach($INIFileVar in $INIFileVars) - { - if((Get-Variable -Name $INIFileVar).Value -ne "") - { - $INIFile += "$INIFileVar=" + (Get-Variable -Name $INIFileVar).Value.Split(".")[0] - } - } - $AccountVars = @("YukonMachineCredential","ReportingMachineCredential") - foreach($AccountVar in $AccountVars) - { - $INIFile += $AccountVar.Replace("Credential","UserName") + "=" + (Get-Variable -Name $AccountVar).Value.GetNetworkCredential().UserName - $INIFile += $AccountVar.Replace("Credential","Password") + "=" + (Get-Variable -Name $AccountVar).Value.GetNetworkCredential().Password - $INIFile += $AccountVar.Replace("Credential","DomainName") + "=" + (Get-Variable -Name $AccountVar).Value.GetNetworkCredential().Domain - } - Write-Verbose "INIFile: $TempFile" - foreach($Line in $INIFile) - { - Add-Content -Path $TempFile -Value $Line -Encoding Ascii - # Replace sensitive values for verbose output - $LogLine = $Line - if($ProductKey -ne "") - { - $LogLine = $LogLine.Replace($ProductKey,"*****-*****-*****-*****-*****") - } - $LogVars = @("YukonMachineCredential","ReportingMachineCredential") - foreach($LogVar in $LogVars) - { - if((Get-Variable -Name $LogVar).Value -ne "") - { - $LogLine = $LogLine.Replace((Get-Variable -Name $LogVar).Value.GetNetworkCredential().Password,"********") - } - } - Write-Verbose $LogLine - } - - switch($Ensure) - { - "Present" - { - $Arguments = " /i /f $TempFile /q" - } - "Absent" - { - $Arguments = " /x /f $TempFile /q" - } - } - - Write-Verbose "Path: $Path" - Write-Verbose "Arguments: $Arguments" - - $Process = StartWin32Process -Path $Path -Arguments $Arguments -Credential $SetupCredential - Write-Verbose $Process - WaitForWin32ProcessEnd -Path $Path -Arguments $Arguments -Credential $SetupCredential - - Remove-Item $TempFile - - if(Test-Path -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations') - { - $global:DSCMachineStatus = 1 - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\DataProtectionManager", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.String] - $UserName, - - [System.String] - $CompanyName, - - [System.String] - $ProductKey, - - [System.String] - $ProgramFiles, - - [parameter(Mandatory = $true)] - [System.String] - $YukonMachineName, - - [parameter(Mandatory = $true)] - [System.String] - $YukonInstanceName, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $YukonMachineCredential, - - [parameter(Mandatory = $true)] - [System.String] - $ReportingMachineName, - - [parameter(Mandatory = $true)] - [System.String] - $ReportingInstanceName, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $ReportingMachineCredential - ) - - $result = ((Get-TargetResource @PSBoundParameters).Ensure -eq $Ensure) - - $result -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSCDPM/DSCResources/MSFT_xSCDPMServerSetup/MSFT_xSCDPMServerSetup.schema.mof b/lib/puppet_x/dsc_resources/xSCDPM/DSCResources/MSFT_xSCDPMServerSetup/MSFT_xSCDPMServerSetup.schema.mof deleted file mode 100644 index da346ef2..00000000 --- a/lib/puppet_x/dsc_resources/xSCDPM/DSCResources/MSFT_xSCDPMServerSetup/MSFT_xSCDPMServerSetup.schema.mof +++ /dev/null @@ -1,18 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSCDPMServerSetup")] -class MSFT_xSCDPMServerSetup : OMI_BaseResource -{ - [Key, Description("An enumerated value that describes if the DPM server is expected to be installed on the machine.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Required, Description("UNC path to the root of the source filesfor installation.")] String SourcePath; - [Write, Description("Folder within the source path containing the source files for installation.")] String SourceFolder; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the installation.")] String SetupCredential; - [Write, Description("User name that the software will be registered to.")] String UserName; - [Write, Description("Company name that the software will be registered to.")] String CompanyName; - [Write, Description("Product key for licensed installations.")] String ProductKey; - [Write, Description("Installation path for the software.")] String ProgramFiles; - [Required, Description("Name of the SQL server for the DPM database.")] String YukonMachineName; - [Required, Description("SQL instance for the DPM database.")] String YukonInstanceName; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to access the SQL instance for DPM at installation time.")] String YukonMachineCredential; - [Required, Description("Name of the SQL server for reporting.")] String ReportingMachineName; - [Required, Description("SQL instance for reporting.")] String ReportingInstanceName; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to access SQL reporting for DPM at installation time.")] String ReportingMachineCredential; -}; diff --git a/lib/puppet_x/dsc_resources/xSCDPM/LICENSE b/lib/puppet_x/dsc_resources/xSCDPM/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xSCDPM/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xSCDPM/en-US/xPDT.strings.psd1 b/lib/puppet_x/dsc_resources/xSCDPM/en-US/xPDT.strings.psd1 deleted file mode 100644 index 11f213c1..00000000 --- a/lib/puppet_x/dsc_resources/xSCDPM/en-US/xPDT.strings.psd1 +++ /dev/null @@ -1,10 +0,0 @@ -ConvertFrom-StringData @' -FileNotFound=File not found in the environment path -AbsolutePathOrFileName=Absolute path or file name expected -InvalidArgument=Invalid argument: '{0}' with value: '{1}' -InvalidArgumentAndMessage={0} {1} -ErrorStarting=Failure starting process matching path '{0}'. Message: {1} -FailureWaitingForProcessesToStart=Failed to wait for processes to start -ProcessStarted=Process matching path '{0}' started in process ID {1} -ProcessAlreadyStarted=Process matching path '{0}' already started in process ID {1} -'@ diff --git a/lib/puppet_x/dsc_resources/xSCDPM/xPDT.psm1 b/lib/puppet_x/dsc_resources/xSCDPM/xPDT.psm1 deleted file mode 100644 index c90beaa1..00000000 --- a/lib/puppet_x/dsc_resources/xSCDPM/xPDT.psm1 +++ /dev/null @@ -1,708 +0,0 @@ -data LocalizedData -{ - ConvertFrom-StringData @' - -FileNotFound=File not found in the environment path -AbsolutePathOrFileName=Absolute path or file name expected -InvalidArgument=Invalid argument: '{0}' with value: '{1}' -InvalidArgumentAndMessage={0} {1} -ErrorStarting=Failure starting process matching path '{0}'. Message: {1} -FailureWaitingForProcessesToStart=Failed to wait for processes to start -ProcessStarted=Process matching path '{0}' started in process ID {1} -ProcessAlreadyStarted=Process matching path '{0}' already started in process ID {1} -'@ -} - -Import-LocalizedData LocalizedData -filename xPDT.strings.psd1 - -function ThrowInvalidArgumentError -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $errorId, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $errorMessage - ) - - $errorCategory=[System.Management.Automation.ErrorCategory]::InvalidArgument - $exception = New-Object System.ArgumentException $errorMessage; - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - throw $errorRecord -} - -function ResolvePath -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Path - ) - - $Path = [Environment]::ExpandEnvironmentVariables($Path) - if(IsRootedPath $Path) - { - if(!(Test-Path $Path -PathType Leaf)) - { - ThrowInvalidArgumentError "CannotFindRootedPath" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.FileNotFound) - } - return $Path - } - if([string]::IsNullOrEmpty($env:Path)) - { - ThrowInvalidArgumentError "EmptyEnvironmentPath" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.FileNotFound) - } - if((Split-Path $Path -Leaf) -ne $Path) - { - ThrowInvalidArgumentError "NotAbsolutePathOrFileName" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.AbsolutePathOrFileName) - } - foreach($rawSegment in $env:Path.Split(";")) - { - $segment = [Environment]::ExpandEnvironmentVariables($rawSegment) - $segmentRooted = $false - try - { - $segmentRooted=[IO.Path]::IsPathRooted($segment) - } - catch {} - if(!$segmentRooted) - { - continue - } - $candidate = join-path $segment $Path - if(Test-Path $candidate -PathType Leaf) - { - return $candidate - } - } - ThrowInvalidArgumentError "CannotFindRelativePath" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.FileNotFound) -} - -function IsRootedPath -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path - ) - - try - { - return [IO.Path]::IsPathRooted($Path) - } - catch - { - ThrowInvalidArgumentError "CannotGetIsPathRooted" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $_.Exception.Message) - } -} - -function ExtractArguments -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - $functionBoundParameters, - - [parameter(Mandatory = $true)] - [string[]] - $argumentNames, - - [string[]] - $newArgumentNames - ) - - $returnValue=@{} - - for($i=0;$i -lt $argumentNames.Count;$i++) - { - $argumentName = $argumentNames[$i] - - if($newArgumentNames -eq $null) - { - $newArgumentName = $argumentName - } - else - { - $newArgumentName = $newArgumentNames[$i] - } - - if($functionBoundParameters.ContainsKey($argumentName)) - { - $null = $returnValue.Add($newArgumentName,$functionBoundParameters[$argumentName]) - } - } - - return $returnValue -} - -function CallPInvoke -{ - $script:ProgramSource = @" -using System; -using System.Collections.Generic; -using System.Text; -using System.Security; -using System.Runtime.InteropServices; -using System.Diagnostics; -using System.Security.Principal; -using System.ComponentModel; -using System.IO; - -namespace Source -{ - [SuppressUnmanagedCodeSecurity] - public static class NativeMethods - { - //The following structs and enums are used by the various Win32 API's that are used in the code below - - [StructLayout(LayoutKind.Sequential)] - public struct STARTUPINFO - { - public Int32 cb; - public string lpReserved; - public string lpDesktop; - public string lpTitle; - public Int32 dwX; - public Int32 dwY; - public Int32 dwXSize; - public Int32 dwXCountChars; - public Int32 dwYCountChars; - public Int32 dwFillAttribute; - public Int32 dwFlags; - public Int16 wShowWindow; - public Int16 cbReserved2; - public IntPtr lpReserved2; - public IntPtr hStdInput; - public IntPtr hStdOutput; - public IntPtr hStdError; - } - - [StructLayout(LayoutKind.Sequential)] - public struct PROCESS_INFORMATION - { - public IntPtr hProcess; - public IntPtr hThread; - public Int32 dwProcessID; - public Int32 dwThreadID; - } - - [Flags] - public enum LogonType - { - LOGON32_LOGON_INTERACTIVE = 2, - LOGON32_LOGON_NETWORK = 3, - LOGON32_LOGON_BATCH = 4, - LOGON32_LOGON_SERVICE = 5, - LOGON32_LOGON_UNLOCK = 7, - LOGON32_LOGON_NETWORK_CLEARTEXT = 8, - LOGON32_LOGON_NEW_CREDENTIALS = 9 - } - - [Flags] - public enum LogonProvider - { - LOGON32_PROVIDER_DEFAULT = 0, - LOGON32_PROVIDER_WINNT35, - LOGON32_PROVIDER_WINNT40, - LOGON32_PROVIDER_WINNT50 - } - [StructLayout(LayoutKind.Sequential)] - public struct SECURITY_ATTRIBUTES - { - public Int32 Length; - public IntPtr lpSecurityDescriptor; - public bool bInheritHandle; - } - - public enum SECURITY_IMPERSONATION_LEVEL - { - SecurityAnonymous, - SecurityIdentification, - SecurityImpersonation, - SecurityDelegation - } - - public enum TOKEN_TYPE - { - TokenPrimary = 1, - TokenImpersonation - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - internal struct TokPriv1Luid - { - public int Count; - public long Luid; - public int Attr; - } - - public const int GENERIC_ALL_ACCESS = 0x10000000; - public const int CREATE_NO_WINDOW = 0x08000000; - internal const int SE_PRIVILEGE_ENABLED = 0x00000002; - internal const int TOKEN_QUERY = 0x00000008; - internal const int TOKEN_ADJUST_PRIVILEGES = 0x00000020; - internal const string SE_INCRASE_QUOTA = "SeIncreaseQuotaPrivilege"; - - [DllImport("kernel32.dll", - EntryPoint = "CloseHandle", SetLastError = true, - CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] - public static extern bool CloseHandle(IntPtr handle); - - [DllImport("advapi32.dll", - EntryPoint = "CreateProcessAsUser", SetLastError = true, - CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] - public static extern bool CreateProcessAsUser( - IntPtr hToken, - string lpApplicationName, - string lpCommandLine, - ref SECURITY_ATTRIBUTES lpProcessAttributes, - ref SECURITY_ATTRIBUTES lpThreadAttributes, - bool bInheritHandle, - Int32 dwCreationFlags, - IntPtr lpEnvrionment, - string lpCurrentDirectory, - ref STARTUPINFO lpStartupInfo, - ref PROCESS_INFORMATION lpProcessInformation - ); - - [DllImport("advapi32.dll", EntryPoint = "DuplicateTokenEx")] - public static extern bool DuplicateTokenEx( - IntPtr hExistingToken, - Int32 dwDesiredAccess, - ref SECURITY_ATTRIBUTES lpThreadAttributes, - Int32 ImpersonationLevel, - Int32 dwTokenType, - ref IntPtr phNewToken - ); - - [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] - public static extern Boolean LogonUser( - String lpszUserName, - String lpszDomain, - String lpszPassword, - LogonType dwLogonType, - LogonProvider dwLogonProvider, - out IntPtr phToken - ); - - [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)] - internal static extern bool AdjustTokenPrivileges( - IntPtr htok, - bool disall, - ref TokPriv1Luid newst, - int len, - IntPtr prev, - IntPtr relen - ); - - [DllImport("kernel32.dll", ExactSpelling = true)] - internal static extern IntPtr GetCurrentProcess(); - - [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)] - internal static extern bool OpenProcessToken( - IntPtr h, - int acc, - ref IntPtr phtok - ); - - [DllImport("advapi32.dll", SetLastError = true)] - internal static extern bool LookupPrivilegeValue( - string host, - string name, - ref long pluid - ); - - public static void CreateProcessAsUser(string strCommand, string strDomain, string strName, string strPassword) - { - var hToken = IntPtr.Zero; - var hDupedToken = IntPtr.Zero; - TokPriv1Luid tp; - var pi = new PROCESS_INFORMATION(); - var sa = new SECURITY_ATTRIBUTES(); - sa.Length = Marshal.SizeOf(sa); - Boolean bResult = false; - try - { - bResult = LogonUser( - strName, - strDomain, - strPassword, - LogonType.LOGON32_LOGON_BATCH, - LogonProvider.LOGON32_PROVIDER_DEFAULT, - out hToken - ); - if (!bResult) - { - throw new Win32Exception("The user could not be logged on. Ensure that the user has an existing profile on the machine and that correct credentials are provided. Logon error #" + Marshal.GetLastWin32Error().ToString()); - } - IntPtr hproc = GetCurrentProcess(); - IntPtr htok = IntPtr.Zero; - bResult = OpenProcessToken( - hproc, - TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, - ref htok - ); - if(!bResult) - { - throw new Win32Exception("Open process token error #" + Marshal.GetLastWin32Error().ToString()); - } - tp.Count = 1; - tp.Luid = 0; - tp.Attr = SE_PRIVILEGE_ENABLED; - bResult = LookupPrivilegeValue( - null, - SE_INCRASE_QUOTA, - ref tp.Luid - ); - if(!bResult) - { - throw new Win32Exception("Error in looking up privilege of the process. This should not happen if DSC is running as LocalSystem Lookup privilege error #" + Marshal.GetLastWin32Error().ToString()); - } - bResult = AdjustTokenPrivileges( - htok, - false, - ref tp, - 0, - IntPtr.Zero, - IntPtr.Zero - ); - if(!bResult) - { - throw new Win32Exception("Token elevation error #" + Marshal.GetLastWin32Error().ToString()); - } - - bResult = DuplicateTokenEx( - hToken, - GENERIC_ALL_ACCESS, - ref sa, - (int)SECURITY_IMPERSONATION_LEVEL.SecurityIdentification, - (int)TOKEN_TYPE.TokenPrimary, - ref hDupedToken - ); - if(!bResult) - { - throw new Win32Exception("Duplicate Token error #" + Marshal.GetLastWin32Error().ToString()); - } - var si = new STARTUPINFO(); - si.cb = Marshal.SizeOf(si); - si.lpDesktop = ""; - bResult = CreateProcessAsUser( - hDupedToken, - null, - strCommand, - ref sa, - ref sa, - false, - 0, - IntPtr.Zero, - null, - ref si, - ref pi - ); - if(!bResult) - { - throw new Win32Exception("The process could not be created. Create process as user error #" + Marshal.GetLastWin32Error().ToString()); - } - } - finally - { - if (pi.hThread != IntPtr.Zero) - { - CloseHandle(pi.hThread); - } - if (pi.hProcess != IntPtr.Zero) - { - CloseHandle(pi.hProcess); - } - if (hDupedToken != IntPtr.Zero) - { - CloseHandle(hDupedToken); - } - } - } - } -} - -"@ - Add-Type -TypeDefinition $ProgramSource -ReferencedAssemblies "System.ServiceProcess" -} - -function GetWin32Process -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [PSCredential] - $Credential - ) - - $fileName = [io.path]::GetFileNameWithoutExtension($Path) - $GetProcesses = @(Get-Process -Name $fileName -ErrorAction SilentlyContinue) - $Processes = foreach($process in $GetProcesses) - { - if($Process.Path -ieq $Path) - { - try - { - [wmi]"Win32_Process.Handle='$($Process.Id)'" - } - catch - { - } - } - } - if($PSBoundParameters.ContainsKey('Credential')) - { - $Processes = $Processes | Where-Object {(GetWin32ProcessOwner $_) -eq $Credential.UserName} - } - if($Arguments -eq $null) {$Arguments = ""} - $Processes = $Processes | Where-Object {(GetWin32ProcessArgumentsFromCommandLine $_.CommandLine) -eq $Arguments} - - return $Processes -} - -function GetWin32ProcessOwner -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNull()] - $Process - ) - - try - { - $Owner = $Process.GetOwner() - } - catch - {} - if($owner.Domain -ne $null) - { - return $Owner.Domain + "\" + $Owner.User - } - else - { - return $Owner.User - } -} - -function GetWin32ProcessArgumentsFromCommandLine -{ - param - ( - [String] - $commandLine - ) - - if($commandLine -eq $null) - { - return "" - } - $commandLine=$commandLine.Trim() - if($commandLine.Length -eq 0) - { - return "" - } - if($commandLine[0] -eq '"') - { - $charToLookfor=[char]'"' - } - else - { - $charToLookfor=[char]' ' - } - $endOfCommand=$commandLine.IndexOf($charToLookfor ,1) - if($endOfCommand -eq -1) - { - return "" - } - return $commandLine.Substring($endOfCommand+1).Trim() -} - -function StartWin32Process -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [PSCredential] - $Credential, - - [Switch] - $AsTask - ) - - $GetArguments = ExtractArguments $PSBoundParameters ("Path","Arguments","Credential") - $Processes = @(GetWin32Process @getArguments) - if ($processes.Count -eq 0) - { - if($PSBoundParameters.ContainsKey("Credential")) - { - if($AsTask) - { - $ActionArguments = ExtractArguments $PSBoundParameters ` - ("Path", "Arguments") ` - ("Execute", "Argument") - if([string]::IsNullOrEmpty($Arguments)) - { - $null = $ActionArguments.Remove("Argument") - } - $TaskGuid = [guid]::NewGuid().ToString() - $Action = New-ScheduledTaskAction @ActionArguments - $null = Register-ScheduledTask -TaskName "xPDT $TaskGuid" -Action $Action -User $Credential.UserName -Password $Credential.GetNetworkCredential().Password -RunLevel Highest - $err = Start-ScheduledTask -TaskName "xPDT $TaskGuid" - } - else - { - try - { - CallPInvoke - [Source.NativeMethods]::CreateProcessAsUser(("$Path " + $Arguments),$Credential.GetNetworkCredential().Domain,$Credential.GetNetworkCredential().UserName,$Credential.GetNetworkCredential().Password) - } - catch - { - $exception = New-Object System.ArgumentException $_ - $errorCategory = [System.Management.Automation.ErrorCategory]::OperationStopped - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, "Win32Exception", $errorCategory, $null - $err = $errorRecord - } - } - } - else - { - $StartArguments = ExtractArguments $PSBoundParameters ` - ("Path", "Arguments", "Credential") ` - ("FilePath", "ArgumentList", "Credential") - if([string]::IsNullOrEmpty($Arguments)) - { - $null = $StartArguments.Remove("ArgumentList") - } - $err = Start-Process @StartArguments - } - if($err -ne $null) - { - throw $err - } - if (!(WaitForWin32ProcessStart @GetArguments)) - { - ThrowInvalidArgumentError "FailureWaitingForProcessesToStart" ($LocalizedData.ErrorStarting -f $Path,$LocalizedData.FailureWaitingForProcessesToStart) - } - } - else - { - return ($LocalizedData.ProcessAlreadyStarted -f $Path,$Processes.ProcessId) - } - $Processes = @(GetWin32Process @getArguments) - return ($LocalizedData.ProcessStarted -f $Path,$Processes.ProcessId) -} - -function WaitForWin32ProcessStart -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [PSCredential] - $Credential - ) - - $start = [DateTime]::Now - $GetArguments = ExtractArguments $PSBoundParameters ("Path","Arguments","Credential") - do - { - $value = @(GetWin32Process @GetArguments).Count -ge 1 - } while(!$value -and ([DateTime]::Now - $start).TotalMilliseconds -lt 60000) - - return $value -} - -function WaitForWin32ProcessEnd -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [PSCredential] - $Credential - ) - - $GetArguments = ExtractArguments $PSBoundParameters ("Path","Arguments","Credential") - While (WaitForWin32ProcessStart @GetArguments) - { - Start-Sleep 1 - } - Get-ScheduledTask | Where-Object {($_.TaskName.Length -ge 4) -and ($_.TaskName.Substring(0,4) -eq "xPDT") -and ($_.Actions.Execute -eq $Path) -and ($_.Actions.Arguments -eq $Arguments)} | Where-Object {$_ -ne $null} | Unregister-ScheduledTask -Confirm:$false -} - -function NetUse -{ - param - ( - [parameter(Mandatory)] - [string] - $SourcePath, - - [parameter(Mandatory)] - [PSCredential] - $Credential, - - [string] - $Ensure = "Present" - ) - - if(($SourcePath.Length -ge 2) -and ($SourcePath.Substring(0,2) -eq "\\")) - { - - if ($Ensure -eq "Absent") - { - $cmd = "net.exe use $SourcePath /del" - } - else - { - $cmd = "net.exe use $SourcePath $($Credential.GetNetworkCredential().Password) /user:$($Credential.GetNetworkCredential().Domain)\$($Credential.GetNetworkCredential().UserName)" - } - Invoke-Expression $cmd - } -} - -Export-ModuleMember ResolvePath,StartWin32Process,WaitForWin32ProcessEnd,NetUse diff --git a/lib/puppet_x/dsc_resources/xSCDPM/xSCDPM.psd1 b/lib/puppet_x/dsc_resources/xSCDPM/xSCDPM.psd1 deleted file mode 100644 index 55003abb..00000000 --- a/lib/puppet_x/dsc_resources/xSCDPM/xSCDPM.psd1 +++ /dev/null @@ -1,31 +0,0 @@ -@{ -# Version number of this module. -ModuleVersion = '1.2.0.0' - -# ID used to uniquely identify this module -GUID = '321465c3-1ae7-41b7-9ad2-e834140972ad' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'Module with DSC Resources for deployment and configuration of Microsoft System Center Data Protection Manager.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Minimum version of the common language runtime (CLR) required by this module -CLRVersion = '4.0' - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' -} diff --git a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMAdmin/MSFT_xSCOMAdmin.psm1 b/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMAdmin/MSFT_xSCOMAdmin.psm1 deleted file mode 100644 index f8d946a7..00000000 --- a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMAdmin/MSFT_xSCOMAdmin.psm1 +++ /dev/null @@ -1,147 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $Principal, - - [parameter(Mandatory = $true)] - [System.String] - $UserRole, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SCOMAdminCredential - ) - - $Ensure = Invoke-Command -ComputerName . -Credential $SCOMAdminCredential -Authentication Credssp { - $Ensure = $args[0] - $Principal = $args[1] - $UserRole = $args[2] - $InstallPath = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\System Center Operations Manager\12\Setup" -Name "InstallDirectory").InstallDirectory - if(!(Get-Module -Name OperationsManager)) - { - Import-Module "$InstallPath\PowerShell\OperationsManager" - } - if(Get-Module -Name OperationsManager) - { - if(Get-SCOMUserRole -Name $UserRole | ForEach-Object {$_.Users} | Where-Object {$_ -eq $Principal}) - { - "Present" - } - else - { - "Absent" - } - } - } -ArgumentList @($Ensure,$Principal,$UserRole) - - $returnValue = @{ - Ensure = $Ensure - Principal = $Principal - UserRole = $UserRole - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $Principal, - - [parameter(Mandatory = $true)] - [System.String] - $UserRole, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SCOMAdminCredential - ) - - Invoke-Command -ComputerName . -Credential $SCOMAdminCredential -Authentication Credssp { - $Ensure = $args[0] - $Principal = $args[1] - $UserRole = $args[2] - $InstallPath = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\System Center Operations Manager\12\Setup" -Name "InstallDirectory").InstallDirectory - if(!(Get-Module -Name OperationsManager)) - { - Import-Module "$InstallPath\PowerShell\OperationsManager" - } - if(Get-Module -Name OperationsManager) - { - $UR = Get-SCOMUserRole -Name $UserRole - switch($Ensure) - { - "Present" - { - if(!(Get-SCOMUserRole -Name $UserRole | ForEach-Object {$_.Users} | Where-Object {$_ -eq $Principal})) - { - $NewUsers = ($UR.Users + $Principal) - } - } - "Absent" - { - if(Get-SCOMUserRole -Name $UserRole | ForEach-Object {$_.Users} | Where-Object {$_ -eq $Principal}) - { - $NewUsers = $UR.Users | Where-Object {$_ -ne $Principal} - } - } - } - Set-SCOMUserRole -UserRole $UR -User $NewUsers - } - } -ArgumentList @($Ensure,$Principal,$UserRole) - - if(!(Test-TargetResource @PSBoundParameters)) - { - throw "Set-TargetResouce failed" - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $Principal, - - [parameter(Mandatory = $true)] - [System.String] - $UserRole, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SCOMAdminCredential - ) - - $result = ((Get-TargetResource @PSBoundParameters).Ensure -eq $Ensure) - - $result -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMAdmin/MSFT_xSCOMAdmin.schema.mof b/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMAdmin/MSFT_xSCOMAdmin.schema.mof deleted file mode 100644 index 156222f6..00000000 --- a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMAdmin/MSFT_xSCOMAdmin.schema.mof +++ /dev/null @@ -1,8 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSCOMAdmin")] -class MSFT_xSCOMAdmin : OMI_BaseResource -{ - [Write, Description("An enumerated value that describes if the principal is an Operations Manager admin.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Key, Description("The Operations Manager admin principal.")] String Principal; - [Key, Description("The Operations Manager user role.")] String UserRole; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the operations.")] String SCOMAdminCredential; -}; diff --git a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMConsoleSetup/MSFT_xSCOMConsoleSetup.psm1 b/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMConsoleSetup/MSFT_xSCOMConsoleSetup.psm1 deleted file mode 100644 index 70648e4e..00000000 --- a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMConsoleSetup/MSFT_xSCOMConsoleSetup.psm1 +++ /dev/null @@ -1,256 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\OperationsManager.en", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.String] - $InstallPath, - - [System.Byte] - $UseMicrosoftUpdate, - - [System.Byte] - $SendCEIPReports, - - [ValidateSet("Never","Queued","Always")] - [System.String] - $EnableErrorReporting = "Never", - - [System.Byte] - $SendODRReports - ) - - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "setup.exe" - $Path = ResolvePath $Path - $Version = (Get-Item -Path $Path).VersionInfo.ProductVersion - - switch($Version) - { - "7.1.10226.0" - { - $IdentifyingNumber = "{041C3416-87CE-4B02-918E-6FDC95F241D3}" - $InstallRegVersion = "12" - } - "7.2.10015.0" - { - $IdentifyingNumber = "{F67729BD-18CF-4283-A6FC-F388A463EC01}" - $InstallRegVersion = "12" - } - Default - { - throw "Unknown version of Operations Manager!" - } - } - - if(Get-WmiObject -Class Win32_Product | Where-Object {$_.IdentifyingNumber -eq $IdentifyingNumber}) - { - $InstallPath = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\System Center Operations Manager\$InstallRegVersion\Setup" -Name "InstallDirectory").InstallDirectory - - $returnValue = @{ - Ensure = "Present" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - InstallPath = $InstallPath - } - } - else - { - $returnValue = @{ - Ensure = "Absent" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\OperationsManager.en", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.String] - $InstallPath, - - [System.Byte] - $UseMicrosoftUpdate, - - [System.Byte] - $SendCEIPReports, - - [ValidateSet("Never","Queued","Always")] - [System.String] - $EnableErrorReporting = "Never", - - [System.Byte] - $SendODRReports - ) - - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "setup.exe" - $Path = ResolvePath $Path - $Version = (Get-Item -Path $Path).VersionInfo.ProductVersion - - switch($Version) - { - "7.1.10226.0" - { - $IdentifyingNumber = "{041C3416-87CE-4B02-918E-6FDC95F241D3}" - } - "7.2.10015.0" - { - $IdentifyingNumber = "{F67729BD-18CF-4283-A6FC-F388A463EC01}" - } - Default - { - throw "Unknown version of Operations Manager!" - } - } - - switch($Ensure) - { - "Present" - { - # Set defaults, if they couldn't be set in param due to null configdata input - if($UseMicrosoftUpdate -ne 1) - { - $UseMicrosoftUpdate = 0 - } - if($SendCEIPReports -ne 1) - { - $SendCEIPReports = 0 - } - if($SendODRReports -ne 1) - { - $SendODRReports = 0 - } - - # Create install arguments - $Arguments = "/silent /install /AcceptEndUserLicenseAgreement:1 /components:OMConsole" - $ArgumentVars = @( - "InstallPath", - "UseMicrosoftUpdate", - "SendCEIPReports", - "EnableErrorReporting", - "SendODRReports" - ) - foreach($ArgumentVar in $ArgumentVars) - { - if(!([String]::IsNullOrEmpty((Get-Variable -Name $ArgumentVar).Value))) - { - $Arguments += " /$ArgumentVar`:" + [Environment]::ExpandEnvironmentVariables((Get-Variable -Name $ArgumentVar).Value) - } - } - } - "Absent" - { - # Create uninstall arguments - $Arguments = "/silent /uninstall /components:OMConsole" - } - } - - Write-Verbose "Path: $Path" - Write-Verbose "Arguments: $Arguments" - - $Process = StartWin32Process -Path $Path -Arguments $Arguments -Credential $SetupCredential -AsTask - Write-Verbose $Process - WaitForWin32ProcessEnd -Path $Path -Arguments $Arguments -Credential $SetupCredential - - if((Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Name 'PendingFileRenameOperations' -ErrorAction SilentlyContinue) -ne $null) - { - $global:DSCMachineStatus = 1 - } - else - { - if(!(Test-TargetResource @PSBoundParameters)) - { - throw "Set-TargetResouce failed" - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\OperationsManager.en", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.String] - $InstallPath, - - [System.Byte] - $UseMicrosoftUpdate, - - [System.Byte] - $SendCEIPReports, - - [ValidateSet("Never","Queued","Always")] - [System.String] - $EnableErrorReporting = "Never", - - [System.Byte] - $SendODRReports - ) - - $result = ((Get-TargetResource @PSBoundParameters).Ensure -eq $Ensure) - - $result -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMConsoleSetup/MSFT_xSCOMConsoleSetup.schema.mof b/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMConsoleSetup/MSFT_xSCOMConsoleSetup.schema.mof deleted file mode 100644 index c37c729b..00000000 --- a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMConsoleSetup/MSFT_xSCOMConsoleSetup.schema.mof +++ /dev/null @@ -1,13 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSCOMConsoleSetup")] -class MSFT_xSCOMConsoleSetup : OMI_BaseResource -{ - [Key, Description("An enumerated value that describes if the OM Console is expected to be installed on the machine.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Required, Description("UNC path to the root of the source files for installation.")] String SourcePath; - [Write, Description("Folder within the source path containing the source files for installation.")] String SourceFolder; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the installation.")] String SetupCredential; - [Write, Description("Installation path for the software.")] String InstallPath; - [Write, Description("0: Do not opt in to Microsoft Update. 1: Opt in to Microsoft Update.")] UInt8 UseMicrosoftUpdate; - [Write, Description("0: Do not opt in to the Customer Experience Improvement Program (CEIP). 1: Opt in to CEIP.")] UInt8 SendCEIPReports; - [Write, Description("Never: Do not opt in to sending automatic error reports. Queued: Opt in to sending error reports, but queue the reports for review before sending. Always: Opt in to automatically send error reports."), ValueMap{"Never","Queued","Always"}, Values{"Never","Queued","Always"}] String EnableErrorReporting; - [Write, Description("0: Do not opt in to sending operational data reports. 1: opt in to sending operational data reports.")] UInt8 SendODRReports; -}; diff --git a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMConsoleUpdate/MSFT_xSCOMConsoleUpdate.psm1 b/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMConsoleUpdate/MSFT_xSCOMConsoleUpdate.psm1 deleted file mode 100644 index f575544a..00000000 --- a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMConsoleUpdate/MSFT_xSCOMConsoleUpdate.psm1 +++ /dev/null @@ -1,183 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\OperationsManager.en\Updates", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - $Version = (Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -eq "System Center Operations Manager 2012 Console"}).Version - - switch($Version) - { - "7.1.10226.0" - { - $ProductCode = "{041C3416-87CE-4B02-918E-6FDC95F241D3}" - $PatchID = "{2BE319B6-DBD6-4F52-9DE1-6EDF1E129F48}" - $Update = "Update Rollup 4" - } - "7.2.10015.0" - { - $returnValue = @{ - Ensure = "Present" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - Update = "None" - } - } - $null - { - $returnValue = @{ - Ensure = "Absent" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - } - } - Default - { - throw "Unknown version of Operations Manager!" - } - } - - if($ProductCode -and $PatchID -and (Get-WmiObject -Class Win32_PatchPackage | Where-Object {($_.ProductCode -eq $ProductCode) -and ($_.PatchID -eq $PatchID)})) - { - $returnValue = @{ - Ensure = "Present" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - Update = $Update - } - } - else - { - $returnValue = @{ - Ensure = "Absent" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\OperationsManager.en\Updates", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - $Version = (Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -eq "System Center Operations Manager 2012 Console"}).Version - - switch($Version) - { - "7.1.10226.0" - { - $UpdateFile = "KB2992020-AMD64-ENU-Console.msp" - } - "7.2.10015.0" - { - Write-Verbose "No update for this version of Operations Manager!" - } - $null - { - Write-Verbose "Operations Manager Console not installed!" - } - Default - { - throw "Unknown version of Operations Manager!" - } - } - - if($UpdateFile) - { - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - $Path = "msiexec.exe" - $Path = ResolvePath $Path - Write-Verbose "Path: $Path" - - $MSPPath = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath $UpdateFile - $MSPPath = ResolvePath $MSPPath - $Arguments = "/update $MSPPath /norestart" - Write-Verbose "Arguments: $Arguments" - - $Process = StartWin32Process -Path $Path -Arguments $Arguments -Credential $SetupCredential - Write-Verbose $Process - WaitForWin32ProcessEnd -Path $Path -Arguments $Arguments -Credential $SetupCredential - } - - if((Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Name 'PendingFileRenameOperations' -ErrorAction SilentlyContinue) -ne $null) - { - $global:DSCMachineStatus = 1 - } - else - { - if(!(Test-TargetResource @PSBoundParameters)) - { - throw "Set-TargetResouce failed" - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\OperationsManager.en\Updates", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - $result = ((Get-TargetResource @PSBoundParameters).Ensure -eq $Ensure) - - $result -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMConsoleUpdate/MSFT_xSCOMConsoleUpdate.schema.mof b/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMConsoleUpdate/MSFT_xSCOMConsoleUpdate.schema.mof deleted file mode 100644 index 4c538675..00000000 --- a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMConsoleUpdate/MSFT_xSCOMConsoleUpdate.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSCOMConsoleUpdate")] -class MSFT_xSCOMConsoleUpdate : OMI_BaseResource -{ - [Key, Description("An enumerated value that describes if the update is expected to be installed on the machine.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Required, Description("UNC path to the root of the source files for installation.")] String SourcePath; - [Write, Description("Folder within the source path containing the source files for installation.")] String SourceFolder; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the installation.")] String SetupCredential; - [Read, Description("Display name of the update.")] String Update; -}; diff --git a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMManagementPack/MSFT_xSCOMManagementPack.psm1 b/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMManagementPack/MSFT_xSCOMManagementPack.psm1 deleted file mode 100644 index 511ff29a..00000000 --- a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMManagementPack/MSFT_xSCOMManagementPack.psm1 +++ /dev/null @@ -1,237 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [System.String] - $Version, - - [System.String] - $MinVersion, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SCOMAdminCredential, - - [System.String] - $SourcePath, - - [parameter(Mandatory = $true)] - [System.String] - $SourceFolder, - - [parameter(Mandatory = $true)] - [System.String] - $SourceFile - ) - - $Version = Invoke-Command -ComputerName . -Credential $SCOMAdminCredential { - $Name = $args[0] - Import-Module OperationsManager - [String](Get-SCManagementPack -Name $Name).Version - } -ArgumentList @($Name) - - $returnValue = @{ - Name = $Name - Version = $Version - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [System.String] - $Version, - - [System.String] - $MinVersion, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SCOMAdminCredential, - - [System.String] - $SourcePath, - - [parameter(Mandatory = $true)] - [System.String] - $SourceFolder, - - [parameter(Mandatory = $true)] - [System.String] - $SourceFile - ) - - if([String]::IsNullOrEmpty($SourcePath)) - { - $SourcePath = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\System Center Operations Manager\12\Setup" -Name "InstallDirectory").InstallDirectory - } - $MPFile = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath $SourceFile - - if(Test-Path -Path $MPFile) - { - Write-Verbose "MPFile: $MPFile" - Invoke-Command -ComputerName . -Credential $SCOMAdminCredential -Authentication Credssp { - $MPFile = $args[0] - Import-Module OperationsManager - Import-SCManagementPack $MPFile - } -ArgumentList @($MPFile) - } - - if(!(Test-TargetResource @PSBoundParameters)) - { - throw "Set-TargetResouce failed" - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [System.String] - $Version, - - [System.String] - $MinVersion, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SCOMAdminCredential, - - [System.String] - $SourcePath, - - [parameter(Mandatory = $true)] - [System.String] - $SourceFolder, - - [parameter(Mandatory = $true)] - [System.String] - $SourceFile - ) - - $result = $true - - $MPData = Get-TargetResource @PSBoundParameters - - # Test for MP not installed - if([String]::IsNullOrEmpty($MPData.Version)) - { - $result = $false - } - - if($result) - { - # Test just for MP, no version - if([String]::IsNullOrEmpty($Version) -and [String]::IsNullOrEmpty($MinVersion)) - { - if(![String]::IsNullOrEmpty($MPData.Version)) - { - $result = $true - } - else - { - $result = $false - } - } - - # Test for MP specific version - if(![String]::IsNullOrEmpty($Version)) - { - if($Version -eq $MPData.Version) - { - $result = $true - } - else - { - $result = $false - } - } - # Test for MP minimum version - else - { - $MinVersionArray = $MinVersion.Split(".") - $VersionArray = $MPData.Version.Split(".") - - if($VersionArray[0] -lt $MinVersionArray[0]) - { - $result = $false - } - else - { - if($VersionArray[0] -gt $MinVersionArray[0]) - { - $result = $true - } - else - { - if($VersionArray[1] -lt $MinVersionArray[1]) - { - $result = $false - } - else - { - if($VersionArray[1] -gt $MinVersionArray[1]) - { - $result = $true - } - else - { - if($VersionArray[2] -lt $MinVersionArray[2]) - { - $result = $false - } - else - { - if($VersionArray[2] -gt $MinVersionArray[2]) - { - $result = $true - } - else - { - if($VersionArray[3] -lt $MinVersionArray[3]) - { - $result = $false - } - else - { - if($VersionArray[3] -ge $MinVersionArray[3]) - { - $result = $true - } - } - } - } - } - } - } - } - } - } - - $result -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMManagementPack/MSFT_xSCOMManagementPack.schema.mof b/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMManagementPack/MSFT_xSCOMManagementPack.schema.mof deleted file mode 100644 index 5b9bf0ce..00000000 --- a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMManagementPack/MSFT_xSCOMManagementPack.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSCOMManagementPack")] -class MSFT_xSCOMManagementPack : OMI_BaseResource -{ - [Key, Description("Name of the Management Pack.")] String Name; - [Write, Description("Specific version of the Management Pack, overrides MinVersion if both set.")] String Version; - [Write, Description("Minimum version of the Management Pack, overridden by Version if both set.")] String MinVersion; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential with admin permissions to Operations Manager.")] String SCOMAdminCredential; - [Write, Description("UNC path to the root of the source files for installation, if omitted the Operations Manager installation folder will be used.")] String SourcePath; - [Required, Description("Folder within the source path containing the source files for installation.")] String SourceFolder; - [Required, Description("Name of the file in the source folder for the Management Pack.")] String SourceFile; -}; diff --git a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMManagementServerSetup/MSFT_xSCOMManagementServerSetup.psm1 b/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMManagementServerSetup/MSFT_xSCOMManagementServerSetup.psm1 deleted file mode 100644 index 3de2d123..00000000 --- a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMManagementServerSetup/MSFT_xSCOMManagementServerSetup.psm1 +++ /dev/null @@ -1,543 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\OperationsManager.en", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.String] - $ProductKey, - - [System.String] - $InstallPath, - - [parameter(Mandatory = $true)] - [System.String] - $ManagementGroupName, - - [parameter(Mandatory = $true)] - [System.Boolean] - $FirstManagementServer, - - [System.UInt16] - $ManagementServicePort = 5723, - - [System.Management.Automation.PSCredential] - $ActionAccount, - - [System.Management.Automation.PSCredential] - $DASAccount, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $DataReader, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $DataWriter, - - [parameter(Mandatory = $true)] - [System.String] - $SqlServerInstance, - - [System.String] - $DatabaseName = "OperationsManager", - - [System.UInt16] - $DatabaseSize = 1000, - - [parameter(Mandatory = $true)] - [System.String] - $DwSqlServerInstance, - - [System.String] - $DwDatabaseName = "OperationsManagerDW", - - [System.UInt16] - $DwDatabaseSize = 1000, - - [System.Byte] - $UseMicrosoftUpdate, - - [System.Byte] - $SendCEIPReports, - - [ValidateSet("Never","Queued","Always")] - [System.String] - $EnableErrorReporting = "Never", - - [System.Byte] - $SendODRReports - ) - - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "setup.exe" - $Path = ResolvePath $Path - $Version = (Get-Item -Path $Path).VersionInfo.ProductVersion - - switch($Version) - { - "7.1.10226.0" - { - $IdentifyingNumber = "{C92727BE-BD12-4140-96A6-276BA4F60AC1}" - $InstallRegVersion = "12" - $RegVersion = "3.0" - } - "7.2.10015.0" - { - $IdentifyingNumber = "{43C498CB-D391-4B07-9C03-85C4E8239102}" - $InstallRegVersion = "12" - $RegVersion = "3.0" - } - Default - { - throw "Unknown version of Operations Manager!" - } - } - - if(Get-WmiObject -Class Win32_Product | Where-Object {$_.IdentifyingNumber -eq $IdentifyingNumber}) - { - $InstallPath = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\System Center Operations Manager\$InstallRegVersion\Setup" -Name "InstallDirectory").InstallDirectory - $MGs = Get-ChildItem -Path "HKLM:\SOFTWARE\Microsoft\Microsoft Operations Manager\$RegVersion\Server Management Groups" - foreach($MG in $MGs) - { - $MGReg = $MG.Name.Replace("HKEY_LOCAL_MACHINE\","HKLM:") - if ((Get-ItemProperty -Path $MGReg -Name "IsServer").IsServer -eq 1) - { - $ManagementGroupName = $MG.Name.Split("\")[$MG.Name.Split("\").Count - 1] - $ManagementServicePort = (Get-ItemProperty -Path $MGReg -Name "Port").Port - } - } - $ComputerName = $env:COMPUTERNAME + "." + (Get-WmiObject -Class Win32_ComputerSystem).Domain - if(!(Get-Module -Name OperationsManager)) - { - Import-Module "$InstallPath\PowerShell\OperationsManager" - } - if(Get-Module -Name OperationsManager) - { - $ManagementServer = Get-SCOMManagementServer -Name $ComputerName - $ActionAccountUsername = $ManagementServer.ActionAccountIdentity - $DRA = (Get-SCOMRunAsAccount -Name "Data Warehouse Report Deployment Account") - $DataReaderUsername = $DRA.Domain + "\" + $DRA.UserName - $DWA = (Get-SCOMRunAsAccount -Name "Data Warehouse Action Account") - $DataWriterUsername = $DWA.Domain + "\" + $DWA.UserName - } - $DASAccountUsername = (Get-WmiObject -Class Win32_Service | Where-Object {$_.Name -eq "OMSDK"}).StartName - $SqlServerInstance = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft Operations Manager\$RegVersion\Setup" -Name "DatabaseServerName").DatabaseServerName - $DatabaseName = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft Operations Manager\$RegVersion\Setup" -Name "DatabaseName").DatabaseName - $DwSqlServerInstance = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft Operations Manager\$RegVersion\Setup" -Name "DataWarehouseDBServerName").DataWarehouseDBServerName - $DwDatabaseName = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft Operations Manager\$RegVersion\Setup" -Name "DataWarehouseDBName").DataWarehouseDBName - - $returnValue = @{ - Ensure = "Present" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - InstallPath = $InstallPath - ManagementGroupName = $ManagementGroupName - ManagementServicePort = $ManagementServicePort - ActionAccountUsername = $ActionAccountUsername - DASAccountUsername = $DASAccountUsername - DataReaderUsername = $DataReaderUsername - DataWriterUsername = $DataWriterUsername - SqlServerInstance = $SqlServerInstance - DatabaseName = $DatabaseName - DwSqlServerInstance = $DwSqlServerInstance - DwDatabaseName = $DwDatabaseName - } - } - else - { - $returnValue = @{ - Ensure = "Absent" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\OperationsManager.en", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.String] - $ProductKey, - - [System.String] - $InstallPath, - - [parameter(Mandatory = $true)] - [System.String] - $ManagementGroupName, - - [parameter(Mandatory = $true)] - [System.Boolean] - $FirstManagementServer, - - [System.UInt16] - $ManagementServicePort = 5723, - - [System.Management.Automation.PSCredential] - $ActionAccount, - - [System.Management.Automation.PSCredential] - $DASAccount, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $DataReader, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $DataWriter, - - [parameter(Mandatory = $true)] - [System.String] - $SqlServerInstance, - - [System.String] - $DatabaseName = "OperationsManager", - - [System.UInt16] - $DatabaseSize = 1000, - - [parameter(Mandatory = $true)] - [System.String] - $DwSqlServerInstance, - - [System.String] - $DwDatabaseName = "OperationsManagerDW", - - [System.UInt16] - $DwDatabaseSize = 1000, - - [System.Byte] - $UseMicrosoftUpdate, - - [System.Byte] - $SendCEIPReports, - - [ValidateSet("Never","Queued","Always")] - [System.String] - $EnableErrorReporting = "Never", - - [System.Byte] - $SendODRReports - ) - - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "setup.exe" - $Path = ResolvePath $Path - $Version = (Get-Item -Path $Path).VersionInfo.ProductVersion - - switch($Version) - { - "7.1.10226.0" - { - $IdentifyingNumber = "{C92727BE-BD12-4140-96A6-276BA4F60AC1}" - $InstallRegVersion = "12" - } - "7.2.10015.0" - { - $IdentifyingNumber = "{43C498CB-D391-4B07-9C03-85C4E8239102}" - $InstallRegVersion = "12" - } - Default - { - throw "Unknown version of Operations Manager!" - } - } - - switch($Ensure) - { - "Present" - { - # Set defaults, if they couldn't be set in param due to null configdata input - if($ManagementServicePort -eq 0) - { - $ManagementServicePort = 5723 - } - if($DatabaseSize -eq 0) - { - $DatabaseSize = 1000 - } - if($DwDatabaseSize -eq 0) - { - $DwDatabaseSize = 1000 - } - if($UseMicrosoftUpdate -ne 1) - { - $UseMicrosoftUpdate = 0 - } - if($SendCEIPReports -ne 1) - { - $SendCEIPReports = 0 - } - if($SendODRReports -ne 1) - { - $SendODRReports = 0 - } - - # Remove default instance name - $SqlServerInstance = $SqlServerInstance.Replace("\MSSQLSERVER","") - $DwSqlServerInstance = $DwSqlServerInstance.Replace("\MSSQLSERVER","") - - # Create install arguments - $Arguments = "/silent /install /AcceptEndUserLicenseAgreement:1 /components:OMServer" - $ArgumentVars = @( - "InstallPath", - "UseMicrosoftUpdate", - "SendCEIPReports", - "EnableErrorReporting", - "SendODRReports", - "ManagementServicePort", - "SqlServerInstance", - "DatabaseName" - ) - if($FirstManagementServer) - { - $ArgumentVars += @( - "ManagementGroupName", - "DatabaseSize", - "DwSqlServerInstance", - "DwDatabaseName", - "DwDatabaseSize" - ) - } - foreach($ArgumentVar in $ArgumentVars) - { - if(!([String]::IsNullOrEmpty((Get-Variable -Name $ArgumentVar).Value))) - { - $Arguments += " /$ArgumentVar`:" + [Environment]::ExpandEnvironmentVariables((Get-Variable -Name $ArgumentVar).Value) - } - } - $AccountVars = @("ActionAccount","DASAccount","DataReader","DataWriter") - foreach($AccountVar in $AccountVars) - { - if($PSBoundParameters.ContainsKey("ActionAccount") -or $PSBoundParameters.ContainsKey($AccountVar)) - { - $Arguments += " /$AccountVar`User:" + (Get-Variable -Name $AccountVar).Value.UserName - $Arguments += " /$AccountVar`Password:" + (Get-Variable -Name $AccountVar).Value.GetNetworkCredential().Password - } - else - { - if(($AccountVar -eq "ActionAccount") -or ($AccountVar -eq "DASAccount")) - { - $Arguments += " /UseLocalSystem$AccountVar" - } - } - } - - # Replace sensitive values for verbose output - $Log = $Arguments - $LogVars = @("ActionAccount","DASAccount","DataReader","DataWriter") - foreach($LogVar in $LogVars) - { - if((Get-Variable -Name $LogVar).Value -ne "") - { - $Log = $Log.Replace((Get-Variable -Name $LogVar).Value.GetNetworkCredential().Password,"********") - } - } - } - "Absent" - { - # Create uninstall arguments - $Arguments = "/silent /uninstall /components:OMServer" - $Log = $Arguments - } - } - - Write-Verbose "Path: $Path" - Write-Verbose "Arguments: $Log" - - $Process = StartWin32Process -Path $Path -Arguments $Arguments -Credential $SetupCredential -AsTask - Write-Verbose $Process - WaitForWin32ProcessEnd -Path $Path -Arguments $Arguments -Credential $SetupCredential - - # Additional first Management Server "Present" actions - if(($Ensure -eq "Present") -and $FirstManagementServer -and (Get-WmiObject -Class Win32_Product | Where-Object {$_.IdentifyingNumber -eq $IdentifyingNumber})) - { - # Set ProductKey - if($PSBoundParameters.ContainsKey("ProductKey")) - { - Write-Verbose "Set product key" - Invoke-Command -ComputerName . -Credential $SetupCredential -Authentication Credssp -ScriptBlock { - $ProductKey = $args[0] - $InstallRegVersion = $args[1] - $InstallPath = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\System Center Operations Manager\$InstallRegVersion\Setup" -Name "InstallDirectory").InstallDirectory - Import-Module "$([Environment]::ExpandEnvironmentVariables($InstallPath))\Powershell\OperationsManager" - Set-SCOMLicense -ProductID $ProductKey -Confirm:$false - } -ArgumentList @($ProductKey,$InstallRegVersion) - Restart-Service omsdk - Restart-Service cshost - } - # Wait for Management Service - $ErrorActionPreference = "SilentlyContinue" - foreach($Port in @($ManagementServicePort,5724)) - { - $MSOpen = $false - while(!$MSOpen) - { - $Socket = New-Object Net.Sockets.TcpClient - $Socket.Connect("localhost",$Port) - if($Socket.Connected) - { - $MSOpen = $true - } - else - { - Write-Verbose "Wait for Management Server port $Port to open" - Start-Sleep 60 - } - $Socket = $null - } - } - $ErrorActionPreference = "Continue" - # Allow MS to initialize - Start-Sleep 300 - } - - if((Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Name 'PendingFileRenameOperations' -ErrorAction SilentlyContinue) -ne $null) - { - $global:DSCMachineStatus = 1 - } - else - { - if(!(Test-TargetResource @PSBoundParameters)) - { - throw "Set-TargetResouce failed" - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\OperationsManager.en", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.String] - $ProductKey, - - [System.String] - $InstallPath, - - [parameter(Mandatory = $true)] - [System.String] - $ManagementGroupName, - - [parameter(Mandatory = $true)] - [System.Boolean] - $FirstManagementServer, - - [System.UInt16] - $ManagementServicePort = 5723, - - [System.Management.Automation.PSCredential] - $ActionAccount, - - [System.Management.Automation.PSCredential] - $DASAccount, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $DataReader, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $DataWriter, - - [parameter(Mandatory = $true)] - [System.String] - $SqlServerInstance, - - [System.String] - $DatabaseName = "OperationsManager", - - [System.UInt16] - $DatabaseSize = 1000, - - [parameter(Mandatory = $true)] - [System.String] - $DwSqlServerInstance, - - [System.String] - $DwDatabaseName = "OperationsManagerDW", - - [System.UInt16] - $DwDatabaseSize = 1000, - - [System.Byte] - $UseMicrosoftUpdate, - - [System.Byte] - $SendCEIPReports, - - [ValidateSet("Never","Queued","Always")] - [System.String] - $EnableErrorReporting = "Never", - - [System.Byte] - $SendODRReports - ) - - $result = ((Get-TargetResource @PSBoundParameters).Ensure -eq $Ensure) - - $result -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMManagementServerSetup/MSFT_xSCOMManagementServerSetup.schema.mof b/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMManagementServerSetup/MSFT_xSCOMManagementServerSetup.schema.mof deleted file mode 100644 index 0128671f..00000000 --- a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMManagementServerSetup/MSFT_xSCOMManagementServerSetup.schema.mof +++ /dev/null @@ -1,31 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSCOMManagementServerSetup")] -class MSFT_xSCOMManagementServerSetup : OMI_BaseResource -{ - [Key, Description("An enumerated value that describes if the OM management server is expected to be installed on the machine.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Required, Description("UNC path to the root of the source files for installation.")] String SourcePath; - [Write, Description("Folder within the source path containing the source files for installation.")] String SourceFolder; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the installation.")] String SetupCredential; - [Write, Description("Product key for licensed installations.")] String ProductKey; - [Write, Description("Installation path for the software.")] String InstallPath; - [Required, Description("The name of the management group.")] String ManagementGroupName; - [Required, Description("Is this the first Management Server?")] Boolean FirstManagementServer; - [Write, Description("Change the Management Server port on install.")] UInt16 ManagementServicePort; - [Write, EmbeddedInstance("MSFT_Credential"), Description("The domain and user name of the Management server action account.")] String ActionAccount; - [Read, Description("Output username of the Management server action account.")] String ActionAccountUsername; - [Write, EmbeddedInstance("MSFT_Credential"), Description("The domain and user name of the Data Access service account.")] String DASAccount; - [Read, Description("Output username of the Data Access service account.")] String DASAccountUsername; - [Required, EmbeddedInstance("MSFT_Credential"), Description("The domain and user name of the data reader account.")] String DataReader; - [Read, Description("Output username of the data reader account.")] String DataReaderUsername; - [Required, EmbeddedInstance("MSFT_Credential"), Description("The domain and user name of the data Writer account.")] String DataWriter; - [Read, Description("Output username of the data writer account.")] String DataWriterUsername; - [Required, Description("The SQL server and instance.")] String SqlServerInstance; - [Write, Description("The name of the Operational database.")] String DatabaseName; - [Write, Description("The size in MB of the Operational database.")] UInt16 DatabaseSize; - [Required, Description("The data warehouse server and instance.")] String DwSqlServerInstance; - [Write, Description("The name of the data warehouse database.")] String DwDatabaseName; - [Write, Description("The size in MB of the data warehouse database.")] UInt16 DwDatabaseSize; - [Write, Description("0: Do not opt in to Microsoft Update. 1: Opt in to Microsoft Update.")] UInt8 UseMicrosoftUpdate; - [Write, Description("0: Do not opt in to the Customer Experience Improvement Program (CEIP). 1: Opt in to CEIP.")] UInt8 SendCEIPReports; - [Write, Description("Never: Do not opt in to sending automatic error reports. Queued: Opt in to sending error reports, but queue the reports for review before sending. Always: Opt in to automatically send error reports."), ValueMap{"Never","Queued","Always"}, Values{"Never","Queued","Always"}] String EnableErrorReporting; - [Write, Description("0: Do not opt in to sending operational data reports. 1: opt in to sending operational data reports.")] UInt8 SendODRReports; -}; diff --git a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMManagementServerUpdate/MSFT_xSCOMManagementServerUpdate.psm1 b/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMManagementServerUpdate/MSFT_xSCOMManagementServerUpdate.psm1 deleted file mode 100644 index 3c2f3eb0..00000000 --- a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMManagementServerUpdate/MSFT_xSCOMManagementServerUpdate.psm1 +++ /dev/null @@ -1,183 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\OperationsManager.en\Updates", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - $Version = (Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -eq "System Center Operations Manager 2012 Server"}).Version - - switch($Version) - { - "7.1.10226.0" - { - $ProductCode = "{C92727BE-BD12-4140-96A6-276BA4F60AC1}" - $PatchID = "{F6930A3E-016D-4F88-9186-440090A836DF}" - $Update = "Update Rollup 4" - } - "7.2.10015.0" - { - $returnValue = @{ - Ensure = "Present" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - Update = "None" - } - } - $null - { - $returnValue = @{ - Ensure = "Absent" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - } - } - Default - { - throw "Unknown version of Operations Manager!" - } - } - - if($ProductCode -and $PatchID -and (Get-WmiObject -Class Win32_PatchPackage | Where-Object {($_.ProductCode -eq $ProductCode) -and ($_.PatchID -eq $PatchID)})) - { - $returnValue = @{ - Ensure = "Present" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - Update = $Update - } - } - else - { - $returnValue = @{ - Ensure = "Absent" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\OperationsManager.en\Updates", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - $Version = (Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -eq "System Center Operations Manager 2012 Server"}).Version - - switch($Version) - { - "7.1.10226.0" - { - $UpdateFile = "KB2992020-AMD64-Server.msp" - } - "7.2.10015.0" - { - Write-Verbose "No update for this version of Operations Manager!" - } - $null - { - Write-Verbose "Operations Manager Management Server not installed!" - } - Default - { - throw "Unknown version of Operations Manager!" - } - } - - if($UpdateFile) - { - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - $Path = "msiexec.exe" - $Path = ResolvePath $Path - Write-Verbose "Path: $Path" - - $MSPPath = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath $UpdateFile - $MSPPath = ResolvePath $MSPPath - $Arguments = "/update $MSPPath /norestart" - Write-Verbose "Arguments: $Arguments" - - $Process = StartWin32Process -Path $Path -Arguments $Arguments -Credential $SetupCredential - Write-Verbose $Process - WaitForWin32ProcessEnd -Path $Path -Arguments $Arguments -Credential $SetupCredential - } - - if((Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Name 'PendingFileRenameOperations' -ErrorAction SilentlyContinue) -ne $null) - { - $global:DSCMachineStatus = 1 - } - else - { - if(!(Test-TargetResource @PSBoundParameters)) - { - throw "Set-TargetResouce failed" - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\OperationsManager.en\Updates", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - $result = ((Get-TargetResource @PSBoundParameters).Ensure -eq $Ensure) - - $result -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMManagementServerUpdate/MSFT_xSCOMManagementServerUpdate.schema.mof b/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMManagementServerUpdate/MSFT_xSCOMManagementServerUpdate.schema.mof deleted file mode 100644 index a5401c7b..00000000 --- a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMManagementServerUpdate/MSFT_xSCOMManagementServerUpdate.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSCOMManagementServerUpdate")] -class MSFT_xSCOMManagementServerUpdate : OMI_BaseResource -{ - [Key, Description("An enumerated value that describes if the update is expected to be installed on the machine.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Required, Description("UNC path to the root of the source files for installation.")] String SourcePath; - [Write, Description("Folder within the source path containing the source files for installation.")] String SourceFolder; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the installation.")] String SetupCredential; - [Read, Description("Display name of the update.")] String Update; -}; diff --git a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMReportingServerSetup/MSFT_xSCOMReportingServerSetup.psm1 b/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMReportingServerSetup/MSFT_xSCOMReportingServerSetup.psm1 deleted file mode 100644 index f78e4c07..00000000 --- a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMReportingServerSetup/MSFT_xSCOMReportingServerSetup.psm1 +++ /dev/null @@ -1,333 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\OperationsManager.en", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.String] - $InstallPath, - - [parameter(Mandatory = $true)] - [System.String] - $ManagementServer, - - [parameter(Mandatory = $true)] - [System.String] - $SRSInstance, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $DataReader, - - [System.Byte] - $UseMicrosoftUpdate, - - [System.Byte] - $SendCEIPReports, - - [ValidateSet("Never","Queued","Always")] - [System.String] - $EnableErrorReporting = "Never", - - [System.Byte] - $SendODRReports - ) - - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "setup.exe" - $Path = ResolvePath $Path - $Version = (Get-Item -Path $Path).VersionInfo.ProductVersion - - switch($Version) - { - "7.1.10226.0" - { - $IdentifyingNumber = "{D6E655E7-6318-4C50-B184-55E70DB179C1}" - $InstallRegVersion = "12" - $RegVersion = "3.0" - } - "7.2.10015.0" - { - $IdentifyingNumber = "{49AD38CD-4502-4CE5-83DE-73A76B28F14B}" - $InstallRegVersion = "12" - $RegVersion = "3.0" - } - Default - { - throw "Unknown version of Operations Manager!" - } - } - - if(Get-WmiObject -Class Win32_Product | Where-Object {$_.IdentifyingNumber -eq $IdentifyingNumber}) - { - $InstallPath = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\System Center Operations Manager\$InstallRegVersion\Setup" -Name "InstallDirectory").InstallDirectory - $ManagementServer = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft Operations Manager\$RegVersion\Reporting" -Name "DefaultSDKServiceMachine").DefaultSDKServiceMachine - $SRSInstance = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft Operations Manager\$RegVersion\Reporting" -Name "SRSInstance").SRSInstance - $InstanceName = $SRSInstance.Split("\")[1] - if(($InstanceName -eq "MSSQLSERVER") -or ($InstanceName -eq $null)) - { - $RSServiceName = "ReportServer" - } - else - { - $RSServiceName = "ReportServer`$$InstanceName" - } - $DataReaderUsername = (Get-WmiObject -Class Win32_Service | Where-Object {$_.Name -eq $RSServiceName}).StartName - - $returnValue = @{ - Ensure = "Present" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - InstallPath = $InstallPath - ManagementServer = $ManagementServer - SRSInstance = $SRSInstance - DataReaderUsername = $DataReaderUsername - } - } - else - { - $returnValue = @{ - Ensure = "Absent" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\OperationsManager.en", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.String] - $InstallPath, - - [parameter(Mandatory = $true)] - [System.String] - $ManagementServer, - - [parameter(Mandatory = $true)] - [System.String] - $SRSInstance, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $DataReader, - - [System.Byte] - $UseMicrosoftUpdate, - - [System.Byte] - $SendCEIPReports, - - [ValidateSet("Never","Queued","Always")] - [System.String] - $EnableErrorReporting = "Never", - - [System.Byte] - $SendODRReports - ) - - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "setup.exe" - $Path = ResolvePath $Path - $Version = (Get-Item -Path $Path).VersionInfo.ProductVersion - - switch($Version) - { - "7.1.10226.0" - { - $IdentifyingNumber = "{D6E655E7-6318-4C50-B184-55E70DB179C1}" - $MSIdentifyingNumber = "{C92727BE-BD12-4140-96A6-276BA4F60AC1}" - } - "7.2.10015.0" - { - $IdentifyingNumber = "{49AD38CD-4502-4CE5-83DE-73A76B28F14B}" - $MSIdentifyingNumber = "{43C498CB-D391-4B07-9C03-85C4E8239102}" - } - Default - { - throw "Unknown version of Operations Manager!" - } - } - - switch($Ensure) - { - "Present" - { - # Set defaults, if they couldn't be set in param due to null configdata input - if($UseMicrosoftUpdate -ne 1) - { - $UseMicrosoftUpdate = 0 - } - if($SendCEIPReports -ne 1) - { - $SendCEIPReports = 0 - } - if($SendODRReports -ne 1) - { - $SendODRReports = 0 - } - - # Remove default instance name - $SRSInstance = $SRSInstance.Replace("\MSSQLSERVER","") - - # Create install arguments - $Arguments = "/silent /install /AcceptEndUserLicenseAgreement:1 /components:OMReporting" - $ArgumentVars = @( - "InstallPath", - "UseMicrosoftUpdate", - "SendCEIPReports", - "EnableErrorReporting", - "SendODRReports" - ) - if(!(Get-WmiObject -Class Win32_Product | Where-Object {$_.IdentifyingNumber -eq $MSIdentifyingNumber})) - { - $ArgumentVars += @("ManagementServer") - } - $ArgumentVars += @("SRSInstance") - $Arguments += " /DataReaderUser:" + $DataReader.UserName - $Arguments += " /DataReaderPassword:" + $DataReader.GetNetworkCredential().Password - foreach($ArgumentVar in $ArgumentVars) - { - if(!([String]::IsNullOrEmpty((Get-Variable -Name $ArgumentVar).Value))) - { - $Arguments += " /$ArgumentVar`:" + [Environment]::ExpandEnvironmentVariables((Get-Variable -Name $ArgumentVar).Value) - } - } - - # Replace sensitive values for verbose output - $Log = $Arguments - $LogVars = @("DataReader") - foreach($LogVar in $LogVars) - { - if((Get-Variable -Name $LogVar).Value -ne "") - { - $Log = $Log.Replace((Get-Variable -Name $LogVar).Value.GetNetworkCredential().Password,"********") - } - } - } - "Absent" - { - # Create uninstall arguments - $Arguments = "/silent /uninstall /components:OMReporting" - $Log = $Arguments - } - } - - Write-Verbose "Path: $Path" - Write-Verbose "Arguments: $Log" - - $Process = StartWin32Process -Path $Path -Arguments $Arguments -Credential $SetupCredential -AsTask - Write-Verbose $Process - WaitForWin32ProcessEnd -Path $Path -Arguments $Arguments -Credential $SetupCredential - - if((Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Name 'PendingFileRenameOperations' -ErrorAction SilentlyContinue) -ne $null) - { - $global:DSCMachineStatus = 1 - } - else - { - if(!(Test-TargetResource @PSBoundParameters)) - { - throw "Set-TargetResouce failed" - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\OperationsManager.en", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.String] - $InstallPath, - - [parameter(Mandatory = $true)] - [System.String] - $ManagementServer, - - [parameter(Mandatory = $true)] - [System.String] - $SRSInstance, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $DataReader, - - [System.Byte] - $UseMicrosoftUpdate, - - [System.Byte] - $SendCEIPReports, - - [ValidateSet("Never","Queued","Always")] - [System.String] - $EnableErrorReporting = "Never", - - [System.Byte] - $SendODRReports - ) - - $result = ((Get-TargetResource @PSBoundParameters).Ensure -eq $Ensure) - - $result -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMReportingServerSetup/MSFT_xSCOMReportingServerSetup.schema.mof b/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMReportingServerSetup/MSFT_xSCOMReportingServerSetup.schema.mof deleted file mode 100644 index 9cbd21c6..00000000 --- a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMReportingServerSetup/MSFT_xSCOMReportingServerSetup.schema.mof +++ /dev/null @@ -1,17 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSCOMReportingServerSetup")] -class MSFT_xSCOMReportingServerSetup : OMI_BaseResource -{ - [Key, Description("An enumerated value that describes if the OM Reporting server is expected to be installed on the machine.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Required, Description("UNC path to the root of the source files for installation.")] String SourcePath; - [Write, Description("Folder within the source path containing the source files for installation.")] String SourceFolder; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the installation.")] String SetupCredential; - [Write, Description("Installation path for the software.")] String InstallPath; - [Required, Description("The name of the management server associated with the Reporting server.")] String ManagementServer; - [Required, Description("The reporting server and instance.")] String SRSInstance; - [Required, EmbeddedInstance("MSFT_Credential"), Description("The domain and user name of the data reader account.")] String DataReader; - [Read, Description("Output username of the data reader account.")] String DataReaderUsername; - [Write, Description("0: Do not opt in to Microsoft Update. 1: Opt in to Microsoft Update.")] UInt8 UseMicrosoftUpdate; - [Write, Description("0: Do not opt in to the Customer Experience Improvement Program (CEIP). 1: Opt in to CEIP.")] UInt8 SendCEIPReports; - [Write, Description("Never: Do not opt in to sending automatic error reports. Queued: Opt in to sending error reports, but queue the reports for review before sending. Always: Opt in to automatically send error reports."), ValueMap{"Never","Queued","Always"}, Values{"Never","Queued","Always"}] String EnableErrorReporting; - [Write, Description("0: Do not opt in to sending operational data reports. 1: opt in to sending operational data reports.")] UInt8 SendODRReports; -}; diff --git a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMWebConsoleServerSetup/MSFT_xSCOMWebConsoleServerSetup.psm1 b/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMWebConsoleServerSetup/MSFT_xSCOMWebConsoleServerSetup.psm1 deleted file mode 100644 index 6346f950..00000000 --- a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMWebConsoleServerSetup/MSFT_xSCOMWebConsoleServerSetup.psm1 +++ /dev/null @@ -1,315 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\OperationsManager.en", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.String] - $InstallPath, - - [parameter(Mandatory = $true)] - [System.String] - $ManagementServer, - - [System.String] - $WebSiteName = "Default Web Site", - - [ValidateSet("Mixed","Network")] - [System.String] - $WebConsoleAuthorizationMode = "Mixed", - - [System.Boolean] - $WebConsoleUseSSL = $false, - - [System.Byte] - $UseMicrosoftUpdate, - - [System.Byte] - $SendCEIPReports, - - [ValidateSet("Never","Queued","Always")] - [System.String] - $EnableErrorReporting = "Never", - - [System.Byte] - $SendODRReports - ) - - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "setup.exe" - $Path = ResolvePath $Path - $Version = (Get-Item -Path $Path).VersionInfo.ProductVersion - - switch($Version) - { - "7.1.10226.0" - { - $IdentifyingNumber = "{B9853D74-E2A7-446C-851D-5B5374671D0B}" - $InstallRegVersion = "12" - } - "7.2.10015.0" - { - $IdentifyingNumber = "{E533B951-2CAA-454F-A186-383F203E591D}" - $InstallRegVersion = "12" - } - Default - { - throw "Unknown version of Operations Manager!" - } - } - - if(Get-WmiObject -Class Win32_Product | Where-Object {$_.IdentifyingNumber -eq $IdentifyingNumber}) - { - $InstallPath = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\System Center Operations Manager\$InstallRegVersion\Setup" -Name "InstallDirectory").InstallDirectory - $ManagementServer = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\System Center Operations Manager\$InstallRegVersion\Setup\WebConsole" -Name "DEFAULT_SERVER").DEFAULT_SERVER - $WebSiteID = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\System Center Operations Manager\$InstallRegVersion\Setup\WebConsole" -Name "WEBSITE_ID").WEBSITE_ID - - $returnValue = @{ - Ensure = "Present" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - InstallPath = $InstallPath - ManagementServer = $ManagementServer - } - } - else - { - $returnValue = @{ - Ensure = "Absent" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\OperationsManager.en", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.String] - $InstallPath, - - [parameter(Mandatory = $true)] - [System.String] - $ManagementServer, - - [System.String] - $WebSiteName = "Default Web Site", - - [ValidateSet("Mixed","Network")] - [System.String] - $WebConsoleAuthorizationMode = "Mixed", - - [System.Boolean] - $WebConsoleUseSSL = $false, - - [System.Byte] - $UseMicrosoftUpdate, - - [System.Byte] - $SendCEIPReports, - - [ValidateSet("Never","Queued","Always")] - [System.String] - $EnableErrorReporting = "Never", - - [System.Byte] - $SendODRReports - ) - - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "setup.exe" - $Path = ResolvePath $Path - $Version = (Get-Item -Path $Path).VersionInfo.ProductVersion - - switch($Version) - { - "7.1.10226.0" - { - $IdentifyingNumber = "{B9853D74-E2A7-446C-851D-5B5374671D0B}" - $MSIdentifyingNumber = "{C92727BE-BD12-4140-96A6-276BA4F60AC1}" - } - "7.2.10015.0" - { - $IdentifyingNumber = "{E533B951-2CAA-454F-A186-383F203E591D}" - $MSIdentifyingNumber = "{43C498CB-D391-4B07-9C03-85C4E8239102}" - } - Default - { - throw "Unknown version of Operations Manager!" - } - } - - switch($Ensure) - { - "Present" - { - # Set defaults, if they couldn't be set in param due to null configdata input - if($UseMicrosoftUpdate -ne 1) - { - $UseMicrosoftUpdate = 0 - } - if($SendCEIPReports -ne 1) - { - $SendCEIPReports = 0 - } - if($SendODRReports -ne 1) - { - $SendODRReports = 0 - } - - # Create install arguments - $Arguments = "/silent /install /AcceptEndUserLicenseAgreement:1 /components:OMWebConsole" - $ArgumentVars = @( - "InstallPath", - "UseMicrosoftUpdate", - "SendCEIPReports", - "EnableErrorReporting", - "SendODRReports" - ) - if(!(Get-WmiObject -Class Win32_Product | Where-Object {$_.IdentifyingNumber -eq $MSIdentifyingNumber})) - { - $ArgumentVars += @("ManagementServer") - } - $ArgumentVars += @( - "WebSiteName" - "WebConsoleAuthorizationMode" - ) - if($WebConsoleUseSSL) - { - $Arguments += " /WebConsoleUseSSL" - } - foreach($ArgumentVar in $ArgumentVars) - { - if(!([String]::IsNullOrEmpty((Get-Variable -Name $ArgumentVar).Value))) - { - $Arguments += " /$ArgumentVar`:" + [Environment]::ExpandEnvironmentVariables((Get-Variable -Name $ArgumentVar).Value) - } - } - } - "Absent" - { - # Create uninstall arguments - $Arguments = "/silent /uninstall /components:OMWebConsole" - } - } - - Write-Verbose "Path: $Path" - Write-Verbose "Arguments: $Arguments" - - $Process = StartWin32Process -Path $Path -Arguments $Arguments -Credential $SetupCredential -AsTask - Write-Verbose $Process - WaitForWin32ProcessEnd -Path $Path -Arguments $Arguments -Credential $SetupCredential - - if((Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Name 'PendingFileRenameOperations' -ErrorAction SilentlyContinue) -ne $null) - { - $global:DSCMachineStatus = 1 - } - else - { - if(!(Test-TargetResource @PSBoundParameters)) - { - throw "Set-TargetResouce failed" - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\OperationsManager.en", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.String] - $InstallPath, - - [parameter(Mandatory = $true)] - [System.String] - $ManagementServer, - - [System.String] - $WebSiteName = "Default Web Site", - - [ValidateSet("Mixed","Network")] - [System.String] - $WebConsoleAuthorizationMode = "Mixed", - - [System.Boolean] - $WebConsoleUseSSL = $false, - - [System.Byte] - $UseMicrosoftUpdate, - - [System.Byte] - $SendCEIPReports, - - [ValidateSet("Never","Queued","Always")] - [System.String] - $EnableErrorReporting = "Never", - - [System.Byte] - $SendODRReports - ) - - $result = ((Get-TargetResource @PSBoundParameters).Ensure -eq $Ensure) - - $result -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMWebConsoleServerSetup/MSFT_xSCOMWebConsoleServerSetup.schema.mof b/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMWebConsoleServerSetup/MSFT_xSCOMWebConsoleServerSetup.schema.mof deleted file mode 100644 index ab3f22c1..00000000 --- a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMWebConsoleServerSetup/MSFT_xSCOMWebConsoleServerSetup.schema.mof +++ /dev/null @@ -1,17 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSCOMWebConsoleServerSetup")] -class MSFT_xSCOMWebConsoleServerSetup : OMI_BaseResource -{ - [Key, Description("An enumerated value that describes if the OM Web Console server is expected to be installed on the machine.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Required, Description("UNC path to the root of the source files for installation.")] String SourcePath; - [Write, Description("Folder within the source path containing the source files for installation.")] String SourceFolder; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the installation.")] String SetupCredential; - [Write, Description("Installation path for the software.")] String InstallPath; - [Required, Description("The name of the management server associated with the Reporting server.")] String ManagementServer; - [Write, Description("The name of the website.")] String WebSiteName; - [Write, Description("Mixed: Used for intranet scenarios. Network: Used for extranet scenarios."), ValueMap{"Mixed","Network"}, Values{"Mixed","Network"}] String WebConsoleAuthorizationMode; - [Write, Description("Specify only if your website has Secure Sockets Layer (SSL) activated. ")] Boolean WebConsoleUseSSL; - [Write, Description("0: Do not opt in to Microsoft Update. 1: Opt in to Microsoft Update.")] UInt8 UseMicrosoftUpdate; - [Write, Description("0: Do not opt in to the Customer Experience Improvement Program (CEIP). 1: Opt in to CEIP.")] UInt8 SendCEIPReports; - [Write, Description("Never: Do not opt in to sending automatic error reports. Queued: Opt in to sending error reports, but queue the reports for review before sending. Always: Opt in to automatically send error reports."), ValueMap{"Never","Queued","Always"}, Values{"Never","Queued","Always"}] String EnableErrorReporting; - [Write, Description("0: Do not opt in to sending operational data reports. 1: opt in to sending operational data reports.")] UInt8 SendODRReports; -}; diff --git a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMWebConsoleServerUpdate/MSFT_xSCOMWebConsoleServerUpdate.psm1 b/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMWebConsoleServerUpdate/MSFT_xSCOMWebConsoleServerUpdate.psm1 deleted file mode 100644 index a07c76a8..00000000 --- a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMWebConsoleServerUpdate/MSFT_xSCOMWebConsoleServerUpdate.psm1 +++ /dev/null @@ -1,183 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\OperationsManager.en\Updates", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - $Version = (Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -eq "System Center Operations Manager 2012 Web Console"}).Version - - switch($Version) - { - "7.1.10226.0" - { - $ProductCode = "{B9853D74-E2A7-446C-851D-5B5374671D0B}" - $PatchID = "{063BBCA9-4C1D-441A-8BD4-9ACDFF250054}" - $Update = "Update Rollup 4" - } - "7.2.10015.0" - { - $returnValue = @{ - Ensure = "Present" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - Update = "None" - } - } - $null - { - $returnValue = @{ - Ensure = "Absent" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - } - } - Default - { - throw "Unknown version of Operations Manager!" - } - } - - if($ProductCode -and $PatchID -and (Get-WmiObject -Class Win32_PatchPackage | Where-Object {($_.ProductCode -eq $ProductCode) -and ($_.PatchID -eq $PatchID)})) - { - $returnValue = @{ - Ensure = "Present" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - Update = $Update - } - } - else - { - $returnValue = @{ - Ensure = "Absent" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\OperationsManager.en\Updates", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - $Version = (Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -eq "System Center Operations Manager 2012 Web Console"}).Version - - switch($Version) - { - "7.1.10226.0" - { - $UpdateFile = "KB2992020-AMD64-ENU-WebConsole.msp" - } - "7.2.10015.0" - { - Write-Verbose "No update for this version of Operations Manager!" - } - $null - { - Write-Verbose "Operations Manager Web Console Server not installed!" - } - Default - { - throw "Unknown version of Operations Manager!" - } - } - - if($UpdateFile) - { - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - $Path = "msiexec.exe" - $Path = ResolvePath $Path - Write-Verbose "Path: $Path" - - $MSPPath = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath $UpdateFile - $MSPPath = ResolvePath $MSPPath - $Arguments = "/update $MSPPath /norestart" - Write-Verbose "Arguments: $Arguments" - - $Process = StartWin32Process -Path $Path -Arguments $Arguments -Credential $SetupCredential - Write-Verbose $Process - WaitForWin32ProcessEnd -Path $Path -Arguments $Arguments -Credential $SetupCredential - } - - if((Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Name 'PendingFileRenameOperations' -ErrorAction SilentlyContinue) -ne $null) - { - $global:DSCMachineStatus = 1 - } - else - { - if(!(Test-TargetResource @PSBoundParameters)) - { - throw "Set-TargetResouce failed" - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\OperationsManager.en\Updates", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - $result = ((Get-TargetResource @PSBoundParameters).Ensure -eq $Ensure) - - $result -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMWebConsoleServerUpdate/MSFT_xSCOMWebConsoleServerUpdate.schema.mof b/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMWebConsoleServerUpdate/MSFT_xSCOMWebConsoleServerUpdate.schema.mof deleted file mode 100644 index e04dbb9a..00000000 --- a/lib/puppet_x/dsc_resources/xSCOM/DSCResources/MSFT_xSCOMWebConsoleServerUpdate/MSFT_xSCOMWebConsoleServerUpdate.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSCOMWebConsoleServerUpdate")] -class MSFT_xSCOMWebConsoleServerUpdate : OMI_BaseResource -{ - [Key, Description("An enumerated value that describes if the update is expected to be installed on the machine.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Required, Description("UNC path to the root of the source files for installation.")] String SourcePath; - [Write, Description("Folder within the source path containing the source files for installation.")] String SourceFolder; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the installation.")] String SetupCredential; - [Read, Description("Display name of the update.")] String Update; -}; diff --git a/lib/puppet_x/dsc_resources/xSCOM/LICENSE b/lib/puppet_x/dsc_resources/xSCOM/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xSCOM/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xSCOM/en-US/xPDT.strings.psd1 b/lib/puppet_x/dsc_resources/xSCOM/en-US/xPDT.strings.psd1 deleted file mode 100644 index 11f213c1..00000000 --- a/lib/puppet_x/dsc_resources/xSCOM/en-US/xPDT.strings.psd1 +++ /dev/null @@ -1,10 +0,0 @@ -ConvertFrom-StringData @' -FileNotFound=File not found in the environment path -AbsolutePathOrFileName=Absolute path or file name expected -InvalidArgument=Invalid argument: '{0}' with value: '{1}' -InvalidArgumentAndMessage={0} {1} -ErrorStarting=Failure starting process matching path '{0}'. Message: {1} -FailureWaitingForProcessesToStart=Failed to wait for processes to start -ProcessStarted=Process matching path '{0}' started in process ID {1} -ProcessAlreadyStarted=Process matching path '{0}' already started in process ID {1} -'@ diff --git a/lib/puppet_x/dsc_resources/xSCOM/xPDT.psm1 b/lib/puppet_x/dsc_resources/xSCOM/xPDT.psm1 deleted file mode 100644 index c90beaa1..00000000 --- a/lib/puppet_x/dsc_resources/xSCOM/xPDT.psm1 +++ /dev/null @@ -1,708 +0,0 @@ -data LocalizedData -{ - ConvertFrom-StringData @' - -FileNotFound=File not found in the environment path -AbsolutePathOrFileName=Absolute path or file name expected -InvalidArgument=Invalid argument: '{0}' with value: '{1}' -InvalidArgumentAndMessage={0} {1} -ErrorStarting=Failure starting process matching path '{0}'. Message: {1} -FailureWaitingForProcessesToStart=Failed to wait for processes to start -ProcessStarted=Process matching path '{0}' started in process ID {1} -ProcessAlreadyStarted=Process matching path '{0}' already started in process ID {1} -'@ -} - -Import-LocalizedData LocalizedData -filename xPDT.strings.psd1 - -function ThrowInvalidArgumentError -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $errorId, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $errorMessage - ) - - $errorCategory=[System.Management.Automation.ErrorCategory]::InvalidArgument - $exception = New-Object System.ArgumentException $errorMessage; - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - throw $errorRecord -} - -function ResolvePath -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Path - ) - - $Path = [Environment]::ExpandEnvironmentVariables($Path) - if(IsRootedPath $Path) - { - if(!(Test-Path $Path -PathType Leaf)) - { - ThrowInvalidArgumentError "CannotFindRootedPath" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.FileNotFound) - } - return $Path - } - if([string]::IsNullOrEmpty($env:Path)) - { - ThrowInvalidArgumentError "EmptyEnvironmentPath" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.FileNotFound) - } - if((Split-Path $Path -Leaf) -ne $Path) - { - ThrowInvalidArgumentError "NotAbsolutePathOrFileName" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.AbsolutePathOrFileName) - } - foreach($rawSegment in $env:Path.Split(";")) - { - $segment = [Environment]::ExpandEnvironmentVariables($rawSegment) - $segmentRooted = $false - try - { - $segmentRooted=[IO.Path]::IsPathRooted($segment) - } - catch {} - if(!$segmentRooted) - { - continue - } - $candidate = join-path $segment $Path - if(Test-Path $candidate -PathType Leaf) - { - return $candidate - } - } - ThrowInvalidArgumentError "CannotFindRelativePath" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.FileNotFound) -} - -function IsRootedPath -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path - ) - - try - { - return [IO.Path]::IsPathRooted($Path) - } - catch - { - ThrowInvalidArgumentError "CannotGetIsPathRooted" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $_.Exception.Message) - } -} - -function ExtractArguments -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - $functionBoundParameters, - - [parameter(Mandatory = $true)] - [string[]] - $argumentNames, - - [string[]] - $newArgumentNames - ) - - $returnValue=@{} - - for($i=0;$i -lt $argumentNames.Count;$i++) - { - $argumentName = $argumentNames[$i] - - if($newArgumentNames -eq $null) - { - $newArgumentName = $argumentName - } - else - { - $newArgumentName = $newArgumentNames[$i] - } - - if($functionBoundParameters.ContainsKey($argumentName)) - { - $null = $returnValue.Add($newArgumentName,$functionBoundParameters[$argumentName]) - } - } - - return $returnValue -} - -function CallPInvoke -{ - $script:ProgramSource = @" -using System; -using System.Collections.Generic; -using System.Text; -using System.Security; -using System.Runtime.InteropServices; -using System.Diagnostics; -using System.Security.Principal; -using System.ComponentModel; -using System.IO; - -namespace Source -{ - [SuppressUnmanagedCodeSecurity] - public static class NativeMethods - { - //The following structs and enums are used by the various Win32 API's that are used in the code below - - [StructLayout(LayoutKind.Sequential)] - public struct STARTUPINFO - { - public Int32 cb; - public string lpReserved; - public string lpDesktop; - public string lpTitle; - public Int32 dwX; - public Int32 dwY; - public Int32 dwXSize; - public Int32 dwXCountChars; - public Int32 dwYCountChars; - public Int32 dwFillAttribute; - public Int32 dwFlags; - public Int16 wShowWindow; - public Int16 cbReserved2; - public IntPtr lpReserved2; - public IntPtr hStdInput; - public IntPtr hStdOutput; - public IntPtr hStdError; - } - - [StructLayout(LayoutKind.Sequential)] - public struct PROCESS_INFORMATION - { - public IntPtr hProcess; - public IntPtr hThread; - public Int32 dwProcessID; - public Int32 dwThreadID; - } - - [Flags] - public enum LogonType - { - LOGON32_LOGON_INTERACTIVE = 2, - LOGON32_LOGON_NETWORK = 3, - LOGON32_LOGON_BATCH = 4, - LOGON32_LOGON_SERVICE = 5, - LOGON32_LOGON_UNLOCK = 7, - LOGON32_LOGON_NETWORK_CLEARTEXT = 8, - LOGON32_LOGON_NEW_CREDENTIALS = 9 - } - - [Flags] - public enum LogonProvider - { - LOGON32_PROVIDER_DEFAULT = 0, - LOGON32_PROVIDER_WINNT35, - LOGON32_PROVIDER_WINNT40, - LOGON32_PROVIDER_WINNT50 - } - [StructLayout(LayoutKind.Sequential)] - public struct SECURITY_ATTRIBUTES - { - public Int32 Length; - public IntPtr lpSecurityDescriptor; - public bool bInheritHandle; - } - - public enum SECURITY_IMPERSONATION_LEVEL - { - SecurityAnonymous, - SecurityIdentification, - SecurityImpersonation, - SecurityDelegation - } - - public enum TOKEN_TYPE - { - TokenPrimary = 1, - TokenImpersonation - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - internal struct TokPriv1Luid - { - public int Count; - public long Luid; - public int Attr; - } - - public const int GENERIC_ALL_ACCESS = 0x10000000; - public const int CREATE_NO_WINDOW = 0x08000000; - internal const int SE_PRIVILEGE_ENABLED = 0x00000002; - internal const int TOKEN_QUERY = 0x00000008; - internal const int TOKEN_ADJUST_PRIVILEGES = 0x00000020; - internal const string SE_INCRASE_QUOTA = "SeIncreaseQuotaPrivilege"; - - [DllImport("kernel32.dll", - EntryPoint = "CloseHandle", SetLastError = true, - CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] - public static extern bool CloseHandle(IntPtr handle); - - [DllImport("advapi32.dll", - EntryPoint = "CreateProcessAsUser", SetLastError = true, - CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] - public static extern bool CreateProcessAsUser( - IntPtr hToken, - string lpApplicationName, - string lpCommandLine, - ref SECURITY_ATTRIBUTES lpProcessAttributes, - ref SECURITY_ATTRIBUTES lpThreadAttributes, - bool bInheritHandle, - Int32 dwCreationFlags, - IntPtr lpEnvrionment, - string lpCurrentDirectory, - ref STARTUPINFO lpStartupInfo, - ref PROCESS_INFORMATION lpProcessInformation - ); - - [DllImport("advapi32.dll", EntryPoint = "DuplicateTokenEx")] - public static extern bool DuplicateTokenEx( - IntPtr hExistingToken, - Int32 dwDesiredAccess, - ref SECURITY_ATTRIBUTES lpThreadAttributes, - Int32 ImpersonationLevel, - Int32 dwTokenType, - ref IntPtr phNewToken - ); - - [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] - public static extern Boolean LogonUser( - String lpszUserName, - String lpszDomain, - String lpszPassword, - LogonType dwLogonType, - LogonProvider dwLogonProvider, - out IntPtr phToken - ); - - [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)] - internal static extern bool AdjustTokenPrivileges( - IntPtr htok, - bool disall, - ref TokPriv1Luid newst, - int len, - IntPtr prev, - IntPtr relen - ); - - [DllImport("kernel32.dll", ExactSpelling = true)] - internal static extern IntPtr GetCurrentProcess(); - - [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)] - internal static extern bool OpenProcessToken( - IntPtr h, - int acc, - ref IntPtr phtok - ); - - [DllImport("advapi32.dll", SetLastError = true)] - internal static extern bool LookupPrivilegeValue( - string host, - string name, - ref long pluid - ); - - public static void CreateProcessAsUser(string strCommand, string strDomain, string strName, string strPassword) - { - var hToken = IntPtr.Zero; - var hDupedToken = IntPtr.Zero; - TokPriv1Luid tp; - var pi = new PROCESS_INFORMATION(); - var sa = new SECURITY_ATTRIBUTES(); - sa.Length = Marshal.SizeOf(sa); - Boolean bResult = false; - try - { - bResult = LogonUser( - strName, - strDomain, - strPassword, - LogonType.LOGON32_LOGON_BATCH, - LogonProvider.LOGON32_PROVIDER_DEFAULT, - out hToken - ); - if (!bResult) - { - throw new Win32Exception("The user could not be logged on. Ensure that the user has an existing profile on the machine and that correct credentials are provided. Logon error #" + Marshal.GetLastWin32Error().ToString()); - } - IntPtr hproc = GetCurrentProcess(); - IntPtr htok = IntPtr.Zero; - bResult = OpenProcessToken( - hproc, - TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, - ref htok - ); - if(!bResult) - { - throw new Win32Exception("Open process token error #" + Marshal.GetLastWin32Error().ToString()); - } - tp.Count = 1; - tp.Luid = 0; - tp.Attr = SE_PRIVILEGE_ENABLED; - bResult = LookupPrivilegeValue( - null, - SE_INCRASE_QUOTA, - ref tp.Luid - ); - if(!bResult) - { - throw new Win32Exception("Error in looking up privilege of the process. This should not happen if DSC is running as LocalSystem Lookup privilege error #" + Marshal.GetLastWin32Error().ToString()); - } - bResult = AdjustTokenPrivileges( - htok, - false, - ref tp, - 0, - IntPtr.Zero, - IntPtr.Zero - ); - if(!bResult) - { - throw new Win32Exception("Token elevation error #" + Marshal.GetLastWin32Error().ToString()); - } - - bResult = DuplicateTokenEx( - hToken, - GENERIC_ALL_ACCESS, - ref sa, - (int)SECURITY_IMPERSONATION_LEVEL.SecurityIdentification, - (int)TOKEN_TYPE.TokenPrimary, - ref hDupedToken - ); - if(!bResult) - { - throw new Win32Exception("Duplicate Token error #" + Marshal.GetLastWin32Error().ToString()); - } - var si = new STARTUPINFO(); - si.cb = Marshal.SizeOf(si); - si.lpDesktop = ""; - bResult = CreateProcessAsUser( - hDupedToken, - null, - strCommand, - ref sa, - ref sa, - false, - 0, - IntPtr.Zero, - null, - ref si, - ref pi - ); - if(!bResult) - { - throw new Win32Exception("The process could not be created. Create process as user error #" + Marshal.GetLastWin32Error().ToString()); - } - } - finally - { - if (pi.hThread != IntPtr.Zero) - { - CloseHandle(pi.hThread); - } - if (pi.hProcess != IntPtr.Zero) - { - CloseHandle(pi.hProcess); - } - if (hDupedToken != IntPtr.Zero) - { - CloseHandle(hDupedToken); - } - } - } - } -} - -"@ - Add-Type -TypeDefinition $ProgramSource -ReferencedAssemblies "System.ServiceProcess" -} - -function GetWin32Process -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [PSCredential] - $Credential - ) - - $fileName = [io.path]::GetFileNameWithoutExtension($Path) - $GetProcesses = @(Get-Process -Name $fileName -ErrorAction SilentlyContinue) - $Processes = foreach($process in $GetProcesses) - { - if($Process.Path -ieq $Path) - { - try - { - [wmi]"Win32_Process.Handle='$($Process.Id)'" - } - catch - { - } - } - } - if($PSBoundParameters.ContainsKey('Credential')) - { - $Processes = $Processes | Where-Object {(GetWin32ProcessOwner $_) -eq $Credential.UserName} - } - if($Arguments -eq $null) {$Arguments = ""} - $Processes = $Processes | Where-Object {(GetWin32ProcessArgumentsFromCommandLine $_.CommandLine) -eq $Arguments} - - return $Processes -} - -function GetWin32ProcessOwner -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNull()] - $Process - ) - - try - { - $Owner = $Process.GetOwner() - } - catch - {} - if($owner.Domain -ne $null) - { - return $Owner.Domain + "\" + $Owner.User - } - else - { - return $Owner.User - } -} - -function GetWin32ProcessArgumentsFromCommandLine -{ - param - ( - [String] - $commandLine - ) - - if($commandLine -eq $null) - { - return "" - } - $commandLine=$commandLine.Trim() - if($commandLine.Length -eq 0) - { - return "" - } - if($commandLine[0] -eq '"') - { - $charToLookfor=[char]'"' - } - else - { - $charToLookfor=[char]' ' - } - $endOfCommand=$commandLine.IndexOf($charToLookfor ,1) - if($endOfCommand -eq -1) - { - return "" - } - return $commandLine.Substring($endOfCommand+1).Trim() -} - -function StartWin32Process -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [PSCredential] - $Credential, - - [Switch] - $AsTask - ) - - $GetArguments = ExtractArguments $PSBoundParameters ("Path","Arguments","Credential") - $Processes = @(GetWin32Process @getArguments) - if ($processes.Count -eq 0) - { - if($PSBoundParameters.ContainsKey("Credential")) - { - if($AsTask) - { - $ActionArguments = ExtractArguments $PSBoundParameters ` - ("Path", "Arguments") ` - ("Execute", "Argument") - if([string]::IsNullOrEmpty($Arguments)) - { - $null = $ActionArguments.Remove("Argument") - } - $TaskGuid = [guid]::NewGuid().ToString() - $Action = New-ScheduledTaskAction @ActionArguments - $null = Register-ScheduledTask -TaskName "xPDT $TaskGuid" -Action $Action -User $Credential.UserName -Password $Credential.GetNetworkCredential().Password -RunLevel Highest - $err = Start-ScheduledTask -TaskName "xPDT $TaskGuid" - } - else - { - try - { - CallPInvoke - [Source.NativeMethods]::CreateProcessAsUser(("$Path " + $Arguments),$Credential.GetNetworkCredential().Domain,$Credential.GetNetworkCredential().UserName,$Credential.GetNetworkCredential().Password) - } - catch - { - $exception = New-Object System.ArgumentException $_ - $errorCategory = [System.Management.Automation.ErrorCategory]::OperationStopped - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, "Win32Exception", $errorCategory, $null - $err = $errorRecord - } - } - } - else - { - $StartArguments = ExtractArguments $PSBoundParameters ` - ("Path", "Arguments", "Credential") ` - ("FilePath", "ArgumentList", "Credential") - if([string]::IsNullOrEmpty($Arguments)) - { - $null = $StartArguments.Remove("ArgumentList") - } - $err = Start-Process @StartArguments - } - if($err -ne $null) - { - throw $err - } - if (!(WaitForWin32ProcessStart @GetArguments)) - { - ThrowInvalidArgumentError "FailureWaitingForProcessesToStart" ($LocalizedData.ErrorStarting -f $Path,$LocalizedData.FailureWaitingForProcessesToStart) - } - } - else - { - return ($LocalizedData.ProcessAlreadyStarted -f $Path,$Processes.ProcessId) - } - $Processes = @(GetWin32Process @getArguments) - return ($LocalizedData.ProcessStarted -f $Path,$Processes.ProcessId) -} - -function WaitForWin32ProcessStart -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [PSCredential] - $Credential - ) - - $start = [DateTime]::Now - $GetArguments = ExtractArguments $PSBoundParameters ("Path","Arguments","Credential") - do - { - $value = @(GetWin32Process @GetArguments).Count -ge 1 - } while(!$value -and ([DateTime]::Now - $start).TotalMilliseconds -lt 60000) - - return $value -} - -function WaitForWin32ProcessEnd -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [PSCredential] - $Credential - ) - - $GetArguments = ExtractArguments $PSBoundParameters ("Path","Arguments","Credential") - While (WaitForWin32ProcessStart @GetArguments) - { - Start-Sleep 1 - } - Get-ScheduledTask | Where-Object {($_.TaskName.Length -ge 4) -and ($_.TaskName.Substring(0,4) -eq "xPDT") -and ($_.Actions.Execute -eq $Path) -and ($_.Actions.Arguments -eq $Arguments)} | Where-Object {$_ -ne $null} | Unregister-ScheduledTask -Confirm:$false -} - -function NetUse -{ - param - ( - [parameter(Mandatory)] - [string] - $SourcePath, - - [parameter(Mandatory)] - [PSCredential] - $Credential, - - [string] - $Ensure = "Present" - ) - - if(($SourcePath.Length -ge 2) -and ($SourcePath.Substring(0,2) -eq "\\")) - { - - if ($Ensure -eq "Absent") - { - $cmd = "net.exe use $SourcePath /del" - } - else - { - $cmd = "net.exe use $SourcePath $($Credential.GetNetworkCredential().Password) /user:$($Credential.GetNetworkCredential().Domain)\$($Credential.GetNetworkCredential().UserName)" - } - Invoke-Expression $cmd - } -} - -Export-ModuleMember ResolvePath,StartWin32Process,WaitForWin32ProcessEnd,NetUse diff --git a/lib/puppet_x/dsc_resources/xSCOM/xSCOM.psd1 b/lib/puppet_x/dsc_resources/xSCOM/xSCOM.psd1 deleted file mode 100644 index 3563d69c..00000000 --- a/lib/puppet_x/dsc_resources/xSCOM/xSCOM.psd1 +++ /dev/null @@ -1,31 +0,0 @@ -@{ -# Version number of this module. -ModuleVersion = '1.3.3.0' - -# ID used to uniquely identify this module -GUID = '990eecbc-0f40-43cb-89dd-b43c79904f56' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'Module with DSC Resources for deployment and configuration of Microsoft System Center Operations Manager.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Minimum version of the common language runtime (CLR) required by this module -CLRVersion = '4.0' - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' -} diff --git a/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xRunbookDirectory/MSFT_xRunbookDirectory.psm1 b/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xRunbookDirectory/MSFT_xRunbookDirectory.psm1 deleted file mode 100644 index 974e3ba6..00000000 --- a/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xRunbookDirectory/MSFT_xRunbookDirectory.psm1 +++ /dev/null @@ -1,250 +0,0 @@ -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData -StringData @' - FindingRunbookDefinition = Finding runbook definition for {0}. - ExistinRunbookDefinition = Existing Runbook definition found. - CreatingTempFile = Creating temp file at {0}. - RunbookFoundMatches = Runbook found matches. No import needed. - RunbookDifferencesFound = Runbook differences found. Import needed. - RemovingTempFile = Removing temp file at {0}. - ImportTwice = Importing all runbooks twice to build all dependencies. - ImportingRunbook = Importing Runbook {0}. - ImportNotRequired = An import is not required. - ImportRequired = An import is required. - ImportCount = Import number {0}. - RemovingRunbook = Removing runbook {0}. - FailedToRemoveRunbook = Failed to remove Runbook {0}. -'@ -} - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Published", "Draft", "Absent")] - [System.String] - $Ensure = "Published", - - [parameter(Mandatory = $true)] - [System.String] - $RunbookPath, - - [parameter(Mandatory = $true)] - [System.String] - $WebServiceEndpoint, - - [Uint32] - $Port = 9090 - ) - - $RunbookPathItems = Get-Item $RunbookPath -Filter *.ps1 - - $ensureStatus = "Absent" - $match = $true - forEach ($RunbookPathItem in $RunbookPathItems) - { - if( $match ) - { - Write-Verbose ( $($LocalizedData.FindingRunbookDefinition) -f $RunbookPathItem.BaseName ) - - # Get runbook definition if one exist - $runbookFound = $false - try - { - if( $Ensure -eq "Published" ) - { - $runbookDefinition = Get-SmaRunbookDefinition -Name $($RunbookPathItem.BaseName) -WebServiceEndpoint $WebServiceEndpoint -Port $port -Type 'Published' -ErrorAction Stop - - $ensureStatus = "Published" - } - else - { - $runbookDefinition = Get-SmaRunbookDefinition -Name $($RunbookPathItem.BaseName) -WebServiceEndpoint $WebServiceEndpoint -Port $port -Type 'Draft' -ErrorAction Stop - - $ensureStatus = "Draft" - } - - $runbookFound = $true - Write-Verbose ( $LocalizedData.ExistinRunbookDefinition ) - } - catch - { - Write-Verbose $_ - $match = $false - } - - if( $runbookFound ) - { - # Can't compare the value of the $runbookDefinition.Content variable to a file, so writing it to a file, then will compare that. - $runbookTempPath = "$env:TEMP\$($RunbookPathItem.BaseName).ps1" - - Write-Verbose ( $($LocalizedData.CreatingTempFile) -f $runbookTempPath) - $runbookDefinition.Content.ToString() | Out-File -FilePath $runbookTempPath - - $compare = Compare-Object -ReferenceObject (Get-Content $RunbookPathItem.FullName) -DifferenceObject (Get-Content $runbookTempPath) - if( $compare -eq $null ) - { - Write-Verbose ( $LocalizedData.RunbookFoundMatches ) - } - Else - { - # Compare-Object sometimes returns new lines as a difference, this can cause repeated re-imports if that new line is at the top of the ps1 - # since SMA will strip this out on import. - - foreach( $difference in $compare ) - { - if( $difference.InputObject -ne "" ) - { - Write-Verbose ( $LocalizedData.RunbookDifferencesFound ) - $match = $false - } - } - - if( $match ) - { - Write-Verbose ( $LocalizedData.RunbookFoundMatches ) - } - } - - Write-Verbose ( $($LocalizedData.RemovingTempFile) -f $runbookTempPath ) - Remove-Item -Path $runbookTempPath - } - } - } - - $returnValue = @{ - Ensure = [System.String]$ensureStatus - RunbookPath = [System.String]$RunbookPath - WebServiceEndpoint = [System.String]$WebServiceEndpoint - Port = [System.String]$Port - Matches = [System.Boolean]$match - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Published", "Draft", "Absent")] - [System.String] - $Ensure = "Published", - - [parameter(Mandatory = $true)] - [System.String] - $RunbookPath, - - [parameter(Mandatory = $true)] - [System.String] - $WebServiceEndpoint, - - [Uint32] - $Port = 9090 - ) - - $RunbookPathItems = Get-Item $RunbookPath -Filter *.ps1 - - if( $Ensure -eq "Absent") - { - forEach ($RunbookPathItem in $RunbookPathItems) - { - try - { - Write-Verbose ( $($LocalizedData.RemovingRunbook) -f $RunbookPathItem.BaseName) - - Remove-SmaRunbook -Name $RunbookPathItem.BaseName -WebServiceEndpoint $WebServiceEndpoint -Port $port -ErrorAction Stop - } - catch - { - Write-Verbose ( $($LocalizedData.FailedToRemoveRunbook) -f $RunbookPathItem.BaseName) - } - } - } - else - { - Write-Verbose ( $LocalizedData.ImportTwice ) - for($k = 1; $k -lt 3; $k++) - { - Write-Verbose ( $($LocalizedData.ImportCount) -f $k ) - forEach ($RunbookPathItem in $RunbookPathItems) - { - # try to edit an existing runbook with the same name, this saves a read to verify that the runbook exist. - # if error, assume the runbook has never been imported - Write-Verbose ( $($LocalizedData.ImportingRunbook) -f $RunbookPathItem.BaseName ) - try - { - Edit-SmaRunbook -Path $RunbookPathItem.FullName -Name $RunbookPathItem.BaseName -WebServiceEndpoint $WebServiceEndpoint -Port $port -Overwrite -ErrorAction Stop - } - catch - { - Import-SmaRunbook -Path $RunbookPathItem.FullName -WebServiceEndpoint $WebServiceEndpoint -Port $port -ErrorAction Stop - } - } - } - - if( $Ensure -eq "Published" ) - { - forEach ($RunbookPathItem in $RunbookPathItems) - { - Publish-SmaRunbook -Name $RunbookPathItem.BaseName -WebServiceEndpoint $WebServiceEndpoint -Port $port -ErrorAction Stop - } - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Published", "Draft", "Absent")] - [System.String] - $Ensure = "Published", - - [parameter(Mandatory = $true)] - [System.String] - $RunbookPath, - - [parameter(Mandatory = $true)] - [System.String] - $WebServiceEndpoint, - - [Uint32] - $Port = 9090 - ) - - $results = Get-TargetResource @PSBoundParameters - - if( ($Ensure -eq "Published") -or ($Ensure -eq "Draft") ) - { - if( ($results.Ensure -eq $Ensure) -and ($results.Matches -eq $true) ) - { - Write-Verbose ( $LocalizedData.ImportNotRequired ) - return $true - } - } - - if( ($results.Ensure -eq "Absent") -and ($Ensure -eq "Absent") ) - { - Write-Verbose ( $LocalizedData.ImportNotRequired ) - return $true - } - - Write-Verbose ( $LocalizedData.ImportRequired ) - return $false -} - - -Export-ModuleMember -Function Get-TargetResource, Set-TargetResource, Test-TargetResource - diff --git a/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xRunbookDirectory/MSFT_xRunbookDirectory.schema.mof b/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xRunbookDirectory/MSFT_xRunbookDirectory.schema.mof deleted file mode 100644 index 1a022477..00000000 --- a/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xRunbookDirectory/MSFT_xRunbookDirectory.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("RunbookDirectory")] -class MSFT_xRunbookDirectory : OMI_BaseResource -{ - [Required, Description("The import state of runbooks found at RunbookPath. This can be Published, Draft, or Absent"), ValueMap{"Published","Draft","Absent"}, Values{"Published","Draft","Absent"}] String Ensure; - [Key, Description("Path to Runbook(s) to be imported. Accepts wildcards.")] String RunbookPath; - [Read, Description("Describes the validity of the imported Runbook(s).")] Boolean Matches; - [Key, Description("URL of SMA's web service endpoint.")] String WebServiceEndpoint; - [Write, Description("Port of the SMA web site. Defaults to the SMA default of 9090.")] Uint32 Port; -}; - diff --git a/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSCSMAPowerShellSetup/MSFT_xSCSMAPowerShellSetup.psm1 b/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSCSMAPowerShellSetup/MSFT_xSCSMAPowerShellSetup.psm1 deleted file mode 100644 index 433b294e..00000000 --- a/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSCSMAPowerShellSetup/MSFT_xSCSMAPowerShellSetup.psm1 +++ /dev/null @@ -1,199 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\Orchestrator", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "\SetupOrchestrator.exe" - $Path = ResolvePath $Path - $Version = (Get-Item -Path $Path).VersionInfo.ProductVersion - - switch($Version) - { - "7.2.84.0" - { - $IdentifyingNumber = "{EF2760C1-FED5-45FD-B067-D9419F7DEBEF}" - } - "7.2.503.0" - { - $IdentifyingNumber = "{EF2760C1-FED5-45FD-B067-D9419F7DEBEF}" - } - "7.3.150.0" - { - # System Center Technical Preview 5 - $IdentifyingNumber = "{EF2760C1-FED5-45FD-B067-D9419F7DEBEF}" - } - "7.3.345.0" - { - # System Center 2016 - $IdentifyingNumber = "{EF2760C1-FED5-45FD-B067-D9419F7DEBEF}" - } - Default - { - throw "Unknown version of Service Management Automation!" - } - } - - if(Get-WmiObject -Class Win32_Product -filter "IdentifyingNumber ='$IdentifyingNumber'") - { - $returnValue = @{ - Ensure = "Present" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - } - } - else - { - $returnValue = @{ - Ensure = "Absent" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\Orchestrator", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "\SetupOrchestrator.exe" - $Path = ResolvePath $Path - $Version = (Get-Item -Path $Path).VersionInfo.ProductVersion - - switch($Version) - { - "7.2.84.0" - { - $IdentifyingNumber = "{EF2760C1-FED5-45FD-B067-D9419F7DEBEF}" - } - "7.2.503.0" - { - $IdentifyingNumber = "{EF2760C1-FED5-45FD-B067-D9419F7DEBEF}" - } - "7.3.150.0" - { - # System Center Technical Preview 5 - $IdentifyingNumber = "{EF2760C1-FED5-45FD-B067-D9419F7DEBEF}" - } - "7.3.345.0" - { - # System Center 2016 - $IdentifyingNumber = "{EF2760C1-FED5-45FD-B067-D9419F7DEBEF}" - } - Default - { - throw "Unknown version of Service Management Automation!" - } - } - - $Path = "msiexec.exe" - $Path = ResolvePath $Path - Write-Verbose "Path: $Path" - - switch($Ensure) - { - "Present" - { - $MSIPath = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "\SMA\PowerShellModuleInstaller.msi" - $MSIPath = ResolvePath $MSIPath - Write-Verbose "MSIPath: $MSIPath" - $Arguments = "/q /i $MSIPath ALLUSERS=2" - } - "Absent" - { - $Arguments = "/q /x $IdentifyingNumber" - } - } - - Write-Verbose "Arguments: $Arguments" - - $Process = StartWin32Process -Path $Path -Arguments $Arguments -Credential $SetupCredential - Write-Verbose $Process - WaitForWin32ProcessEnd -Path $Path -Arguments $Arguments -Credential $SetupCredential - - if((Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Name 'PendingFileRenameOperations' -ErrorAction SilentlyContinue) -ne $null) - { - $global:DSCMachineStatus = 1 - } - else - { - if(!(Test-TargetResource @PSBoundParameters)) - { - throw "Set-TargetResouce failed" - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\Orchestrator", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - $result = ((Get-TargetResource @PSBoundParameters).Ensure -eq $Ensure) - - $result -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSCSMAPowerShellSetup/MSFT_xSCSMAPowerShellSetup.schema.mof b/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSCSMAPowerShellSetup/MSFT_xSCSMAPowerShellSetup.schema.mof deleted file mode 100644 index f1efdcbc..00000000 --- a/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSCSMAPowerShellSetup/MSFT_xSCSMAPowerShellSetup.schema.mof +++ /dev/null @@ -1,8 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSCSMAPowerShellSetup")] -class MSFT_xSCSMAPowerShellSetup : OMI_BaseResource -{ - [Key, Description("An enumerated value that describes if SMA PowerShell is expected to be installed on the machine.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Required, Description("UNC path to the root of the source files for installation.")] String SourcePath; - [Write, Description("Folder within the source path containing the source files for installation.")] String SourceFolder; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the installation.")] String SetupCredential; -}; diff --git a/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSCSMARunbookWorkerServerSetup/MSFT_xSCSMARunbookWorkerServerSetup.psm1 b/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSCSMARunbookWorkerServerSetup/MSFT_xSCSMARunbookWorkerServerSetup.psm1 deleted file mode 100644 index 2260f722..00000000 --- a/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSCSMARunbookWorkerServerSetup/MSFT_xSCSMARunbookWorkerServerSetup.psm1 +++ /dev/null @@ -1,367 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\Orchestrator", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $Service, - - [parameter(Mandatory = $true)] - [System.String] - $SqlServer, - - [parameter(Mandatory = $true)] - [System.String] - $SqlInstance, - - [System.String] - $SqlDatabase = "SMA", - - [System.String] - $InstallFolder, - - [System.String] - $ETWManifest = "Yes", - - [System.String] - $SendCEIPReports = "No", - - [System.String] - $MSUpdate = "No", - - [System.String] - $ProductKey - ) - - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "\SMA\WebServiceSetup.exe" - $Path = ResolvePath $Path - $Version = (Get-Item -Path $Path).VersionInfo.ProductVersion - - switch($Version) - { - "7.2.1563.0" - { - $IdentifyingNumber = "{B2FA6B22-1DDF-4BD4-8B92-ADF17D48262F}" - } - "7.2.5002.0" - { - $IdentifyingNumber = "{B2FA6B22-1DDF-4BD4-8B92-ADF17D48262F}" - } - "7.3.150.0" - { - # System Center Technical Preview 5 - $IdentifyingNumber = "{B2FA6B22-1DDF-4BD4-8B92-ADF17D48262F}" - } - "7.3.345.0" - { - # System Center 2016 RTM - $IdentifyingNumber = "{B2FA6B22-1DDF-4BD4-8B92-ADF17D48262F}" - } - Default - { - throw "Unknown version of Service Management Automation!" - } - } - - if(Get-WmiObject -Class Win32_Product -Filter "IdentifyingNumber ='$IdentifyingNumber'") - { - $ServiceUsername = (Get-WmiObject -Class Win32_Service -Filter "Name ='rbsvc'").StartName - $SqlServer = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\ServiceManagementAutomation\RunbookWorker" -Name "DatabaseServerName").DatabaseServerName - $SqlInstance = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\ServiceManagementAutomation\RunbookWorker" -Name "DatabaseServerInstance").DatabaseServerInstance - if([String]::IsNullOrEmpty($SqlInstance)) - { - $SqlInstance = "MSSQLSERVER" - } - $SqlDatabase = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\ServiceManagementAutomation\RunbookWorker" -Name "DatabaseName").DatabaseName - $InstallFolder = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\ServiceManagementAutomation\RunbookWorker" -Name "InstallationFolder").InstallationFolder - - $returnValue = @{ - Ensure = "Present" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - ServiceUsername = $ServiceUsername - SqlServer = $SqlServer - SqlInstance = $SqlInstance - SqlDatabase = $SqlDatabase - InstallFolder = $InstallFolder - } - } - else - { - $returnValue = @{ - Ensure = "Absent" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\Orchestrator", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $Service, - - [parameter(Mandatory = $true)] - [System.String] - $SqlServer, - - [parameter(Mandatory = $true)] - [System.String] - $SqlInstance, - - [System.String] - $SqlDatabase = "SMA", - - [System.String] - $InstallFolder, - - [System.String] - $ETWManifest = "Yes", - - [System.String] - $SendCEIPReports = "No", - - [System.String] - $MSUpdate = "No", - - [System.String] - $ProductKey - ) - - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "\SMA\WebServiceSetup.exe" - $Path = ResolvePath $Path - $Version = (Get-Item -Path $Path).VersionInfo.ProductVersion - - switch($Version) - { - "7.2.1563.0" - { - $IdentifyingNumber = "{B2FA6B22-1DDF-4BD4-8B92-ADF17D48262F}" - $SCVersion = "System Center 2012 R2" - } - "7.2.5002.0" - { - $IdentifyingNumber = "{B2FA6B22-1DDF-4BD4-8B92-ADF17D48262F}" - $SCVersion = "System Center Technical Preview" - } - "7.3.150.0" - { - $IdentifyingNumber = "{B2FA6B22-1DDF-4BD4-8B92-ADF17D48262F}" - $SCVersion = "System Center Technical Preview 5" - } - "7.3.345.0" - { - # System Center 2016 RTM - $IdentifyingNumber = "{B2FA6B22-1DDF-4BD4-8B92-ADF17D48262F}" - $SCVersion = "System Center 2016" - } - Default - { - throw "Unknown version of Service Management Automation!" - } - } - - $Path = "msiexec.exe" - $Path = ResolvePath $Path - - switch($Ensure) - { - "Present" - { - # Set defaults, if they couldn't be set in param due to null configdata input - foreach($ArgumentVar in ("ETWManifest","SendCEIPReports","MSUpdate")) - { - if((Get-Variable -Name $ArgumentVar).Value -ne "Yes") - { - Set-Variable -Name $ArgumentVar -Value "No" - } - - } - - $MSIPath = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "\SMA\WorkerInstaller.msi" - $MSIPath = ResolvePath $MSIPath - Write-Verbose "MSIPath: $MSIPath" - - # Create install arguments - $Arguments = "/q /i $MSIPath" - if(($PSVersionTable.PSVersion.Major -eq 5) -and ($SCVersion -eq "System Center 2012 R2")) - { - $MSTPath = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "\SMA\WMF5Worker.mst" - $MSTPath = ResolvePath $MSTPath - Write-Verbose "MSTPath: $MSTPath" - $Arguments += " TRANSFORMS=$MSTPath" - } - $Arguments += " ALLUSERS=2 CreateDatabase=No DatabaseAuthentication=Windows" - $ArgumentVars = @( - "SqlServer", - "SqlDatabase", - "InstallFolder", - "ETWManifest" - "SendCEIPReports", - "MSUpdate", - "ProductKey" - ) - if($SQLInstance -ne "MSSQLSERVER") - { - $ArgumentVars += @( - "SqlInstance" - ) - } - foreach($ArgumentVar in $ArgumentVars) - { - if(!([String]::IsNullOrEmpty((Get-Variable -Name $ArgumentVar).Value))) - { - $Arguments += " $ArgumentVar=`"" + [Environment]::ExpandEnvironmentVariables((Get-Variable -Name $ArgumentVar).Value) + "`"" - } - } - $AccountVars = @("Service") - foreach($AccountVar in $AccountVars) - { - $Arguments += " $AccountVar`Account=`"" + (Get-Variable -Name $AccountVar).Value.UserName + "`"" - $Arguments += " $AccountVar`Password=`"" + (Get-Variable -Name $AccountVar).Value.GetNetworkCredential().Password + "`"" - } - - # Replace sensitive values for verbose output - $Log = $Arguments - $LogVars = @("Service") - foreach($LogVar in $LogVars) - { - if((Get-Variable -Name $LogVar).Value -ne "") - { - $Log = $Log.Replace((Get-Variable -Name $LogVar).Value.GetNetworkCredential().Password,"********") - } - } - } - "Absent" - { - $Arguments = "/q /x $IdentifyingNumber" - $Log = $Arguments - } - } - - Write-Verbose "Path: $Path" - Write-Verbose "Arguments: $Log" - - $Process = StartWin32Process -Path $Path -Arguments $Arguments -Credential $SetupCredential - Write-Verbose $Process - WaitForWin32ProcessEnd -Path $Path -Arguments $Arguments -Credential $SetupCredential - - if((Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Name 'PendingFileRenameOperations' -ErrorAction SilentlyContinue) -ne $null) - { - $global:DSCMachineStatus = 1 - } - else - { - if(!(Test-TargetResource @PSBoundParameters)) - { - throw "Set-TargetResouce failed" - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\Orchestrator", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $Service, - - [parameter(Mandatory = $true)] - [System.String] - $SqlServer, - - [parameter(Mandatory = $true)] - [System.String] - $SqlInstance, - - [System.String] - $SqlDatabase = "SMA", - - [System.String] - $InstallFolder, - - [System.String] - $ETWManifest = "Yes", - - [System.String] - $SendCEIPReports = "No", - - [System.String] - $MSUpdate = "No", - - [System.String] - $ProductKey - ) - - $result = ((Get-TargetResource @PSBoundParameters).Ensure -eq $Ensure) - - $result -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSCSMARunbookWorkerServerSetup/MSFT_xSCSMARunbookWorkerServerSetup.schema.mof b/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSCSMARunbookWorkerServerSetup/MSFT_xSCSMARunbookWorkerServerSetup.schema.mof deleted file mode 100644 index 4047c75f..00000000 --- a/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSCSMARunbookWorkerServerSetup/MSFT_xSCSMARunbookWorkerServerSetup.schema.mof +++ /dev/null @@ -1,18 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSCSMARunbookWorkerServerSetup")] -class MSFT_xSCSMARunbookWorkerServerSetup : OMI_BaseResource -{ - [Key, Description("An enumerated value that describes if the SMA Runbook Worker server is expected to be installed on the machine.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Required, Description("UNC path to the root of the source files for installation.")] String SourcePath; - [Write, Description("Folder within the source path containing the source files for installation.")] String SourceFolder; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the installation.")] String SetupCredential; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Service account of the web service application pool.")] String Service; - [Read, Description("Output username of the Service account of the web service application pool.")] String ServiceUserName; - [Required, Description("Name of the SQL Server for the SMA database.")] String SqlServer; - [Required, Description("Name of the SQL Instance for the SMA database.")] String SqlInstance; - [Write, Description("Name of the SMA database.")] String SqlDatabase; - [Write, Description("Installation folder for SMA.")] String InstallFolder; - [Write, Description("Log to ETW.")] String ETWManifest; - [Write, Description("Participate in the Customer Experience Improvement Program.")] String SendCEIPReports; - [Write, Description("Use Microsoft Update.")] String MSUpdate; - [Write, Description("Product key for licensed installations.")] String ProductKey; -}; diff --git a/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSCSMAWebServiceServerSetup/MSFT_xSCSMAWebServiceServerSetup.psm1 b/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSCSMAWebServiceServerSetup/MSFT_xSCSMAWebServiceServerSetup.psm1 deleted file mode 100644 index 200cbeee..00000000 --- a/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSCSMAWebServiceServerSetup/MSFT_xSCSMAWebServiceServerSetup.psm1 +++ /dev/null @@ -1,505 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\Orchestrator", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [parameter(Mandatory = $true)] - [System.Boolean] - $FirstWebServiceServer, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $ApPool, - - [System.String] - $AdminGroupMembers, - - [parameter(Mandatory = $true)] - [System.String] - $SqlServer, - - [parameter(Mandatory = $true)] - [System.String] - $SqlInstance, - - [System.String] - $SqlDatabase = "SMA", - - [System.String] - $SiteName = "SMA", - - [System.UInt16] - $WebServicePort = 9090, - - [System.String] - $InstallFolder, - - [System.String] - $UseSSL = "Yes", - - [System.String] - $SpecifyCertificate = "No", - - [System.String] - $CertificateName = ($env:COMPUTERNAME + "." + (Get-WmiObject -Class Win32_ComputerSystem).Domain), - - [System.String] - $ETWManifest = "Yes", - - [System.String] - $SendCEIPReports = "No", - - [System.String] - $MSUpdate = "No", - - [System.String] - $ProductKey, - - [System.String[]] - $RunbookWorkerServers - ) - - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "\SMA\WorkerSetup.exe" - $Path = ResolvePath $Path - $Version = (Get-Item -Path $Path).VersionInfo.ProductVersion - - switch($Version) - { - "7.2.1563.0" - { - $IdentifyingNumber = "{4B76B636-AE9A-47D5-A246-E02909D97CF2}" - } - "7.2.5002.0" - { - $IdentifyingNumber = "{4B76B636-AE9A-47D5-A246-E02909D97CF2}" - } - "7.3.150.0" - { - # System Center Technical Preview 5 - $IdentifyingNumber = "{4B76B636-AE9A-47D5-A246-E02909D97CF2}" - } - "7.3.345.0" - { - # System Center 2016 RTM - $IdentifyingNumber = "{4B76B636-AE9A-47D5-A246-E02909D97CF2}" - } - Default - { - throw "Unknown version of Service Management Automation!" - } - } - - if(Get-WmiObject -Class win32_product -Filter "IdentifyingNumber='$IdentifyingNumber'") - { - $SqlServer = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\ServiceManagementAutomation\WebService" -Name "DatabaseServerName").DatabaseServerName - $SqlInstance = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\ServiceManagementAutomation\WebService" -Name "DatabaseServerInstance").DatabaseServerInstance - if([String]::IsNullOrEmpty($SqlInstance)) - { - $SqlInstance = "MSSQLSERVER" - } - $SqlDatabase = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\ServiceManagementAutomation\WebService" -Name "DatabaseName").DatabaseName - $InstallFolder = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\ServiceManagementAutomation\WebService" -Name "InstallationFolder").InstallationFolder - $SiteName = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\ServiceManagementAutomation\WebService" -Name "IisSiteName").IisSiteName - $ApPoolUsername = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\ServiceManagementAutomation\WebService" -Name "IisAppPoolAccount").IisAppPoolAccount - $AdminGroupMembers = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\ServiceManagementAutomation\WebService" -Name "IisAuthorizationAdminGroupMembers").IisAuthorizationAdminGroupMembers - if(!(Get-Module -Name Microsoft.SystemCenter.ServiceManagementAutomation)) - { - Import-Module -Name Microsoft.SystemCenter.ServiceManagementAutomation - } - $RunbookWorkerServers = (Get-SmaRunbookWorkerDeployment -WebServiceEndpoint https://localhost).ComputerName - - $returnValue = @{ - Ensure = "Present" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - ApPoolUsername = $ApPoolUsername - AdminGroupMembers = $AdminGroupMembers - SqlServer = $SqlServer - SqlInstance = $SqlInstance - SqlDatabase = $SqlDatabase - SiteName = $SiteName - InstallFolder = $InstallFolder - RunbookWorkerServers = $RunbookWorkerServers - } - } - else - { - $returnValue = @{ - Ensure = "Absent" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\Orchestrator", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [parameter(Mandatory = $true)] - [System.Boolean] - $FirstWebServiceServer, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $ApPool, - - [System.String] - $AdminGroupMembers, - - [parameter(Mandatory = $true)] - [System.String] - $SqlServer, - - [parameter(Mandatory = $true)] - [System.String] - $SqlInstance, - - [System.String] - $SqlDatabase = "SMA", - - [System.String] - $SiteName = "SMA", - - [System.UInt16] - $WebServicePort = 9090, - - [System.String] - $InstallFolder, - - [System.String] - $UseSSL = "Yes", - - [System.String] - $SpecifyCertificate = "No", - - [System.String] - $CertificateName = ($env:COMPUTERNAME + "." + (Get-WmiObject -Class Win32_ComputerSystem).Domain), - - [System.String] - $ETWManifest = "Yes", - - [System.String] - $SendCEIPReports = "No", - - [System.String] - $MSUpdate = "No", - - [System.String] - $ProductKey, - - [System.String[]] - $RunbookWorkerServers - ) - - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "\SMA\WorkerSetup.exe" - $Path = ResolvePath $Path - $Version = (Get-Item -Path $Path).VersionInfo.ProductVersion - - switch($Version) - { - "7.2.1563.0" - { - $IdentifyingNumber = "{4B76B636-AE9A-47D5-A246-E02909D97CF2}" - $SCVersion = "System Center 2012 R2" - } - "7.2.5002.0" - { - $IdentifyingNumber = "{4B76B636-AE9A-47D5-A246-E02909D97CF2}" - $SCVersion = "System Center Technical Preview" - } - "7.3.150.0" - { - $IdentifyingNumber = "{4B76B636-AE9A-47D5-A246-E02909D97CF2}" - $SCVersion = "System Center Technical Preview 5" - } - "7.3.345.0" - { - # System Center 2016 RTM - $IdentifyingNumber = "{4B76B636-AE9A-47D5-A246-E02909D97CF2}" - $SCVersion = "System Center 2016" - } - Default - { - throw "Unknown version of Service Management Automation!" - } - } - - $Path = "msiexec.exe" - $Path = ResolvePath $Path - - switch($Ensure) - { - "Present" - { - # Set defaults, if they couldn't be set in param due to null configdata input - if($WebServicePort -eq 0) - { - $WebServicePort = 9090 - } - foreach($ArgumentVar in ("UseSSL","SpecifyCertificate","ETWManifest","SendCEIPReports","MSUpdate")) - { - if((Get-Variable -Name $ArgumentVar).Value -ne "Yes") - { - Set-Variable -Name $ArgumentVar -Value "No" - } - } - if([String]::IsNullOrEmpty($AdminGroupMembers)) - { - $AdminGroupMembers = $ApPool.UserName - } - else - { - $AdminGroupMembers = "$AdminGroupMembers,$($ApPool.UserName)" - } - - $MSIPath = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "\SMA\WebServiceInstaller.msi" - $MSIPath = ResolvePath $MSIPath - Write-Verbose "MSIPath: $MSIPath" - - # Create install arguments - $Arguments = "/q /i $MSIPath" - if(($PSVersionTable.PSVersion.Major -eq 5) -and ($SCVersion -eq "System Center 2012 R2")) - { - $MSTPath = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "\SMA\WMF5WebService.mst" - $MSTPath = ResolvePath $MSTPath - Write-Verbose "MSTPath: $MSTPath" - $Arguments += " TRANSFORMS=$MSTPath" - } - $Arguments += " ALLUSERS=2 DatabaseAuthentication=Windows UseSSL=Yes" - $ArgumentVars = @( - "AdminGroupMembers", - "SqlServer", - "SqlDatabase", - "SiteName", - "WebServicePort", - "InstallFolder", - "ETWManifest" - "SendCEIPReports", - "MSUpdate", - "ProductKey" - ) - if($SQLInstance -ne "MSSQLSERVER") - { - $ArgumentVars += @( - "SqlInstance" - ) - } - # If SpecifyCertificate = Yes, get serial number - if($SpecifyCertificate -eq "Yes") - { - $Certificates = @(Get-ChildItem -Path "Cert:\LocalMachine\My" | Where-Object {($_.Subject -eq "CN=$CertificateName") -and ($_.Issuer -ne "CN=$CertificateName")} | Where-Object {$_.EnhancedKeyUsageList.ObjectId -eq "1.3.6.1.5.5.7.3.1"}) - if($Certificates.Count -eq 0) - { - $Certificates = @(Get-ChildItem -Path "Cert:\LocalMachine\My" | Where-Object {$_.Subject -eq "CN=$CertificateName"} | Where-Object {$_.EnhancedKeyUsageList.ObjectId -eq "1.3.6.1.5.5.7.3.1"}) - } - if($Certificates.Count -eq 0) - { - $null = New-SelfSignedCertificate -DnsName $CertificateName -CertStoreLocation "Cert:\LocalMachine\My" - $Certificates = @(Get-ChildItem -Path "Cert:\LocalMachine\My" | Where-Object {$_.Subject -eq "CN=$CertificateName"} | Where-Object {$_.EnhancedKeyUsageList.ObjectId -eq "1.3.6.1.5.5.7.3.1"}) - } - $CertificateSerialNumber = $Certificates[0].SerialNumber - $ArgumentVars += @("CertificateSerialNumber") - } - if($FirstWebServiceServer) - { - $Arguments += " CreateDatabase=Yes" - } - else - { - $Arguments += " CreateDatabase=No" - } - foreach($ArgumentVar in $ArgumentVars) - { - if(!([String]::IsNullOrEmpty((Get-Variable -Name $ArgumentVar).Value))) - { - $Arguments += " $ArgumentVar=`"" + [Environment]::ExpandEnvironmentVariables((Get-Variable -Name $ArgumentVar).Value) + "`"" - } - } - $AccountVars = @("ApPool") - foreach($AccountVar in $AccountVars) - { - $Arguments += " $AccountVar`Account=`"" + (Get-Variable -Name $AccountVar).Value.UserName + "`"" - $Arguments += " $AccountVar`Password=`"" + (Get-Variable -Name $AccountVar).Value.GetNetworkCredential().Password + "`"" - } - - # Replace sensitive values for verbose output - $Log = $Arguments - $LogVars = @("ApPool") - foreach($LogVar in $LogVars) - { - if((Get-Variable -Name $LogVar).Value -ne "") - { - $Log = $Log.Replace((Get-Variable -Name $LogVar).Value.GetNetworkCredential().Password,"********") - } - } - } - "Absent" - { - $Arguments = "/q /x $IdentifyingNumber" - $Log = $Arguments - } - } - - Write-Verbose "Path: $Path" - Write-Verbose "Arguments: $Log" - - $Process = StartWin32Process -Path $Path -Arguments $Arguments -Credential $SetupCredential - Write-Verbose $Process - WaitForWin32ProcessEnd -Path $Path -Arguments $Arguments -Credential $SetupCredential - - # Additional first Web Service Server "Present" actions - if(($Ensure -eq "Present") -and $FirstWebServiceServer -and (Get-WmiObject -Class Win32_Product -Filter "IdentifyingNumber ='$IdentifyingNumber'")) - { - if(!(Get-Module -Name Microsoft.SystemCenter.ServiceManagementAutomation)) - { - Import-Module -Name Microsoft.SystemCenter.ServiceManagementAutomation - $Workers = @() - foreach($RunbookWorkerServer in $RunbookWorkerServers) - { - $Workers += $RunbookWorkerServer.Split(".")[0] - } - New-SmaRunbookWorkerDeployment -WebServiceEndpoint https://localhost -ComputerName $Workers - } - } - - if((Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Name 'PendingFileRenameOperations' -ErrorAction SilentlyContinue) -ne $null) - { - $global:DSCMachineStatus = 1 - } - else - { - if(!(Test-TargetResource @PSBoundParameters)) - { - throw "Set-TargetResouce failed" - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\Orchestrator", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [parameter(Mandatory = $true)] - [System.Boolean] - $FirstWebServiceServer, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $ApPool, - - [System.String] - $AdminGroupMembers, - - [parameter(Mandatory = $true)] - [System.String] - $SqlServer, - - [parameter(Mandatory = $true)] - [System.String] - $SqlInstance, - - [System.String] - $SqlDatabase = "SMA", - - [System.String] - $SiteName = "SMA", - - [System.UInt16] - $WebServicePort = 9090, - - [System.String] - $InstallFolder, - - [System.String] - $UseSSL = "Yes", - - [System.String] - $SpecifyCertificate = "No", - - [System.String] - $CertificateName = ($env:COMPUTERNAME + "." + (Get-WmiObject -Class Win32_ComputerSystem).Domain), - - [System.String] - $ETWManifest = "Yes", - - [System.String] - $SendCEIPReports = "No", - - [System.String] - $MSUpdate = "No", - - [System.String] - $ProductKey, - - [System.String[]] - $RunbookWorkerServers - ) - - $result = ((Get-TargetResource @PSBoundParameters).Ensure -eq $Ensure) - - $result -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSCSMAWebServiceServerSetup/MSFT_xSCSMAWebServiceServerSetup.schema.mof b/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSCSMAWebServiceServerSetup/MSFT_xSCSMAWebServiceServerSetup.schema.mof deleted file mode 100644 index 102f4cd1..00000000 --- a/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSCSMAWebServiceServerSetup/MSFT_xSCSMAWebServiceServerSetup.schema.mof +++ /dev/null @@ -1,26 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSCSMAWebServiceServerSetup")] -class MSFT_xSCSMAWebServiceServerSetup : OMI_BaseResource -{ - [Key, Description("An enumerated value that describes if the SMA Web Service server is expected to be installed on the machine.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Required, Description("UNC path to the root of the source files for installation.")] String SourcePath; - [Write, Description("Folder within the source path containing the source files for installation.")] String SourceFolder; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the installation.")] String SetupCredential; - [Required, Description("Is this the first Management Server?")] Boolean FirstWebServiceServer; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Service account of the web service application pool.")] String ApPool; - [Read, Description("Output username of the web service application pool.")] String ApPoolUsername; - [Write, Description("A comma-separated list of users to add to the IIS Administrators group.")] String AdminGroupMembers; - [Required, Description("Name of the SQL Server for the SMA database.")] String SqlServer; - [Required, Description("Name of the SQL Instance for the SMA database.")] String SqlInstance; - [Write, Description("Name of the SMA database.")] String SqlDatabase; - [Write, Description("Name of the SMA web site.")] String SiteName; - [Write, Description("Port of the SMA web site.")] UInt16 WebServicePort; - [Write, Description("Installation folder for SMA.")] String InstallFolder; - [Write, Description("Use SSL?")] String UseSSL; - [Write, Description("Specify an existing certificate for the SMA web site.")] String SpecifyCertificate; - [Write, Description("Name of the existing certificate to use.")] String CertificateName; - [Write, Description("Log to ETW.")] String ETWManifest; - [Write, Description("Send Customer Experience Improvement Program.")] String SendCEIPReports; - [Write, Description("Use Microsoft Update.")] String MSUpdate; - [Write, Description("Product key for licensed installations.")] String ProductKey; - [Write, Description("Array of Runbook Worker servers in this deployment.")] String RunbookWorkerServers[]; -}; diff --git a/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSmaCredential/MSFT_xSmaCredential.psm1 b/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSmaCredential/MSFT_xSmaCredential.psm1 deleted file mode 100644 index 3d0c4752..00000000 --- a/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSmaCredential/MSFT_xSmaCredential.psm1 +++ /dev/null @@ -1,128 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $credential, - - [System.String] - $Description, - - [parameter(Mandatory = $true)] - [System.String] - $WebServiceEndpoint, - - [System.UInt32] - $Port - ) - - $null = $PSBoundParameters.Remove("credential") - $null = $PSBoundParameters.Remove("Description") - - $SMACredential = Get-SmaCredential @PSBoundParameters -ErrorAction SilentlyContinue - - $foundUserName = $SMACredential.UserName - $foundDescription = $SMACredential.Description - - $returnValue = @{ - Name = [System.String]$Name - Credential = [System.Management.Automation.PSCredential]$credential # return credentials given, because SMA does not return any - Description = [System.String]$foundDescription - WebServiceEndpoint = [System.String]$WebServiceEndpoint - Port = [System.UInt32]$Port - UserName = [System.String]$foundUserName - } - - $returnValue - -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $credential, - - [System.String] - $Description, - - [parameter(Mandatory = $true)] - [System.String] - $WebServiceEndpoint, - - [System.UInt32] - $Port - ) - - $PSBoundParameters.Add("value", $credential) - $PSBoundParameters.Remove("credential") - - Set-SmaCredential @PSBoundParameters -ErrorAction Stop -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $credential, - - [System.String] - $Description, - - [parameter(Mandatory = $true)] - [System.String] - $WebServiceEndpoint, - - [System.UInt32] - $Port - ) - - $results = Get-TargetResource @PSBoundParameters - - # check user name value match - if($results.UserName -ne $credential.UserName) - { - Write-Verbose "SMA credential $Name user name $($results.UserName) expected $($credential.UserName)" - return $false - } - - # check descption match - if($results.Description -ne $Description ) - { - # check description are not supposed to be empty - if( !(($results.Description -eq $null) -and ($Description -eq "")) ) - { - Write-Verbose "SMA credential $Name description $($results.Description) expected $Description" - return $false - } - } - - return $true -} - - -Export-ModuleMember -Function Get-TargetResource, Set-TargetResource, Test-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSmaCredential/MSFT_xSmaCredential.schema.mof b/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSmaCredential/MSFT_xSmaCredential.schema.mof deleted file mode 100644 index 3c62f1ad..00000000 --- a/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSmaCredential/MSFT_xSmaCredential.schema.mof +++ /dev/null @@ -1,12 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xSmaCredential")] -class MSFT_xSmaCredential : OMI_BaseResource -{ - [Key, Description("Name of credential.")] String Name; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential object to be imported.")] String credential; - [Write, Description("Description of credential.")] String Description; - [Required, Description("Web service endpoint of SMA instance.")] String WebServiceEndpoint; - [Write, Description("Port to reach the web service endpoint.")] Uint32 Port; - [Read, Description("User name of credential found within SMA")] String UserName; -}; - diff --git a/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSmaVariable/MSFT_xSmaVariable.psm1 b/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSmaVariable/MSFT_xSmaVariable.psm1 deleted file mode 100644 index e1fbd253..00000000 --- a/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSmaVariable/MSFT_xSmaVariable.psm1 +++ /dev/null @@ -1,173 +0,0 @@ -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData -StringData @' - VariableDoesNotMatch = variable {0} has value {1} expected {2}. - VariableDescriptionDoesNotMatch = variable {0} has description {1} expected {2}. - VariableNotFound = Failed to find variable {0}. -'@ -} - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $value, - - [System.String] - $Description, - - [parameter(Mandatory = $true)] - [System.String] - $WebServiceEndpoint, - - [System.UInt32] - $Port = 9090 - ) - - $Set = $true - try - { - $variable = Get-SmaVariable -Name $Name -WebServiceEndpoint $webserviceendpoint -port $port -ErrorAction Stop - - $Ensure = "Present" - - # check variable value match - if($variable.Value -ne $value) - { - Write-Verbose ( $($LocalizedData.VariableDoesNotMatch) -f $Name, $variable.Value, $value) - $Set = $false - } - - # check description match - if($variable.Description -ne $Description ) - { - # check description are not supposed to be empty - if( !(($variable.Description -eq $null) -and ($Description -eq "")) ) - { - Write-Verbose ( $($LocalizedData.VariableDescriptionDoesNotMatch) -f $Name, $variable.Description, $Description) - $Set = $false - } - } - } - catch - { - Write-Verbose ( $($LocalizedData.VariableNotFound) -f $Name) - $Set = $false - $Ensure = "Absent" - } - - $returnValue = @{ - Ensure = [System.String]$Ensure - Name = [System.String]$variable.Name - value = [System.String]$variable.Value - Description = [System.String]$variable.Description - Set = [System.Boolean]$Set - WebServiceEndpoint = [System.String]$WebServiceEndpoint - Port = [System.UInt32]$Port - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $value, - - [System.String] - $Description, - - [parameter(Mandatory = $true)] - [System.String] - $WebServiceEndpoint, - - [System.UInt32] - $Port = 9090 - ) - - If($Ensure -eq "Present") - { - Set-SmaVariable -Name $Name -Value $value -Description $Description -WebServiceEndpoint $webserviceendpoint -port $port -ErrorAction Stop - } - else - { - Remove-SmaVariable -Name $Name -WebServiceEndpoint $webserviceendpoint -port $port -ErrorAction Stop - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $value, - - [System.String] - $Description, - - [parameter(Mandatory = $true)] - [System.String] - $WebServiceEndpoint, - - [System.UInt32] - $Port = 9090 - ) - - $result = Get-TargetResource @PSBoundParameters - - if( ($Ensure -eq "Present") -and ($result.Ensure -eq "Present") -and ($result.set -eq $true)) - { - return $true - } - elseif( ($result.Ensure -eq "Absent") -and ($Ensure -eq "Absent") ) - { - return $true - } - - return $false -} - - -Export-ModuleMember -Function Get-TargetResource, Set-TargetResource, Test-TargetResource - diff --git a/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSmaVariable/MSFT_xSmaVariable.schema.mof b/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSmaVariable/MSFT_xSmaVariable.schema.mof deleted file mode 100644 index 5c0e698c..00000000 --- a/lib/puppet_x/dsc_resources/xSCSMA/DSCResources/MSFT_xSmaVariable/MSFT_xSmaVariable.schema.mof +++ /dev/null @@ -1,14 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("SmaVariable")] -class MSFT_xSmaVariable : OMI_BaseResource -{ - [Required, Description("Desired state of SMA variable"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Key, Description("Name of SMA variable.")] String Name; - [Required, Description("Value of SMA variable.")] String value; - [Write, Description("Description of SMA variable.")] String Description; - [Read, Description("Set is true if existing SMA variable matches configuration.")] Boolean Set; - [Key, Description("Web service endpoint of SMA instance.")] String WebServiceEndpoint; - [Write, Description("Port to reach the web service endpoint. Defaults to the SMA default of 9090.")] Uint32 Port; -}; - - diff --git a/lib/puppet_x/dsc_resources/xSCSMA/LICENSE b/lib/puppet_x/dsc_resources/xSCSMA/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xSCSMA/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xSCSMA/en-US/xPDT.strings.psd1 b/lib/puppet_x/dsc_resources/xSCSMA/en-US/xPDT.strings.psd1 deleted file mode 100644 index 11f213c1..00000000 --- a/lib/puppet_x/dsc_resources/xSCSMA/en-US/xPDT.strings.psd1 +++ /dev/null @@ -1,10 +0,0 @@ -ConvertFrom-StringData @' -FileNotFound=File not found in the environment path -AbsolutePathOrFileName=Absolute path or file name expected -InvalidArgument=Invalid argument: '{0}' with value: '{1}' -InvalidArgumentAndMessage={0} {1} -ErrorStarting=Failure starting process matching path '{0}'. Message: {1} -FailureWaitingForProcessesToStart=Failed to wait for processes to start -ProcessStarted=Process matching path '{0}' started in process ID {1} -ProcessAlreadyStarted=Process matching path '{0}' already started in process ID {1} -'@ diff --git a/lib/puppet_x/dsc_resources/xSCSMA/xPDT.psm1 b/lib/puppet_x/dsc_resources/xSCSMA/xPDT.psm1 deleted file mode 100644 index c90beaa1..00000000 --- a/lib/puppet_x/dsc_resources/xSCSMA/xPDT.psm1 +++ /dev/null @@ -1,708 +0,0 @@ -data LocalizedData -{ - ConvertFrom-StringData @' - -FileNotFound=File not found in the environment path -AbsolutePathOrFileName=Absolute path or file name expected -InvalidArgument=Invalid argument: '{0}' with value: '{1}' -InvalidArgumentAndMessage={0} {1} -ErrorStarting=Failure starting process matching path '{0}'. Message: {1} -FailureWaitingForProcessesToStart=Failed to wait for processes to start -ProcessStarted=Process matching path '{0}' started in process ID {1} -ProcessAlreadyStarted=Process matching path '{0}' already started in process ID {1} -'@ -} - -Import-LocalizedData LocalizedData -filename xPDT.strings.psd1 - -function ThrowInvalidArgumentError -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $errorId, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $errorMessage - ) - - $errorCategory=[System.Management.Automation.ErrorCategory]::InvalidArgument - $exception = New-Object System.ArgumentException $errorMessage; - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - throw $errorRecord -} - -function ResolvePath -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Path - ) - - $Path = [Environment]::ExpandEnvironmentVariables($Path) - if(IsRootedPath $Path) - { - if(!(Test-Path $Path -PathType Leaf)) - { - ThrowInvalidArgumentError "CannotFindRootedPath" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.FileNotFound) - } - return $Path - } - if([string]::IsNullOrEmpty($env:Path)) - { - ThrowInvalidArgumentError "EmptyEnvironmentPath" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.FileNotFound) - } - if((Split-Path $Path -Leaf) -ne $Path) - { - ThrowInvalidArgumentError "NotAbsolutePathOrFileName" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.AbsolutePathOrFileName) - } - foreach($rawSegment in $env:Path.Split(";")) - { - $segment = [Environment]::ExpandEnvironmentVariables($rawSegment) - $segmentRooted = $false - try - { - $segmentRooted=[IO.Path]::IsPathRooted($segment) - } - catch {} - if(!$segmentRooted) - { - continue - } - $candidate = join-path $segment $Path - if(Test-Path $candidate -PathType Leaf) - { - return $candidate - } - } - ThrowInvalidArgumentError "CannotFindRelativePath" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.FileNotFound) -} - -function IsRootedPath -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path - ) - - try - { - return [IO.Path]::IsPathRooted($Path) - } - catch - { - ThrowInvalidArgumentError "CannotGetIsPathRooted" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $_.Exception.Message) - } -} - -function ExtractArguments -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - $functionBoundParameters, - - [parameter(Mandatory = $true)] - [string[]] - $argumentNames, - - [string[]] - $newArgumentNames - ) - - $returnValue=@{} - - for($i=0;$i -lt $argumentNames.Count;$i++) - { - $argumentName = $argumentNames[$i] - - if($newArgumentNames -eq $null) - { - $newArgumentName = $argumentName - } - else - { - $newArgumentName = $newArgumentNames[$i] - } - - if($functionBoundParameters.ContainsKey($argumentName)) - { - $null = $returnValue.Add($newArgumentName,$functionBoundParameters[$argumentName]) - } - } - - return $returnValue -} - -function CallPInvoke -{ - $script:ProgramSource = @" -using System; -using System.Collections.Generic; -using System.Text; -using System.Security; -using System.Runtime.InteropServices; -using System.Diagnostics; -using System.Security.Principal; -using System.ComponentModel; -using System.IO; - -namespace Source -{ - [SuppressUnmanagedCodeSecurity] - public static class NativeMethods - { - //The following structs and enums are used by the various Win32 API's that are used in the code below - - [StructLayout(LayoutKind.Sequential)] - public struct STARTUPINFO - { - public Int32 cb; - public string lpReserved; - public string lpDesktop; - public string lpTitle; - public Int32 dwX; - public Int32 dwY; - public Int32 dwXSize; - public Int32 dwXCountChars; - public Int32 dwYCountChars; - public Int32 dwFillAttribute; - public Int32 dwFlags; - public Int16 wShowWindow; - public Int16 cbReserved2; - public IntPtr lpReserved2; - public IntPtr hStdInput; - public IntPtr hStdOutput; - public IntPtr hStdError; - } - - [StructLayout(LayoutKind.Sequential)] - public struct PROCESS_INFORMATION - { - public IntPtr hProcess; - public IntPtr hThread; - public Int32 dwProcessID; - public Int32 dwThreadID; - } - - [Flags] - public enum LogonType - { - LOGON32_LOGON_INTERACTIVE = 2, - LOGON32_LOGON_NETWORK = 3, - LOGON32_LOGON_BATCH = 4, - LOGON32_LOGON_SERVICE = 5, - LOGON32_LOGON_UNLOCK = 7, - LOGON32_LOGON_NETWORK_CLEARTEXT = 8, - LOGON32_LOGON_NEW_CREDENTIALS = 9 - } - - [Flags] - public enum LogonProvider - { - LOGON32_PROVIDER_DEFAULT = 0, - LOGON32_PROVIDER_WINNT35, - LOGON32_PROVIDER_WINNT40, - LOGON32_PROVIDER_WINNT50 - } - [StructLayout(LayoutKind.Sequential)] - public struct SECURITY_ATTRIBUTES - { - public Int32 Length; - public IntPtr lpSecurityDescriptor; - public bool bInheritHandle; - } - - public enum SECURITY_IMPERSONATION_LEVEL - { - SecurityAnonymous, - SecurityIdentification, - SecurityImpersonation, - SecurityDelegation - } - - public enum TOKEN_TYPE - { - TokenPrimary = 1, - TokenImpersonation - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - internal struct TokPriv1Luid - { - public int Count; - public long Luid; - public int Attr; - } - - public const int GENERIC_ALL_ACCESS = 0x10000000; - public const int CREATE_NO_WINDOW = 0x08000000; - internal const int SE_PRIVILEGE_ENABLED = 0x00000002; - internal const int TOKEN_QUERY = 0x00000008; - internal const int TOKEN_ADJUST_PRIVILEGES = 0x00000020; - internal const string SE_INCRASE_QUOTA = "SeIncreaseQuotaPrivilege"; - - [DllImport("kernel32.dll", - EntryPoint = "CloseHandle", SetLastError = true, - CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] - public static extern bool CloseHandle(IntPtr handle); - - [DllImport("advapi32.dll", - EntryPoint = "CreateProcessAsUser", SetLastError = true, - CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] - public static extern bool CreateProcessAsUser( - IntPtr hToken, - string lpApplicationName, - string lpCommandLine, - ref SECURITY_ATTRIBUTES lpProcessAttributes, - ref SECURITY_ATTRIBUTES lpThreadAttributes, - bool bInheritHandle, - Int32 dwCreationFlags, - IntPtr lpEnvrionment, - string lpCurrentDirectory, - ref STARTUPINFO lpStartupInfo, - ref PROCESS_INFORMATION lpProcessInformation - ); - - [DllImport("advapi32.dll", EntryPoint = "DuplicateTokenEx")] - public static extern bool DuplicateTokenEx( - IntPtr hExistingToken, - Int32 dwDesiredAccess, - ref SECURITY_ATTRIBUTES lpThreadAttributes, - Int32 ImpersonationLevel, - Int32 dwTokenType, - ref IntPtr phNewToken - ); - - [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] - public static extern Boolean LogonUser( - String lpszUserName, - String lpszDomain, - String lpszPassword, - LogonType dwLogonType, - LogonProvider dwLogonProvider, - out IntPtr phToken - ); - - [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)] - internal static extern bool AdjustTokenPrivileges( - IntPtr htok, - bool disall, - ref TokPriv1Luid newst, - int len, - IntPtr prev, - IntPtr relen - ); - - [DllImport("kernel32.dll", ExactSpelling = true)] - internal static extern IntPtr GetCurrentProcess(); - - [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)] - internal static extern bool OpenProcessToken( - IntPtr h, - int acc, - ref IntPtr phtok - ); - - [DllImport("advapi32.dll", SetLastError = true)] - internal static extern bool LookupPrivilegeValue( - string host, - string name, - ref long pluid - ); - - public static void CreateProcessAsUser(string strCommand, string strDomain, string strName, string strPassword) - { - var hToken = IntPtr.Zero; - var hDupedToken = IntPtr.Zero; - TokPriv1Luid tp; - var pi = new PROCESS_INFORMATION(); - var sa = new SECURITY_ATTRIBUTES(); - sa.Length = Marshal.SizeOf(sa); - Boolean bResult = false; - try - { - bResult = LogonUser( - strName, - strDomain, - strPassword, - LogonType.LOGON32_LOGON_BATCH, - LogonProvider.LOGON32_PROVIDER_DEFAULT, - out hToken - ); - if (!bResult) - { - throw new Win32Exception("The user could not be logged on. Ensure that the user has an existing profile on the machine and that correct credentials are provided. Logon error #" + Marshal.GetLastWin32Error().ToString()); - } - IntPtr hproc = GetCurrentProcess(); - IntPtr htok = IntPtr.Zero; - bResult = OpenProcessToken( - hproc, - TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, - ref htok - ); - if(!bResult) - { - throw new Win32Exception("Open process token error #" + Marshal.GetLastWin32Error().ToString()); - } - tp.Count = 1; - tp.Luid = 0; - tp.Attr = SE_PRIVILEGE_ENABLED; - bResult = LookupPrivilegeValue( - null, - SE_INCRASE_QUOTA, - ref tp.Luid - ); - if(!bResult) - { - throw new Win32Exception("Error in looking up privilege of the process. This should not happen if DSC is running as LocalSystem Lookup privilege error #" + Marshal.GetLastWin32Error().ToString()); - } - bResult = AdjustTokenPrivileges( - htok, - false, - ref tp, - 0, - IntPtr.Zero, - IntPtr.Zero - ); - if(!bResult) - { - throw new Win32Exception("Token elevation error #" + Marshal.GetLastWin32Error().ToString()); - } - - bResult = DuplicateTokenEx( - hToken, - GENERIC_ALL_ACCESS, - ref sa, - (int)SECURITY_IMPERSONATION_LEVEL.SecurityIdentification, - (int)TOKEN_TYPE.TokenPrimary, - ref hDupedToken - ); - if(!bResult) - { - throw new Win32Exception("Duplicate Token error #" + Marshal.GetLastWin32Error().ToString()); - } - var si = new STARTUPINFO(); - si.cb = Marshal.SizeOf(si); - si.lpDesktop = ""; - bResult = CreateProcessAsUser( - hDupedToken, - null, - strCommand, - ref sa, - ref sa, - false, - 0, - IntPtr.Zero, - null, - ref si, - ref pi - ); - if(!bResult) - { - throw new Win32Exception("The process could not be created. Create process as user error #" + Marshal.GetLastWin32Error().ToString()); - } - } - finally - { - if (pi.hThread != IntPtr.Zero) - { - CloseHandle(pi.hThread); - } - if (pi.hProcess != IntPtr.Zero) - { - CloseHandle(pi.hProcess); - } - if (hDupedToken != IntPtr.Zero) - { - CloseHandle(hDupedToken); - } - } - } - } -} - -"@ - Add-Type -TypeDefinition $ProgramSource -ReferencedAssemblies "System.ServiceProcess" -} - -function GetWin32Process -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [PSCredential] - $Credential - ) - - $fileName = [io.path]::GetFileNameWithoutExtension($Path) - $GetProcesses = @(Get-Process -Name $fileName -ErrorAction SilentlyContinue) - $Processes = foreach($process in $GetProcesses) - { - if($Process.Path -ieq $Path) - { - try - { - [wmi]"Win32_Process.Handle='$($Process.Id)'" - } - catch - { - } - } - } - if($PSBoundParameters.ContainsKey('Credential')) - { - $Processes = $Processes | Where-Object {(GetWin32ProcessOwner $_) -eq $Credential.UserName} - } - if($Arguments -eq $null) {$Arguments = ""} - $Processes = $Processes | Where-Object {(GetWin32ProcessArgumentsFromCommandLine $_.CommandLine) -eq $Arguments} - - return $Processes -} - -function GetWin32ProcessOwner -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNull()] - $Process - ) - - try - { - $Owner = $Process.GetOwner() - } - catch - {} - if($owner.Domain -ne $null) - { - return $Owner.Domain + "\" + $Owner.User - } - else - { - return $Owner.User - } -} - -function GetWin32ProcessArgumentsFromCommandLine -{ - param - ( - [String] - $commandLine - ) - - if($commandLine -eq $null) - { - return "" - } - $commandLine=$commandLine.Trim() - if($commandLine.Length -eq 0) - { - return "" - } - if($commandLine[0] -eq '"') - { - $charToLookfor=[char]'"' - } - else - { - $charToLookfor=[char]' ' - } - $endOfCommand=$commandLine.IndexOf($charToLookfor ,1) - if($endOfCommand -eq -1) - { - return "" - } - return $commandLine.Substring($endOfCommand+1).Trim() -} - -function StartWin32Process -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [PSCredential] - $Credential, - - [Switch] - $AsTask - ) - - $GetArguments = ExtractArguments $PSBoundParameters ("Path","Arguments","Credential") - $Processes = @(GetWin32Process @getArguments) - if ($processes.Count -eq 0) - { - if($PSBoundParameters.ContainsKey("Credential")) - { - if($AsTask) - { - $ActionArguments = ExtractArguments $PSBoundParameters ` - ("Path", "Arguments") ` - ("Execute", "Argument") - if([string]::IsNullOrEmpty($Arguments)) - { - $null = $ActionArguments.Remove("Argument") - } - $TaskGuid = [guid]::NewGuid().ToString() - $Action = New-ScheduledTaskAction @ActionArguments - $null = Register-ScheduledTask -TaskName "xPDT $TaskGuid" -Action $Action -User $Credential.UserName -Password $Credential.GetNetworkCredential().Password -RunLevel Highest - $err = Start-ScheduledTask -TaskName "xPDT $TaskGuid" - } - else - { - try - { - CallPInvoke - [Source.NativeMethods]::CreateProcessAsUser(("$Path " + $Arguments),$Credential.GetNetworkCredential().Domain,$Credential.GetNetworkCredential().UserName,$Credential.GetNetworkCredential().Password) - } - catch - { - $exception = New-Object System.ArgumentException $_ - $errorCategory = [System.Management.Automation.ErrorCategory]::OperationStopped - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, "Win32Exception", $errorCategory, $null - $err = $errorRecord - } - } - } - else - { - $StartArguments = ExtractArguments $PSBoundParameters ` - ("Path", "Arguments", "Credential") ` - ("FilePath", "ArgumentList", "Credential") - if([string]::IsNullOrEmpty($Arguments)) - { - $null = $StartArguments.Remove("ArgumentList") - } - $err = Start-Process @StartArguments - } - if($err -ne $null) - { - throw $err - } - if (!(WaitForWin32ProcessStart @GetArguments)) - { - ThrowInvalidArgumentError "FailureWaitingForProcessesToStart" ($LocalizedData.ErrorStarting -f $Path,$LocalizedData.FailureWaitingForProcessesToStart) - } - } - else - { - return ($LocalizedData.ProcessAlreadyStarted -f $Path,$Processes.ProcessId) - } - $Processes = @(GetWin32Process @getArguments) - return ($LocalizedData.ProcessStarted -f $Path,$Processes.ProcessId) -} - -function WaitForWin32ProcessStart -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [PSCredential] - $Credential - ) - - $start = [DateTime]::Now - $GetArguments = ExtractArguments $PSBoundParameters ("Path","Arguments","Credential") - do - { - $value = @(GetWin32Process @GetArguments).Count -ge 1 - } while(!$value -and ([DateTime]::Now - $start).TotalMilliseconds -lt 60000) - - return $value -} - -function WaitForWin32ProcessEnd -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [PSCredential] - $Credential - ) - - $GetArguments = ExtractArguments $PSBoundParameters ("Path","Arguments","Credential") - While (WaitForWin32ProcessStart @GetArguments) - { - Start-Sleep 1 - } - Get-ScheduledTask | Where-Object {($_.TaskName.Length -ge 4) -and ($_.TaskName.Substring(0,4) -eq "xPDT") -and ($_.Actions.Execute -eq $Path) -and ($_.Actions.Arguments -eq $Arguments)} | Where-Object {$_ -ne $null} | Unregister-ScheduledTask -Confirm:$false -} - -function NetUse -{ - param - ( - [parameter(Mandatory)] - [string] - $SourcePath, - - [parameter(Mandatory)] - [PSCredential] - $Credential, - - [string] - $Ensure = "Present" - ) - - if(($SourcePath.Length -ge 2) -and ($SourcePath.Substring(0,2) -eq "\\")) - { - - if ($Ensure -eq "Absent") - { - $cmd = "net.exe use $SourcePath /del" - } - else - { - $cmd = "net.exe use $SourcePath $($Credential.GetNetworkCredential().Password) /user:$($Credential.GetNetworkCredential().Domain)\$($Credential.GetNetworkCredential().UserName)" - } - Invoke-Expression $cmd - } -} - -Export-ModuleMember ResolvePath,StartWin32Process,WaitForWin32ProcessEnd,NetUse diff --git a/lib/puppet_x/dsc_resources/xSCSMA/xSCSMA.psd1 b/lib/puppet_x/dsc_resources/xSCSMA/xSCSMA.psd1 deleted file mode 100644 index 923c136c..00000000 --- a/lib/puppet_x/dsc_resources/xSCSMA/xSCSMA.psd1 +++ /dev/null @@ -1,60 +0,0 @@ -@{ -# Version number of this module. -ModuleVersion = '1.5.0.0' - -# ID used to uniquely identify this module -GUID = 'dada748e-cf1e-43ed-a4ff-3530c01afd53' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'Module with DSC Resources for deployment and configuration of Microsoft System Center Service Management Automation.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Minimum version of the common language runtime (CLR) required by this module -CLRVersion = '4.0' - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/xSCSMA/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/xSCSMA' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - ReleaseNotes = '* Added $IdentifyingNumber for TP5/RTM and small WMI improvements - -' - - } # End of PSData hashtable - -} # End of PrivateData hashtable -} - - - diff --git a/lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFServer/MSFT_xSCSPFServer.psm1 b/lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFServer/MSFT_xSCSPFServer.psm1 deleted file mode 100644 index c7e7f775..00000000 --- a/lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFServer/MSFT_xSCSPFServer.psm1 +++ /dev/null @@ -1,143 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [ValidateSet("VMM","OM","DPM","OMDW","RDGateway","Orchestrator","None")] - [System.String] - $ServerType, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SCSPFAdminCredential - ) - - $Ensure = Invoke-Command -ComputerName . -Credential $SCSPFAdminCredential -Authentication Credssp { - $Name = $args[0] - $ServerType = $args[1] - if(!(Get-Module spfadmin)) - { - Import-Module spfadmin - } - if(Get-Module spfadmin) - { - if(Get-SCSpfServer -Name $Name | Where-Object {$_.ServerType.ToString() -eq $ServerType}) - { - "Present" - } - else - { - "Absent" - } - } - else - { - "Absent" - } - } -ArgumentList @($Name,$ServerType) - - $returnValue = @{ - Ensure = $Ensure - Name = $Name - ServerType = $ServerType - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [ValidateSet("VMM","OM","DPM","OMDW","RDGateway","Orchestrator","None")] - [System.String] - $ServerType, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SCSPFAdminCredential - ) - - Invoke-Command -ComputerName . -Credential $SCSPFAdminCredential -Authentication Credssp { - $Ensure = $args[0] - $Name = $args[1] - $ServerType = $args[2] - if(!(Get-Module spfadmin)) - { - Import-Module spfadmin - } - if(Get-Module spfadmin) - { - switch($Ensure) - { - "Present" - { - New-SCSpfServer -Name $Name -ServerType $ServerType - } - "Absent" - { - Get-SCSpfServer -Name $Name | Remove-SCSPFServer - } - } - } - } -ArgumentList @($Ensure,$Name,$ServerType) - - if(!(Test-TargetResource @PSBoundParameters)) - { - throw "Set-TargetResouce failed" - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [ValidateSet("VMM","OM","DPM","OMDW","RDGateway","Orchestrator","None")] - [System.String] - $ServerType, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SCSPFAdminCredential - ) - - $result = ((Get-TargetResource @PSBoundParameters).Ensure -eq $Ensure) - - $result -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFServer/MSFT_xSCSPFServer.schema.mof b/lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFServer/MSFT_xSCSPFServer.schema.mof deleted file mode 100644 index a2b8ca42..00000000 --- a/lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFServer/MSFT_xSCSPFServer.schema.mof +++ /dev/null @@ -1,8 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSCSPFServer")] -class MSFT_xSCSPFServer : OMI_BaseResource -{ - [Write, Description("An enumerated value that describes if the SPF server exists.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Key, Description("Specifies a name for the server.")] String Name; - [Required, Description("Specifies the type of server."), ValueMap{"VMM","OM","DPM","OMDW","RDGateway","Orchestrator","None"}, Values{"VMM","OM","DPM","OMDW","RDGateway","Orchestrator","None"}] String ServerType; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential with admin permissions to Service Provider Foundation.")] String SCSPFAdminCredential; -}; diff --git a/lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFServerSetup/MSFT_xSCSPFServerSetup.psm1 b/lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFServerSetup/MSFT_xSCSPFServerSetup.psm1 deleted file mode 100644 index 97d69f97..00000000 --- a/lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFServerSetup/MSFT_xSCSPFServerSetup.psm1 +++ /dev/null @@ -1,490 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\Orchestrator", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.String] - $SendCEIPReports = "False", - - [System.String] - $UseMicrosoftUpdate = "False", - - [System.Boolean] - $SpecifyCertificate = $false, - - [System.String] - $CertificateName = ($env:COMPUTERNAME + "." + (Get-WmiObject -Class Win32_ComputerSystem).Domain), - - [Parameter(Mandatory=$true)] - [System.String] - $DatabaseServer, - - [System.UInt16] - $DatabasePortNumber, - - [System.String] - $DatabaseName = "SCSPFDB", - - [System.UInt16] - $WebSitePortNumber = 8090, - - [System.Management.Automation.PSCredential] - $SCVMM, - - [System.Management.Automation.PSCredential] - $SCAdmin = $SCVMM, - - [System.Management.Automation.PSCredential] - $SCProvider = $SCVMM, - - [System.Management.Automation.PSCredential] - $SCUsage = $SCVMM, - - [System.String] - $VMMSecurityGroupUsers, - - [System.String] - $AdminSecurityGroupUsers, - - [System.String] - $ProviderSecurityGroupUsers, - - [System.String] - $UsageSecurityGroupUsers - ) - - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "\SPF\setup.exe" - $Path = ResolvePath $Path - $Version = (Get-Item -Path $Path).VersionInfo.ProductVersion - - switch($Version) - { - "7.2.1902.0" - { - $IdentifyingNumber = "{69344E86-7183-4384-A230-499E9914BE14}" - } - "7.2.5017.0" - { - $IdentifyingNumber = "{69344E86-7183-4384-A230-499E9914BE14}" - } - Default - { - throw "Unknown version of Service Provider Foundation!" - } - } - - if(Get-WmiObject -Class Win32_Product | Where-Object {$_.IdentifyingNumber -eq $IdentifyingNumber}) - { - $DatabaseServer = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Service Provider Foundation" -Name "DatabaseServer").DatabaseServer - - $DatabasePort = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Service Provider Foundation" -Name "DatabasePort").DatabasePort - if($DatabasePort -eq -1) - { - $DatabasePortNumber = 0 - } - else - { - $DatabasePortNumber = $DatabasePort - } - $DatabaseName = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Service Provider Foundation" -Name "DatabaseName").DatabaseName - $WebSitePortNumber = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Service Provider Foundation" -Name "PortNumber").PortNumber - $SCVMMUsername = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Service Provider Foundation\VMM" -Name "AppPoolDomain").AppPoolDomain + "\" + (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Service Provider Foundation\VMM" -Name "AppPoolUserName").AppPoolUserName - $SCAdminUsername = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Service Provider Foundation\Admin" -Name "AppPoolDomain").AppPoolDomain + "\" + (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Service Provider Foundation\Admin" -Name "AppPoolUserName").AppPoolUserName - $SCProviderUsername = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Service Provider Foundation\Provider" -Name "AppPoolDomain").AppPoolDomain + "\" + (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Service Provider Foundation\Provider" -Name "AppPoolUserName").AppPoolUserName - $SCUsageUsername = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Service Provider Foundation\Usage" -Name "AppPoolDomain").AppPoolDomain + "\" + (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Service Provider Foundation\Usage" -Name "AppPoolUserName").AppPoolUserName - $SPFGroups = @("VMM","Admin","Provider","Usage") - foreach($SPFGroup in $SPFGroups) - { - Set-Variable -Name ($SPFGroup + "SecurityGroupUsers") -Value @() - $Group = "SPF_$SPFGroup" - $ADSIGroup = [ADSI]("WinNT://localhost/$Group,group") - foreach($GroupMember in $ADSIGroup.Members()) - { - $AdsPath = $GroupMember.GetType().InvokeMember('Adspath', 'GetProperty', $Null, $GroupMember, $Null) - $A = $AdsPath.split('/',[StringSplitOptions]::RemoveEmptyEntries) - $Name = $A[2] - $Domain = $A[1] - if(($Domain + "\" + $Name) -ne (Get-Variable -Name ("SC" + $SPFGroup)).Value.Username) - { - Set-Variable -Name ($SPFGroup + "SecurityGroupUsers") -Value ((Get-Variable -Name ($SPFGroup + "SecurityGroupUsers")).Value + @(($Domain + "\" + $Name))) - } - } - } - - $returnValue = @{ - Ensure = "Present" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - DatabaseServer = $DatabaseServer - DatabasePortNumber = $DatabasePortNumber - DatabaseName = $DatabaseName - WebSitePortNumber = $WebSitePortNumber - SCVMMUsername = $SCVMMUsername - SCAdminUsername = $SCAdminUsername - SCProviderUsername = $SCProviderUsername - SCUsageUsername = $SCUsageUsername - VMMSecurityGroupUsers = $VMMSecurityGroupUsers - AdminSecurityGroupUsers = $AdminSecurityGroupUsers - ProviderSecurityGroupUsers = $ProviderSecurityGroupUsers - UsageSecurityGroupUsers = $UsageSecurityGroupUsers - } - } - else - { - $returnValue = @{ - Ensure = "Absent" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\Orchestrator", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.String] - $SendCEIPReports = "False", - - [System.String] - $UseMicrosoftUpdate = "False", - - [System.Boolean] - $SpecifyCertificate = $false, - - [System.String] - $CertificateName = ($env:COMPUTERNAME + "." + (Get-WmiObject -Class Win32_ComputerSystem).Domain), - - [Parameter(Mandatory=$true)] - [System.String] - $DatabaseServer, - - [System.UInt16] - $DatabasePortNumber, - - [System.String] - $DatabaseName = "SCSPFDB", - - [System.UInt16] - $WebSitePortNumber = 8090, - - [System.Management.Automation.PSCredential] - $SCVMM, - - [System.Management.Automation.PSCredential] - $SCAdmin = $SCVMM, - - [System.Management.Automation.PSCredential] - $SCProvider = $SCVMM, - - [System.Management.Automation.PSCredential] - $SCUsage = $SCVMM, - - [System.String] - $VMMSecurityGroupUsers, - - [System.String] - $AdminSecurityGroupUsers, - - [System.String] - $ProviderSecurityGroupUsers, - - [System.String] - $UsageSecurityGroupUsers - ) - - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "\SPF\setup.exe" - $Path = ResolvePath $Path - $Version = (Get-Item -Path $Path).VersionInfo.ProductVersion - Write-Verbose "Path: $Path" - - switch($Version) - { - "7.2.1902.0" - { - $IdentifyingNumber = "{69344E86-7183-4384-A230-499E9914BE14}" - } - "7.2.5017.0" - { - $IdentifyingNumber = "{69344E86-7183-4384-A230-499E9914BE14}" - } - Default - { - throw "Unknown version of Service Provider Foundation!" - } - } - - switch($Ensure) - { - "Present" - { - # Set defaults, if they couldn't be set in param due to null configdata input - if($WebSitePortNumber -eq 0) - { - $WebSitePortNumber = 8090 - } - if($SendCEIPReports -ne "True") - { - $SendCEIPReports = "False" - } - if($UseMicrosoftUpdate -ne "True") - { - $UseMicrosoftUpdate = "False" - } - - # Create install arguments - $TempFile = [IO.Path]::GetTempFileName() - $Arguments = "-Silent $TempFile" - $AnswerFile = @() - $AnswerFileVars = @( - "SendCEIPReports", - "UseMicrosoftUpdate", - "DatabaseServer", - "DatabasePortNumber", - "DatabaseName", - "WebSitePortNumber", - "SpecifyCertificate" - ) - # If SpecifyCertificate = True, get serial number - if($SpecifyCertificate) - { - $Certificates = @(Get-ChildItem -Path "Cert:\LocalMachine\My" | Where-Object {($_.Subject -eq "CN=$CertificateName") -and ($_.Issuer -ne "CN=$CertificateName")} | Where-Object {$_.EnhancedKeyUsageList.ObjectId -eq "1.3.6.1.5.5.7.3.1"}) - if($Certificates.Count -eq 0) - { - $Certificates = @(Get-ChildItem -Path "Cert:\LocalMachine\My" | Where-Object {$_.Subject -eq "CN=$CertificateName"} | Where-Object {$_.EnhancedKeyUsageList.ObjectId -eq "1.3.6.1.5.5.7.3.1"}) - } - if($Certificates.Count -eq 0) - { - $null = New-SelfSignedCertificate -DnsName $CertificateName -CertStoreLocation "Cert:\LocalMachine\My" - $Certificates = @(Get-ChildItem -Path "Cert:\LocalMachine\My" | Where-Object {$_.Subject -eq "CN=$CertificateName"} | Where-Object {$_.EnhancedKeyUsageList.ObjectId -eq "1.3.6.1.5.5.7.3.1"}) - } - $CertificateSerialNumber = $Certificates[0].SerialNumber - $AnswerFileVars += @("CertificateSerialNumber") - } - foreach($AnswerFileVar in $AnswerFileVars) - { - if(!([String]::IsNullOrEmpty((Get-Variable -Name $AnswerFileVar).Value)) -and ((Get-Variable -Name $AnswerFileVar).Value -ne 0)) - { - $AnswerFile += "-$AnswerFileVar " + (Get-Variable -Name $AnswerFileVar).Value - } - } - $AccountVars = @("SCVMM","SCAdmin","SCProvider","SCUsage") - foreach($AccountVar in $AccountVars) - { - if($PSBoundParameters.ContainsKey("SCVMM") -or $PSBoundParameters.ContainsKey("$AccountVar")) - { - $AnswerFile += "-$AccountVar`NetworkServiceSelected False" - $AnswerFile += "-$AccountVar`UserName " + (Get-Variable -Name $AccountVar).Value.GetNetworkCredential().UserName - $AnswerFile += "-$AccountVar`Password " + (Get-Variable -Name $AccountVar).Value.GetNetworkCredential().Password - $AnswerFile += "-$AccountVar`Domain " + (Get-Variable -Name $AccountVar).Value.GetNetworkCredential().Domain - $AnswerFile += "-" + $AccountVar.Substring(2) + "SecurityGroupUsers " + (Get-Variable -Name $AccountVar).Value.UserName - } - else - { - $AnswerFile += "-$AccountVar`NetworkServiceSelected True" - } - } - - Write-Verbose "AnswerFile: $TempFile" - foreach($Line in $AnswerFile) - { - Add-Content -Path $TempFile -Value $Line -Encoding Ascii - # Replace sensitive values for verbose output - $LogLine = $Line - if($LogLine.Contains("Password")) - { - $LogLine = $LogLine.Split(" ")[0] + " ********" - } - Write-Verbose $LogLine - } - } - "Absent" - { - # Create uninstall arguments - $Arguments = "-Silent -Uninstall" - } - } - - Write-Verbose "Arguments: $Arguments" - - $Process = StartWin32Process -Path $Path -Arguments $Arguments -Credential $SetupCredential - Write-Verbose $Process - WaitForWin32ProcessEnd -Path $Path -Arguments $Arguments -Credential $SetupCredential - - # Add admins to groups - if(($Ensure -eq "Present") -and (Get-WmiObject -Class Win32_Product | Where-Object {$_.IdentifyingNumber -eq "$IdentifyingNumber"})) - { - $SPFGroups = @("VMM","Admin","Provider","Usage") - foreach($SPFGroup in $SPFGroups) - { - if($PSBoundParameters.ContainsKey("$SPFGroup`SecurityGroupUsers")) - { - $Group = "SPF_$SPFGroup" - $ADSIGroup = [ADSI]("WinNT://localhost/$Group,group") - foreach($User in (Get-Variable -Name "$SPFGroup`SecurityGroupUsers").Value.Split(";")) - { - $IsGroupMember = $false - foreach($GroupMember in $ADSIGroup.Members()) - { - if(!$IsGroupMember) - { - $AdsPath = $GroupMember.GetType().InvokeMember('Adspath', 'GetProperty', $Null, $GroupMember, $Null) - $A = $AdsPath.split('/',[StringSplitOptions]::RemoveEmptyEntries) - $Name = $A[2] - $Domain = $A[1] - if(($Domain -eq $User.Split('\')[0]) -and ($Name -eq $User.Split('\')[1])) - { - $IsGroupMember = $true - } - } - } - if(!$IsGroupMember) - { - $ADSIUser = "WinNT://" + $User.Split("\")[0] + "/" + $User.Split("\")[1] - $ADSIGroup.Add($ADSIUser) - } - } - } - } - } - - # Clean up - if(Test-Path -Path $TempFile) - { - Remove-Item -Path $TempFile - } - - if((Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Name 'PendingFileRenameOperations' -ErrorAction SilentlyContinue) -ne $null) - { - $global:DSCMachineStatus = 1 - } - else - { - if(!(Test-TargetResource @PSBoundParameters)) - { - throw "Set-TargetResouce failed" - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\Orchestrator", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.String] - $SendCEIPReports = "False", - - [System.String] - $UseMicrosoftUpdate = "False", - - [System.Boolean] - $SpecifyCertificate = $false, - - [System.String] - $CertificateName = ($env:COMPUTERNAME + "." + (Get-WmiObject -Class Win32_ComputerSystem).Domain), - - [Parameter(Mandatory=$true)] - [System.String] - $DatabaseServer, - - [System.UInt16] - $DatabasePortNumber, - - [System.String] - $DatabaseName = "SCSPFDB", - - [System.UInt16] - $WebSitePortNumber = 8090, - - [System.Management.Automation.PSCredential] - $SCVMM, - - [System.Management.Automation.PSCredential] - $SCAdmin = $SCVMM, - - [System.Management.Automation.PSCredential] - $SCProvider = $SCVMM, - - [System.Management.Automation.PSCredential] - $SCUsage = $SCVMM, - - [System.String] - $VMMSecurityGroupUsers, - - [System.String] - $AdminSecurityGroupUsers, - - [System.String] - $ProviderSecurityGroupUsers, - - [System.String] - $UsageSecurityGroupUsers - ) - - $result = ((Get-TargetResource @PSBoundParameters).Ensure -eq $Ensure) - - $result -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFServerSetup/MSFT_xSCSPFServerSetup.schema.mof b/lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFServerSetup/MSFT_xSCSPFServerSetup.schema.mof deleted file mode 100644 index 1019aa49..00000000 --- a/lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFServerSetup/MSFT_xSCSPFServerSetup.schema.mof +++ /dev/null @@ -1,28 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSCSPFServerSetup")] -class MSFT_xSCSPFServerSetup : OMI_BaseResource -{ - [Key, Description("An enumerated value that describes if SPF server is expected to be installed on the machine.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Required, Description("UNC path to the root of the source files for installation.")] String SourcePath; - [Write, Description("Folder within the source path containing the source files for installation.")] String SourceFolder; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the installation.")] String SetupCredential; - [Write, Description("Participate in the Customer Experience Improvement Program.")] String SendCEIPReports; - [Write, Description("Use Microsoft Update.")] String UseMicrosoftUpdate; - [Write, Description("Use an existing certificate.")] Boolean SpecifyCertificate; - [Write, Description("Name of existing certificate to use.")] String CertificateName; - [Required, Description("Name of the database server.")] String DatabaseServer; - [Write, Description("Port of the database server instance.")] UInt16 DatabasePortNumber; - [Write, Description("Name of the SPF database.")] String DatabaseName; - [Write, Description("Port for the SPF web service.")] UInt16 WebSitePortNumber; - [Write,EmbeddedInstance("MSFT_Credential"), Description("Credential for the VMM application pool.")] String SCVMM; - [Read, Description("Output username of the VMM application pool serivce.")] String SCVMMUsername; - [Write,EmbeddedInstance("MSFT_Credential"), Description("Credential for the Admin application pool")] String SCAdmin; - [Read, Description("Output username of the Admin application pool serivce.")] String SCAdminUsername; - [Write,EmbeddedInstance("MSFT_Credential"), Description("Credential for the Provider application pool")] String SCProvider; - [Read, Description("Output username of the Provider application pool serivce.")] String SCProviderUsername; - [Write,EmbeddedInstance("MSFT_Credential"), Description("Credential for the Usage application pool")] String SCUsage; - [Read, Description("Output username of the Usage application pool serivce.")] String SCUsageUsername; - [Write, Description("Administrator of the VMM application pool.")] String VMMSecurityGroupUsers; - [Write, Description("Administrator of the Admin application pool")] String AdminSecurityGroupUsers; - [Write, Description("Administrator of the Provider application pool")] String ProviderSecurityGroupUsers; - [Write, Description("Administrator of the Usage application pool")] String UsageSecurityGroupUsers; -}; diff --git a/lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFServerUpdate/MSFT_xSCSPFServerUpdate.psm1 b/lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFServerUpdate/MSFT_xSCSPFServerUpdate.psm1 deleted file mode 100644 index 1caf7b87..00000000 --- a/lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFServerUpdate/MSFT_xSCSPFServerUpdate.psm1 +++ /dev/null @@ -1,183 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\Orchestrator\SPF\Updates", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - $Version = (Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -eq "System Center 2012 R2 Service Provider Foundation MSI"}).Version - - switch($Version) - { - "7.2.1902.0" - { - $ProductCode = "{69344E86-7183-4384-A230-499E9914BE14}" - $PatchID = "{96659A28-25CB-47DA-BB74-9AF19FB14F00}" - $Update = "Update Rollup 4" - } - "7.2.5017.0" - { - $returnValue = @{ - Ensure = "Present" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - Update = "None" - } - } - $null - { - $returnValue = @{ - Ensure = "Absent" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - } - } - Default - { - throw "Unknown version of Service Provider Foundation!" - } - } - - if($ProductCode -and $PatchID -and (Get-WmiObject -Class Win32_PatchPackage | Where-Object {($_.ProductCode -eq $ProductCode) -and ($_.PatchID -eq $PatchID)})) - { - $returnValue = @{ - Ensure = "Present" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - Update = $Update - } - } - else - { - $returnValue = @{ - Ensure = "Absent" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\Orchestrator\SPF\Updates", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - $Version = (Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -eq "System Center 2012 R2 Service Provider Foundation MSI"}).Version - - switch($Version) - { - "7.2.1902.0" - { - $UpdateFile = "kb2992021_Microsoft.SystemCenter.Foundation.Setup_x64.msp" - } - "7.2.5017.0" - { - Write-Verbose "No update for this version of Service Provider Foundation!" - } - $null - { - Write-Verbose "Service Provider Foundation not installed!" - } - Default - { - throw "Unknown version of Service Provider Foundation!" - } - } - - if($UpdateFile) - { - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - $Path = "msiexec.exe" - $Path = ResolvePath $Path - Write-Verbose "Path: $Path" - - $MSPPath = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath $UpdateFile - $MSPPath = ResolvePath $MSPPath - $Arguments = "/update $MSPPath" - Write-Verbose "Arguments: $Arguments" - - $Process = StartWin32Process -Path $Path -Arguments $Arguments -Credential $SetupCredential - Write-Verbose $Process - WaitForWin32ProcessEnd -Path $Path -Arguments $Arguments -Credential $SetupCredential - } - - if((Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Name 'PendingFileRenameOperations' -ErrorAction SilentlyContinue) -ne $null) - { - $global:DSCMachineStatus = 1 - } - else - { - if(!(Test-TargetResource @PSBoundParameters)) - { - throw "Set-TargetResouce failed" - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\Orchestrator\SPF\Updates", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - $result = ((Get-TargetResource @PSBoundParameters).Ensure -eq $Ensure) - - $result -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFServerUpdate/MSFT_xSCSPFServerUpdate.schema.mof b/lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFServerUpdate/MSFT_xSCSPFServerUpdate.schema.mof deleted file mode 100644 index 57031a86..00000000 --- a/lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFServerUpdate/MSFT_xSCSPFServerUpdate.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSCSPFServerUpdate")] -class MSFT_xSCSPFServerUpdate : OMI_BaseResource -{ - [Key, Description("An enumerated value that describes if the update is expected to be installed on the machine.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Required, Description("UNC path to the root of the source files for installation.")] String SourcePath; - [Write, Description("Folder within the source path containing the source files for installation.")] String SourceFolder; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the installation.")] String SetupCredential; - [Read, Description("Display name of the update.")] String Update; -}; diff --git a/lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFSetting/MSFT_xSCSPFSetting.psm1 b/lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFSetting/MSFT_xSCSPFSetting.psm1 deleted file mode 100644 index f04aa55e..00000000 --- a/lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFSetting/MSFT_xSCSPFSetting.psm1 +++ /dev/null @@ -1,171 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $ServerName, - - [parameter(Mandatory = $true)] - [ValidateSet("DatabaseConnectionString","EndPointConnectionString")] - [System.String] - $SettingType, - - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $Value, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SCSPFAdminCredential - ) - - $returnValue = Invoke-Command -ComputerName . -Credential $SCSPFAdminCredential -Authentication Credssp { - $ServerName = $args[0] - $Name = $args[1] - $Value = $args[2] - $SettingType = $args[3] - if(!(Get-Module spfadmin)) - { - Import-Module spfadmin - } - if(Get-Module spfadmin) - { - $SpfSetting = Get-SCSpfSetting -ServerName $ServerName -SettingType $SettingType | Where-Object {$_.Name -eq $Name} - if($SpfSetting.Value -eq $Value) - { - $Ensure = "Present" - } - else - { - $Ensure = "Absent" - } - } - else - { - $Ensure = "Absent" - } - @{ - Ensure = $Ensure - ServerName = $ServerName - Name = $Name - Value = $SpfSetting.Value - SettingType = $SettingType - } - } -ArgumentList @($ServerName,$Name,$Value,$SettingType) - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $ServerName, - - [parameter(Mandatory = $true)] - [ValidateSet("DatabaseConnectionString","EndPointConnectionString")] - [System.String] - $SettingType, - - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $Value, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SCSPFAdminCredential - ) - - Invoke-Command -ComputerName . -Credential $SCSPFAdminCredential -Authentication Credssp { - $Ensure = $args[0] - $ServerName = $args[1] - $Name = $args[2] - $Value = $args[3] - $SettingType = $args[4] - if(!(Get-Module spfadmin)) - { - Import-Module spfadmin - } - if(Get-Module spfadmin) - { - if(Get-SCSpfSetting -ServerName $ServerName -SettingType $SettingType | Where-Object {$_.Name -eq $Name}) - { - Get-SCSpfSetting -ServerName $ServerName -SettingType $SettingType | Where-Object {$_.Name -eq $Name} | Remove-SCSpfSetting - } - if($Ensure -eq "Present") - { - New-SCSpfSetting -ServerName $ServerName -SettingType $SettingType -Name $Name -Value $Value.ToLower() - } - } - } -ArgumentList @($Ensure,$ServerName,$Name,$Value,$SettingType) - - - if(!(Test-TargetResource @PSBoundParameters)) - { - throw "Set-TargetResouce failed" - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $ServerName, - - [parameter(Mandatory = $true)] - [ValidateSet("DatabaseConnectionString","EndPointConnectionString")] - [System.String] - $SettingType, - - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $Value, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SCSPFAdminCredential - ) - - $result = ((Get-TargetResource @PSBoundParameters).Ensure -eq $Ensure) - - $result -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFSetting/MSFT_xSCSPFSetting.schema.mof b/lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFSetting/MSFT_xSCSPFSetting.schema.mof deleted file mode 100644 index c37561c9..00000000 --- a/lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFSetting/MSFT_xSCSPFSetting.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSCSPFSetting")] -class MSFT_xSCSPFSetting : OMI_BaseResource -{ - [Write, Description("An enumerated value that describes if the SPF setting exists.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Key, Description("Specifies the name of the server the setting is associated with.")] String ServerName; - [Required, Description("Specifies either DatabaseConnectionString or EndPointConnectionString."), ValueMap{"DatabaseConnectionString","EndPointConnectionString"}, Values{"DatabaseConnectionString","EndPointConnectionString"}] String SettingType; - [Key, Description("Specifies a friendly name for the setting.")] String Name; - [Required, Description("Specifies the value for the setting.")] String Value; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential with admin permissions to Service Provider Foundation.")] String SCSPFAdminCredential; -}; diff --git a/lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFStamp/MSFT_xSCSPFStamp.psm1 b/lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFStamp/MSFT_xSCSPFStamp.psm1 deleted file mode 100644 index 6b4fe1b1..00000000 --- a/lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFStamp/MSFT_xSCSPFStamp.psm1 +++ /dev/null @@ -1,180 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String[]] - $Servers, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SCSPFAdminCredential - ) - - $Ensure = Invoke-Command -ComputerName . -Credential $SCSPFAdminCredential -Authentication Credssp { - $Name = $args[0] - if(!(Get-Module spfadmin)) - { - Import-Module spfadmin - } - if(Get-Module spfadmin) - { - if(Get-SCSpfStamp -Name $Name) - { - "Present" - } - else - { - "Absent" - } - } - else - { - "Absent" - } - } -ArgumentList @($Name) - - if($Ensure -eq "Present") - { - $StampServers = Invoke-Command -ComputerName . -Credential $SCSPFAdminCredential -Authentication Credssp { - $Name = $args[0] - if(!(Get-Module spfadmin)) - { - Import-Module spfadmin - } - if(Get-Module spfadmin) - { - (Get-ScSpfStamp -Name $Name | Get-ScSpfServer).Name - } - } -ArgumentList @($Name) - foreach($Server in $Servers) - { - if($Ensure -eq "Present") - { - if(!($StampServers | Where-Object {$_ -eq $Server})) - { - $Ensure = "Absent" - $Servers = $StampServers - } - } - } - } - else - { - $Servers = $null - } - - $returnValue = @{ - Ensure = $Ensure - Name = $Name - Servers = $Servers - } - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String[]] - $Servers, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SCSPFAdminCredential - ) - - Invoke-Command -ComputerName . -Credential $SCSPFAdminCredential -Authentication Credssp { - $Ensure = $args[0] - $Name = $args[1] - $Servers = $args[2] - if(!(Get-Module spfadmin)) - { - Import-Module spfadmin - } - if(Get-Module spfadmin) - { - switch($Ensure) - { - "Present" - { - $StampServers = @() - foreach($Server in $Servers) - { - $StampServers += Get-SCSpfServer -Name $Server - } - if(Get-ScSpfStamp -Name $Name) - { - Set-SCSpfStamp -Stamp (Get-ScSpfStamp -Name $Name) -Servers $StampServers - } - else - { - New-SCSpfStamp -Name $Name -Servers $StampServers - } - } - "Absent" - { - Get-SCSPFStamp -Name $Name | Remove-SCSPFStamp - } - } - } - } -ArgumentList @($Ensure,$Name,$Servers) - - if(!(Test-TargetResource @PSBoundParameters)) - { - throw "Set-TargetResouce failed" - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String[]] - $Servers, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SCSPFAdminCredential - ) - - $result = ((Get-TargetResource @PSBoundParameters).Ensure -eq $Ensure) - - $result -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFStamp/MSFT_xSCSPFStamp.schema.mof b/lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFStamp/MSFT_xSCSPFStamp.schema.mof deleted file mode 100644 index 818e105d..00000000 --- a/lib/puppet_x/dsc_resources/xSCSPF/DSCResources/MSFT_xSCSPFStamp/MSFT_xSCSPFStamp.schema.mof +++ /dev/null @@ -1,8 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSCSPFStamp")] -class MSFT_xSCSPFStamp : OMI_BaseResource -{ - [Write, Description("An enumerated value that describes if the SPF stamp exists.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Key, Description("Specifies a name for the stamp.")] String Name; - [Required, Description("Specifies the name of one or more server objects to associate with the new stamp.")] String Servers[]; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential with admin permissions to Service Provider Foundation.")] String SCSPFAdminCredential; -}; diff --git a/lib/puppet_x/dsc_resources/xSCSPF/LICENSE b/lib/puppet_x/dsc_resources/xSCSPF/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xSCSPF/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xSCSPF/en-US/xPDT.strings.psd1 b/lib/puppet_x/dsc_resources/xSCSPF/en-US/xPDT.strings.psd1 deleted file mode 100644 index 11f213c1..00000000 --- a/lib/puppet_x/dsc_resources/xSCSPF/en-US/xPDT.strings.psd1 +++ /dev/null @@ -1,10 +0,0 @@ -ConvertFrom-StringData @' -FileNotFound=File not found in the environment path -AbsolutePathOrFileName=Absolute path or file name expected -InvalidArgument=Invalid argument: '{0}' with value: '{1}' -InvalidArgumentAndMessage={0} {1} -ErrorStarting=Failure starting process matching path '{0}'. Message: {1} -FailureWaitingForProcessesToStart=Failed to wait for processes to start -ProcessStarted=Process matching path '{0}' started in process ID {1} -ProcessAlreadyStarted=Process matching path '{0}' already started in process ID {1} -'@ diff --git a/lib/puppet_x/dsc_resources/xSCSPF/xPDT.psm1 b/lib/puppet_x/dsc_resources/xSCSPF/xPDT.psm1 deleted file mode 100644 index c90beaa1..00000000 --- a/lib/puppet_x/dsc_resources/xSCSPF/xPDT.psm1 +++ /dev/null @@ -1,708 +0,0 @@ -data LocalizedData -{ - ConvertFrom-StringData @' - -FileNotFound=File not found in the environment path -AbsolutePathOrFileName=Absolute path or file name expected -InvalidArgument=Invalid argument: '{0}' with value: '{1}' -InvalidArgumentAndMessage={0} {1} -ErrorStarting=Failure starting process matching path '{0}'. Message: {1} -FailureWaitingForProcessesToStart=Failed to wait for processes to start -ProcessStarted=Process matching path '{0}' started in process ID {1} -ProcessAlreadyStarted=Process matching path '{0}' already started in process ID {1} -'@ -} - -Import-LocalizedData LocalizedData -filename xPDT.strings.psd1 - -function ThrowInvalidArgumentError -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $errorId, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $errorMessage - ) - - $errorCategory=[System.Management.Automation.ErrorCategory]::InvalidArgument - $exception = New-Object System.ArgumentException $errorMessage; - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - throw $errorRecord -} - -function ResolvePath -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Path - ) - - $Path = [Environment]::ExpandEnvironmentVariables($Path) - if(IsRootedPath $Path) - { - if(!(Test-Path $Path -PathType Leaf)) - { - ThrowInvalidArgumentError "CannotFindRootedPath" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.FileNotFound) - } - return $Path - } - if([string]::IsNullOrEmpty($env:Path)) - { - ThrowInvalidArgumentError "EmptyEnvironmentPath" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.FileNotFound) - } - if((Split-Path $Path -Leaf) -ne $Path) - { - ThrowInvalidArgumentError "NotAbsolutePathOrFileName" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.AbsolutePathOrFileName) - } - foreach($rawSegment in $env:Path.Split(";")) - { - $segment = [Environment]::ExpandEnvironmentVariables($rawSegment) - $segmentRooted = $false - try - { - $segmentRooted=[IO.Path]::IsPathRooted($segment) - } - catch {} - if(!$segmentRooted) - { - continue - } - $candidate = join-path $segment $Path - if(Test-Path $candidate -PathType Leaf) - { - return $candidate - } - } - ThrowInvalidArgumentError "CannotFindRelativePath" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.FileNotFound) -} - -function IsRootedPath -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path - ) - - try - { - return [IO.Path]::IsPathRooted($Path) - } - catch - { - ThrowInvalidArgumentError "CannotGetIsPathRooted" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $_.Exception.Message) - } -} - -function ExtractArguments -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - $functionBoundParameters, - - [parameter(Mandatory = $true)] - [string[]] - $argumentNames, - - [string[]] - $newArgumentNames - ) - - $returnValue=@{} - - for($i=0;$i -lt $argumentNames.Count;$i++) - { - $argumentName = $argumentNames[$i] - - if($newArgumentNames -eq $null) - { - $newArgumentName = $argumentName - } - else - { - $newArgumentName = $newArgumentNames[$i] - } - - if($functionBoundParameters.ContainsKey($argumentName)) - { - $null = $returnValue.Add($newArgumentName,$functionBoundParameters[$argumentName]) - } - } - - return $returnValue -} - -function CallPInvoke -{ - $script:ProgramSource = @" -using System; -using System.Collections.Generic; -using System.Text; -using System.Security; -using System.Runtime.InteropServices; -using System.Diagnostics; -using System.Security.Principal; -using System.ComponentModel; -using System.IO; - -namespace Source -{ - [SuppressUnmanagedCodeSecurity] - public static class NativeMethods - { - //The following structs and enums are used by the various Win32 API's that are used in the code below - - [StructLayout(LayoutKind.Sequential)] - public struct STARTUPINFO - { - public Int32 cb; - public string lpReserved; - public string lpDesktop; - public string lpTitle; - public Int32 dwX; - public Int32 dwY; - public Int32 dwXSize; - public Int32 dwXCountChars; - public Int32 dwYCountChars; - public Int32 dwFillAttribute; - public Int32 dwFlags; - public Int16 wShowWindow; - public Int16 cbReserved2; - public IntPtr lpReserved2; - public IntPtr hStdInput; - public IntPtr hStdOutput; - public IntPtr hStdError; - } - - [StructLayout(LayoutKind.Sequential)] - public struct PROCESS_INFORMATION - { - public IntPtr hProcess; - public IntPtr hThread; - public Int32 dwProcessID; - public Int32 dwThreadID; - } - - [Flags] - public enum LogonType - { - LOGON32_LOGON_INTERACTIVE = 2, - LOGON32_LOGON_NETWORK = 3, - LOGON32_LOGON_BATCH = 4, - LOGON32_LOGON_SERVICE = 5, - LOGON32_LOGON_UNLOCK = 7, - LOGON32_LOGON_NETWORK_CLEARTEXT = 8, - LOGON32_LOGON_NEW_CREDENTIALS = 9 - } - - [Flags] - public enum LogonProvider - { - LOGON32_PROVIDER_DEFAULT = 0, - LOGON32_PROVIDER_WINNT35, - LOGON32_PROVIDER_WINNT40, - LOGON32_PROVIDER_WINNT50 - } - [StructLayout(LayoutKind.Sequential)] - public struct SECURITY_ATTRIBUTES - { - public Int32 Length; - public IntPtr lpSecurityDescriptor; - public bool bInheritHandle; - } - - public enum SECURITY_IMPERSONATION_LEVEL - { - SecurityAnonymous, - SecurityIdentification, - SecurityImpersonation, - SecurityDelegation - } - - public enum TOKEN_TYPE - { - TokenPrimary = 1, - TokenImpersonation - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - internal struct TokPriv1Luid - { - public int Count; - public long Luid; - public int Attr; - } - - public const int GENERIC_ALL_ACCESS = 0x10000000; - public const int CREATE_NO_WINDOW = 0x08000000; - internal const int SE_PRIVILEGE_ENABLED = 0x00000002; - internal const int TOKEN_QUERY = 0x00000008; - internal const int TOKEN_ADJUST_PRIVILEGES = 0x00000020; - internal const string SE_INCRASE_QUOTA = "SeIncreaseQuotaPrivilege"; - - [DllImport("kernel32.dll", - EntryPoint = "CloseHandle", SetLastError = true, - CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] - public static extern bool CloseHandle(IntPtr handle); - - [DllImport("advapi32.dll", - EntryPoint = "CreateProcessAsUser", SetLastError = true, - CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] - public static extern bool CreateProcessAsUser( - IntPtr hToken, - string lpApplicationName, - string lpCommandLine, - ref SECURITY_ATTRIBUTES lpProcessAttributes, - ref SECURITY_ATTRIBUTES lpThreadAttributes, - bool bInheritHandle, - Int32 dwCreationFlags, - IntPtr lpEnvrionment, - string lpCurrentDirectory, - ref STARTUPINFO lpStartupInfo, - ref PROCESS_INFORMATION lpProcessInformation - ); - - [DllImport("advapi32.dll", EntryPoint = "DuplicateTokenEx")] - public static extern bool DuplicateTokenEx( - IntPtr hExistingToken, - Int32 dwDesiredAccess, - ref SECURITY_ATTRIBUTES lpThreadAttributes, - Int32 ImpersonationLevel, - Int32 dwTokenType, - ref IntPtr phNewToken - ); - - [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] - public static extern Boolean LogonUser( - String lpszUserName, - String lpszDomain, - String lpszPassword, - LogonType dwLogonType, - LogonProvider dwLogonProvider, - out IntPtr phToken - ); - - [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)] - internal static extern bool AdjustTokenPrivileges( - IntPtr htok, - bool disall, - ref TokPriv1Luid newst, - int len, - IntPtr prev, - IntPtr relen - ); - - [DllImport("kernel32.dll", ExactSpelling = true)] - internal static extern IntPtr GetCurrentProcess(); - - [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)] - internal static extern bool OpenProcessToken( - IntPtr h, - int acc, - ref IntPtr phtok - ); - - [DllImport("advapi32.dll", SetLastError = true)] - internal static extern bool LookupPrivilegeValue( - string host, - string name, - ref long pluid - ); - - public static void CreateProcessAsUser(string strCommand, string strDomain, string strName, string strPassword) - { - var hToken = IntPtr.Zero; - var hDupedToken = IntPtr.Zero; - TokPriv1Luid tp; - var pi = new PROCESS_INFORMATION(); - var sa = new SECURITY_ATTRIBUTES(); - sa.Length = Marshal.SizeOf(sa); - Boolean bResult = false; - try - { - bResult = LogonUser( - strName, - strDomain, - strPassword, - LogonType.LOGON32_LOGON_BATCH, - LogonProvider.LOGON32_PROVIDER_DEFAULT, - out hToken - ); - if (!bResult) - { - throw new Win32Exception("The user could not be logged on. Ensure that the user has an existing profile on the machine and that correct credentials are provided. Logon error #" + Marshal.GetLastWin32Error().ToString()); - } - IntPtr hproc = GetCurrentProcess(); - IntPtr htok = IntPtr.Zero; - bResult = OpenProcessToken( - hproc, - TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, - ref htok - ); - if(!bResult) - { - throw new Win32Exception("Open process token error #" + Marshal.GetLastWin32Error().ToString()); - } - tp.Count = 1; - tp.Luid = 0; - tp.Attr = SE_PRIVILEGE_ENABLED; - bResult = LookupPrivilegeValue( - null, - SE_INCRASE_QUOTA, - ref tp.Luid - ); - if(!bResult) - { - throw new Win32Exception("Error in looking up privilege of the process. This should not happen if DSC is running as LocalSystem Lookup privilege error #" + Marshal.GetLastWin32Error().ToString()); - } - bResult = AdjustTokenPrivileges( - htok, - false, - ref tp, - 0, - IntPtr.Zero, - IntPtr.Zero - ); - if(!bResult) - { - throw new Win32Exception("Token elevation error #" + Marshal.GetLastWin32Error().ToString()); - } - - bResult = DuplicateTokenEx( - hToken, - GENERIC_ALL_ACCESS, - ref sa, - (int)SECURITY_IMPERSONATION_LEVEL.SecurityIdentification, - (int)TOKEN_TYPE.TokenPrimary, - ref hDupedToken - ); - if(!bResult) - { - throw new Win32Exception("Duplicate Token error #" + Marshal.GetLastWin32Error().ToString()); - } - var si = new STARTUPINFO(); - si.cb = Marshal.SizeOf(si); - si.lpDesktop = ""; - bResult = CreateProcessAsUser( - hDupedToken, - null, - strCommand, - ref sa, - ref sa, - false, - 0, - IntPtr.Zero, - null, - ref si, - ref pi - ); - if(!bResult) - { - throw new Win32Exception("The process could not be created. Create process as user error #" + Marshal.GetLastWin32Error().ToString()); - } - } - finally - { - if (pi.hThread != IntPtr.Zero) - { - CloseHandle(pi.hThread); - } - if (pi.hProcess != IntPtr.Zero) - { - CloseHandle(pi.hProcess); - } - if (hDupedToken != IntPtr.Zero) - { - CloseHandle(hDupedToken); - } - } - } - } -} - -"@ - Add-Type -TypeDefinition $ProgramSource -ReferencedAssemblies "System.ServiceProcess" -} - -function GetWin32Process -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [PSCredential] - $Credential - ) - - $fileName = [io.path]::GetFileNameWithoutExtension($Path) - $GetProcesses = @(Get-Process -Name $fileName -ErrorAction SilentlyContinue) - $Processes = foreach($process in $GetProcesses) - { - if($Process.Path -ieq $Path) - { - try - { - [wmi]"Win32_Process.Handle='$($Process.Id)'" - } - catch - { - } - } - } - if($PSBoundParameters.ContainsKey('Credential')) - { - $Processes = $Processes | Where-Object {(GetWin32ProcessOwner $_) -eq $Credential.UserName} - } - if($Arguments -eq $null) {$Arguments = ""} - $Processes = $Processes | Where-Object {(GetWin32ProcessArgumentsFromCommandLine $_.CommandLine) -eq $Arguments} - - return $Processes -} - -function GetWin32ProcessOwner -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNull()] - $Process - ) - - try - { - $Owner = $Process.GetOwner() - } - catch - {} - if($owner.Domain -ne $null) - { - return $Owner.Domain + "\" + $Owner.User - } - else - { - return $Owner.User - } -} - -function GetWin32ProcessArgumentsFromCommandLine -{ - param - ( - [String] - $commandLine - ) - - if($commandLine -eq $null) - { - return "" - } - $commandLine=$commandLine.Trim() - if($commandLine.Length -eq 0) - { - return "" - } - if($commandLine[0] -eq '"') - { - $charToLookfor=[char]'"' - } - else - { - $charToLookfor=[char]' ' - } - $endOfCommand=$commandLine.IndexOf($charToLookfor ,1) - if($endOfCommand -eq -1) - { - return "" - } - return $commandLine.Substring($endOfCommand+1).Trim() -} - -function StartWin32Process -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [PSCredential] - $Credential, - - [Switch] - $AsTask - ) - - $GetArguments = ExtractArguments $PSBoundParameters ("Path","Arguments","Credential") - $Processes = @(GetWin32Process @getArguments) - if ($processes.Count -eq 0) - { - if($PSBoundParameters.ContainsKey("Credential")) - { - if($AsTask) - { - $ActionArguments = ExtractArguments $PSBoundParameters ` - ("Path", "Arguments") ` - ("Execute", "Argument") - if([string]::IsNullOrEmpty($Arguments)) - { - $null = $ActionArguments.Remove("Argument") - } - $TaskGuid = [guid]::NewGuid().ToString() - $Action = New-ScheduledTaskAction @ActionArguments - $null = Register-ScheduledTask -TaskName "xPDT $TaskGuid" -Action $Action -User $Credential.UserName -Password $Credential.GetNetworkCredential().Password -RunLevel Highest - $err = Start-ScheduledTask -TaskName "xPDT $TaskGuid" - } - else - { - try - { - CallPInvoke - [Source.NativeMethods]::CreateProcessAsUser(("$Path " + $Arguments),$Credential.GetNetworkCredential().Domain,$Credential.GetNetworkCredential().UserName,$Credential.GetNetworkCredential().Password) - } - catch - { - $exception = New-Object System.ArgumentException $_ - $errorCategory = [System.Management.Automation.ErrorCategory]::OperationStopped - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, "Win32Exception", $errorCategory, $null - $err = $errorRecord - } - } - } - else - { - $StartArguments = ExtractArguments $PSBoundParameters ` - ("Path", "Arguments", "Credential") ` - ("FilePath", "ArgumentList", "Credential") - if([string]::IsNullOrEmpty($Arguments)) - { - $null = $StartArguments.Remove("ArgumentList") - } - $err = Start-Process @StartArguments - } - if($err -ne $null) - { - throw $err - } - if (!(WaitForWin32ProcessStart @GetArguments)) - { - ThrowInvalidArgumentError "FailureWaitingForProcessesToStart" ($LocalizedData.ErrorStarting -f $Path,$LocalizedData.FailureWaitingForProcessesToStart) - } - } - else - { - return ($LocalizedData.ProcessAlreadyStarted -f $Path,$Processes.ProcessId) - } - $Processes = @(GetWin32Process @getArguments) - return ($LocalizedData.ProcessStarted -f $Path,$Processes.ProcessId) -} - -function WaitForWin32ProcessStart -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [PSCredential] - $Credential - ) - - $start = [DateTime]::Now - $GetArguments = ExtractArguments $PSBoundParameters ("Path","Arguments","Credential") - do - { - $value = @(GetWin32Process @GetArguments).Count -ge 1 - } while(!$value -and ([DateTime]::Now - $start).TotalMilliseconds -lt 60000) - - return $value -} - -function WaitForWin32ProcessEnd -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [PSCredential] - $Credential - ) - - $GetArguments = ExtractArguments $PSBoundParameters ("Path","Arguments","Credential") - While (WaitForWin32ProcessStart @GetArguments) - { - Start-Sleep 1 - } - Get-ScheduledTask | Where-Object {($_.TaskName.Length -ge 4) -and ($_.TaskName.Substring(0,4) -eq "xPDT") -and ($_.Actions.Execute -eq $Path) -and ($_.Actions.Arguments -eq $Arguments)} | Where-Object {$_ -ne $null} | Unregister-ScheduledTask -Confirm:$false -} - -function NetUse -{ - param - ( - [parameter(Mandatory)] - [string] - $SourcePath, - - [parameter(Mandatory)] - [PSCredential] - $Credential, - - [string] - $Ensure = "Present" - ) - - if(($SourcePath.Length -ge 2) -and ($SourcePath.Substring(0,2) -eq "\\")) - { - - if ($Ensure -eq "Absent") - { - $cmd = "net.exe use $SourcePath /del" - } - else - { - $cmd = "net.exe use $SourcePath $($Credential.GetNetworkCredential().Password) /user:$($Credential.GetNetworkCredential().Domain)\$($Credential.GetNetworkCredential().UserName)" - } - Invoke-Expression $cmd - } -} - -Export-ModuleMember ResolvePath,StartWin32Process,WaitForWin32ProcessEnd,NetUse diff --git a/lib/puppet_x/dsc_resources/xSCSPF/xSCSPF.psd1 b/lib/puppet_x/dsc_resources/xSCSPF/xSCSPF.psd1 deleted file mode 100644 index 574bcaaa..00000000 --- a/lib/puppet_x/dsc_resources/xSCSPF/xSCSPF.psd1 +++ /dev/null @@ -1,31 +0,0 @@ -@{ -# Version number of this module. -ModuleVersion = '1.3.1.0' - -# ID used to uniquely identify this module -GUID = '8dbdcdc0-3f1a-46c3-9708-02f15c6679fd' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'Module with DSC Resources for deployment and configuration of Microsoft System Center Service Provider Foundation.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Minimum version of the common language runtime (CLR) required by this module -CLRVersion = '4.0' - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' -} diff --git a/lib/puppet_x/dsc_resources/xSCSR/DSCResources/MSFT_xSCSRServerSetup/MSFT_xSCSRServerSetup.psm1 b/lib/puppet_x/dsc_resources/xSCSR/DSCResources/MSFT_xSCSRServerSetup/MSFT_xSCSRServerSetup.psm1 deleted file mode 100644 index 69cde96e..00000000 --- a/lib/puppet_x/dsc_resources/xSCSR/DSCResources/MSFT_xSCSRServerSetup/MSFT_xSCSRServerSetup.psm1 +++ /dev/null @@ -1,390 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\Orchestrator", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.String] - [ValidateSet("Yes","No")] - $SendCEIPReports = "No", - - [System.String] - [ValidateSet("Yes","No")] - $UseMicrosoftUpdate = "No", - - [System.String] - $InstallFolder, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServerInstance, - - [System.String] - $RepositoryDatabaseName = "UsageRepositoryDB", - - [System.String] - $StagingDatabaseName = "UsageStagingDB", - - [System.String] - $DWDatabaseName = "UsageWarehouseDB", - - [parameter(Mandatory = $true)] - [System.String] - $AnalysisDatabaseServer, - - [parameter(Mandatory = $true)] - [System.String] - $AnalysisDatabaseServerInstance, - - [System.String] - $AnalysisDatabaseName = "UsageAnalysisDB" - ) - - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "\Service Reporting\setup.exe" - $Path = ResolvePath $Path - $Version = (Get-Item -Path $Path).VersionInfo.ProductVersion - - switch($Version) - { - "7.2.462.0" - { - $IdentifyingNumber = "{643E2225-E1BB-4586-9CBE-8BC2DED6D12E}" - $SCVersion = "System Center 2012 R2" - } - "7.2.3002.0" - { - $IdentifyingNumber = "{643E2225-E1BB-4586-9CBE-8BC2DED6D12E}" - $SCVersion = "System Center Technical Preview" - } - Default - { - throw "Unknown version of Service Reporting!" - } - } - - if(Get-WmiObject -Class Win32_Product | Where-Object {$_.IdentifyingNumber -eq $IdentifyingNumber}) - { - switch($SCVersion) - { - "System Center 2012 R2" - { - $Reg = "HKLM:\SOFTWARE\Microsoft\System Center Service Reporting\R2" - } - "System Center Technical Preview" - { - $Reg = "HKLM:\SOFTWARE\Microsoft\System Center Service Reporting\R2" - } - } - $InstallFolder = (Get-ItemProperty -Path $Reg -Name "PackageFolder").PackageFolder - $DatabaseServer = (Get-ItemProperty -Path $Reg -Name "DWRepositoryDBHost").DWRepositoryDBHost - if($DatabaseServer.Contains("\")) - { - $DatabaseServerInstance = $DatabaseServer.Split("\")[1] - $DatabaseServer = $DatabaseServer.Split("\")[0] - } - else - { - $DatabaseServerInstance = "MSSQLSERVER" - } - $RepositoryDatabaseName = (Get-ItemProperty -Path $Reg -Name "ETLRepositoryDBName").ETLRepositoryDBName - $StagingDatabaseName = (Get-ItemProperty -Path $Reg -Name "StagingDBName").StagingDBName - $DWDatabaseName = (Get-ItemProperty -Path $Reg -Name "DWRepositoryDBName").DWRepositoryDBName - $AnalysisDatabaseServer = (Get-ItemProperty -Path $Reg -Name "AnalysisDBHost").AnalysisDBHost - if($AnalysisDatabaseServer.Contains("\")) - { - $AnalysisDatabaseServerInstance = $AnalysisDatabaseServer.Split("\")[1] - $AnalysisDatabaseServer = $AnalysisDatabaseServer.Split("\")[0] - } - else - { - $AnalysisDatabaseServerInstance = "MSSQLSERVER" - } - $AnalysisDatabaseName = (Get-ItemProperty -Path $Reg -Name "AnalysisDBName").AnalysisDBName - - $returnValue = @{ - Ensure = "Present" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - InstallFolder = $InstallFolder - DatabaseServer = $DatabaseServer - DatabaseServerInstance = $DatabaseServerInstance - RepositoryDatabaseName = $RepositoryDatabaseName - StagingDatabaseName = $StagingDatabaseName - DWDatabaseName = $DWDatabaseName - AnalysisDatabaseServer = $AnalysisDatabaseServer - AnalysisDatabaseServerInstance = $AnalysisDatabaseServerInstance - AnalysisDatabaseName = $AnalysisDatabaseName - } - } - else - { - $returnValue = @{ - Ensure = "Absent" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\Orchestrator", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.String] - [ValidateSet("Yes","No")] - $SendCEIPReports = "No", - - [System.String] - [ValidateSet("Yes","No")] - $UseMicrosoftUpdate = "No", - - [System.String] - $InstallFolder, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServerInstance, - - [System.String] - $RepositoryDatabaseName = "UsageRepositoryDB", - - [System.String] - $StagingDatabaseName = "UsageStagingDB", - - [System.String] - $DWDatabaseName = "UsageWarehouseDB", - - [parameter(Mandatory = $true)] - [System.String] - $AnalysisDatabaseServer, - - [parameter(Mandatory = $true)] - [System.String] - $AnalysisDatabaseServerInstance, - - [System.String] - $AnalysisDatabaseName = "UsageAnalysisDB" - ) - - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "\Service Reporting\setup.exe" - $Path = ResolvePath $Path - $Version = (Get-Item -Path $Path).VersionInfo.ProductVersion - Write-Verbose "Path: $Path" - - switch($Version) - { - "7.2.462.0" - { - $IdentifyingNumber = "{643E2225-E1BB-4586-9CBE-8BC2DED6D12E}" - } - "7.2.3002.0" - { - $IdentifyingNumber = "{643E2225-E1BB-4586-9CBE-8BC2DED6D12E}" - } - Default - { - throw "Unknown version of Service Reporting!" - } - } - - switch($Ensure) - { - "Present" - { - # Create install arguments - $TempFile = [IO.Path]::GetTempFileName() - $Arguments = "-Silent $TempFile" - $AnswerFile = @("-AcceptEULA Yes") - if($DatabaseServerInstance -eq "MSSQLSERVER") - { - $DatabaseServerInstance = $DatabaseServer - } - if($AnalysisDatabaseServerInstance -eq "MSSQLSERVER") - { - $AnalysisDatabaseServerInstance = $AnalysisDatabaseServer - } - $AnswerFileVars = @( - "SendCEIPReports", - "UseMicrosoftUpdate", - "InstallFolder", - "DatabaseServer", - "DatabaseServerInstance", - "RepositoryDatabaseName", - "StagingDatabaseName", - "DWDatabaseName", - "AnalysisDatabaseServer", - "AnalysisDatabaseServerInstance", - "AnalysisDatabaseName" - ) - foreach($AnswerFileVar in $AnswerFileVars) - { - if(!([String]::IsNullOrEmpty((Get-Variable -Name $AnswerFileVar).Value)) -and ((Get-Variable -Name $AnswerFileVar).Value -ne 0)) - { - if([Environment]::ExpandEnvironmentVariables((Get-Variable -Name $AnswerFileVar).Value).Contains(" ")) - { - $AnswerFile += "-$AnswerFileVar `"" + [Environment]::ExpandEnvironmentVariables((Get-Variable -Name $AnswerFileVar).Value) + "`"" - } - else - { - $AnswerFile += "-$AnswerFileVar " + [Environment]::ExpandEnvironmentVariables((Get-Variable -Name $AnswerFileVar).Value) - } - } - } - - Write-Verbose "AnswerFile: $TempFile" - foreach($Line in $AnswerFile) - { - Add-Content -Path $TempFile -Value $Line -Encoding Ascii - Write-Verbose $Line - } - } - "Absent" - { - # Create uninstall arguments - $Arguments = "-Uninstall" - } - } - - Write-Verbose "Arguments: $Arguments" - - $Process = StartWin32Process -Path $Path -Arguments $Arguments -Credential $SetupCredential - Write-Verbose $Process - WaitForWin32ProcessEnd -Path $Path -Arguments $Arguments -Credential $SetupCredential - - # Clean up - if(Test-Path -Path $TempFile) - { - Remove-Item -Path $TempFile - } - - if((Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Name 'PendingFileRenameOperations' -ErrorAction SilentlyContinue) -ne $null) - { - $global:DSCMachineStatus = 1 - } - else - { - if(!(Test-TargetResource @PSBoundParameters)) - { - throw "Set-TargetResouce failed" - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\Orchestrator", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.String] - [ValidateSet("Yes","No")] - $SendCEIPReports = "No", - - [System.String] - [ValidateSet("Yes","No")] - $UseMicrosoftUpdate = "No", - - [System.String] - $InstallFolder, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServerInstance, - - [System.String] - $RepositoryDatabaseName = "UsageRepositoryDB", - - [System.String] - $StagingDatabaseName = "UsageStagingDB", - - [System.String] - $DWDatabaseName = "UsageWarehouseDB", - - [parameter(Mandatory = $true)] - [System.String] - $AnalysisDatabaseServer, - - [parameter(Mandatory = $true)] - [System.String] - $AnalysisDatabaseServerInstance, - - [System.String] - $AnalysisDatabaseName = "UsageAnalysisDB" - ) - - $result = ((Get-TargetResource @PSBoundParameters).Ensure -eq $Ensure) - - $result -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSCSR/DSCResources/MSFT_xSCSRServerSetup/MSFT_xSCSRServerSetup.schema.mof b/lib/puppet_x/dsc_resources/xSCSR/DSCResources/MSFT_xSCSRServerSetup/MSFT_xSCSRServerSetup.schema.mof deleted file mode 100644 index 0563a759..00000000 --- a/lib/puppet_x/dsc_resources/xSCSR/DSCResources/MSFT_xSCSRServerSetup/MSFT_xSCSRServerSetup.schema.mof +++ /dev/null @@ -1,19 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSCSRServerSetup")] -class MSFT_xSCSRServerSetup : OMI_BaseResource -{ - [Key, Description("An enumerated value that describes if the Service Reporting server is expected to be installed on the machine.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Required, Description("UNC path to the root of the source files for installation.")] String SourcePath; - [Write, Description("Folder within the source path containing the source files for installation.")] String SourceFolder; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the installation.")] String SetupCredential; - [Write, Description("Participation in Customer Experience Improvement Program (yes or no)."), ValueMap{"Yes","No"}, Values{"Yes","No"}] String SendCEIPReports; - [Write, Description("Participation in Microsoft Update (yes or no)."), ValueMap{"Yes","No"}, Values{"Yes","No"}] String UseMicrosoftUpdate; - [Write, Description("Folder to install to.")] String InstallFolder; - [Required, Description("Name of the server that is running SQL Server where the databases already exist, or where Setup will create them .")] String DatabaseServer; - [Required, Description("Name of the SQL Server database instance to install to.")] String DatabaseServerInstance; - [Write, Description("Name of the usage repository database that already exists, or that Setup will create.")] String RepositoryDatabaseName; - [Write, Description("Name of the usage staging database that already exists, or that Setup will create.")] String StagingDatabaseName; - [Write, Description("Name of the usage data warehouse database that already exists, or that Setup will create.")] String DWDatabaseName; - [Required, Description("Name of the server that is running SQL Server where the analysis database already exists, or where Setup will create it.")] String AnalysisDatabaseServer; - [Required, Description("Name of the SQL Server analysis database instance to install to.")] String AnalysisDatabaseServerInstance; - [Write, Description("Name of the analysis database that already exists, or that Setup will create.")] String AnalysisDatabaseName; -}; diff --git a/lib/puppet_x/dsc_resources/xSCSR/DSCResources/MSFT_xSCSRServerUpdate/MSFT_xSCSRServerUpdate.psm1 b/lib/puppet_x/dsc_resources/xSCSR/DSCResources/MSFT_xSCSRServerUpdate/MSFT_xSCSRServerUpdate.psm1 deleted file mode 100644 index 809ef485..00000000 --- a/lib/puppet_x/dsc_resources/xSCSR/DSCResources/MSFT_xSCSRServerUpdate/MSFT_xSCSRServerUpdate.psm1 +++ /dev/null @@ -1,183 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\Orchestrator\Service Reporting\Updates", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - $Version = (Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -eq "System Center 2012 R2 Service Reporting MSI"}).Version - - switch($Version) - { - "7.2.462.0" - { - $ProductCode = "{643E2225-E1BB-4586-9CBE-8BC2DED6D12E}" - $PatchID = "{1C2F9B0C-83D4-4820-8AD9-AEBCE05D6D13}" - $Update = "Update Rollup 4" - } - "7.2.3002.0" - { - $returnValue = @{ - Ensure = "Present" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - Update = "None" - } - } - $null - { - $returnValue = @{ - Ensure = "Absent" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - } - } - Default - { - throw "Unknown version of Service Reporting!" - } - } - - if($ProductCode -and $PatchID -and (Get-WmiObject -Class Win32_PatchPackage | Where-Object {($_.ProductCode -eq $ProductCode) -and ($_.PatchID -eq $PatchID)})) - { - $returnValue = @{ - Ensure = "Present" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - Update = $Update - } - } - else - { - $returnValue = @{ - Ensure = "Absent" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\Orchestrator\Service Reporting\Updates", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - $Version = (Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -eq "System Center 2012 R2 Service Reporting MSI"}).Version - - switch($Version) - { - "7.2.462.0" - { - $UpdateFile = "kb2992025_Microsoft.SystemCenter.SMR.Setup_x64.msp" - } - "7.2.3002.0" - { - Write-Verbose "No update for this version of Service Reporting!" - } - $null - { - Write-Verbose "Service Reporting not installed!" - } - Default - { - throw "Unknown version of Service Reporting!" - } - } - - if($UpdateFile) - { - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - $Path = "msiexec.exe" - $Path = ResolvePath $Path - Write-Verbose "Path: $Path" - - $MSPPath = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath $UpdateFile - $MSPPath = ResolvePath $MSPPath - $Arguments = "/update `"$MSPPath`" /norestart" - Write-Verbose "Arguments: $Arguments" - - $Process = StartWin32Process -Path $Path -Arguments $Arguments -Credential $SetupCredential - Write-Verbose $Process - WaitForWin32ProcessEnd -Path $Path -Arguments $Arguments -Credential $SetupCredential - } - - if((Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Name 'PendingFileRenameOperations' -ErrorAction SilentlyContinue) -ne $null) - { - $global:DSCMachineStatus = 1 - } - else - { - if(!(Test-TargetResource @PSBoundParameters)) - { - throw "Set-TargetResouce failed" - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\Orchestrator\Service Reporting\Updates", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - $result = ((Get-TargetResource @PSBoundParameters).Ensure -eq $Ensure) - - $result -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSCSR/DSCResources/MSFT_xSCSRServerUpdate/MSFT_xSCSRServerUpdate.schema.mof b/lib/puppet_x/dsc_resources/xSCSR/DSCResources/MSFT_xSCSRServerUpdate/MSFT_xSCSRServerUpdate.schema.mof deleted file mode 100644 index 0240be29..00000000 --- a/lib/puppet_x/dsc_resources/xSCSR/DSCResources/MSFT_xSCSRServerUpdate/MSFT_xSCSRServerUpdate.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSCSRServerUpdate")] -class MSFT_xSCSRServerUpdate : OMI_BaseResource -{ - [Key, Description("An enumerated value that describes if the update is expected to be installed on the machine.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Required, Description("UNC path to the root of the source files for installation.")] String SourcePath; - [Write, Description("Folder within the source path containing the source files for installation.")] String SourceFolder; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the installation.")] String SetupCredential; - [Read, Description("Display name of the update.")] String Update; -}; diff --git a/lib/puppet_x/dsc_resources/xSCSR/LICENSE b/lib/puppet_x/dsc_resources/xSCSR/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xSCSR/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xSCSR/en-US/xPDT.strings.psd1 b/lib/puppet_x/dsc_resources/xSCSR/en-US/xPDT.strings.psd1 deleted file mode 100644 index 11f213c1..00000000 --- a/lib/puppet_x/dsc_resources/xSCSR/en-US/xPDT.strings.psd1 +++ /dev/null @@ -1,10 +0,0 @@ -ConvertFrom-StringData @' -FileNotFound=File not found in the environment path -AbsolutePathOrFileName=Absolute path or file name expected -InvalidArgument=Invalid argument: '{0}' with value: '{1}' -InvalidArgumentAndMessage={0} {1} -ErrorStarting=Failure starting process matching path '{0}'. Message: {1} -FailureWaitingForProcessesToStart=Failed to wait for processes to start -ProcessStarted=Process matching path '{0}' started in process ID {1} -ProcessAlreadyStarted=Process matching path '{0}' already started in process ID {1} -'@ diff --git a/lib/puppet_x/dsc_resources/xSCSR/xPDT.psm1 b/lib/puppet_x/dsc_resources/xSCSR/xPDT.psm1 deleted file mode 100644 index c90beaa1..00000000 --- a/lib/puppet_x/dsc_resources/xSCSR/xPDT.psm1 +++ /dev/null @@ -1,708 +0,0 @@ -data LocalizedData -{ - ConvertFrom-StringData @' - -FileNotFound=File not found in the environment path -AbsolutePathOrFileName=Absolute path or file name expected -InvalidArgument=Invalid argument: '{0}' with value: '{1}' -InvalidArgumentAndMessage={0} {1} -ErrorStarting=Failure starting process matching path '{0}'. Message: {1} -FailureWaitingForProcessesToStart=Failed to wait for processes to start -ProcessStarted=Process matching path '{0}' started in process ID {1} -ProcessAlreadyStarted=Process matching path '{0}' already started in process ID {1} -'@ -} - -Import-LocalizedData LocalizedData -filename xPDT.strings.psd1 - -function ThrowInvalidArgumentError -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $errorId, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $errorMessage - ) - - $errorCategory=[System.Management.Automation.ErrorCategory]::InvalidArgument - $exception = New-Object System.ArgumentException $errorMessage; - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - throw $errorRecord -} - -function ResolvePath -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Path - ) - - $Path = [Environment]::ExpandEnvironmentVariables($Path) - if(IsRootedPath $Path) - { - if(!(Test-Path $Path -PathType Leaf)) - { - ThrowInvalidArgumentError "CannotFindRootedPath" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.FileNotFound) - } - return $Path - } - if([string]::IsNullOrEmpty($env:Path)) - { - ThrowInvalidArgumentError "EmptyEnvironmentPath" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.FileNotFound) - } - if((Split-Path $Path -Leaf) -ne $Path) - { - ThrowInvalidArgumentError "NotAbsolutePathOrFileName" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.AbsolutePathOrFileName) - } - foreach($rawSegment in $env:Path.Split(";")) - { - $segment = [Environment]::ExpandEnvironmentVariables($rawSegment) - $segmentRooted = $false - try - { - $segmentRooted=[IO.Path]::IsPathRooted($segment) - } - catch {} - if(!$segmentRooted) - { - continue - } - $candidate = join-path $segment $Path - if(Test-Path $candidate -PathType Leaf) - { - return $candidate - } - } - ThrowInvalidArgumentError "CannotFindRelativePath" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.FileNotFound) -} - -function IsRootedPath -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path - ) - - try - { - return [IO.Path]::IsPathRooted($Path) - } - catch - { - ThrowInvalidArgumentError "CannotGetIsPathRooted" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $_.Exception.Message) - } -} - -function ExtractArguments -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - $functionBoundParameters, - - [parameter(Mandatory = $true)] - [string[]] - $argumentNames, - - [string[]] - $newArgumentNames - ) - - $returnValue=@{} - - for($i=0;$i -lt $argumentNames.Count;$i++) - { - $argumentName = $argumentNames[$i] - - if($newArgumentNames -eq $null) - { - $newArgumentName = $argumentName - } - else - { - $newArgumentName = $newArgumentNames[$i] - } - - if($functionBoundParameters.ContainsKey($argumentName)) - { - $null = $returnValue.Add($newArgumentName,$functionBoundParameters[$argumentName]) - } - } - - return $returnValue -} - -function CallPInvoke -{ - $script:ProgramSource = @" -using System; -using System.Collections.Generic; -using System.Text; -using System.Security; -using System.Runtime.InteropServices; -using System.Diagnostics; -using System.Security.Principal; -using System.ComponentModel; -using System.IO; - -namespace Source -{ - [SuppressUnmanagedCodeSecurity] - public static class NativeMethods - { - //The following structs and enums are used by the various Win32 API's that are used in the code below - - [StructLayout(LayoutKind.Sequential)] - public struct STARTUPINFO - { - public Int32 cb; - public string lpReserved; - public string lpDesktop; - public string lpTitle; - public Int32 dwX; - public Int32 dwY; - public Int32 dwXSize; - public Int32 dwXCountChars; - public Int32 dwYCountChars; - public Int32 dwFillAttribute; - public Int32 dwFlags; - public Int16 wShowWindow; - public Int16 cbReserved2; - public IntPtr lpReserved2; - public IntPtr hStdInput; - public IntPtr hStdOutput; - public IntPtr hStdError; - } - - [StructLayout(LayoutKind.Sequential)] - public struct PROCESS_INFORMATION - { - public IntPtr hProcess; - public IntPtr hThread; - public Int32 dwProcessID; - public Int32 dwThreadID; - } - - [Flags] - public enum LogonType - { - LOGON32_LOGON_INTERACTIVE = 2, - LOGON32_LOGON_NETWORK = 3, - LOGON32_LOGON_BATCH = 4, - LOGON32_LOGON_SERVICE = 5, - LOGON32_LOGON_UNLOCK = 7, - LOGON32_LOGON_NETWORK_CLEARTEXT = 8, - LOGON32_LOGON_NEW_CREDENTIALS = 9 - } - - [Flags] - public enum LogonProvider - { - LOGON32_PROVIDER_DEFAULT = 0, - LOGON32_PROVIDER_WINNT35, - LOGON32_PROVIDER_WINNT40, - LOGON32_PROVIDER_WINNT50 - } - [StructLayout(LayoutKind.Sequential)] - public struct SECURITY_ATTRIBUTES - { - public Int32 Length; - public IntPtr lpSecurityDescriptor; - public bool bInheritHandle; - } - - public enum SECURITY_IMPERSONATION_LEVEL - { - SecurityAnonymous, - SecurityIdentification, - SecurityImpersonation, - SecurityDelegation - } - - public enum TOKEN_TYPE - { - TokenPrimary = 1, - TokenImpersonation - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - internal struct TokPriv1Luid - { - public int Count; - public long Luid; - public int Attr; - } - - public const int GENERIC_ALL_ACCESS = 0x10000000; - public const int CREATE_NO_WINDOW = 0x08000000; - internal const int SE_PRIVILEGE_ENABLED = 0x00000002; - internal const int TOKEN_QUERY = 0x00000008; - internal const int TOKEN_ADJUST_PRIVILEGES = 0x00000020; - internal const string SE_INCRASE_QUOTA = "SeIncreaseQuotaPrivilege"; - - [DllImport("kernel32.dll", - EntryPoint = "CloseHandle", SetLastError = true, - CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] - public static extern bool CloseHandle(IntPtr handle); - - [DllImport("advapi32.dll", - EntryPoint = "CreateProcessAsUser", SetLastError = true, - CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] - public static extern bool CreateProcessAsUser( - IntPtr hToken, - string lpApplicationName, - string lpCommandLine, - ref SECURITY_ATTRIBUTES lpProcessAttributes, - ref SECURITY_ATTRIBUTES lpThreadAttributes, - bool bInheritHandle, - Int32 dwCreationFlags, - IntPtr lpEnvrionment, - string lpCurrentDirectory, - ref STARTUPINFO lpStartupInfo, - ref PROCESS_INFORMATION lpProcessInformation - ); - - [DllImport("advapi32.dll", EntryPoint = "DuplicateTokenEx")] - public static extern bool DuplicateTokenEx( - IntPtr hExistingToken, - Int32 dwDesiredAccess, - ref SECURITY_ATTRIBUTES lpThreadAttributes, - Int32 ImpersonationLevel, - Int32 dwTokenType, - ref IntPtr phNewToken - ); - - [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] - public static extern Boolean LogonUser( - String lpszUserName, - String lpszDomain, - String lpszPassword, - LogonType dwLogonType, - LogonProvider dwLogonProvider, - out IntPtr phToken - ); - - [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)] - internal static extern bool AdjustTokenPrivileges( - IntPtr htok, - bool disall, - ref TokPriv1Luid newst, - int len, - IntPtr prev, - IntPtr relen - ); - - [DllImport("kernel32.dll", ExactSpelling = true)] - internal static extern IntPtr GetCurrentProcess(); - - [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)] - internal static extern bool OpenProcessToken( - IntPtr h, - int acc, - ref IntPtr phtok - ); - - [DllImport("advapi32.dll", SetLastError = true)] - internal static extern bool LookupPrivilegeValue( - string host, - string name, - ref long pluid - ); - - public static void CreateProcessAsUser(string strCommand, string strDomain, string strName, string strPassword) - { - var hToken = IntPtr.Zero; - var hDupedToken = IntPtr.Zero; - TokPriv1Luid tp; - var pi = new PROCESS_INFORMATION(); - var sa = new SECURITY_ATTRIBUTES(); - sa.Length = Marshal.SizeOf(sa); - Boolean bResult = false; - try - { - bResult = LogonUser( - strName, - strDomain, - strPassword, - LogonType.LOGON32_LOGON_BATCH, - LogonProvider.LOGON32_PROVIDER_DEFAULT, - out hToken - ); - if (!bResult) - { - throw new Win32Exception("The user could not be logged on. Ensure that the user has an existing profile on the machine and that correct credentials are provided. Logon error #" + Marshal.GetLastWin32Error().ToString()); - } - IntPtr hproc = GetCurrentProcess(); - IntPtr htok = IntPtr.Zero; - bResult = OpenProcessToken( - hproc, - TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, - ref htok - ); - if(!bResult) - { - throw new Win32Exception("Open process token error #" + Marshal.GetLastWin32Error().ToString()); - } - tp.Count = 1; - tp.Luid = 0; - tp.Attr = SE_PRIVILEGE_ENABLED; - bResult = LookupPrivilegeValue( - null, - SE_INCRASE_QUOTA, - ref tp.Luid - ); - if(!bResult) - { - throw new Win32Exception("Error in looking up privilege of the process. This should not happen if DSC is running as LocalSystem Lookup privilege error #" + Marshal.GetLastWin32Error().ToString()); - } - bResult = AdjustTokenPrivileges( - htok, - false, - ref tp, - 0, - IntPtr.Zero, - IntPtr.Zero - ); - if(!bResult) - { - throw new Win32Exception("Token elevation error #" + Marshal.GetLastWin32Error().ToString()); - } - - bResult = DuplicateTokenEx( - hToken, - GENERIC_ALL_ACCESS, - ref sa, - (int)SECURITY_IMPERSONATION_LEVEL.SecurityIdentification, - (int)TOKEN_TYPE.TokenPrimary, - ref hDupedToken - ); - if(!bResult) - { - throw new Win32Exception("Duplicate Token error #" + Marshal.GetLastWin32Error().ToString()); - } - var si = new STARTUPINFO(); - si.cb = Marshal.SizeOf(si); - si.lpDesktop = ""; - bResult = CreateProcessAsUser( - hDupedToken, - null, - strCommand, - ref sa, - ref sa, - false, - 0, - IntPtr.Zero, - null, - ref si, - ref pi - ); - if(!bResult) - { - throw new Win32Exception("The process could not be created. Create process as user error #" + Marshal.GetLastWin32Error().ToString()); - } - } - finally - { - if (pi.hThread != IntPtr.Zero) - { - CloseHandle(pi.hThread); - } - if (pi.hProcess != IntPtr.Zero) - { - CloseHandle(pi.hProcess); - } - if (hDupedToken != IntPtr.Zero) - { - CloseHandle(hDupedToken); - } - } - } - } -} - -"@ - Add-Type -TypeDefinition $ProgramSource -ReferencedAssemblies "System.ServiceProcess" -} - -function GetWin32Process -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [PSCredential] - $Credential - ) - - $fileName = [io.path]::GetFileNameWithoutExtension($Path) - $GetProcesses = @(Get-Process -Name $fileName -ErrorAction SilentlyContinue) - $Processes = foreach($process in $GetProcesses) - { - if($Process.Path -ieq $Path) - { - try - { - [wmi]"Win32_Process.Handle='$($Process.Id)'" - } - catch - { - } - } - } - if($PSBoundParameters.ContainsKey('Credential')) - { - $Processes = $Processes | Where-Object {(GetWin32ProcessOwner $_) -eq $Credential.UserName} - } - if($Arguments -eq $null) {$Arguments = ""} - $Processes = $Processes | Where-Object {(GetWin32ProcessArgumentsFromCommandLine $_.CommandLine) -eq $Arguments} - - return $Processes -} - -function GetWin32ProcessOwner -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNull()] - $Process - ) - - try - { - $Owner = $Process.GetOwner() - } - catch - {} - if($owner.Domain -ne $null) - { - return $Owner.Domain + "\" + $Owner.User - } - else - { - return $Owner.User - } -} - -function GetWin32ProcessArgumentsFromCommandLine -{ - param - ( - [String] - $commandLine - ) - - if($commandLine -eq $null) - { - return "" - } - $commandLine=$commandLine.Trim() - if($commandLine.Length -eq 0) - { - return "" - } - if($commandLine[0] -eq '"') - { - $charToLookfor=[char]'"' - } - else - { - $charToLookfor=[char]' ' - } - $endOfCommand=$commandLine.IndexOf($charToLookfor ,1) - if($endOfCommand -eq -1) - { - return "" - } - return $commandLine.Substring($endOfCommand+1).Trim() -} - -function StartWin32Process -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [PSCredential] - $Credential, - - [Switch] - $AsTask - ) - - $GetArguments = ExtractArguments $PSBoundParameters ("Path","Arguments","Credential") - $Processes = @(GetWin32Process @getArguments) - if ($processes.Count -eq 0) - { - if($PSBoundParameters.ContainsKey("Credential")) - { - if($AsTask) - { - $ActionArguments = ExtractArguments $PSBoundParameters ` - ("Path", "Arguments") ` - ("Execute", "Argument") - if([string]::IsNullOrEmpty($Arguments)) - { - $null = $ActionArguments.Remove("Argument") - } - $TaskGuid = [guid]::NewGuid().ToString() - $Action = New-ScheduledTaskAction @ActionArguments - $null = Register-ScheduledTask -TaskName "xPDT $TaskGuid" -Action $Action -User $Credential.UserName -Password $Credential.GetNetworkCredential().Password -RunLevel Highest - $err = Start-ScheduledTask -TaskName "xPDT $TaskGuid" - } - else - { - try - { - CallPInvoke - [Source.NativeMethods]::CreateProcessAsUser(("$Path " + $Arguments),$Credential.GetNetworkCredential().Domain,$Credential.GetNetworkCredential().UserName,$Credential.GetNetworkCredential().Password) - } - catch - { - $exception = New-Object System.ArgumentException $_ - $errorCategory = [System.Management.Automation.ErrorCategory]::OperationStopped - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, "Win32Exception", $errorCategory, $null - $err = $errorRecord - } - } - } - else - { - $StartArguments = ExtractArguments $PSBoundParameters ` - ("Path", "Arguments", "Credential") ` - ("FilePath", "ArgumentList", "Credential") - if([string]::IsNullOrEmpty($Arguments)) - { - $null = $StartArguments.Remove("ArgumentList") - } - $err = Start-Process @StartArguments - } - if($err -ne $null) - { - throw $err - } - if (!(WaitForWin32ProcessStart @GetArguments)) - { - ThrowInvalidArgumentError "FailureWaitingForProcessesToStart" ($LocalizedData.ErrorStarting -f $Path,$LocalizedData.FailureWaitingForProcessesToStart) - } - } - else - { - return ($LocalizedData.ProcessAlreadyStarted -f $Path,$Processes.ProcessId) - } - $Processes = @(GetWin32Process @getArguments) - return ($LocalizedData.ProcessStarted -f $Path,$Processes.ProcessId) -} - -function WaitForWin32ProcessStart -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [PSCredential] - $Credential - ) - - $start = [DateTime]::Now - $GetArguments = ExtractArguments $PSBoundParameters ("Path","Arguments","Credential") - do - { - $value = @(GetWin32Process @GetArguments).Count -ge 1 - } while(!$value -and ([DateTime]::Now - $start).TotalMilliseconds -lt 60000) - - return $value -} - -function WaitForWin32ProcessEnd -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [PSCredential] - $Credential - ) - - $GetArguments = ExtractArguments $PSBoundParameters ("Path","Arguments","Credential") - While (WaitForWin32ProcessStart @GetArguments) - { - Start-Sleep 1 - } - Get-ScheduledTask | Where-Object {($_.TaskName.Length -ge 4) -and ($_.TaskName.Substring(0,4) -eq "xPDT") -and ($_.Actions.Execute -eq $Path) -and ($_.Actions.Arguments -eq $Arguments)} | Where-Object {$_ -ne $null} | Unregister-ScheduledTask -Confirm:$false -} - -function NetUse -{ - param - ( - [parameter(Mandatory)] - [string] - $SourcePath, - - [parameter(Mandatory)] - [PSCredential] - $Credential, - - [string] - $Ensure = "Present" - ) - - if(($SourcePath.Length -ge 2) -and ($SourcePath.Substring(0,2) -eq "\\")) - { - - if ($Ensure -eq "Absent") - { - $cmd = "net.exe use $SourcePath /del" - } - else - { - $cmd = "net.exe use $SourcePath $($Credential.GetNetworkCredential().Password) /user:$($Credential.GetNetworkCredential().Domain)\$($Credential.GetNetworkCredential().UserName)" - } - Invoke-Expression $cmd - } -} - -Export-ModuleMember ResolvePath,StartWin32Process,WaitForWin32ProcessEnd,NetUse diff --git a/lib/puppet_x/dsc_resources/xSCSR/xSCSR.psd1 b/lib/puppet_x/dsc_resources/xSCSR/xSCSR.psd1 deleted file mode 100644 index 891ee3d8..00000000 --- a/lib/puppet_x/dsc_resources/xSCSR/xSCSR.psd1 +++ /dev/null @@ -1,31 +0,0 @@ -@{ -# Version number of this module. -ModuleVersion = '1.3.0.0' - -# ID used to uniquely identify this module -GUID = '9abb59ff-a2ec-4206-a372-ed16859bb2ef' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'Module with DSC Resources for deployment and configuration of Microsoft System Center Service Reporting.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Minimum version of the common language runtime (CLR) required by this module -CLRVersion = '4.0' - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' -} diff --git a/lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMAdmin/MSFT_xSCVMMAdmin.psm1 b/lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMAdmin/MSFT_xSCVMMAdmin.psm1 deleted file mode 100644 index f55c9459..00000000 --- a/lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMAdmin/MSFT_xSCVMMAdmin.psm1 +++ /dev/null @@ -1,129 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $Principal, - - [parameter(Mandatory = $true)] - [System.String] - $UserRole, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SCVMMAdminCredential - ) - - $Ensure = Invoke-Command -ComputerName . -Credential $SCVMMAdminCredential { - $Ensure = $args[0] - $Principal = $args[1] - $UserRole = $args[2] - if(Get-SCUserRole -VMMServer $env:COMPUTERNAME -Name $UserRole | ForEach-Object {$_.Members} | Where-Object {$_.Name -eq $Principal}) - { - "Present" - } - else - { - "Absent" - } - } -ArgumentList @($Ensure,$Principal,$UserRole) - - $returnValue = @{ - Ensure = $Ensure - Principal = $Principal - UserRole = $UserRole - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $Principal, - - [parameter(Mandatory = $true)] - [System.String] - $UserRole, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SCVMMAdminCredential - ) - - Invoke-Command -ComputerName . -Credential $SCVMMAdminCredential { - $Ensure = $args[0] - $Principal = $args[1] - $UserRole = $args[2] - switch($Ensure) - { - "Present" - { - if(!(Get-SCUserRole -VMMServer $env:COMPUTERNAME -Name $UserRole | ForEach-Object {$_.Members} | Where-Object {$_.Name -eq $Principal})) - { - Get-SCUserRole -VMMServer $env:COMPUTERNAME -Name $UserRole | Set-SCUserRole -AddMember $Principal - } - } - "Absent" - { - if(Get-SCUserRole -VMMServer $env:COMPUTERNAME -Name $UserRole | ForEach-Object {$_.Members} | Where-Object {$_.Name -eq $Principal}) - { - Get-SCUserRole -VMMServer $env:COMPUTERNAME -Name $UserRole | Set-SCUserRole -RemoveMember $Principal - } - } - } - } -ArgumentList @($Ensure,$Principal,$UserRole) - - if(!(Test-TargetResource @PSBoundParameters)) - { - throw "Set-TargetResouce failed" - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $Principal, - - [parameter(Mandatory = $true)] - [System.String] - $UserRole, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SCVMMAdminCredential - ) - - $result = ((Get-TargetResource @PSBoundParameters).Ensure -eq $Ensure) - - $result -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMAdmin/MSFT_xSCVMMAdmin.schema.mof b/lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMAdmin/MSFT_xSCVMMAdmin.schema.mof deleted file mode 100644 index c67e52e5..00000000 --- a/lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMAdmin/MSFT_xSCVMMAdmin.schema.mof +++ /dev/null @@ -1,8 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSCVMMAdmin")] -class MSFT_xSCVMMAdmin : OMI_BaseResource -{ - [Write, Description("An enumerated value that describes if the principal is an Virtual Machine Manager admin.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Key, Description("The Virtual Machine Manager admin principal.")] String Principal; - [Key, Description("The Virtual Machine Manager user role.")] String UserRole; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the operations.")] String SCVMMAdminCredential; -}; diff --git a/lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMConsoleSetup/MSFT_xSCVMMConsoleSetup.psm1 b/lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMConsoleSetup/MSFT_xSCVMMConsoleSetup.psm1 deleted file mode 100644 index 94ae262b..00000000 --- a/lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMConsoleSetup/MSFT_xSCVMMConsoleSetup.psm1 +++ /dev/null @@ -1,259 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\VirtualMachineManager", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.String] - $ProgramFiles, - - [System.UInt16] - $IndigoTcpPort = 8100, - - [System.Byte] - $MUOptIn - ) - - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "setup.exe" - $Path = ResolvePath $Path - $Version = (Get-Item -Path $Path).VersionInfo.ProductVersion - - switch($Version) - { - "3.2.7510.0" - { - $IdentifyingNumber = "{CDFB453F-5FA4-4884-B282-F46BDFC06051}" - } - "3.2.9013.0" - { - $IdentifyingNumber = "{CDFB453F-5FA4-4884-B282-F46BDFC06051}" - } - Default - { - throw "Unknown version of Virtual Machine Manager!" - } - } - - if(Get-WmiObject -Class Win32_Product | Where-Object {$_.IdentifyingNumber -eq $IdentifyingNumber}) - { - $IndigoTcpPort = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft System Center Virtual Machine Manager Administrator Console\Settings" -Name "IndigoTcpPort").IndigoTcpPort - - $returnValue = @{ - Ensure = "Present" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - IndigoTcpPort = $IndigoTcpPort - } - } - else - { - $returnValue = @{ - Ensure = "Absent" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\VirtualMachineManager", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.String] - $ProgramFiles, - - [System.UInt16] - $IndigoTcpPort = 8100, - - [System.Byte] - $MUOptIn - ) - - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "setup.exe" - $Path = ResolvePath $Path - $Version = (Get-Item -Path $Path).VersionInfo.ProductVersion - Write-Verbose "Path: $Path" - - switch($Version) - { - "3.2.7510.0" - { - $IdentifyingNumber = "{CDFB453F-5FA4-4884-B282-F46BDFC06051}" - $MSIdentifyingNumber = "{59518B15-FC64-4CF9-A4D1-0EE1B4A63088}" - } - "3.2.9013.0" - { - $IdentifyingNumber = "{CDFB453F-5FA4-4884-B282-F46BDFC06051}" - $MSIdentifyingNumber = "{59518B15-FC64-4CF9-A4D1-0EE1B4A63088}" - } - Default - { - throw "Unknown version of Virtual Machine Manager!" - } - } - - $TempFile = [IO.Path]::GetTempFileName() - - switch($Ensure) - { - "Present" - { - # Set defaults, if they couldn't be set in param due to null configdata input - if ($IndigoTcpPort -eq 0) - { - $IndigoTcpPort = 8100 - } - if ($MUOptIn -ne 1) - { - $MUOptIn = 0 - } - - # Create INI file - $INIFile = @() - $INIFile += "[Options]" - - $INIFileVars = @( - "ProgramFiles", - "IndigoTcpPort", - "MUOptIn" - ) - - foreach($INIFileVar in $INIFileVars) - { - if(!([String]::IsNullOrEmpty((Get-Variable -Name $INIFileVar).Value))) - { - $INIFile += "$INIFileVar=" + [Environment]::ExpandEnvironmentVariables((Get-Variable -Name $INIFileVar).Value) - } - } - - Write-Verbose "INIFile: $TempFile" - foreach($Line in $INIFile) - { - Add-Content -Path $TempFile -Value $Line -Encoding Ascii - Write-Verbose $Line - } - - # Create install arguments - $Arguments = "/i /IAcceptSCEULA /client /f $TempFile" - $Arguments = "/i /IAcceptSCEULA /client /f $TempFile" - } - "Absent" - { - # Do not remove console from management server - if(!(Get-WmiObject -Class Win32_Product | Where-Object {$_.IdentifyingNumber -eq $MSIdentifyingNumber})) - { - # Create install arguments - $Arguments = "/x /client" - } - else - { - throw "VMM Console should not be removed from a VMM Management Server!" - } - } - } - - Write-Verbose "Arguments: $Arguments" - - $Process = StartWin32Process -Path $Path -Arguments $Arguments -Credential $SetupCredential -AsTask - Write-Verbose $Process - WaitForWin32ProcessEnd -Path $Path -Arguments $Arguments -Credential $SetupCredential - - # Clean up - if(Test-Path -Path $TempFile) - { - Remove-Item -Path $TempFile - } - - if((Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Name 'PendingFileRenameOperations' -ErrorAction SilentlyContinue) -ne $null) - { - $global:DSCMachineStatus = 1 - } - else - { - if(!(Test-TargetResource @PSBoundParameters)) - { - throw "Set-TargetResouce failed" - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\VirtualMachineManager", - - [System.String] - $ProgramFiles, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.UInt16] - $IndigoTcpPort = 8100, - - [System.Byte] - $MUOptIn - ) - - $result = ((Get-TargetResource @PSBoundParameters).Ensure -eq $Ensure) - - $result -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMConsoleSetup/MSFT_xSCVMMConsoleSetup.schema.mof b/lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMConsoleSetup/MSFT_xSCVMMConsoleSetup.schema.mof deleted file mode 100644 index 825b4784..00000000 --- a/lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMConsoleSetup/MSFT_xSCVMMConsoleSetup.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSCVMMConsoleSetup")] -class MSFT_xSCVMMConsoleSetup : OMI_BaseResource -{ - [Key, Description("An enumerated value that describes if the DPM server is expected to be installed on the machine.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Required, Description("UNC path to the root of the source files for installation.")] String SourcePath; - [Write, Description("Folder within the source path containing the source files for installation.")] String SourceFolder; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the installation.")] String SetupCredential; - [Write, Description("Installation path for the software.")] String ProgramFiles; - [Write, Description("Port for communication with the VMM management server.")] UInt16 IndigoTcpPort; - [Write, Description("0: Do not opt in to Microsoft Update. 1: Opt in to Microsoft Update.")] UInt8 MUOptIn; -}; diff --git a/lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMConsoleUpdate/MSFT_xSCVMMConsoleUpdate.psm1 b/lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMConsoleUpdate/MSFT_xSCVMMConsoleUpdate.psm1 deleted file mode 100644 index 99ea6ae0..00000000 --- a/lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMConsoleUpdate/MSFT_xSCVMMConsoleUpdate.psm1 +++ /dev/null @@ -1,183 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\VirtualMachineManager\Updates", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - $Version = (Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -eq "Microsoft System Center Virtual Machine Manager Administrator Console (x64)"}).Version - - switch($Version) - { - "3.2.7510.0" - { - $ProductCode = "{CDFB453F-5FA4-4884-B282-F46BDFC06051}" - $PatchID = "{E424A006-23B8-4403-A413-9EEBFB422FB2}" - $Update = "Update Rollup 4" - } - "3.2.9013.0" - { - $returnValue = @{ - Ensure = "Present" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - Update = "None" - } - } - $null - { - $returnValue = @{ - Ensure = "Absent" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - } - } - Default - { - throw "Unknown version of Virtual Machine Manager!" - } - } - - if($ProductCode -and $PatchID -and (Get-WmiObject -Class Win32_PatchPackage | Where-Object {($_.ProductCode -eq $ProductCode) -and ($_.PatchID -eq $PatchID)})) - { - $returnValue = @{ - Ensure = "Present" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - Update = $Update - } - } - else - { - $returnValue = @{ - Ensure = "Absent" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\VirtualMachineManager\Updates", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - $Version = (Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -eq "Microsoft System Center Virtual Machine Manager Administrator Console (x64)"}).Version - - switch($Version) - { - "3.2.7510.0" - { - $UpdateFile = "kb2992023_AdminConsole_amd64.msp" - } - "3.2.9013.0" - { - Write-Verbose "No update for this version of Virtual Machine Manager!" - } - $null - { - Write-Verbose "Virtual Machine Manager Console not installed!" - } - Default - { - throw "Unknown version of Virtual Machine Manager!" - } - } - - if($UpdateFile) - { - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - $Path = "msiexec.exe" - $Path = ResolvePath $Path - Write-Verbose "Path: $Path" - - $MSPPath = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath $UpdateFile - $MSPPath = ResolvePath $MSPPath - $Arguments = "/update $MSPPath /norestart" - Write-Verbose "Arguments: $Arguments" - - $Process = StartWin32Process -Path $Path -Arguments $Arguments -Credential $SetupCredential - Write-Verbose $Process - WaitForWin32ProcessEnd -Path $Path -Arguments $Arguments -Credential $SetupCredential - } - - if((Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Name 'PendingFileRenameOperations' -ErrorAction SilentlyContinue) -ne $null) - { - $global:DSCMachineStatus = 1 - } - else - { - if(!(Test-TargetResource @PSBoundParameters)) - { - throw "Set-TargetResouce failed" - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\VirtualMachineManager\Updates", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - $result = ((Get-TargetResource @PSBoundParameters).Ensure -eq $Ensure) - - $result -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMConsoleUpdate/MSFT_xSCVMMConsoleUpdate.schema.mof b/lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMConsoleUpdate/MSFT_xSCVMMConsoleUpdate.schema.mof deleted file mode 100644 index 60d67688..00000000 --- a/lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMConsoleUpdate/MSFT_xSCVMMConsoleUpdate.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSCVMMConsoleUpdate")] -class MSFT_xSCVMMConsoleUpdate : OMI_BaseResource -{ - [Key, Description("An enumerated value that describes if the update is expected to be installed on the machine.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Required, Description("UNC path to the root of the source files for installation.")] String SourcePath; - [Write, Description("Folder within the source path containing the source files for installation.")] String SourceFolder; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the installation.")] String SetupCredential; - [Read, Description("Display name of the update.")] String Update; -}; diff --git a/lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMManagementServerSetup/MSFT_xSCVMMManagementServerSetup.psm1 b/lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMManagementServerSetup/MSFT_xSCVMMManagementServerSetup.psm1 deleted file mode 100644 index 12bc6274..00000000 --- a/lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMManagementServerSetup/MSFT_xSCVMMManagementServerSetup.psm1 +++ /dev/null @@ -1,628 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\VirtualMachineManager", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.Management.Automation.PSCredential] - $vmmService, - - [System.String] - $ProductKey, - - [System.String] - $UserName, - - [System.String] - $CompanyName, - - [System.String] - $ProgramFiles, - - [System.Boolean] - $ClusterManagementServer, - - [System.Boolean] - $FirstManagementServer, - - [System.String] - $CreateNewSqlDatabase = "1", - - [parameter(Mandatory = $true)] - [System.String] - $SqlMachineName, - - [parameter(Mandatory = $true)] - [System.String] - $SqlInstanceName, - - [System.String] - $SqlDatabaseName = "VirtualManagerDB", - - [System.UInt16] - $IndigoTcpPort = 8100, - - [System.UInt16] - $IndigoHTTPSPort = 8101, - - [System.UInt16] - $IndigoNETTCPPort = 8102, - - [System.UInt16] - $IndigoHTTPPort = 8103, - - [System.UInt16] - $WSManTcpPort = 5985, - - [System.UInt16] - $BitsTcpPort = 443, - - [System.String] - $CreateNewLibraryShare = "1", - - [System.String] - $LibraryShareName = "MSSCVMMLibrary", - - [System.String] - $LibrarySharePath = "%ProgramData%\Virtual Machine Manager Library Files", - - [System.String] - $LibraryShareDescription = "Virtual Machine Manager Library Files", - - [System.String] - $TopContainerName, - - [System.String] - $VmmServerName, - - [System.String] - $VMMStaticIPAddress, - - [System.Byte] - $RetainSqlDatabase, - - [System.Byte] - $ForceHAVMMUninstall, - - [System.Byte] - $SQMOptIn, - - [System.Byte] - $MUOptIn - ) - - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "setup.exe" - $Path = ResolvePath $Path - $Version = (Get-Item -Path $Path).VersionInfo.ProductVersion - - switch($Version) - { - "3.2.7510.0" - { - $IdentifyingNumber = "{59518B15-FC64-4CF9-A4D1-0EE1B4A63088}" - } - "3.2.9013.0" - { - $IdentifyingNumber = "{59518B15-FC64-4CF9-A4D1-0EE1B4A63088}" - } - Default - { - throw "Unknown version of Virtual Machine Manager!" - } - } - - if(Get-WmiObject -Class Win32_Product | Where-Object {$_.IdentifyingNumber -eq $IdentifyingNumber}) - { - $vmmServiceUsername = (Get-WmiObject -Class Win32_Service | Where-Object {$_.Name -eq "SCVMMService"}).StartName - $UserName = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft System Center Virtual Machine Manager Server\Setup\Registration" -Name "UserName").UserName - $CompanyName = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft System Center Virtual Machine Manager Server\Setup\Registration" -Name "CompanyName").CompanyName - $ProgramFiles = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft System Center Virtual Machine Manager Server\Setup" -Name "InstallPath").InstallPath - $SqlMachineName = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft System Center Virtual Machine Manager Server\Settings\SQL" -Name "MachineFQDN").MachineFQDN - $SqlInstanceName = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft System Center Virtual Machine Manager Server\Settings\SQL" -Name "MachineFQDN").MachineFQDN - if($SqlInstanceName -eq $SqlMachineName) - { - $SqlInstanceName = "MSSQLSERVER" - } - $SqlDatabaseName = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft System Center Virtual Machine Manager Server\Settings\SQL" -Name "DatabaseName").DatabaseName - foreach($Port in @("IndigoTcpPort","IndigoHTTPSPort","IndigoNETTCPPort","IndigoHTTPPort","WSManTcpPort","BitsTcpPort")) - { - Set-Variable -Name $Port -Value (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft System Center Virtual Machine Manager Server\Settings" -Name $Port).$Port - } - $LibraryShareName = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft System Center Virtual Machine Manager Server\Settings\Library" -Name "LibraryShareName").LibraryShareName - $LibrarySharePath = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft System Center Virtual Machine Manager Server\Settings\Library" -Name "LibrarySharePath").LibrarySharePath - - $returnValue = @{ - Ensure = "Present" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - vmmServiceUsername = $vmmServiceUsername - UserName = $UserName - CompanyName = $CompanyName - ProgramFiles = $ProgramFiles - # ClusterManagementServer = [System.Boolean] - SqlMachineName = $SqlMachineName - SqlInstanceName = $SqlInstanceName - SqlDatabaseName = $SqlDatabaseName - IndigoTcpPort = $IndigoTcpPort - IndigoHTTPSPort = $IndigoHTTPSPort - IndigoNETTCPPort = $IndigoNETTCPPort - IndigoHTTPPort = $IndigoHTTPPort - WSManTcpPort = $WSManTcpPort - BitsTcpPort = $BitsTcpPort - LibraryShareName = $LibraryShareName - LibrarySharePath = $LibrarySharePath - # TopContainerName = [System.String] - # VmmServerName = [System.String] - # VMMStaticIPAddress = [System.String] - } - } - else - { - $returnValue = @{ - Ensure = "Absent" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\VirtualMachineManager", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.Management.Automation.PSCredential] - $vmmService, - - [System.String] - $ProductKey, - - [System.String] - $UserName, - - [System.String] - $CompanyName, - - [System.String] - $ProgramFiles, - - [System.Boolean] - $ClusterManagementServer, - - [System.Boolean] - $FirstManagementServer, - - [System.String] - $CreateNewSqlDatabase = "1", - - [parameter(Mandatory = $true)] - [System.String] - $SqlMachineName, - - [parameter(Mandatory = $true)] - [System.String] - $SqlInstanceName, - - [System.String] - $SqlDatabaseName = "VirtualManagerDB", - - [System.UInt16] - $IndigoTcpPort = 8100, - - [System.UInt16] - $IndigoHTTPSPort = 8101, - - [System.UInt16] - $IndigoNETTCPPort = 8102, - - [System.UInt16] - $IndigoHTTPPort = 8103, - - [System.UInt16] - $WSManTcpPort = 5985, - - [System.UInt16] - $BitsTcpPort = 443, - - [System.String] - $CreateNewLibraryShare = "1", - - [System.String] - $LibraryShareName = "MSSCVMMLibrary", - - [System.String] - $LibrarySharePath = "%ProgramData%\Virtual Machine Manager Library Files", - - [System.String] - $LibraryShareDescription = "Virtual Machine Manager Library Files", - - [System.String] - $TopContainerName, - - [System.String] - $VmmServerName, - - [System.String] - $VMMStaticIPAddress, - - [System.Byte] - $RetainSqlDatabase, - - [System.Byte] - $ForceHAVMMUninstall, - - [System.Byte] - $SQMOptIn, - - [System.Byte] - $MUOptIn - ) - - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "setup.exe" - $Path = ResolvePath $Path - $Version = (Get-Item -Path $Path).VersionInfo.ProductVersion - - switch($Version) - { - "3.2.7510.0" - { - $IdentifyingNumber = "{59518B15-FC64-4CF9-A4D1-0EE1B4A63088}" - } - "3.2.9013.0" - { - $IdentifyingNumber = "{59518B15-FC64-4CF9-A4D1-0EE1B4A63088}" - } - Default - { - throw "Unknown version of Virtual Machine Manager!" - } - } - - # Create INI file - $TempFile = [IO.Path]::GetTempFileName() - $INIFile = @() - $INIFile += "[Options]" - $INIFile += "RemoteDatabaseImpersonation=0" - - switch($Ensure) - { - "Present" - { - # Set defaults, if they couldn't be set in param due to null configdata input - if ($IndigoTcpPort -eq 0) - { - $IndigoTcpPort = 8100 - } - if ($IndigoHTTPSPort -eq 0) - { - $IndigoHTTPSPort = 8101 - } - if ($IndigoNETTCPPort -eq 0) - { - $IndigoNETTCPPort = 8102 - } - if ($IndigoHTTPPort -eq 0) - { - $IndigoHTTPPort = 8103 - } - if ($WSManTcpPort -eq 0) - { - $WSManTcpPort = 5985 - } - if ($BitsTcpPort -eq 0) - { - $BitsTcpPort = 443 - } - if ($SQMOptIn -ne 1) - { - $SQMOptIn = 0 - } - if ($MUOptIn -ne 1) - { - $MUOptIn = 0 - } - - $INIFileVars = @( - "ProductKey", - "UserName", - "CompanyName", - "ProgramFiles", - "SQLInstanceName", - "SQLDatabaseName", - "SQLMachineName", - "IndigoTcpPort", - "IndigoHTTPSPort", - "IndigoNETTCPPort", - "IndigoHTTPPort", - "WSManTcpPort", - "BitsTcpPort", - "SQMOptIn", - "MUOptIn", - "TopContainerName" - ) - if($ClusterManagementServer -and !$FirstManagementServer) - { - $INIFile += "CreateNewSQLDatabase=0" - } - else - { - $INIFileVars += @( - "CreateNewSQLDatabase" - ) - } - if($PSBoundParameters.ContainsKey("vmmService")) - { - $INIFile += "VMMServiceLocalAccount=0" - } - else - { - $INIFile += "VMMServiceLocalAccount=1" - } - if($ClusterManagementServer) - { - $INIFileVars += @( - "VmmServerName", - "VmmStaticIPAddress" - ) - $INIFile += "HighlyAvailable=1" - if($FirstManagementServer) - { - $INIFile += "HighlyAvailable2ndNode=0" - } - else - { - $INIFile += "HighlyAvailable2ndNode=1" - } - } - else - { - $INIFileVars += @( - "CreateNewLibraryShare", - "LibraryShareName", - "LibrarySharePath", - "LibraryShareDescription" - ) - } - - # Create install arguments - $Arguments = "/i /IAcceptSCEULA /server /f $TempFile" - if($PSBoundParameters.ContainsKey("vmmService")) - { - $Arguments += " /vmmServiceDomain " + $vmmService.GetNetworkCredential().Domain - $Arguments += " /vmmServiceUserName " + $vmmService.GetNetworkCredential().UserName - $Arguments += " /vmmServiceUserPassword " + $vmmService.GetNetworkCredential().Password - } - } - "Absent" - { - # Set defaults, if they couldn't be set in param due to null configdata input - if ($RetainSqlDatabase -ne 1) - { - $RetainSqlDatabase = 0 - } - if ($ForceHAVMMUninstall -ne 1) - { - $ForceHAVMMUninstall = 0 - } - - # Create uninstall arguments - $INIFileVars = @( - "RetainSqlDatabase", - "ForceHAVMMUninstall" - ) - - # Create install arguments - $Arguments = "/x /server /f $TempFile" - } - } - - foreach($INIFileVar in $INIFileVars) - { - if(!([String]::IsNullOrEmpty((Get-Variable -Name $INIFileVar).Value))) - { - $INIFile += "$INIFileVar=" + [Environment]::ExpandEnvironmentVariables((Get-Variable -Name $INIFileVar).Value) - } - } - - Write-Verbose "Path: $Path" - Write-Verbose "INIFile: $TempFile" - foreach($Line in $INIFile) - { - Add-Content -Path $TempFile -Value $Line -Encoding Ascii - # Replace sensitive values for verbose output - $LineLog = $Line - if($PSBoundParameters.ContainsKey("ProductKey")) - { - $LineLog = $LineLog.Replace($ProductKey,"*****-*****-*****-*****-*****") - } - Write-Verbose $LineLog - } - - # Replace sensitive values for verbose output - $Log = $Arguments - if($PSBoundParameters.ContainsKey("vmmService")) - { - $Log = $Log.Replace($vmmService.GetNetworkCredential().Password,"********") - } - - Write-Verbose "Arguments: $Log" - - $Process = StartWin32Process -Path $Path -Arguments $Arguments -Credential $SetupCredential -AsTask - Write-Verbose $Process - WaitForWin32ProcessEnd -Path $Path -Arguments $Arguments -Credential $SetupCredential - - # Clean up - if(Test-Path -Path $TempFile) - { - Remove-Item -Path $TempFile - } - - if((Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Name 'PendingFileRenameOperations' -ErrorAction SilentlyContinue) -ne $null) - { - $global:DSCMachineStatus = 1 - } - else - { - if(!(Test-TargetResource @PSBoundParameters)) - { - throw "Set-TargetResouce failed" - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\VirtualMachineManager", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.Management.Automation.PSCredential] - $vmmService, - - [System.String] - $ProductKey, - - [System.String] - $UserName, - - [System.String] - $CompanyName, - - [System.String] - $ProgramFiles, - - [System.Boolean] - $ClusterManagementServer, - - [System.Boolean] - $FirstManagementServer, - - [System.String] - $CreateNewSqlDatabase = "1", - - [parameter(Mandatory = $true)] - [System.String] - $SqlMachineName, - - [parameter(Mandatory = $true)] - [System.String] - $SqlInstanceName, - - [System.String] - $SqlDatabaseName = "VirtualManagerDB", - - [System.UInt16] - $IndigoTcpPort = 8100, - - [System.UInt16] - $IndigoHTTPSPort = 8101, - - [System.UInt16] - $IndigoNETTCPPort = 8102, - - [System.UInt16] - $IndigoHTTPPort = 8103, - - [System.UInt16] - $WSManTcpPort = 5985, - - [System.UInt16] - $BitsTcpPort = 443, - - [System.String] - $CreateNewLibraryShare = "1", - - [System.String] - $LibraryShareName = "MSSCVMMLibrary", - - [System.String] - $LibrarySharePath = "%ProgramData%\Virtual Machine Manager Library Files", - - [System.String] - $LibraryShareDescription = "Virtual Machine Manager Library Files", - - [System.String] - $TopContainerName, - - [System.String] - $VmmServerName, - - [System.String] - $VMMStaticIPAddress, - - [System.Byte] - $RetainSqlDatabase, - - [System.Byte] - $ForceHAVMMUninstall, - - [System.Byte] - $SQMOptIn, - - [System.Byte] - $MUOptIn - ) - - $result = ((Get-TargetResource @PSBoundParameters).Ensure -eq $Ensure) - - $result -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMManagementServerSetup/MSFT_xSCVMMManagementServerSetup.schema.mof b/lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMManagementServerSetup/MSFT_xSCVMMManagementServerSetup.schema.mof deleted file mode 100644 index bf0dc71a..00000000 --- a/lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMManagementServerSetup/MSFT_xSCVMMManagementServerSetup.schema.mof +++ /dev/null @@ -1,37 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSCVMMManagementServerSetup")] -class MSFT_xSCVMMManagementServerSetup : OMI_BaseResource -{ - [Key, Description("An enumerated value that describes if the DPM server is expected to be installed on the machine.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Required, Description("UNC path to the root of the source files for installation.")] String SourcePath; - [Write, Description("Folder within the source path containing the source files for installation.")] String SourceFolder; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the installation.")] String SetupCredential; - [Write, EmbeddedInstance("MSFT_Credential"), Description("Domain account for the VMM service.")] String vmmService; - [Read, Description("Output username of the VMM service.")] String vmmServiceUsername; - [Write, Description("Product key for licensed installations.")] String ProductKey; - [Write, Description("Display name for the user.")] String UserName; - [Write, Description("Display name for the organization.")] String CompanyName; - [Write, Description("Installation path for the software.")] String ProgramFiles; - [Write, Description("Is this a clustered Management Server?")] Boolean ClusterManagementServer; - [Write, Description("Is this the first Management Server?")] Boolean FirstManagementServer; - [Write, Description("0: Use an existing Microsoft SQL Server database. 1: Create a new SQL Server database.")] String CreateNewSqlDatabase; - [Required, Description("Name of the server that is hosting SQL Server.")] String SqlMachineName; - [Required, Description("Name of the new or existing instance of SQL Server.")] String SqlInstanceName; - [Write, Description("Name of the new or existing SQL Server database.")] String SqlDatabaseName; - [Write, Description("Port for communication with the VMM console.")] UInt16 IndigoTcpPort; - [Write, Description("Port for communication with the Windows Preinstallation Environment agents.")] UInt16 IndigoHTTPSPort; - [Write, Description("Port for communication with Windows Deployment Services.")] UInt16 IndigoNETTCPPort; - [Write, Description("Port for communication with Windows PE agent for time synchronization.")] UInt16 IndigoHTTPPort; - [Write, Description("Port for communication with agents on hosts and library servers.")] UInt16 WSManTcpPort; - [Write, Description("Port for file transfers to agents on hosts and library servers.")] UInt16 BitsTcpPort; - [Write, Description("0: Use an existing library share. 1: Create a new library share.")] String CreateNewLibraryShare; - [Write, Description("Name of the file share to be used or created.")] String LibraryShareName; - [Write, Description("Location of the existing file share or the new file share to be created.")] String LibrarySharePath; - [Write, Description("Description of the share.")] String LibraryShareDescription; - [Write, Description("Container for Distributed Key Management.")] String TopContainerName; - [Write, Description("Clustered service name for a highly available VMM management server.")] String VmmServerName; - [Write, Description("IP address for the clustered service name for a highly available VMM management server, if you are not using Dynamic Host Configuration Protocol (DHCP).")] String VMMStaticIPAddress; - [Write, Description("0: Remove the SQL Server database. 1: Do not remove the SQL Server database.")] UInt8 RetainSqlDatabase; - [Write, Description("0: Do not force uninstallation if setup.exe cannot verify whether this node is the final node of the highly available installation. 1: Force the uninstallation.")] UInt8 ForceHAVMMUninstall; - [Write, Description("0: Do not opt in to the Customer Experience Improvement Program (CEIP). 1: Opt in to CEIP.")] UInt8 SQMOptIn; - [Write, Description("0: Do not opt in to Microsoft Update. 1: Opt in to Microsoft Update.")] UInt8 MUOptIn; -}; diff --git a/lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMManagementServerUpdate/MSFT_xSCVMMManagementServerUpdate.psm1 b/lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMManagementServerUpdate/MSFT_xSCVMMManagementServerUpdate.psm1 deleted file mode 100644 index 8db99f6d..00000000 --- a/lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMManagementServerUpdate/MSFT_xSCVMMManagementServerUpdate.psm1 +++ /dev/null @@ -1,183 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\VirtualMachineManager\Updates", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - $Version = (Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -eq "Microsoft System Center Virtual Machine Manager Server (x64)"}).Version - - switch($Version) - { - "3.2.7510.0" - { - $ProductCode = "{59518B15-FC64-4CF9-A4D1-0EE1B4A63088}" - $PatchID = "{59E2363E-A466-4F40-8026-1342C1E26402}" - $Update = "Update Rollup 4" - } - "3.2.9013.0" - { - $returnValue = @{ - Ensure = "Present" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - Update = "None" - } - } - $null - { - $returnValue = @{ - Ensure = "Absent" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - } - } - Default - { - throw "Unknown version of Virtual Machine Manager!" - } - } - - if($ProductCode -and $PatchID -and (Get-WmiObject -Class Win32_PatchPackage | Where-Object {($_.ProductCode -eq $ProductCode) -and ($_.PatchID -eq $PatchID)})) - { - $returnValue = @{ - Ensure = "Present" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - Update = $Update - } - } - else - { - $returnValue = @{ - Ensure = "Absent" - SourcePath = $SourcePath - SourceFolder = $SourceFolder - } - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\VirtualMachineManager\Updates", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - $Version = (Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -eq "Microsoft System Center Virtual Machine Manager Server (x64)"}).Version - - switch($Version) - { - "3.2.7510.0" - { - $UpdateFile = "kb2992024_vmmserver_amd64.msp" - } - "3.2.9013.0" - { - Write-Verbose "No update for this version of Virtual Machine Manager!" - } - $null - { - Write-Verbose "Virtual Machine Manager not installed!" - } - Default - { - throw "Unknown version of Virtual Machine Manager!" - } - } - - if($UpdateFile) - { - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - $Path = "msiexec.exe" - $Path = ResolvePath $Path - Write-Verbose "Path: $Path" - - $MSPPath = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath $UpdateFile - $MSPPath = ResolvePath $MSPPath - $Arguments = "/update $MSPPath /norestart" - Write-Verbose "Arguments: $Arguments" - - $Process = StartWin32Process -Path $Path -Arguments $Arguments -Credential $SetupCredential - Write-Verbose $Process - WaitForWin32ProcessEnd -Path $Path -Arguments $Arguments -Credential $SetupCredential - } - - if((Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Name 'PendingFileRenameOperations' -ErrorAction SilentlyContinue) -ne $null) - { - $global:DSCMachineStatus = 1 - } - else - { - if(!(Test-TargetResource @PSBoundParameters)) - { - throw "Set-TargetResouce failed" - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present", - - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [System.String] - $SourceFolder = "\SystemCenter2012R2\VirtualMachineManager\Updates", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - $result = ((Get-TargetResource @PSBoundParameters).Ensure -eq $Ensure) - - $result -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMManagementServerUpdate/MSFT_xSCVMMManagementServerUpdate.schema.mof b/lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMManagementServerUpdate/MSFT_xSCVMMManagementServerUpdate.schema.mof deleted file mode 100644 index 28ff3d13..00000000 --- a/lib/puppet_x/dsc_resources/xSCVMM/DSCResources/MSFT_xSCVMMManagementServerUpdate/MSFT_xSCVMMManagementServerUpdate.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSCVMMManagementServerUpdate")] -class MSFT_xSCVMMManagementServerUpdate : OMI_BaseResource -{ - [Key, Description("An enumerated value that describes if the update is expected to be installed on the machine.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Required, Description("UNC path to the root of the source files for installation.")] String SourcePath; - [Write, Description("Folder within the source path containing the source files for installation.")] String SourceFolder; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the installation.")] String SetupCredential; - [Read, Description("Display name of the update.")] String Update; -}; diff --git a/lib/puppet_x/dsc_resources/xSCVMM/LICENSE b/lib/puppet_x/dsc_resources/xSCVMM/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xSCVMM/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xSCVMM/en-US/xPDT.strings.psd1 b/lib/puppet_x/dsc_resources/xSCVMM/en-US/xPDT.strings.psd1 deleted file mode 100644 index 11f213c1..00000000 --- a/lib/puppet_x/dsc_resources/xSCVMM/en-US/xPDT.strings.psd1 +++ /dev/null @@ -1,10 +0,0 @@ -ConvertFrom-StringData @' -FileNotFound=File not found in the environment path -AbsolutePathOrFileName=Absolute path or file name expected -InvalidArgument=Invalid argument: '{0}' with value: '{1}' -InvalidArgumentAndMessage={0} {1} -ErrorStarting=Failure starting process matching path '{0}'. Message: {1} -FailureWaitingForProcessesToStart=Failed to wait for processes to start -ProcessStarted=Process matching path '{0}' started in process ID {1} -ProcessAlreadyStarted=Process matching path '{0}' already started in process ID {1} -'@ diff --git a/lib/puppet_x/dsc_resources/xSCVMM/xPDT.psm1 b/lib/puppet_x/dsc_resources/xSCVMM/xPDT.psm1 deleted file mode 100644 index c90beaa1..00000000 --- a/lib/puppet_x/dsc_resources/xSCVMM/xPDT.psm1 +++ /dev/null @@ -1,708 +0,0 @@ -data LocalizedData -{ - ConvertFrom-StringData @' - -FileNotFound=File not found in the environment path -AbsolutePathOrFileName=Absolute path or file name expected -InvalidArgument=Invalid argument: '{0}' with value: '{1}' -InvalidArgumentAndMessage={0} {1} -ErrorStarting=Failure starting process matching path '{0}'. Message: {1} -FailureWaitingForProcessesToStart=Failed to wait for processes to start -ProcessStarted=Process matching path '{0}' started in process ID {1} -ProcessAlreadyStarted=Process matching path '{0}' already started in process ID {1} -'@ -} - -Import-LocalizedData LocalizedData -filename xPDT.strings.psd1 - -function ThrowInvalidArgumentError -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $errorId, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $errorMessage - ) - - $errorCategory=[System.Management.Automation.ErrorCategory]::InvalidArgument - $exception = New-Object System.ArgumentException $errorMessage; - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - throw $errorRecord -} - -function ResolvePath -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Path - ) - - $Path = [Environment]::ExpandEnvironmentVariables($Path) - if(IsRootedPath $Path) - { - if(!(Test-Path $Path -PathType Leaf)) - { - ThrowInvalidArgumentError "CannotFindRootedPath" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.FileNotFound) - } - return $Path - } - if([string]::IsNullOrEmpty($env:Path)) - { - ThrowInvalidArgumentError "EmptyEnvironmentPath" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.FileNotFound) - } - if((Split-Path $Path -Leaf) -ne $Path) - { - ThrowInvalidArgumentError "NotAbsolutePathOrFileName" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.AbsolutePathOrFileName) - } - foreach($rawSegment in $env:Path.Split(";")) - { - $segment = [Environment]::ExpandEnvironmentVariables($rawSegment) - $segmentRooted = $false - try - { - $segmentRooted=[IO.Path]::IsPathRooted($segment) - } - catch {} - if(!$segmentRooted) - { - continue - } - $candidate = join-path $segment $Path - if(Test-Path $candidate -PathType Leaf) - { - return $candidate - } - } - ThrowInvalidArgumentError "CannotFindRelativePath" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.FileNotFound) -} - -function IsRootedPath -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path - ) - - try - { - return [IO.Path]::IsPathRooted($Path) - } - catch - { - ThrowInvalidArgumentError "CannotGetIsPathRooted" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $_.Exception.Message) - } -} - -function ExtractArguments -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - $functionBoundParameters, - - [parameter(Mandatory = $true)] - [string[]] - $argumentNames, - - [string[]] - $newArgumentNames - ) - - $returnValue=@{} - - for($i=0;$i -lt $argumentNames.Count;$i++) - { - $argumentName = $argumentNames[$i] - - if($newArgumentNames -eq $null) - { - $newArgumentName = $argumentName - } - else - { - $newArgumentName = $newArgumentNames[$i] - } - - if($functionBoundParameters.ContainsKey($argumentName)) - { - $null = $returnValue.Add($newArgumentName,$functionBoundParameters[$argumentName]) - } - } - - return $returnValue -} - -function CallPInvoke -{ - $script:ProgramSource = @" -using System; -using System.Collections.Generic; -using System.Text; -using System.Security; -using System.Runtime.InteropServices; -using System.Diagnostics; -using System.Security.Principal; -using System.ComponentModel; -using System.IO; - -namespace Source -{ - [SuppressUnmanagedCodeSecurity] - public static class NativeMethods - { - //The following structs and enums are used by the various Win32 API's that are used in the code below - - [StructLayout(LayoutKind.Sequential)] - public struct STARTUPINFO - { - public Int32 cb; - public string lpReserved; - public string lpDesktop; - public string lpTitle; - public Int32 dwX; - public Int32 dwY; - public Int32 dwXSize; - public Int32 dwXCountChars; - public Int32 dwYCountChars; - public Int32 dwFillAttribute; - public Int32 dwFlags; - public Int16 wShowWindow; - public Int16 cbReserved2; - public IntPtr lpReserved2; - public IntPtr hStdInput; - public IntPtr hStdOutput; - public IntPtr hStdError; - } - - [StructLayout(LayoutKind.Sequential)] - public struct PROCESS_INFORMATION - { - public IntPtr hProcess; - public IntPtr hThread; - public Int32 dwProcessID; - public Int32 dwThreadID; - } - - [Flags] - public enum LogonType - { - LOGON32_LOGON_INTERACTIVE = 2, - LOGON32_LOGON_NETWORK = 3, - LOGON32_LOGON_BATCH = 4, - LOGON32_LOGON_SERVICE = 5, - LOGON32_LOGON_UNLOCK = 7, - LOGON32_LOGON_NETWORK_CLEARTEXT = 8, - LOGON32_LOGON_NEW_CREDENTIALS = 9 - } - - [Flags] - public enum LogonProvider - { - LOGON32_PROVIDER_DEFAULT = 0, - LOGON32_PROVIDER_WINNT35, - LOGON32_PROVIDER_WINNT40, - LOGON32_PROVIDER_WINNT50 - } - [StructLayout(LayoutKind.Sequential)] - public struct SECURITY_ATTRIBUTES - { - public Int32 Length; - public IntPtr lpSecurityDescriptor; - public bool bInheritHandle; - } - - public enum SECURITY_IMPERSONATION_LEVEL - { - SecurityAnonymous, - SecurityIdentification, - SecurityImpersonation, - SecurityDelegation - } - - public enum TOKEN_TYPE - { - TokenPrimary = 1, - TokenImpersonation - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - internal struct TokPriv1Luid - { - public int Count; - public long Luid; - public int Attr; - } - - public const int GENERIC_ALL_ACCESS = 0x10000000; - public const int CREATE_NO_WINDOW = 0x08000000; - internal const int SE_PRIVILEGE_ENABLED = 0x00000002; - internal const int TOKEN_QUERY = 0x00000008; - internal const int TOKEN_ADJUST_PRIVILEGES = 0x00000020; - internal const string SE_INCRASE_QUOTA = "SeIncreaseQuotaPrivilege"; - - [DllImport("kernel32.dll", - EntryPoint = "CloseHandle", SetLastError = true, - CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] - public static extern bool CloseHandle(IntPtr handle); - - [DllImport("advapi32.dll", - EntryPoint = "CreateProcessAsUser", SetLastError = true, - CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] - public static extern bool CreateProcessAsUser( - IntPtr hToken, - string lpApplicationName, - string lpCommandLine, - ref SECURITY_ATTRIBUTES lpProcessAttributes, - ref SECURITY_ATTRIBUTES lpThreadAttributes, - bool bInheritHandle, - Int32 dwCreationFlags, - IntPtr lpEnvrionment, - string lpCurrentDirectory, - ref STARTUPINFO lpStartupInfo, - ref PROCESS_INFORMATION lpProcessInformation - ); - - [DllImport("advapi32.dll", EntryPoint = "DuplicateTokenEx")] - public static extern bool DuplicateTokenEx( - IntPtr hExistingToken, - Int32 dwDesiredAccess, - ref SECURITY_ATTRIBUTES lpThreadAttributes, - Int32 ImpersonationLevel, - Int32 dwTokenType, - ref IntPtr phNewToken - ); - - [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] - public static extern Boolean LogonUser( - String lpszUserName, - String lpszDomain, - String lpszPassword, - LogonType dwLogonType, - LogonProvider dwLogonProvider, - out IntPtr phToken - ); - - [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)] - internal static extern bool AdjustTokenPrivileges( - IntPtr htok, - bool disall, - ref TokPriv1Luid newst, - int len, - IntPtr prev, - IntPtr relen - ); - - [DllImport("kernel32.dll", ExactSpelling = true)] - internal static extern IntPtr GetCurrentProcess(); - - [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)] - internal static extern bool OpenProcessToken( - IntPtr h, - int acc, - ref IntPtr phtok - ); - - [DllImport("advapi32.dll", SetLastError = true)] - internal static extern bool LookupPrivilegeValue( - string host, - string name, - ref long pluid - ); - - public static void CreateProcessAsUser(string strCommand, string strDomain, string strName, string strPassword) - { - var hToken = IntPtr.Zero; - var hDupedToken = IntPtr.Zero; - TokPriv1Luid tp; - var pi = new PROCESS_INFORMATION(); - var sa = new SECURITY_ATTRIBUTES(); - sa.Length = Marshal.SizeOf(sa); - Boolean bResult = false; - try - { - bResult = LogonUser( - strName, - strDomain, - strPassword, - LogonType.LOGON32_LOGON_BATCH, - LogonProvider.LOGON32_PROVIDER_DEFAULT, - out hToken - ); - if (!bResult) - { - throw new Win32Exception("The user could not be logged on. Ensure that the user has an existing profile on the machine and that correct credentials are provided. Logon error #" + Marshal.GetLastWin32Error().ToString()); - } - IntPtr hproc = GetCurrentProcess(); - IntPtr htok = IntPtr.Zero; - bResult = OpenProcessToken( - hproc, - TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, - ref htok - ); - if(!bResult) - { - throw new Win32Exception("Open process token error #" + Marshal.GetLastWin32Error().ToString()); - } - tp.Count = 1; - tp.Luid = 0; - tp.Attr = SE_PRIVILEGE_ENABLED; - bResult = LookupPrivilegeValue( - null, - SE_INCRASE_QUOTA, - ref tp.Luid - ); - if(!bResult) - { - throw new Win32Exception("Error in looking up privilege of the process. This should not happen if DSC is running as LocalSystem Lookup privilege error #" + Marshal.GetLastWin32Error().ToString()); - } - bResult = AdjustTokenPrivileges( - htok, - false, - ref tp, - 0, - IntPtr.Zero, - IntPtr.Zero - ); - if(!bResult) - { - throw new Win32Exception("Token elevation error #" + Marshal.GetLastWin32Error().ToString()); - } - - bResult = DuplicateTokenEx( - hToken, - GENERIC_ALL_ACCESS, - ref sa, - (int)SECURITY_IMPERSONATION_LEVEL.SecurityIdentification, - (int)TOKEN_TYPE.TokenPrimary, - ref hDupedToken - ); - if(!bResult) - { - throw new Win32Exception("Duplicate Token error #" + Marshal.GetLastWin32Error().ToString()); - } - var si = new STARTUPINFO(); - si.cb = Marshal.SizeOf(si); - si.lpDesktop = ""; - bResult = CreateProcessAsUser( - hDupedToken, - null, - strCommand, - ref sa, - ref sa, - false, - 0, - IntPtr.Zero, - null, - ref si, - ref pi - ); - if(!bResult) - { - throw new Win32Exception("The process could not be created. Create process as user error #" + Marshal.GetLastWin32Error().ToString()); - } - } - finally - { - if (pi.hThread != IntPtr.Zero) - { - CloseHandle(pi.hThread); - } - if (pi.hProcess != IntPtr.Zero) - { - CloseHandle(pi.hProcess); - } - if (hDupedToken != IntPtr.Zero) - { - CloseHandle(hDupedToken); - } - } - } - } -} - -"@ - Add-Type -TypeDefinition $ProgramSource -ReferencedAssemblies "System.ServiceProcess" -} - -function GetWin32Process -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [PSCredential] - $Credential - ) - - $fileName = [io.path]::GetFileNameWithoutExtension($Path) - $GetProcesses = @(Get-Process -Name $fileName -ErrorAction SilentlyContinue) - $Processes = foreach($process in $GetProcesses) - { - if($Process.Path -ieq $Path) - { - try - { - [wmi]"Win32_Process.Handle='$($Process.Id)'" - } - catch - { - } - } - } - if($PSBoundParameters.ContainsKey('Credential')) - { - $Processes = $Processes | Where-Object {(GetWin32ProcessOwner $_) -eq $Credential.UserName} - } - if($Arguments -eq $null) {$Arguments = ""} - $Processes = $Processes | Where-Object {(GetWin32ProcessArgumentsFromCommandLine $_.CommandLine) -eq $Arguments} - - return $Processes -} - -function GetWin32ProcessOwner -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNull()] - $Process - ) - - try - { - $Owner = $Process.GetOwner() - } - catch - {} - if($owner.Domain -ne $null) - { - return $Owner.Domain + "\" + $Owner.User - } - else - { - return $Owner.User - } -} - -function GetWin32ProcessArgumentsFromCommandLine -{ - param - ( - [String] - $commandLine - ) - - if($commandLine -eq $null) - { - return "" - } - $commandLine=$commandLine.Trim() - if($commandLine.Length -eq 0) - { - return "" - } - if($commandLine[0] -eq '"') - { - $charToLookfor=[char]'"' - } - else - { - $charToLookfor=[char]' ' - } - $endOfCommand=$commandLine.IndexOf($charToLookfor ,1) - if($endOfCommand -eq -1) - { - return "" - } - return $commandLine.Substring($endOfCommand+1).Trim() -} - -function StartWin32Process -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [PSCredential] - $Credential, - - [Switch] - $AsTask - ) - - $GetArguments = ExtractArguments $PSBoundParameters ("Path","Arguments","Credential") - $Processes = @(GetWin32Process @getArguments) - if ($processes.Count -eq 0) - { - if($PSBoundParameters.ContainsKey("Credential")) - { - if($AsTask) - { - $ActionArguments = ExtractArguments $PSBoundParameters ` - ("Path", "Arguments") ` - ("Execute", "Argument") - if([string]::IsNullOrEmpty($Arguments)) - { - $null = $ActionArguments.Remove("Argument") - } - $TaskGuid = [guid]::NewGuid().ToString() - $Action = New-ScheduledTaskAction @ActionArguments - $null = Register-ScheduledTask -TaskName "xPDT $TaskGuid" -Action $Action -User $Credential.UserName -Password $Credential.GetNetworkCredential().Password -RunLevel Highest - $err = Start-ScheduledTask -TaskName "xPDT $TaskGuid" - } - else - { - try - { - CallPInvoke - [Source.NativeMethods]::CreateProcessAsUser(("$Path " + $Arguments),$Credential.GetNetworkCredential().Domain,$Credential.GetNetworkCredential().UserName,$Credential.GetNetworkCredential().Password) - } - catch - { - $exception = New-Object System.ArgumentException $_ - $errorCategory = [System.Management.Automation.ErrorCategory]::OperationStopped - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, "Win32Exception", $errorCategory, $null - $err = $errorRecord - } - } - } - else - { - $StartArguments = ExtractArguments $PSBoundParameters ` - ("Path", "Arguments", "Credential") ` - ("FilePath", "ArgumentList", "Credential") - if([string]::IsNullOrEmpty($Arguments)) - { - $null = $StartArguments.Remove("ArgumentList") - } - $err = Start-Process @StartArguments - } - if($err -ne $null) - { - throw $err - } - if (!(WaitForWin32ProcessStart @GetArguments)) - { - ThrowInvalidArgumentError "FailureWaitingForProcessesToStart" ($LocalizedData.ErrorStarting -f $Path,$LocalizedData.FailureWaitingForProcessesToStart) - } - } - else - { - return ($LocalizedData.ProcessAlreadyStarted -f $Path,$Processes.ProcessId) - } - $Processes = @(GetWin32Process @getArguments) - return ($LocalizedData.ProcessStarted -f $Path,$Processes.ProcessId) -} - -function WaitForWin32ProcessStart -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [PSCredential] - $Credential - ) - - $start = [DateTime]::Now - $GetArguments = ExtractArguments $PSBoundParameters ("Path","Arguments","Credential") - do - { - $value = @(GetWin32Process @GetArguments).Count -ge 1 - } while(!$value -and ([DateTime]::Now - $start).TotalMilliseconds -lt 60000) - - return $value -} - -function WaitForWin32ProcessEnd -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [PSCredential] - $Credential - ) - - $GetArguments = ExtractArguments $PSBoundParameters ("Path","Arguments","Credential") - While (WaitForWin32ProcessStart @GetArguments) - { - Start-Sleep 1 - } - Get-ScheduledTask | Where-Object {($_.TaskName.Length -ge 4) -and ($_.TaskName.Substring(0,4) -eq "xPDT") -and ($_.Actions.Execute -eq $Path) -and ($_.Actions.Arguments -eq $Arguments)} | Where-Object {$_ -ne $null} | Unregister-ScheduledTask -Confirm:$false -} - -function NetUse -{ - param - ( - [parameter(Mandatory)] - [string] - $SourcePath, - - [parameter(Mandatory)] - [PSCredential] - $Credential, - - [string] - $Ensure = "Present" - ) - - if(($SourcePath.Length -ge 2) -and ($SourcePath.Substring(0,2) -eq "\\")) - { - - if ($Ensure -eq "Absent") - { - $cmd = "net.exe use $SourcePath /del" - } - else - { - $cmd = "net.exe use $SourcePath $($Credential.GetNetworkCredential().Password) /user:$($Credential.GetNetworkCredential().Domain)\$($Credential.GetNetworkCredential().UserName)" - } - Invoke-Expression $cmd - } -} - -Export-ModuleMember ResolvePath,StartWin32Process,WaitForWin32ProcessEnd,NetUse diff --git a/lib/puppet_x/dsc_resources/xSCVMM/xSCVMM.psd1 b/lib/puppet_x/dsc_resources/xSCVMM/xSCVMM.psd1 deleted file mode 100644 index 1a9b03b5..00000000 --- a/lib/puppet_x/dsc_resources/xSCVMM/xSCVMM.psd1 +++ /dev/null @@ -1,31 +0,0 @@ -@{ -# Version number of this module. -ModuleVersion = '1.2.4.0' - -# ID used to uniquely identify this module -GUID = '9e9bcee1-93e5-4b57-96df-9768686b0f2d' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'Module with DSC Resources for deployment and configuration of Microsoft System Center Virtual Machine Manager.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Minimum version of the common language runtime (CLR) required by this module -CLRVersion = '4.0' - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' -} diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLAOGroupEnsure/MSFT_xSQLAOGroupEnsure.psm1 b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLAOGroupEnsure/MSFT_xSQLAOGroupEnsure.psm1 deleted file mode 100644 index f9c07c7f..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLAOGroupEnsure/MSFT_xSQLAOGroupEnsure.psm1 +++ /dev/null @@ -1,367 +0,0 @@ -$currentPath = Split-Path -Parent $MyInvocation.MyCommand.Path -Write-Verbose -Message "CurrentPath: $currentPath" - -Import-Module $currentPath\..\..\xSQLServerHelper.psm1 -Verbose:$false -ErrorAction Stop - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure, - - [parameter(Mandatory = $true)] - [System.String] - $AvailabilityGroupName, - - [System.String] - $SQLServer = $env:COMPUTERNAME, - - [ValidateNotNull()] - [System.String] - $SQLInstanceName= 'MSSQLSERVER', - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - $sql = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName -SetupCredential $SetupCredential - - $vConfigured = Test-TargetResource -Ensure $Ensure -AvailabilityGroupName $AvailabilityGroupName -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName -SetupCredential $SetupCredential - - $returnValue = @{ - Ensure = $vConfigured - AvailabilityGroupName = $sql.AvailabilityGroups[$AvailabilityGroupName] - AvailabilityGroupNameListener = $sql.AvailabilityGroups[$AvailabilityGroupName].AvailabilityGroupListeners.name - AvailabilityGroupNameIP = $sql.AvailabilityGroups[$AvailabilityGroupName].AvailabilityGroupListeners.availabilitygrouplisteneripaddresses.IPAddress - AvailabilityGroupSubMask = $sql.AvailabilityGroups[$AvailabilityGroupName].AvailabilityGroupListeners.availabilitygrouplisteneripaddresses.SubnetMask - AvailabilityGroupPort = $sql.AvailabilityGroups[$AvailabilityGroupName].AvailabilityGroupListeners.portnumber - AvailabilityGroupNameDatabase = $sql.AvailabilityGroups[$AvailabilityGroupName].AvailabilityDatabases.name - BackupDirectory = '' - SQLServer = $SQLServer - SQLInstanceName = $SQLInstanceName - } - - $returnValue -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure, - - [parameter(Mandatory = $true)] - [System.String] - $AvailabilityGroupName, - - [System.String] - $AvailabilityGroupNameListener = $AvailabilityGroupName, - - [System.String[]] - $AvailabilityGroupNameIP, - - [System.String[]] - $AvailabilityGroupSubMask, - - [System.UInt32] - $AvailabilityGroupPort = '1433', - - [ValidateSet('None', 'ReadOnly', 'ReadIntent')] - [System.String] - $ReadableSecondary = 'ReadOnly', - - [ValidateSet('Primary', 'Secondary')] - [System.String] - $AutoBackupPreference = 'Primary', - - [System.UInt32] - $BackupPriority = '50', - - [System.UInt32] - $EndPointPort = '5022', - - [System.String] - $SQLServer = $env:COMPUTERNAME, - - [System.String] - $SQLInstanceName = 'MSSQLSERVER', - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - $null = [System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.Smo') - $null = [System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.SmoExtended') - - $sql = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName -SetupCredential $SetupCredential - - if (($AvailabilityGroupNameIP -and !$AvailabilityGroupSubMask) -or (!$AvailabilityGroupNameIP -and $AvailabilityGroupSubMask)) - { - throw 'AvailabilityGroupNameIP and AvailabilityGroupSubMask must both be passed for Static IP assignment.' - } - - switch ($Ensure) - { - 'Present' - { - Grant-ServerPerms -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName -AuthorizedUser 'NT AUTHORITY\SYSTEM' -SetupCredential $SetupCredential - New-ListenerADObject -AvailabilityGroupNameListener $AvailabilityGroupNameListener -SetupCredential $SetupCredential -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName - - $FailoverCondition = 3 - $HealthCheckTimeout = 30000 - $ConnectionModeInPrimary = 'AllowAllConnections' - - $ConnectionModeInSecondaryRole = switch ($ReadableSecondary) - { - 'None' - { - 'AllowNoConnections' - } - - 'ReadOnly' - { - 'AllowAllConnections' - } - - 'ReadIntent' - { - 'AllowReadIntentConnectionsOnly' - } - - Default - { - 'AllowAllConnections' - } - } - - # Get Servers participating in the cluster - # First two nodes will account for Syncronous Automatic Failover, Any additional will be Asyncronous - try - { - $nodes = Get-ClusterNode -cluster $sql.ClusterName -Verbose:$false | Select-Object -ExpandProperty name - $syncNodes = $nodes | Select-Object -First 2 - $asyncNodes = $nodes | Select-Object -Skip 2 - $availabilityGroup = New-Object -typename Microsoft.SqlServer.Management.Smo.AvailabilityGroup -ArgumentList $SQL, $AvailabilityGroupName - $availabilityGroup.AutomatedBackupPreference = $AutoBackupPreference - $availabilityGroup.FailureConditionLevel = $FailoverCondition - $availabilityGroup.HealthCheckTimeout = $HealthCheckTimeout - } - catch - { - throw "Failed to connect to Cluster Nodes from $($sql.ClusterName)" - } - - # Loop through Sync nodes Create Replica Object Assign properties and add it to AvailabilityGroup - foreach ($node in $syncNodes) - { - Try - { - $Replica = New-Object -typename Microsoft.SqlServer.Management.Smo.AvailabilityReplica -ArgumentList $availabilityGroup, $node - $Replica.EndpointUrl = "TCP://$($node):$EndPointPort" - $Replica.FailoverMode = [Microsoft.SqlServer.Management.Smo.AvailabilityReplicaFailoverMode]::Automatic - $Replica.AvailabilityMode = [Microsoft.SqlServer.Management.Smo.AvailabilityReplicaAvailabilityMode]::SynchronousCommit - # Backup Priority Gives the ability to set a priority of one secondany over another valid values are from 1 - 100 - $Replica.BackupPriority = $BackupPriority - $Replica.ConnectionModeInPrimaryRole = $ConnectionModeInPrimary - $replica.ConnectionModeInSecondaryRole = $ConnectionModeInSecondaryRole - $availabilityGroup.AvailabilityReplicas.Add($Replica) - } - catch - { - throw "Failed to add $Replica to the Availability Group $AvailabilityGroupName" - } - } - - # Loop through ASync nodes Create Replica Object Assign properties and add it to AvailabilityGroup - foreach ($node in $AsyncNodes) - { - try - { - $asyncReplica = New-Object -typename Microsoft.SqlServer.Management.Smo.AvailabilityReplica -ArgumentList $availabilityGroup, $node - $asyncReplica.EndpointUrl = "TCP://$($node):$EndPointPort" - $asyncReplica.FailoverMode = [Microsoft.SqlServer.Management.Smo.AvailabilityReplicaFailoverMode]::Manual - $asyncReplica.AvailabilityMode = [Microsoft.SqlServer.Management.Smo.AvailabilityReplicaAvailabilityMode]::ASynchronousCommit - $asyncReplica.BackupPriority = $BackupPriority - $asyncReplica.ConnectionModeInPrimaryRole = $ConnectionModeInPrimary - $asyncReplica.ConnectionModeInSecondaryRole = $ConnectionModeInSecondaryRole - $AvailabilityGroup.AvailabilityReplicas.Add($asyncReplica) - } - catch - { - Write-Error "Failed to add $asyncReplica to the Availability Group $AvailabilityGroupName" - } - } - - try - { - $AgListener = New-Object -typename Microsoft.SqlServer.Management.Smo.AvailabilityGroupListener -ArgumentList $AvailabilityGroup, $AvailabilityGroupNameListener - $AgListener.PortNumber =$AvailabilityGroupPort - } - catch - { - Write-Error -Message ('{0}: Failed to Create AG Listener Object' -f ((Get-Date -format yyyy-MM-dd_HH-mm-ss))) - } - - - if ($AvailabilityGroupNameIP) - { - foreach ($IP in $AvailabilityGroupNameIP) - { - $AgListenerIp = New-Object -typename Microsoft.SqlServer.Management.Smo.AvailabilityGroupListenerIPAddress -ArgumentList $AgListener - $AgListenerIp.IsDHCP = $false - $AgListenerIp.IPAddress = $IP - $AgListenerIp.SubnetMask = $AvailabilityGroupSubMask - $AgListener.AvailabilityGroupListenerIPAddresses.Add($AgListenerIp) - New-VerboseMessage -Message "Added Static IP $IP to $AvailabilityGroupNameListener..." - - } - } - else - { - # Utilize Dynamic IP since no Ip was passed - $AgListenerIp = New-Object -typename Microsoft.SqlServer.Management.Smo.AvailabilityGroupListenerIPAddress -ArgumentList $AgListener - $AgListenerIp.IsDHCP = $true - $AgListener.AvailabilityGroupListenerIPAddresses.Add($AgListenerIp) - New-VerboseMessage -Message "Added DynamicIP to $AvailabilityGroupNameListener..." - } - - try - { - $AvailabilityGroup.AvailabilityGroupListeners.Add($AgListener); - } - catch - { - throw "Failed to Add $AvailabilityGroupNameListener to $AvailabilityGroupName..." - } - - # Add Availabilty Group to the SQL connection - try - { - $SQL.AvailabilityGroups.Add($availabilityGroup) - New-VerboseMessage -Message "Added $availabilityGroupName Availability Group to Connection" - } - catch - { - throw "Unable to Add $AvailabilityGroup to $SQLServer\$SQLInstanceName" - } - - # Create Availability Group - try - { - $availabilityGroup.Create() - - New-VerboseMessage -Message "Created Availability Group $availabilityGroupName" - } - catch - { - throw "Unable to Create $AvailabilityGroup on $SQLServer\$SQLInstanceName" - } - } - - 'Absent' - { - try - { - $sql.AvailabilityGroups[$AvailabilityGroupName].Drop() - - New-VerboseMessage -Message "Dropped $AvailabilityGroupName" - } - catch - { - throw "Unable to Drop $AvailabilityGroup on $SQLServer\$SQLInstanceName" - } - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure, - - [parameter(Mandatory = $true)] - [System.String] - $AvailabilityGroupName, - - [System.String] - $AvailabilityGroupNameListener, - - [System.String[]] - $AvailabilityGroupNameIP, - - [System.String[]] - $AvailabilityGroupSubMask, - - [System.UInt32] - $AvailabilityGroupPort, - - [ValidateSet('None', 'ReadOnly', 'ReadIntent')] - [System.String] - $ReadableSecondary ='ReadOnly', - - [ValidateSet('Primary', 'Secondary')] - [System.String] - $AutoBackupPreference = 'Primary', - - [System.UInt32] - $BackupPriority = '50', - - [System.UInt32] - $EndPointPort = '5022', - - [System.String] - $SQLServer = $env:COMPUTERNAME, - - [System.String] - $SQLInstanceName = 'MSSQLSERVER', - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - $sql = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName -SetupCredential $SetupCredential - - $result = $false - - switch ($Ensure) - { - 'Present' - { - $availabilityGroupPresent = $sql.AvailabilityGroups.Contains($AvailabilityGroupName) - if ($availabilityGroupPresent) - { - $result = $true - } - } - - 'Absent' - { - if (!$sql.AvailabilityGroups[$AvailabilityGroupName]) - { - $result = $true - } - } - } - - return $result -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLAOGroupEnsure/MSFT_xSQLAOGroupEnsure.schema.mof b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLAOGroupEnsure/MSFT_xSQLAOGroupEnsure.schema.mof deleted file mode 100644 index 0d722dd6..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLAOGroupEnsure/MSFT_xSQLAOGroupEnsure.schema.mof +++ /dev/null @@ -1,17 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSQLAOGroupEnsure")] -class MSFT_xSQLAOGroupEnsure : OMI_BaseResource -{ - [Key, Description("Determines whether the availability group should be added or removed."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Key, Description("Name for availability group.")] String AvailabilityGroupName; - [Write, Description("Listener name for availability group.")] String AvailabilityGroupNameListener; - [Write, Description("List of IP addresses associated with listener.")] String AvailabilityGroupNameIP[]; - [Write, Description("Network subnetmask for listener.")] String AvailabilityGroupSubMask[]; - [Write, Description("Port availability group should listen on.")] Uint32 AvailabilityGroupPort; - [Write, Description("Mode secondaries should operate under (None, ReadOnly, ReadIntent)."), ValueMap{"None","ReadOnly","ReadIntent"}, Values{"None","ReadOnly","ReadIntent"}] String ReadableSecondary; - [Write, Description("Where backups should be backed up from (Primary, Secondary)."), ValueMap{"Primary","Secondary"}, Values{"Primary","Secondary"}] String AutoBackupPreference; - [Write, Description("The percentage weight for backup prority (default 50).")] Uint32 BackupPriority; - [Write, Description("he TCP port for the SQL AG Endpoint (default 5022).")] Uint32 EndPointPort; - [Write, Description("The SQL Server for the database.")] String SQLServer; - [Write, Description("The SQL instance for the database.")] String SQLInstanceName; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to Grant Permissions on SQL Server, set this to $null to use Windows Authentication.")] String SetupCredential; -}; diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLAOGroupJoin/MSFT_xSQLAOGroupJoin.psm1 b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLAOGroupJoin/MSFT_xSQLAOGroupJoin.psm1 deleted file mode 100644 index a9693ab0..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLAOGroupJoin/MSFT_xSQLAOGroupJoin.psm1 +++ /dev/null @@ -1,227 +0,0 @@ -$script:currentPath = Split-Path -Path $MyInvocation.MyCommand.Path -Parent -Import-Module -Name (Join-Path -Path (Split-Path -Path (Split-Path -Path $script:currentPath -Parent) -Parent) -ChildPath 'xSQLServerHelper.psm1') - -<# - .SYNOPSIS - Returns the current joined state of the Availability Group. - - .PARAMETER Ensure - If the replica should be joined ('Present') to the Availability Group or not joined ('Absent') to the Availability Group. - - .PARAMETER AvailabilityGroupName - The name Availability Group to join. - - .PARAMETER SQLServer - Name of the SQL server to be configured. - - .PARAMETER SQLInstanceName - Name of the SQL instance to be configured. - - .PARAMETER SetupCredential - Credential to be used to Grant Permissions in SQL. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure, - - [Parameter(Mandatory = $true)] - [System.String] - $AvailabilityGroupName, - - [Parameter()] - [System.String] - $SQLServer = $env:COMPUTERNAME, - - [Parameter()] - [System.String] - $SQLInstanceName= 'MSSQLSERVER', - - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - $sql = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName -SetupCredential $SetupCredential - - if (Test-TargetResource @PSBoundParameters) - { - $ensure = 'Present' - } - else - { - $ensure = 'Absent' - } - - return @{ - Ensure = $ensure - AvailabilityGroupName = $sql.AvailabilityGroups[$AvailabilityGroupName].Name - AvailabilityGroupNameListener = $sql.AvailabilityGroups[$AvailabilityGroupName].AvailabilityGroupListeners.Name - AvailabilityGroupNameIP = $sql.AvailabilityGroups[$AvailabilityGroupName].AvailabilityGroupListeners.AvailabilityGroupListenerIPAddresses.IPAddress - AvailabilityGroupSubMask = $sql.AvailabilityGroups[$AvailabilityGroupName].AvailabilityGroupListeners.AvailabilityGroupListenerIPAddresses.SubnetMask - AvailabilityGroupPort = $sql.AvailabilityGroups[$AvailabilityGroupName].AvailabilityGroupListeners.PortNumber - AvailabilityGroupNameDatabase = $sql.AvailabilityGroups[$AvailabilityGroupName].AvailabilityDatabases.Name - BackupDirectory = "" - SQLServer = $SQLServer - SQLInstanceName = $SQLInstanceName - } -} - -<# - .SYNOPSIS - Join the node to the the Availability Group. - - .PARAMETER Ensure - If the replica should be joined ('Present') to the Availability Group or not joined ('Absent') to the Availability Group. - - .PARAMETER AvailabilityGroupName - The name Availability Group to join. - - .PARAMETER SQLServer - Name of the SQL server to be configured. - - .PARAMETER SQLInstanceName - Name of the SQL instance to be configured. - - .PARAMETER SetupCredential - Credential to be used to Grant Permissions in SQL. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure, - - [Parameter(Mandatory = $true)] - [System.String] - $AvailabilityGroupName, - - [Parameter()] - [System.String] - $SQLServer = $env:COMPUTERNAME, - - [Parameter()] - [System.String] - $SQLInstanceName= 'MSSQLSERVER', - - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - Initialize-SqlServerAssemblies - - $sql = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName -SetupCredential $SetupCredential - Grant-ServerPerms -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName -AuthorizedUser "NT AUTHORITY\SYSTEM" -SetupCredential $SetupCredential - - try - { - $sql.JoinAvailabilityGroup($AvailabilityGroupName) - New-VerboseMessage -Message "Joined $SQLServer\$SQLInstanceName to $AvailabilityGroupName" - } - catch - { - throw "Unable to Join $AvailabilityGroupName on $SQLServer\$SQLInstanceName" - } -} - -<# - .SYNOPSIS - Test if the node is joined to the Availability Group. - - .PARAMETER Ensure - If the replica should be joined ('Present') to the Availability Group or not joined ('Absent') to the Availability Group. - - .PARAMETER AvailabilityGroupName - The name Availability Group to join. - - .PARAMETER SQLServer - Name of the SQL server to be configured. - - .PARAMETER SQLInstanceName - Name of the SQL instance to be configured. - - .PARAMETER SetupCredential - Credential to be used to Grant Permissions in SQL. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure, - - [Parameter(Mandatory = $true)] - [System.String] - $AvailabilityGroupName, - - [Parameter()] - [System.String] - $SQLServer = $env:COMPUTERNAME, - - [Parameter()] - [System.String] - $SQLInstanceName= 'MSSQLSERVER', - - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - $sql = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName -SetupCredential $SetupCredential - - $returnValue = $false - - switch ($Ensure) - { - 'Present' - { - $availabilityGroupPresent = $sql.AvailabilityGroups.Contains($AvailabilityGroupName) - - if ($availabilityGroupPresent) - { - $returnValue = $true - } - } - - "Absent" - { - $availabilityGroupPresent = $sql.AvailabilityGroups.Contains($AvailabilityGroupName) - - if (!$availabilityGroupPresent) - { - $returnValue = $true - } - } - } - - return $returnValue -} - -<# - .SYNOPSIS - Loads the needed assemblies for the resource to be able to use methods. -#> -function Initialize-SqlServerAssemblies -{ - param () - - $null = [System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.Smo') - $null = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SmoExtended") -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLAOGroupJoin/MSFT_xSQLAOGroupJoin.schema.mof b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLAOGroupJoin/MSFT_xSQLAOGroupJoin.schema.mof deleted file mode 100644 index c3a19b5e..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLAOGroupJoin/MSFT_xSQLAOGroupJoin.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSQLAOGroupJoin")] -class MSFT_xSQLAOGroupJoin : OMI_BaseResource -{ - [Key, Description("If the replica should be joined ('Present') to the Availability Group or not joined ('Absent') to the Availability Group."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Key, Description("The name Availability Group to join.")] String AvailabilityGroupName; - [Write, Description("Name of the SQL server to be configured.")] String SQLServer; - [Write, Description("Name of the SQL instance to be configured.")] String SQLInstanceName; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to Grant Permissions in SQL.")] String SetupCredential; -}; - diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAlias/MSFT_xSQLServerAlias.psm1 b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAlias/MSFT_xSQLServerAlias.psm1 deleted file mode 100644 index 550af907..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAlias/MSFT_xSQLServerAlias.psm1 +++ /dev/null @@ -1,289 +0,0 @@ -Import-Module -Name (Join-Path -Path (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent) -ChildPath 'xSQLServerHelper.psm1') -Force - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $ServerName - ) - - $returnValue = @{ - Name = [System.String] $Name - Protocol = [System.String] '' - ServerName = [System.String] $ServerName - TcpPort = [System.UInt16] 0 - UseDynamicTcpPort = [System.Boolean] $false - PipeName = [System.String] '' - Ensure = [System.String] 'Absent' - } - - $protocolTcp = 'DBMSSOCN' - $protocolNamedPipes = 'DBNMPNTW' - - Write-Verbose -Message "Getting the SQL Server Client Alias $Name" - $itemValue = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo' ` - -Name $Name ` - -ErrorAction SilentlyContinue - - if (((Get-CimInstance -ClassName win32_OperatingSystem).OSArchitecture) -eq '64-bit') - { - Write-Verbose -Message "64-bit Operating System. Also get the client alias $Name from Wow6432Node" - - $isWow6432Node = $true - $itemValueWow6432Node = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\MSSQLServer\Client\ConnectTo' ` - -Name $Name ` - -ErrorAction SilentlyContinue - } - - if ((-not $isWow6432Node -and $null -ne $itemValue ) -or ` - (($null -ne $itemValue -and $null -ne $itemValueWow6432Node) -and ` - ($isWow6432Node -and $itemValueWow6432Node."$Name" -eq $itemValue."$Name"))) - { - $itemConfig = $itemValue."$Name" | ConvertFrom-Csv -Header 'Protocol','ServerName','TcpPort' - if ($itemConfig) - { - if ($itemConfig.Protocol -eq $protocolTcp) - { - $returnValue.Ensure = 'Present' - $returnValue.Protocol = 'TCP' - $returnValue.ServerName = $itemConfig.ServerName - if ($itemConfig.TcpPort) - { - $returnValue.TcpPort = $itemConfig.TcpPort - $returnValue.UseDynamicTcpPort = $false - } - else - { - $returnValue.UseDynamicTcpPort = $true - $returnValue.TcpPort = 0 - } - } - elseif ($itemConfig.Protocol -eq $protocolNamedPipes) - { - $returnValue.Ensure = 'Present' - $returnValue.Protocol = 'NP' - $returnValue.PipeName = $itemConfig.ServerName - } - } - else - { - $returnValue.Ensure = 'Absent' - } - } - else - { - $returnValue.Ensure = 'Absent' - } - - $returnValue -} - -function Set-TargetResource -{ - [CmdletBinding(SupportsShouldProcess)] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name, - - [Parameter()] - [ValidateSet('TCP','NP')] - [System.String] - $Protocol = 'TCP', - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $ServerName, - - [Parameter()] - [System.UInt16] - $TcpPort = 1433, - - [Parameter()] - [System.Boolean] - $UseDynamicTcpPort = $false, - - [Parameter()] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present' - ) - - Write-Verbose -Message "Setting the SQL Server Client Alias $Name" - - if ($Protocol -eq 'NP') - { - $itemValue = "DBNMPNTW,\\$ServerName\PIPE\sql\query" - } - - if ($Protocol -eq 'TCP') - { - $itemValue = "DBMSSOCN,$ServerName" - if (!$UseDynamicTcpPort) - { - $itemValue += ",$TcpPort" - } - } - - $registryPath = 'HKLM:\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo' - $registryPathWow6432Node = 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\MSSQLServer\Client\ConnectTo' - - if ($Ensure -eq 'Present') - { - Write-Verbose -Message "Adding the SQL Server Client Alias $Name" - - if ($PSCmdlet.ShouldProcess($Name, 'Setting the client alias')) - { - if (!(Test-Path -Path $registryPath)) - { - New-Item -Path $registryPath | Out-Null - } - - Set-ItemProperty -Path $registryPath -Name $Name -Value $itemValue | Out-Null - } - - # If this is a 64-bit OS then also update Wow6432Node - if (((Get-CimInstance -ClassName win32_OperatingSystem).OSArchitecture) -eq '64-bit') - { - if ($PSCmdlet.ShouldProcess($Name, 'Setting the client alias (32-bit)')) - { - if (!(Test-Path -Path $registryPathWow6432Node)) - { - New-Item -Path $registryPathWow6432Node | Out-Null - } - - Set-ItemProperty -Path $registryPathWow6432Node -Name $Name -Value $itemValue | Out-Null - } - } - } - - if ($Ensure -eq 'Absent') - { - Write-Verbose -Message "Removing the SQL Server Client Alias $Name" - - if ($PSCmdlet.ShouldProcess($Name, 'Remove the client alias')) - { - if (Test-Path -Path $registryPath) - { - Remove-ItemProperty -Path $registryPath -Name $Name - } - } - - # If this is a 64-bit OS then also remove from Wow6432Node - if (((Get-CimInstance -ClassName win32_OperatingSystem).OSArchitecture) -eq '64-bit' ` - -and (Test-Path -Path $registryPathWow6432Node)) - { - if ($PSCmdlet.ShouldProcess($Name, 'Remove the client alias (32-bit)')) - { - Remove-ItemProperty -Path $registryPathWow6432Node -Name $Name - } - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name, - - [Parameter()] - [ValidateSet('TCP','NP')] - [System.String] - $Protocol = 'TCP', - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $ServerName, - - [Parameter()] - [System.UInt16] - $TcpPort = 1433, - - [Parameter()] - [System.Boolean] - $UseDynamicTcpPort = $false, - - [Parameter()] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present' - ) - - Write-Verbose -Message "Testing the SQL Server Client Alias $Name" - - $result = $false - - $parameters = @{ - Name = $PSBoundParameters.Name - ServerName = $PSBoundParameters.ServerName - } - - $currentValues = Get-TargetResource @parameters - - if ($Ensure -eq $currentValues.Ensure) - { - if( $Ensure -eq 'Absent' ) - { - $result = $true - } - else - { - Write-Verbose -Message 'Ensure is in the desired state. Verifying values.' - - if ($Protocol -eq $currentValues.Protocol) - { - if ($Protocol -eq 'NP' -and - $currentValues.PipeName -eq "\\$ServerName\PIPE\sql\query") - { - $result = $true - } - elseif ($Protocol -eq 'TCP' -and - $UseDynamicTcpPort -and - $currentValues.ServerName -eq $ServerName) - { - $result = $true - } - elseif ($Protocol -eq 'TCP' -and - -not $UseDynamicTcpPort -and - $currentValues.ServerName -eq $ServerName -and - $currentValues.TcpPort -eq $TcpPort) - { - $result = $true - } - } - } - } - - if ($result) - { - Write-Verbose -Message 'In the desired state' - } - else - { - Write-Verbose -Message 'Not in the desired state' - } - - return $result -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAlias/MSFT_xSQLServerAlias.schema.mof b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAlias/MSFT_xSQLServerAlias.schema.mof deleted file mode 100644 index bf613ea9..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAlias/MSFT_xSQLServerAlias.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSQLServerAlias")] -class MSFT_xSQLServerAlias : OMI_BaseResource -{ - [Key, Description("The name of Alias (e.g. svr01\\inst01).")] String Name; - [Write, Description("Protocol to use when connecting. Valid values are 'TCP' or 'NP' (Named Pipes). Default value is 'TCP'."), ValueMap{"TCP","NP"}, Values{"TCP","NP"}] String Protocol; - [Key, Description("The SQL Server you are aliasing (the netbios name or FQDN).")] String ServerName; - [Write, Description("The TCP port SQL is listening on. Only used when protocol is set to 'TCP'. Default value is port 1433.")] UInt16 TcpPort; - [Write, Description("The UseDynamicTcpPort specify that the Net-Library will determine the port dynamically. The port specified in Port number will not be used. Default value is '$false'.")] Boolean UseDynamicTcpPort; - [Read, Description("Named Pipes path from the Get-TargetResource method.")] String PipeName; - [Write, Description("Determines whether the alias should be added or removed. Default value is 'Present'"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; -}; diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroup/MSFT_xSQLServerAlwaysOnAvailabilityGroup.psm1 b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroup/MSFT_xSQLServerAlwaysOnAvailabilityGroup.psm1 deleted file mode 100644 index 41b3142c..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroup/MSFT_xSQLServerAlwaysOnAvailabilityGroup.psm1 +++ /dev/null @@ -1,758 +0,0 @@ -Import-Module -Name (Join-Path -Path (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent) ` - -ChildPath 'xSQLServerHelper.psm1') ` - -Force - -<# - .SYNOPSIS - Gets the specified Availabilty Group. - - .PARAMETER Name - The name of the availability group. - - .PARAMETER SQLServer - Hostname of the SQL Server to be configured. - - .PARAMETER SQLInstanceName - Name of the SQL instance to be configued. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [String] - $Name, - - [Parameter(Mandatory = $true)] - [String] - $SQLServer, - - [Parameter(Mandatory = $true)] - [String] - $SQLInstanceName - ) - - # Connect to the instance - $serverObject = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName - - # Get the endpoint properties - $endpoint = $serverObject.Endpoints | Where-Object { $_.EndpointType -eq 'DatabaseMirroring' } - if ( $endpoint ) - { - $endpointPort = $endpoint.Protocol.Tcp.ListenerPort - } - - # Get the Availability Group - $availabilityGroup = $serverObject.AvailabilityGroups[$Name] - - if ( $availabilityGroup ) - { - # Get all of the properties that can be set using this resource - $alwaysOnAvailabilityGroupResource = @{ - Name = $Name - SQLServer = $SQLServer - SQLInstanceName = $SQLInstanceName - Ensure = 'Present' - AutomatedBackupPreference = $availabilityGroup.AutomatedBackupPreference - AvailabilityMode = $availabilityGroup.AvailabilityReplicas[$serverObject.Name].AvailabilityMode - BackupPriority = $availabilityGroup.AvailabilityReplicas[$serverObject.Name].BackupPriority - ConnectionModeInPrimaryRole = $availabilityGroup.AvailabilityReplicas[$serverObject.Name].ConnectionModeInPrimaryRole - ConnectionModeInSecondaryRole = $availabilityGroup.AvailabilityReplicas[$serverObject.Name].ConnectionModeInSecondaryRole - FailureConditionLevel = $availabilityGroup.FailureConditionLevel - FailoverMode = $availabilityGroup.AvailabilityReplicas[$serverObject.Name].FailoverMode - HealthCheckTimeout = $availabilityGroup.HealthCheckTimeout - EndpointURL = $availabilityGroup.AvailabilityReplicas[$serverObject.Name].EndpointUrl - EndpointPort = $endpointPort - SQLServerNetName = $serverObject.NetName - Version = $serverObject.Version.Major - } - - # Add properties that are only present in SQL 2016 or newer - if ( $serverObject.Version.Major -ge 13 ) - { - $alwaysOnAvailabilityGroupResource.Add('BasicAvailabilityGroup', $availabilityGroup.BasicAvailabilityGroup) - } - } - else - { - # Return the minimum amount of properties showing that the Availabilty Group is absent - $alwaysOnAvailabilityGroupResource = @{ - Name = $Name - SQLServer = $SQLServer - SQLInstanceName = $SQLInstanceName - Ensure = 'Absent' - } - } - - return $alwaysOnAvailabilityGroupResource -} - -<# - .SYNOPSIS - Creates or removes the availability group to in accordance with the desired state. - - .PARAMETER Name - The name of the availability group. - - .PARAMETER SQLServer - Hostname of the SQL Server to be configured. - - .PARAMETER SQLInstanceName - Name of the SQL instance to be configued. - - .PARAMETER Ensure - Specifies if the availability group should be present or absent. Default is Present. - - .PARAMETER AutomatedBackupPreference - Specifies the automated backup preference for the availability group. - - .PARAMETER AvailabilityMode - Specifies the replica availability mode. Default is 'AsynchronousCommit'. - - .PARAMETER BackupPriority - Specifies the desired priority of the replicas in performing backups. The acceptable values for this parameter are integers from 0 through 100. Of the set of replicas which are online and available, the replica that has the highest priority performs the backup. Default is 50. - - .PARAMETER BasicAvailabilityGroup - Specifies the type of availability group is Basic. This is only available is SQL Server 2016 and later and is ignored when applied to previous versions. - - .PARAMETER ConnectionModeInPrimaryRole - Specifies how the availability replica handles connections when in the primary role. - - .PARAMETER ConnectionModeInSecondaryRole - Specifies how the availability replica handles connections when in the secondary role. - - .PARAMETER EndpointHostName - Specifies the hostname or IP address of the availability group replica endpoint. Default is the instance network name. - - .PARAMETER FailureConditionLevel - Specifies the automatic failover behavior of the availability group. - - .PARAMETER HealthCheckTimeout - Specifies the length of time, in milliseconds, after which AlwaysOn availability groups declare an unresponsive server to be unhealthy. Default is 30,000. -#> -function Set-TargetResource -{ - [CmdletBinding()] - Param - ( - [Parameter(Mandatory = $true)] - [String] - $Name, - - [Parameter(Mandatory = $true)] - [String] - $SQLServer, - - [Parameter(Mandatory = $true)] - [String] - $SQLInstanceName, - - [Parameter()] - [ValidateSet('Present','Absent')] - [String] - $Ensure = 'Present', - - [Parameter()] - [ValidateSet('Primary','SecondaryOnly','Secondary','None')] - [String] - $AutomatedBackupPreference = 'None', - - [Parameter()] - [ValidateSet('AsynchronousCommit','SynchronousCommit')] - [String] - $AvailabilityMode = 'AsynchronousCommit', - - [Parameter()] - [ValidateRange(0,100)] - [UInt32] - $BackupPriority = 50, - - [Parameter()] - [bool] - $BasicAvailabilityGroup, - - [Parameter()] - [ValidateSet('AllowAllConnections','AllowReadWriteConnections')] - [String] - $ConnectionModeInPrimaryRole, - - [Parameter()] - [ValidateSet('AllowNoConnections','AllowReadIntentConnectionsOnly','AllowAllConnections')] - [String] - $ConnectionModeInSecondaryRole, - - [Parameter()] - [String] - $EndpointHostName, - - [Parameter()] - [ValidateSet( - 'OnServerDown', - 'OnServerUnresponsive', - 'OnCriticalServerErrors', - 'OnModerateServerErrors', - 'OnAnyQualifiedFailureCondition' - )] - [String] - $FailureConditionLevel, - - [Parameter()] - [ValidateSet('Automatic','Manual')] - [String] - $FailoverMode = 'Manual', - - [Parameter()] - [UInt32] - $HealthCheckTimeout = 30000 - ) - - Import-SQLPSModule - - # Connect to the instance - $serverObject = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName - - # Determine if HADR is enabled on the instance. If not, throw an error - if ( -not $serverObject.IsHadrEnabled ) - { - throw New-TerminatingError -ErrorType HadrNotEnabled -FormatArgs $Ensure,$SQLInstanceName -ErrorCategory NotImplemented - } - - $version = $serverObject.Version.Major - - # Get the Availabilty Group if it exists - $availabilityGroup = $serverObject.AvailabilityGroups[$Name] - - switch ($Ensure) - { - Absent - { - # If the AG exists - if ( $availabilityGroup ) - { - # If the primary replica is currently on this instance - if ( $availabilityGroup.PrimaryReplicaServerName -eq $serverObject.Name ) - { - try - { - Remove-SqlAvailabilityGroup -InputObject $availabilityGroup -ErrorAction Stop - } - catch - { - throw New-TerminatingError -ErrorType RemoveAvailabilityGroupFailed -FormatArgs $availabilityGroup.Name,$SQLInstanceName -ErrorCategory ResourceUnavailable - } - } - else - { - throw New-TerminatingError -ErrorType InstanceNotPrimaryReplica -FormatArgs $SQLInstanceName,$availabilityGroup.Name -ErrorCategory ResourceUnavailable - } - } - } - - Present - { - $clusterServiceName = 'NT SERVICE\ClusSvc' - $ntAuthoritySystemName = 'NT AUTHORITY\SYSTEM' - $availabilityGroupManagementPerms = @('Connect SQL','Alter Any Availability Group','View Server State') - $clusterPermissionsPresent = $false - - foreach ( $loginName in @( $clusterServiceName, $ntAuthoritySystemName ) ) - { - if ( $serverObject.Logins[$loginName] ) - { - $testLoginEffectivePermissionsParams = @{ - SQLServer = $SQLServer - SQLInstanceName = $SQLInstanceName - LoginName = $loginName - Permissions = $availabilityGroupManagementPerms - } - - $clusterPermissionsPresent = Test-LoginEffectivePermissions @testLoginEffectivePermissionsParams - - if ( $clusterPermissionsPresent ) - { - # Exit the loop when the script verifies the required cluster permissions are present - break - } - else - { - switch ( $loginName ) - { - $clusterServiceName - { - New-VerboseMessage -Message "The recommended account '$loginName' is missing one or more of the following permissions: $( $availabilityGroupManagementPerms -join ', ' ). Trying with '$ntAuthoritySystemName'." - } - - $ntAuthoritySystemName - { - New-VerboseMessage -Message "'$loginName' is missing one or more of the following permissions: $( $availabilityGroupManagementPerms -join ', ' )" - } - } - } - } - else - { - switch ( $loginName ) - { - $clusterServiceName - { - New-VerboseMessage -Message "The recommended login '$loginName' is not present. Trying with '$ntAuthoritySystemName'." - } - - $ntAuthoritySystemName - { - New-VerboseMessage -Message "The login '$loginName' is not present." - } - } - } - } - - # If neither 'NT SERVICE\ClusSvc' or 'NT AUTHORITY\SYSTEM' have the required permissions, throw an error - if ( -not $clusterPermissionsPresent ) - { - throw New-TerminatingError -ErrorType ClusterPermissionsMissing -FormatArgs $SQLServer,$SQLInstanceName -ErrorCategory SecurityError - } - - $endpoint = $serverObject.Endpoints | Where-Object { $_.EndpointType -eq 'DatabaseMirroring' } - if ( -not $endpoint ) - { - throw New-TerminatingError -ErrorType DatabaseMirroringEndpointNotFound -FormatArgs $SQLServer,$SQLInstanceName -ErrorCategory ObjectNotFound - } - - if ( -not $EndpointHostName ) - { - $EndpointHostName = $serverObject.NetName - } - - # If the availability group does not exist, create it - if ( -not $availabilityGroup ) - { - - # Set up the parameters to create the AG Replica - $newReplicaParams = @{ - Name = $serverObject.Name - Version = $version - AsTemplate = $true - AvailabilityMode = $AvailabilityMode - EndpointUrl = "TCP://$($EndpointHostName):$($endpoint.Protocol.Tcp.ListenerPort)" - FailoverMode = $FailoverMode - } - - if ( $BackupPriority ) - { - $newReplicaParams.Add('BackupPriority',$BackupPriority) - } - - if ( $ConnectionModeInPrimaryRole ) - { - $newReplicaParams.Add('ConnectionModeInPrimaryRole',$ConnectionModeInPrimaryRole) - } - - if ( $ConnectionModeInSecondaryRole ) - { - $newReplicaParams.Add('ConnectionModeInSecondaryRole',$ConnectionModeInSecondaryRole) - } - - # Create the new replica object - try - { - $primaryReplica = New-SqlAvailabilityReplica @newReplicaParams -ErrorAction Stop - } - catch - { - throw New-TerminatingError -ErrorType CreateAvailabilityGroupReplicaFailed -FormatArgs $Ensure,$SQLInstanceName -ErrorCategory OperationStopped - } - - # Set up the parameters for the new availability group - $newAvailabilityGroupParams = @{ - InputObject = $serverObject - Name = $Name - AvailabilityReplica = $primaryReplica - } - - if ( $AutomatedBackupPreference ) - { - $newAvailabilityGroupParams.Add('AutomatedBackupPreference',$AutomatedBackupPreference) - } - - if ( $BasicAvailabilityGroup -and ( $version -ge 13 ) ) - { - $newAvailabilityGroupParams.Add('BasicAvailabilityGroup',$BasicAvailabilityGroup) - } - - if ( $FailureConditionLevel ) - { - $newAvailabilityGroupParams.Add('FailureConditionLevel',$FailureConditionLevel) - } - - if ( $HealthCheckTimeout ) - { - $newAvailabilityGroupParams.Add('HealthCheckTimeout',$HealthCheckTimeout) - } - - # Create the Availabilty Group - try - { - New-SqlAvailabilityGroup @newAvailabilityGroupParams -ErrorAction Stop - } - catch - { - throw New-TerminatingError -ErrorType CreateAvailabilityGroupFailed -FormatArgs $Name,$_.Exception -ErrorCategory OperationStopped - } - } - # Otherwise let's check each of the parameters passed and update the Availability Group accordingly - else - { - # Make sure we're communicating with the primary replica - if ( $availabilityGroup.LocalReplicaRole -ne 'Primary' ) - { - $primaryServerObject = Connect-SQL -SQLServer $availabilityGroup.PrimaryReplicaServerName - $availabilityGroup = $primaryServerObject.AvailabilityGroups[$Name] - } - - if ( $AutomatedBackupPreference -ne $availabilityGroup.AutomatedBackupPreference ) - { - $availabilityGroup.AutomatedBackupPreference = $AutomatedBackupPreference - Update-AvailabilityGroup -AvailabilityGroup $availabilityGroup - } - - if ( $AvailabilityMode -ne $availabilityGroup.AvailabilityReplicas[$serverObject.Name].AvailabilityMode ) - { - $availabilityGroup.AvailabilityReplicas[$serverObject.Name].AvailabilityMode = $AvailabilityMode - Update-AvailabilityGroupReplica -AvailabilityGroupReplica $availabilityGroup.AvailabilityReplicas[$serverObject.Name] - } - - if ( $BackupPriority -ne $availabilityGroup.AvailabilityReplicas[$serverObject.Name].BackupPriority ) - { - $availabilityGroup.AvailabilityReplicas[$serverObject.Name].BackupPriority = $BackupPriority - Update-AvailabilityGroupReplica -AvailabilityGroupReplica $availabilityGroup.AvailabilityReplicas[$serverObject.Name] - } - - if ( $BasicAvailabilityGroup -and ( $version -ge 13 ) -and ( $BasicAvailabilityGroup -ne $availabilityGroup.BasicAvailabilityGroup ) ) - { - $availabilityGroup.BasicAvailabilityGroup = $BasicAvailabilityGroup - Update-AvailabilityGroup -AvailabilityGroup $availabilityGroup - } - - # Make sure ConnectionModeInPrimaryRole has a value in order to avoid false positive matches when the parameter is not defined - if ( ( -not [string]::IsNullOrEmpty($ConnectionModeInPrimaryRole) ) -and ( $ConnectionModeInPrimaryRole -ne $availabilityGroup.AvailabilityReplicas[$serverObject.Name].ConnectionModeInPrimaryRole ) ) - { - $availabilityGroup.AvailabilityReplicas[$serverObject.Name].ConnectionModeInPrimaryRole = $ConnectionModeInPrimaryRole - Update-AvailabilityGroupReplica -AvailabilityGroupReplica $availabilityGroup.AvailabilityReplicas[$serverObject.Name] - } - - # Make sure ConnectionModeInSecondaryRole has a value in order to avoid false positive matches when the parameter is not defined - if ( ( -not [string]::IsNullOrEmpty($ConnectionModeInSecondaryRole) ) -and ( $ConnectionModeInSecondaryRole -ne $availabilityGroup.AvailabilityReplicas[$serverObject.Name].ConnectionModeInSecondaryRole ) ) - { - $availabilityGroup.AvailabilityReplicas[$serverObject.Name].ConnectionModeInSecondaryRole = $ConnectionModeInSecondaryRole - Update-AvailabilityGroupReplica -AvailabilityGroupReplica $availabilityGroup.AvailabilityReplicas[$serverObject.Name] - } - - # Break out the EndpointUrl properties - $currentEndpointProtocol, $currentEndpointHostName, $currentEndpointPort = $availabilityGroup.AvailabilityReplicas[$serverObject.Name].EndpointUrl.Replace('//','').Split(':') - - if ( $endpoint.Protocol.Tcp.ListenerPort -ne $currentEndpointPort ) - { - $newEndpointUrl = $availabilityGroup.AvailabilityReplicas[$serverObject.Name].EndpointUrl.Replace($currentEndpointPort,$endpoint.Protocol.Tcp.ListenerPort) - $availabilityGroup.AvailabilityReplicas[$serverObject.Name].EndpointUrl = $newEndpointUrl - Update-AvailabilityGroupReplica -AvailabilityGroupReplica $availabilityGroup.AvailabilityReplicas[$serverObject.Name] - } - - if ( $EndpointHostName -ne $currentEndpointHostName ) - { - $newEndpointUrl = $availabilityGroup.AvailabilityReplicas[$serverObject.Name].EndpointUrl.Replace($currentEndpointHostName,$EndpointHostName) - $availabilityGroup.AvailabilityReplicas[$serverObject.Name].EndpointUrl = $newEndpointUrl - Update-AvailabilityGroupReplica -AvailabilityGroupReplica $availabilityGroup.AvailabilityReplicas[$serverObject.Name] - } - - if ( $currentEndpointProtocol -ne 'TCP' ) - { - $newEndpointUrl = $availabilityGroup.AvailabilityReplicas[$serverObject.Name].EndpointUrl.Replace($currentEndpointProtocol,'TCP') - $availabilityGroup.AvailabilityReplicas[$serverObject.Name].EndpointUrl = $newEndpointUrl - Update-AvailabilityGroupReplica -AvailabilityGroupReplica $availabilityGroup.AvailabilityReplicas[$serverObject.Name] - } - - # Make sure FailureConditionLevel has a value in order to avoid false positive matches when the parameter is not defined - if ( ( -not [string]::IsNullOrEmpty($FailureConditionLevel) ) -and ( $FailureConditionLevel -ne $availabilityGroup.FailureConditionLevel ) ) - { - $availabilityGroup.FailureConditionLevel = $FailureConditionLevel - Update-AvailabilityGroup -AvailabilityGroup $availabilityGroup - } - - if ( $FailoverMode -ne $availabilityGroup.AvailabilityReplicas[$serverObject.Name].FailoverMode ) - { - $availabilityGroup.AvailabilityReplicas[$serverObject.Name].AvailabilityMode = $FailoverMode - Update-AvailabilityGroupReplica -AvailabilityGroupReplica $availabilityGroup.AvailabilityReplicas[$serverObject.Name] - } - - if ( $HealthCheckTimeout -ne $availabilityGroup.HealthCheckTimeout ) - { - $availabilityGroup.HealthCheckTimeout = $HealthCheckTimeout - Update-AvailabilityGroup -AvailabilityGroup $availabilityGroup - } - } - } - } -} - -<# - .SYNOPSIS - Determines if the availability group is in the desired state. - - .PARAMETER Name - The name of the availability group. - - .PARAMETER SQLServer - Hostname of the SQL Server to be configured. - - .PARAMETER SQLInstanceName - Name of the SQL instance to be configued. - - .PARAMETER Ensure - Specifies if the availability group should be present or absent. Default is Present. - - .PARAMETER AutomatedBackupPreference - Specifies the automated backup preference for the availability group. - - .PARAMETER AvailabilityMode - Specifies the replica availability mode. Default is 'AsynchronousCommit'. - - .PARAMETER BackupPriority - Specifies the desired priority of the replicas in performing backups. The acceptable values for this parameter are integers from 0 through 100. Of the set of replicas which are online and available, the replica that has the highest priority performs the backup. Default is 50. - - .PARAMETER BasicAvailabilityGroup - Specifies the type of availability group is Basic. This is only available is SQL Server 2016 and later and is ignored when applied to previous versions. - - .PARAMETER ConnectionModeInPrimaryRole - Specifies how the availability replica handles connections when in the primary role. - - .PARAMETER ConnectionModeInSecondaryRole - Specifies how the availability replica handles connections when in the secondary role. - - .PARAMETER EndpointHostName - Specifies the hostname or IP address of the availability group replica endpoint. Default is the instance network name. - - .PARAMETER FailureConditionLevel - Specifies the automatic failover behavior of the availability group. - - .PARAMETER HealthCheckTimeout - Specifies the length of time, in milliseconds, after which AlwaysOn availability groups declare an unresponsive server to be unhealthy. Default is 30,000. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - Param - ( - [Parameter(Mandatory = $true)] - [String] - $Name, - - [Parameter(Mandatory = $true)] - [String] - $SQLServer, - - [Parameter(Mandatory = $true)] - [String] - $SQLInstanceName, - - [Parameter()] - [ValidateSet('Present','Absent')] - [String] - $Ensure = 'Present', - - [Parameter()] - [ValidateSet('Primary','SecondaryOnly','Secondary','None')] - [String] - $AutomatedBackupPreference = 'None', - - [Parameter()] - [ValidateSet('AsynchronousCommit','SynchronousCommit')] - [String] - $AvailabilityMode = 'AsynchronousCommit', - - [Parameter()] - [ValidateRange(0,100)] - [UInt32] - $BackupPriority = 50, - - [Parameter()] - [bool] - $BasicAvailabilityGroup, - - [Parameter()] - [ValidateSet('AllowAllConnections','AllowReadWriteConnections')] - [String] - $ConnectionModeInPrimaryRole, - - [Parameter()] - [ValidateSet('AllowNoConnections','AllowReadIntentConnectionsOnly','AllowAllConnections')] - [String] - $ConnectionModeInSecondaryRole, - - [Parameter()] - [String] - $EndpointHostName, - - [Parameter()] - [ValidateSet('OnServerDown','OnServerUnresponsive','OnCriticalServerErrors','OnModerateServerErrors','OnAnyQualifiedFailureCondition')] - [String] - $FailureConditionLevel, - - [Parameter()] - [ValidateSet('Automatic','Manual')] - [String] - $FailoverMode = 'Manual', - - [Parameter()] - [UInt32] - $HealthCheckTimeout = 30000 - ) - - $getTargetResourceParameters = @{ - SQLInstanceName = $SQLInstanceName - SQLServer = $SQLServer - Name = $Name - } - - # Assume this will pass. We will determine otherwise later - $result = $true - - $getTargetResourceResult = Get-TargetResource @getTargetResourceParameters - - switch ($Ensure) - { - 'Absent' - { - if ( $getTargetResourceResult.Ensure -eq 'Absent' ) - { - $result = $true - } - else - { - $result = $false - } - } - - 'Present' - { - $parametersToCheck = @( - 'Name', - 'SQLServer', - 'SQLInstanceName', - 'Ensure', - 'AutomatedBackupPreference', - 'AvailabilityMode', - 'BackupPriority', - 'BasicAvailabilityGroup', - 'ConnectionModeInPrimaryRole', - 'ConnectionModeInSecondaryRole', - 'FailureConditionLevel', - 'FailoverMode', - 'HealthCheckTimeout' - ) - - if ( $getTargetResourceResult.Ensure -eq 'Present' ) - { - # PsBoundParameters won't work here because it doesn't account for default values - foreach ( $parameter in $MyInvocation.MyCommand.Parameters.GetEnumerator() ) - { - $parameterName = $parameter.Key - $parameterValue = Get-Variable -Name $parameterName -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Value - - # Make sure we don't try to validate a common parameter - if ( $parametersToCheck -notcontains $parameterName ) - { - continue - } - - if ( $getTargetResourceResult.($parameterName) -ne $parameterValue ) - { - if ( $parameterName -eq 'BasicAvailabilityGroup' ) - { - # Move on to the next property if the instance is not at least SQL Server 2016 - if ( $getTargetResourceResult.Version -lt 13 ) - { - continue - } - } - - New-VerboseMessage -Message "'$($parameterName)' should be '$($parameterValue)' but is '$($getTargetResourceResult.($parameterName))'" - - $result = $False - } - } - - # Get the Endpoint URL properties - $currentEndpointProtocol, $currentEndpointHostName, $currentEndpointPort = $getTargetResourceResult.EndpointUrl.Replace('//','').Split(':') - - if ( -not $EndpointHostName ) - { - $EndpointHostName = $getTargetResourceResult.SQLServerNetName - } - - # Verify the hostname in the endpoint URL is correct - if ( $EndpointHostName -ne $currentEndpointHostName ) - { - New-VerboseMessage -Message "'EndpointHostName' should be '$EndpointHostName' but is '$currentEndpointHostName'" - $result = $false - } - - # Verify the protocol in the endpoint URL is correct - if ( 'TCP' -ne $currentEndpointProtocol ) - { - New-VerboseMessage -Message "'EndpointProtocol' should be 'TCP' but is '$currentEndpointProtocol'" - $result = $false - } - - # Verify the port in the endpoint URL is correct - if ( $getTargetResourceResult.EndpointPort -ne $currentEndpointPort ) - { - New-VerboseMessage -Message "'EndpointPort' should be '$($getTargetResourceResult.EndpointPort)' but is '$currentEndpointPort'" - $result = $false - } - } - else - { - $result = $false - } - } - } - - return $result -} - -<# - .SYNOPSIS - Executes the alter method on an Availability Group object. - - .PARAMETER AvailabilityGroup - The Availabilty Group object that must be altered. -#> -function Update-AvailabilityGroup -{ - param - ( - [Parameter(Mandatory = $true)] - [Microsoft.SqlServer.Management.Smo.AvailabilityGroup] - $AvailabilityGroup - ) - - try - { - $originalErrorActionPreference = $ErrorActionPreference - $ErrorActionPreference = 'Stop' - $AvailabilityGroup.Alter() - } - catch - { - throw New-TerminatingError -ErrorType AlterAvailabilityGroupFailed -FormatArgs $AvailabilityGroup.Name -ErrorCategory OperationStopped - } - finally - { - $ErrorActionPreference = $originalErrorActionPreference - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroup/MSFT_xSQLServerAlwaysOnAvailabilityGroup.schema.mof b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroup/MSFT_xSQLServerAlwaysOnAvailabilityGroup.schema.mof deleted file mode 100644 index 07947f4d..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroup/MSFT_xSQLServerAlwaysOnAvailabilityGroup.schema.mof +++ /dev/null @@ -1,18 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSQLServerAlwaysOnAvailabilityGroup")] -class MSFT_xSQLServerAlwaysOnAvailabilityGroup : OMI_BaseResource -{ - [Key, Description("The name of the availability group.")] String Name; - [Required, Description("Hostname of the SQL Server to be configured.")] String SQLServer; - [Key, Description("Name of the SQL instance to be configued.")] String SQLInstanceName; - [Write, Description("Specifies if the availability group should be present or absent. Default is Present."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, Description("Specifies the automated backup preference for the availability group. Default is None"), ValueMap{"Primary","SecondaryOnly","Secondary","None"}, Values{"Primary","SecondaryOnly","Secondary","None"}] String AutomatedBackupPreference; - [Write, Description("Specifies the replica availability mode. Default is 'AsynchronousCommit'."), ValueMap{"AsynchronousCommit","SynchronousCommit"}, Values{"AsynchronousCommit","SynchronousCommit"}] String AvailabilityMode; - [Write, Description("Specifies the desired priority of the replicas in performing backups. The acceptable values for this parameter are: integers from 0 through 100. Of the set of replicas which are online and available, the replica that has the highest priority performs the backup. Default is 50.")] UInt32 BackupPriority; - [Write, Description("Specifies the type of availability group is Basic. This is only available is SQL Server 2016 and later and is ignored when applied to previous versions.")] Boolean BasicAvailabilityGroup; - [Write, Description("Specifies how the availability replica handles connections when in the primary role."), ValueMap{"AllowAllConnections","AllowReadWriteConnections"}, Values{"AllowAllConnections","AllowReadWriteConnections"}] String ConnectionModeInPrimaryRole; - [Write, Description("Specifies how the availability replica handles connections when in the secondary role."), ValueMap{"AllowNoConnections","AllowReadIntentConnectionsOnly","AllowAllConnections"}, Values{"AllowNoConnections","AllowReadIntentConnectionsOnly","AllowAllConnections"}] String ConnectionModeInSecondaryRole; - [Write, Description("Specifies the hostname or IP address of the availability group replica endpoint. Default is the instance network name.")] String EndpointHostName; - [Write, Description("Specifies the automatic failover behavior of the availability group."), ValueMap{"OnServerDown","OnServerUnresponsive","OnCriticalServerErrors","OnModerateServerErrors","OnAnyQualifiedFailureCondition"}, Values{"OnServerDown","OnServerUnresponsive","OnCriticalServerErrors","OnModerateServerErrors","OnAnyQualifiedFailureCondition"}] String FailureConditionLevel; - [Write, Description("Specifies the failover mode. Default is 'Manual'."), ValueMap{"Automatic","Manual"}, Values{"Automatic","Manual"}] String FailoverMode; - [Write, Description("Specifies the length of time, in milliseconds, after which AlwaysOn availability groups declare an unresponsive server to be unhealthy. Default is 30000.")] UInt32 HealthCheckTimeout; -}; diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupReplica/MSFT_xSQLServerAlwaysOnAvailabilityGroupReplica.psm1 b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupReplica/MSFT_xSQLServerAlwaysOnAvailabilityGroupReplica.psm1 deleted file mode 100644 index 982164cd..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupReplica/MSFT_xSQLServerAlwaysOnAvailabilityGroupReplica.psm1 +++ /dev/null @@ -1,738 +0,0 @@ -Import-Module -Name (Join-Path -Path (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent) ` - -ChildPath 'xSQLServerHelper.psm1') ` - -Force - -<# - .SYNOPSIS - Gets the specified Availabilty Group Replica from the specified Availabilty Group. - - .PARAMETER Name - The name of the availability group replica. - - .PARAMETER AvailabilityGroupName - The name of the availability group. - - .PARAMETER SQLServer - Hostname of the SQL Server to be configured. - - .PARAMETER SQLInstanceName - Name of the SQL instance to be configued. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [String] - $Name, - - [Parameter(Mandatory = $true)] - [String] - $AvailabilityGroupName, - - [Parameter(Mandatory = $true)] - [String] - $SQLServer, - - [Parameter(Mandatory = $true)] - [String] - $SQLInstanceName - ) - - # Connect to the instance - $serverObject = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName - - # Get the endpoint properties - $endpoint = $serverObject.Endpoints | Where-Object { $_.EndpointType -eq 'DatabaseMirroring' } - if ( $endpoint ) - { - $endpointPort = $endpoint.Protocol.Tcp.ListenerPort - } - - # Create the return object - $alwaysOnAvailabilityGroupReplicaResource = @{ - Ensure = 'Absent' - Name = '' - AvailabilityGroupName = '' - AvailabilityMode = '' - BackupPriority = '' - ConnectionModeInPrimaryRole = '' - ConnectionModeInSecondaryRole = '' - FailoverMode = '' - EndpointUrl = '' - ReadOnlyRoutingConnectionUrl = '' - ReadOnlyRoutingList = @() - SQLServer = $SQLServer - SQLInstanceName = $SQLInstanceName - EndpointPort = $endpointPort - SQLServerNetName = $serverObject.NetName - } - - # Get the availability group - $availabilityGroup = $serverObject.AvailabilityGroups[$AvailabilityGroupName] - - if ( $availabilityGroup ) - { - # Add the Availability Group name to the results - $alwaysOnAvailabilityGroupReplicaResource.AvailabilityGroupName = $availabilityGroup.Name - - # Try to find the replica - $availabilityGroupReplica = $availabilityGroup.AvailabilityReplicas[$Name] - - if ( $availabilityGroupReplica ) - { - # Add the Availability Group Replica properties to the results - $alwaysOnAvailabilityGroupReplicaResource.Ensure = 'Present' - $alwaysOnAvailabilityGroupReplicaResource.Name = $availabilityGroupReplica.Name - $alwaysOnAvailabilityGroupReplicaResource.AvailabilityMode = $availabilityGroupReplica.AvailabilityMode - $alwaysOnAvailabilityGroupReplicaResource.BackupPriority = $availabilityGroupReplica.BackupPriority - $alwaysOnAvailabilityGroupReplicaResource.ConnectionModeInPrimaryRole = $availabilityGroupReplica.ConnectionModeInPrimaryRole - $alwaysOnAvailabilityGroupReplicaResource.ConnectionModeInSecondaryRole = $availabilityGroupReplica.ConnectionModeInSecondaryRole - $alwaysOnAvailabilityGroupReplicaResource.FailoverMode = $availabilityGroupReplica.FailoverMode - $alwaysOnAvailabilityGroupReplicaResource.EndpointUrl = $availabilityGroupReplica.EndpointUrl - $alwaysOnAvailabilityGroupReplicaResource.ReadOnlyRoutingConnectionUrl = $availabilityGroupReplica.ReadOnlyRoutingConnectionUrl - $alwaysOnAvailabilityGroupReplicaResource.ReadOnlyRoutingList = $availabilityGroupReplica.ReadOnlyRoutingList - } - } - - return $alwaysOnAvailabilityGroupReplicaResource -} - -<# - .SYNOPSIS - Creates or removes the availability group replica in accordance with the desired state. - - .PARAMETER Name - The name of the availability group replica. - - .PARAMETER AvailabilityGroupName - The name of the availability group. - - .PARAMETER SQLServer - Hostname of the SQL Server to be configured. - - .PARAMETER SQLInstanceName - Name of the SQL instance to be configued. - - .PARAMETER PrimaryReplicaSQLServer - Hostname of the SQL Server where the primary replica is expected to be active. If the primary replica is not found here, the resource will attempt to find the host that holds the primary replica and connect to it. - - .PARAMETER PrimaryReplicaSQLInstanceName - Name of the SQL instance where the primary replica lives. - - .PARAMETER Ensure - Specifies if the availability group should be present or absent. Default is Present. - - .PARAMETER AvailabilityMode - Specifies the replica availability mode. Default is 'AsynchronousCommit'. - - .PARAMETER BackupPriority - Specifies the desired priority of the replicas in performing backups. The acceptable values for this parameter are integers from 0 through 100. Of the set of replicas which are online and available, the replica that has the highest priority performs the backup. Default is 50. - - .PARAMETER ConnectionModeInPrimaryRole - Specifies how the availability replica handles connections when in the primary role. - - .PARAMETER ConnectionModeInSecondaryRole - Specifies how the availability replica handles connections when in the secondary role. - - .PARAMETER EndpointHostName - Specifies the hostname or IP address of the availability group replica endpoint. Default is the instance network name which is set in the code because the value can only be determined when connected to the SQL Instance. - - .PARAMETER FailoverMode - Specifies the failover mode. Default is Manual. - - .PARAMETER ReadOnlyRoutingConnectionUrl - Specifies the fully-qualified domain name (FQDN) and port to use when routing to the replica for read only connections. - - .PARAMETER ReadOnlyRoutingList - Specifies an ordered list of replica server names that represent the probe sequence for connection director to use when redirecting read-only connections through this availability replica. This parameter applies if the availability replica is the current primary replica of the availability group. -#> -function Set-TargetResource -{ - [CmdletBinding()] - Param - ( - [Parameter(Mandatory = $true)] - [String] - $Name, - - [Parameter(Mandatory = $true)] - [String] - $AvailabilityGroupName, - - [Parameter(Mandatory = $true)] - [String] - $SQLServer, - - [Parameter(Mandatory = $true)] - [String] - $SQLInstanceName, - - [Parameter()] - [String] - $PrimaryReplicaSQLServer, - - [Parameter()] - [String] - $PrimaryReplicaSQLInstanceName, - - [Parameter()] - [ValidateSet('Present','Absent')] - [String] - $Ensure = 'Present', - - [Parameter()] - [ValidateSet('AsynchronousCommit','SynchronousCommit')] - [String] - $AvailabilityMode = 'AsynchronousCommit', - - [Parameter()] - [ValidateRange(0,100)] - [UInt32] - $BackupPriority = 50, - - [Parameter()] - [ValidateSet('AllowAllConnections','AllowReadWriteConnections')] - [String] - $ConnectionModeInPrimaryRole, - - [Parameter()] - [ValidateSet('AllowNoConnections','AllowReadIntentConnectionsOnly','AllowAllConnections')] - [String] - $ConnectionModeInSecondaryRole, - - [Parameter()] - [String] - $EndpointHostName, - - [Parameter()] - [ValidateSet('Automatic','Manual')] - [String] - $FailoverMode = 'Manual', - - [Parameter()] - [String] - $ReadOnlyRoutingConnectionUrl, - - [Parameter()] - [String[]] - $ReadOnlyRoutingList - ) - - Import-SQLPSModule - - # Connect to the instance - $serverObject = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName - - # Determine if HADR is enabled on the instance. If not, throw an error - if ( -not $serverObject.IsHadrEnabled ) - { - throw New-TerminatingError -ErrorType HadrNotEnabled -FormatArgs $Ensure,$SQLInstanceName -ErrorCategory NotImplemented - } - - # Get the Availabilty Group if it exists - $availabilityGroup = $serverObject.AvailabilityGroups[$AvailabilityGroupName] - - # Make sure we're communicating with the primary replica in order to make changes to the replica - if ( $availabilityGroup ) - { - while ( $availabilityGroup.LocalReplicaRole -ne 'Primary' ) - { - $primaryServerObject = Connect-SQL -SQLServer $availabilityGroup.PrimaryReplicaServerName - $availabilityGroup = $primaryServerObject.AvailabilityGroups[$AvailabilityGroupName] - } - } - - switch ( $Ensure ) - { - Absent - { - if ( $availabilityGroup ) - { - $availabilityGroupReplica = $availabilityGroup.AvailabilityReplicas[$Name] - - if ( $availabilityGroupReplica ) - { - try - { - Remove-SqlAvailabilityReplica -InputObject $availabilityGroupReplica -Confirm:$false -ErrorAction Stop - } - catch - { - throw New-TerminatingError -ErrorType RemoveAvailabilityGroupReplicaFailed -FormatArgs $Name, $_.Exception -ErrorCategory ResourceUnavailable - } - } - } - } - - Present - { - $clusterServiceName = 'NT SERVICE\ClusSvc' - $ntAuthoritySystemName = 'NT AUTHORITY\SYSTEM' - $availabilityGroupManagementPerms = @('Connect SQL','Alter Any Availability Group','View Server State') - $clusterPermissionsPresent = $false - - foreach ( $loginName in @( $clusterServiceName, $ntAuthoritySystemName ) ) - { - if ( $serverObject.Logins[$loginName] -and -not $clusterPermissionsPresent ) - { - $testLoginEffectivePermissionsParams = @{ - SQLServer = $SQLServer - SQLInstanceName = $SQLInstanceName - LoginName = $loginName - Permissions = $availabilityGroupManagementPerms - } - - $clusterPermissionsPresent = Test-LoginEffectivePermissions @testLoginEffectivePermissionsParams - - if ( -not $clusterPermissionsPresent ) - { - switch ( $loginName ) - { - $clusterServiceName - { - New-VerboseMessage -Message "The recommended account '$loginName' is missing one or more of the following permissions: $( $availabilityGroupManagementPerms -join ', ' ). Trying with '$ntAuthoritySystemName'." - } - - $ntAuthoritySystemName - { - New-VerboseMessage -Message "'$loginName' is missing one or more of the following permissions: $( $availabilityGroupManagementPerms -join ', ' )" - } - } - } - } - elseif ( -not $clusterPermissionsPresent ) - { - switch ( $loginName ) - { - $clusterServiceName - { - New-VerboseMessage -Message "The recommended login '$loginName' is not present. Trying with '$ntAuthoritySystemName'." - } - - $ntAuthoritySystemName - { - New-VerboseMessage -Message "The login '$loginName' is not present." - } - } - } - } - - # If neither 'NT SERVICE\ClusSvc' or 'NT AUTHORITY\SYSTEM' have the required permissions, throw an error. - if ( -not $clusterPermissionsPresent ) - { - throw New-TerminatingError -ErrorType ClusterPermissionsMissing -FormatArgs $SQLServer,$SQLInstanceName -ErrorCategory SecurityError - } - - # Make sure a database mirroring endpoint exists. - $endpoint = $serverObject.Endpoints | Where-Object { $_.EndpointType -eq 'DatabaseMirroring' } - if ( -not $endpoint ) - { - throw New-TerminatingError -ErrorType DatabaseMirroringEndpointNotFound -FormatArgs $SQLServer,$SQLInstanceName -ErrorCategory ObjectNotFound - } - - # If a hostname for the endpoint was not specified, define it now. - if ( -not $EndpointHostName ) - { - $EndpointHostName = $serverObject.NetName - } - - # Get the endpoint port - $endpointPort = $endpoint.Protocol.Tcp.ListenerPort - - # Determine if the Availabilty Group exists on the instance - if ( $availabilityGroup ) - { - # Make sure the replia exists on the instance. If the availability group exists, the replica should exist. - $availabilityGroupReplica = $availabilityGroup.AvailabilityReplicas[$Name] - if ( $availabilityGroupReplica ) - { - if ( $AvailabilityMode -ne $availabilityGroupReplica.AvailabilityMode ) - { - $availabilityGroupReplica.AvailabilityMode = $AvailabilityMode - Update-AvailabilityGroupReplica -AvailabilityGroupReplica $availabilityGroupReplica - } - - if ( $BackupPriority -ne $availabilityGroupReplica.BackupPriority ) - { - $availabilityGroupReplica.BackupPriority = $BackupPriority - Update-AvailabilityGroupReplica -AvailabilityGroupReplica $availabilityGroupReplica - } - - # Make sure ConnectionModeInPrimaryRole has a value in order to avoid false positive matches when the parameter is not defined - if ( ( -not [string]::IsNullOrEmpty($ConnectionModeInPrimaryRole) ) -and ( $ConnectionModeInPrimaryRole -ne $availabilityGroupReplica.ConnectionModeInPrimaryRole ) ) - { - $availabilityGroupReplica.ConnectionModeInPrimaryRole = $ConnectionModeInPrimaryRole - Update-AvailabilityGroupReplica -AvailabilityGroupReplica $availabilityGroupReplica - } - - # Make sure ConnectionModeInSecondaryRole has a value in order to avoid false positive matches when the parameter is not defined - if ( ( -not [string]::IsNullOrEmpty($ConnectionModeInSecondaryRole) ) -and ( $ConnectionModeInSecondaryRole -ne $availabilityGroupReplica.ConnectionModeInSecondaryRole ) ) - { - $availabilityGroupReplica.ConnectionModeInSecondaryRole = $ConnectionModeInSecondaryRole - Update-AvailabilityGroupReplica -AvailabilityGroupReplica $availabilityGroupReplica - } - - # Break out the EndpointUrl properties - $currentEndpointProtocol, $currentEndpointHostName, $currentEndpointPort = $availabilityGroupReplica.EndpointUrl.Replace('//','').Split(':') - - if ( $endpoint.Protocol.Tcp.ListenerPort -ne $currentEndpointPort ) - { - $newEndpointUrl = $availabilityGroupReplica.EndpointUrl.Replace($currentEndpointPort,$endpoint.Protocol.Tcp.ListenerPort) - $availabilityGroupReplica.EndpointUrl = $newEndpointUrl - Update-AvailabilityGroupReplica -AvailabilityGroupReplica $availabilityGroupReplica - } - - if ( $EndpointHostName -ne $currentEndpointHostName ) - { - $newEndpointUrl = $availabilityGroupReplica.EndpointUrl.Replace($currentEndpointHostName,$EndpointHostName) - $availabilityGroupReplica.EndpointUrl = $newEndpointUrl - Update-AvailabilityGroupReplica -AvailabilityGroupReplica $availabilityGroupReplica - } - - if ( $currentEndpointProtocol -ne 'TCP' ) - { - $newEndpointUrl = $availabilityGroupReplica.EndpointUrl.Replace($currentEndpointProtocol,'TCP') - $availabilityGroupReplica.EndpointUrl = $newEndpointUrl - Update-AvailabilityGroupReplica -AvailabilityGroupReplica $availabilityGroupReplica - } - - if ( $FailoverMode -ne $availabilityGroupReplica.FailoverMode ) - { - $availabilityGroupReplica.FailoverMode = $FailoverMode - Update-AvailabilityGroupReplica -AvailabilityGroupReplica $availabilityGroupReplica - } - - if ( $ReadOnlyRoutingConnectionUrl -ne $availabilityGroupReplica.ReadOnlyRoutingConnectionUrl ) - { - $availabilityGroupReplica.ReadOnlyRoutingConnectionUrl = $ReadOnlyRoutingConnectionUrl - Update-AvailabilityGroupReplica -AvailabilityGroupReplica $availabilityGroupReplica - } - - if ( $ReadOnlyRoutingList -ne $availabilityGroupReplica.ReadOnlyRoutingList ) - { - $availabilityGroupReplica.ReadOnlyRoutingList = $ReadOnlyRoutingList - Update-AvailabilityGroupReplica -AvailabilityGroupReplica $availabilityGroupReplica - } - } - else - { - throw New-TerminatingError -ErrorType ReplicaNotFound -FormatArgs $Name,$SQLInstanceName -ErrorCategory ResourceUnavailable - } - } - else - { - # Connect to the instance that is supposed to house the primary replica - $primaryReplicaServerObject = Connect-SQL -SQLServer $PrimaryReplicaSQLServer -SQLInstanceName $PrimaryReplicaSQLInstanceName - - # Verify the Availability Group exists on the supplied primary replica - $primaryReplicaAvailabilityGroup = $primaryReplicaServerObject.AvailabilityGroups[$AvailabilityGroupName] - if ( $primaryReplicaAvailabilityGroup ) - { - # Make sure the instance defined as the primary replica in the parameters is actually the primary replica - if ( $primaryReplicaAvailabilityGroup.LocalReplicaRole -ne 'Primary' ) - { - New-VerboseMessage -Message "The instance '$PrimaryReplicaSQLServer\$PrimaryReplicaSQLInstanceName' is not currently the primary replica. Connecting to '$($primaryReplicaAvailabilityGroup.PrimaryReplicaServerName)'." - - $primaryReplicaServerObject = Connect-SQL -SQLServer $primaryReplicaAvailabilityGroup.PrimaryReplicaServerName - $primaryReplicaAvailabilityGroup = $primaryReplicaServerObject.AvailabilityGroups[$AvailabilityGroupName] - } - - # Build the endpoint URL - $endpointUrl = "TCP://$($EndpointHostName):$($endpointPort)" - - $newAvailabilityGroupReplicaParams = @{ - Name = $Name - InputObject = $primaryReplicaAvailabilityGroup - AvailabilityMode = $AvailabilityMode - EndpointUrl = $endpointUrl - FailoverMode = $FailoverMode - Verbose = $false - } - - if ( $BackupPriority ) - { - $newAvailabilityGroupReplicaParams.Add('BackupPriority',$BackupPriority) - } - - if ( $ConnectionModeInPrimaryRole ) - { - $newAvailabilityGroupReplicaParams.Add('ConnectionModeInPrimaryRole',$ConnectionModeInPrimaryRole) - } - - if ( $ConnectionModeInSecondaryRole ) - { - $newAvailabilityGroupReplicaParams.Add('ConnectionModeInSecondaryRole',$ConnectionModeInSecondaryRole) - } - - if ( $ReadOnlyRoutingConnectionUrl ) - { - $newAvailabilityGroupReplicaParams.Add('ReadOnlyRoutingConnectionUrl',$ReadOnlyRoutingConnectionUrl) - } - - if ( $ReadOnlyRoutingList ) - { - $newAvailabilityGroupReplicaParams.Add('ReadOnlyRoutingList',$ReadOnlyRoutingList) - } - - # Create the Availability Group Replica - try - { - $availabilityGroupReplica = New-SqlAvailabilityReplica @newAvailabilityGroupReplicaParams - } - catch - { - throw New-TerminatingError -ErrorType CreateAvailabilityGroupReplicaFailed -FormatArgs $Name,$SQLInstanceName -ErrorCategory OperationStopped - } - - # Join the Availability Group Replica to the Availability Group - try - { - $joinAvailabilityGroupResults = Join-SqlAvailabilityGroup -Name $AvailabilityGroupName -InputObject $serverObject - } - catch - { - throw New-TerminatingError -ErrorType JoinAvailabilityGroupFailed -FormatArgs $Name -ErrorCategory OperationStopped - } - } - # The Availability Group doesn't exist on the primary replica - else - { - throw New-TerminatingError -ErrorType AvailabilityGroupNotFound -FormatArgs $Name,$PrimaryReplicaSQLInstanceName -ErrorCategory ResourceUnavailable - } - } - } - } -} - -<# - .SYNOPSIS - Determines if the availability group replica is in the desired state. - - .PARAMETER Name - The name of the availability group replica. - - .PARAMETER AvailabilityGroupName - The name of the availability group. - - .PARAMETER SQLServer - Hostname of the SQL Server to be configured. - - .PARAMETER SQLInstanceName - Name of the SQL instance to be configued. - - .PARAMETER PrimaryReplicaSQLServer - Hostname of the SQL Server where the primary replica is expected to be active. If the primary replica is not found here, the resource will attempt to find the host that holds the primary replica and connect to it. - - .PARAMETER PrimaryReplicaSQLInstanceName - Name of the SQL instance where the primary replica lives. - - .PARAMETER Ensure - Specifies if the availability group should be present or absent. Default is Present. - - .PARAMETER AvailabilityMode - Specifies the replica availability mode. Default is 'AsynchronousCommit'. - - .PARAMETER BackupPriority - Specifies the desired priority of the replicas in performing backups. The acceptable values for this parameter are integers from 0 through 100. Of the set of replicas which are online and available, the replica that has the highest priority performs the backup. Default is 50. - - .PARAMETER ConnectionModeInPrimaryRole - Specifies how the availability replica handles connections when in the primary role. - - .PARAMETER ConnectionModeInSecondaryRole - Specifies how the availability replica handles connections when in the secondary role. - - .PARAMETER EndpointHostName - Specifies the hostname or IP address of the availability group replica endpoint. Default is the instance network name which is set in the code because the value can only be determined when connected to the SQL Instance. - - .PARAMETER FailoverMode - Specifies the failover mode. Default is Manual. - - .PARAMETER ReadOnlyRoutingConnectionUrl - Specifies the fully-qualified domain name (FQDN) and port to use when routing to the replica for read only connections. - - .PARAMETER ReadOnlyRoutingList - Specifies an ordered list of replica server names that represent the probe sequence for connection director to use when redirecting read-only connections through this availability replica. This parameter applies if the availability replica is the current primary replica of the availability group. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - Param - ( - [Parameter(Mandatory = $true)] - [String] - $Name, - - [Parameter(Mandatory = $true)] - [String] - $AvailabilityGroupName, - - [Parameter(Mandatory = $true)] - [String] - $SQLServer, - - [Parameter(Mandatory = $true)] - [String] - $SQLInstanceName, - - [Parameter()] - [String] - $PrimaryReplicaSQLServer, - - [Parameter()] - [String] - $PrimaryReplicaSQLInstanceName, - - [Parameter()] - [ValidateSet('Present','Absent')] - [String] - $Ensure = 'Present', - - [Parameter()] - [ValidateSet('AsynchronousCommit','SynchronousCommit')] - [String] - $AvailabilityMode = 'AsynchronousCommit', - - [Parameter()] - [ValidateRange(0,100)] - [UInt32] - $BackupPriority = 50, - - [Parameter()] - [ValidateSet('AllowAllConnections','AllowReadWriteConnections')] - [String] - $ConnectionModeInPrimaryRole, - - [Parameter()] - [ValidateSet('AllowNoConnections','AllowReadIntentConnectionsOnly','AllowAllConnections')] - [String] - $ConnectionModeInSecondaryRole, - - [Parameter()] - [String] - $EndpointHostName, - - [Parameter()] - [ValidateSet('Automatic','Manual')] - [String] - $FailoverMode = 'Manual', - - [Parameter()] - [String] - $ReadOnlyRoutingConnectionUrl, - - [Parameter()] - [String[]] - $ReadOnlyRoutingList - ) - - $getTargetResourceParameters = @{ - SQLInstanceName = $SQLInstanceName - SQLServer = $SQLServer - Name = $Name - AvailabilityGroupName = $AvailabilityGroupName - } - - # Assume this will pass. We will determine otherwise later - $result = $true - - $getTargetResourceResult = Get-TargetResource @getTargetResourceParameters - - switch ($Ensure) - { - 'Absent' - { - if ( $getTargetResourceResult.Ensure -eq 'Absent' ) - { - $result = $true - } - else - { - $result = $false - } - } - - 'Present' - { - $parametersToCheck = @( - 'Name', - 'AvailabilityGroupName', - 'SQLServer', - 'SQLInstanceName', - 'Ensure', - 'AvailabilityMode', - 'BackupPriority', - 'ConnectionModeInPrimaryRole', - 'ConnectionModeInSecondaryRole', - 'FailoverMode', - 'ReadOnlyRoutingConnectionUrl', - 'ReadOnlyRoutingList' - ) - - if ( $getTargetResourceResult.Ensure -eq 'Present' ) - { - # PsBoundParameters won't work here because it doesn't account for default values - foreach ( $parameter in $MyInvocation.MyCommand.Parameters.GetEnumerator() ) - { - $parameterName = $parameter.Key - $parameterValue = Get-Variable -Name $parameterName -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Value - - # Make sure we don't try to validate a common parameter - if ( $parametersToCheck -contains $parameterName ) - { - # If the parameter is Null, a value wasn't provided - if ( -not [string]::IsNullOrEmpty($parameterValue) ) - { - if ( $getTargetResourceResult.($parameterName) -ne $parameterValue ) - { - New-VerboseMessage -Message "'$($parameterName)' should be '$($parameterValue)' but is '$($getTargetResourceResult.($parameterName))'" - - $result = $false - } - } - } - } - - # Get the Endpoint URL properties - $currentEndpointProtocol, $currentEndpointHostName, $currentEndpointPort = $getTargetResourceResult.EndpointUrl.Replace('//','').Split(':') - - if ( -not $EndpointHostName ) - { - $EndpointHostName = $getTargetResourceResult.SQLServerNetName - } - - # Verify the hostname in the endpoint URL is correct - if ( $EndpointHostName -ne $currentEndpointHostName ) - { - New-VerboseMessage -Message "'EndpointHostName' should be '$EndpointHostName' but is '$currentEndpointHostName'" - $result = $false - } - - # Verify the protocol in the endpoint URL is correct - if ( 'TCP' -ne $currentEndpointProtocol ) - { - New-VerboseMessage -Message "'EndpointProtocol' should be 'TCP' but is '$currentEndpointProtocol'" - $result = $false - } - - # Verify the port in the endpoint URL is correct - if ( $getTargetResourceResult.EndpointPort -ne $currentEndpointPort ) - { - New-VerboseMessage -Message "'EndpointPort' should be '$($getTargetResourceResult.EndpointPort)' but is '$currentEndpointPort'" - $result = $false - } - } - else - { - $result = $false - } - } - } - - return $result -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupReplica/MSFT_xSQLServerAlwaysOnAvailabilityGroupReplica.schema.mof b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupReplica/MSFT_xSQLServerAlwaysOnAvailabilityGroupReplica.schema.mof deleted file mode 100644 index 358c7d33..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroupReplica/MSFT_xSQLServerAlwaysOnAvailabilityGroupReplica.schema.mof +++ /dev/null @@ -1,20 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSQLServerAlwaysOnAvailabilityGroupReplica")] -class MSFT_xSQLServerAlwaysOnAvailabilityGroupReplica : OMI_BaseResource -{ - [Key, Description("The name of the availability group replica.")] String Name; - [Key, Description("The name of the availability group.")] String AvailabilityGroupName; - [Required, Description("Hostname of the SQL Server to be configured.")] String SQLServer; - [Key, Description("Name of the SQL instance to be configued.")] String SQLInstanceName; - [Write, Description("Hostname of the SQL Server where the primary replica is expected to be active. If the primary replica is not found here, the resource will attempt to find the host that holds the primary replica and connect to it.")] String PrimaryReplicaSQLServer; - [Write, Description("Name of the SQL instance where the primary replica lives.")] String PrimaryReplicaSQLInstanceName; - [Write, Description("Specifies if the availability group replica should be present or absent. Default is Present."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, Description("Specifies the replica availability mode. Default is 'AsynchronousCommit'."), ValueMap{"AsynchronousCommit","SynchronousCommit"}, Values{"AsynchronousCommit","SynchronousCommit"}] String AvailabilityMode; - [Write, Description("Specifies the desired priority of the replicas in performing backups. The acceptable values for this parameter are: integers from 0 through 100. Of the set of replicas which are online and available, the replica that has the highest priority performs the backup. Default is 50.")] UInt32 BackupPriority; - [Write, Description("Specifies how the availability replica handles connections when in the primary role."), ValueMap{"AllowAllConnections","AllowReadWriteConnections"}, Values{"AllowAllConnections","AllowReadWriteConnections"}] String ConnectionModeInPrimaryRole; - [Write, Description("Specifies how the availability replica handles connections when in the secondary role."), ValueMap{"AllowNoConnections","AllowReadIntentConnectionsOnly","AllowAllConnections"}, Values{"AllowNoConnections","AllowReadIntentConnectionsOnly","AllowAllConnections"}] String ConnectionModeInSecondaryRole; - [Write, Description("Specifies the hostname or IP address of the availability group replica endpoint. Default is the instance network name which is set in the code because the value can only be determined when connected to the SQL Instance.")] String EndpointHostName; - [Write, Description("Specifies the failover mode. Default is 'Manual'."), ValueMap{"Automatic","Manual"}, Values{"Automatic","Manual"}] String FailoverMode; - [Write, Description("Specifies the fully-qualified domain name (FQDN) and port to use when routing to the replica for read only connections.")] String ReadOnlyRoutingConnectionUrl; - [Write, Description("Specifies an ordered list of replica server names that represent the probe sequence for connection director to use when redirecting read-only connections through this availability replica. This parameter applies if the availability replica is the current primary replica of the availability group.")] String ReadOnlyRoutingList[]; - [Read, Description("Output the NetName property from the SQL Server object. Used by Get-TargetResource")] String SqlServerNetName; -}; diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAlwaysOnService/MSFT_xSQLServerAlwaysOnService.psm1 b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAlwaysOnService/MSFT_xSQLServerAlwaysOnService.psm1 deleted file mode 100644 index 85f07426..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAlwaysOnService/MSFT_xSQLServerAlwaysOnService.psm1 +++ /dev/null @@ -1,186 +0,0 @@ -Import-Module -Name (Join-Path -Path (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent) ` - -ChildPath 'xSQLServerHelper.psm1') ` - -Force - -<# - .SYNOPSIS - Gets the current value of the SQL Server HADR property. - - .PARAMETER Ensure - *** Not used in this function *** - HADR is Present (enabled) or Absent (disabled). - - .PARAMETER SQLServer - Hostname of the SQL Server to be configured. - - .PARAMETER SQLInstanceName - Name of the SQL instance to be configued. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure, - - [Parameter(Mandatory = $true)] - [System.String] - $SQLServer, - - [Parameter(Mandatory = $true)] - [System.String] - $SQLInstanceName - ) - - $sql = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName - - New-VerboseMessage -Message ( 'SQL Always On is {0} on "{1}\{2}".' -f @{$false='disabled'; $true='enabled'}[$sql.IsHadrEnabled],$SQLServer,$SQLInstanceName ) - - return @{ IsHadrEnabled = $sql.IsHadrEnabled } -} - -<# - .SYNOPSIS - Sets the current value of the SQL Server HADR property. - - .PARAMETER Ensure - HADR is Present (enabled) or Absent (disabled). - - .PARAMETER SQLServer - Hostname of the SQL Server to be configured. - - .PARAMETER SQLInstanceName - Name of the SQL instance to be configued. - - .PARAMETER RestartTimeout - The length of time, in seconds, to wait for the service to restart. Default is 120 seconds. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure, - - [Parameter(Mandatory = $true)] - [System.String] - $SQLServer, - - [Parameter(Mandatory = $true)] - [System.String] - $SQLInstanceName, - - [Parameter()] - [Int32] - $RestartTimeout = 120 - ) - - # Build the instance name to allow the Enable/Disable-AlwaysOn to connect to the instance - if($SQLInstanceName -eq "MSSQLSERVER") - { - $serverInstance = $SQLServer - } - else - { - $serverInstance = "$SQLServer\$SQLInstanceName" - } - - Import-SQLPSModule - - switch ($Ensure) - { - 'Absent' - { - # Disable Always On without restarting the services. - New-VerboseMessage -Message "Disabling Always On for the instance $serverInstance" - Disable-SqlAlwaysOn -ServerInstance $serverInstance -NoServiceRestart - } - 'Present' - { - # Enable Always On without restarting the services. - New-VerboseMessage -Message "Enabling Always On for the instance $serverInstance" - Enable-SqlAlwaysOn -ServerInstance $serverInstance -NoServiceRestart - } - } - - New-VerboseMessage -Message ( 'SQL Always On has been {0} on "{1}\{2}". Restarting the service.' -f @{Absent='disabled'; Present='enabled'}[$Ensure],$SQLServer,$SQLInstanceName ) - - # Now restart the SQL service so that all dependent services are also returned to their previous state - Restart-SqlService -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName -Timeout $RestartTimeout - - # Verify always on was set - if( -not ( Test-TargetResource @PSBoundParameters ) ) - { - throw New-TerminatingError -ErrorType AlterAlwaysOnServiceFailed -FormatArgs $Ensure,$serverInstance -ErrorCategory InvalidResult - } -} - -<# - .SYNOPSIS - Determines whether the current value of the SQL Server HADR property is properly set. - - .PARAMETER Ensure - HADR is Present (enabled) or Absent (disabled). - - .PARAMETER SQLServer - Hostname of the SQL Server to be configured. - - .PARAMETER SQLInstanceName - Name of the SQL instance to be configued. - - .PARAMETER RestartTimeout - *** Not used in this function *** - The length of time, in seconds, to wait for the service to restart. Default is 120 seconds. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure, - - [Parameter(Mandatory = $true)] - [System.String] - $SQLServer, - - [Parameter(Mandatory = $true)] - [System.String] - $SQLInstanceName, - - [Parameter()] - [Int32] - $RestartTimeout = 120 - ) - - # Determine the current state of Always On - $params = @{ - Ensure = $Ensure - SQLServer = $SQLServer - SQLInstanceName = $SQLInstanceName - } - - $state = Get-TargetResource @params - - # Determine what the desired state of Always On is - $hadrDesiredState = @{ 'Present' = $true; 'Absent' = $false }[$Ensure] - - # Determine whether the value matches the desired state - $desiredStateMet = $state.IsHadrEnabled -eq $hadrDesiredState - - New-VerboseMessage -Message ( 'SQL Always On is in the desired state for "{0}\{1}": {2}.' -f $SQLServer,$SQLInstanceName,$desiredStateMet ) - - return $desiredStateMet -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAlwaysOnService/MSFT_xSQLServerAlwaysOnService.schema.mof b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAlwaysOnService/MSFT_xSQLServerAlwaysOnService.schema.mof deleted file mode 100644 index 083ef2a0..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAlwaysOnService/MSFT_xSQLServerAlwaysOnService.schema.mof +++ /dev/null @@ -1,8 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSQLServerAlwaysOnService")] -class MSFT_xSQLServerAlwaysOnService : OMI_BaseResource -{ - [Required, Description("HADR is Present (enabled) or Absent (disabled)"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Key, Description("The hostname of the SQL Server to be configured")] String SQLServer; - [Key, Description("Name of the SQL instance to be configured.")] String SQLInstanceName; - [Write, Description("The length of time, in seconds, to wait for the service to restart. Default is 120 seconds.")] Sint32 RestartTimeout; -}; diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAvailabilityGroupListener/MSFT_xSQLServerAvailabilityGroupListener.psm1 b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAvailabilityGroupListener/MSFT_xSQLServerAvailabilityGroupListener.psm1 deleted file mode 100644 index 87933a80..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAvailabilityGroupListener/MSFT_xSQLServerAvailabilityGroupListener.psm1 +++ /dev/null @@ -1,494 +0,0 @@ -Import-Module -Name (Join-Path -Path (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent) ` - -ChildPath 'xSQLServerHelper.psm1') ` - -Force -<# - .SYNOPSIS - Returns the current state of the Availabilty Group listener. - - .PARAMETER InstanceName - The SQL Server instance name of the primary replica. Default value is 'MSSQLSERVER'. - - .PARAMETER NodeName - The host name or FQDN of the primary replica. - - .PARAMETER Name - The name of the availability group listener, max 15 characters. This name will be used as the Virtual Computer Object (VCO). - - .PARAMETER AvailabilityGroup - The name of the availability group to which the availability group listener is or will be connected. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $InstanceName, - - [Parameter(Mandatory = $true)] - [System.String] - $NodeName, - - [Parameter(Mandatory = $true)] - [ValidateLength(1,15)] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [System.String] - $AvailabilityGroup - ) - - try - { - $availabilityGroupListener = Get-SQLAlwaysOnAvailabilityGroupListener -Name $Name -AvailabilityGroup $AvailabilityGroup -NodeName $NodeName -InstanceName $InstanceName - - if ($null -ne $availabilityGroupListener) - { - New-VerboseMessage -Message "Listener $Name exist." - - $ensure = 'Present' - $port = [uint16]( $availabilityGroupListener | Select-Object -ExpandProperty PortNumber ) - - $presentIpAddress = $availabilityGroupListener.AvailabilityGroupListenerIPAddresses - $dhcp = [bool]( $presentIpAddress | Select-Object -First 1 -ExpandProperty IsDHCP ) - - $ipAddress = @() - foreach ($currentIpAddress in $presentIpAddress) - { - $ipAddress += "$($currentIpAddress.IPAddress)/$($currentIpAddress.SubnetMask)" - } - } - else - { - New-VerboseMessage -Message "Listener $Name does not exist" - - $ensure = 'Absent' - $port = 0 - $dhcp = $false - $ipAddress = $null - } - } - catch - { - throw New-TerminatingError -ErrorType AvailabilityGroupListenerNotFound -FormatArgs @($Name) -ErrorCategory ObjectNotFound -InnerException $_.Exception - } - - return @{ - InstanceName = [System.String] $InstanceName - NodeName = [System.String] $NodeName - Name = [System.String] $Name - Ensure = [System.String] $ensure - AvailabilityGroup = [System.String] $AvailabilityGroup - IpAddress = [System.String[]] $ipAddress - Port = [System.UInt16] $port - DHCP = [System.Boolean] $dhcp - } -} - -<# - .SYNOPSIS - Creates the Availability Group listener. - - .PARAMETER InstanceName - The SQL Server instance name of the primary replica. Default value is 'MSSQLSERVER'. - - .PARAMETER NodeName - The host name or FQDN of the primary replica. - - .PARAMETER Name - The name of the availability group listener, max 15 characters. This name will be used as the Virtual Computer Object (VCO). - - .PARAMETER Ensure - If the availability group listener should be present or absent. - - .PARAMETER AvailabilityGroup - The name of the availability group to which the availability group listener is or will be connected. - - .PARAMETER IpAddress - The IP address used for the availability group listener, in the format 192.168.10.45/255.255.252.0. If using DCHP, set to the first IP-address of the DHCP subnet, in the format 192.168.8.1/255.255.252.0. Must be valid in the cluster-allowed IP range. - - .PARAMETER Port - The port used for the availability group listener. - - .PARAMETER DHCP - If DHCP should be used for the availability group listener instead of static IP address. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $InstanceName, - - [Parameter(Mandatory = $true)] - [System.String] - $NodeName, - - [Parameter(Mandatory = $true)] - [ValidateLength(1,15)] - [System.String] - $Name, - - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present', - - [Parameter(Mandatory = $true)] - [System.String] - $AvailabilityGroup, - - [System.String[]] - $IpAddress, - - [System.UInt16] - $Port, - - [System.Boolean] - $DHCP - ) - - $parameters = @{ - InstanceName = [System.String] $InstanceName - NodeName = [System.String] $NodeName - Name = [System.String] $Name - AvailabilityGroup = [System.String] $AvailabilityGroup - } - - $availabilityGroupListenerState = Get-TargetResource @parameters - if ($null -ne $availabilityGroupListenerState) - { - if ($Ensure -ne '' -and $availabilityGroupListenerState.Ensure -ne $Ensure) - { - if ($Ensure -eq 'Present') - { - New-VerboseMessage -Message "Create listener on $AvailabilityGroup" - - $sqlServerObject = Connect-SQL -SQLServer $NodeName -SQLInstanceName $InstanceName - - $availabilityGroupObject = $sqlServerObject.AvailabilityGroups[$AvailabilityGroup] - if ($availabilityGroupObject) - { - $newListenerParams = @{ - Name = $Name - InputObject = $availabilityGroupObject - } - - if ($Port) - { - New-VerboseMessage -Message "Listener port set to $Port" - $newListenerParams += @{ - Port = $Port - } - } - - if ($DHCP -and $IpAddress.Count -gt 0) - { - New-VerboseMessage -Message "Listener set to DHCP with subnet $IpAddress" - $newListenerParams += @{ - DhcpSubnet = [string]$IpAddress - } - } - elseif (-not $DHCP -and $IpAddress.Count -gt 0) - { - New-VerboseMessage -Message "Listener set to static IP-address(es); $($IpAddress -join ', ')" - $newListenerParams += @{ - StaticIp = $IpAddress - } - } - else - { - New-VerboseMessage -Message 'Listener using DHCP with server default subnet' - } - - New-SqlAvailabilityGroupListener @newListenerParams -ErrorAction Stop | Out-Null - } - else - { - throw New-TerminatingError -ErrorType AvailabilityGroupNotFound -FormatArgs @($AvailabilityGroup,$InstanceName) -ErrorCategory ObjectNotFound - } - } - else - { - New-VerboseMessage -Message "Remove listener from $AvailabilityGroup" - - $sqlServerObject = Connect-SQL -SQLServer $NodeName -SQLInstanceName $InstanceName - - $availabilityGroupObject = $sqlServerObject.AvailabilityGroups[$AvailabilityGroup] - if ($availabilityGroupObject) - { - $availabilityGroupListenerObject = $availabilityGroupObject.AvailabilityGroupListeners[$Name] - if ($availabilityGroupListenerObject) - { - $availabilityGroupListenerObject.Drop() - } - else - { - throw New-TerminatingError -ErrorType AvailabilityGroupListenerNotFound -ErrorCategory ObjectNotFound - } - } - else - { - throw New-TerminatingError -ErrorType AvailabilityGroupNotFound -FormatArgs @($AvailabilityGroup,$InstanceName) -ErrorCategory ObjectNotFound - } - } - } - else - { - if ($Ensure -ne '') - { - New-VerboseMessage -Message "State is already $Ensure" - } - - if ($availabilityGroupListenerState.Ensure -eq 'Present') - { - if (-not $DHCP -and $availabilityGroupListenerState.IpAddress.Count -lt $IpAddress.Count) # Only able to add a new IP-address, not change existing ones. - { - New-VerboseMessage -Message 'Found at least one new IP-address.' - $ipAddressEqual = $false - } - else - { - # No new IP-address - if ($null -eq $IpAddress -or -not ( Compare-Object -ReferenceObject $IpAddress -DifferenceObject $availabilityGroupListenerState.IpAddress)) - { - $ipAddressEqual = $true - } - else - { - throw New-TerminatingError -ErrorType AvailabilityGroupListenerIPChangeError -FormatArgs @($($IpAddress -join ', '),$($availabilityGroupListenerState.IpAddress -join ', ')) -ErrorCategory InvalidOperation - } - } - - if ($($PSBoundParameters.ContainsKey('DHCP')) -and $availabilityGroupListenerState.DHCP -ne $DHCP) - { - throw New-TerminatingError -ErrorType AvailabilityGroupListenerDHCPChangeError -FormatArgs @( $DHCP, $($availabilityGroupListenerState.DHCP) ) -ErrorCategory InvalidOperation - } - - $sqlServerObject = Connect-SQL -SQLServer $NodeName -SQLInstanceName $InstanceName - - $availabilityGroupObject = $sqlServerObject.AvailabilityGroups[$AvailabilityGroup] - if ($availabilityGroupObject) - { - $availabilityGroupListenerObject = $availabilityGroupObject.AvailabilityGroupListeners[$Name] - if ($availabilityGroupListenerObject) - { - if ($availabilityGroupListenerState.Port -ne $Port -or -not $ipAddressEqual) - { - New-VerboseMessage -Message 'Listener differ in configuration.' - - if ($availabilityGroupListenerState.Port -ne $Port) - { - New-VerboseMessage -Message 'Changing port configuration' - - $setListenerParams = @{ - InputObject = $availabilityGroupListenerObject - Port = $Port - } - - Set-SqlAvailabilityGroupListener @setListenerParams -ErrorAction Stop | Out-Null - } - - if (-not $ipAddressEqual) - { - New-VerboseMessage -Message 'Adding IP-address(es)' - - $newIpAddress = @() - - foreach ($currentIpAddress in $IpAddress) - { - if (-not ( $availabilityGroupListenerState.IpAddress -contains $currentIpAddress)) - { - $newIpAddress += $currentIpAddress - } - } - - $setListenerParams = @{ - InputObject = $availabilityGroupListenerObject - StaticIp = $newIpAddress - } - - Add-SqlAvailabilityGroupListenerStaticIp @setListenerParams -ErrorAction Stop | Out-Null - } - } - else - { - New-VerboseMessage -Message 'Listener configuration is already correct.' - } - } - else - { - throw New-TerminatingError -ErrorType AvailabilityGroupListenerNotFound -ErrorCategory ObjectNotFound - } - } - else - { - throw New-TerminatingError -ErrorType AvailabilityGroupNotFound -FormatArgs @($AvailabilityGroup,$InstanceName) -ErrorCategory ObjectNotFound - } - } - } - } - else - { - throw New-TerminatingError -ErrorType UnexpectedErrorFromGet -ErrorCategory InvalidResult - } -} - -<# - .SYNOPSIS - Tests if the the Availability Group listener is in desired state. - - .PARAMETER InstanceName - The SQL Server instance name of the primary replica. Default value is 'MSSQLSERVER'. - - .PARAMETER NodeName - The host name or FQDN of the primary replica. - - .PARAMETER Name - The name of the availability group listener, max 15 characters. This name will be used as the Virtual Computer Object (VCO). - - .PARAMETER Ensure - If the availability group listener should be present or absent. - - .PARAMETER AvailabilityGroup - The name of the availability group to which the availability group listener is or will be connected. - - .PARAMETER IpAddress - The IP address used for the availability group listener, in the format 192.168.10.45/255.255.252.0. If using DCHP, set to the first IP-address of the DHCP subnet, in the format 192.168.8.1/255.255.252.0. Must be valid in the cluster-allowed IP range. - - .PARAMETER Port - The port used for the availability group listener. - - .PARAMETER DHCP - If DHCP should be used for the availability group listener instead of static IP address. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $InstanceName, - - [Parameter(Mandatory = $true)] - [System.String] - $NodeName, - - [Parameter(Mandatory = $true)] - [ValidateLength(1,15)] - [System.String] - $Name, - - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present', - - [Parameter(Mandatory = $true)] - [System.String] - $AvailabilityGroup, - - [System.String[]] - $IpAddress, - - [System.UInt16] - $Port, - - [System.Boolean] - $DHCP - ) - - $parameters = @{ - InstanceName = [System.String] $InstanceName - NodeName = [System.String] $NodeName - Name = [System.String] $Name - AvailabilityGroup = [System.String] $AvailabilityGroup - } - - New-VerboseMessage -Message "Testing state of listener $Name" - - $availabilityGroupListenerState = Get-TargetResource @parameters - if ($null -ne $availabilityGroupListenerState) - { - if ($null -eq $IpAddress -or ($null -ne $availabilityGroupListenerState.IpAddress -and -not ( Compare-Object -ReferenceObject $IpAddress -DifferenceObject $availabilityGroupListenerState.IpAddress))) - { - $ipAddressEqual = $true - } - else - { - $ipAddressEqual = $false - } - - [System.Boolean] $result = $false - if ($availabilityGroupListenerState.Ensure -eq $Ensure) - { - if ($Ensure -eq 'Absent') - { - $result = $true - } - } - - if (-not $($PSBoundParameters.ContainsKey('Ensure')) -or $Ensure -eq 'Present') - { - if (($Port -eq "" -or $availabilityGroupListenerState.Port -eq $Port) -and - $ipAddressEqual -and - (-not $($PSBoundParameters.ContainsKey('DHCP')) -or $availabilityGroupListenerState.DHCP -eq $DHCP)) - { - $result = $true - } - } - } - else - { - throw New-TerminatingError -ErrorType UnexpectedErrorFromGet -ErrorCategory InvalidResult - } - - return $result -} - -function Get-SQLAlwaysOnAvailabilityGroupListener -{ - [CmdletBinding()] - [OutputType()] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [System.String] - $AvailabilityGroup, - - [Parameter(Mandatory = $true)] - [System.String] - $InstanceName, - - [Parameter(Mandatory = $true)] - [System.String] - $NodeName - ) - - Write-Debug "Connecting to availability group $Name as $([System.Security.Principal.WindowsIdentity]::GetCurrent().Name)" - - $sqlServerObject = Connect-SQL -SQLServer $NodeName -SQLInstanceName $InstanceName - - $availabilityGroupObject = $sqlServerObject.AvailabilityGroups[$AvailabilityGroup] - if ($availabilityGroupObject) - { - $availabilityGroupListener = $availabilityGroupObject.AvailabilityGroupListeners[$Name] - } - else - { - throw New-TerminatingError -ErrorType AvailabilityGroupNotFound -FormatArgs @($AvailabilityGroup,$InstanceName) -ErrorCategory ObjectNotFound - } - - return $availabilityGroupListener -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAvailabilityGroupListener/MSFT_xSQLServerAvailabilityGroupListener.schema.mof b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAvailabilityGroupListener/MSFT_xSQLServerAvailabilityGroupListener.schema.mof deleted file mode 100644 index 41b7db59..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerAvailabilityGroupListener/MSFT_xSQLServerAvailabilityGroupListener.schema.mof +++ /dev/null @@ -1,14 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xSQLServerAvailabilityGroupListener")] -class MSFT_xSQLServerAvailabilityGroupListener : OMI_BaseResource -{ - [Key, Description("The SQL Server instance name of the primary replica.")] String InstanceName; - [Required, Description("The host name or FQDN of the primary replica.")] String NodeName; - [Required, Description("The name of the availability group listener, max 15 characters. This name will be used as the Virtual Computer Object (VCO).")] String Name; - [Write, Description("If the availability group listener should be present or absent. Default value is 'Present'."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Key, Description("The name of the availability group to which the availability group listener is or will be connected.")] String AvailabilityGroup; - [Write, Description("The IP address used for the availability group listener, in the format 192.168.10.45/255.255.252.0. If using DCHP, set to the first IP-address of the DHCP subnet, in the format 192.168.8.1/255.255.252.0. Must be valid in the cluster-allowed IP range.")] String IpAddress[]; - [Write, Description("The port used for the availability group listener")] UInt16 Port; - [Write, Description("If DHCP should be used for the availability group listener instead of static IP address.")] Boolean DHCP; -}; - diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerConfiguration/MSFT_xSQLServerConfiguration.psm1 b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerConfiguration/MSFT_xSQLServerConfiguration.psm1 deleted file mode 100644 index 4a646724..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerConfiguration/MSFT_xSQLServerConfiguration.psm1 +++ /dev/null @@ -1,213 +0,0 @@ -# Load Common Code -Import-Module -Name (Join-Path -Path (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent) ` - -ChildPath 'xSQLServerHelper.psm1') ` - -Force -<# - .SYNOPSIS - Gets the current value of a SQL configuration option - - .PARAMETER SQLServer - Hostname of the SQL Server to be configured - - .PARAMETER SQLInstanceName - Name of the SQL instance to be configued. Default is 'MSSQLSERVER' - - .PARAMETER OptionName - The name of the SQL configuration option to be checked - - .PARAMETER OptionValue - The desired value of the SQL configuration option - - .PARAMETER RestartService - *** Not used in this function *** - Determines whether the instance should be restarted after updating the configuration option. - - .PARAMETER RestartTimeout - *** Not used in this function *** - The length of time, in seconds, to wait for the service to restart. Default is 120 seconds. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([Hashtable])] - param( - [Parameter(Mandatory = $true)] - [String] - $SQLServer, - - [Parameter(Mandatory = $true)] - [String] - $SQLInstanceName, - - [Parameter(Mandatory = $true)] - [String] - $OptionName, - - [Parameter(Mandatory = $true)] - [Int32] - $OptionValue, - - [Boolean] - $RestartService = $false, - - [Int32] - $RestartTimeout = 120 - ) - - $sql = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName - - ## get the configuration option - $option = $sql.Configuration.Properties | Where-Object { $_.DisplayName -eq $OptionName } - - if(!$option) - { - throw New-TerminatingError -ErrorType "ConfigurationOptionNotFound" -FormatArgs $OptionName -ErrorCategory InvalidArgument - } - - return @{ - SqlServer = $SQLServer - SQLInstanceName = $SQLInstanceName - OptionName = $option.DisplayName - OptionValue = $option.ConfigValue - RestartService = $RestartService - RestartTimeout = $RestartTimeout - } -} - -<# - .SYNOPSIS - Sets the value of a SQL configuration option - - .PARAMETER SQLServer - Hostname of the SQL Server to be configured - - .PARAMETER SQLInstanceName - Name of the SQL instance to be configued. Default is 'MSSQLSERVER' - - .PARAMETER OptionName - The name of the SQL configuration option to be set - - .PARAMETER OptionValue - The desired value of the SQL configuration option - - .PARAMETER RestartService - Determines whether the instance should be restarted after updating the configuration option - - .PARAMETER RestartTimeout - The length of time, in seconds, to wait for the service to restart. Default is 120 seconds. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [String] - $SQLServer, - - [Parameter(Mandatory = $true)] - [String] - $SQLInstanceName, - - [Parameter(Mandatory = $true)] - [String] - $OptionName, - - [Parameter(Mandatory = $true)] - [Int32] - $OptionValue, - - [Boolean] - $RestartService = $false, - - [Int32] - $RestartTimeout = 120 - ) - - $sql = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName - - ## get the configuration option - $option = $sql.Configuration.Properties | Where-Object { $_.DisplayName -eq $OptionName } - - if(!$option) - { - throw New-TerminatingError -ErrorType "ConfigurationOptionNotFound" -FormatArgs $OptionName -ErrorCategory InvalidArgument - } - - $option.ConfigValue = $OptionValue - $sql.Configuration.Alter() - - if ($option.IsDynamic -eq $true) - { - New-VerboseMessage -Message 'Configuration option has been updated.' - } - elseif (($option.IsDynamic -eq $false) -and ($RestartService -eq $true)) - { - New-VerboseMessage -Message 'Configuration option has been updated, restarting instance...' - Restart-SqlService -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName -Timeout $RestartTimeout - } - else - { - New-WarningMessage -WarningType 'ConfigurationRestartRequired' -FormatArgs $OptionName - } -} - -<# - .SYNOPSIS - Determines whether a SQL configuration option value is properly set - - .PARAMETER SQLServer - Hostname of the SQL Server to be configured - - .PARAMETER SQLInstanceName - Name of the SQL instance to be configued. Default is 'MSSQLSERVER' - - .PARAMETER OptionName - The name of the SQL configuration option to be tested - - .PARAMETER OptionValue - The desired value of the SQL configuration option - - .PARAMETER RestartService - *** Not used in this function *** - Determines whether the instance should be restarted after updating the configuration option - - .PARAMETER RestartTimeout - *** Not used in this function *** - The length of time, in seconds, to wait for the service to restart. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([Boolean])] - param( - [Parameter(Mandatory = $true)] - [String] - $SQLServer, - - [Parameter(Mandatory = $true)] - [String] - $SQLInstanceName, - - [Parameter(Mandatory = $true)] - [String] - $OptionName, - - [Parameter(Mandatory = $true)] - [Int32] - $OptionValue, - - [Boolean] - $RestartService = $false, - - [Int32] - $RestartTimeout = 120 - ) - - ## Get the current state of the configuration item - $state = Get-TargetResource @PSBoundParameters - - ## return whether the value matches the desired state - return ($state.OptionValue -eq $OptionValue) -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerConfiguration/MSFT_xSQLServerConfiguration.schema.mof b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerConfiguration/MSFT_xSQLServerConfiguration.schema.mof deleted file mode 100644 index e90976a7..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerConfiguration/MSFT_xSQLServerConfiguration.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSQLServerConfiguration")] -class MSFT_xSQLServerConfiguration : OMI_BaseResource -{ - [Key, Description("The hostname of the SQL Server to be configured.")] String SQLServer; - [Key, Description("Name of the SQL instance to be configured.")] String SQLInstanceName; - [Key, Description("The name of the SQL configuration option to be checked.")] String OptionName; - [Required, Description("The desired value of the SQL configuration option.")] Sint32 OptionValue; - [Write, Description("Determines whether the instance should be restarted after updating the configuration option.")] Boolean RestartService; - [Write, Description("The length of time, in seconds, to wait for the service to restart. Default is 120 seconds.")] Sint32 RestartTimeout; -}; diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabase/MSFT_xSQLServerDatabase.psm1 b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabase/MSFT_xSQLServerDatabase.psm1 deleted file mode 100644 index ca523ffb..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabase/MSFT_xSQLServerDatabase.psm1 +++ /dev/null @@ -1,245 +0,0 @@ -Import-Module -Name (Join-Path -Path (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent) ` - -ChildPath 'xSQLServerHelper.psm1') ` - -Force -<# - .SYNOPSIS - This function gets the sql database. - - .PARAMETER Ensure - When set to 'Present', the database will be created. - When set to 'Absent', the database will be dropped. - - .PARAMETER Name - The name of database to be created or dropped. - - .PARAMETER SQLServer - The host name of the SQL Server to be configured. - - .PARAMETER SQLInstanceName - The name of the SQL instance to be configured. -#> - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter()] - [ValidateSet('Present','Absent')] - [ValidateNotNullOrEmpty()] - [System.String] - $Ensure = 'Present', - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLServer, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLInstanceName - ) - - $sqlServerObject = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName - - if ($sqlServerObject) - { - Write-Verbose -Message 'Getting SQL Databases' - # Check database exists - $sqlDatabaseObject = $sqlServerObject.Databases[$Name] - - if ($sqlDatabaseObject) - { - Write-Verbose -Message "SQL Database name $Name is present" - $Ensure = 'Present' - } - else - { - Write-Verbose -Message "SQL Database name $Name is absent" - $Ensure = 'Absent' - } - } - - $returnValue = @{ - Name = $Name - Ensure = $Ensure - SQLServer = $SQLServer - SQLInstanceName = $SQLInstanceName - } - - $returnValue -} - -<# - .SYNOPSIS - This function create or delete a database in the SQL Server instance provided. - - .PARAMETER Ensure - When set to 'Present', the database will be created. - When set to 'Absent', the database will be dropped. - - .PARAMETER Name - The name of database to be created or dropped. - - .PARAMETER SQLServer - The host name of the SQL Server to be configured. - - .PARAMETER SQLInstanceName - The name of the SQL instance to be configured. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter()] - [ValidateSet('Present','Absent')] - [ValidateNotNullOrEmpty()] - [System.String] - $Ensure = 'Present', - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLServer, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLInstanceName - ) - - $sqlServerObject = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName - - if ($sqlServerObject) - { - if ($Ensure -eq 'Present') - { - try - { - $sqlDatabaseObjectToCreate = New-Object -TypeName Microsoft.SqlServer.Management.Smo.Database -ArgumentList $sqlServerObject,$Name - if ($sqlDatabaseObjectToCreate) - { - Write-Verbose -Message "Adding to SQL the database $Name" - $sqlDatabaseObjectToCreate.Create() - New-VerboseMessage -Message "Created Database $Name" - } - } - catch - { - throw New-TerminatingError -ErrorType CreateDatabaseSetError ` - -FormatArgs @($SQLServer,$SQLInstanceName,$Name) ` - -ErrorCategory InvalidOperation ` - -InnerException $_.Exception - } - } - else - { - try - { - $sqlDatabaseObjectToDrop = $sqlServerObject.Databases[$Name] - if ($sqlDatabaseObjectToDrop) - { - Write-Verbose -Message "Deleting to SQL the database $Name" - $sqlDatabaseObjectToDrop.Drop() - New-VerboseMessage -Message "Dropped Database $Name" - } - } - catch - { - throw New-TerminatingError -ErrorType DropDatabaseSetError ` - -FormatArgs @($SQLServer,$SQLInstanceName,$Name) ` - -ErrorCategory InvalidOperation ` - -InnerException $_.Exception - } - } - } -} - -<# - .SYNOPSIS - This function tests if the sql database is already created or dropped. - - .PARAMETER Ensure - When set to 'Present', the database will be created. - When set to 'Absent', the database will be dropped. - - .PARAMETER Name - The name of database to be created or dropped. - - .PARAMETER SQLServer - The host name of the SQL Server to be configured. - - .PARAMETER SQLInstanceName - The name of the SQL instance to be configured. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter()] - [ValidateSet('Present','Absent')] - [ValidateNotNullOrEmpty()] - [System.String] - $Ensure = 'Present', - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLServer, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLInstanceName - ) - - Write-Verbose -Message "Checking if database named $Name is present or absent" - - $getTargetResourceResult = Get-TargetResource @PSBoundParameters - $isDatabaseInDesiredState = $true - - switch ($Ensure) - { - 'Absent' - { - if ($getTargetResourceResult.Ensure -ne 'Absent') - { - New-VerboseMessage -Message "Ensure is set to Absent. The database $Name should be dropped" - $isDatabaseInDesiredState = $false - } - } - - 'Present' - { - if ($getTargetResourceResult.Ensure -ne 'Present') - { - New-VerboseMessage -Message "Ensure is set to Present. The database $Name should be created" - $isDatabaseInDesiredState = $false - } - } - } - - $isDatabaseInDesiredState -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabase/MSFT_xSQLServerDatabase.schema.mof b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabase/MSFT_xSQLServerDatabase.schema.mof deleted file mode 100644 index 442e02a0..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabase/MSFT_xSQLServerDatabase.schema.mof +++ /dev/null @@ -1,8 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSQLServerDatabase")] -class MSFT_xSQLServerDatabase : OMI_BaseResource -{ - [Key, Description("The name of the SQL database.")] String Name; - [Write, Description("An enumerated value that describes if the database is added (Present) or dropped (Absent). Valid values are 'Present' or 'Absent'. Default Value is 'Present'."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Key, Description("The host name of the SQL Server to be configured.")] String SQLServer; - [Key, Description("The name of the SQL instance to be configured.")] String SQLInstanceName; -}; diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabaseOwner/MSFT_xSQLServerDatabaseOwner.psm1 b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabaseOwner/MSFT_xSQLServerDatabaseOwner.psm1 deleted file mode 100644 index db4a63ed..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabaseOwner/MSFT_xSQLServerDatabaseOwner.psm1 +++ /dev/null @@ -1,208 +0,0 @@ -Import-Module -Name (Join-Path -Path (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent) ` - -ChildPath 'xSQLServerHelper.psm1') ` - -Force -<# - .SYNOPSIS - This function gets the owner of the desired sql database. - - .PARAMETER Database - The name of database to be configured. - - .PARAMETER Name - The name of the login that will become a owner of the desired sql database. - - .PARAMETER SQLServer - The host name of the SQL Server to be configured. - - .PARAMETER SQLInstanceName - The name of the SQL instance to be configured. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Database, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLServer = $env:COMPUTERNAME, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLInstanceName = 'MSSQLSERVER' - ) - - Write-Verbose -Message "Getting owner of database $Database" - $sqlServerObject = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName - - if ($sqlServerObject) - { - # Check database exists - if ( -not ($sqlDatabaseObject = $sqlServerObject.Databases[$Database]) ) - { - throw New-TerminatingError -ErrorType NoDatabase ` - -FormatArgs @($Database, $SQLServer, $SQLInstanceName) ` - -ErrorCategory ObjectNotFound - } - - try - { - $sqlDatabaseOwner = $sqlDatabaseObject.Owner - New-VerboseMessage -Message "Owner for SQL Database name $Database is $sqlDatabaseOwner" - } - catch - { - throw New-TerminatingError -ErrorType FailedToGetOwnerDatabase ` - -FormatArgs @($Database, $SQLServer, $SQLInstanceName) ` - -ErrorCategory InvalidOperation - } - } - - $returnValue = @{ - Database = $Database - Name = $sqlDatabaseOwner - SQLServer = $SQLServer - SQLInstanceName = $SQLInstanceName - } - - $returnValue -} - -<# - .SYNOPSIS - This function sets the owner of the desired sql database. - - .PARAMETER Database - The name of database to be configured. - - .PARAMETER Name - The name of the login that will become a owner of the desired sql database. - - .PARAMETER SQLServer - The host name of the SQL Server to be configured. - - .PARAMETER SQLInstanceName - The name of the SQL instance to be configured. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Database, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLServer = $env:COMPUTERNAME, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLInstanceName = 'MSSQLSERVER' - ) - - Write-Verbose -Message "Setting owner $Name of database $Database" - $sqlServerObject = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName - - if($sqlServerObject) - { - # Check database exists - if ( -not ($sqlDatabaseObject = $sqlServerObject.Databases[$Database]) ) - { - throw New-TerminatingError -ErrorType NoDatabase -FormatArgs @($Database, $SQLServer, $SQLInstanceName) -ErrorCategory ObjectNotFound - } - - # Check login exists - if ( -not ($sqlServerObject.Logins[$Name]) ) - { - throw New-TerminatingError -ErrorType LoginNotFound -FormatArgs @($Name, $SQLServer, $SQLInstanceName) -ErrorCategory ObjectNotFound - } - - try - { - $sqlDatabaseObject.SetOwner($Name) - New-VerboseMessage -Message "Owner of SQL Database name $Database is now $Name" - } - catch - { - throw New-TerminatingError -ErrorType FailedToSetOwnerDatabase ` - -FormatArgs @($Name, $Database, $SQLServer, $SQLInstanceName) ` - -ErrorCategory InvalidOperation ` - -InnerException $_.Exception - } - } -} - -<# - .SYNOPSIS - This function tests the owner of the desired sql database. - - .PARAMETER Database - The name of database to be configured. - - .PARAMETER Name - The name of the login that will become a owner of the desired sql database. - - .PARAMETER SQLServer - The host name of the SQL Server to be configured. - - .PARAMETER SQLInstanceName - The name of the SQL instance to be configured. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Database, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLServer = $env:COMPUTERNAME, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLInstanceName = 'MSSQLSERVER' - ) - - Write-Verbose -Message "Testing owner $Name of database $Database" - - $currentValues = Get-TargetResource @PSBoundParameters - return Test-SQLDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @('Name', 'Database') -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabaseOwner/MSFT_xSQLServerDatabaseOwner.schema.mof b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabaseOwner/MSFT_xSQLServerDatabaseOwner.schema.mof deleted file mode 100644 index 552d2262..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabaseOwner/MSFT_xSQLServerDatabaseOwner.schema.mof +++ /dev/null @@ -1,8 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSQLServerDatabaseOwner")] -class MSFT_xSQLServerDatabaseOwner : OMI_BaseResource -{ - [Key, Description("The name of database to be configured.")] String Database; - [Required, Description("The name of the login that will become a owner of the desired sql database.")] String Name; - [Write, Description("The host name of the SQL Server to be configured.")] String SQLServer; - [Write, Description("The name of the SQL instance to be configured.")] String SQLInstanceName; -}; diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabasePermission/MSFT_xSQLServerDatabasePermission.psm1 b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabasePermission/MSFT_xSQLServerDatabasePermission.psm1 deleted file mode 100644 index f0614f32..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabasePermission/MSFT_xSQLServerDatabasePermission.psm1 +++ /dev/null @@ -1,278 +0,0 @@ -Import-Module -Name (Join-Path -Path (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent) -ChildPath 'xSQLServerHelper.psm1') -Force - -<# - .SYNOPSIS - Returns the current permissions for the user in the database - - .PARAMETER Ensure - This is The Ensure if the permission should be granted (Present) or revoked (Absent) - Not used in Get-TargetResource - - .PARAMETER Database - This is the SQL database - - .PARAMETER Name - This is the name of the SQL login for the permission set - - .PARAMETER PermissionState - This is the state of permission set. Valid values are 'Grant' or 'Deny' - - .PARAMETER Permissions - This is a list that represents a SQL Server set of database permissions - - .PARAMETER SQLServer - This is the SQL Server for the database - - .PARAMETER SQLInstanceName - This is the SQL instance for the database -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [ValidateSet('Present','Absent')] - [System.String] - $Ensure, - - [parameter(Mandatory = $true)] - [System.String] - $Database, - - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [ValidateSet('Grant','Deny')] - [System.String] - $PermissionState, - - [parameter(Mandatory = $true)] - [System.String[]] - $Permissions, - - [parameter(Mandatory = $true)] - [System.String] - $SQLServer = $env:COMPUTERNAME, - - [parameter(Mandatory = $true)] - [System.String] - $SQLInstanceName = 'MSSQLSERVER' - ) - - $sqlServerObject = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName - - if ($sqlServerObject) - { - Write-Verbose -Message "Getting permissions for user '$Name' in database '$Database'" - $getSqlDatabasePermissionResult = Get-SqlDatabasePermission -SqlServerObject $sqlServerObject ` - -Name $Name ` - -Database $Database ` - -PermissionState $PermissionState - - if ($getSqlDatabasePermissionResult) - { - $resultOfPermissionCompare = Compare-Object -ReferenceObject $Permissions ` - -DifferenceObject $getSqlDatabasePermissionResult - if ($null -eq $resultOfPermissionCompare) - { - $Ensure = 'Present' - } - else - { - $Ensure = 'Absent' - } - } - else - { - $Ensure = 'Absent' - } - } - else - { - throw New-TerminatingError -ErrorType ConnectSQLError ` - -FormatArgs @($SQLServer,$SQLInstanceName) ` - -ErrorCategory InvalidOperation - } - - $returnValue = @{ - Ensure = $Ensure - Database = $Database - Name = $Name - PermissionState = $PermissionState - Permissions = $getSqlDatabasePermissionResult - SQLServer = $SQLServer - SQLInstanceName = $SQLInstanceName - } - - $returnValue -} - -<# - .SYNOPSIS - Sets the permissions for the user in the database. - - .PARAMETER Ensure - This is The Ensure if the permission should be granted (Present) or revoked (Absent) - - .PARAMETER Database - This is the SQL database - - .PARAMETER Name - This is the name of the SQL login for the permission set - - .PARAMETER PermissionState - This is the state of permission set. Valid values are 'Grant' or 'Deny' - - .PARAMETER Permissions - This is a list that represents a SQL Server set of database permissions - - .PARAMETER SQLServer - This is the SQL Server for the database - - .PARAMETER SQLInstanceName - This is the SQL instance for the database -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present', - - [parameter(Mandatory = $true)] - [System.String] - $Database, - - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [ValidateSet('Grant','Deny')] - [System.String] - $PermissionState, - - [parameter(Mandatory = $true)] - [System.String[]] - $Permissions, - - [parameter(Mandatory = $true)] - [System.String] - $SQLServer = $env:COMPUTERNAME, - - [parameter(Mandatory = $true)] - [System.String] - $SQLInstanceName = 'MSSQLSERVER' - ) - - $sqlServerObject = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName - - if ($sqlServerObject) - { - Write-Verbose -Message "Setting permissions of database '$Database' for login '$Name'" - - if ($Ensure -eq 'Present') - { - Add-SqlDatabasePermission -SqlServerObject $sqlServerObject ` - -Name $Name ` - -Database $Database ` - -PermissionState $PermissionState ` - -Permissions $Permissions - - New-VerboseMessage -Message "$PermissionState - SQL Permissions for $Name, successfullly added in $Database" - } - else - { - Remove-SqlDatabasePermission -SqlServerObject $sqlServerObject ` - -Name $Name ` - -Database $Database ` - -PermissionState $PermissionState ` - -Permissions $Permissions - - New-VerboseMessage -Message "$PermissionState - SQL Permissions for $Name, successfullly removed in $Database" - } - } - else - { - throw New-TerminatingError -ErrorType ConnectSQLError ` - -FormatArgs @($SQLServer,$SQLInstanceName) ` - -ErrorCategory InvalidOperation - } -} - -<# - .SYNOPSIS - Tests if the permissions is set for the user in the database - - .PARAMETER Ensure - This is The Ensure if the permission should be granted (Present) or revoked (Absent) - - .PARAMETER Database - This is the SQL database - - .PARAMETER Name - This is the name of the SQL login for the permission set - - .PARAMETER PermissionState - This is the state of permission set. Valid values are 'Grant' or 'Deny' - - .PARAMETER Permissions - This is a list that represents a SQL Server set of database permissions - - .PARAMETER SQLServer - This is the SQL Server for the database - - .PARAMETER SQLInstanceName - This is the SQL instance for the database -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present', - - [parameter(Mandatory = $true)] - [System.String] - $Database, - - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [ValidateSet('Grant','Deny')] - [System.String] - $PermissionState, - - [parameter(Mandatory = $true)] - [System.String[]] - $Permissions, - - [parameter(Mandatory = $true)] - [System.String] - $SQLServer = $env:COMPUTERNAME, - - [parameter(Mandatory = $true)] - [System.String] - $SQLInstanceName = 'MSSQLSERVER' - ) - - Write-Verbose -Message "Evaluating permissions for user '$Name' in database '$Database'." - - $getTargetResourceResult = Get-TargetResource @PSBoundParameters - - return Test-SQLDscParameterState -CurrentValues $getTargetResourceResult ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @('Name', 'Ensure', 'PermissionState', 'Permissions') -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabasePermission/MSFT_xSQLServerDatabasePermission.schema.mof b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabasePermission/MSFT_xSQLServerDatabasePermission.schema.mof deleted file mode 100644 index 5d58b58a..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabasePermission/MSFT_xSQLServerDatabasePermission.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSQLServerDatabasePermission")] -class MSFT_xSQLServerDatabasePermission : OMI_BaseResource -{ - [Write, Description("If the values should be present or absent. Valid values are 'Present' or 'Absent'."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Key, Description("The name of the database.")] String Database; - [Key, Description("The name of the user that should be granted or denied the permission.")] String Name; - [Key, Description("The state of the permission. Valid values are 'Grant' or 'Deny'."), ValueMap{"Grant","Deny"}, Values{"Grant","Deny"}] String PermissionState; - [Required, Description("The set of permissions for the SQL database.")] String Permissions[]; - [Key, Description("The host name of the SQL Server to be configured.")] String SQLServer; - [Key, Description("The name of the SQL instance to be configured.")] String SQLInstanceName; -}; diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabaseRecoveryModel/MSFT_xSQLServerDatabaseRecoveryModel.psm1 b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabaseRecoveryModel/MSFT_xSQLServerDatabaseRecoveryModel.psm1 deleted file mode 100644 index 0c377d6b..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabaseRecoveryModel/MSFT_xSQLServerDatabaseRecoveryModel.psm1 +++ /dev/null @@ -1,199 +0,0 @@ -Import-Module -Name (Join-Path -Path (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent) ` - -ChildPath 'xSQLServerHelper.psm1') ` - -Force -<# - .SYNOPSIS - This function gets all Key properties defined in the resource schema file - - .PARAMETER Database - This is the SQL database - - .PARAMETER RecoveryModel - This is the RecoveryModel of the SQL database - - .PARAMETER SQLServer - This is a the SQL Server for the database - - .PARAMETER SQLInstanceName - This is a the SQL instance for the database -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Full','Simple','BulkLogged')] - [ValidateNotNullOrEmpty()] - [System.String] - $RecoveryModel, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLServer, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLInstanceName, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name - ) - - $sqlServerObject = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName - - if ($sqlServerObject) - { - Write-Verbose -Message "Getting RecoveryModel of SQL database '$Name'" - $sqlDatabaseObject = $sqlServerObject.Databases[$Name] - - if ($sqlDatabaseObject) - { - $sqlDatabaseRecoveryModel = $sqlDatabaseObject.RecoveryModel - New-VerboseMessage -Message "The current recovery model used by database $Name is '$sqlDatabaseRecoveryModel'" - } - else - { - throw New-TerminatingError -ErrorType NoDatabase ` - -FormatArgs @($Name,$sqlServer,$sqlInstanceName) ` - -ErrorCategory InvalidResult - } - } - - $returnValue = @{ - Name = $Name - RecoveryModel = $sqlDatabaseRecoveryModel - SQLServer = $SQLServer - SQLInstanceName = $SQLInstanceName - } - - $returnValue -} - -<# - .SYNOPSIS - This function gets all Key properties defined in the resource schema file - - .PARAMETER Database - This is the SQL database - - .PARAMETER RecoveryModel - This is the RecoveryModel of the SQL database - - .PARAMETER SQLServer - This is a the SQL Server for the database - - .PARAMETER SQLInstanceName - This is a the SQL instance for the database -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Full','Simple','BulkLogged')] - [ValidateNotNullOrEmpty()] - [System.String] - $RecoveryModel, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLServer, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLInstanceName, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name - ) - - $sqlServerObject = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName - - if ($sqlServerObject) - { - Write-Verbose -Message "Setting RecoveryModel of SQL database '$Name'" - $sqlDatabaseObject = $sqlServerObject.Databases[$Name] - - if ($sqlDatabaseObject) - { - if($sqlDatabaseObject.RecoveryModel -ne $RecoveryModel) - { - $sqlDatabaseObject.RecoveryModel = $RecoveryModel - $sqlDatabaseObject.Alter() - New-VerboseMessage -Message "The recovery model for the database $Name is changed to '$RecoveryModel'." - } - } - else - { - throw New-TerminatingError -ErrorType NoDatabase ` - -FormatArgs @($Name,$sqlServer,$sqlInstanceName) ` - -ErrorCategory InvalidResult - } - } -} - -<# - .SYNOPSIS - This function gets all Key properties defined in the resource schema file - - .PARAMETER Database - This is the SQL database - - .PARAMETER RecoveryModel - This is the RecoveryModel of the SQL database - - .PARAMETER SQLServer - This is a the SQL Server for the database - - .PARAMETER SQLInstanceName - This is a the SQL instance for the database -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateSet('Full','Simple','BulkLogged')] - [ValidateNotNullOrEmpty()] - [System.String] - $RecoveryModel, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLServer, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLInstanceName, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name - ) - - Write-Verbose -Message "Testing RecoveryModel of database '$Name'" - - $currentValues = Get-TargetResource @PSBoundParameters - - return Test-SQLDscParameterState -CurrentValues $currentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @('Name','RecoveryModel') -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabaseRecoveryModel/MSFT_xSQLServerDatabaseRecoveryModel.schema.mof b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabaseRecoveryModel/MSFT_xSQLServerDatabaseRecoveryModel.schema.mof deleted file mode 100644 index 0ffb09a9..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabaseRecoveryModel/MSFT_xSQLServerDatabaseRecoveryModel.schema.mof +++ /dev/null @@ -1,8 +0,0 @@ -[ClassVersion("1.0"), FriendlyName("xSQLServerDatabaseRecoveryModel")] -class MSFT_xSQLServerDatabaseRecoveryModel : OMI_BaseResource -{ - [Key, Description("The SQL database name")] String Name; - [Required, Description("The recovery model to use for the database."), ValueMap{"Full","Simple","BulkLogged"}, Values{"Full","Simple","BulkLogged"}] String RecoveryModel; - [Key, Description("The host name of the SQL Server to be configured.")] String SQLServer; - [Key, Description("The name of the SQL instance to be configured.")] String SQLInstanceName; -}; diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabaseRole/MSFT_xSQLServerDatabaseRole.psm1 b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabaseRole/MSFT_xSQLServerDatabaseRole.psm1 deleted file mode 100644 index c9c67b0b..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabaseRole/MSFT_xSQLServerDatabaseRole.psm1 +++ /dev/null @@ -1,377 +0,0 @@ -Import-Module -Name (Join-Path -Path (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent) ` - -ChildPath 'xSQLServerHelper.psm1') ` - -Force - -<# - .SYNOPSIS - Returns the current state of the user memberships in the role(s). - - .PARAMETER Ensure - Specifies the desired state of the membership of the role(s). - - .PARAMETER Name - Specifies the name of the login that evaluated if it is member of the role(s). - - .PARAMETER SQLServer - Specifies the SQL server on which the instance exist. - - .PARAMETER SQLInstanceName - Specifies the SQL instance in which the database exist. - - .PARAMETER Database - Specifies the database in which the login (user) and role(s) exist. - - .PARAMETER Role - Specifies one or more roles to which the login (user) will be evaluated if it should be added or removed. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLServer, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLInstanceName, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Database, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String[]] - $Role - ) - - Write-Verbose -Message "Getting SQL Database role for $Name" - - $sqlServerObject = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName - - if ($sqlServerObject) - { - # Check database exists - if ( -not ($sqlDatabaseObject = $sqlServerObject.Databases[$Database]) ) - { - throw New-TerminatingError -ErrorType NoDatabase ` - -FormatArgs @($Database, $SQLServer, $SQLInstanceName) ` - -ErrorCategory ObjectNotFound - } - - # Check role exists - foreach ($currentRole in $Role) - { - if( -not ($sqlDatabaseObject.Roles[$currentRole]) ) - { - throw New-TerminatingError -ErrorType RoleNotFound ` - -FormatArgs @($currentRole, $Database, $SQLServer, $SQLInstanceName) ` - -ErrorCategory ObjectNotFound - } - } - - # Check login exists - if ( -not ($sqlServerObject.Logins[$Name]) ) - { - throw New-TerminatingError -ErrorType LoginNotFound ` - -FormatArgs @($Name, $SQLServer, $SQLInstanceName) ` - -ErrorCategory ObjectNotFound - } - - $ensure = 'Absent' - $grantedRole = @() - - if ($sqlDatabaseUser = $sqlDatabaseObject.Users[$Name] ) - { - foreach ($currentRole in $Role) - { - if ($sqlDatabaseUser.IsMember($currentRole)) - { - New-VerboseMessage -Message ("The login '$Name' is a member of the role '$currentRole' on the " + ` - "database '$Database', on the instance $SQLServer\$SQLInstanceName") - - $grantedRole += $currentRole - } - else - { - New-VerboseMessage -Message ("The login '$Name' is not a member of the role '$currentRole' on the " + ` - "database '$Database', on the instance $SQLServer\$SQLInstanceName") - } - } - - if ( -not (Compare-Object -ReferenceObject $Role -DifferenceObject $grantedRole) ) - { - $ensure = 'Present' - } - } - else - { - New-VerboseMessage -Message ("The login '$Name' is not a user of the database " + ` - "'$Database' on the instance $SQLServer\$SQLInstanceName") - } - } - - $returnValue = @{ - Ensure = $ensure - Name = $Name - SQLServer = $SQLServer - SQLInstanceName = $SQLInstanceName - Database = $Database - Role = $grantedRole - } - - $returnValue -} - -<# - .SYNOPSIS - Adds the login (user) to each of the provided roles when Ensure is set to 'Present'. - When Ensure is set to 'Absent' the login (user) will be removed from each of the provided roles. - If the login does not exist as a user in the database, then the user will be created in the database using the login. - - .PARAMETER Ensure - Specifies the desired state of the membership of the role(s). - - .PARAMETER Name - Specifies the name of the login that evaluated if it is member of the role(s), if it is not it will be added. - If the login does not exist as a user, a user will be created using the login. - - .PARAMETER SQLServer - Specifies the SQL server on which the instance exist. - - .PARAMETER SQLInstanceName - Specifies the SQL instance in which the database exist. - - .PARAMETER Database - Specifies the database in which the login (user) and role(s) exist. - - .PARAMETER Role - Specifies one or more roles to which the login (user) will be added or removed. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter()] - [ValidateSet('Present','Absent')] - [ValidateNotNullOrEmpty()] - [System.String] - $Ensure = 'Present', - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLServer, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLInstanceName, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Database, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String[]] - $Role - ) - - Write-Verbose -Message "Setting SQL Database role for $Name" - - $sqlServerObject = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName - - if ($sqlServerObject) - { - $sqlDatabaseObject = $sqlServerObject.Databases[$Database] - - switch ($Ensure) - { - 'Present' - { - # Adding database user if it does not exist. - if ( -not ($sqlDatabaseObject.Users[$Name]) ) - { - try - { - New-VerboseMessage -Message ("Adding the login '$Name' as a user of the database " + ` - "'$Database', on the instance $SQLServer\$SQLInstanceName") - - $sqlDatabaseUser = New-Object -TypeName Microsoft.SqlServer.Management.Smo.User ` - -ArgumentList $SQLDatabase, $Name - $sqlDatabaseUser.Login = $Name - $sqlDatabaseUser.Create() - } - catch - { - throw New-TerminatingError -ErrorType AddLoginDatabaseSetError ` - -FormatArgs @($SQLServer,$SQLInstanceName,$Name,$Database) ` - -ErrorCategory InvalidOperation ` - -InnerException $_.Exception - } - } - - # Adding database user to the role. - foreach ($currentRole in $Role) - { - try - { - New-VerboseMessage -Message ("Adding the login '$Name' to the role '$currentRole' on the " + ` - "database '$Database', on the instance $SQLServer\$SQLInstanceName") - - $sqlDatabaseRole = $sqlDatabaseObject.Roles[$currentRole] - $sqlDatabaseRole.AddMember($Name) - } - catch - { - throw New-TerminatingError -ErrorType AddMemberDatabaseSetError ` - -FormatArgs @($SQLServer,$SQLInstanceName,$Name,$Role,$Database) ` - -ErrorCategory InvalidOperation ` - -InnerException $_.Exception - } - } - } - - 'Absent' - { - try - { - foreach ($currentRole in $Role) - { - New-VerboseMessage -Message ("Removing the login '$Name' to the role '$currentRole' on the " + ` - "database '$Database', on the instance $SQLServer\$SQLInstanceName") - - $sqlDatabaseRole = $sqlDatabaseObject.Roles[$currentRole] - $sqlDatabaseRole.DropMember($Name) - } - } - catch - { - throw New-TerminatingError -ErrorType DropMemberDatabaseSetError ` - -FormatArgs @($SQLServer,$SQLInstanceName,$Name,$Role,$Database) ` - -ErrorCategory InvalidOperation ` - -InnerException $_.Exception - } - } - } - } -} - -<# - .SYNOPSIS - Tests if the login (user) has the desired state in each of the provided roles. - - .PARAMETER Ensure - Specifies the desired state of the membership of the role(s). - - .PARAMETER Name - Specifies the name of the login that evaluated if it is member of the role(s). - - .PARAMETER SQLServer - Specifies the SQL server on which the instance exist. - - .PARAMETER SQLInstanceName - Specifies the SQL instance in which the database exist. - - .PARAMETER Database - Specifies the database in which the login (user) and role(s) exist. - - .PARAMETER Role - Specifies one or more roles to which the login (user) will be tested if it should added or removed. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter()] - [ValidateSet('Present','Absent')] - [ValidateNotNullOrEmpty()] - [System.String] - $Ensure = 'Present', - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLServer, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLInstanceName, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Database, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String[]] - $Role - ) - - Write-Verbose -Message "Testing SQL Database role for $Name" - - $getTargetResourceParameters = @{ - SQLInstanceName = $PSBoundParameters.SQLInstanceName - SQLServer = $PSBoundParameters.SQLServer - Role = $PSBoundParameters.Role - Database = $PSBoundParameters.Database - Name = $PSBoundParameters.Name - } - - $getTargetResourceResult = Get-TargetResource @getTargetResourceParameters - - $isDatabaseRoleInDesiredState = $true - - switch ($Ensure) - { - 'Absent' - { - if ($getTargetResourceResult.Ensure -ne 'Absent') - { - New-VerboseMessage -Message "Ensure is set to Absent. The existing role for $Name should be dropped" - $isDatabaseRoleInDesiredState = $false - } - } - - 'Present' - { - if ($getTargetResourceResult.Ensure -ne 'Present') - { - New-VerboseMessage -Message "Ensure is set to Present. The missing role for $Name should be added" - $isDatabaseRoleInDesiredState = $false - } - } - } - - $isDatabaseRoleInDesiredState -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabaseRole/MSFT_xSQLServerDatabaseRole.schema.mof b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabaseRole/MSFT_xSQLServerDatabaseRole.schema.mof deleted file mode 100644 index ef07952f..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerDatabaseRole/MSFT_xSQLServerDatabaseRole.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSQLServerDatabaseRole")] -class MSFT_xSQLServerDatabaseRole : OMI_BaseResource -{ - [Write, Description("If 'Present' (the default value) then the login (user) will be added to the role(s). If 'Absent' then the login (user) will be removed from the role(s)."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Key, Description("The name of the login that will become a member, or removed as a member, of the role(s).")] String Name; - [Key, Description("The host name of the SQL Server to be configured.")] String SQLServer; - [Key, Description("The name of the SQL instance to be configured.")] String SQLInstanceName; - [Key, Description("The database in which the login (user) and role(s) exist.")] String Database; - [Required, Description("One or more roles to which the login (user) will be added or removed.")] String Role[]; -}; diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerEndpoint/MSFT_xSQLServerEndpoint.psm1 b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerEndpoint/MSFT_xSQLServerEndpoint.psm1 deleted file mode 100644 index e72954b2..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerEndpoint/MSFT_xSQLServerEndpoint.psm1 +++ /dev/null @@ -1,281 +0,0 @@ -Import-Module -Name (Join-Path -Path (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent) ` - -ChildPath 'xSQLServerHelper.psm1') ` - -Force -<# - .SYNOPSIS - Returns the current state of the endpoint. - - .PARAMETER EndpointName - The name of the endpoint. - - .PARAMETER SQLServer - The host name of the SQL Server to be configured. Default value is $env:COMPUTERNAME. - - .PARAMETER SQLInstanceName - The name of the SQL instance to be configured. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $EndpointName, - - [Parameter()] - [System.String] - $SQLServer = $env:COMPUTERNAME, - - [Parameter(Mandatory = $true)] - [System.String] - $SQLInstanceName - ) - - $getTargetResourceReturnValues = @{ - SQLServer = $SQLServer - SQLInstanceName = $SQLInstanceName - Ensure = 'Absent' - EndpointName = '' - Port = '' - IpAddress = '' - } - - $sqlServerObject = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName - if ($sqlServerObject) - { - Write-Verbose -Message ('Connected to {0}\{1}' -f $SQLServer, $SQLInstanceName) - - $endpointObject = $sqlServerObject.Endpoints[$EndpointName] - if ($endpointObject.Name -eq $EndpointName) - { - if ($sqlServerObject.Endpoints[$EndPointName].EndpointType -ne 'DatabaseMirroring') - { - throw New-TerminatingError -ErrorType EndpointFoundButWrongType ` - -FormatArgs @($EndpointName) ` - -ErrorCategory InvalidOperation - } - - $getTargetResourceReturnValues.Ensure = 'Present' - $getTargetResourceReturnValues.EndpointName = $endpointObject.Name - $getTargetResourceReturnValues.Port = $endpointObject.Protocol.Tcp.ListenerPort - $getTargetResourceReturnValues.IpAddress = $endpointObject.Protocol.Tcp.ListenerIPAddress - } - else - { - $getTargetResourceReturnValues.Ensure = 'Absent' - $getTargetResourceReturnValues.EndpointName = '' - $getTargetResourceReturnValues.Port = '' - $getTargetResourceReturnValues.IpAddress = '' - } - } - else - { - throw New-TerminatingError -ErrorType NotConnectedToInstance ` - -FormatArgs @($SQLServer,$SQLInstanceName) ` - -ErrorCategory InvalidOperation - } - - return $getTargetResourceReturnValues -} - -<# - .SYNOPSIS - Create, changes or drops an endpoint. - - .PARAMETER EndpointName - The name of the endpoint. - - .PARAMETER Ensure - If the endpoint should be present or absent. Default values is 'Present'. - - .PARAMETER Port - The network port the endpoint is listening on. Default value is 5022. - - .PARAMETER SQLServer - The host name of the SQL Server to be configured. Default value is $env:COMPUTERNAME. - - .PARAMETER SQLInstanceName - The name of the SQL instance to be configured. - - .PARAMETER IpAddress - The network IP address the endpoint is listening on. Defaults to '0.0.0.0' which means listen on any valid IP address. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $EndpointName, - - [Parameter()] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present', - - [Parameter()] - [System.UInt16] - $Port = 5022, - - [Parameter()] - [System.String] - $SQLServer = $env:COMPUTERNAME, - - [Parameter(Mandatory = $true)] - [System.String] - $SQLInstanceName, - - [Parameter()] - [System.String] - $IpAddress = '0.0.0.0' - ) - - $getTargetResourceResult = Get-TargetResource -EndpointName $EndpointName -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName - - $sqlServerObject = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName - if ($sqlServerObject) - { - if ($Ensure -eq 'Present' -and $getTargetResourceResult.Ensure -eq 'Absent') - { - Write-Verbose -Message ('Creating endpoint {0}.' -f $EndpointName) - - $endpointObject = New-Object -TypeName Microsoft.SqlServer.Management.Smo.Endpoint -ArgumentList $sqlServerObject, $EndpointName - $endpointObject.EndpointType = [Microsoft.SqlServer.Management.Smo.EndpointType]::DatabaseMirroring - $endpointObject.ProtocolType = [Microsoft.SqlServer.Management.Smo.ProtocolType]::Tcp - $endpointObject.Protocol.Tcp.ListenerPort = $Port - $endpointObject.Protocol.Tcp.ListenerIPAddress = $IpAddress - $endpointObject.Payload.DatabaseMirroring.ServerMirroringRole = [Microsoft.SqlServer.Management.Smo.ServerMirroringRole]::All - $endpointObject.Payload.DatabaseMirroring.EndpointEncryption = [Microsoft.SqlServer.Management.Smo.EndpointEncryption]::Required - $endpointObject.Payload.DatabaseMirroring.EndpointEncryptionAlgorithm = [Microsoft.SqlServer.Management.Smo.EndpointEncryptionAlgorithm]::Aes - $endpointObject.Create() - $endpointObject.Start() - } - elseif ($Ensure -eq 'Present' -and $getTargetResourceResult.Ensure -eq 'Present') - { - # The endpoint already exist, verifying supported endpoint properties so they are in desired state. - $endpointObject = $sqlServerObject.Endpoints[$EndpointName] - if ($endpointObject) - { - if ($endpointObject.Protocol.Tcp.ListenerIPAddress -ne $IpAddress) - { - Write-Verbose -Message ('Updating endpoint {0} IP address to {1}.' -f $EndpointName, $IpAddress) - $endpointObject.Protocol.Tcp.ListenerIPAddress = $IpAddress - $endpointObject.Alter() - } - - if ($endpointObject.Protocol.Tcp.ListenerPort -ne $Port) - { - Write-Verbose -Message ('Updating endpoint {0} port to {1}.' -f $EndpointName, $Port) - $endpointObject.Protocol.Tcp.ListenerPort = $Port - $endpointObject.Alter() - } - } - else - { - throw New-TerminatingError -ErrorType EndpointNotFound -FormatArgs @($EndpointName) -ErrorCategory ObjectNotFound - } - } - elseif ($Ensure -eq 'Absent' -and $getTargetResourceResult.Ensure -eq 'Present') - { - Write-Verbose -Message ('Dropping endpoint {0}.' -f $EndpointName) - - $endpointObject = $sqlServerObject.Endpoints[$EndpointName] - if ($endpointObject) - { - $endpointObject.Drop() - } - else - { - throw New-TerminatingError -ErrorType EndpointNotFound -FormatArgs @($EndpointName) -ErrorCategory ObjectNotFound - } - } - } - else - { - throw New-TerminatingError -ErrorType NotConnectedToInstance ` - -FormatArgs @($SQLServer,$SQLInstanceName) ` - -ErrorCategory InvalidOperation - } -} - -<# - .SYNOPSIS - Tests if the principal (login) has the desired permissions. - - .PARAMETER EndpointName - The name of the endpoint. - - .PARAMETER Ensure - If the endpoint should be present or absent. Default values is 'Present'. - - .PARAMETER Port - The network port the endpoint is listening on. Default value is 5022. - - .PARAMETER SQLServer - The host name of the SQL Server to be configured. Default value is $env:COMPUTERNAME. - - .PARAMETER SQLInstanceName - The name of the SQL instance to be configured. - - .PARAMETER IpAddress - The network IP address the endpoint is listening on. Defaults to '0.0.0.0' which means listen on any valid IP address. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $EndpointName, - - [Parameter()] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present', - - [Parameter()] - [System.UInt16] - $Port = 5022, - - [Parameter()] - [System.String] - $SQLServer = $env:COMPUTERNAME, - - [Parameter(Mandatory = $true)] - [System.String] - $SQLInstanceName, - - [Parameter()] - [System.String] - $IpAddress = '0.0.0.0' - ) - - $getTargetResourceResult = Get-TargetResource -EndpointName $EndpointName -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName - if ($getTargetResourceResult.Ensure -eq $Ensure) - { - $result = $true - - if ($getTargetResourceResult.Ensure -eq 'Present' ` - -and ( - $getTargetResourceResult.Port -ne $Port ` - -or $getTargetResourceResult.IpAddress -ne $IpAddress - ) - ) - { - $result = $false - } - } - else - { - $result = $false - } - - return $result -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerEndpoint/MSFT_xSQLServerEndpoint.schema.mof b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerEndpoint/MSFT_xSQLServerEndpoint.schema.mof deleted file mode 100644 index 737bb8db..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerEndpoint/MSFT_xSQLServerEndpoint.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSQLServerEndpoint")] -class MSFT_xSQLServerEndpoint : OMI_BaseResource -{ - [Key, Description("The name of the endpoint.")] String EndpointName; - [Write, Description("If the endpoint should be present or absent. Default values is 'Present'."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, Description("The network port the endpoint is listening on. Default value is 5022.")] Uint16 Port; - [Write, Description("The host name of the SQL Server to be configured. Default value is $env:COMPUTERNAME.")] String SQLServer; - [Key, Description("The name of the SQL instance to be configured.")] String SQLInstanceName; - [Write, Description("The network IP address the endpoint is listening on. Default the endpoint will listen on any valid IP address.")] String IpAddress; -}; diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerEndpointPermission/MSFT_xSQLServerEndpointPermission.psm1 b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerEndpointPermission/MSFT_xSQLServerEndpointPermission.psm1 deleted file mode 100644 index bfdd1f18..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerEndpointPermission/MSFT_xSQLServerEndpointPermission.psm1 +++ /dev/null @@ -1,249 +0,0 @@ -Import-Module -Name (Join-Path -Path (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent) ` - -ChildPath 'xSQLServerHelper.psm1') ` - -Force -<# - .SYNOPSIS - Returns the current state of the permissions for the principal (login). - - .PARAMETER InstanceName - The name of the SQL instance to be configured. - - .PARAMETER NodeName - The host name of the SQL Server to be configured. - - .PARAMETER Name - The name of the endpoint. - - .PARAMETER Principal - The login to which permission will be set. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $InstanceName, - - [Parameter(Mandatory = $true)] - [System.String] - $NodeName, - - [Parameter(Mandatory = $true)] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [System.String] - $Principal - ) - - try - { - $sqlServerObject = Connect-SQL -SQLServer $NodeName -SQLInstanceName $InstanceName - - $endpointObject = $sqlServerObject.Endpoints[$Name] - if( $null -ne $endpointObject ) - { - New-VerboseMessage -Message "Enumerating permissions for endpoint $Name" - - $permissionSet = New-Object -Property @{ Connect = $True } -TypeName Microsoft.SqlServer.Management.Smo.ObjectPermissionSet - - $endpointPermission = $endpointObject.EnumObjectPermissions( $permissionSet ) | Where-Object { $_.PermissionState -eq "Grant" -and $_.Grantee -eq $Principal } - if ($endpointPermission.Count -ne 0) - { - $Ensure = 'Present' - $Permission = 'CONNECT' - } - else - { - $Ensure = 'Absent' - $Permission = '' - } - } - else - { - throw New-TerminatingError -ErrorType EndpointNotFound -FormatArgs @($Name) -ErrorCategory ObjectNotFound - } - } - catch - { - throw New-TerminatingError -ErrorType UnexpectedErrorFromGet -FormatArgs @($Name) -ErrorCategory ObjectNotFound -InnerException $_.Exception - } - - return @{ - InstanceName = [System.String] $InstanceName - NodeName = [System.String] $NodeName - Ensure = [System.String] $Ensure - Name = [System.String] $Name - Principal = [System.String] $Principal - Permission = [System.String] $Permission - } -} - -<# - .SYNOPSIS - Grants or revokes the permission for the the principal (login). - - .PARAMETER InstanceName - The name of the SQL instance to be configured. - - .PARAMETER NodeName - The host name of the SQL Server to be configured. - - .PARAMETER Ensure - If the permission should be present or absent. Default value is 'Present'. - - .PARAMETER Name - The name of the endpoint. - - .PARAMETER Permission - The permission to set for the login. Valid value for permission are only CONNECT. - - .PARAMETER Principal - The permission to set for the login. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $InstanceName, - - [Parameter(Mandatory = $true)] - [System.String] - $NodeName, - - [Parameter()] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present', - - [Parameter(Mandatory = $true)] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [System.String] - $Principal, - - [Parameter()] - [ValidateSet('CONNECT')] - [System.String] - $Permission - ) - - $parameters = @{ - InstanceName = [System.String] $InstanceName - NodeName = [System.String] $NodeName - Name = [System.String] $Name - Principal = [System.String] $Principal - } - - $getTargetResourceResult = Get-TargetResource @parameters - if ($getTargetResourceResult.Ensure -ne $Ensure) - { - $sqlServerObject = Connect-SQL -SQLServer $NodeName -SQLInstanceName $InstanceName - - $endpointObject = $sqlServerObject.Endpoints[$Name] - if ($null -ne $endpointObject) - { - $permissionSet = New-Object -Property @{ Connect = $True } -TypeName Microsoft.SqlServer.Management.Smo.ObjectPermissionSet - - if ($Ensure -eq 'Present') - { - New-VerboseMessage -Message "Grant permission to $Principal on endpoint $Name" - - $endpointObject.Grant($permissionSet, $Principal) - } - else - { - New-VerboseMessage -Message "Revoke permission to $Principal on endpoint $Name" - $endpointObject.Revoke($permissionSet, $Principal) - } - } - else - { - throw New-TerminatingError -ErrorType EndpointNotFound -FormatArgs @($Name) -ErrorCategory ObjectNotFound - } - } - else - { - New-VerboseMessage -Message "State is already $Ensure" - } -} - -<# - .SYNOPSIS - Tests if the principal (login) has the desired permissions. - - .PARAMETER InstanceName - The name of the SQL instance to be configured. - - .PARAMETER NodeName - The host name of the SQL Server to be configured. - - .PARAMETER Ensure - If the permission should be present or absent. Default value is 'Present'. - - .PARAMETER Name - The name of the endpoint. - - .PARAMETER Permission - The permission to set for the login. Valid value for permission are only CONNECT. - - .PARAMETER Principal - The permission to set for the login. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $InstanceName, - - [Parameter(Mandatory = $true)] - [System.String] - $NodeName, - - [Parameter()] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present', - - [Parameter(Mandatory = $true)] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [System.String] - $Principal, - - [Parameter()] - [ValidateSet('CONNECT')] - [System.String] - $Permission - ) - - $parameters = @{ - InstanceName = [System.String] $InstanceName - NodeName = [System.String] $NodeName - Name = [System.String] $Name - Principal = [System.String] $Principal - } - - New-VerboseMessage -Message "Testing state of endpoint permission for $Principal" - - $getTargetResourceResult = Get-TargetResource @parameters - - return $getTargetResourceResult.Ensure -eq $Ensure -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerEndpointPermission/MSFT_xSQLServerEndpointPermission.schema.mof b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerEndpointPermission/MSFT_xSQLServerEndpointPermission.schema.mof deleted file mode 100644 index d5070709..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerEndpointPermission/MSFT_xSQLServerEndpointPermission.schema.mof +++ /dev/null @@ -1,12 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xSQLServerEndpointPermission")] -class MSFT_xSQLServerEndpointPermission : OMI_BaseResource -{ - [Key, Description("The name of the SQL instance to be configured.")] String InstanceName; - [Required, Description("The host name of the SQL Server to be configured.")] String NodeName; - [Write, Description("If the permission should be present or absent. Default value is 'Present'."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Required, Description("The name of the endpoint.")] String Name; - [Key, Description("The login to which permission will be set.")] String Principal; - [Write, Description("The permission to set for the login. Valid value for permission are only CONNECT."), ValueMap{"CONNECT"}, Values{"CONNECT"}] String Permission; -}; - diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerEndpointState/MSFT_xSQLServerEndpointState.psm1 b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerEndpointState/MSFT_xSQLServerEndpointState.psm1 deleted file mode 100644 index 55a630c1..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerEndpointState/MSFT_xSQLServerEndpointState.psm1 +++ /dev/null @@ -1,205 +0,0 @@ -Import-Module -Name (Join-Path -Path (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent) ` - -ChildPath 'xSQLServerHelper.psm1') ` - -Force -<# - .SYNOPSIS - Returns the current state of an endpoint. - - .PARAMETER InstanceName - The name of the SQL instance to be configured. - - .PARAMETER NodeName - The host name of the SQL Server to be configured. - - .PARAMETER Name - The name of the endpoint. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $InstanceName, - - [Parameter()] - [System.String] - $NodeName = $env:COMPUTERNAME, - - [Parameter(Mandatory = $true)] - [System.String] - $Name - ) - - New-VerboseMessage -Message "Getting state of endpoint $Name" - - try - { - $sqlServerObject = Connect-SQL -SQLServer $NodeName -SQLInstanceName $InstanceName - - $endpointObject = $sqlServerObject.Endpoints[$Name] - if ($null -ne $endpointObject) - { - $currentState = $endpointObject.EndpointState - } - else - { - throw New-TerminatingError -ErrorType EndpointNotFound -FormatArgs @($Name) -ErrorCategory ObjectNotFound - } - } - catch - { - throw New-TerminatingError -ErrorType EndpointErrorVerifyExist -FormatArgs @($Name) -ErrorCategory ObjectNotFound -InnerException $_.Exception - } - - return @{ - InstanceName = [System.String] $InstanceName - NodeName = [System.String] $NodeName - Name = [System.String] $Name - State = [System.String] $currentState - } -} - -<# - .SYNOPSIS - Changes the state of an endpoint. - - .PARAMETER InstanceName - The name of the SQL instance to be configured. - - .PARAMETER NodeName - The host name of the SQL Server to be configured. - - .PARAMETER Name - The name of the endpoint. - - .PARAMETER State - The state of the endpoint. Valid states are Started, Stopped or Disabled. Default value is 'Started'. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $InstanceName, - - [Parameter()] - [System.String] - $NodeName = $env:COMPUTERNAME, - - [Parameter(Mandatory = $true)] - [System.String] - $Name, - - [Parameter()] - [ValidateSet('Started','Stopped','Disabled')] - [System.String] - $State = 'Started' - ) - - $parameters = @{ - InstanceName = [System.String] $InstanceName - NodeName = [System.String] $NodeName - Name = [System.String] $Name - } - - $getTargetResourceResult = Get-TargetResource @parameters - if ($null -ne $getTargetResourceResult) - { - if ($getTargetResourceResult.State -ne $State) - { - New-VerboseMessage -Message ('Changing state of endpoint ''{0}''' -f $Name) - - $sqlServerObject = Connect-SQL -SQLServer $NodeName -SQLInstanceName $InstanceName - - $endpointObject = $sqlServerObject.Endpoints[$Name] - - $setEndpointParams = @{ - InputObject = $endpointObject - State = $State - } - - Set-SqlHADREndpoint @setEndpointParams -ErrorAction Stop | Out-Null - } - else - { - New-VerboseMessage -Message ('Endpoint ''{0}'' state is already correct.' -f $Name) - } - } - else - { - throw New-TerminatingError -ErrorType UnexpectedErrorFromGet -ErrorCategory InvalidResult - } -} - -<# - .SYNOPSIS - Tests the state of an endpoint if it is in desired state. - - .PARAMETER InstanceName - The name of the SQL instance to be configured. - - .PARAMETER NodeName - The host name of the SQL Server to be configured. - - .PARAMETER Name - The name of the endpoint. - - .PARAMETER State - The state of the endpoint. Valid states are Started, Stopped or Disabled. Default value is 'Started'. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $InstanceName, - - [Parameter()] - [System.String] - $NodeName = $env:COMPUTERNAME, - - [Parameter(Mandatory = $true)] - [System.String] - $Name, - - [Parameter()] - [ValidateSet('Started','Stopped','Disabled')] - [System.String] - $State = 'Started' - ) - - $parameters = @{ - InstanceName = $InstanceName - NodeName = $NodeName - Name = $Name - } - - New-VerboseMessage -Message "Testing state $State on endpoint '$Name'" - - $getTargetResourceResult = Get-TargetResource @parameters - if ($null -ne $getTargetResourceResult) - { - $result = $false - - if ($getTargetResourceResult.State -eq $State) - { - $result = $true - } - } - else - { - throw New-TerminatingError -ErrorType UnexpectedErrorFromGet -ErrorCategory InvalidResult - } - - return $result -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerEndpointState/MSFT_xSQLServerEndpointState.schema.mof b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerEndpointState/MSFT_xSQLServerEndpointState.schema.mof deleted file mode 100644 index 14edfab0..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerEndpointState/MSFT_xSQLServerEndpointState.schema.mof +++ /dev/null @@ -1,8 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSQLServerEndpointState")] -class MSFT_xSQLServerEndpointState : OMI_BaseResource -{ - [Key, Description("The name of the SQL instance to be configured.")] String InstanceName; - [Write, Description("The host name of the SQL Server to be configured. Default value is $env:COMPUTERNAME.")] String NodeName; - [Key, Description("The name of the endpoint.")] String Name; - [Write, Description("The state of the endpoint. Valid states are Started, Stopped or Disabled. Default value is 'Started'."), ValueMap{"Started","Stopped","Disabled"}, Values{"Started","Stopped","Disabled"}] String State; -}; diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerFailoverClusterSetup/MSFT_xSQLServerFailoverClusterSetup.psm1 b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerFailoverClusterSetup/MSFT_xSQLServerFailoverClusterSetup.psm1 deleted file mode 100644 index 832a1fac..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerFailoverClusterSetup/MSFT_xSQLServerFailoverClusterSetup.psm1 +++ /dev/null @@ -1,1038 +0,0 @@ -# NOTE: This resource requires WMF5 and PsDscRunAsCredential - -$currentPath = Split-Path -Parent $MyInvocation.MyCommand.Path -Write-Debug -Message "CurrentPath: $currentPath" - -# Load Common Code -Import-Module $currentPath\..\..\xSQLServerHelper.psm1 -Verbose:$false -ErrorAction Stop - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Prepare","Complete")] - [System.String] - $Action, - - [System.String] - $SourcePath = "$PSScriptRoot\..\..\", - - [System.String] - $SourceFolder = "Source", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.Management.Automation.PSCredential] - $SourceCredential, - - [System.Boolean] - $SuppressReboot, - - [System.Boolean] - $ForceReboot, - - [parameter(Mandatory = $true)] - [System.String] - $Features, - - [parameter(Mandatory = $true)] - [System.String] - $InstanceName, - - [System.String] - $InstanceID = $InstanceName, - - [System.String] - $PID, - - [System.String] - $UpdateEnabled = $True, - - [System.String] - $UpdateSource = ".\Updates", - - [System.String] - $SQMReporting, - - [System.String] - $ErrorReporting, - - [System.String] - $FailoverClusterGroup = "SQL Server ($InstanceName)", - - [parameter(Mandatory = $true)] - [System.String] - $FailoverClusterNetworkName, - - [System.String] - $FailoverClusterIPAddress, - - [System.String] - $InstallSharedDir, - - [System.String] - $InstallSharedWOWDir, - - [System.String] - $InstanceDir, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SQLSvcAccount, - - [System.Management.Automation.PSCredential] - $AgtSvcAccount = $SQLSvcAccount, - - [System.String] - $SQLCollation, - - [System.String[]] - $SQLSysAdminAccounts, - - [System.String] - $SecurityMode, - - [System.Management.Automation.PSCredential] - $SAPwd = $SetupCredential, - - [System.String] - $InstallSQLDataDir, - - [System.String] - $SQLUserDBDir, - - [System.String] - $SQLUserDBLogDir, - - [System.String] - $SQLTempDBDir, - - [System.String] - $SQLTempDBLogDir, - - [System.String] - $SQLBackupDir, - - [System.Management.Automation.PSCredential] - $ASSvcAccount = $SQLSvcAccount, - - [System.String] - $ASCollation, - - [System.String[]] - $ASSysAdminAccounts, - - [System.String] - $ASDataDir, - - [System.String] - $ASLogDir, - - [System.String] - $ASBackupDir, - - [System.String] - $ASTempDir, - - [System.String] - $ASConfigDir, - - [System.Management.Automation.PSCredential] - $ISSvcAccount = $SQLSvcAccount, - - [System.String] - $ISFileSystemFolder - ) - - $InstanceName = $InstanceName.ToUpper() - - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - - if($SourceCredential) - { - NetUse -SourcePath $SourcePath -Credential $SourceCredential -Ensure "Present" - } - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "setup.exe" - $Path = ResolvePath $Path - Write-Verbose "Path: $Path" - $SQLVersion = GetSQLVersion -Path $Path - if($SourceCredential) - { - NetUse -SourcePath $SourcePath -Credential $SourceCredential -Ensure "Absent" - } - - if($InstanceName -eq "MSSQLSERVER") - { - $DBServiceName = "MSSQLSERVER" - $AgtServiceName = "SQLSERVERAGENT" - $ASServiceName = "MSSQLServerOLAPService" - } - else - { - $DBServiceName = "MSSQL`$$InstanceName" - $AgtServiceName = "SQLAgent`$$InstanceName" - $ASServiceName = "MSOLAP`$$InstanceName" - } - $ISServiceName = "MsDtsServer" + $SQLVersion + "0" - - if(Get-WmiObject -Namespace root/mscluster -Class MSCluster_ResourceGroup -ErrorAction SilentlyContinue | Where-Object {$_.Name -eq $FailoverClusterGroup}) - { - $Complete = $true - $FailoverClusterNetworkName = (Get-ClusterGroup -Name $FailoverClusterGroup | Get-ClusterResource | Where-Object {$_.ResourceType -eq "Network Name"} | Get-ClusterParameter -Name "Name").Value - $FailoverClusterIPAddress = (Get-ClusterGroup -Name $FailoverClusterGroup | Get-ClusterResource | Where-Object {$_.ResourceType -eq "IP Address"} | Get-ClusterParameter -Name "Address").Value - } - else - { - $FailoverClusterGroup = $null - $FailoverClusterNetworkName = $null - $FailoverClusterIPAddress = $null - $Complete = $false - } - - $Services = Get-Service - $Features = "" - if($Services | Where-Object {$_.Name -eq $DBServiceName}) - { - $Features += "SQLENGINE," - $SQLSvcAccountUsername = (Get-WmiObject -Class Win32_Service | Where-Object {$_.Name -eq $DBServiceName}).StartName - $AgtSvcAccountUsername = (Get-WmiObject -Class Win32_Service | Where-Object {$_.Name -eq $AgtServiceName}).StartName - $InstanceID = ((Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL' -Name $InstanceName).$InstanceName).Split(".")[1] - $FullInstanceID = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL' -Name $InstanceName).$InstanceName - $InstanceID = $FullInstanceID.Split(".")[1] - $InstanceDir = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\$FullInstanceID\Setup" -Name 'SqlProgramDir').SqlProgramDir.Trim("\") - } - if($Services | Where-Object {$_.Name -eq $ASServiceName}) - { - $Features += "AS," - $ASSvcAccountUsername = (Get-WmiObject -Class Win32_Service | Where-Object {$_.Name -eq $ASServiceName}).StartName - } - if($Services | Where-Object {$_.Name -eq $ISServiceName}) - { - $Features += "IS," - $ISSvcAccountUsername = (Get-WmiObject -Class Win32_Service | Where-Object {$_.Name -eq $ISServiceName}).StartName - } - $Products = Get-WmiObject -Class Win32_Product - switch($SQLVersion) - { - "11" - { - $IdentifyingNumber = "{A7037EB2-F953-4B12-B843-195F4D988DA1}" - } - "12" - { - $IdentifyingNumber = "{75A54138-3B98-4705-92E4-F619825B121F}" - } - } - if($Products | Where-Object {$_.IdentifyingNumber -eq $IdentifyingNumber}) - { - $Features += "SSMS," - } - switch($SQLVersion) - { - "11" - { - $IdentifyingNumber = "{7842C220-6E9A-4D5A-AE70-0E138271F883}" - } - "12" - { - $IdentifyingNumber = "{B5ECFA5C-AC4F-45A4-A12E-A76ABDD9CCBA}" - } - } - if($Products | Where-Object {$_.IdentifyingNumber -eq $IdentifyingNumber}) - { - $Features += "ADV_SSMS," - } - $Features = $Features.Trim(",") - if($Features -ne "") - { - switch($SQLVersion) - { - "11" - { - $InstallSharedDir = (GetFirstItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components" -Name "FEE2E540D20152D4597229B6CFBC0A69") - $InstallSharedWOWDir = (GetFirstItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components" -Name "A79497A344129F64CA7D69C56F5DD8B4") - } - "12" - { - $InstallSharedDir = (GetFirstItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components" -Name "FEE2E540D20152D4597229B6CFBC0A69") - $InstallSharedWOWDir = (GetFirstItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components" -Name "C90BFAC020D87EA46811C836AD3C507F") - } - "13" - { - $InstallSharedDir = (GetFirstItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components" -Name "FEE2E540D20152D4597229B6CFBC0A69") - $InstallSharedWOWDir = (GetFirstItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components" -Name "A79497A344129F64CA7D69C56F5DD8B4") - } - } - } - - $returnValue = @{ - Action = $Action - SourcePath = $SourcePath - SourceFolder = $SourceFolder - Features = $Features - InstanceName = $InstanceName - InstanceID = $InstanceID - FailoverClusterGroup = $FailoverClusterGroup - FailoverClusterNetworkName = $FailoverClusterNetworkName - FailoverClusterIPAddress = $FailoverClusterIPAddress - InstallSharedDir = $InstallSharedDir - InstallSharedWOWDir = $InstallSharedWOWDir - InstanceDir = $InstanceDir - SQLSvcAccountUsername = $SQLSvcAccountUsername - AgtSvcAccountUsername = $AgtSvcAccountUsername - ASSvcAccountUsername = $ASSvcAccountUsername - ISSvcAccountUsername = $ISSvcAccountUsername - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Prepare","Complete")] - [System.String] - $Action, - - [System.String] - $SourcePath = "$PSScriptRoot\..\..\", - - [System.String] - $SourceFolder = "Source", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.Management.Automation.PSCredential] - $SourceCredential, - - [System.Boolean] - $SuppressReboot, - - [System.Boolean] - $ForceReboot, - - [parameter(Mandatory = $true)] - [System.String] - $Features, - - [parameter(Mandatory = $true)] - [System.String] - $InstanceName, - - [System.String] - $InstanceID = $InstanceName, - - [System.String] - $PID, - - [System.String] - $UpdateEnabled = $True, - - [System.String] - $UpdateSource = ".\Updates", - - [System.String] - $SQMReporting, - - [System.String] - $ErrorReporting, - - [System.String] - $FailoverClusterGroup = "SQL Server ($InstanceName)", - - [parameter(Mandatory = $true)] - [System.String] - $FailoverClusterNetworkName, - - [System.String] - $FailoverClusterIPAddress, - - [System.String] - $InstallSharedDir, - - [System.String] - $InstallSharedWOWDir, - - [System.String] - $InstanceDir, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SQLSvcAccount, - - [System.Management.Automation.PSCredential] - $AgtSvcAccount = $SQLSvcAccount, - - [System.String] - $SQLCollation, - - [System.String[]] - $SQLSysAdminAccounts, - - [System.String] - $SecurityMode, - - [System.Management.Automation.PSCredential] - $SAPwd = $SetupCredential, - - [System.String] - $InstallSQLDataDir, - - [System.String] - $SQLUserDBDir, - - [System.String] - $SQLUserDBLogDir, - - [System.String] - $SQLTempDBDir, - - [System.String] - $SQLTempDBLogDir, - - [System.String] - $SQLBackupDir, - - [System.Management.Automation.PSCredential] - $ASSvcAccount = $SQLSvcAccount, - - [System.String] - $ASCollation, - - [System.String[]] - $ASSysAdminAccounts, - - [System.String] - $ASDataDir, - - [System.String] - $ASLogDir, - - [System.String] - $ASBackupDir, - - [System.String] - $ASTempDir, - - [System.String] - $ASConfigDir, - - [System.Management.Automation.PSCredential] - $ISSvcAccount = $SQLSvcAccount, - - [System.String] - $ISFileSystemFolder - ) - - $InstanceName = $InstanceName.ToUpper() - - Import-Module $PSScriptRoot\..\..\xPDT.psm1 - - if($SourceCredential) - { - NetUse -SourcePath $SourcePath -Credential $SourceCredential -Ensure "Present" - $TempFolder = [IO.Path]::GetTempPath() - & robocopy.exe (Join-Path -Path $SourcePath -ChildPath $SourceFolder) (Join-Path -Path $TempFolder -ChildPath $SourceFolder) /e - $SourcePath = $TempFolder - NetUse -SourcePath $SourcePath -Credential $SourceCredential -Ensure "Absent" - } - $Path = Join-Path -Path (Join-Path -Path $SourcePath -ChildPath $SourceFolder) -ChildPath "setup.exe" - $Path = ResolvePath $Path - $SQLVersion = GetSQLVersion -Path $Path - - foreach($feature in $Features.Split(",")) - { - if(($SQLVersion -eq "13") -and (($feature -eq "SSMS") -or ($feature -eq "ADV_SSMS"))) - { - Throw New-TerminatingError -ErrorType FeatureNotSupported -FormatArgs @($feature) -ErrorCategory InvalidData - } - } - - switch($Action) - { - "Prepare" - { - # If SQL shared components already installed, clear InstallShared*Dir variables - switch($SQLVersion) - { - "11" - { - if((Get-Variable -Name "InstallSharedDir" -ErrorAction SilentlyContinue) -and (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\30AE1F084B1CF8B4797ECB3CCAA3B3B6" -ErrorAction SilentlyContinue)) - { - Set-Variable -Name "InstallSharedDir" -Value "" - } - if((Get-Variable -Name "InstallSharedWOWDir" -ErrorAction SilentlyContinue) -and (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\A79497A344129F64CA7D69C56F5DD8B4" -ErrorAction SilentlyContinue)) - { - Set-Variable -Name "InstallSharedWOWDir" -Value "" - } - } - "12" - { - if((Get-Variable -Name "InstallSharedDir" -ErrorAction SilentlyContinue) -and (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\FEE2E540D20152D4597229B6CFBC0A69" -ErrorAction SilentlyContinue)) - { - Set-Variable -Name "InstallSharedDir" -Value "" - } - if((Get-Variable -Name "InstallSharedWOWDir" -ErrorAction SilentlyContinue) -and (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\C90BFAC020D87EA46811C836AD3C507F" -ErrorAction SilentlyContinue)) - { - Set-Variable -Name "InstallSharedWOWDir" -Value "" - } - } - "13" - { - if((Get-Variable -Name "InstallSharedDir" -ErrorAction SilentlyContinue) -and (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\FEE2E540D20152D4597229B6CFBC0A69" -ErrorAction SilentlyContinue)) - { - Set-Variable -Name "InstallSharedDir" -Value "" - } - if((Get-Variable -Name "InstallSharedWOWDir" -ErrorAction SilentlyContinue) -and (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\A79497A344129F64CA7D69C56F5DD8B4" -ErrorAction SilentlyContinue)) - { - Set-Variable -Name "InstallSharedWOWDir" -Value "" - } - } - } - - # Create install arguments - $Arguments = "/SkipRules=`"Cluster_VerifyForErrors`" /Quiet=`"True`" /IAcceptSQLServerLicenseTerms=`"True`" /Action=`"PrepareFailoverCluster`"" - $ArgumentVars = @( - "InstanceName", - "InstanceID", - "UpdateEnabled", - "UpdateSource", - "Features", - "PID", - "SQMReporting", - "ErrorReporting", - "InstallSharedDir", - "InstallSharedWOWDir", - "InstanceDir" - ) - foreach($ArgumentVar in $ArgumentVars) - { - if((Get-Variable -Name $ArgumentVar).Value -ne "") - { - $Arguments += " /$ArgumentVar=`"" + (Get-Variable -Name $ArgumentVar).Value + "`"" - } - } - if($Features.Contains("SQLENGINE")) - { - $Arguments += " /AgtSvcAccount=`"" + $AgtSvcAccount.UserName + "`"" - $Arguments += " /AgtSvcPassword=`"" + $AgtSvcAccount.GetNetworkCredential().Password + "`"" - $Arguments += " /SQLSvcAccount=`"" + $SQLSvcAccount.UserName + "`"" - $Arguments += " /SQLSvcPassword=`"" + $SQLSvcAccount.GetNetworkCredential().Password + "`"" - } - if($Features.Contains("AS")) - { - $Arguments += " /ASSvcAccount=`"" + $ASSvcAccount.UserName + "`"" - $Arguments += " /ASSvcPassword=`"" + $ASSvcAccount.GetNetworkCredential().Password + "`"" - } - if($Features.Contains("IS")) - { - $Arguments += " /ISSvcAccount=`"" + $ISSvcAccount.UserName + "`"" - $Arguments += " /ISSvcPassword=`"" + $ISSvcAccount.GetNetworkCredential().Password + "`"" - } - } - "Complete" - { - # Remove trailing "\" from paths - foreach($Var in @("InstallSQLDataDir","SQLUserDBDir","SQLUserDBLogDir","SQLTempDBDir","SQLTempDBLogDir","SQLBackupDir","ASDataDir","ASLogDir","ASBackupDir","ASTempDir","ASConfigDir","ISFileSystemFolder")) - { - if(Get-Variable -Name $Var -ErrorAction SilentlyContinue) - { - Set-Variable -Name $Var -Value (Get-Variable -Name $Var).Value.TrimEnd("\") - } - } - - # Discover which cluster disks need to be added to this cluster group - $Drives = @() - foreach($Var in @("InstallSQLDataDir","SQLUserDBDir","SQLUserDBLogDir","SQLTempDBDir","SQLTempDBLogDir","SQLBackupDir","ASDataDir","ASLogDir","ASBackupDir","ASTempDir","ASConfigDir","ISFileSystemFolder")) - { - if( - (Get-Variable -Name $Var -ErrorAction SilentlyContinue) -and ` - ((Get-Variable -Name $Var).Value.Length -ge 2) -and ` - ((Get-Variable -Name $Var).Value.Substring(1,1) -eq ":") - ) - { - $Drives += (Get-Variable -Name $Var).Value.Substring(0,2) - } - } - $Drives = $Drives | Sort-Object -Unique - $FailoverClusterDisks = @() - $DiskResources = Get-WmiObject -Class MSCluster_Resource -Namespace root/mscluster | Where-Object {$_.Type -eq "Physical Disk"} - foreach($DiskResource in $DiskResources) - { - $Disks = Get-WmiObject -Namespace root/mscluster -Query "Associators of {$DiskResource} Where ResultClass=MSCluster_Disk" - foreach($Disk in $Disks) - { - $Partitions = Get-WmiObject -Namespace root/mscluster -Query "Associators of {$Disk} Where ResultClass=MSCluster_DiskPartition" - foreach($Partition in $Partitions) - { - foreach($Drive in $Drives) - { - if($Partition.Path -eq $Drive) - { - $FailoverClusterDisks += $DiskResource.Name - } - } - } - } - } - - # Discover which cluster network to use for this cluster group - $ClusterNetworks = @(Get-WmiObject -Namespace root/mscluster -Class MSCluster_Network) - if([String]::IsNullOrEmpty($FailoverClusterIPAddress)) - { - $FailoverClusterIPAddresses = "IPv4;DHCP;" + $ClusterNetwork[0].Name - } - else - { - $FailoverClusterIPAddressDecimal = ConvertDecimalIP -IPAddress $FailoverClusterIPAddress - foreach($ClusterNetwork in $ClusterNetworks) - { - $ClusterNetworkAddressDecimal = ConvertDecimalIP -IPAddress $ClusterNetwork.Address - $ClusterNetworkAddressMaskDecimal = ConvertDecimalIP -IPAddress $ClusterNetwork.AddressMask - if(($FailoverClusterIPAddressDecimal -band $ClusterNetworkAddressMaskDecimal) -eq ($ClusterNetworkAddressDecimal -band $ClusterNetworkAddressMaskDecimal)) - { - $FailoverClusterIPAddresses = "IPv4;$FailoverClusterIPAddress;" + $ClusterNetwork.Name + ";" + $ClusterNetwork.AddressMask - } - } - } - - # Create install arguments - $Arguments = "/SkipRules=`"Cluster_VerifyForErrors`" /Quiet=`"True`" /IAcceptSQLServerLicenseTerms=`"True`" /Action=`"CompleteFailoverCluster`"" - $ArgumentVars = @( - "InstanceName", - "FailoverClusterGroup", - "FailoverClusterNetworkName", - "FailoverClusterIPAddresses" - ) - if($Features.Contains("SQLENGINE")) - { - $ArgumentVars += @( - "SecurityMode", - "SQLCollation", - "InstallSQLDataDir", - "SQLUserDBDir", - "SQLUserDBLogDir", - "SQLTempDBDir", - "SQLTempDBLogDir", - "SQLBackupDir" - ) - } - if($Features.Contains("AS")) - { - $ArgumentVars += @( - "ASCollation", - "ASDataDir", - "ASLogDir", - "ASBackupDir", - "ASTempDir", - "ASConfigDir" - ) - } - foreach($ArgumentVar in $ArgumentVars) - { - if((Get-Variable -Name $ArgumentVar).Value -ne "") - { - $Arguments += " /$ArgumentVar=`"" + (Get-Variable -Name $ArgumentVar).Value + "`"" - } - } - if($FailoverClusterDisks.Count -ne 0) - { - $Arguments += " /FailoverClusterDisks=" - foreach($FailoverClusterDisk in $FailoverClusterDisks) - { - $Arguments +="`"$FailoverClusterDisk`" " - } - $Arguments = $Arguments.Trim() - } - if($Features.Contains("SQLENGINE")) - { - $Arguments += " /SQLSysAdminAccounts=`"" + $SetupCredential.UserName + "`"" - if($PSBoundParameters.ContainsKey("SQLSysAdminAccounts")) - { - foreach($AdminAccount in $SQLSysAdminAccounts) - { - $Arguments += " `"$AdminAccount`"" - } - } - if($SecurityMode -eq "SQL") - { - $Arguments += " /SAPwd=`"" + $SAPwd.GetNetworkCredential().Password + "`"" - } - } - if($Features.Contains("AS")) - { - $Arguments += " /ASSysAdminAccounts=`"" + $SetupCredential.UserName + "`"" - if($PSBoundParameters.ContainsKey("ASSysAdminAccounts")) - { - foreach($AdminAccount in $ASSysAdminAccounts) - { - $Arguments += " `"$AdminAccount`"" - } - } - } - } - } - - # Replace sensitive values for verbose output - $Log = $Arguments - if($PID -ne "") - { - $Log = $Log.Replace($PID,"*****-*****-*****-*****-*****") - } - if($SecurityMode -eq "SQL") - { - $Log = $Log.Replace($SAPwd.GetNetworkCredential().Password,"********") - } - $LogVars = @("AgtSvcAccount","SQLSvcAccount","ASSvcAccount","ISSvcAccount") - foreach($LogVar in $LogVars) - { - if((Get-Variable -Name $LogVar).Value -ne "") - { - $Log = $Log.Replace((Get-Variable -Name $LogVar).Value.GetNetworkCredential().Password,"********") - } - } - - Write-Verbose "Path: $Path" - Write-Verbose "Arguments: $Log" - - switch($Action) - { - 'Prepare' - { - $Process = StartWin32Process -Path $Path -Arguments $Arguments -Credential $SetupCredential -AsTask - } - 'Complete' - { - $Process = StartWin32Process -Path $Path -Arguments $Arguments - } - } - Write-Verbose $Process - WaitForWin32ProcessEnd -Path $Path -Arguments $Arguments -Credential $SetupCredential - - # Additional "Prepare" actions - if($Action -eq "Prepare") - { - # Configure integration services - if($Features.Contains("IS")) - { - $MsDtsSrvrPath = (Get-ItemProperty -Path ("HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\" + $SQLVersion + "0\SSIS\ServiceConfigFile") -Name '(default)').'(default)' - if(Test-Path $MsDtsSrvrPath) - { - $MsDtsSrvr = [XML](Get-Content $MsDtsSrvrPath) - if($FailoverClusterNetworkName -eq "") - { - $FailoverClusterNetworkName = "." - } - if($InstanceName -eq "MSSQLSERVER") - { - $MsDtsSrvr.DtsServiceConfiguration.TopLevelFolders.Folder | Where-Object {$_.type -eq "SqlServerFolder"} | ForEach-Object {$_.ServerName = "$FailoverClusterNetworkName"} - } - else - { - $MsDtsSrvr.DtsServiceConfiguration.TopLevelFolders.Folder | Where-Object {$_.type -eq "SqlServerFolder"} | ForEach-Object {$_.ServerName = "$FailoverClusterNetworkName\$InstanceName"} - } - $MsDtsSrvr.Save($MsDtsSrvrPath) - Restart-Service -Name ("MsDtsServer" + $SQLVersion + "0") - } - } - } - - # Additional "Complete" actions - if($Action -eq "Complete") - { - # Workaround for Analysis Services IPv6 issue, see KB2658571 - if($Features.Contains("AS")) - { - $msmredirpath = [Environment]::ExpandEnvironmentVariables("%ProgramFiles(x86)%\Microsoft SQL Server\90\Shared\ASConfig\msmdredir.ini") - if(Test-Path ($msmredirpath)) - { - $msmdredir = [XML](Get-Content $msmredirpath) - if($msmdredir.ConfigurationSettings.Instances.Instance | Where-Object {$_.Name -eq $InstanceName} | ForEach-Object {$_.PortIPv6}) - { - $Entry = $msmdredir.ConfigurationSettings.Instances.Instance | Where-Object {$_.Name -eq $InstanceName} | ForEach-Object {$_.SelectSingleNode('PortIPv6')} - $msmdredir.ConfigurationSettings.Instances.Instance | Where-Object {$_.Name -eq $InstanceName} | ForEach-Object {$_.RemoveChild($Entry)} - $msmdredir.Save($msmredirpath) - Stop-ClusterGroup -Name $FailoverClusterGroup - Start-ClusterGroup -Name $FailoverClusterGroup - } - } - } - - # Create path for Integration Services - if($Features.Contains("IS") -and ($ISFileSystemFolder -ne "")) - { - if(($ISFileSystemFolder.Length -ge 2) -and ($ISFileSystemFolder.Substring(1,1) -eq ":")) - { - Invoke-Command -ScriptBlock { - $ISFileSystemFolder = $args[0] - if((Test-Path -Path $ISFileSystemFolder.Substring(0,2)) -and !(Test-Path -Path $ISFileSystemFolder)) - { - New-Item -Path $ISFileSystemFolder -ItemType Directory - } - } -ComputerName . -ArgumentList @($ISFileSystemFolder) - } - } - } - - if($ForceReboot -or ((Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Name 'PendingFileRenameOperations' -ErrorAction SilentlyContinue) -ne $null)) - { - if(!($SuppressReboot)) - { - $global:DSCMachineStatus = 1 - } - else - { - Write-Verbose "Suppressing reboot" - } - } - - if(!(Test-TargetResource @PSBoundParameters)) - { - throw New-TerminatingError -ErrorType TestFailedAfterSet -ErrorCategory InvalidResult - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Prepare","Complete")] - [System.String] - $Action, - - [System.String] - $SourcePath = "$PSScriptRoot\..\..\", - - [System.String] - $SourceFolder = "Source", - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [System.Management.Automation.PSCredential] - $SourceCredential, - - [System.Boolean] - $SuppressReboot, - - [System.Boolean] - $ForceReboot, - - [parameter(Mandatory = $true)] - [System.String] - $Features, - - [parameter(Mandatory = $true)] - [System.String] - $InstanceName, - - [System.String] - $InstanceID = $InstanceName, - - [System.String] - $PID, - - [System.String] - $UpdateEnabled = $True, - - [System.String] - $UpdateSource = ".\Updates", - - [System.String] - $SQMReporting, - - [System.String] - $ErrorReporting, - - [System.String] - $FailoverClusterGroup = "SQL Server ($InstanceName)", - - [parameter(Mandatory = $true)] - [System.String] - $FailoverClusterNetworkName, - - [System.String] - $FailoverClusterIPAddress, - - [System.String] - $InstallSharedDir, - - [System.String] - $InstallSharedWOWDir, - - [System.String] - $InstanceDir, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SQLSvcAccount, - - [System.Management.Automation.PSCredential] - $AgtSvcAccount = $SQLSvcAccount, - - [System.String] - $SQLCollation, - - [System.String[]] - $SQLSysAdminAccounts, - - [System.String] - $SecurityMode, - - [System.Management.Automation.PSCredential] - $SAPwd = $SetupCredential, - - [System.String] - $InstallSQLDataDir, - - [System.String] - $SQLUserDBDir, - - [System.String] - $SQLUserDBLogDir, - - [System.String] - $SQLTempDBDir, - - [System.String] - $SQLTempDBLogDir, - - [System.String] - $SQLBackupDir, - - [System.Management.Automation.PSCredential] - $ASSvcAccount = $SQLSvcAccount, - - [System.String] - $ASCollation, - - [System.String[]] - $ASSysAdminAccounts, - - [System.String] - $ASDataDir, - - [System.String] - $ASLogDir, - - [System.String] - $ASBackupDir, - - [System.String] - $ASTempDir, - - [System.String] - $ASConfigDir, - - [System.Management.Automation.PSCredential] - $ISSvcAccount = $SQLSvcAccount, - - [System.String] - $ISFileSystemFolder - ) - - switch($Action) - { - "Prepare" - { - $SQLData = Get-TargetResource @PSBoundParameters - - $result = $true - foreach($Feature in $Features.Split(",")) - { - if(!($SQLData.Features.Contains($Feature))) - { - $result = $false - } - } - } - "Complete" - { - if(Get-WmiObject -Namespace root/mscluster -Class MSCluster_ResourceGroup -ErrorAction SilentlyContinue | Where-Object {$_.Name -eq $FailoverClusterGroup}) - { - $result = $true - } - else - { - $result = $false - } - } - } - - $result -} - - -function GetSQLVersion -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory=$true)] - [String] - $Path - ) - - (Get-Item -Path $Path).VersionInfo.ProductVersion.Split(".")[0] -} - - -function GetFirstItemPropertyValue -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory=$true)] - [String] - $Path, - - [Parameter(Mandatory=$true)] - [String] - $Name - ) - - if(Get-ItemProperty -Path "$Path\$Name" -ErrorAction SilentlyContinue) - { - $FirstName = ((Get-ItemProperty -Path "$Path\$Name") | Get-Member -MemberType NoteProperty | Where-Object {$_.Name.Substring(0,2) -ne "PS"}).Name[0] - (Get-ItemProperty -Path "$Path\$Name" -Name $FirstName).$FirstName.TrimEnd("\") - } -} - - -function ConvertDecimalIP -{ - [CmdLetBinding()] - param( - [Parameter(Mandatory = $true)] - [Net.IPAddress] - $IPAddress - ) - - $i = 3 - $DecimalIP = 0 - $IPAddress.GetAddressBytes() | ForEach-Object { - $DecimalIP += $_ * [Math]::Pow(256,$i) - $i-- - } - - return [UInt32]$DecimalIP -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerFailoverClusterSetup/MSFT_xSQLServerFailoverClusterSetup.schema.mof b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerFailoverClusterSetup/MSFT_xSQLServerFailoverClusterSetup.schema.mof deleted file mode 100644 index 1de6c331..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerFailoverClusterSetup/MSFT_xSQLServerFailoverClusterSetup.schema.mof +++ /dev/null @@ -1,51 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSQLServerFailoverClusterSetup")] -class MSFT_xSQLServerFailoverClusterSetup : OMI_BaseResource -{ - [Key, Description("Prepare or Complete."), ValueMap{"Prepare","Complete"}, Values{"Prepare","Complete"}] String Action; - [Write, Description("UNC path to the root of the source files for installation.")] String SourcePath; - [Write, Description("Folder within the source path containing the source files for installation.")] String SourceFolder; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the installation.")] String SetupCredential; - [Write, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to access SourcePath.")] String SourceCredential; - [Write, Description("Suppress reboot.")] Boolean SuppressReboot; - [Write, Description("Force reboot.")] Boolean ForceReboot; - [Required, Description("SQL features to be installed.")] String Features; - [Key, Description("SQL instance to be installed.")] String InstanceName; - [Write, Description("SQL instance ID, if different from InstanceName.")] String InstanceID; - [Write, Description("Product key for licensed installations.")] String PID; - [Write, Description("Enabled updates during installation.")] String UpdateEnabled; - [Write, Description("Source of updates to be applied during installation.")] String UpdateSource; - [Write, Description("Enable customer experience reporting.")] String SQMReporting; - [Write, Description("Enable error reporting.")] String ErrorReporting; - [Write, Description("Name of the resource group to be used for the SQL Server failover cluster.")] String FailoverClusterGroup; - [Required, Description("Network name for the SQL Server failover cluster.")] String FailoverClusterNetworkName; - [Write, Description("IPv4 address for the SQL Server failover cluster.")] String FailoverClusterIPAddress; - [Write, Description("Installation path for shared SQL files.")] String InstallSharedDir; - [Write, Description("Installation path for x86 shared SQL files.")] String InstallSharedWOWDir; - [Write, Description("Installation path for SQL instance files.")] String InstanceDir; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Service account for the SQL service.")] String SQLSvcAccount; - [Read, Description("Output username for the SQL service.")] String SQLSvcAccountUsername; - [Write, EmbeddedInstance("MSFT_Credential"), Description("Service account for the SQL Agent service.")] String AgtSvcAccount; - [Read, Description("Output username for the SQL Agent service.")] String AgtSvcAccountUsername; - [Write, Description("Collation for SQL.")] String SQLCollation; - [Write, Description("Array of accounts to be made SQL administrators.")] String SQLSysAdminAccounts[]; - [Write, Description("Security mode.")] String SecurityMode; - [Write, EmbeddedInstance("MSFT_Credential"), Description("SA password, if SecurityMode=SQL")] String SAPwd; - [Write, Description("Root path for SQL database files.")] String InstallSQLDataDir; - [Write, Description("Path for SQL database files.")] String SQLUserDBDir; - [Write, Description("Path for SQL log files.")] String SQLUserDBLogDir; - [Write, Description("Path for SQL TempDB files.")] String SQLTempDBDir; - [Write, Description("Path for SQL TempDB log files.")] String SQLTempDBLogDir; - [Write, Description("Path for SQL backup files.")] String SQLBackupDir; - [Write, EmbeddedInstance("MSFT_Credential"), Description("Service account for Analysus Services service.")] String ASSvcAccount; - [Read, Description("Output username for the Analysis Services service.")] String ASSvcAccountUsername; - [Write, Description("Collation for Analysis Services.")] String ASCollation; - [Write, Description("Array of accounts to be made Analysis Services admins.")] String ASSysAdminAccounts[]; - [Write, Description("Path for Analysis Services data files.")] String ASDataDir; - [Write, Description("Path for Analysis Services log files.")] String ASLogDir; - [Write, Description("Path for Analysis Services backup files.")] String ASBackupDir; - [Write, Description("Path for Analysis Services temp files.")] String ASTempDir; - [Write, Description("Path for Analysis Services config.")] String ASConfigDir; - [Write, EmbeddedInstance("MSFT_Credential"), Description("Service account for Integration Services service.")] String ISSvcAccount; - [Read, Description("Output username for the Integration Services service.")] String ISSvcAccountUsername; - [Write, Description("File system folder for Integration Services.")] String ISFileSystemFolder; -}; diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerFirewall/MSFT_xSQLServerFirewall.psm1 b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerFirewall/MSFT_xSQLServerFirewall.psm1 deleted file mode 100644 index c7b6f20d..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerFirewall/MSFT_xSQLServerFirewall.psm1 +++ /dev/null @@ -1,806 +0,0 @@ -$script:currentPath = Split-Path -Path $MyInvocation.MyCommand.Path -Parent -Import-Module -Name (Join-Path -Path (Split-Path -Path (Split-Path -Path $script:currentPath -Parent) -Parent) -ChildPath 'xSQLServerHelper.psm1') - -<# - .SYNOPSIS - Returns the current state of the firewall rules. - - .PARAMETER SourcePath - The path to the root of the source files for installation. I.e and UNC path to a shared resource. Environment variables can be used in the path. - - .PARAMETER Features - One or more SQL feature to create default firewall rules for. Each feature should be seperated with a comma, i.e. 'SQLEngine,IS,RS'. - - .PARAMETER SourceCredential - Credentials used to access the path set in the parameter `SourcePath`. - - .PARAMETER InstanceName - Name of the instance to get firewall rules for. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter()] - [System.String] - $SourcePath, - - [Parameter(Mandatory = $true)] - [System.String] - $Features, - - [Parameter(Mandatory = $true)] - [System.String] - $InstanceName, - - [Parameter()] - [System.Management.Automation.PSCredential] - $SourceCredential - ) - - $InstanceName = $InstanceName.ToUpper() - - $SourcePath = [Environment]::ExpandEnvironmentVariables($SourcePath) - - if ($SourceCredential) - { - $newSmbMappingParameters = @{ - RemotePath = $SourcePath - UserName = "$($SourceCredential.GetNetworkCredential().Domain)\$($SourceCredential.GetNetworkCredential().UserName)" - Password = $($SourceCredential.GetNetworkCredential().Password) - } - - $null = New-SmbMapping @newSmbMappingParameters - } - - $pathToSetupExecutable = Join-Path -Path $SourcePath -ChildPath 'setup.exe' - - New-VerboseMessage -Message "Using path: $pathToSetupExecutable" - - $sqlVersion = Get-SqlMajorVersion -Path $pathToSetupExecutable - - if ($SourceCredential) - { - Remove-SmbMapping -RemotePath $SourcePath -Force - } - - if($InstanceName -eq 'MSSQLSERVER') - { - $databaseServiceName = 'MSSQLSERVER' - $reportServiceName = 'ReportServer' - $analysisServiceName = 'MSSQLServerOLAPService' - } - else - { - $databaseServiceName = 'MSSQL${0}' -f $InstanceName - $reportServiceName = 'ReportServer${0}' -f $InstanceName - $analysisServiceName = 'MSOLAP${0}' -f $InstanceName - } - - $integrationServiceName = 'MsDtsServer{0}0' -f $sqlVersion - $browserServiceName = 'SQLBrowser' - - $ensure = 'Present' - $featuresInstalled = '' - - $services = Get-Service - - foreach ($currentFeature in $Features.Split(',')) - { - switch ($currentFeature) - { - 'SQLENGINE' - { - if ($services | Where-Object {$_.Name -eq $databaseServiceName}) - { - $featuresInstalled += "$_," - - $pathToDatabaseEngineExecutable = Join-Path -Path (Get-SQLPath -Feature $_ -InstanceName $InstanceName) -ChildPath 'sqlservr.exe' - $databaseEngineFirewallRuleDisplayName = "SQL Server Database Engine instance $InstanceName" - - $databaseEngineFirewallRuleParameters = @{ - DisplayName = $databaseEngineFirewallRuleDisplayName - Program = $pathToDatabaseEngineExecutable - Enabled = 'True' - Profile = 'Any' - Direction = 'Inbound' - } - - if (Test-IsFirewallRuleInDesiredState @databaseEngineFirewallRuleParameters) - { - $databaseEngineFirewall = $true - } - else - { - $databaseEngineFirewall = $false - } - - $browserFirewallRuleDisplayName = 'SQL Server Browser' - - $browserFirewallRuleParameters = @{ - DisplayName = $browserFirewallRuleDisplayName - Service = $browserServiceName - Enabled = 'True' - Profile = 'Any' - Direction = 'Inbound' - } - - if (Test-IsFirewallRuleInDesiredState @browserFirewallRuleParameters) - { - $browserFirewall = $true - } - else - { - $browserFirewall = $false - } - } - } - - 'RS' - { - if ($services | Where-Object {$_.Name -eq $reportServiceName}) - { - $featuresInstalled += "$_," - - $reportingServicesNoSslProtocol = 'TCP' - $reportingServicesNoSslLocalPort = '80' - $reportingServicesNoSslFirewallRuleDisplayName = 'SQL Server Reporting Services 80' - - $reportingServicesNoSslFirewallRuleParameters = @{ - DisplayName = $reportingServicesNoSslFirewallRuleDisplayName - Protocol = $reportingServicesNoSslProtocol - LocalPort = $reportingServicesNoSslLocalPort - Enabled = 'True' - Profile = 'Any' - Direction = 'Inbound' - } - - $reportingServicesSslProtocol = 'TCP' - $reportingServicesSslLocalPort = '443' - $reportingServicesSslFirewallRuleDisplayName = 'SQL Server Reporting Services 443' - - $reportingServicesSslFirewallRuleParameters = @{ - DisplayName = $reportingServicesSslFirewallRuleDisplayName - Protocol = $reportingServicesSslProtocol - LocalPort = $reportingServicesSslLocalPort - Enabled = 'True' - Profile = 'Any' - Direction = 'Inbound' - } - - if ((Test-IsFirewallRuleInDesiredState @reportingServicesNoSslFirewallRuleParameters) ` - -and (Test-IsFirewallRuleInDesiredState @reportingServicesSslFirewallRuleParameters)) - { - $reportingServicesFirewall = $true - } - else - { - $reportingServicesFirewall = $false - } - } - } - - 'AS' - { - if ($services | Where-Object {$_.Name -eq $analysisServiceName}) - { - $featuresInstalled += "$_," - - $analysisServicesFirewallRuleDisplayName = "SQL Server Analysis Services instance $InstanceName" - - $analysisServicesFirewallRuleParameters = @{ - DisplayName = $analysisServicesFirewallRuleDisplayName - Service = $analysisServiceName - Enabled = 'True' - Profile = 'Any' - Direction = 'Inbound' - } - - if (Test-IsFirewallRuleInDesiredState @analysisServicesFirewallRuleParameters) - { - $analysisServicesFirewall = $true - } - else - { - $analysisServicesFirewall = $false - } - - $browserFirewallRuleDisplayName = 'SQL Server Browser' - - $browserFirewallRuleParameters = @{ - DisplayName = $browserFirewallRuleDisplayName - Service = $browserServiceName - Enabled = 'True' - Profile = 'Any' - Direction = 'Inbound' - } - - if (Test-IsFirewallRuleInDesiredState @browserFirewallRuleParameters) - { - $browserFirewall = $true - } - else - { - $browserFirewall = $false - } - } - } - - 'IS' - { - if ($services | Where-Object {$_.Name -eq $integrationServiceName}) - { - $featuresInstalled += "$_," - - $integrationServicesRuleApplicationDisplayName = 'SQL Server Integration Services Application' - $pathToIntegrationServicesExecutable = (Join-Path -Path (Join-Path -Path (Get-SQLPath -Feature 'IS' -SQLVersion $sqlVersion) -ChildPath 'Binn') -ChildPath 'MsDtsSrvr.exe') - - $integrationServicesFirewallRuleApplicationParameters = @{ - DisplayName = $integrationServicesRuleApplicationDisplayName - Program = $pathToIntegrationServicesExecutable - Enabled = 'True' - Profile = 'Any' - Direction = 'Inbound' - } - - $integrationServicesProtocol = 'TCP' - $integrationServicesLocalPort = '135' - $integrationServicesFirewallRuleDisplayName = 'SQL Server Integration Services Port' - - $integrationServicesFirewallRulePortParameters = @{ - DisplayName = $integrationServicesFirewallRuleDisplayName - Protocol = $integrationServicesProtocol - LocalPort = $integrationServicesLocalPort - Enabled = 'True' - Profile = 'Any' - Direction = 'Inbound' - } - - if ((Test-IsFirewallRuleInDesiredState @integrationServicesFirewallRuleApplicationParameters) ` - -and (Test-IsFirewallRuleInDesiredState @integrationServicesFirewallRulePortParameters)) - { - $integrationServicesFirewall = $true - } - else - { - $integrationServicesFirewall = $false - } - } - } - } - } - - if ( - ($Features -match 'SQLENGINE' -and -not ($databaseEngineFirewall -and $browserFirewall)) ` - -or ($Features -match 'RS' -and -not $reportingServicesFirewall) ` - -or ($Features -match 'AS' -and -not ($analysisServicesFirewall -and $browserFirewall)) ` - -or ($Features -match 'IS' -and -not $integrationServicesFirewall) - ) - { - $ensure = 'Absent' - } - - - $featuresInstalled = $featuresInstalled.Trim(',') - - return @{ - Ensure = $ensure - SourcePath = $SourcePath - Features = $featuresInstalled - InstanceName = $InstanceName - DatabaseEngineFirewall = $databaseEngineFirewall - BrowserFirewall = $browserFirewall - ReportingServicesFirewall = $reportingServicesFirewall - AnalysisServicesFirewall = $analysisServicesFirewall - IntegrationServicesFirewall = $integrationServicesFirewall - } -} - -<# - .SYNOPSIS - Creates, updates or remove the firewall rules. - - .PARAMETER Ensure - If the firewall rules should be present ('Present') or absent ('Absent'). The default value is 'Present'. - - .PARAMETER SourcePath - The path to the root of the source files for installation. I.e and UNC path to a shared resource. Environment variables can be used in the path. - - .PARAMETER Features - One or more SQL feature to create default firewall rules for. Each feature should be seperated with a comma, i.e. 'SQLEngine,IS,RS'. - - .PARAMETER SourceCredential - Credentials used to access the path set in the parameter `SourcePath`. - - .PARAMETER InstanceName - Name of the instance to get firewall rules for. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter()] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present', - - [Parameter()] - [System.String] - $SourcePath, - - [Parameter(Mandatory = $true)] - [System.String] - $Features, - - [Parameter(Mandatory = $true)] - [System.String] - $InstanceName, - - [Parameter()] - [System.Management.Automation.PSCredential] - $SourceCredential - ) - - $InstanceName = $InstanceName.ToUpper() - - $SourcePath = [Environment]::ExpandEnvironmentVariables($SourcePath) - - if ($SourceCredential) - { - $newSmbMappingParameters = @{ - RemotePath = $SourcePath - UserName = "$($SourceCredential.GetNetworkCredential().Domain)\$($SourceCredential.GetNetworkCredential().UserName)" - Password = $($SourceCredential.GetNetworkCredential().Password) - } - - $null = New-SmbMapping @newSmbMappingParameters - } - - $path = Join-Path -Path $SourcePath -ChildPath 'setup.exe' - - New-VerboseMessage -Message "Using path: $path" - - $sqlVersion = Get-SqlMajorVersion -Path $path - - if ($SourceCredential) - { - Remove-SmbMapping -RemotePath $SourcePath -Force - } - - if ($InstanceName -eq 'MSSQLSERVER') - { - $analysisServiceName = 'MSSQLServerOLAPService' - } - else - { - $analysisServiceName = 'MSOLAP${0}' -f $InstanceName - } - - $browserServiceName = 'SQLBrowser' - - $getTargetResourceResult = Get-TargetResource -SourcePath $SourcePath -Features $Features -InstanceName $InstanceName - - foreach ($currentFeature in $getTargetResourceResult.Features.Split(',')) - { - switch ($currentFeature) - { - 'SQLENGINE' - { - if (-not ($getTargetResourceResult.DatabaseEngineFirewall)) - { - $pathToDatabaseEngineExecutable = Join-Path -Path (Get-SQLPath -Feature $_ -InstanceName $InstanceName) -ChildPath 'sqlservr.exe' - $databaseEngineFirewallRuleDisplayName = "SQL Server Database Engine instance $InstanceName" - - $databaseEngineFirewallRuleParameters = @{ - DisplayName = $databaseEngineFirewallRuleDisplayName - Program = $pathToDatabaseEngineExecutable - Enabled = 'True' - Profile = 'Any' - Direction = 'Inbound' - } - - if (-not (Test-IsFirewallRuleInDesiredState @databaseEngineFirewallRuleParameters)) - { - New-NetFirewallRule @databaseEngineFirewallRuleParameters - } - } - - if (-not ($getTargetResourceResult.BrowserFirewall)) - { - $browserFirewallRuleDisplayName = 'SQL Server Browser' - - $browserFirewallRuleParameters = @{ - DisplayName = $browserFirewallRuleDisplayName - Service = $browserServiceName - Enabled = 'True' - Profile = 'Any' - Direction = 'Inbound' - } - - if (-not (Test-IsFirewallRuleInDesiredState @browserFirewallRuleParameters)) - { - New-NetFirewallRule @browserFirewallRuleParameters - } - } - } - - 'RS' - { - if (-not ($getTargetResourceResult.ReportingServicesFirewall)) - { - $reportingServicesNoSslProtocol = 'TCP' - $reportingServicesNoSslLocalPort = '80' - $reportingServicesNoSslFirewallRuleDisplayName = 'SQL Server Reporting Services 80' - - $reportingServicesNoSslFirewallRuleParameters = @{ - DisplayName = $reportingServicesNoSslFirewallRuleDisplayName - Protocol = $reportingServicesNoSslProtocol - LocalPort = $reportingServicesNoSslLocalPort - Enabled = 'True' - Profile = 'Any' - Direction = 'Inbound' - } - - if (-not (Test-IsFirewallRuleInDesiredState @reportingServicesNoSslFirewallRuleParameters)) - { - New-NetFirewallRule @reportingServicesNoSslFirewallRuleParameters - } - - $reportingServicesSslProtocol = 'TCP' - $reportingServicesSslLocalPort = '443' - $reportingServicesSslFirewallRuleDisplayName = 'SQL Server Reporting Services 443' - - $reportingServicesSslFirewallRuleParameters = @{ - DisplayName = $reportingServicesSslFirewallRuleDisplayName - Protocol = $reportingServicesSslProtocol - LocalPort = $reportingServicesSslLocalPort - Enabled = 'True' - Profile = 'Any' - Direction = 'Inbound' - } - - if (-not (Test-IsFirewallRuleInDesiredState @reportingServicesSslFirewallRuleParameters)) - { - New-NetFirewallRule @reportingServicesSslFirewallRuleParameters - } - } - } - - 'AS' - { - if (-not ($getTargetResourceResult.AnalysisServicesFirewall)) - { - $analysisServicesFirewallRuleDisplayName = "SQL Server Analysis Services instance $InstanceName" - - $analysisServicesFirewallRuleParameters = @{ - DisplayName = $analysisServicesFirewallRuleDisplayName - Service = $analysisServiceName - Enabled = 'True' - Profile = 'Any' - Direction = 'Inbound' - } - - if(-not (Test-IsFirewallRuleInDesiredState @analysisServicesFirewallRuleParameters)) - { - New-NetFirewallRule @analysisServicesFirewallRuleParameters - } - } - - if (-not ($getTargetResourceResult.BrowserFirewall)) - { - $browserFirewallRuleDisplayName = 'SQL Server Browser' - - $browserFirewallRuleParameters = @{ - DisplayName = $browserFirewallRuleDisplayName - Service = $browserServiceName - Enabled = 'True' - Profile = 'Any' - Direction = 'Inbound' - } - - if (-not (Test-IsFirewallRuleInDesiredState @browserFirewallRuleParameters)) - { - New-NetFirewallRule @browserFirewallRuleParameters - } - } - } - - 'IS' - { - if (!($getTargetResourceResult.IntegrationServicesFirewall)) - { - $integrationServicesRuleApplicationDisplayName = 'SQL Server Integration Services Application' - $pathToIntegrationServicesExecutable = (Join-Path -Path (Join-Path -Path (Get-SQLPath -Feature 'IS' -SQLVersion $sqlVersion) -ChildPath 'Binn') -ChildPath 'MsDtsSrvr.exe') - - $integrationServicesFirewallRuleApplicationParameters = @{ - DisplayName = $integrationServicesRuleApplicationDisplayName - Program = $pathToIntegrationServicesExecutable - Enabled = 'True' - Profile = 'Any' - Direction = 'Inbound' - } - - if (-not (Test-IsFirewallRuleInDesiredState @integrationServicesFirewallRuleApplicationParameters)) - { - New-NetFirewallRule @integrationServicesFirewallRuleApplicationParameters - } - - $integrationServicesProtocol = 'TCP' - $integrationServicesLocalPort = '135' - $integrationServicesFirewallRuleDisplayName = 'SQL Server Integration Services Port' - - $integrationServicesFirewallRulePortParameters = @{ - DisplayName = $integrationServicesFirewallRuleDisplayName - Protocol = $integrationServicesProtocol - LocalPort = $integrationServicesLocalPort - Enabled = 'True' - Profile = 'Any' - Direction = 'Inbound' - } - - if (-not (Test-IsFirewallRuleInDesiredState @integrationServicesFirewallRulePortParameters)) - { - New-NetFirewallRule @integrationServicesFirewallRulePortParameters - } - } - } - } - } - - if (-not (Test-TargetResource -SourcePath $SourcePath -Features $Features -InstanceName $InstanceName)) - { - throw New-TerminatingError -ErrorType TestFailedAfterSet -ErrorCategory InvalidResult - } -} - -<# - .SYNOPSIS - Test if the firewall rules are in desired state. - - .PARAMETER Ensure - If the firewall rules should be present ('Present') or absent ('Absent'). The default value is 'Present'. - - .PARAMETER SourcePath - The path to the root of the source files for installation. I.e and UNC path to a shared resource. Environment variables can be used in the path. - - .PARAMETER Features - One or more SQL feature to create default firewall rules for. Each feature should be seperated with a comma, i.e. 'SQLEngine,IS,RS'. - - .PARAMETER SourceCredential - Credentials used to access the path set in the parameter `SourcePath`. - - .PARAMETER InstanceName - Name of the instance to get firewall rules for. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter()] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present', - - [Parameter()] - [System.String] - $SourcePath, - - [Parameter(Mandatory = $true)] - [System.String] - $Features, - - [Parameter(Mandatory = $true)] - [System.String] - $InstanceName, - - [Parameter()] - [System.Management.Automation.PSCredential] - $SourceCredential - ) - - $getTargetResourceResult = Get-TargetResource -SourcePath $SourcePath -Features $Features -InstanceName $InstanceName - - return ($getTargetResourceResult.Ensure -eq $Ensure) -} - -<# - .SYNOPSIS - Get the path to SQL Server executables. - - .PARAMETER Feature - String containing the feature name for which to get the path. - - .PARAMETER InstanceName - String containing the name of the instance for which to get the path. - - .PARAMETER SQLVersion - String containing the major version of the SQL server to get the path for. - This is used to evaluate the Integration Services version number. -#> -function Get-SQLPath -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory=$true)] - [String] - $Feature, - - [Parameter()] - [String] - $InstanceName, - - [Parameter()] - [String] - $SQLVersion - ) - - if (($Feature -eq 'SQLENGINE') -or ($Feature -eq 'AS')) - { - switch ($Feature) - { - 'SQLENGINE' - { - $productinstanceId = 'SQL' - } - - 'AS' - { - $productinstanceId = 'OLAP' - } - } - - $instanceId = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\$($productinstanceId)" -Name $InstanceName).$InstanceName - $path = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\$($instanceId)\setup" -Name 'SQLBinRoot').SQLBinRoot - } - - if ($Feature -eq 'IS') - { - $path = (Get-ItemProperty -Path ("HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\$($SQLVersion)0\DTS\setup") -Name 'SQLPath').SQLPath - } - - return $path -} - -<# - .SYNOPSIS - Evaluates if the firewall rule is in desired state. - - .PARAMETER DisplayName - String containing the display name for the firewall rule. - - .PARAMETER Enabled - String containing either 'True' or 'False' meaning if the firewall rule should be active or not. - - .PARAMETER Profile - String containing one or more profiles to which the firewall rule is assigned. - - .PARAMETER Direction - String containing the direction of traffic for the the firewall rule. It can be either 'Inbound' or 'Outbound'. - - .PARAMETER Program - String containing the path to an executable. This paramater is optional. - - .PARAMETER Service - String containing the name of a service for the firewall rule. This parameter is optional. - - .PARAMETER Protocol - String containing the protocol for the local port parameter. This parameter is optional. - - .PARAMETER LocalPort - String containing the local port for the firewall rule. This parameter is optional, with the exception that if - the parameter Protocol is specified this parameter must also be specified. -#> -function Test-IsFirewallRuleInDesiredState -{ - [OutputType([System.Boolean])] - [CmdletBinding()] - param - ( - [Parameter(Mandatory=$true)] - [String] - $DisplayName, - - [Parameter(Mandatory=$true)] - [ValidateSet('True','False')] - [String] - $Enabled, - - [Parameter(Mandatory=$true)] - [String[]] - [ValidateSet('Any','Domain','Private','Public','NotApplicable')] - $Profile, - - [Parameter(Mandatory=$true)] - [ValidateSet('Inbound','Outbound')] - [String] - $Direction, - - [Parameter()] - [String] - $Program, - - [Parameter()] - [String] - $Service, - - [Parameter()] - [ValidateSet('TCP','UDP','ICMPv4','ICMPv6')] - [String] - $Protocol, - - [Parameter()] - [String] - $LocalPort - ) - - $isRuleInDesiredState = $false - - if ($firewallRule = Get-NetFirewallRule -DisplayName $DisplayName -ErrorAction SilentlyContinue) - { - if (($firewallRule.Enabled -eq $Enabled) -and ($firewallRule.Profile -eq $Profile) -and ($firewallRule.Direction -eq $Direction)) - { - if ($PSBoundParameters.ContainsKey('Program')) - { - if ($firewallApplicationFilter = Get-NetFirewallApplicationFilter -AssociatedNetFirewallRule $firewallRule -ErrorAction SilentlyContinue) - { - if ($firewallApplicationFilter.Program -eq $Program) - { - $isRuleInDesiredState = $true - } - } - } - - if ($PSBoundParameters.ContainsKey('Service')) - { - if ($firewallServiceFilter = Get-NetFirewallServiceFilter -AssociatedNetFirewallRule $firewallRule -ErrorAction SilentlyContinue) - { - if ($firewallServiceFilter.Service -eq $Service) - { - $isRuleInDesiredState = $true - } - } - } - - if ($PSBoundParameters.ContainsKey('Protocol') -and $PSBoundParameters.ContainsKey('LocalPort')) - { - if ($firewallPortFilter = Get-NetFirewallPortFilter -AssociatedNetFirewallRule $firewallRule -ErrorAction SilentlyContinue) - { - if ($firewallPortFilter.Protocol -eq $Protocol -and $firewallPortFilter.LocalPort -eq $LocalPort) - { - $isRuleInDesiredState = $true - } - } - } - } - } - - return $isRuleInDesiredState -} - -<# - .SYNOPSIS - Returns the SQL Server major version from the setup.exe executable provided in the Path parameter. - - .PARAMETER Path - String containing the path to the SQL Server setup.exe executable. -#> -function Get-SqlMajorVersion -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory=$true)] - [String] - $path - ) - - (Get-Item -Path $path).VersionInfo.ProductVersion.Split('.')[0] -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerFirewall/MSFT_xSQLServerFirewall.schema.mof b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerFirewall/MSFT_xSQLServerFirewall.schema.mof deleted file mode 100644 index 8879b045..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerFirewall/MSFT_xSQLServerFirewall.schema.mof +++ /dev/null @@ -1,14 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSQLServerFirewall")] -class MSFT_xSQLServerFirewall : OMI_BaseResource -{ - [Write, Description("An enumerated value that describes if the SQL firewall rules are is expected to be enabled on the machine.\nPresent {default} \nAbsent \n"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, Description("UNC path to the root of the source files for installation.")] String SourcePath; - [Key, Description("SQL features to enable firewall rules for.")] String Features; - [Key, Description("SQL instance to enable firewall rules for.")] String InstanceName; - [Read, Description("Is the firewall rule for the Database Engine enabled?")] boolean DatabaseEngineFirewall; - [Read, Description("Is the firewall rule for the Browser enabled?")] boolean BrowserFirewall; - [Read, Description("Is the firewall rule for Reporting Services enabled?")] boolean ReportingServicesFirewall; - [Read, Description("Is the firewall rule for Analysis Services enabled?")] boolean AnalysisServicesFirewall; - [Read, Description("Is the firewall rule for the Integration Services enabled?")] boolean IntegrationServicesFirewall; - [Write, EmbeddedInstance("MSFT_Credential"), Description("Credentials used to access the path set in the parameter 'SourcePath'.")] String SourceCredential; - }; diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerLogin/MSFT_xSQLServerLogin.psm1 b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerLogin/MSFT_xSQLServerLogin.psm1 deleted file mode 100644 index 3bbd95ae..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerLogin/MSFT_xSQLServerLogin.psm1 +++ /dev/null @@ -1,615 +0,0 @@ -Import-Module -Name (Join-Path -Path (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent) ` - -ChildPath 'xSQLServerHelper.psm1') ` - -Force - -<# - .SYNOPSIS - Gets the specified login by name. - - .PARAMETER Name - The name of the login to retrieve. - - .PARAMETER SQLServer - Hostname of the SQL Server to retrieve the login from. - - .PARAMETER SQLInstanceName - Name of the SQL instance to retrieve the login from. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [System.String] - $SQLServer, - - [Parameter(Mandatory = $true)] - [System.String] - $SQLInstanceName - ) - - $serverObject = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName - - Write-Verbose 'Getting SQL logins' - New-VerboseMessage -Message "Getting the login '$Name' from '$SQLServer\$SQLInstanceName'" - - $login = $serverObject.Logins[$Name] - - if ( $login ) - { - $Ensure = 'Present' - } - else - { - $Ensure = 'Absent' - } - - New-VerboseMessage -Message "The login '$Name' is $ensure from the '$SQLServer\$SQLInstanceName' instance." - - $returnValue = @{ - Ensure = $Ensure - Name = $Name - LoginType = $login.LoginType - SQLServer = $SQLServer - SQLInstanceName = $SQLInstanceName - } - - if ( $login.LoginType -eq 'SqlLogin' ) - { - $returnValue.Add('LoginMustChangePassword',$login.MustChangePassword) - $returnValue.Add('LoginPasswordExpirationEnabled',$login.PasswordExpirationEnabled) - $returnValue.Add('LoginPasswordPolicyEnforced',$login.PasswordPolicyEnforced) - } - - return $returnValue -} - -<# - .SYNOPSIS - Creates a login. - - .PARAMETER Ensure - Specifies if the login to exist. Default is 'Present'. - - .PARAMETER Name - The name of the login to retrieve. - - .PARAMETER LoginType - The type of login to create. Default is 'WindowsUser' - - .PARAMETER SQLServer - Hostname of the SQL Server to create the login on. - - .PARAMETER SQLInstanceName - Name of the SQL instance to create the login on. - - .PARAMETER LoginCredential - The credential containing the password for a SQL Login. Only applies if the login type is SqlLogin. - - .PARAMETER LoginMustChangePassword - Specifies if the login is required to have its password change on the next login. Only applies to SQL Logins. Default is $true. - - .PARAMETER LoginPasswordExpirationEnabled - Specifies if the login password is required to expire in accordance to the operating system security policy. Only applies to SQL Logins. Default is $true. - - .PARAMETER LoginPasswordPolicyEnforced - Specifies if the login password is required to conform to the password policy specified in the system security policy. Only applies to SQL Logins. Default is $true. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter()] - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure = 'Present', - - [Parameter(Mandatory = $true)] - [System.String] - $Name, - - [Parameter()] - [ValidateSet( - 'WindowsUser', - 'WindowsGroup', - 'SqlLogin', - 'Certificate', - 'AsymmetricKey', - 'ExternalUser', - 'ExternalGroup' - )] - [System.String] - $LoginType = 'WindowsUser', - - [Parameter(Mandatory = $true)] - [System.String] - $SQLServer, - - [Parameter(Mandatory = $true)] - [System.String] - $SQLInstanceName, - - [Parameter()] - [System.Management.Automation.PSCredential] - $LoginCredential, - - [Parameter()] - [bool] - $LoginMustChangePassword = $true, - - [Parameter()] - [bool] - $LoginPasswordExpirationEnabled = $true, - - [Parameter()] - [bool] - $LoginPasswordPolicyEnforced = $true - ) - - $serverObject = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName - - switch ( $Ensure ) - { - 'Present' - { - if ( $serverObject.Logins[$Name] ) - { - $login = $serverObject.Logins[$Name] - - if ( $login.LoginType -eq 'SqlLogin' ) - { - - - if ( $login.PasswordExpirationEnabled -ne $LoginPasswordExpirationEnabled ) - { - New-VerboseMessage -Message "Setting PasswordExpirationEnabled to '$LoginPasswordExpirationEnabled' for the login '$Name' on the '$SQLServer\$SQLInstanceName' instance." - $login.PasswordExpirationEnabled = $LoginPasswordExpirationEnabled - Update-SQLServerLogin -Login $login - } - - if ( $login.PasswordPolicyEnforced -ne $LoginPasswordPolicyEnforced ) - { - New-VerboseMessage -Message "Setting PasswordPolicyEnforced to '$LoginPasswordPolicyEnforced' for the login '$Name' on the '$SQLServer\$SQLInstanceName' instance." - $login.PasswordPolicyEnforced = $LoginPasswordPolicyEnforced - Update-SQLServerLogin -Login $login - } - - # Set the password if it is specified - if ( $LoginCredential ) - { - Set-SQLServerLoginPassword -Login $login -SecureString $LoginCredential.Password - } - } - } - else - { - # Some login types need additional work. These will need to be fleshed out more in the future - if ( @('Certificate','AsymmetricKey','ExternalUser','ExternalGroup') -contains $LoginType ) - { - throw New-TerminatingError -ErrorType LoginTypeNotImplemented -FormatArgs $LoginType -ErrorCategory NotImplemented - } - - if ( ( $LoginType -eq 'SqlLogin' ) -and ( -not $LoginCredential ) ) - { - throw New-TerminatingError -ErrorType LoginCredentialNotFound -FormatArgs $Name -ErrorCategory ObjectNotFound - } - - New-VerboseMessage -Message "Adding the login '$Name' to the '$SQLServer\$SQLInstanceName' instance." - - $login = New-Object -TypeName Microsoft.SqlServer.Management.Smo.Login -ArgumentList $serverObject,$Name - $login.LoginType = $LoginType - - switch ($LoginType) - { - SqlLogin - { - # Verify the instance is in Mixed authentication mode - if ( $serverObject.LoginMode -notmatch 'Mixed|Integrated' ) - { - throw New-TerminatingError -ErrorType IncorrectLoginMode -FormatArgs $SQLServer,$SQLInstanceName,$serverObject.LoginMode -ErrorCategory NotImplemented - } - - $login.PasswordPolicyEnforced = $LoginPasswordPolicyEnforced - $login.PasswordExpirationEnabled = $LoginPasswordExpirationEnabled - if ( $LoginMustChangePassword ) - { - $LoginCreateOptions = [Microsoft.SqlServer.Management.Smo.LoginCreateOptions]::MustChange - } - else - { - $LoginCreateOptions = [Microsoft.SqlServer.Management.Smo.LoginCreateOptions]::None - } - - New-SQLServerLogin -Login $login -LoginCreateOptions $LoginCreateOptions -SecureString $LoginCredential.Password -ErrorAction Stop - } - - default - { - New-SQLServerLogin -Login $login - } - } - } - } - - 'Absent' - { - if ( $serverObject.Logins[$Name] ) - { - New-VerboseMessage -Message "Dropping the login '$Name' from the '$SQLServer\$SQLInstanceName' instance." - Remove-SQLServerLogin -Login $serverObject.Logins[$Name] - } - } - } -} - -<# - .SYNOPSIS - Tests to verify the login exists and the properties are correctly set. - - .PARAMETER Ensure - Specifies if the login is supposed to exist. Default is 'Present'. - - .PARAMETER Name - The name of the login. - - .PARAMETER LoginType - The type of login. Default is 'WindowsUser' - - .PARAMETER SQLServer - Hostname of the SQL Server. - - .PARAMETER SQLInstanceName - Name of the SQL instance. - - .PARAMETER LoginCredential - The credential containing the password for a SQL Login. Only applies if the login type is SqlLogin. - - .PARAMETER LoginMustChangePassword - Specifies if the login is required to have its password change on the next login. Only applies to SQL Logins. Default is $true. - - .PARAMETER LoginPasswordExpirationEnabled - Specifies if the login password is required to expire in accordance to the operating system security policy. Only applies to SQL Logins. Default is $true. - - .PARAMETER LoginPasswordPolicyEnforced - Specifies if the login password is required to conform to the password policy specified in the system security policy. Only applies to SQL Logins. Default is $true. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter()] - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure = 'Present', - - [Parameter(Mandatory = $true)] - [System.String] - $Name, - - [Parameter()] - [ValidateSet('WindowsUser', - 'WindowsGroup', - 'SqlLogin', - 'Certificate', - 'AsymmetricKey', - 'ExternalUser', - 'ExternalGroup' - )] - [System.String] - $LoginType = 'WindowsUser', - - [Parameter(Mandatory = $true)] - [System.String] - $SQLServer, - - [Parameter(Mandatory = $true)] - [System.String] - $SQLInstanceName, - - [Parameter()] - [System.Management.Automation.PSCredential] - $LoginCredential, - - [Parameter()] - [bool] - $LoginMustChangePassword = $true, - - [Parameter()] - [bool] - $LoginPasswordExpirationEnabled = $true, - - [Parameter()] - [bool] - $LoginPasswordPolicyEnforced = $true - ) - - # Assume the test will pass - $testPassed = $true - - $getParams = @{ - Name = $Name - SQLServer = $SQLServer - SQLInstanceName = $SQLInstanceName - } - - $loginInfo = Get-TargetResource @getParams - - if ( $Ensure -ne $loginInfo.Ensure ) - { - New-VerboseMessage -Message "The login '$Name' on the instance '$SQLServer\$SQLInstanceName' is $($loginInfo.Ensure) rather than $Ensure" - $testPassed = $false - } - - if ( $Ensure -eq 'Present' ) - { - if ( $LoginType -ne $loginInfo.LoginType ) - { - New-VerboseMessage -Message "The login '$Name' on the instance '$SQLServer\$SQLInstanceName' is a $($loginInfo.LoginType) rather than $LoginType" - $testPassed = $false - } - - if ( $LoginType -eq 'SqlLogin' ) - { - if ( $LoginPasswordExpirationEnabled -ne $loginInfo.LoginPasswordExpirationEnabled ) - { - New-VerboseMessage -Message "The login '$Name' on the instance '$SQLServer\$SQLInstanceName' has PasswordExpirationEnabled set to $($loginInfo.LoginPasswordExpirationEnabled) rather than $LoginPasswordExpirationEnabled" - $testPassed = $false - } - - if ( $LoginPasswordPolicyEnforced -ne $loginInfo.LoginPasswordPolicyEnforced ) - { - New-VerboseMessage -Message "The login '$Name' on the instance '$SQLServer\$SQLInstanceName' has PasswordPolicyEnforced set to $($loginInfo.LoginPasswordPolicyEnforced) rather than $LoginPasswordPolicyEnforced" - $testPassed = $false - } - - # If testPassed is still true and a login credential was specified, test the password - if ( $testPassed -and $LoginCredential ) - { - $userCred = [System.Management.Automation.PSCredential]::new($Name, $LoginCredential.Password) - - try - { - $serverObject = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName -SetupCredential $userCred - } - catch - { - New-VerboseMessage -Message "Password validation failed for the login '$Name'." - $testPassed = $false - } - } - } - } - - return $testPassed -} - -<# - .SYNOPSIS - Alters a login. - - .PARAMETER Login - The Login object to alter. - - .NOTES - This function allows us to more easily write mocks. -#> -function Update-SQLServerLogin -{ - param - ( - [Parameter(Mandatory = $true)] - [Microsoft.SqlServer.Management.Smo.Login] - $Login - ) - - try - { - $originalErrorActionPreference = $ErrorActionPreference - $ErrorActionPreference = 'Stop' - - $Login.Alter() - } - catch - { - throw New-TerminatingError -ErrorType AlterLoginFailed -FormatArgs $Login.Name -ErrorCategory NotSpecified - } - finally - { - $ErrorActionPreference = $originalErrorActionPreference - } -} - -<# - .SYNOPSIS - Creates a login. - - .PARAMETER Login - The Login object to create. - - .PARAMETER LoginCreateOptions - The LoginCreateOptions object to use when creating a SQL login. - - .PARAMETER SecureString - The SecureString object that contains the password for a SQL login. - - .EXAMPLE - CreateLogin -Login $login -LoginCreateOptions $LoginCreateOptions -SecureString $LoginCredential.Password -ErrorAction Stop - - .EXAMPLE - CreateLogin -Login $login - - .NOTES - This function allows us to more easily write mocks. -#> -function New-SQLServerLogin -{ - [CmdletBinding(DefaultParameterSetName = 'WindowsLogin')] - param - ( - [Parameter(Mandatory = $true, ParameterSetName = 'WindowsLogin')] - [Parameter(Mandatory = $true, ParameterSetName = 'SqlLogin')] - [Microsoft.SqlServer.Management.Smo.Login] - $Login, - - [Parameter(Mandatory = $true, ParameterSetName = 'SqlLogin')] - [Microsoft.SqlServer.Management.Smo.LoginCreateOptions] - $LoginCreateOptions, - - [Parameter(Mandatory = $true, ParameterSetName = 'SqlLogin')] - [System.Security.SecureString] - $SecureString - ) - - switch ( $PSCmdlet.ParameterSetName ) - { - 'SqlLogin' - { - try - { - $originalErrorActionPreference = $ErrorActionPreference - $ErrorActionPreference = 'Stop' - - $login.Create($SecureString,$LoginCreateOptions) - } - catch [Microsoft.SqlServer.Management.Smo.FailedOperationException] - { - if ( $_.Exception.InnerException.InnerException.InnerException -match 'Password validation failed' ) - { - throw New-TerminatingError -ErrorType PasswordValidationFailed -FormatArgs $Name,$_.Exception.InnerException.InnerException.InnerException -ErrorCategory SecurityError - } - else - { - throw New-TerminatingError -ErrorType LoginCreationFailedFailedOperation -FormatArgs $Name -ErrorCategory NotSpecified - } - } - catch - { - throw New-TerminatingError -ErrorType LoginCreationFailedSqlNotSpecified -FormatArgs $Name -ErrorCategory NotSpecified - } - finally - { - $ErrorActionPreference = $originalErrorActionPreference - } - } - - 'WindowsLogin' - { - try - { - $originalErrorActionPreference = $ErrorActionPreference - $ErrorActionPreference = 'Stop' - - $login.Create() - } - catch - { - throw New-TerminatingError -ErrorType LoginCreationFailedWindowsNotSpecified -FormatArgs $Name -ErrorCategory NotSpecified - } - finally - { - $ErrorActionPreference = $originalErrorActionPreference - } - } - } -} - -<# - .SYNOPSIS - Drops a login. - - .PARAMETER Login - The Login object to drop. - - .NOTES - This function allows us to more easily write mocks. -#> -function Remove-SQLServerLogin -{ - param - ( - [Parameter(Mandatory = $true)] - [Microsoft.SqlServer.Management.Smo.Login] - $Login - ) - - try - { - $originalErrorActionPreference = $ErrorActionPreference - $ErrorActionPreference = 'Stop' - - $Login.Drop() - } - catch - { - throw New-TerminatingError -ErrorType DropLoginFailed -FormatArgs $Login.Name -ErrorCategory NotSpecified - } - finally - { - $ErrorActionPreference = $originalErrorActionPreference - } -} - -<# - .SYNOPSIS - Changes the password of a SQL Login. - - .PARAMETER Login - The Login object to change the password on. - - .PARAMETER SecureString - The SecureString object that contains the password for a SQL login. - - .NOTES - This function allows us to more easily write mocks. -#> -function Set-SQLServerLoginPassword -{ - param - ( - [Parameter(Mandatory = $true)] - [Microsoft.SqlServer.Management.Smo.Login] - $Login, - - [Parameter(Mandatory = $true)] - [System.Security.SecureString] - $SecureString - ) - - try - { - $originalErrorActionPreference = $ErrorActionPreference - $ErrorActionPreference = 'Stop' - - $Login.ChangePassword($SecureString) - } - catch [Microsoft.SqlServer.Management.Smo.FailedOperationException] - { - if ( $_.Exception.InnerException.InnerException.InnerException -match 'Password validation failed' ) - { - throw New-TerminatingError -ErrorType PasswordValidationFailed -FormatArgs $Name,$_.Exception.InnerException.InnerException.InnerException -ErrorCategory SecurityError - } - else - { - throw New-TerminatingError -ErrorType PasswordChangeFailed -FormatArgs $Name -ErrorCategory NotSpecified - } - } - catch - { - throw New-TerminatingError -ErrorType PasswordChangeFailed -FormatArgs $Name -ErrorCategory NotSpecified - } - finally - { - $ErrorActionPreference = $originalErrorActionPreference - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerLogin/MSFT_xSQLServerLogin.schema.mof b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerLogin/MSFT_xSQLServerLogin.schema.mof deleted file mode 100644 index a8866341..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerLogin/MSFT_xSQLServerLogin.schema.mof +++ /dev/null @@ -1,15 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSQLServerLogin")] -class MSFT_xSQLServerLogin : OMI_BaseResource -{ - [Write, Description("The specified login is Present or Absent. Default is Present."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Key, Description("The name of the login.")] String Name; - [Write, Description("The type of login to be created. If LoginType is 'WindowsUser' or 'WindowsGroup' then provide the name in the format DOMAIN\name. Default is WindowsUser. Unsupported login types are Certificate, AsymmetricKey, ExternalUser, and ExternalGroup."), - ValueMap{"WindowsUser","WindowsGroup","SqlLogin","Certificate","AsymmetricKey","ExternalUser","ExternalGroup"}, - Values{"WindowsUser","WindowsGroup","SqlLogin","Certificate","AsymmetricKey","ExternalUser","ExternalGroup"}] String LoginType; - [Key, Description("The hostname of the SQL Server to be configured.")] String SQLServer; - [Key, Description("Name of the SQL instance to be configured.")] String SQLInstanceName; - [Write, EmbeddedInstance("MSFT_Credential"), Description("If LoginType is 'SqlLogin' then a PSCredential is needed for the password to the login.")] String LoginCredential; - [Write, Description("Specifies if the login is required to have its password change on the next login. Only applies to SQL Logins. Default is $true.")] Boolean LoginMustChangePassword; - [Write, Description("Specifies if the login password is required to expire in accordance to the operating system security policy. Only applies to SQL Logins. Default is $true.")] Boolean LoginPasswordExpirationEnabled; - [Write, Description("Specifies if the login password is required to conform to the password policy specified in the system security policy. Only applies to SQL Logins. Default is $true.")] Boolean LoginPasswordPolicyEnforced; -}; diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerMaxDop/MSFT_xSQLServerMaxDop.psm1 b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerMaxDop/MSFT_xSQLServerMaxDop.psm1 deleted file mode 100644 index 06a1a7ca..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerMaxDop/MSFT_xSQLServerMaxDop.psm1 +++ /dev/null @@ -1,282 +0,0 @@ -Import-Module -Name (Join-Path -Path (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent) ` - -ChildPath 'xSQLServerHelper.psm1') ` - -Force -<# - .SYNOPSIS - This function gets the max degree of parallelism server configuration option. - - .PARAMETER SQLServer - The host name of the SQL Server to be configured. - - .PARAMETER SQLInstanceName - The name of the SQL instance to be configured. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLInstanceName, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLServer = $env:COMPUTERNAME - ) - - $sqlServerObject = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName - - if ($sqlServerObject) - { - Write-Verbose -Message 'Getting the max degree of parallelism server configuration option' - $currentMaxDop = $sqlServerObject.Configuration.MaxDegreeOfParallelism.ConfigValue - } - - $returnValue = @{ - SQLInstanceName = $SQLInstanceName - SQLServer = $SQLServer - MaxDop = $currentMaxDop - } - - $returnValue -} - -<# - .SYNOPSIS - This function sets the max degree of parallelism server configuration option. - - .PARAMETER SQLServer - The host name of the SQL Server to be configured. - - .PARAMETER SQLInstanceName - The name of the SQL instance to be configured. - - .PARAMETER Ensure - When set to 'Present' then max degree of parallelism will be set to either the value in parameter MaxDop or dynamically configured when parameter DynamicAlloc is set to $true. - When set to 'Absent' max degree of parallelism will be set to 0 which means no limit in number of processors used in parallel plan execution. - - .PARAMETER DynamicAlloc - If set to $true then max degree of parallelism will be dynamically configured. - When this is set parameter is set to $true, the parameter MaxDop must be set to $null or not be configured. - - .PARAMETER MaxDop - A numeric value to limit the number of processors used in parallel plan execution. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLInstanceName, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLServer = $env:COMPUTERNAME, - - [Parameter()] - [ValidateSet('Present','Absent')] - [ValidateNotNullOrEmpty()] - [System.String] - $Ensure = 'Present', - - [Parameter()] - [System.Boolean] - $DynamicAlloc, - - [Parameter()] - [System.Int32] - $MaxDop - ) - - $sqlServerObject = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName - - if ($sqlServerObject) - { - Write-Verbose -Message 'Setting the max degree of parallelism server configuration option' - switch ($Ensure) - { - 'Present' - { - if ($DynamicAlloc) - { - if ($MaxDop) - { - throw New-TerminatingError -ErrorType MaxDopParamMustBeNull ` - -FormatArgs @( $SQLServer,$SQLInstanceName ) ` - -ErrorCategory InvalidArgument - } - - $targetMaxDop = Get-SqlDscDynamicMaxDop -SqlServerObject $sqlServerObject - New-VerboseMessage -Message "Dynamic MaxDop is $targetMaxDop." - } - else - { - $targetMaxDop = $MaxDop - } - } - - 'Absent' - { - $targetMaxDop = 0 - New-VerboseMessage -Message 'Desired state should be absent - MAXDOP is reset to the default value.' - } - } - - try - { - $sqlServerObject.Configuration.MaxDegreeOfParallelism.ConfigValue = $targetMaxDop - $sqlServerObject.Alter() - New-VerboseMessage -Message "Setting MAXDOP value to $targetMaxDop." - } - catch - { - throw New-TerminatingError -ErrorType MaxDopSetError ` - -FormatArgs @($SQLServer,$SQLInstanceName,$targetMaxDop) ` - -ErrorCategory InvalidOperation ` - -InnerException $_.Exception - } - } -} - -<# - .SYNOPSIS - This function tests the max degree of parallelism server configuration option. - - .PARAMETER SQLServer - The host name of the SQL Server to be configured. - - .PARAMETER SQLInstanceName - The name of the SQL instance to be configured. - - .PARAMETER Ensure - When set to 'Present' then max degree of parallelism will be set to either the value in parameter MaxDop or dynamically configured when parameter DynamicAlloc is set to $true. - When set to 'Absent' max degree of parallelism will be set to 0 which means no limit in number of processors used in parallel plan execution. - - .PARAMETER DynamicAlloc - If set to $true then max degree of parallelism will be dynamically configured. - When this is set parameter is set to $true, the parameter MaxDop must be set to $null or not be configured. - - .PARAMETER MaxDop - A numeric value to limit the number of processors used in parallel plan execution. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLInstanceName, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLServer = $env:COMPUTERNAME, - - [Parameter()] - [ValidateSet('Present','Absent')] - [ValidateNotNullOrEmpty()] - [System.String] - $Ensure = 'Present', - - [Parameter()] - [System.Boolean] - $DynamicAlloc, - - [Parameter()] - [System.Int32] - $MaxDop - ) - - Write-Verbose -Message 'Testing the max degree of parallelism server configuration option' - - $parameters = @{ - SQLInstanceName = $PSBoundParameters.SQLInstanceName - SQLServer = $PSBoundParameters.SQLServer - } - - $currentValues = Get-TargetResource @parameters - $getMaxDop = $currentValues.MaxDop - $isMaxDopInDesiredState = $true - - switch ($Ensure) - { - 'Absent' - { - if ($getMaxDop -ne 0) - { - New-VerboseMessage -Message "Current MaxDop is $getMaxDop should be updated to 0" - $isMaxDopInDesiredState = $false - } - } - 'Present' - { - if ($DynamicAlloc) - { - if ($MaxDop) - { - throw New-TerminatingError -ErrorType MaxDopParamMustBeNull ` - -FormatArgs @( $SQLServer,$SQLInstanceName ) ` - -ErrorCategory InvalidArgument - } - - $dynamicMaxDop = Get-SqlDscDynamicMaxDop - New-VerboseMessage -Message "Dynamic MaxDop is $dynamicMaxDop." - - if ($getMaxDop -ne $dynamicMaxDop) - { - New-VerboseMessage -Message "Current MaxDop is $getMaxDop should be updated to $dynamicMaxDop" - $isMaxDopInDesiredState = $false - } - } - else - { - if ($getMaxDop -ne $MaxDop) - { - New-VerboseMessage -Message "Current MaxDop is $getMaxDop should be updated to $MaxDop" - $isMaxDopInDesiredState = $false - } - } - } - } - - $isMaxDopInDesiredState -} - -<# - .SYNOPSIS - This cmdlet is used to return the dynamic max degree of parallelism -#> -function Get-SqlDscDynamicMaxDop -{ - $cimInstanceProc = Get-CimInstance -ClassName Win32_Processor - $numProcs = (Measure-Object -InputObject $cimInstanceProc -Property NumberOfLogicalProcessors -Sum).Sum - $numCores = (Measure-Object -InputObject $cimInstanceProc -Property NumberOfCores -Sum).Sum - - if ($numProcs -eq 1) - { - $dynamicMaxDop = [Math]::Round($numCores / 2, [System.MidpointRounding]::AwayFromZero) - } - elseif ($numCores -ge 8) - { - $dynamicMaxDop = 8 - } - else - { - $dynamicMaxDop = $numCores - } - - $dynamicMaxDop -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerMaxDop/MSFT_xSQLServerMaxDop.schema.mof b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerMaxDop/MSFT_xSQLServerMaxDop.schema.mof deleted file mode 100644 index 0ca9038a..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerMaxDop/MSFT_xSQLServerMaxDop.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSQLServerMaxDop")] -class MSFT_xSQLServerMaxDop : OMI_BaseResource -{ - [Write, Description("An enumerated value that describes if MaxDop is configured (Present) or reset to default value (Absent)"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, Description("Flag to Dynamically allocate Maxdop based on Best Practices")] Boolean DynamicAlloc; - [Write, Description("Numeric value to configure Maxdop to")] Sint32 MaxDop; - [Write, Description("The host name of the SQL Server to be configured. Default value is '$env:COMPUTERNAME'.")] String SQLServer; - [Key, Description("The name of the SQL instance to be configured.")] String SQLInstanceName; -}; diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerMemory/MSFT_xSQLServerMemory.psm1 b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerMemory/MSFT_xSQLServerMemory.psm1 deleted file mode 100644 index 9814ef45..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerMemory/MSFT_xSQLServerMemory.psm1 +++ /dev/null @@ -1,366 +0,0 @@ -Import-Module -Name (Join-Path -Path (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent) -ChildPath 'xSQLServerHelper.psm1') -Force - -<# - .SYNOPSIS - This function gets the value of the min and max memory server configuration option. - - .PARAMETER SQLServer - The host name of the SQL Server to be configured. - - .PARAMETER SQLInstanceName - The name of the SQL instance to be configured. -#> - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLInstanceName, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLServer = $env:COMPUTERNAME - ) - - $sqlServerObject = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName - - if ($sqlServerObject) - { - Write-Verbose -Message 'Getting the value for minimum and maximum SQL server memory.' - $minMemory = $sqlServerObject.Configuration.MinServerMemory.ConfigValue - $maxMemory = $sqlServerObject.Configuration.MaxServerMemory.ConfigValue - } - - $returnValue = @{ - SQLInstanceName = $SQLInstanceName - SQLServer = $SQLServer - MinMemory = $minMemory - MaxMemory = $maxMemory - } - - $returnValue -} - -<# - .SYNOPSIS - This function sets the value for the min and max memory server configuration option. - - .PARAMETER SQLServer - The host name of the SQL Server to be configured. - - .PARAMETER SQLInstanceName - The name of the SQL instance to be configured. - - .PARAMETER Ensure - When set to 'Present' then min and max memory will be set to either the value in parameter MinMemory and MaxMemory or dynamically configured when parameter DynamicAlloc is set to $true. - When set to 'Absent' min and max memory will be set to default values. - - .PARAMETER DynamicAlloc - If set to $true then max memory will be dynamically configured. - When this is set parameter is set to $true, the parameter MaxMemory must be set to $null or not be configured. - - .PARAMETER MinMemory - This is the minimum amount of memory, in MB, in the buffer pool used by the instance of SQL Server. - - .PARAMETER MaxMemory - This is the maximum amount of memory, in MB, in the buffer pool used by the instance of SQL Server. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLInstanceName, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLServer = $env:COMPUTERNAME, - - [Parameter()] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present', - - [Parameter()] - [System.Boolean] - $DynamicAlloc = $false, - - [Parameter()] - [System.Int32] - $MinMemory, - - [Parameter()] - [System.Int32] - $MaxMemory - ) - - $sqlServerObject = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName - - if ($sqlServerObject) - { - Write-Verbose -Message 'Setting the minimum and maximum memory used by the instance.' - switch ($Ensure) - { - 'Present' - { - if ($DynamicAlloc) - { - if ($MaxMemory) - { - throw New-TerminatingError -ErrorType MaxMemoryParamMustBeNull ` - -FormatArgs @( $SQLServer,$SQLInstanceName ) ` - -ErrorCategory InvalidArgument - } - - $MaxMemory = Get-SqlDscDynamicMaxMemory - New-VerboseMessage -Message "Dynamic maximum memory has been calculated to $($MaxMemory)MB." - } - else - { - if (-not $MaxMemory) - { - throw New-TerminatingError -ErrorType MaxMemoryParamMustNotBeNull ` - -FormatArgs @( $SQLServer,$SQLInstanceName ) ` - -ErrorCategory InvalidArgument - } - } - - $sqlServerObject.Configuration.MaxServerMemory.ConfigValue = $MaxMemory - New-VerboseMessage -Message "Maximum memory used by the instance has been limited to $($MaxMemory)MB." - } - - 'Absent' - { - $sqlServerObject.Configuration.MaxServerMemory.ConfigValue = 2147483647 - $sqlServerObject.Configuration.MinServerMemory.ConfigValue = 0 - New-VerboseMessage -Message ('Ensure is set to absent. Minimum and maximum server memory' + ` - 'values used by the instance are reset to the default values.') - } - } - - try - { - if ($MinMemory) - { - $sqlServerObject.Configuration.MinServerMemory.ConfigValue = $MinMemory - New-VerboseMessage -Message "Minimum memory used by the instance is set to $($MinMemory)MB." - } - - $sqlServerObject.Alter() - } - catch - { - throw New-TerminatingError -ErrorType AlterServerMemoryFailed ` - -FormatArgs @($SQLServer,$SQLInstanceName) ` - -ErrorCategory InvalidOperation ` - -InnerException $_.Exception - } - } -} - -<# - .SYNOPSIS - This function tests the value of the min and max memory server configuration option. - - .PARAMETER SQLServer - The host name of the SQL Server to be configured. - - .PARAMETER SQLInstanceName - The name of the SQL instance to be configured. - - .PARAMETER Ensure - When set to 'Present' then min and max memory will be set to either the value in parameter MinMemory and MaxMemory or dynamically configured when parameter DynamicAlloc is set to $true. - When set to 'Absent' min and max memory will be set to default values. - - .PARAMETER DynamicAlloc - If set to $true then max memory will be dynamically configured. - When this is set parameter is set to $true, the parameter MaxMemory must be set to $null or not be configured. - - .PARAMETER MinMemory - This is the minimum amount of memory, in MB, in the buffer pool used by the instance of SQL Server. - - .PARAMETER MaxMemory - This is the maximum amount of memory, in MB, in the buffer pool used by the instance of SQL Server. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLInstanceName, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLServer = $env:COMPUTERNAME, - - [Parameter()] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = 'Present', - - [Parameter()] - [System.Boolean] - $DynamicAlloc = $false, - - [Parameter()] - [System.Int32] - $MinMemory, - - [Parameter()] - [System.Int32] - $MaxMemory - ) - - Write-Verbose -Message 'Testing the values of the minimum and maximum memory server configuration option set to be used by the instance.' - - $getTargetResourceParameters = @{ - SQLInstanceName = $PSBoundParameters.SQLInstanceName - SQLServer = $PSBoundParameters.SQLServer - } - - $getTargetResourceResult = Get-TargetResource @getTargetResourceParameters - - $currentMinMemory = $getTargetResourceResult.MinMemory - $currentMaxMemory = $getTargetResourceResult.MaxMemory - $isServerMemoryInDesiredState = $true - - switch ($Ensure) - { - 'Absent' - { - if ($currentMaxMemory -ne 2147483647) - { - New-VerboseMessage -Message "Current maximum server memory used by the instance is $($currentMaxMemory)MB. Expected 2147483647MB." - $isServerMemoryInDesiredState = $false - } - - if ($currentMinMemory -ne 0) - { - New-VerboseMessage -Message "Current minimum server memory used by the instance is $($currentMinMemory)MB. Expected 0MB." - $isServerMemoryInDesiredState = $false - } - } - - 'Present' - { - if ($DynamicAlloc) - { - if ($MaxMemory) - { - throw New-TerminatingError -ErrorType MaxMemoryParamMustBeNull ` - -FormatArgs @( $SQLServer,$SQLInstanceName ) ` - -ErrorCategory InvalidArgument - } - - $MaxMemory = Get-SqlDscDynamicMaxMemory - New-VerboseMessage -Message "Dynamic maximum memory has been calculated to $($MaxMemory)MB." - } - else - { - if (-not $MaxMemory) - { - throw New-TerminatingError -ErrorType MaxMemoryParamMustNotBeNull ` - -FormatArgs @( $SQLServer,$SQLInstanceName ) ` - -ErrorCategory InvalidArgument - } - } - - if ($MaxMemory -ne $currentMaxMemory) - { - New-VerboseMessage -Message ("Current maximum server memory used by the instance " + ` - "is $($currentMaxMemory)MB. Expected $($MaxMemory)MB.") - $isServerMemoryInDesiredState = $false - } - - if ($MinMemory) - { - if ($MinMemory -ne $currentMinMemory) - { - New-VerboseMessage -Message ("Current minimum server memory used by the instance " + ` - "is $($currentMinMemory)MB. Expected $($MinMemory)MB.") - $isServerMemoryInDesiredState = $false - } - } - } - } - - return $isServerMemoryInDesiredState -} - -<# - .SYNOPSIS - This cmdlet is used to return the Dynamic MaxMemory of a SQL Instance -#> -function Get-SqlDscDynamicMaxMemory -{ - try - { - $physicalMemory = ((Get-CimInstance -ClassName Win32_PhysicalMemory).Capacity | Measure-Object -Sum).Sum - $physicalMemoryInMegaBytes = [Math]::Round($physicalMemory / 1MB) - - # Find how much to save for OS: 20% of total ram for under 15GB / 12.5% for over 20GB - if ($physicalMemoryInMegaBytes -ge 20480) - { - $reservedOperatingSystemMemory = [Math]::Round((0.125 * $physicalMemoryInMegaBytes)) - } - else - { - $reservedOperatingSystemMemory = [Math]::Round((0.2 * $physicalMemoryInMegaBytes)) - } - - $numberOfCores = (Get-CimInstance -ClassName Win32_Processor | Measure-Object -Property NumberOfCores -Sum).Sum - - # Get the number of SQL threads. - if ($numberOfCores -ge 4) - { - $numberOfSqlThreads = 256 + ($numberOfCores - 4) * 8 - } - else - { - $numberOfSqlThreads = 0 - } - - $operatingSystemArchitecture = (Get-CimInstance -ClassName Win32_operatingsystem).OSArchitecture - - # Find threadStackSize 1MB x86/ 2MB x64/ 4MB IA64 - if ($operatingSystemArchitecture -eq '32-bit') - { - $threadStackSize = 1 - } - elseif ($operatingSystemArchitecture -eq '64-bit') - { - $threadStackSize = 2 - } - else - { - $threadStackSize = 4 - } - - $maxMemory = $physicalMemoryInMegaBytes - $reservedOperatingSystemMemory - ($numberOfSqlThreads * $threadStackSize) - (1024 * [System.Math]::Ceiling($numberOfCores / 4)) - } - catch - { - throw New-TerminatingError -ErrorType ErrorGetDynamicMaxMemory ` - -ErrorCategory InvalidOperation ` - -InnerException $_.Exception - } - - $maxMemory -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerMemory/MSFT_xSQLServerMemory.schema.mof b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerMemory/MSFT_xSQLServerMemory.schema.mof deleted file mode 100644 index ef3ca5c8..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerMemory/MSFT_xSQLServerMemory.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSQLServerMemory")] -class MSFT_xSQLServerMemory : OMI_BaseResource -{ - [Key, Description("The name of the SQL instance to be configured.")] String SQLInstanceName; - [Write, Description("The host name of the SQL Server to be configured. Default value is $env:COMPUTERNAME.")] String SQLServer; - [Write, Description("When set to 'Present' then min and max memory will be set to either the value in parameter MinMemory and MaxMemory or dynamically configured when parameter DynamicAlloc is set to $true. When set to 'Absent' min and max memory will be set to default values. Default value is Present."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, Description("If set to $true then max memory will be dynamically configured. When this is set parameter is set to $true, the parameter MaxMemory must be set to $null or not be configured. Default value is $false.")] Boolean DynamicAlloc; - [Write, Description("Minimum amount of memory, in MB, in the buffer pool used by the instance of SQL Server.")] Sint32 MinMemory; - [Write, Description("Maximum amount of memory, in MB, in the buffer pool used by the instance of SQL Server.")] Sint32 MaxMemory; -}; diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerNetwork/MSFT_xSQLServerNetwork.psm1 b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerNetwork/MSFT_xSQLServerNetwork.psm1 deleted file mode 100644 index 5c8fb2e2..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerNetwork/MSFT_xSQLServerNetwork.psm1 +++ /dev/null @@ -1,287 +0,0 @@ -Function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param( - [parameter(Mandatory = $true)] - [System.String] - $InstanceName, - - # for now support is just for tcp protocol - # possible future feature to support additional protocols - [parameter(Mandatory = $true)] - [ValidateSet("tcp")] - [System.String] - $ProtocolName - ) - - Write-Verbose "xSQLServerNetwork.Get-TargetResourece ..." - Write-Verbose "Parameters: InstanceName = $InstanceName; ProtocolName = $ProtocolName" - - # create isolated appdomain to load version specific libs, this needed if you have multiple versions of SQL server in the same configuration - $dom_get = [System.AppDomain]::CreateDomain("xSQLServerNetwork_Get_$InstanceName") - - Try - { - $version = GetVersion -InstanceName $InstanceName - - if([string]::IsNullOrEmpty($version)) - { - throw "Unable to resolve SQL version for instance" - } - - $smo = $dom_get.Load("Microsoft.SqlServer.Smo, Version=$version.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91") - $sqlWmiManagement = $dom_get.Load("Microsoft.SqlServer.SqlWmiManagement, Version=$version.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91") - - Write-Verbose "Creating [Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer] object" - $wmi = new-object $sqlWmiManagement.GetType("Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer") - - Write-Verbose "Getting [$ProtocolName] network protocol for [$InstanceName] SQL instance" - $tcp = $wmi.ServerInstances[$InstanceName].ServerProtocols[$ProtocolName] - - Write-Verbose "Reading state values:" - $returnValue = @{ - InstanceName = $InstanceName - ProtocolName = $ProtocolName - IsEnabled = $tcp.IsEnabled - TCPDynamicPorts = $tcp.IPAddresses["IPAll"].IPAddressProperties["TcpDynamicPorts"].Value - TCPPort = $tcp.IPAddresses["IPAll"].IPAddressProperties["TcpPort"].Value - } - - $returnValue.Keys | % { Write-Verbose "$_ = $($returnValue[$_])" } - - } - Finally - { - [System.AppDomain]::Unload($dom_get) - } - - return $returnValue -} - -Function Set-TargetResource -{ - [CmdletBinding()] - param( - [parameter(Mandatory = $true)] - [System.String] - $InstanceName, - - [parameter(Mandatory = $true)] - [ValidateSet("tcp")] - [System.String] - $ProtocolName, - - [System.Boolean] - $IsEnabled, - - [ValidateSet("0")] - [System.String] - $TCPDynamicPorts, - - [System.String] - $TCPPort, - - [System.Boolean] - $RestartService = $false - ) - - Write-Verbose "xSQLServerNetwork.Set-TargetResource ..." - Write-Verbose "Parameters: InstanceName = $InstanceName; ProtocolName = $ProtocolName; IsEnabled=$IsEnabled; TCPDynamicPorts = $TCPDynamicPorts; TCPPort = $TCPPort; RestartService=$RestartService;" - - Write-Verbose "Calling xSQLServerNetwork.Get-TargetResource ..." - $currentState = Get-TargetResource -InstanceName $InstanceName -ProtocolName $ProtocolName - - # create isolated appdomain to load version specific libs, this needed if you have multiple versions of SQL server in the same configuration - $dom_set = [System.AppDomain]::CreateDomain("xSQLServerNetwork_Set_$InstanceName") - - Try - { - $version = GetVersion -InstanceName $InstanceName - - if([string]::IsNullOrEmpty($version)) - { - throw "Unable to resolve SQL version for instance" - } - - $smo = $dom_set.Load("Microsoft.SqlServer.Smo, Version=$version.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91") - $sqlWmiManagement = $dom_set.Load("Microsoft.SqlServer.SqlWmiManagement, Version=$version.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91") - - $desiredState = @{ - InstanceName = $InstanceName - ProtocolName = $ProtocolName - IsEnabled = $IsEnabled - TCPDynamicPorts = $TCPDynamicPorts - TCPPort = $TCPPort - } - - Write-Verbose "Creating [Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer] object" - $wmi = new-object $sqlWmiManagement.GetType("Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer") - - Write-Verbose "Getting [$ProtocolName] network protocol for [$InstanceName] SQL instance" - $tcp = $wmi.ServerInstances[$InstanceName].ServerProtocols[$ProtocolName] - - Write-Verbose "Checking [IsEnabled] property ..." - if($desiredState["IsEnabled"] -ine $currentState["IsEnabled"]) - { - Write-Verbose "Updating [IsEnabled] from $($currentState["IsEnabled"]) to $($desiredState["IsEnabled"])" - $tcp.IsEnabled = $desiredState["IsEnabled"] - } - - Write-Verbose "Checking [TCPDynamicPorts] property ..." - if($desiredState["TCPDynamicPorts"] -ine $currentState["TCPDynamicPorts"]) - { - Write-Verbose "Updating [TCPDynamicPorts] from $($currentState["TCPDynamicPorts"]) to $($desiredState["TCPDynamicPorts"])" - $tcp.IPAddresses["IPAll"].IPAddressProperties["TcpDynamicPorts"].Value = $desiredState["TCPDynamicPorts"] - } - - Write-Verbose "Checking [TCPPort property] ..." - if($desiredState["TCPPort"] -ine $currentState["TCPPort"]) - { - Write-Verbose "Updating [TCPPort] from $($currentState["TCPPort"]) to $($desiredState["TCPPort"])" - $tcp.IPAddresses["IPAll"].IPAddressProperties["TcpPort"].Value = $desiredState["TCPPort"] - } - - Write-Verbose "Saving changes ..." - $tcp.Alter() - - if($RestartService) - { - Write-Verbose "SQL Service will be restarted ..." - if($InstanceName -eq "MSSQLSERVER") - { - $dbServiceName = "MSSQLSERVER" - $agtServiceName = "SQLSERVERAGENT" - } - else - { - $dbServiceName = "MSSQL`$$InstanceName" - $agtServiceName = "SQLAgent`$$InstanceName" - } - - $sqlService = $wmi.Services[$dbServiceName] - $agentService = $wmi.Services[$agtServiceName] - $startAgent = ($agentService.ServiceState -eq "Running") - - if ($sqlService -eq $null) - { - throw "$dbServiceName service was not found, restart service failed" - } - - Write-Verbose "Stopping [$dbServiceName] service ..." - $sqlService.Stop() - - while($sqlService.ServiceState -ne "Stopped") - { - Start-Sleep -Milliseconds 500 - $sqlService.Refresh() - } - Write-Verbose "[$dbServiceName] service stopped" - - Write-Verbose "Starting [$dbServiceName] service ..." - $sqlService.Start() - - while($sqlService.ServiceState -ne "Running") - { - Start-Sleep -Milliseconds 500 - $sqlService.Refresh() - } - Write-Verbose "[$dbServiceName] service started" - - if ($startAgent) - { - Write-Verbose "Staring [$agtServiceName] service ..." - $agentService.Start() - while($agentService.ServiceState -ne "Running") - { - Start-Sleep -Milliseconds 500 - $agentService.Refresh() - } - Write-Verbose "[$agtServiceName] service started" - } - } - } - Finally - { - [System.AppDomain]::Unload($dom_set) - } -} - -Function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param( - [parameter(Mandatory = $true)] - [System.String] - $InstanceName, - - [parameter(Mandatory = $true)] - [ValidateSet("tcp")] - [System.String] - $ProtocolName, - - [System.Boolean] - $IsEnabled, - - [ValidateSet("0")] - [System.String] - $TCPDynamicPorts, - - [System.String] - $TCPPort, - - [System.Boolean] - $RestartService = $false - ) - - Write-Verbose "xSQLServerNetwork.Test-TargetResource ..." - Write-Verbose "Parameters: InstanceName = $InstanceName; ProtocolName = $ProtocolName; IsEnabled=$IsEnabled; TCPDynamicPorts = $TCPDynamicPorts; TCPPort = $TCPPort; RestartService=$RestartService;" - - $desiredState = @{ - InstanceName = $InstanceName - ProtocolName = $ProtocolName - IsEnabled = $IsEnabled - TCPDynamicPorts = $TCPDynamicPorts - TCPPort = $TCPPort - } - - Write-Verbose "Calling xSQLServerNetwork.Get-TargetResource ..." - $currentState = Get-TargetResource -InstanceName $InstanceName -ProtocolName $ProtocolName - - Write-Verbose "Comparing desiredState with currentSate ..." - foreach($key in $desiredState.Keys) - { - if($currentState.Keys -eq $key) - { - if($desiredState[$key] -ine $currentState[$key] ) - { - Write-Verbose "$key is different: desired = $($desiredState[$key]); current = $($currentState[$key])" - return $false - } - } - else - { - Write-Verbose "$key is missing" - return $false - } - } - - Write-Verbose "States match" - return $true -} - -Function GetVersion -{ - param( - [parameter(Mandatory = $true)] - [System.String] - $InstanceName - ) - - $instanceId = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL").$InstanceName - $sqlVersion = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\$instanceId\Setup").Version - $sqlVersion.Split(".")[0] -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerNetwork/MSFT_xSQLServerNetwork.schema.mof b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerNetwork/MSFT_xSQLServerNetwork.schema.mof deleted file mode 100644 index cf1be7c2..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerNetwork/MSFT_xSQLServerNetwork.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSQLServerNetwork")] -class MSFT_xSQLServerNetwork : OMI_BaseResource -{ - [Key, Description("SQL Server instance name of which network protocol should be configured")] String InstanceName; - [Required, Description("Network protocol name that should be configured"), ValueMap{"tcp"}, Values{"tcp"}] String ProtocolName; - [Write, Description("Is network protocol should be enabled or disabled")] Boolean IsEnabled; - [Write, Description("If dynamic ports are used should be set to 0, otherwise leave empty"), ValueMap{"0"}, Values{"0"}] String TCPDynamicPorts; - [Write, Description("Sets static port for TCP/IP")] String TCPPort; - [Write, Description("Controls if affected SQL Service should be restarted automatically")] Boolean RestartService; -}; diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerPermission/MSFT_xSQLServerPermission.psm1 b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerPermission/MSFT_xSQLServerPermission.psm1 deleted file mode 100644 index 5a75b2f3..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerPermission/MSFT_xSQLServerPermission.psm1 +++ /dev/null @@ -1,252 +0,0 @@ -$ErrorActionPreference = "Stop" - -$script:currentPath = Split-Path -Parent $MyInvocation.MyCommand.Path -Import-Module $script:currentPath\..\..\xSQLServerHelper.psm1 -ErrorAction Stop - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $InstanceName = "DEFAULT", - - [Parameter(Mandatory = $true)] - [System.String] - $NodeName, - - [Parameter(Mandatory = $true)] - [System.String] - $Principal, - - [ValidateSet('AlterAnyAvailabilityGroup','ViewServerState','AlterAnyEndPoint')] - [System.String[]] - $Permission - ) - - New-VerboseMessage -Message "Enumerating permissions for $Principal" - - try { - $instance = Get-SQLPSInstance -NodeName $NodeName -InstanceName $InstanceName - - $permissionSet = Get-SQLServerPermissionSet -Permission $Permission - $enumeratedPermission = $instance.EnumServerPermissions( $Principal, $permissionSet ) | Where-Object { $_.PermissionState -eq "Grant" } - if( $null -ne $enumeratedPermission) { - $grantedPermissionSet = Get-SQLServerPermissionSet -PermissionSet $enumeratedPermission.PermissionType - if( -not ( Compare-Object -ReferenceObject $permissionSet -DifferenceObject $grantedPermissionSet -Property $Permission ) ) { - $ensure = "Present" - } else { - $ensure = "Absent" - } - - $grantedPermission = Get-SQLPermission -ServerPermissionSet $grantedPermissionSet - } else { - $ensure = "Absent" - $grantedPermission = "" - } - } catch { - throw New-TerminatingError -ErrorType PermissionGetError -FormatArgs @($Principal) -ErrorCategory InvalidOperation -InnerException $_.Exception - } - - $returnValue = @{ - InstanceName = [System.String] $InstanceName - NodeName = [System.String] $NodeName - Ensure = [System.String] $ensure - Principal = [System.String] $Principal - Permission = [System.String[]] $grantedPermission - } - - return $returnValue -} - -function Set-TargetResource -{ - [CmdletBinding(SupportsShouldProcess)] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $InstanceName = "DEFAULT", - - [Parameter(Mandatory = $true)] - [System.String] - $NodeName, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [Parameter(Mandatory = $true)] - [System.String] - $Principal, - - [ValidateSet('AlterAnyAvailabilityGroup','ViewServerState','AlterAnyEndPoint')] - [System.String[]] - $Permission - ) - - $parameters = @{ - InstanceName = [System.String] $InstanceName - NodeName = [System.String] $NodeName - Principal = [System.String] $Principal - Permission = [System.String[]] $Permission - } - - $permissionState = Get-TargetResource @parameters - if( $null -ne $permissionState ) { - if( $Ensure -ne "" ) { - if( $permissionState.Ensure -ne $Ensure ) { - $instance = Get-SQLPSInstance -NodeName $NodeName -InstanceName $InstanceName - if( $null -ne $instance ) { - $permissionSet = Get-SQLServerPermissionSet -Permission $Permission - - if( $Ensure -eq "Present") { - if( ( $PSCmdlet.ShouldProcess( $Principal, "Grant permission" ) ) ) { - $instance.Grant($permissionSet, $Principal ) - } - } else { - if( ( $PSCmdlet.ShouldProcess( $Principal, "Revoke permission" ) ) ) { - $instance.Revoke($permissionSet, $Principal ) - } - } - } else { - throw New-TerminatingError -ErrorType PrincipalNotFound -FormatArgs @($Principal) -ErrorCategory ObjectNotFound - } - } else { - New-VerboseMessage -Message "State is already $Ensure" - } - } else { - throw New-TerminatingError -ErrorType PermissionMissingEnsure -FormatArgs @($Principal) -ErrorCategory InvalidOperation - } - } else { - throw New-TerminatingError -ErrorType UnexpectedErrorFromGet -ErrorCategory InvalidResult - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $InstanceName = "DEFAULT", - - [Parameter(Mandatory = $true)] - [System.String] - $NodeName, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [Parameter(Mandatory = $true)] - [System.String] - $Principal, - - [ValidateSet('AlterAnyAvailabilityGroup','ViewServerState','AlterAnyEndPoint')] - [System.String[]] - $Permission - ) - - $parameters = @{ - InstanceName = [System.String] $InstanceName - NodeName = [System.String] $NodeName - Principal = [System.String] $Principal - Permission = [System.String[]] $Permission - } - - New-VerboseMessage -Message "Testing state of permissions for $Principal" - - $permissionState = Get-TargetResource @parameters - if( $null -ne $permissionState ) { - [System.Boolean] $result = $false - if( $permissionState.Ensure -eq $Ensure) { - $result = $true - } - } else { - throw New-TerminatingError -ErrorType UnexpectedErrorFromGet -ErrorCategory InvalidResult - } - - return $result -} - -function Get-SQLPermission -{ - [CmdletBinding()] - [OutputType([String[]])] - param ( - [Parameter(Mandatory,ParameterSetName="ServerPermissionSet",HelpMessage="Takes a PermissionSet which will be enumerated to return a string array.")] - [Microsoft.SqlServer.Management.Smo.ServerPermissionSet] - [ValidateNotNullOrEmpty()] - $ServerPermissionSet - ) - - [String[]] $permission = @() - - if( $ServerPermissionSet ) { - foreach( $Property in $($ServerPermissionSet | Get-Member -Type Property) ) { - if( $ServerPermissionSet.$($Property.Name) ) { - $permission += $Property.Name - } - } - } - - return [String[]] $permission -} - -function Get-SQLServerPermissionSet -{ - [CmdletBinding()] - [OutputType([Object])] - param - ( - [Parameter(Mandatory,ParameterSetName="Permission",HelpMessage="Takes an array of strings which will be concatenated to a single ServerPermissionSet.")] - [System.String[]] - [ValidateNotNullOrEmpty()] - $Permission, - - [Parameter(Mandatory,ParameterSetName="ServerPermissionSet",HelpMessage="Takes an array of ServerPermissionSet which will be concatenated to a single ServerPermissionSet.")] - [Microsoft.SqlServer.Management.Smo.ServerPermissionSet[]] - [ValidateNotNullOrEmpty()] - $PermissionSet - ) - - if( $Permission ) { - [Microsoft.SqlServer.Management.Smo.ServerPermissionSet] $permissionSet = New-Object -TypeName Microsoft.SqlServer.Management.Smo.ServerPermissionSet - - foreach( $currentPermission in $Permission ) { - $permissionSet.$($currentPermission) = $true - } - } else { - $permissionSet = Merge-SQLPermissionSet -Object $PermissionSet - } - - return $permissionSet -} - -function Merge-SQLPermissionSet { - param ( - [Parameter(Mandatory)] - [Microsoft.SqlServer.Management.Smo.ServerPermissionSet[]] - [ValidateNotNullOrEmpty()] - $Object - ) - - $baseObject = New-Object -TypeName ($Object[0].GetType()) - - foreach ( $currentObject in $Object ) { - foreach( $Property in $($currentObject | Get-Member -Type Property) ) { - if( $currentObject.$($Property.Name) ) { - $baseObject.$($Property.Name) = $currentObject.$($Property.Name) - } - } - } - - return $baseObject -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerPermission/MSFT_xSQLServerPermission.schema.mof b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerPermission/MSFT_xSQLServerPermission.schema.mof deleted file mode 100644 index d92f251a..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerPermission/MSFT_xSQLServerPermission.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xSQLServerPermission")] -class MSFT_xSQLServerPermission : OMI_BaseResource -{ - [Key, Description("The SQL Server instance name.")] String InstanceName; - [Required, Description("The host name or FQDN.")] String NodeName; - [Write, Description("If the permission should be present or absent."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Required, Description("The login to which permission will be set.")] String Principal; - [Write, Description("The permission to set for the login."), ValueMap{"AlterAnyAvailabilityGroup","ViewServerState","AlterAnyEndPoint"}, Values{"AlterAnyAvailabilityGroup","ViewServerState","AlterAnyEndPoint"}] String Permission[]; -}; - diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerRSConfig/MSFT_xSQLServerRSConfig.psm1 b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerRSConfig/MSFT_xSQLServerRSConfig.psm1 deleted file mode 100644 index 6265f171..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerRSConfig/MSFT_xSQLServerRSConfig.psm1 +++ /dev/null @@ -1,229 +0,0 @@ -$currentPath = Split-Path -Parent $MyInvocation.MyCommand.Path -Write-Debug -Message "CurrentPath: $currentPath" - -# Load Common Code -Import-Module $currentPath\..\..\xSQLServerHelper.psm1 -Verbose:$false -ErrorAction Stop - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $InstanceName, - - [parameter(Mandatory = $true)] - [System.String] - $RSSQLServer, - - [parameter(Mandatory = $true)] - [System.String] - $RSSQLInstanceName, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SQLAdminCredential - ) - - if(Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\RS" -Name $InstanceName -ErrorAction SilentlyContinue) - { - $InstanceKey = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\RS" -Name $InstanceName).$InstanceName - $SQLVersion = ((Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\$InstanceKey\Setup" -Name "Version").Version).Split(".")[0] - $RSConfig = Invoke-Command -ComputerName . -Credential $SQLAdminCredential -ScriptBlock { - $SQLVersion = $args[0] - $InstanceName = $args[1] - $RSConfig = Get-WmiObject -Class MSReportServer_ConfigurationSetting -Namespace "root\Microsoft\SQLServer\ReportServer\RS_$InstanceName\v$SQLVersion\Admin" - $RSConfig - } -ArgumentList @($SQLVersion,$InstanceName) - if($RSConfig.DatabaseServerName.Contains("\")) - { - $RSSQLServer = $RSConfig.DatabaseServerName.Split("\")[0] - $RSSQLInstanceName = $RSConfig.DatabaseServerName.Split("\")[1] - } - else - { - $RSSQLServer = $RSConfig.DatabaseServerName - $RSSQLInstanceName = "MSSQLSERVER" - } - $IsInitialized = $RSConfig.IsInitialized - } - else - { - throw New-TerminatingError -ErrorType SSRSNotFound -FormatArgs @($InstanceName) -ErrorCategory ObjectNotFound - } - - $returnValue = @{ - InstanceName = $InstanceName - RSSQLServer = $RSSQLServer - RSSQLInstanceName = $RSSQLInstanceName - IsInitialized = $IsInitialized - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $InstanceName, - - [parameter(Mandatory = $true)] - [System.String] - $RSSQLServer, - - [parameter(Mandatory = $true)] - [System.String] - $RSSQLInstanceName, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SQLAdminCredential - ) - - if(Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\RS" -Name $InstanceName -ErrorAction SilentlyContinue) - { - Invoke-Command -ComputerName . -Credential $SQLAdminCredential -Authentication Credssp -ScriptBlock { - $InstanceName = $args[0] - $RSSQLServer = $args[1] - $RSSQLInstanceName = $args[2] - $InstanceKey = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\RS" -Name $InstanceName).$InstanceName - $SQLVersion = ((Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\$InstanceKey\Setup" -Name "Version").Version).Split(".")[0] - $DBCreateFile = [IO.Path]::GetTempFileName() - $DBRightsFile = [IO.Path]::GetTempFileName() - if($InstanceName -eq "MSSQLSERVER") - { - $RSServiceName = "ReportServer" - $RSVirtualDirectory = "ReportServer" - $RMVirtualDirectory = "Reports" - $RSDatabase = "ReportServer" - } - else - { - $RSServiceName = "ReportServer`$$InstanceName" - $RSVirtualDirectory = "ReportServer_$InstanceName" - $RMVirtualDirectory = "Reports_$InstanceName" - $RSDatabase = "ReportServer`$$InstanceName" - } - if($RSSQLInstanceName -eq "MSSQLSERVER") - { - $RSConnection = "$RSSQLServer" - } - else - { - $RSConnection = "$RSSQLServer\$RSSQLInstanceName" - } - $Language = (Get-WMIObject -Class Win32_OperatingSystem -Namespace root/cimv2 -ErrorAction SilentlyContinue).OSLanguage - $RSConfig = Get-WmiObject -Class MSReportServer_ConfigurationSetting -Namespace "root\Microsoft\SQLServer\ReportServer\RS_$InstanceName\v$SQLVersion\Admin" - if($RSConfig.VirtualDirectoryReportServer -ne $RSVirtualDirectory) - { - $RSConfig.SetVirtualDirectory("ReportServerWebService",$RSVirtualDirectory,$Language) - $RSConfig.ReserveURL("ReportServerWebService","http://+:80",$Language) - } - if($RSConfig.VirtualDirectoryReportManager -ne $RMVirtualDirectory) - { - $RSConfig.SetVirtualDirectory("ReportManager",$RMVirtualDirectory,$Language) - $RSConfig.ReserveURL("ReportManager","http://+:80",$Language) - } - $RSScript = $RSConfig.GenerateDatabaseCreationScript($RSDatabase,$Language,$false) - $RSScript.Script | Out-File $DBCreateFile - - # Determine RS service account - $RSSvcAccountUsername = (Get-WmiObject -Class Win32_Service | Where-Object {$_.Name -eq $RSServiceName}).StartName - if(($RSSvcAccountUsername -eq "LocalSystem") -or (($RSSvcAccountUsername.Length -ge 10) -and ($RSSvcAccountUsername.SubString(0,10) -eq "NT Service"))) - { - $RSSvcAccountUsername = $RSConfig.MachineAccountIdentity - } - $RSScript = $RSConfig.GenerateDatabaseRightsScript($RSSvcAccountUsername,$RSDatabase,$false,$true) - $RSScript.Script | Out-File $DBRightsFile - - # Get path to sqlcmd.exe - $SQLCmdLocations = @( - @{ - Key = "4B5EB208A08862C4C9A0A2924D2613FF" - Name = "BAF8FF4572ED7814281FBEEAA6EE68A9" - } - @{ - Key = "4B5EB208A08862C4C9A0A2924D2613FF" - Name = "2BE7307A359F21B48B3491F5D489D81A" - } - @{ - Key = "4B5EB208A08862C4C9A0A2924D2613FF" - Name = "17E375D97701E7C44BBDE4225A2D4BB8" - } - @{ - Key = "A4A2A5C7B23E40145A6AFA7667643E85" - Name = "8B035CCA4B6B6D045BB9514286FC740D" - } - ) - $SQLCmdPath = "" - foreach($SQLCmdLocation in $SQLCmdLocations) - { - if($SQLCmdPath -eq "") - { - if(Get-ItemProperty -Path ("HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\" + $SQLCmdLocation.Key) -Name $SQLCmdLocation.Name -ErrorAction SilentlyContinue) - { - - if(Test-Path -Path (Get-ItemProperty -Path ("HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\" + $SQLCmdLocation.Key) -Name $SQLCmdLocation.Name).($SQLCmdLocation.Name)) - { - $SQLCmdPath = (Get-ItemProperty -Path ("HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\" + $SQLCmdLocation.Key) -Name $SQLCmdLocation.Name).($SQLCmdLocation.Name) - } - } - } - } - if($SQLCmdPath -ne "") - { - & "$SQLCmdPath" -S $RSConnection -i $DBCreateFile - & "$SQLCmdPath" -S $RSConnection -i $DBRightsFile - $RSConfig.SetDatabaseConnection($RSConnection,$RSDatabase,2,"","") - $RSConfig.InitializeReportServer($RSConfig.InstallationID) - } - - Remove-Item -Path $DBCreateFile - Remove-Item -Path $DBRightsFile - } -ArgumentList @($InstanceName,$RSSQLServer,$RSSQLInstanceName) - } - - if(!(Test-TargetResource @PSBoundParameters)) - { - throw New-TerminatingError -ErrorType TestFailedAfterSet -ErrorCategory InvalidResult - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $InstanceName, - - [parameter(Mandatory = $true)] - [System.String] - $RSSQLServer, - - [parameter(Mandatory = $true)] - [System.String] - $RSSQLInstanceName, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SQLAdminCredential - ) - - $result = (Get-TargetResource @PSBoundParameters).IsInitialized - - $result -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerRSConfig/MSFT_xSQLServerRSConfig.schema.mof b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerRSConfig/MSFT_xSQLServerRSConfig.schema.mof deleted file mode 100644 index 5891a288..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerRSConfig/MSFT_xSQLServerRSConfig.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSQLServerRSConfig")] -class MSFT_xSQLServerRSConfig : OMI_BaseResource -{ - [Key, Description("Name of the SQL Server Reporting Services instance to be configured.")] String InstanceName; - [Required, Description("Name of the SQL Server to host the Reporting Service database.")] String RSSQLServer; - [Required, Description("Name of the SQL Server instance to host the Reporting Service database.")] String RSSQLInstanceName; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the configuration.")] String SQLAdminCredential; - [Read, Description("Is the Reporting Services instance initialized.")] Boolean IsInitialized; -}; diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerRSSecureConnectionLevel/MSFT_xSQLServerRSSecureConnectionLevel.psm1 b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerRSSecureConnectionLevel/MSFT_xSQLServerRSSecureConnectionLevel.psm1 deleted file mode 100644 index 6771f2ad..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerRSSecureConnectionLevel/MSFT_xSQLServerRSSecureConnectionLevel.psm1 +++ /dev/null @@ -1,114 +0,0 @@ -$currentPath = Split-Path -Parent $MyInvocation.MyCommand.Path -Write-Debug -Message "CurrentPath: $currentPath" - -# Load Common Code -Import-Module $currentPath\..\..\xSQLServerHelper.psm1 -Verbose:$false -ErrorAction Stop - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $InstanceName, - - [parameter(Mandatory = $true)] - [System.UInt16] - $SecureConnectionLevel, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SQLAdminCredential - ) - - if(Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\RS" -Name $InstanceName -ErrorAction SilentlyContinue) - { - $InstanceKey = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\RS" -Name $InstanceName).$InstanceName - $SQLVersion = ((Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\$InstanceKey\Setup" -Name "Version").Version).Split(".")[0] - $SecureConnectionLevel = Invoke-Command -ComputerName . -Credential $SQLAdminCredential -ScriptBlock { - $SQLVersion = $args[0] - $InstanceName = $args[1] - $RSConfig = Get-WmiObject -Class MSReportServer_ConfigurationSetting -Namespace "root\Microsoft\SQLServer\ReportServer\RS_$InstanceName\v$SQLVersion\Admin" - $RSConfig.SecureConnectionLevel - } -ArgumentList @($SQLVersion,$InstanceName) - } - else - { - throw New-TerminatingError -ErrorType SSRSNotFound -FormatArgs @($InstanceName) -ErrorCategory ObjectNotFound - } - - $returnValue = @{ - InstanceName = $InstanceName - SecureConnectionLevel = $SecureConnectionLevel - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $InstanceName, - - [parameter(Mandatory = $true)] - [System.UInt16] - $SecureConnectionLevel, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SQLAdminCredential - ) - - if(Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\RS" -Name $InstanceName -ErrorAction SilentlyContinue) - { - $InstanceKey = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\RS" -Name $InstanceName).$InstanceName - $SQLVersion = ((Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\$InstanceKey\Setup" -Name "Version").Version).Split(".")[0] - Invoke-Command -ComputerName . -Credential $SQLAdminCredential -ScriptBlock { - $SQLVersion = $args[0] - $InstanceName = $args[1] - $SecureConnectionLevel = $args[2] - $RSConfig = Get-WmiObject -Class MSReportServer_ConfigurationSetting -Namespace "root\Microsoft\SQLServer\ReportServer\RS_$InstanceName\v$SQLVersion\Admin" - $RSConfig.SetSecureConnectionLevel($SecureConnectionLevel) - } -ArgumentList @($SQLVersion,$InstanceName,$SecureConnectionLevel) - } - - if(!(Test-TargetResource @PSBoundParameters)) - { - throw New-TerminatingError -ErrorType TestFailedAfterSet -ErrorCategory InvalidResult - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $InstanceName, - - [parameter(Mandatory = $true)] - [System.UInt16] - $SecureConnectionLevel, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SQLAdminCredential - ) - - $result = ((Get-TargetResource @PSBoundParameters).SecureConnectionLevel -eq $SecureConnectionLevel) - - $result -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerRSSecureConnectionLevel/MSFT_xSQLServerRSSecureConnectionLevel.schema.mof b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerRSSecureConnectionLevel/MSFT_xSQLServerRSSecureConnectionLevel.schema.mof deleted file mode 100644 index 9539097e..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerRSSecureConnectionLevel/MSFT_xSQLServerRSSecureConnectionLevel.schema.mof +++ /dev/null @@ -1,7 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSQLServerRSSecureConnectionLevel")] -class MSFT_xSQLServerRSSecureConnectionLevel : OMI_BaseResource -{ - [Key, Description("SQL instance to set secure connection level for.")] String InstanceName; - [Key, Description("SQL Server Reporting Service secure connection level.")] Uint16 SecureConnectionLevel; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential with administrative permissions to the SQL instance.")] String SQLAdminCredential; -}; diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerReplication/MSFT_xSQLServerReplication.psm1 b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerReplication/MSFT_xSQLServerReplication.psm1 deleted file mode 100644 index 252d651b..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerReplication/MSFT_xSQLServerReplication.psm1 +++ /dev/null @@ -1,505 +0,0 @@ -$dom = [AppDomain]::CreateDomain('xSQLServerReplication') - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param( - [parameter(Mandatory = $true)] - [System.String] - $InstanceName, - - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure = 'Present', - - [parameter(Mandatory = $true)] - [ValidateSet('Local', 'Remote')] - [System.String] - $DistributorMode, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $AdminLinkCredentials, - - [System.String] - $DistributionDBName = 'distribution', - - [System.String] - $RemoteDistributor, - - [parameter(Mandatory = $true)] - [System.String] - $WorkingDirectory, - - [System.Boolean] - $UseTrustedConnection = $true, - - [System.Boolean] - $UninstallWithForce = $true - ) - - $Ensure = 'Absent' - - $sqlMajorVersion = Get-SqlServerMajorVersion -InstanceName $InstanceName - $localSqlName = Get-SqlLocalServerName -InstanceName $InstanceName - - $localServerConnection = New-ServerConnection -SqlMajorVersion $sqlMajorVersion -SqlServerName $localSqlName - $localReplicationServer = New-ReplicationServer -SqlMajorVersion $sqlMajorVersion -ServerConnection $localServerConnection - - if($localReplicationServer.IsDistributor -eq $true) - { - $Ensure = 'Present' - $DistributorMode = 'Local' - } - elseif($localReplicationServer.IsPublisher -eq $true) - { - $Ensure = 'Present' - $DistributorMode = 'Remote' - } - - if($Ensure -eq 'Present') - { - $DistributionDBName = $localReplicationServer.DistributionDatabase - $RemoteDistributor = $localReplicationServer.DistributionServer - $WorkingDirectory = $localReplicationServer.WorkingDirectory - } - - $returnValue = @{ - InstanceName = $InstanceName - Ensure = $Ensure - DistributorMode = $DistributorMode - DistributionDBName = $DistributionDBName - RemoteDistributor = $RemoteDistributor - WorkingDirectory = $WorkingDirectory - } - - return $returnValue -} - -function Set-TargetResource -{ - [CmdletBinding()] - param( - [parameter(Mandatory = $true)] - [System.String] - $InstanceName, - - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure = 'Present', - - [parameter(Mandatory = $true)] - [ValidateSet('Local', 'Remote')] - [System.String] - $DistributorMode, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $AdminLinkCredentials, - - [System.String] - $DistributionDBName = 'distribution', - - [System.String] - $RemoteDistributor, - - [parameter(Mandatory = $true)] - [System.String] - $WorkingDirectory, - - [System.Boolean] - $UseTrustedConnection = $true, - - [System.Boolean] - $UninstallWithForce = $true - ) - - if(($DistributorMode -eq 'Remote') -and (-not $RemoteDistributor)) - { - throw "RemoteDistributor parameter cannot be empty when DistributorMode = 'Remote'!" - } - - $sqlMajorVersion = Get-SqlServerMajorVersion -InstanceName $InstanceName - $localSqlName = Get-SqlLocalServerName -InstanceName $InstanceName - - $localServerConnection = New-ServerConnection -SqlMajorVersion $sqlMajorVersion -SqlServerName $localSqlName - $localReplicationServer = New-ReplicationServer -SqlMajorVersion $sqlMajorVersion -ServerConnection $localServerConnection - - if($Ensure -eq 'Present') - { - if($DistributorMode -eq 'Local' -and $localReplicationServer.IsDistributor -eq $false) - { - Write-Verbose "Local distribution will be configured ..." - - $distributionDB = New-DistributionDatabase ` - -SqlMajorVersion $sqlMajorVersion ` - -DistributionDBName $DistributionDBName ` - -ServerConnection $localServerConnection - - Install-LocalDistributor ` - -ReplicationServer $localReplicationServer ` - -AdminLinkCredentials $AdminLinkCredentials ` - -DistributionDB $distributionDB - - Register-DistributorPublisher ` - -SqlMajorVersion $sqlMajorVersion ` - -PublisherName $localSqlName ` - -ServerConnection $localServerConnection ` - -DistributionDBName $DistributionDBName ` - -WorkingDirectory $WorkingDirectory ` - -UseTrustedConnection $UseTrustedConnection - } - - if($DistributorMode -eq 'Remote' -and $localReplicationServer.IsPublisher -eq $false) - { - Write-Verbose "Remote distribution will be configured ..." - - $remoteConnection = New-ServerConnection -SqlMajorVersion $sqlMajorVersion -SqlServerName $RemoteDistributor - - Register-DistributorPublisher ` - -SqlMajorVersion $sqlMajorVersion ` - -PublisherName $localSqlName ` - -ServerConnection $remoteConnection ` - -DistributionDBName $DistributionDBName ` - -WorkingDirectory $WorkingDirectory ` - -UseTrustedConnection $UseTrustedConnection - - Install-RemoteDistributor ` - -ReplicationServer $localReplicationServer ` - -RemoteDistributor $RemoteDistributor ` - -AdminLinkCredentials $AdminLinkCredentials - } - } - else #'Absent' - { - if($localReplicationServer.IsDistributor -eq $true -or $localReplicationServer.IsPublisher -eq $true) - { - Write-Verbose "Distribution will be removed ..." - Uninstall-Distributor -ReplicationServer $localReplicationServer -UninstallWithForce $UninstallWithForce - } - else - { - Write-Verbose "Distribution is not configured on this instance." - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param( - [parameter(Mandatory = $true)] - [System.String] - $InstanceName, - - [ValidateSet('Present', 'Absent')] - [System.String] - $Ensure = 'Present', - - [parameter(Mandatory = $true)] - [ValidateSet('Local', 'Remote')] - [System.String] - $DistributorMode, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $AdminLinkCredentials, - - [System.String] - $DistributionDBName = 'distribution', - - [System.String] - $RemoteDistributor, - - [parameter(Mandatory = $true)] - [System.String] - $WorkingDirectory, - - [System.Boolean] - $UseTrustedConnection = $true, - - [System.Boolean] - $UninstallWithForce = $true - ) - - $result = $false - $state = Get-TargetResource @PSBoundParameters - - if($Ensure -eq 'Absent' -and $state.Ensure -eq 'Absent') - { - $result = $true - } - elseif($Ensure -eq 'Present' -and $state.Ensure -eq 'Present' -and $state.DistributorMode -eq $DistributorMode) - { - $result = $true - } - - return $result -} - -#region helper functions -function New-ServerConnection -{ - [CmdletBinding()] - [OutputType([System.Object])] - param( - [parameter(Mandatory = $true)] - [System.String] - $SqlMajorVersion, - - [parameter(Mandatory = $true)] - [System.String] - $SqlServerName - ) - - $connInfo = Get-ConnectionInfoAssembly -SqlMajorVersion $SqlMajorVersion - $serverConnection = New-Object $connInfo.GetType('Microsoft.SqlServer.Management.Common.ServerConnection') $SqlServerName - - return $serverConnection -} - -function New-ReplicationServer -{ - [CmdletBinding()] - [OutputType([System.Object])] - param( - [parameter(Mandatory = $true)] - [System.String] - $SqlMajorVersion, - - [parameter(Mandatory = $true)] - [System.Object] - $ServerConnection - ) - - $rmo = Get-RmoAssembly -SqlMajorVersion $SqlMajorVersion - $localReplicationServer = New-Object $rmo.GetType('Microsoft.SqlServer.Replication.ReplicationServer') $ServerConnection - - return $localReplicationServer; -} - -function New-DistributionDatabase -{ - [CmdletBinding()] - [OutputType([System.Object])] - param( - [parameter(Mandatory = $true)] - [System.String] - $SqlMajorVersion, - - [parameter(Mandatory = $true)] - [System.String] - $DistributionDBName, - - [parameter(Mandatory = $true)] - [System.Object] - $ServerConnection - ) - - $rmo = Get-RmoAssembly -SqlMajorVersion $SqlMajorVersion - Write-Verbose "Creating DistributionDatabase object $DistributionDBName" - $distributionDB = New-Object $rmo.GetType('Microsoft.SqlServer.Replication.DistributionDatabase') $DistributionDBName, $ServerConnection - - return $distributionDB -} - -function New-DistributionPublisher -{ - [CmdletBinding()] - [OutputType([System.Object])] - param( - [parameter(Mandatory = $true)] - [System.String] - $SqlMajorVersion, - - [parameter(Mandatory = $true)] - [System.String] - $PublisherName, - - [parameter(Mandatory = $true)] - [System.Object] - $ServerConnection - ) - - $rmo = Get-RmoAssembly -SqlMajorVersion $SqlMajorVersion - $distributorPublisher = New-object $rmo.GetType('Microsoft.SqlServer.Replication.DistributionPublisher') $PublisherName, $ServerConnection - - return $distributorPublisher -} - -function Install-RemoteDistributor -{ - [CmdletBinding()] - param( - [parameter(Mandatory = $true)] - [System.Object] - $ReplicationServer, - - [parameter(Mandatory = $true)] - [System.String] - $RemoteDistributor, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $AdminLinkCredentials - ) - - Write-Verbose "Calling InstallDistributor with RemoteDistributor = $RemoteDistributor" - $ReplicationServer.InstallDistributor($RemoteDistributor, $AdminLinkCredentials.Password) -} - -function Install-LocalDistributor -{ - [CmdletBinding()] - param( - [parameter(Mandatory = $true)] - [System.Object] - $ReplicationServer, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $AdminLinkCredentials, - - [parameter(Mandatory = $true)] - [System.Object] - $DistributionDB - ) - - Write-Verbose "Calling InstallDistributor with DistributionDB" - $ReplicationServer.InstallDistributor($AdminLinkCredentials.Password, $DistributionDB) -} - -function Uninstall-Distributor -{ - [CmdletBinding()] - param( - [parameter(Mandatory = $true)] - [System.Object] - $ReplicationServer, - - [parameter(Mandatory = $true)] - [System.Boolean] - $UninstallWithForce - ) - Write-Verbose 'Calling UnistallDistributor method on ReplicationServer object' - $ReplicationServer.UninstallDistributor($UninstallWithForce) -} - -function Register-DistributorPublisher -{ - [CmdletBinding()] - param( - [parameter(Mandatory = $true)] - [System.String] - $SqlMajorVersion, - - [parameter(Mandatory = $true)] - [System.String] - $PublisherName, - - [parameter(Mandatory = $true)] - [System.Object] - $ServerConnection, - - [parameter(Mandatory = $true)] - [System.String] - $DistributionDBName, - - [parameter(Mandatory = $true)] - [System.String] - $WorkingDirectory, - - [parameter(Mandatory = $true)] - [System.Boolean] - $UseTrustedConnection - ) - - Write-Verbose "Creating DistributorPublisher $PublisherName on $($ServerConnection.ServerInstance)" - - $distributorPublisher = New-DistributionPublisher ` - -SqlMajorVersion $SqlMajorVersion ` - -PublisherName $PublisherName ` - -ServerConnection $ServerConnection - - $distributorPublisher.DistributionDatabase = $DistributionDBName - $distributorPublisher.WorkingDirectory = $WorkingDirectory - $distributorPublisher.PublisherSecurity.WindowsAuthentication = $UseTrustedConnection - $distributorPublisher.Create() -} - -function Get-ConnectionInfoAssembly -{ - [CmdletBinding()] - [OutputType([System.Object])] - param( - [parameter(Mandatory = $true)] - [System.String] - $SqlMajorVersion - ) - - $connInfo = $dom.Load("Microsoft.SqlServer.ConnectionInfo, Version=$SqlMajorVersion.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91") - Write-Verbose "Loaded assembly: $($connInfo.FullName)" - - return $connInfo -} - -function Get-RmoAssembly -{ - [CmdletBinding()] - [OutputType([System.Object])] - param( - [parameter(Mandatory = $true)] - [System.String] - $SqlMajorVersion - ) - - $rmo = $dom.Load("Microsoft.SqlServer.Rmo, Version=$SqlMajorVersion.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91") - Write-Verbose "Loaded assembly: $($rmo.FullName)" - - return $rmo -} - -function Get-SqlServerMajorVersion -{ - [CmdletBinding()] - [OutputType([System.String])] - param( - [parameter(Mandatory = $true)] - [System.String] - $InstanceName - ) - - $instanceId = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL").$InstanceName - $sqlVersion = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\$instanceId\Setup").Version - $sqlMajorVersion = $sqlVersion.Split(".")[0] - if (-not $sqlMajorVersion) - { - throw "Unable to detect version for sql server instance: $InstanceName!" - } - return $sqlMajorVersion -} - -function Get-SqlLocalServerName -{ - [CmdletBinding()] - [OutputType([System.String])] - param( - [parameter(Mandatory = $true)] - [System.String] - $InstanceName - ) - - if($InstanceName -eq "MSSQLSERVER") - { - return $env:COMPUTERNAME - } - else - { - return "$($env:COMPUTERNAME)\$InstanceName" - } -} -#endregion - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerReplication/MSFT_xSQLServerReplication.schema.mof b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerReplication/MSFT_xSQLServerReplication.schema.mof deleted file mode 100644 index 609bc1aa..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerReplication/MSFT_xSQLServerReplication.schema.mof +++ /dev/null @@ -1,13 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSQLServerReplication")] -class MSFT_xSQLServerReplication : OMI_BaseResource -{ - [Key, Description("SQL Server instance name where replication distribution will be configured")] String InstanceName; - [Write, ValueMap{"Present", "Absent"}, Values{"Present", "Absent"}] String Ensure; - [Required, ValueMap{"Local", "Remote"}, Values{"Local", "Remote"}] String DistributorMode; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Distributor administration link password")] String AdminLinkCredentials; - [Write, Description("Distribution database name")] String DistributionDBName; - [Write, Description("Distributor server name if configuring publisher with remote distributor")] String RemoteDistributor; - [Required, Description("Publisher working directory")] String WorkingDirectory; - [Write, Description("Publisher security mode")] Boolean UseTrustedConnection; - [Write, Description("Force flag for uninstall procedure")] Boolean UninstallWithForce; -}; diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerRole/MSFT_xSQLServerRole.psm1 b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerRole/MSFT_xSQLServerRole.psm1 deleted file mode 100644 index f618c659..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerRole/MSFT_xSQLServerRole.psm1 +++ /dev/null @@ -1,541 +0,0 @@ -Import-Module -Name (Join-Path -Path (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent) ` - -ChildPath 'xSQLServerHelper.psm1') ` - -Force -<# - .SYNOPSIS - This function gets the sql server role properties. - - .PARAMETER Members - The members the server role should have. - - .PARAMETER MembersToInclude - The members the server role should include. - - .PARAMETER MembersToExclude - The members the server role should exclude. - - .PARAMETER ServerRoleName - The name of server role to be created or dropped. - - .PARAMETER SQLServer - The host name of the SQL Server to be configured. - - .PARAMETER SQLInstanceName - The name of the SQL instance to be configured. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter()] - [System.String[]] - $Members, - - [Parameter()] - [System.String[]] - $MembersToInclude, - - [Parameter()] - [System.String[]] - $MembersToExclude, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $ServerRoleName, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLServer, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLInstanceName - ) - - $sqlServerObject = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName - $ensure = 'Present' - - if ($sqlServerObject) - { - Write-Verbose -Message "Getting properties of SQL Server role '$ServerRoleName'." - if ($sqlServerRoleObject = $sqlServerObject.Roles[$ServerRoleName]) - { - try - { - $membersInRole = $sqlServerRoleObject.EnumMemberNames() - } - catch - { - throw New-TerminatingError -ErrorType EnumMemberNamesServerRoleGetError ` - -FormatArgs @($SQLServer,$SQLInstanceName,$ServerRoleName) ` - -ErrorCategory InvalidOperation ` - -InnerException $_.Exception - } - - if ($Members) - { - if ($MembersToInclude -or $MembersToExclude) - { - throw New-TerminatingError -ErrorType MembersToIncludeAndExcludeParamMustBeNull ` - -FormatArgs @($SQLServer,$SQLInstanceName) ` - -ErrorCategory InvalidArgument - } - - if ( $null -ne (Compare-Object -ReferenceObject $membersInRole -DifferenceObject $Members)) - { - New-VerboseMessage -Message "The desired members are not present in server role $ServerRoleName" - $ensure = 'Absent' - } - } - else - { - if ($MembersToInclude) - { - foreach ($memberToInclude in $MembersToInclude) - { - if ( -not ($membersInRole.Contains($memberToInclude))) - { - New-VerboseMessage -Message "The included members are not present in server role $ServerRoleName" - $ensure = 'Absent' - } - } - } - - if ($MembersToExclude) - { - foreach ($memberToExclude in $MembersToExclude) - { - if ($membersInRole.Contains($memberToExclude)) - { - New-VerboseMessage -Message "The excluded members are present in server role $ServerRoleName" - $ensure = 'Absent' - } - } - } - } - } - else - { - $ensure = 'Absent' - } - } - - $returnValue = @{ - Ensure = $ensure - Members = $membersInRole - MembersToInclude = $MembersToInclude - MembersToExclude = $MembersToExclude - ServerRoleName = $ServerRoleName - SQLServer = $SQLServer - SQLInstanceName = $SQLInstanceName - } - $returnValue -} - -<# - .SYNOPSIS - This function sets the sql server role properties. - - .PARAMETER Ensure - When set to 'Present', the server role will be created. - When set to 'Absent', the server role will be dropped. - - .PARAMETER Members - The members the server role should have. - - .PARAMETER MembersToInclude - The members the server role should include. - - .PARAMETER MembersToExclude - The members the server role should exclude. - - .PARAMETER ServerRoleName - The name of server role to be created or dropped. - - .PARAMETER SQLServer - The host name of the SQL Server to be configured. - - .PARAMETER SQLInstanceName - The name of the SQL instance to be configured. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter()] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present', - - [Parameter()] - [System.String[]] - $Members, - - [Parameter()] - [System.String[]] - $MembersToInclude, - - [Parameter()] - [System.String[]] - $MembersToExclude, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $ServerRoleName, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLServer, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLInstanceName - ) - - $sqlServerObject = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName - - if ($sqlServerObject) - { - Write-Verbose -Message "Setting properties of SQL Server role '$ServerRoleName'." - - switch ($Ensure) - { - 'Absent' - { - try - { - $sqlServerRoleObjectToDrop = $sqlServerObject.Roles[$ServerRoleName] - if ($sqlServerRoleObjectToDrop) - { - Write-Verbose -Message "Trying to drop the SQL Server role '$ServerRoleName'." - $sqlServerRoleObjectToDrop.Drop() - New-VerboseMessage -Message "Dropped the SQL Server role '$ServerRoleName'." - } - } - catch - { - throw New-TerminatingError -ErrorType DropServerRoleSetError ` - -FormatArgs @($SQLServer,$SQLInstanceName,$ServerRoleName) ` - -ErrorCategory InvalidOperation ` - -InnerException $_.Exception - } - } - - 'Present' - { - if ($null -eq $sqlServerObject.Roles[$ServerRoleName]) - { - try - { - $sqlServerRoleObjectToCreate = New-Object -TypeName Microsoft.SqlServer.Management.Smo.ServerRole ` - -ArgumentList $sqlServerObject,$ServerRoleName - if ($sqlServerRoleObjectToCreate) - { - Write-Verbose -Message "Creating the SQL Server role '$ServerRoleName'." - $sqlServerRoleObjectToCreate.Create() - New-VerboseMessage -Message "Created the SQL Server role '$ServerRoleName'." - } - } - catch - { - throw New-TerminatingError -ErrorType CreateServerRoleSetError ` - -FormatArgs @($SQLServer,$SQLInstanceName,$ServerRoleName) ` - -ErrorCategory InvalidOperation ` - -InnerException $_.Exception - } - } - - if ($Members) - { - if ($MembersToInclude -or $MembersToExclude) - { - throw New-TerminatingError -ErrorType MembersToIncludeAndExcludeParamMustBeNull ` - -FormatArgs @($SQLServer,$SQLInstanceName) ` - -ErrorCategory InvalidArgument - } - - $memberNamesInRoleObject = $sqlServerObject.Roles[$ServerRoleName].EnumMemberNames() - - foreach ($memberName in $memberNamesInRoleObject) - { - if ( -not ($Members.Contains($memberName))) - { - Remove-SqlDscServerRoleMember -SqlServerObject $sqlServerObject ` - -LoginName $memberName ` - -ServerRoleName $ServerRoleName - } - } - - foreach ($memberToAdd in $Members) - { - if ( -not ($memberNamesInRoleObject.Contains($memberToAdd))) - { - Add-SqlDscServerRoleMember -SqlServerObject $sqlServerObject ` - -LoginName $memberToAdd ` - -ServerRoleName $ServerRoleName - } - } - } - else - { - if ($MembersToInclude) - { - $memberNamesInRoleObject = $sqlServerObject.Roles[$ServerRoleName].EnumMemberNames() - - foreach ($memberToInclude in $MembersToInclude) - { - if ( -not ($memberNamesInRoleObject.Contains($memberToInclude))) - { - Add-SqlDscServerRoleMember -SqlServerObject $sqlServerObject ` - -LoginName $memberToInclude ` - -ServerRoleName $ServerRoleName - } - } - } - - if ($MembersToExclude) - { - $memberNamesInRoleObject = $sqlServerObject.Roles[$ServerRoleName].EnumMemberNames() - - foreach ($memberToExclude in $MembersToExclude) - { - if ($memberNamesInRoleObject.Contains($memberToExclude)) - { - Remove-SqlDscServerRoleMember -SqlServerObject $sqlServerObject ` - -LoginName $memberToExclude ` - -ServerRoleName $ServerRoleName - } - } - } - } - } - } - } -} - -<# - .SYNOPSIS - This function tests the sql server role properties. - - .PARAMETER Ensure - When set to 'Present', the server role will be created. - When set to 'Absent', the server role will be dropped. - - .PARAMETER Members - The members the server role should have. - - .PARAMETER MembersToInclude - The members the server role should include. - - .PARAMETER MembersToExclude - The members the server role should exclude. - - .PARAMETER ServerRoleName - The name of server role to be created or dropped. - - .PARAMETER SQLServer - The host name of the SQL Server to be configured. - - .PARAMETER SQLInstanceName - The name of the SQL instance to be configured. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter()] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present', - - [Parameter()] - [System.String[]] - $Members, - - [Parameter()] - [System.String[]] - $MembersToInclude, - - [Parameter()] - [System.String[]] - $MembersToExclude, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $ServerRoleName, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLServer, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLInstanceName - ) - - Write-Verbose -Message "Testing SQL Server role $ServerRoleName properties." - - $getTargetResourceParameters = @{ - SQLInstanceName = $PSBoundParameters.SQLInstanceName - SQLServer = $PSBoundParameters.SQLServer - ServerRoleName = $PSBoundParameters.ServerRoleName - Members = $PSBoundParameters.Members - MembersToInclude = $PSBoundParameters.MembersToInclude - MembersToExclude = $PSBoundParameters.MembersToExclude - } - - $getTargetResourceResult = Get-TargetResource @getTargetResourceParameters - $isServerRoleInDesiredState = $true - - switch ($Ensure) - { - 'Absent' - { - if ($getTargetResourceResult.Ensure -ne 'Absent') - { - New-VerboseMessage -Message "Ensure is set to Absent. The existing role $ServerRoleName should be dropped" - $isServerRoleInDesiredState = $false - } - } - - 'Present' - { - if ($getTargetResourceResult.Ensure -ne 'Present') - { - New-VerboseMessage -Message ("Ensure is set to Present. The missing role $ServerRoleName " + ` - "should be added or members are not correctly configured") - $isServerRoleInDesiredState = $false - } - } - } - - $isServerRoleInDesiredState -} - -<# - .SYNOPSIS - Add a user to a server role in the SQL Server instance provided. - - .PARAMETER SqlServerObject - An object returned from Connect-SQL function. - - .PARAMETER LoginName - String containing the login (user) which should be added as a member to the server role. - - .PARAMETER ServerRoleName - String containing the name of the server role which the user will be added as a member to. -#> -function Add-SqlDscServerRoleMember -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.Object] - $SqlServerObject, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $LoginName, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $ServerRoleName - ) - - if ( -not ($SqlServerObject.Logins[$LoginName]) ) - { - throw New-TerminatingError -ErrorType LoginNotFound ` - -FormatArgs @($LoginName, $SQLServer, $SQLInstanceName) ` - -ErrorCategory ObjectNotFound - } - - try - { - Write-Verbose -Message "Adding SQL login $LoginName in role $ServerRoleName" - $SqlServerObject.Roles[$ServerRoleName].AddMember($LoginName) - New-VerboseMessage -Message "SQL Role $ServerRoleName for $LoginName, successfullly added" - } - catch - { - throw New-TerminatingError -ErrorType AddMemberServerRoleSetError ` - -FormatArgs @($SQLServer,$SQLInstanceName,$ServerRoleName,$LoginName) ` - -ErrorCategory InvalidOperation ` - -InnerException $_.Exception - } -} - -<# - .SYNOPSIS - Remove a user in a server role in the SQL Server instance provided. - - .PARAMETER SqlServerObject - An object returned from Connect-SQL function. - - .PARAMETER LoginName - String containing the login (user) which should be removed as a member in the server role. - - .PARAMETER ServerRoleName - String containing the name of the server role for which the user will be removed as a member. -#> -function Remove-SqlDscServerRoleMember -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.Object] - $SqlServerObject, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $LoginName, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $ServerRoleName - ) - - if ( -not ($SqlServerObject.Logins[$LoginName]) ) - { - throw New-TerminatingError -ErrorType LoginNotFound ` - -FormatArgs @($LoginName, $SQLServer, $SQLInstanceName) ` - -ErrorCategory ObjectNotFound - } - - try - { - Write-Verbose -Message "Removing SQL login $LoginName from role $ServerRoleName" - $SqlServerObject.Roles[$ServerRoleName].DropMember($LoginName) - New-VerboseMessage -Message "SQL Role $ServerRoleName for $LoginName, successfullly dropped" - } - catch - { - throw New-TerminatingError -ErrorType DropMemberServerRoleSetError ` - -FormatArgs @($SQLServer,$SQLInstanceName,$ServerRoleName,$LoginName) ` - -ErrorCategory InvalidOperation ` - -InnerException $_.Exception - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerRole/MSFT_xSQLServerRole.schema.mof b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerRole/MSFT_xSQLServerRole.schema.mof deleted file mode 100644 index d7c1a397..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerRole/MSFT_xSQLServerRole.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSQLServerRole")] -class MSFT_xSQLServerRole : OMI_BaseResource -{ - [Key, Description("The name of of SQL role to add or remove.")] String ServerRoleName; - [Key, Description("The host name of the SQL Server to be configured.")] String SQLServer; - [Key, Description("The name of the SQL instance to be configured.")] String SQLInstanceName; - [Write, Description("An enumerated value that describes if the server role is added (Present) or dropped (Absent). Default value is 'Present'."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, Description("The members the server role should have. This parameter will replace all the current server role members with the specified members.")] String Members[]; - [Write, Description("The members the server role should include. This parameter will only add members to a server role. Can not be used at the same time as parameter Members.")] String MembersToInclude[]; - [Write, Description("The members the server role should exclude. This parameter will only remove members from a server role. Can only be used when parameter Ensure is set to 'Present'. Can not be used at the same time as parameter Members.")] String MembersToExclude[]; -}; diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerScript/MSFT_xSQLServerScript.Schema.mof b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerScript/MSFT_xSQLServerScript.Schema.mof deleted file mode 100644 index 275ccd78..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerScript/MSFT_xSQLServerScript.Schema.mof +++ /dev/null @@ -1,11 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSQLServerScript")] -class MSFT_xSQLServerScript : OMI_BaseResource -{ - [Key, Description("The name of an instance of the Database Engine. For a default instance, only specify the computer name. For a named instance, use the format ComputerName\\InstanceName")] String ServerInstance; - [Key, Description("Path to the T-SQL file that will perform Set action.")] String SetFilePath; - [Key, Description("Path to the T-SQL file that will perform Get action. Any values returned by the T-SQL queries will also be returned by the cmdlet Get-DscConfiguration through the 'GetResult' property.")] String GetFilePath; - [Key, Description("Path to the T-SQL file that will perform Test action. Any script that does not throw an error or returns null is evaluated to true. The cmdlet Invoke-SqlCmd treats T-SQL Print statements as verbose text, and will not cause the test to return false.")] String TestFilePath; - [Write, EmbeddedInstance("MSFT_Credential"), Description("The credentials to authenticate with, using SQL Authentication. To authenticate using Windows Authentication, assign the credentials to the built-in parameter 'PsDscRunAsCredential'. If both parameters 'Credential' and 'PsDscRunAsCredential' are not assigned, then SYSTEM account will be used to authenticate using Windows Authentication.")] String Credential; - [Write, Description("Specifies, as a string array, a sqlcmd scripting variable for use in the sqlcmd script, and sets a value for the variable. Use a Windows PowerShell array to specify multiple variables and their values. For more information how to use this, please go to the help documentation for Invoke-Sqlcmd.")] String Variable[]; - [Read, Description("Contains the values returned from the T-SQL script provided in the parameter 'GetFilePath' when cmdlet Get-DscConfiguration is run.")] String GetResult[]; -}; diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerScript/MSFT_xSQLServerScript.psm1 b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerScript/MSFT_xSQLServerScript.psm1 deleted file mode 100644 index 75b23494..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerScript/MSFT_xSQLServerScript.psm1 +++ /dev/null @@ -1,283 +0,0 @@ -$script:currentPath = Split-Path -Path $MyInvocation.MyCommand.Path -Parent -Import-Module -Name (Join-Path -Path (Split-Path -Path (Split-Path -Path $script:currentPath -Parent) -Parent) -ChildPath 'xSQLServerHelper.psm1') - -<# - .SYNOPSIS - Returns the current state of the SQL Server features. - - .PARAMETER ServerInstance - The name of an instance of the Database Engine. For a default instance, only specify the computer name. For a named instances, - use the format ComputerName\InstanceName. - - .PARAMETER SetFilePath - Path to the T-SQL file that will perform Set action. - - .PARAMETER GetFilePath - Path to the T-SQL file that will perform Get action. - Any values returned by the T-SQL queries will also be returned by the cmdlet Get-DscConfiguration through the `GetResult` property. - - .PARAMETER TestFilePath - Path to the T-SQL file that will perform Test action. - Any script that does not throw an error or returns null is evaluated to true. - The cmdlet Invoke-SqlCmd treats T-SQL Print statements as verbose text, and will not cause the test to return false. - - .PARAMETER Credential - The credentials to authenticate with, using SQL Authentication. To authenticate using Windows Authentication, assign the credentials - to the built-in parameter `PsDscRunAsCredential`. If both parameters `Credential` and `PsDscRunAsCredential` are not assigned, - then SYSTEM account will be used to authenticate using Windows Authentication. - - .PARAMETER Variable - Specifies, as a string array, a sqlcmd scripting variable for use in the sqlcmd script, and sets a value for the variable. - Use a Windows PowerShell array to specify multiple variables and their values. For more information how to use this, - please go to the help documentation for [Invoke-Sqlcmd](https://technet.microsoft.com/en-us/library/mt683370.aspx). - - .OUTPUTS - Hash table containing key 'GetResult' which holds the value of the result from the SQL script that was ran from the parameter 'GetFilePath'. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $ServerInstance, - - [Parameter(Mandatory = $true)] - [System.String] - $SetFilePath, - - [Parameter(Mandatory = $true)] - [System.String] - $GetFilePath, - - [Parameter(Mandatory = $true)] - [System.String] - $TestFilePath, - - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.String[]] - $Variable - ) - - $result = Invoke-SqlScript -ServerInstance $ServerInstance -SqlScriptPath $GetFilePath ` - -Credential $Credential -Variable $Variable -ErrorAction Stop - - $getResult = Out-String -InputObject $result - - $returnValue = @{ - ServerInstance = [System.String] $ServerInstance - SetFilePath = [System.String] $SetFilePath - GetFilePath = [System.String] $GetFilePath - TestFilePath = [System.String] $TestFilePath - Username = [System.Object] $Credential - Variable = [System.String[]] $Variable - GetResult = [System.String[]] $getresult - } - - $returnValue -} - -<# - .SYNOPSIS - Returns the current state of the SQL Server features. - - .PARAMETER ServerInstance - The name of an instance of the Database Engine. For a default instance, only specify the computer name. For a named instances, - use the format ComputerName\InstanceName. - - .PARAMETER SetFilePath - Path to the T-SQL file that will perform Set action. - - .PARAMETER GetFilePath - Path to the T-SQL file that will perform Get action. - Any values returned by the T-SQL queries will also be returned by the cmdlet Get-DscConfiguration through the `GetResult` property. - - .PARAMETER TestFilePath - Path to the T-SQL file that will perform Test action. - Any script that does not throw an error or returns null is evaluated to true. - The cmdlet Invoke-SqlCmd treats T-SQL Print statements as verbose text, and will not cause the test to return false. - - .PARAMETER Credential - The credentials to authenticate with, using SQL Authentication. To authenticate using Windows Authentication, assign the credentials - to the built-in parameter `PsDscRunAsCredential`. If both parameters `Credential` and `PsDscRunAsCredential` are not assigned, - then SYSTEM account will be used to authenticate using Windows Authentication. - - .PARAMETER Variable - Specifies, as a string array, a sqlcmd scripting variable for use in the sqlcmd script, and sets a value for the variable. - Use a Windows PowerShell array to specify multiple variables and their values. For more information how to use this, - please go to the help documentation for [Invoke-Sqlcmd](https://technet.microsoft.com/en-us/library/mt683370.aspx). -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $ServerInstance, - - [Parameter(Mandatory = $true)] - [System.String] - $SetFilePath, - - [Parameter(Mandatory = $true)] - [System.String] - $GetFilePath, - - [Parameter(Mandatory = $true)] - [System.String] - $TestFilePath, - - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.String[]] - $Variable - ) - - Invoke-SqlScript -ServerInstance $ServerInstance -SqlScriptPath $SetFilePath ` - -Credential $Credential -Variable $Variable -ErrorAction Stop -} - -<# - .SYNOPSIS - Returns the current state of the SQL Server features. - - .PARAMETER ServerInstance - The name of an instance of the Database Engine. For a default instance, only specify the computer name. For a named instances, - use the format ComputerName\InstanceName. - - .PARAMETER SetFilePath - Path to the T-SQL file that will perform Set action. - - .PARAMETER GetFilePath - Path to the T-SQL file that will perform Get action. - Any values returned by the T-SQL queries will also be returned by the cmdlet Get-DscConfiguration through the `GetResult` property. - - .PARAMETER TestFilePath - Path to the T-SQL file that will perform Test action. - Any script that does not throw an error or returns null is evaluated to true. - The cmdlet Invoke-SqlCmd treats T-SQL Print statements as verbose text, and will not cause the test to return false. - - .PARAMETER Credential - The credentials to authenticate with, using SQL Authentication. To authenticate using Windows Authentication, assign the credentials - to the built-in parameter `PsDscRunAsCredential`. If both parameters `Credential` and `PsDscRunAsCredential` are not assigned, - then SYSTEM account will be used to authenticate using Windows Authentication. - - .PARAMETER Variable - Specifies, as a string array, a sqlcmd scripting variable for use in the sqlcmd script, and sets a value for the variable. - Use a Windows PowerShell array to specify multiple variables and their values. For more information how to use this, - please go to the help documentation for [Invoke-Sqlcmd](https://technet.microsoft.com/en-us/library/mt683370.aspx). - -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $ServerInstance, - - [Parameter(Mandatory = $true)] - [System.String] - $SetFilePath, - - [Parameter(Mandatory = $true)] - [System.String] - $GetFilePath, - - [Parameter(Mandatory = $true)] - [System.String] - $TestFilePath, - - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.String[]] - $Variable - ) - - try - { - $result = Invoke-SqlScript -ServerInstance $ServerInstance -SqlScriptPath $TestFilePath ` - -Credential $Credential -Variable $Variable -ErrorAction Stop - - if($null -eq $result) - { - return $true - } - else - { - return $false - } - } - catch [Microsoft.SqlServer.Management.PowerShell.SqlPowerShellSqlExecutionException] - { - Write-Verbose $_ - return $false - } -} - -<# - .SYNOPSIS - Execute an SQL script located in a file on disk. - - .PARAMETER ServerInstance - The name of an instance of the Database Engine. - For default instances, only specify the computer name. For named instances, use the format ComputerName\InstanceName. - - .PARAMETER SqlScriptPath - Path to SQL script file that will be executed. - - .PARAMETER Credential - The credentials to use to authenticate using SQL Authentication. To authenticate using Windows Authentication, assing the credentials - to the built-in parameter 'PsDscRunAsCredential'. If both parameters 'Credential' and 'PsDscRunAsCredential' are not assigned, then - the SYSTEM account will be used to authenticate using Windows Authentication. - - .PARAMETER Variable - Creates a sqlcmd scripting variable for use in the sqlcmd script, and sets a value for the variable. -#> -function Invoke-SqlScript -{ - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $ServerInstance, - - [Parameter(Mandatory = $true)] - [System.String] - $SqlScriptPath, - - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [System.String[]] - $Variable - ) - - Import-SQLPSModule - - if($null -ne $Credential) - { - $null = $PSBoundParameters.Add("Username", $Credential.UserName) - $null = $PSBoundParameters.Add("Password", $Credential.GetNetworkCredential().password) - } - - $null = $PSBoundParameters.Remove("Credential") - $null = $PSBoundParameters.Remove("SqlScriptPath") - - Invoke-Sqlcmd -InputFile $SqlScriptPath @PSBoundParameters -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerSetup/MSFT_xSQLServerSetup.psm1 b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerSetup/MSFT_xSQLServerSetup.psm1 deleted file mode 100644 index c741bc44..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerSetup/MSFT_xSQLServerSetup.psm1 +++ /dev/null @@ -1,1973 +0,0 @@ -$script:currentPath = Split-Path -Path $MyInvocation.MyCommand.Path -Parent -Import-Module -Name (Join-Path -Path (Split-Path -Path (Split-Path -Path $script:currentPath -Parent) -Parent) -ChildPath 'xSQLServerHelper.psm1') -Import-Module -Name (Join-Path -Path (Split-Path -Path (Split-Path -Path $script:currentPath -Parent) -Parent) -ChildPath 'xPDT.psm1') - -<# - .SYNOPSIS - Returns the current state of the SQL Server features. - - .PARAMETER Action - The action to be performed. Default value is 'Install'. - Possible values are 'Install', 'InstallFailoverCluster', 'AddNode', 'PrepareFailoverCluster', and 'CompleteFailoverCluster' - - .PARAMETER SourcePath - The path to the root of the source files for installation. I.e and UNC path to a shared resource. Environment variables can be used in the path. - - .PARAMETER SetupCredential - Credential to be used to perform the installation. - - .PARAMETER SourceCredential - Credentials used to access the path set in the parameter `SourcePath`. Using this parameter will trigger a copy - of the installation media to a temp folder on the target node. Setup will then be started from the temp folder on the target node. - For any subsequent calls to the resource, the parameter `SourceCredential` is used to evaluate what major version the file 'setup.exe' - has in the path set, again, by the parameter `SourcePath`. - If the path, that is assigned to parameter `SourcePath`, contains a leaf folder, for example '\\server\share\folder', then that leaf - folder will be used as the name of the temporary folder. If the path, that is assigned to parameter `SourcePath`, does not have a - leaf folder, for example '\\server\share', then a unique guid will be used as the name of the temporary folder. - - .PARAMETER InstanceName - Name of the SQL instance to be installed. - - .PARAMETER FailoverClusterNetworkName - Host name to be assigned to the clustered SQL Server instance -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter()] - [ValidateSet('Install','InstallFailoverCluster','AddNode','PrepareFailoverCluster','CompleteFailoverCluster')] - [System.String] - $Action = 'Install', - - [Parameter()] - [System.String] - $SourcePath, - - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [Parameter()] - [System.Management.Automation.PSCredential] - $SourceCredential, - - [Parameter(Mandatory = $true)] - [System.String] - $InstanceName, - - [Parameter()] - [System.String] - $FailoverClusterNetworkName - ) - - if ($Action -in @('CompleteFailoverCluster','InstallFailoverCluster','Addnode')) - { - $sqlHostName = $FailoverClusterNetworkName - } - else - { - $sqlHostName = $env:COMPUTERNAME - } - - $InstanceName = $InstanceName.ToUpper() - - $SourcePath = [Environment]::ExpandEnvironmentVariables($SourcePath) - - if ($SourceCredential) - { - $newSmbMappingParameters = @{ - RemotePath = $SourcePath - UserName = "$($SourceCredential.GetNetworkCredential().Domain)\$($SourceCredential.GetNetworkCredential().UserName)" - Password = $($SourceCredential.GetNetworkCredential().Password) - } - - $null = New-SmbMapping @newSmbMappingParameters - } - - $pathToSetupExecutable = Join-Path -Path $SourcePath -ChildPath 'setup.exe' - - New-VerboseMessage -Message "Using path: $pathToSetupExecutable" - - $sqlVersion = Get-SqlMajorVersion -Path $pathToSetupExecutable - - if ($SourceCredential) - { - Remove-SmbMapping -RemotePath $SourcePath -Force - } - - if ($InstanceName -eq 'MSSQLSERVER') - { - $databaseServiceName = 'MSSQLSERVER' - $agentServiceName = 'SQLSERVERAGENT' - $fullTextServiceName = 'MSSQLFDLauncher' - $reportServiceName = 'ReportServer' - $analysisServiceName = 'MSSQLServerOLAPService' - } - else - { - $databaseServiceName = "MSSQL`$$InstanceName" - $agentServiceName = "SQLAgent`$$InstanceName" - $fullTextServiceName = "MSSQLFDLauncher`$$InstanceName" - $reportServiceName = "ReportServer`$$InstanceName" - $analysisServiceName = "MSOLAP`$$InstanceName" - } - - $integrationServiceName = "MsDtsServer$($sqlVersion)0" - - $features = '' - $clusteredSqlGroupName = '' - $clusteredSqlHostname = '' - $clusteredSqlIPAddress = '' - - $services = Get-Service - if ($services | Where-Object {$_.Name -eq $databaseServiceName}) - { - $features += 'SQLENGINE,' - - $sqlServiceAccountUsername = (Get-CimInstance -ClassName Win32_Service -Filter "Name = '$databaseServiceName'").StartName - $agentServiceAccountUsername = (Get-CimInstance -ClassName Win32_Service -Filter "Name = '$agentServiceName'").StartName - - $fullInstanceId = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL' -Name $InstanceName).$InstanceName - - # Check if Replication sub component is configured for this instance - New-VerboseMessage -Message "Detecting replication feature (HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\$fullInstanceId\ConfigurationState)" - $isReplicationInstalled = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\$fullInstanceId\ConfigurationState").SQL_Replication_Core_Inst - if ($isReplicationInstalled -eq 1) - { - New-VerboseMessage -Message 'Replication feature detected' - $features += 'REPLICATION,' - } - else - { - New-VerboseMessage -Message 'Replication feature not detected' - } - - $clientComponentsFullRegistryPath = "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\$($sqlVersion)0\Tools\Setup\Client_Components_Full" - $registryClientComponentsFullFeatureList = (Get-ItemProperty -Path $clientComponentsFullRegistryPath -ErrorAction SilentlyContinue).FeatureList - - Write-Debug -Message "Detecting Client Connectivity Tools feature ($clientComponentsFullRegistryPath)" - if ($registryClientComponentsFullFeatureList -like '*Connectivity_FNS=3*') - { - New-VerboseMessage -Message 'Client Connectivity Tools feature detected' - $features += 'CONN,' - } - else - { - New-VerboseMessage -Message 'Client Connectivity Tools feature not detected' - } - - Write-Debug -Message "Detecting Client Connectivity Backwards Compatibility Tools feature ($clientComponentsFullRegistryPath)" - if ($registryClientComponentsFullFeatureList -like '*Tools_Legacy_FNS=3*') - { - New-VerboseMessage -Message 'Client Connectivity Tools Backwards Compatibility feature detected' - $features += 'BC,' - } - else - { - New-VerboseMessage -Message 'Client Connectivity Tools Backwards Compatibility feature not detected' - } - - $instanceId = $fullInstanceId.Split('.')[1] - $instanceDirectory = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\$fullInstanceId\Setup" -Name 'SqlProgramDir').SqlProgramDir.Trim("\") - - $databaseServer = Connect-SQL -SQLServer $sqlHostName -SQLInstanceName $InstanceName - - $sqlCollation = $databaseServer.Collation - - $sqlSystemAdminAccounts = @() - foreach ($sqlUser in $databaseServer.Logins) - { - foreach ($sqlRole in $sqlUser.ListMembers()) - { - if ($sqlRole -like 'sysadmin') - { - $sqlSystemAdminAccounts += $sqlUser.Name - } - } - } - - if ($databaseServer.LoginMode -eq 'Mixed') - { - $securityMode = 'SQL' - } - else - { - $securityMode = 'Windows' - } - - $installSQLDataDirectory = $databaseServer.InstallDataDirectory - $sqlUserDatabaseDirectory = $databaseServer.DefaultFile - $sqlUserDatabaseLogDirectory = $databaseServer.DefaultLog - $sqlBackupDirectory = $databaseServer.BackupDirectory - - if ($databaseServer.IsClustered) - { - New-VerboseMessage -Message 'Clustered instance detected' - - $clusteredSqlInstance = Get-CimInstance -Namespace root/MSCluster -ClassName MSCluster_Resource -Filter "Type = 'SQL Server'" | - Where-Object { $_.PrivateProperties.InstanceName -eq $InstanceName } - - if (!$clusteredSqlInstance) - { - throw New-TerminatingError -ErrorType FailoverClusterResourceNotFound -FormatArgs $InstanceName -ErrorCategory 'ObjectNotFound' - } - - New-VerboseMessage -Message 'Clustered SQL Server resource located' - - $clusteredSqlGroup = $clusteredSqlInstance | Get-CimAssociatedInstance -ResultClassName MSCluster_ResourceGroup - $clusteredSqlNetworkName = $clusteredSqlGroup | Get-CimAssociatedInstance -ResultClassName MSCluster_Resource | - Where-Object { $_.Type -eq "Network Name" } - - $clusteredSqlIPAddress = ($clusteredSqlNetworkName | Get-CimAssociatedInstance -ResultClassName MSCluster_Resource | - Where-Object { $_.Type -eq "IP Address" }).PrivateProperties.Address - - # Extract the required values - $clusteredSqlGroupName = $clusteredSqlGroup.Name - $clusteredSqlHostname = $clusteredSqlNetworkName.PrivateProperties.DnsName - } - else - { - New-VerboseMessage -Message 'Clustered instance not detected' - } - } - - if ($services | Where-Object {$_.Name -eq $fullTextServiceName}) - { - $features += 'FULLTEXT,' - $fulltextServiceAccountUsername = (Get-CimInstance -ClassName Win32_Service -Filter "Name = '$fullTextServiceName'").StartName - } - - if ($services | Where-Object {$_.Name -eq $reportServiceName}) - { - $features += 'RS,' - $reportingServiceAccountUsername = (Get-CimInstance -ClassName Win32_Service -Filter "Name = '$reportServiceName'").StartName - } - - if ($services | Where-Object {$_.Name -eq $analysisServiceName}) - { - $features += 'AS,' - $analysisServiceAccountUsername = (Get-CimInstance -ClassName Win32_Service -Filter "Name = '$analysisServiceName'").StartName - - $analysisServer = Connect-SQLAnalysis -SQLServer $sqlHostName -SQLInstanceName $InstanceName - - $analysisCollation = $analysisServer.ServerProperties['CollationName'].Value - $analysisDataDirectory = $analysisServer.ServerProperties['DataDir'].Value - $analysisTempDirectory = $analysisServer.ServerProperties['TempDir'].Value - $analysisLogDirectory = $analysisServer.ServerProperties['LogDir'].Value - $analysisBackupDirectory = $analysisServer.ServerProperties['BackupDir'].Value - - $analysisSystemAdminAccounts = $analysisServer.Roles['Administrators'].Members.Name - - $analysisConfigDirectory = (Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\$analysisServiceName" -Name 'ImagePath').ImagePath.Replace(' -s ',',').Split(',')[1].Trim('"') - } - - if ($services | Where-Object {$_.Name -eq $integrationServiceName}) - { - $features += 'IS,' - $integrationServiceAccountUsername = (Get-CimInstance -ClassName Win32_Service -Filter "Name = '$integrationServiceName'").StartName - } - - $registryUninstallPath = 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall' - - # Verify if SQL Server Management Studio 2008 or SQL Server Management Studio 2008 R2 (major version 10) is installed - $installedProductSqlServerManagementStudio2008R2 = Get-ItemProperty -Path ( - Join-Path -Path $registryUninstallPath -ChildPath '{72AB7E6F-BC24-481E-8C45-1AB5B3DD795D}' - ) -ErrorAction SilentlyContinue - - # Verify if SQL Server Management Studio 2012 (major version 11) is installed - $installedProductSqlServerManagementStudio2012 = Get-ItemProperty -Path ( - Join-Path -Path $registryUninstallPath -ChildPath '{A7037EB2-F953-4B12-B843-195F4D988DA1}' - ) -ErrorAction SilentlyContinue - - # Verify if SQL Server Management Studio 2014 (major version 12) is installed - $installedProductSqlServerManagementStudio2014 = Get-ItemProperty -Path ( - Join-Path -Path $registryUninstallPath -ChildPath '{75A54138-3B98-4705-92E4-F619825B121F}' - ) -ErrorAction SilentlyContinue - - if ( - ($sqlVersion -eq 10 -and $installedProductSqlServerManagementStudio2008R2) -or - ($sqlVersion -eq 11 -and $installedProductSqlServerManagementStudio2012) -or - ($sqlVersion -eq 12 -and $installedProductSqlServerManagementStudio2014) - ) - { - $features += 'SSMS,' - } - - # Evaluating if SQL Server Management Studio Advanced 2008 or SQL Server Management Studio Advanced 2008 R2 (major version 10) is installed - $installedProductSqlServerManagementStudioAdvanced2008R2 = Get-ItemProperty -Path ( - Join-Path -Path $registryUninstallPath -ChildPath '{B5FE23CC-0151-4595-84C3-F1DE6F44FE9B}' - ) -ErrorAction SilentlyContinue - - # Evaluating if SQL Server Management Studio Advanced 2012 (major version 11) is installed - $installedProductSqlServerManagementStudioAdvanced2012 = Get-ItemProperty -Path ( - Join-Path -Path $registryUninstallPath -ChildPath '{7842C220-6E9A-4D5A-AE70-0E138271F883}' - ) -ErrorAction SilentlyContinue - - # Evaluating if SQL Server Management Studio Advanced 2014 (major version 12) is installed - $installedProductSqlServerManagementStudioAdvanced2014 = Get-ItemProperty -Path ( - Join-Path -Path $registryUninstallPath -ChildPath '{B5ECFA5C-AC4F-45A4-A12E-A76ABDD9CCBA}' - ) -ErrorAction SilentlyContinue - - if ( - ($sqlVersion -eq 10 -and $installedProductSqlServerManagementStudioAdvanced2008R2) -or - ($sqlVersion -eq 11 -and $installedProductSqlServerManagementStudioAdvanced2012) -or - ($sqlVersion -eq 12 -and $installedProductSqlServerManagementStudioAdvanced2014) - ) - { - $features += 'ADV_SSMS,' - } - - $features = $features.Trim(',') - if ($features -ne '') - { - $registryInstallerComponentsPath = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components' - - switch ($sqlVersion) - { - '10' - { - $registryKeySharedDir = '0D1F366D0FE0E404F8C15EE4F1C15094' - $registryKeySharedWOWDir = 'C90BFAC020D87EA46811C836AD3C507F' - } - - '11' - { - $registryKeySharedDir = 'FEE2E540D20152D4597229B6CFBC0A69' - $registryKeySharedWOWDir = 'A79497A344129F64CA7D69C56F5DD8B4' - } - - '12' - { - $registryKeySharedDir = 'FEE2E540D20152D4597229B6CFBC0A69' - $registryKeySharedWOWDir = 'C90BFAC020D87EA46811C836AD3C507F' - } - - { $_ -in ('13','14') } - { - $registryKeySharedDir = 'FEE2E540D20152D4597229B6CFBC0A69' - $registryKeySharedWOWDir = 'A79497A344129F64CA7D69C56F5DD8B4' - } - } - - if ($registryKeySharedDir) - { - $installSharedDir = Get-FirstItemPropertyValue -Path (Join-Path -Path $registryInstallerComponentsPath -ChildPath $registryKeySharedDir) - } - - if ($registryKeySharedWOWDir) - { - $installSharedWOWDir = Get-FirstItemPropertyValue -Path (Join-Path -Path $registryInstallerComponentsPath -ChildPath $registryKeySharedWOWDir) - } - } - - return @{ - SourcePath = $SourcePath - Features = $features - InstanceName = $InstanceName - InstanceID = $instanceID - InstallSharedDir = $installSharedDir - InstallSharedWOWDir = $installSharedWOWDir - InstanceDir = $instanceDirectory - SQLSvcAccountUsername = $sqlServiceAccountUsername - AgtSvcAccountUsername = $agentServiceAccountUsername - SQLCollation = $sqlCollation - SQLSysAdminAccounts = $sqlSystemAdminAccounts - SecurityMode = $securityMode - InstallSQLDataDir = $installSQLDataDirectory - SQLUserDBDir = $sqlUserDatabaseDirectory - SQLUserDBLogDir = $sqlUserDatabaseLogDirectory - SQLTempDBDir = $null - SQLTempDBLogDir = $null - SQLBackupDir = $sqlBackupDirectory - FTSvcAccountUsername = $fulltextServiceAccountUsername - RSSvcAccountUsername = $reportingServiceAccountUsername - ASSvcAccountUsername = $analysisServiceAccountUsername - ASCollation = $analysisCollation - ASSysAdminAccounts = $analysisSystemAdminAccounts - ASDataDir = $analysisDataDirectory - ASLogDir = $analysisLogDirectory - ASBackupDir = $analysisBackupDirectory - ASTempDir = $analysisTempDirectory - ASConfigDir = $analysisConfigDirectory - ISSvcAccountUsername = $integrationServiceAccountUsername - FailoverClusterGroupName = $clusteredSqlGroupName - FailoverClusterNetworkName = $clusteredSqlHostname - FailoverClusterIPAddress = $clusteredSqlIPAddress - } -} - -<# - .SYNOPSIS - Installs the SQL Server features to the node. - - .PARAMETER Action - The action to be performed. Default value is 'Install'. - Possible values are 'Install', 'InstallFailoverCluster', 'AddNode', 'PrepareFailoverCluster', and 'CompleteFailoverCluster' - - .PARAMETER SourcePath - The path to the root of the source files for installation. I.e and UNC path to a shared resource. Environment variables can be used in the path. - - .PARAMETER SetupCredential - Credential to be used to perform the installation. - - .PARAMETER SourceCredential - Credentials used to access the path set in the parameter `SourcePath`. Using this parameter will trigger a copy - of the installation media to a temp folder on the target node. Setup will then be started from the temp folder on the target node. - For any subsequent calls to the resource, the parameter `SourceCredential` is used to evaluate what major version the file 'setup.exe' - has in the path set, again, by the parameter `SourcePath`. - If the path, that is assigned to parameter `SourcePath`, contains a leaf folder, for example '\\server\share\folder', then that leaf - folder will be used as the name of the temporary folder. If the path, that is assigned to parameter `SourcePath`, does not have a - leaf folder, for example '\\server\share', then a unique guid will be used as the name of the temporary folder. - - .PARAMETER SuppressReboot - Suppressed reboot. - - .PARAMETER ForceReboot - Forces reboot. - - .PARAMETER Features - SQL features to be installed. - - .PARAMETER InstanceName - Name of the SQL instance to be installed. - - .PARAMETER InstanceID - SQL instance ID, if different from InstanceName. - - .PARAMETER ProductKey - Product key for licensed installations. - - .PARAMETER UpdateEnabled - Enabled updates during installation. - - .PARAMETER UpdateSource - Path to the source of updates to be applied during installation. - - .PARAMETER SQMReporting - Enable customer experience reporting. - - .PARAMETER ErrorReporting - Enable error reporting. - - .PARAMETER InstallSharedDir - Installation path for shared SQL files. - - .PARAMETER InstallSharedWOWDir - Installation path for x86 shared SQL files. - - .PARAMETER InstanceDir - Installation path for SQL instance files. - - .PARAMETER SQLSvcAccount - Service account for the SQL service. - - .PARAMETER AgtSvcAccount - Service account for the SQL Agent service. - - .PARAMETER SQLCollation - Collation for SQL. - - .PARAMETER SQLSysAdminAccounts - Array of accounts to be made SQL administrators. - - .PARAMETER SecurityMode - Security mode to apply to the SQL Server instance. - - .PARAMETER SAPwd - SA password, if SecurityMode is set to 'SQL'. - - .PARAMETER InstallSQLDataDir - Root path for SQL database files. - - .PARAMETER SQLUserDBDir - Path for SQL database files. - - .PARAMETER SQLUserDBLogDir - Path for SQL log files. - - .PARAMETER SQLTempDBDir - Path for SQL TempDB files. - - .PARAMETER SQLTempDBLogDir - Path for SQL TempDB log files. - - .PARAMETER SQLBackupDir - Path for SQL backup files. - - .PARAMETER FTSvcAccount - Service account for the Full Text service. - - .PARAMETER RSSvcAccount - Service account for Reporting Services service. - - .PARAMETER ASSvcAccount - Service account for Analysis Services service. - - .PARAMETER ASCollation - Collation for Analysis Services. - - .PARAMETER ASSysAdminAccounts - Array of accounts to be made Analysis Services admins. - - .PARAMETER ASDataDir - Path for Analysis Services data files. - - .PARAMETER ASLogDir - Path for Analysis Services log files. - - .PARAMETER ASBackupDir - Path for Analysis Services backup files. - - .PARAMETER ASTempDir - Path for Analysis Services temp files. - - .PARAMETER ASConfigDir - Path for Analysis Services config. - - .PARAMETER ISSvcAccount - Service account for Integration Services service. - - .PARAMETER BrowserSvcStartupType - Specifies the startup mode for SQL Server Browser service - - .PARAMETER FailoverClusterGroupName - The name of the resource group to create for the clustered SQL Server instance. Default is 'SQL Server (InstanceName)'. - - .PARAMETER FailoverClusterIPAddress - Array of IP Addresses to be assigned to the clustered SQL Server instance - - .PARAMETER FailoverClusterNetworkName - Host name to be assigned to the clustered SQL Server instance -#> -function Set-TargetResource -{ - # Suppressing this rule because $global:DSCMachineStatus is used to trigger a reboot, either by force or when there are pending changes. - [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', '')] - [CmdletBinding()] - param - ( - [Parameter()] - [ValidateSet('Install','InstallFailoverCluster','AddNode','PrepareFailoverCluster','CompleteFailoverCluster')] - [System.String] - $Action = 'Install', - - [Parameter()] - [System.String] - $SourcePath, - - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [Parameter()] - [System.Management.Automation.PSCredential] - $SourceCredential, - - [Parameter()] - [System.Boolean] - $SuppressReboot, - - [Parameter()] - [System.Boolean] - $ForceReboot, - - [Parameter()] - [System.String] - $Features, - - [Parameter(Mandatory = $true)] - [System.String] - $InstanceName, - - [Parameter()] - [System.String] - $InstanceID, - - [Parameter()] - [System.String] - $ProductKey, - - [Parameter()] - [System.String] - $UpdateEnabled, - - [Parameter()] - [System.String] - $UpdateSource, - - [Parameter()] - [System.String] - $SQMReporting, - - [Parameter()] - [System.String] - $ErrorReporting, - - [Parameter()] - [System.String] - $InstallSharedDir, - - [Parameter()] - [System.String] - $InstallSharedWOWDir, - - [Parameter()] - [System.String] - $InstanceDir, - - [Parameter()] - [System.Management.Automation.PSCredential] - $SQLSvcAccount, - - [Parameter()] - [System.Management.Automation.PSCredential] - $AgtSvcAccount, - - [Parameter()] - [System.String] - $SQLCollation, - - [Parameter()] - [System.String[]] - $SQLSysAdminAccounts, - - [Parameter()] - [System.String] - $SecurityMode, - - [Parameter()] - [System.Management.Automation.PSCredential] - $SAPwd, - - [Parameter()] - [System.String] - $InstallSQLDataDir, - - [Parameter()] - [System.String] - $SQLUserDBDir, - - [Parameter()] - [System.String] - $SQLUserDBLogDir, - - [Parameter()] - [System.String] - $SQLTempDBDir, - - [Parameter()] - [System.String] - $SQLTempDBLogDir, - - [Parameter()] - [System.String] - $SQLBackupDir, - - [Parameter()] - [System.Management.Automation.PSCredential] - $FTSvcAccount, - - [Parameter()] - [System.Management.Automation.PSCredential] - $RSSvcAccount, - - [Parameter()] - [System.Management.Automation.PSCredential] - $ASSvcAccount, - - [Parameter()] - [System.String] - $ASCollation, - - [Parameter()] - [System.String[]] - $ASSysAdminAccounts, - - [Parameter()] - [System.String] - $ASDataDir, - - [Parameter()] - [System.String] - $ASLogDir, - - [Parameter()] - [System.String] - $ASBackupDir, - - [Parameter()] - [System.String] - $ASTempDir, - - [Parameter()] - [System.String] - $ASConfigDir, - - [Parameter()] - [System.Management.Automation.PSCredential] - $ISSvcAccount, - - [Parameter()] - [System.String] - [ValidateSet('Automatic', 'Disabled', 'Manual')] - $BrowserSvcStartupType, - - [Parameter()] - [System.String] - $FailoverClusterGroupName = "SQL Server ($InstanceName)", - - [Parameter()] - [System.String[]] - $FailoverClusterIPAddress, - - [Parameter()] - [System.String] - $FailoverClusterNetworkName - ) - - $getTargetResourceParameters = @{ - Action = $Action - SourcePath = $SourcePath - SetupCredential = $SetupCredential - SourceCredential = $SourceCredential - InstanceName = $InstanceName - FailoverClusterNetworkName = $FailoverClusterNetworkName - } - - $getTargetResourceResult = Get-TargetResource @getTargetResourceParameters - - $InstanceName = $InstanceName.ToUpper() - - $parametersToEvaluateTrailingSlash = @( - 'InstanceDir', - 'InstallSharedDir', - 'InstallSharedWOWDir', - 'InstallSQLDataDir', - 'SQLUserDBDir', - 'SQLUserDBLogDir', - 'SQLTempDBDir', - 'SQLTempDBLogDir', - 'SQLBackupDir', - 'ASDataDir', - 'ASLogDir', - 'ASBackupDir', - 'ASTempDir', - 'ASConfigDir' - ) - - # Remove trailing slash ('\') from paths - foreach ($parameterName in $parametersToEvaluateTrailingSlash) - { - if ($PSBoundParameters.ContainsKey($parameterName)) - { - $parameterValue = Get-Variable -Name $parameterName -ValueOnly - - # Trim backslash, but only if the path contains a full path and not just a qualifier. - if ($parameterValue -and $parameterValue -notmatch '^[a-zA-Z]:\\$') - { - Set-Variable -Name $parameterName -Value $parameterValue.TrimEnd('\') - } - - # If the path only contains a qualifier but no backslash ('M:'), then a backslash is added ('M:\'). - if ($parameterValue -match '^[a-zA-Z]:$') - { - Set-Variable -Name $parameterName -Value "$parameterValue\" - } - } - } - - $SourcePath = [Environment]::ExpandEnvironmentVariables($SourcePath) - - if ($SourceCredential) - { - $newSmbMappingParameters = @{ - RemotePath = $SourcePath - UserName = "$($SourceCredential.GetNetworkCredential().Domain)\$($SourceCredential.GetNetworkCredential().UserName)" - Password = $($SourceCredential.GetNetworkCredential().Password) - } - - $null = New-SmbMapping @newSmbMappingParameters - - # Create a destination folder so the media files aren't written to the root of the Temp folder. - $mediaDestinationFolder = Split-Path -Path $SourcePath -Leaf - if (-not $mediaDestinationFolder ) - { - $mediaDestinationFolder = New-Guid | Select-Object -ExpandProperty Guid - } - - $mediaDestinationPath = Join-Path -Path (Get-TemporaryFolder) -ChildPath $mediaDestinationFolder - - New-VerboseMessage -Message "Robocopy is copying media from source '$SourcePath' to destination '$mediaDestinationPath'" - Copy-ItemWithRoboCopy -Path $SourcePath -DestinationPath $mediaDestinationPath - - Remove-SmbMapping -RemotePath $SourcePath -Force - - $SourcePath = $mediaDestinationPath - } - - $pathToSetupExecutable = Join-Path -Path $SourcePath -ChildPath 'setup.exe' - - New-VerboseMessage -Message "Using path: $pathToSetupExecutable" - - $sqlVersion = Get-SqlMajorVersion -Path $pathToSetupExecutable - - # Determine features to install - $featuresToInstall = "" - foreach ($feature in $Features.Split(",")) - { - # Given that all the returned features are uppercase, make sure that the feature to search for is also uppercase - $feature = $feature.ToUpper(); - - if (($sqlVersion -in ('13','14')) -and ($feature -in ('ADV_SSMS','SSMS'))) - { - Throw New-TerminatingError -ErrorType FeatureNotSupported -FormatArgs @($feature) -ErrorCategory InvalidData - } - - if (-not ($getTargetResourceResult.Features.Contains($feature))) - { - $featuresToInstall += "$feature," - } - } - - $Features = $featuresToInstall.Trim(',') - - # If SQL shared components already installed, clear InstallShared*Dir variables - switch ($sqlVersion) - { - '10' - { - if((Get-Variable -Name 'InstallSharedDir' -ErrorAction SilentlyContinue) -and (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\0D1F366D0FE0E404F8C15EE4F1C15094' -ErrorAction SilentlyContinue)) - { - Set-Variable -Name 'InstallSharedDir' -Value '' - } - - if((Get-Variable -Name 'InstallSharedWOWDir' -ErrorAction SilentlyContinue) -and (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\C90BFAC020D87EA46811C836AD3C507F' -ErrorAction SilentlyContinue)) - { - Set-Variable -Name 'InstallSharedWOWDir' -Value '' - } - } - - '11' - { - if((Get-Variable -Name 'InstallSharedDir' -ErrorAction SilentlyContinue) -and (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\30AE1F084B1CF8B4797ECB3CCAA3B3B6' -ErrorAction SilentlyContinue)) - { - Set-Variable -Name 'InstallSharedDir' -Value '' - } - - if((Get-Variable -Name 'InstallSharedWOWDir' -ErrorAction SilentlyContinue) -and (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\A79497A344129F64CA7D69C56F5DD8B4' -ErrorAction SilentlyContinue)) - { - Set-Variable -Name 'InstallSharedWOWDir' -Value '' - } - } - - '12' - { - if((Get-Variable -Name 'InstallSharedDir' -ErrorAction SilentlyContinue) -and (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\FEE2E540D20152D4597229B6CFBC0A69' -ErrorAction SilentlyContinue)) - { - Set-Variable -Name 'InstallSharedDir' -Value '' - } - - if((Get-Variable -Name 'InstallSharedWOWDir' -ErrorAction SilentlyContinue) -and (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\C90BFAC020D87EA46811C836AD3C507F' -ErrorAction SilentlyContinue)) - { - Set-Variable -Name 'InstallSharedWOWDir' -Value '' - } - } - - { $_ -in ('13','14') } - { - if((Get-Variable -Name 'InstallSharedDir' -ErrorAction SilentlyContinue) -and (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\FEE2E540D20152D4597229B6CFBC0A69' -ErrorAction SilentlyContinue)) - { - Set-Variable -Name 'InstallSharedDir' -Value '' - } - - if((Get-Variable -Name 'InstallSharedWOWDir' -ErrorAction SilentlyContinue) -and (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\A79497A344129F64CA7D69C56F5DD8B4' -ErrorAction SilentlyContinue)) - { - Set-Variable -Name 'InstallSharedWOWDir' -Value '' - } - } - } - - $setupArguments = @{} - - if ($Action -in @('PrepareFailoverCluster','CompleteFailoverCluster','InstallFailoverCluster','Addnode')) - { - # This was brought over from the old module. Should be removed (breaking change). - $setupArguments += @{ - SkipRules = 'Cluster_VerifyForErrors' - } - } - - <# - Set the failover cluster group name and failover cluster network name for this clustered instance - if the action is either installing (InstallFailoverCluster) or completing (CompleteFailoverCluster) a cluster. - #> - if ($Action -in @('CompleteFailoverCluster','InstallFailoverCluster')) - { - $setupArguments += @{ - FailoverClusterNetworkName = $FailoverClusterNetworkName - FailoverClusterGroup = $FailoverClusterGroupName - } - } - - # Perform disk mapping for specific cluster installation types - if ($Action -in @('CompleteFailoverCluster','InstallFailoverCluster')) - { - $requiredDrive = @() - - # This is also used to evaluate which cluster shard disks should be used. - $parametersToEvaluateShareDisk = @( - 'InstallSQLDataDir', - 'SQLUserDBDir', - 'SQLUserDBLogDir', - 'SQLTempDBDir', - 'SQLTempDBLogDir', - 'SQLBackupDir', - 'ASDataDir', - 'ASLogDir', - 'ASBackupDir', - 'ASTempDir', - 'ASConfigDir' - ) - - # Get a required listing of drives based on parameters assigned by user. - foreach ($parameterName in $parametersToEvaluateShareDisk) - { - if ($PSBoundParameters.ContainsKey($parameterName)) - { - $parameterValue = Get-Variable -Name $parameterName -ValueOnly - if ($parameterValue) - { - New-VerboseMessage -Message ("Found assigned parameter '{0}'. Adding path '{1}' to list of paths that required cluster drive." -f $parameterName, $parameterValue) - $requiredDrive += $parameterValue - } - } - } - - # Only keep unique paths and add a member to keep track if the path is mapped to a disk. - $requiredDrive = $requiredDrive | Sort-Object -Unique | Add-Member -MemberType NoteProperty -Name IsMapped -Value $false -PassThru - - # Get the disk resources that are available (not assigned to a cluster role) - $availableStorage = Get-CimInstance -Namespace 'root/MSCluster' -ClassName 'MSCluster_ResourceGroup' -Filter "Name = 'Available Storage'" | - Get-CimAssociatedInstance -Association MSCluster_ResourceGroupToResource -ResultClassName MSCluster_Resource | ` - Add-Member -MemberType NoteProperty -Name 'IsPossibleOwner' -Value $false -PassThru - - # First map regular cluster volumes - foreach ($diskResource in $availableStorage) - { - # Determine whether the current node is a possible owner of the disk resource - $possibleOwners = $diskResource | Get-CimAssociatedInstance -Association 'MSCluster_ResourceToPossibleOwner' -KeyOnly | Select-Object -ExpandProperty Name - - if ($possibleOwners -icontains $env:COMPUTERNAME) - { - $diskResource.IsPossibleOwner = $true - } - } - - $failoverClusterDisks = @() - - foreach ($currentRequiredDrive in $requiredDrive) - { - foreach ($diskResource in ($availableStorage | Where-Object {$_.IsPossibleOwner -eq $true})) - { - $partitions = $diskResource | Get-CimAssociatedInstance -ResultClassName 'MSCluster_DiskPartition' | Select-Object -ExpandProperty Path - foreach ($partition in $partitions) - { - if ($currentRequiredDrive -imatch $partition.Replace('\','\\')) - { - $currentRequiredDrive.IsMapped = $true - $failoverClusterDisks += $diskResource.Name - break - } - - if ($currentRequiredDrive.IsMapped) - { - break - } - } - - if ($currentRequiredDrive.IsMapped) - { - break - } - } - } - - # Now we handle cluster shared volumes - $clusterSharedVolumes = Get-CimInstance -ClassName 'MSCluster_ClusterSharedVolume' -Namespace 'root/MSCluster' - - foreach ($clusterSharedVolume in $clusterSharedVolumes) - { - foreach ($currentRequiredDrive in ($requiredDrive | Where-Object {$_.IsMapped -eq $false})) - { - if ($currentRequiredDrive -imatch $clusterSharedVolume.Name.Replace('\','\\')) - { - $diskName = Get-CimInstance -ClassName 'MSCluster_ClusterSharedVolumeToResource' -Namespace 'root/MSCluster' | ` - Where-Object {$_.GroupComponent.Name -eq $clusterSharedVolume.Name} | ` - Select-Object -ExpandProperty PartComponent | ` - Select-Object -ExpandProperty Name - $failoverClusterDisks += $diskName - $currentRequiredDrive.IsMapped = $true - } - } - } - - # Ensure we have a unique listing of disks - $failoverClusterDisks = $failoverClusterDisks | Sort-Object -Unique - - # Ensure we mapped all required drives - $unMappedRequiredDrives = $requiredDrive | Where-Object {$_.IsMapped -eq $false} | Measure-Object - if ($unMappedRequiredDrives.Count -gt 0) - { - throw New-TerminatingError -ErrorType FailoverClusterDiskMappingError -FormatArgs ($failoverClusterDisks -join '; ') -ErrorCategory InvalidResult - } - - # Add the cluster disks as a setup argument - $setupArguments += @{ FailoverClusterDisks = ($failoverClusterDisks | Sort-Object) } - } - - # Determine network mapping for specific cluster installation types - if ($Action -in @('CompleteFailoverCluster','InstallFailoverCluster')) - { - $clusterIPAddresses = @() - - # If no IP Address has been specified, use "DEFAULT" - if ($FailoverClusterIPAddress.Count -eq 0) - { - $clusterIPAddresses += "DEFAULT" - } - else - { - # Get the available client networks - $availableNetworks = @(Get-CimInstance -Namespace root/MSCluster -ClassName MSCluster_Network -Filter 'Role >= 2') - - # Add supplied IP Addresses that are valid for available cluster networks - foreach ($address in $FailoverClusterIPAddress) - { - foreach ($network in $availableNetworks) - { - # Determine whether the IP address is valid for this network - if (Test-IPAddress -IPAddress $address -NetworkID $network.Address -SubnetMask $network.AddressMask) - { - # Add the formatted string to our array - $clusterIPAddresses += "IPv4;$address;$($network.Name);$($network.AddressMask)" - } - } - } - } - - # Ensure we mapped all required networks - $suppliedNetworkCount = $FailoverClusterIPAddress.Count - $mappedNetworkCount = $clusterIPAddresses.Count - - # Determine whether we have mapping issues for the IP Address(es) - if ($mappedNetworkCount -lt $suppliedNetworkCount) - { - throw New-TerminatingError -ErrorType FailoverClusterIPAddressNotValid -ErrorCategory InvalidArgument - } - - # Add the networks to the installation arguments - $setupArguments += @{ FailoverClusterIPAddresses = $clusterIPAddresses } - } - - # Add standard install arguments - $setupArguments += @{ - Quiet = $true - IAcceptSQLServerLicenseTerms = $true - Action = $Action - } - - $argumentVars = @( - 'InstanceName', - 'InstanceID', - 'UpdateEnabled', - 'UpdateSource', - 'ProductKey', - 'SQMReporting', - 'ErrorReporting' - ) - - if ($Action -in @('Install','InstallFailoverCluster','PrepareFailoverCluster','CompleteFailoverCluster')) - { - $argumentVars += @( - 'Features', - 'InstallSharedDir', - 'InstallSharedWOWDir', - 'InstanceDir' - ) - } - - if ($null -ne $BrowserSvcStartupType) - { - $argumentVars += 'BrowserSvcStartupType' - } - - if ($Features.Contains('SQLENGINE')) - { - - if ($PSBoundParameters.ContainsKey('SQLSvcAccount')) - { - $setupArguments += (Get-ServiceAccountParameters -ServiceAccount $SQLSvcAccount -ServiceType 'SQL') - } - - if($PSBoundParameters.ContainsKey('AgtSvcAccount')) - { - $setupArguments += (Get-ServiceAccountParameters -ServiceAccount $AgtSvcAccount -ServiceType 'AGT') - } - - if ($SecurityMode -eq 'SQL') - { - $setupArguments += @{ SAPwd = $SAPwd.GetNetworkCredential().Password } - } - - # Should not be passed when PrepareFailoverCluster is specified - if ($Action -in @('Install','InstallFailoverCluster','CompleteFailoverCluster')) - { - $setupArguments += @{ SQLSysAdminAccounts = @($SetupCredential.UserName) } - if ($PSBoundParameters.ContainsKey('SQLSysAdminAccounts')) - { - $setupArguments['SQLSysAdminAccounts'] += $SQLSysAdminAccounts - } - - $argumentVars += @( - 'SecurityMode', - 'SQLCollation', - 'InstallSQLDataDir', - 'SQLUserDBDir', - 'SQLUserDBLogDir', - 'SQLTempDBDir', - 'SQLTempDBLogDir', - 'SQLBackupDir' - ) - } - - if ($Action -in @('Install')) - { - $setupArguments += @{ AgtSvcStartupType = 'Automatic' } - } - } - - if ($Features.Contains('FULLTEXT')) - { - if ($PSBoundParameters.ContainsKey('FTSvcAccount')) - { - $setupArguments += (Get-ServiceAccountParameters -ServiceAccount $FTSvcAccount -ServiceType 'FT') - } - } - - if ($Features.Contains('RS')) - { - if ($PSBoundParameters.ContainsKey('RSSvcAccount')) - { - $setupArguments += (Get-ServiceAccountParameters -ServiceAccount $RSSvcAccount -ServiceType 'RS') - } - } - - if ($Features.Contains('AS')) - { - $argumentVars += @( - 'ASCollation', - 'ASDataDir', - 'ASLogDir', - 'ASBackupDir', - 'ASTempDir', - 'ASConfigDir' - ) - - if ($PSBoundParameters.ContainsKey('ASSvcAccount')) - { - $setupArguments += (Get-ServiceAccountParameters -ServiceAccount $ASSvcAccount -ServiceType 'AS') - } - - if ($Action -in ('Install','InstallFailoverCluster','CompleteFailoverCluster')) - { - $setupArguments += @{ ASSysAdminAccounts = @($SetupCredential.UserName) } - - if($PSBoundParameters.ContainsKey("ASSysAdminAccounts")) - { - $setupArguments['ASSysAdminAccounts'] += $ASSysAdminAccounts - } - } - } - - if ($Features.Contains('IS')) - { - if ($PSBoundParameters.ContainsKey('ISSvcAccount')) - { - $setupArguments += (Get-ServiceAccountParameters -ServiceAccount $ISSvcAccount -ServiceType 'IS') - } - } - - # Automatically include any additional arguments - foreach ($argument in $argumentVars) - { - if($argument -eq 'ProductKey') - { - $setupArguments += @{ 'PID' = (Get-Variable -Name $argument -ValueOnly) } - } - else - { - $setupArguments += @{ $argument = (Get-Variable -Name $argument -ValueOnly) } - } - } - - # Build the argument string to be passed to setup - $arguments = '' - foreach ($currentSetupArgument in $setupArguments.GetEnumerator()) - { - if ($currentSetupArgument.Value -ne '') - { - # Arrays are handled specially - if ($currentSetupArgument.Value -is [array]) - { - # Sort and format the array - $setupArgumentValue = ($currentSetupArgument.Value | Sort-Object | ForEach-Object { '"{0}"' -f $_ }) -join ' ' - } - elseif ($currentSetupArgument.Value -is [Boolean]) - { - $setupArgumentValue = @{ $true = 'True'; $false = 'False' }[$currentSetupArgument.Value] - $setupArgumentValue = '"{0}"' -f $setupArgumentValue - } - else - { - # Features are comma-separated, no quotes - if ($currentSetupArgument.Key -eq 'Features') - { - $setupArgumentValue = $currentSetupArgument.Value - } - else - { - $setupArgumentValue = '"{0}"' -f $currentSetupArgument.Value - } - } - - $arguments += "/$($currentSetupArgument.Key.ToUpper())=$($setupArgumentValue) " - } - - } - - # Replace sensitive values for verbose output - $log = $arguments - if ($SecurityMode -eq 'SQL') - { - $log = $log.Replace($SAPwd.GetNetworkCredential().Password,"********") - } - - if ($ProductKey -ne "") - { - $log = $log.Replace($ProductKey,"*****-*****-*****-*****-*****") - } - - $logVars = @('AgtSvcAccount', 'SQLSvcAccount', 'FTSvcAccount', 'RSSvcAccount', 'ASSvcAccount','ISSvcAccount') - foreach ($logVar in $logVars) - { - if ($PSBoundParameters.ContainsKey($logVar)) - { - $log = $log.Replace((Get-Variable -Name $logVar).Value.GetNetworkCredential().Password,"********") - } - } - - New-VerboseMessage -Message "Starting setup using arguments: $log" - - $arguments = $arguments.Trim() - $processArguments = @{ - Path = $pathToSetupExecutable - Arguments = $arguments - } - - if ($Action -in @('InstallFailoverCluster','AddNode')) - { - $processArguments.Add('Credential',$SetupCredential) - } - - $process = StartWin32Process @processArguments - - New-VerboseMessage -Message $process - - WaitForWin32ProcessEnd -Path $pathToSetupExecutable -Arguments $arguments - - if ($ForceReboot -or ($null -ne (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Name 'PendingFileRenameOperations' -ErrorAction SilentlyContinue))) - { - if (-not ($SuppressReboot)) - { - $global:DSCMachineStatus = 1 - } - else - { - New-VerboseMessage -Message 'Suppressing reboot' - } - } - - if (-not (Test-TargetResource @PSBoundParameters)) - { - throw New-TerminatingError -ErrorType TestFailedAfterSet -ErrorCategory InvalidResult - } -} - -<# - .SYNOPSIS - Tests if the SQL Server features are installed on the node. - - .PARAMETER Action - The action to be performed. Default value is 'Install'. - Possible values are 'Install', 'InstallFailoverCluster', 'AddNode', 'PrepareFailoverCluster', and 'CompleteFailoverCluster' - - .PARAMETER SourcePath - The path to the root of the source files for installation. I.e and UNC path to a shared resource. Environment variables can be used in the path. - - .PARAMETER SetupCredential - Credential to be used to perform the installation. - - .PARAMETER SourceCredential - Credentials used to access the path set in the parameter `SourcePath`. Using this parameter will trigger a copy - of the installation media to a temp folder on the target node. Setup will then be started from the temp folder on the target node. - For any subsequent calls to the resource, the parameter `SourceCredential` is used to evaluate what major version the file 'setup.exe' - has in the path set, again, by the parameter `SourcePath`. - If the path, that is assigned to parameter `SourcePath`, contains a leaf folder, for example '\\server\share\folder', then that leaf - folder will be used as the name of the temporary folder. If the path, that is assigned to parameter `SourcePath`, does not have a - leaf folder, for example '\\server\share', then a unique guid will be used as the name of the temporary folder. - - .PARAMETER SuppressReboot - Suppresses reboot. - - .PARAMETER ForceReboot - Forces reboot. - - .PARAMETER Features - SQL features to be installed. - - .PARAMETER InstanceName - Name of the SQL instance to be installed. - - .PARAMETER InstanceID - SQL instance ID, if different from InstanceName. - - .PARAMETER ProductKey - Product key for licensed installations. - - .PARAMETER UpdateEnabled - Enabled updates during installation. - - .PARAMETER UpdateSource - Path to the source of updates to be applied during installation. - - .PARAMETER SQMReporting - Enable customer experience reporting. - - .PARAMETER ErrorReporting - Enable error reporting. - - .PARAMETER InstallSharedDir - Installation path for shared SQL files. - - .PARAMETER InstallSharedWOWDir - Installation path for x86 shared SQL files. - - .PARAMETER InstanceDir - Installation path for SQL instance files. - - .PARAMETER SQLSvcAccount - Service account for the SQL service. - - .PARAMETER AgtSvcAccount - Service account for the SQL Agent service. - - .PARAMETER SQLCollation - Collation for SQL. - - .PARAMETER SQLSysAdminAccounts - Array of accounts to be made SQL administrators. - - .PARAMETER SecurityMode - Security mode to apply to the SQL Server instance. - - .PARAMETER SAPwd - SA password, if SecurityMode is set to 'SQL'. - - .PARAMETER InstallSQLDataDir - Root path for SQL database files. - - .PARAMETER SQLUserDBDir - Path for SQL database files. - - .PARAMETER SQLUserDBLogDir - Path for SQL log files. - - .PARAMETER SQLTempDBDir - Path for SQL TempDB files. - - .PARAMETER SQLTempDBLogDir - Path for SQL TempDB log files. - - .PARAMETER SQLBackupDir - Path for SQL backup files. - - .PARAMETER FTSvcAccount - Service account for the Full Text service. - - .PARAMETER RSSvcAccount - Service account for Reporting Services service. - - .PARAMETER ASSvcAccount - Service account for Analysis Services service. - - .PARAMETER ASCollation - Collation for Analysis Services. - - .PARAMETER ASSysAdminAccounts - Array of accounts to be made Analysis Services admins. - - .PARAMETER ASDataDir - Path for Analysis Services data files. - - .PARAMETER ASLogDir - Path for Analysis Services log files. - - .PARAMETER ASBackupDir - Path for Analysis Services backup files. - - .PARAMETER ASTempDir - Path for Analysis Services temp files. - - .PARAMETER ASConfigDir - Path for Analysis Services config. - - .PARAMETER ISSvcAccount - Service account for Integration Services service. - - .PARAMETER BrowserSvcStartupType - Specifies the startup mode for SQL Server Browser service - - .PARAMETER FailoverClusterGroupName - The name of the resource group to create for the clustered SQL Server instance. Default is 'SQL Server (InstanceName)'. - - .PARAMETER FailoverClusterIPAddress - Array of IP Addresses to be assigned to the clustered SQL Server instance - - .PARAMETER FailoverClusterNetworkName - Host name to be assigned to the clustered SQL Server instance -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter()] - [ValidateSet('Install','InstallFailoverCluster','AddNode','PrepareFailoverCluster','CompleteFailoverCluster')] - [System.String] - $Action = 'Install', - - [Parameter()] - [System.String] - $SourcePath, - - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [Parameter()] - [System.Management.Automation.PSCredential] - $SourceCredential, - - [Parameter()] - [System.Boolean] - $SuppressReboot, - - [Parameter()] - [System.Boolean] - $ForceReboot, - - [Parameter()] - [System.String] - $Features, - - [Parameter(Mandatory = $true)] - [System.String] - $InstanceName, - - [Parameter()] - [System.String] - $InstanceID, - - [Parameter()] - [System.String] - $ProductKey, - - [Parameter()] - [System.String] - $UpdateEnabled, - - [Parameter()] - [System.String] - $UpdateSource, - - [Parameter()] - [System.String] - $SQMReporting, - - [Parameter()] - [System.String] - $ErrorReporting, - - [Parameter()] - [System.String] - $InstallSharedDir, - - [Parameter()] - [System.String] - $InstallSharedWOWDir, - - [Parameter()] - [System.String] - $InstanceDir, - - [Parameter()] - [System.Management.Automation.PSCredential] - $SQLSvcAccount, - - [Parameter()] - [System.Management.Automation.PSCredential] - $AgtSvcAccount, - - [Parameter()] - [System.String] - $SQLCollation, - - [Parameter()] - [System.String[]] - $SQLSysAdminAccounts, - - [Parameter()] - [System.String] - $SecurityMode, - - [Parameter()] - [System.Management.Automation.PSCredential] - $SAPwd, - - [Parameter()] - [System.String] - $InstallSQLDataDir, - - [Parameter()] - [System.String] - $SQLUserDBDir, - - [Parameter()] - [System.String] - $SQLUserDBLogDir, - - [Parameter()] - [System.String] - $SQLTempDBDir, - - [Parameter()] - [System.String] - $SQLTempDBLogDir, - - [Parameter()] - [System.String] - $SQLBackupDir, - - [Parameter()] - [System.Management.Automation.PSCredential] - $FTSvcAccount, - - [Parameter()] - [System.Management.Automation.PSCredential] - $RSSvcAccount, - - [Parameter()] - [System.Management.Automation.PSCredential] - $ASSvcAccount, - - [Parameter()] - [System.String] - $ASCollation, - - [Parameter()] - [System.String[]] - $ASSysAdminAccounts, - - [Parameter()] - [System.String] - $ASDataDir, - - [Parameter()] - [System.String] - $ASLogDir, - - [Parameter()] - [System.String] - $ASBackupDir, - - [Parameter()] - [System.String] - $ASTempDir, - - [Parameter()] - [System.String] - $ASConfigDir, - - [Parameter()] - [System.Management.Automation.PSCredential] - $ISSvcAccount, - - [Parameter()] - [System.String] - [ValidateSet('Automatic', 'Disabled', 'Manual')] - $BrowserSvcStartupType, - - [Parameter(ParameterSetName = 'ClusterInstall')] - [System.String] - $FailoverClusterGroupName = "SQL Server ($InstanceName)", - - [Parameter(ParameterSetName = 'ClusterInstall')] - [System.String[]] - $FailoverClusterIPAddress, - - [Parameter(ParameterSetName = 'ClusterInstall')] - [System.String] - $FailoverClusterNetworkName - ) - - $getTargetResourceParameters = @{ - Action = $Action - SourcePath = $SourcePath - SetupCredential = $SetupCredential - SourceCredential = $SourceCredential - InstanceName = $InstanceName - FailoverClusterNetworkName = $FailoverClusterNetworkName - } - - $boundParameters = $PSBoundParameters - - $getTargetResourceResult = Get-TargetResource @getTargetResourceParameters - New-VerboseMessage -Message "Features found: '$($getTargetResourceResult.Features)'" - - $result = $true - - if ($getTargetResourceResult.Features ) - { - foreach ($feature in $Features.Split(",")) - { - # Given that all the returned features are uppercase, make sure that the feature to search for is also uppercase - $feature = $feature.ToUpper(); - - if(!($getTargetResourceResult.Features.Contains($feature))) - { - New-VerboseMessage -Message "Unable to find feature '$feature' among the installed features: '$($getTargetResourceResult.Features)'" - $result = $false - } - } - } - else - { - $result = $false - } - - if ($PSCmdlet.ParameterSetName -eq 'ClusterInstall') - { - New-VerboseMessage -Message "Clustered install, checking parameters." - - $boundParameters.Keys | Where-Object {$_ -imatch "^FailoverCluster"} | ForEach-Object { - $variableName = $_ - - if ($getTargetResourceResult.$variableName -ne $boundParameters[$variableName]) { - New-VerboseMessage -Message "$variableName '$($boundParameters[$variableName])' is not in the desired state for this cluster." - $result = $false - } - } - } - - return $result -} - -<# - .SYNOPSIS - Returns the SQL Server major version from the setup.exe executable provided in the Path parameter. - - .PARAMETER Path - String containing the path to the SQL Server setup.exe executable. -#> -function Get-SqlMajorVersion -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory=$true)] - [String] - $Path - ) - - (Get-Item -Path $Path).VersionInfo.ProductVersion.Split('.')[0] -} - -<# - .SYNOPSIS - Returns the first item value in the registry location provided in the Path parameter. - - .PARAMETER Path - String containing the path to the registry. -#> -function Get-FirstItemPropertyValue -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory=$true)] - [String] - $Path - ) - - $registryProperty = Get-Item -Path $Path -ErrorAction SilentlyContinue - if ($registryProperty) - { - $registryProperty = $registryProperty | Select-Object -ExpandProperty Property | Select-Object -First 1 - if ($registryProperty) - { - $registryPropertyValue = (Get-ItemProperty -Path $Path -Name $registryProperty).$registryProperty.TrimEnd('\') - } - } - - return $registryPropertyValue -} - -<# - .SYNOPSIS - Copy folder structure using RoboCopy. Every file and folder, including empty ones are copied. - - .PARAMETER Path - Source path to be copied. - - .PARAMETER DestinationPath - The path to the destination. -#> -function Copy-ItemWithRoboCopy -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $DestinationPath - ) - - $robocopyExecutable = Get-Command -Name "Robocopy.exe" -ErrorAction Stop - - $robocopyArgumentSilent = '/njh /njs /ndl /nc /ns /nfl' - $robocopyArgumentCopySubDirectoriesIncludingEmpty = '/e' - $robocopyArgumentDeletesDestinationFilesAndDirectoriesNotExistAtSource = '/purge' - - if ([System.Version]$robocopyExecutable.FileVersionInfo.ProductVersion -ge [System.Version]'6.3.9600.16384') - { - Write-Verbose "Robocopy is using unbuffered I/O." - $robocopyArgumentUseUnbufferedIO = '/J' - } - else - { - Write-Verbose 'Unbuffered I/O cannot be used due to incompatible version of Robocopy.' - } - - $robocopyArgumentList = '{0} {1} {2} {3} {4} {5}' -f $Path, - $DestinationPath, - $robocopyArgumentCopySubDirectoriesIncludingEmpty, - $robocopyArgumentDeletesDestinationFilesAndDirectoriesNotExistAtSource, - $robocopyArgumentUseUnbufferedIO, - $robocopyArgumentSilent - - $robocopyStartProcessParameters = @{ - FilePath = $robocopyExecutable.Name - ArgumentList = $robocopyArgumentList - } - - Write-Verbose ('Robocopy is started with the following arguments: {0}' -f $robocopyArgumentList ) - $robocopyProcess = Start-Process @robocopyStartProcessParameters -Wait -NoNewWindow -PassThru - - switch ($($robocopyProcess.ExitCode)) - { - {$_ -in 8, 16} - { - throw "Robocopy reported errors when copying files. Error code: $_." - } - - {$_ -gt 7 } - { - throw "Robocopy reported that failures occured when copying files. Error code: $_." - } - - 1 - { - Write-Verbose 'Robocopy copied files sucessfully' - } - - 2 - { - Write-Verbose 'Robocopy found files at the destination path that is not present at the source path, these extra files was remove at the destination path.' - } - - 3 - { - Write-Verbose 'Robocopy copied files to destination sucessfully. Robocopy also found files at the destination path that is not present at the source path, these extra files was remove at the destination path.' - } - - {$_ -eq 0 -or $null -eq $_ } - { - Write-Verbose 'Robocopy reported that all files already present.' - } - } -} - -<# - .SYNOPSIS - Returns the path of the current user's temporary folder. -#> -function Get-TemporaryFolder -{ - [CmdletBinding()] - [OutputType([System.String])] - param() - - return [IO.Path]::GetTempPath() -} - -<# - .SYNOPSIS - Returns the decimal representation of an IP Addresses - - .PARAMETER IPAddress - The IP Address to be converted -#> -function ConvertTo-Decimal -{ - [CmdletBinding()] - [OutputType([System.UInt32])] - param( - [Parameter(Mandatory = $true)] - [System.Net.IPAddress] - $IPAddress - ) - - $i = 3 - $DecimalIP = 0 - $IPAddress.GetAddressBytes() | ForEach-Object { - $DecimalIP += $_ * [Math]::Pow(256,$i) - $i-- - } - - return [UInt32]$DecimalIP -} - -<# - .SYNOPSIS - Determines whether an IP Address is valid for a given network / subnet - - .PARAMETER IPAddress - IP Address to be checked - - .PARAMETER NetworkID - IP Address of the network identifier - - .PARAMETER SubnetMask - Subnet mask of the network to be checked -#> -function Test-IPAddress -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.Net.IPAddress] - $IPAddress, - - [Parameter(Mandatory = $true)] - [System.Net.IPAddress] - $NetworkID, - - [Parameter(Mandatory = $true)] - [System.Net.IPAddress] - $SubnetMask - ) - - # Convert all values to decimal - $IPAddressDecimal = ConvertTo-Decimal -IPAddress $IPAddress - $NetworkDecimal = ConvertTo-Decimal -IPAddress $NetworkID - $SubnetDecimal = ConvertTo-Decimal -IPAddress $SubnetMask - - # Determine whether the IP Address is valid for this network / subnet - return (($IPAddressDecimal -band $SubnetDecimal) -eq ($NetworkDecimal -band $SubnetDecimal)) -} - -<# - .SYNOPSIS - Builds service account parameters for setup - - .PARAMETER ServiceAccount - Credential for the service account - - .PARAMETER ServiceType - Type of service account -#> -function Get-ServiceAccountParameters -{ - [CmdletBinding()] - [OutputType([Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [PSCredential] - $ServiceAccount, - - [Parameter(Mandatory = $true)] - [ValidateSet('SQL','AGT','IS','RS','AS','FT')] - [String] - $ServiceType - ) - - $parameters = @{} - - switch -Regex ($ServiceAccount.UserName.ToUpper()) - { - '^(?:NT ?AUTHORITY\\)?(SYSTEM|LOCALSERVICE|LOCAL SERVICE|NETWORKSERVICE|NETWORK SERVICE)$' - { - $parameters = @{ - "$($ServiceType)SVCACCOUNT" = "NT AUTHORITY\$($Matches[1])" - } - } - - '^(?:NT SERVICE\\)(.*)$' - { - $parameters = @{ - "$($ServiceType)SVCACCOUNT" = "NT SERVICE\$($Matches[1])" - } - } - - '.*\$' - { - $parameters = @{ - "$($ServiceType)SVCACCOUNT" = $ServiceAccount.UserName - } - } - - default - { - $parameters = @{ - "$($ServiceType)SVCACCOUNT" = $ServiceAccount.UserName - "$($ServiceType)SVCPASSWORD" = $ServiceAccount.GetNetworkCredential().Password - } - } - } - - return $parameters -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerSetup/MSFT_xSQLServerSetup.schema.mof b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerSetup/MSFT_xSQLServerSetup.schema.mof deleted file mode 100644 index f30fd559..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xSQLServerSetup/MSFT_xSQLServerSetup.schema.mof +++ /dev/null @@ -1,54 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSQLServerSetup")] -class MSFT_xSQLServerSetup : OMI_BaseResource -{ - [Write, Description("The action to be performed. Default value is 'Install'."), ValueMap{"Install","InstallFailoverCluster","AddNode","PrepareFailoverCluster","CompleteFailoverCluster"}, Values{"Install","InstallFailoverCluster","AddNode","PrepareFailoverCluster","CompleteFailoverCluster"}] String Action; - [Write, Description("The path to the root of the source files for installation. I.e and UNC path to a shared resource. Environment variables can be used in the path.")] String SourcePath; - [Required, EmbeddedInstance("MSFT_Credential"), Description("Credential to be used to perform the installation.")] String SetupCredential; - [Write, EmbeddedInstance("MSFT_Credential"), Description("Credentials used to access the path set in the parameter 'SourcePath'.")] String SourceCredential; - [Write, Description("Suppresses reboot.")] Boolean SuppressReboot; - [Write, Description("Forces reboot.")] Boolean ForceReboot; - [Write, Description("SQL features to be installed.")] String Features; - [Key, Description("Name of the SQL instance to be installed.")] String InstanceName; - [Write, Description("SQL instance ID, if different from InstanceName.")] String InstanceID; - [Write, Description("Product key for licensed installations.")] String ProductKey; - [Write, Description("Enabled updates during installation.")] String UpdateEnabled; - [Write, Description("Path to the source of updates to be applied during installation.")] String UpdateSource; - [Write, Description("Enable customer experience reporting.")] String SQMReporting; - [Write, Description("Enable error reporting.")] String ErrorReporting; - [Write, Description("Installation path for shared SQL files.")] String InstallSharedDir; - [Write, Description("Installation path for x86 shared SQL files.")] String InstallSharedWOWDir; - [Write, Description("Installation path for SQL instance files.")] String InstanceDir; - [Write, EmbeddedInstance("MSFT_Credential"), Description("Service account for the SQL service.")] String SQLSvcAccount; - [Read, Description("Output username for the SQL service.")] String SQLSvcAccountUsername; - [Write, EmbeddedInstance("MSFT_Credential"), Description("Service account for the SQL Agent service.")] String AgtSvcAccount; - [Read, Description("Output username for the SQL Agent service.")] String AgtSvcAccountUsername; - [Write, Description("Collation for SQL.")] String SQLCollation; - [Write, Description("Array of accounts to be made SQL administrators.")] String SQLSysAdminAccounts[]; - [Write, Description("Security mode to apply to the SQL Server instance.")] String SecurityMode; - [Write, EmbeddedInstance("MSFT_Credential"), Description("SA password, if SecurityMode is set to 'SQL'.")] String SAPwd; - [Write, Description("Root path for SQL database files.")] String InstallSQLDataDir; - [Write, Description("Path for SQL database files.")] String SQLUserDBDir; - [Write, Description("Path for SQL log files.")] String SQLUserDBLogDir; - [Write, Description("Path for SQL TempDB files.")] String SQLTempDBDir; - [Write, Description("Path for SQL TempDB log files.")] String SQLTempDBLogDir; - [Write, Description("Path for SQL backup files.")] String SQLBackupDir; - [Write, EmbeddedInstance("MSFT_Credential"), Description("Service account for the Full Text service.")] String FTSvcAccount; - [Read, Description("Output username for the Full Text service.")] String FTSvcAccountUsername; - [Write, EmbeddedInstance("MSFT_Credential"), Description("Service account for Reporting Services service.")] String RSSvcAccount; - [Read, Description("Output username for the Reporting Services service.")] String RSSvcAccountUsername; - [Write, EmbeddedInstance("MSFT_Credential"), Description("Service account for Analysis Services service.")] String ASSvcAccount; - [Read, Description("Output username for the Analysis Services service.")] String ASSvcAccountUsername; - [Write, Description("Collation for Analysis Services.")] String ASCollation; - [Write, Description("Array of accounts to be made Analysis Services admins.")] String ASSysAdminAccounts[]; - [Write, Description("Path for Analysis Services data files.")] String ASDataDir; - [Write, Description("Path for Analysis Services log files.")] String ASLogDir; - [Write, Description("Path for Analysis Services backup files.")] String ASBackupDir; - [Write, Description("Path for Analysis Services temp files.")] String ASTempDir; - [Write, Description("Path for Analysis Services config.")] String ASConfigDir; - [Write, EmbeddedInstance("MSFT_Credential"), Description("Service account for Integration Services service.")] String ISSvcAccount; - [Read, Description("Output username for the Integration Services service.")] String ISSvcAccountUsername; - [Write, Description("Specifies the startup mode for SQL Server Browser service."), ValueMap{"Automatic", "Disabled", "Manual"}, Values{"Automatic", "Disabled", "Manual"}] String BrowserSvcStartupType; - [Write, Description("The name of the resource group to create for the clustered SQL Server instance. Default is 'SQL Server (InstanceName)'.")] String FailoverClusterGroupName; - [Write, Description("Array of IP Addresses to be assigned to the clustered SQL Server instance.")] String FailoverClusterIPAddress[]; - [Write, Description("Host name to be assigend to the clustered SQL Server instance.")] String FailoverClusterNetworkName; -}; diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xWaitForAvailabilityGroup/MSFT_xWaitForAvailabilityGroup.psm1 b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xWaitForAvailabilityGroup/MSFT_xWaitForAvailabilityGroup.psm1 deleted file mode 100644 index 323889ed..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xWaitForAvailabilityGroup/MSFT_xWaitForAvailabilityGroup.psm1 +++ /dev/null @@ -1,126 +0,0 @@ -$currentPath = Split-Path -Parent $MyInvocation.MyCommand.Path -Write-Verbose -Message "CurrentPath: $currentPath" - -# Load Common Code -Import-Module $currentPath\..\..\xSQLServerHelper.psm1 -Verbose:$false -ErrorAction Stop - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [UInt64] $RetryIntervalSec = 10, - [UInt32] $RetryCount = 50 - ) - - @{ - Name = $Name - RetryIntervalSec = $RetryIntervalSec - RetryCount = $RetryCount - } -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [System.UInt64] - $RetryIntervalSec =20, - - [System.UInt32] - $RetryCount = 6 - ) - - $AGFound = $false - New-VerboseMessage -Message "Checking for Availaibilty Group $Name ..." - - for ($count = 0; $count -lt $RetryCount; $count++) - { - try - { - $clusterGroup = Get-ClusterGroup -Name $Name -ErrorAction Ignore - - if ($clusterGroup -ne $null) - { - New-VerboseMessage -Message "Found Availability Group $Name" - $AGFound = $true - Start-Sleep -Seconds $RetryIntervalSec - break; - } - - } - catch - { - New-VerboseMessage -Message "Availability Group $Name not found. Will retry again after $RetryIntervalSec sec" - } - - New-VerboseMessage -Message "Availability Group $Name not found. Will retry again after $RetryIntervalSec sec" - Start-Sleep -Seconds $RetryIntervalSec - } - - if (! $AGFound) - { - throw "Availability Group $Name not found after $count attempts with $RetryIntervalSec sec interval" - Exit - } - - -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [System.UInt64] - $RetryIntervalSec = 10, - - [System.UInt32] - $RetryCount = 50 - ) - - New-VerboseMessage -Message "Checking for Availability Group $Name ..." - - try - { - - $clusterGroup = Get-ClusterGroup -Name $Name -ErrorAction Ignore - - if ($clusterGroup -eq $null) - { - New-VerboseMessage -Message "Availability Group $Name not found" - $false - } - else - { - New-VerboseMessage -Message "Found Availabilty Group $Name" - $true - } - } - catch - { - New-VerboseMessage -Message "Availability Group $Name not found" - $false - } -} - - -Export-ModuleMember -Function *-TargetResource - diff --git a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xWaitForAvailabilityGroup/MSFT_xWaitForAvailabilityGroup.schema.mof b/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xWaitForAvailabilityGroup/MSFT_xWaitForAvailabilityGroup.schema.mof deleted file mode 100644 index 08be8088..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/DSCResources/MSFT_xWaitForAvailabilityGroup/MSFT_xWaitForAvailabilityGroup.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xWaitForAvailabilityGroup")] -class MSFT_xWaitForAvailabilityGroup : OMI_BaseResource -{ - [Key, Description("Availability Group Name")] String Name; - [Write, Description("Interval to check for Availability Group")] Uint64 RetryIntervalSec; - [Write, Description("Maximum number of retries to check Availabilty group creation")] Uint32 RetryCount; -}; - diff --git a/lib/puppet_x/dsc_resources/xSQLServer/LICENSE b/lib/puppet_x/dsc_resources/xSQLServer/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xSQLServer/en-US/xPDT.strings.psd1 b/lib/puppet_x/dsc_resources/xSQLServer/en-US/xPDT.strings.psd1 deleted file mode 100644 index 0411cbba..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/en-US/xPDT.strings.psd1 +++ /dev/null @@ -1,11 +0,0 @@ -ConvertFrom-StringData @' -###PSLOC -FileNotFound=File not found in the environment path -AbsolutePathOrFileName=Absolute path or file name expected -InvalidArgument=Invalid argument: '{0}' with value: '{1}' -InvalidArgumentAndMessage={0} {1} -ErrorStarting=Failure starting process matching path '{0}'. Message: {1} -FailureWaitingForProcessesToStart=Failed to wait for processes to start -ProcessStarted=Process matching path '{0}' started in process ID {1} -ProcessAlreadyStarted=Process matching path '{0}' already started in process ID {1} -'@ diff --git a/lib/puppet_x/dsc_resources/xSQLServer/en-US/xSQLServer.strings.psd1 b/lib/puppet_x/dsc_resources/xSQLServer/en-US/xSQLServer.strings.psd1 deleted file mode 100644 index 5313b446..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/en-US/xSQLServer.strings.psd1 +++ /dev/null @@ -1,114 +0,0 @@ -ConvertFrom-StringData @' -###PSLOC -# Common -NoKeyFound = No Localization key found for ErrorType: '{0}'. -AbsentNotImplemented = Ensure = Absent is not implemented! -TestFailedAfterSet = Test-TargetResource returned false after calling set. -RemoteConnectionFailed = Remote PowerShell connection to Server '{0}' failed. -TODO = ToDo. Work not implemented at this time. -UnexpectedErrorFromGet = Got unexpected result from Get-TargetResource. No change is made. -FailedToImportSqlModule = Failed to import {0} module. -SqlModuleNotFound = Neither SqlServer module or SQLPS module was found. -NotConnectedToInstance = Was unable to connect to the instance '{0}\\{1}' -AlterAvailabilityGroupFailed = Failed to alter the availability group '{0}'. -HadrNotEnabled = HADR is not enabled. -AvailabilityGroupNotFound = Unable to locate the availability group '{0}' on the instance '{1}'. - -# SQLServer -NoDatabase = Database '{0}' does not exist on SQL server '{1}\\{2}'. -SSRSNotFound = SQL Reporting Services instance '{0}' does not exist! -RoleNotFound = Role '{0}' does not exist on database '{1}' on SQL server '{2}\\{3}'." -LoginNotFound = Login '{0}' does not exist on SQL server '{1}\\{2}'." -FailedLogin = Creating a login of type 'SqlLogin' requires LoginCredential -FeatureNotSupported = '{0}' is not a valid value for setting 'FEATURES'. Refer to SQL Help for more information. - -# Database Role -AddLoginDatabaseSetError = Failed adding the login {2} as a user of the database {3}, on the instance {0}\\{1}. -DropMemberDatabaseSetError = Failed removing the login {2} from the role {3} on the database {4}, on the instance {0}\\{1}. -AddMemberDatabaseSetError = Failed adding the login {2} to the role {3} on the database {4}, on the instance {0}\\{1}. - -# AvailabilityGroupListener -AvailabilityGroupListenerNotFound = Trying to make a change to a listener that does not exist. -AvailabilityGroupListenerErrorVerifyExist = Unexpected result when trying to verify existence of listener '{0}'. -AvailabilityGroupListenerIPChangeError = IP-address configuration mismatch. Expecting '{0}' found '{1}'. Resource does not support changing IP-address. Listener needs to be removed and then created again. -AvailabilityGroupListenerDHCPChangeError = IP-address configuration mismatch. Expecting '{0}' found '{1}'. Resource does not support changing between static IP and DHCP. Listener needs to be removed and then created again. - -# Endpoint -EndpointNotFound = Endpoint '{0}' does not exist -EndpointErrorVerifyExist = Unexpected result when trying to verify existence of endpoint '{0}'. -EndpointFoundButWrongType = Endpoint '{0}' does exist, but it is not of type 'DatabaseMirroring'. - -# Permission -PermissionGetError = Unexpected result when trying to get permissions for '{0}'. -PrincipalNotFound = Principal '{0}' does not exist. -PermissionMissingEnsure = Ensure is not set. No change can be made. - -# Configuration -ConfigurationOptionNotFound = Specified option '{0}' could not be found. -ConfigurationRestartRequired = Configuration option '{0}' has been updated, but a manual restart of SQL Server is required for it to take effect. - -# AlwaysOnService -AlterAlwaysOnServiceFailed = Failed to ensure Always On is {0} on the instance '{1}'. - -# Login -PasswordValidationFailed = Creation of the login '{0}' failed due to the following error: {1} -LoginCreationFailedFailedOperation = Creation of the login '{0}' failed due to a failed operation. -LoginCreationFailedSqlNotSpecified = Creation of the SQL login '{0}' failed due to an unspecified error. -LoginCreationFailedWindowsNotSpecified = Creation of the Windows login '{0}' failed due to an unspecified error. -LoginTypeNotImplemented = The login type '{0}' is not implemented in this resource. -IncorrectLoginMode = The instance '{0}\{1}' is currently in '{2}' authentication mode. To create a SQL Login, it must be set to 'Mixed' authentication mode. -LoginCredentialNotFound = The credential for the SQL Login '{0}' was not found. -PasswordChangeFailed = Setting the password failed for the SQL Login '{0}'. -AlterLoginFailed = Altering the login '{0}' failed. -CreateLoginFailed = Creating the login '{0}' failed. -DropLoginFailed = Dropping the login '{0}' failed. - -# Clustered Setup -FailoverClusterDiskMappingError = Unable to map the specified paths to valid cluster storage. Drives mapped: {0} -FailoverClusterIPAddressNotValid = Unable to map the specified IP Address(es) to valid cluster networks. -FailoverClusterResourceNotFound = Could not locate a SQL Server cluster resource for instance {0}. - -# AlwaysOnAvailabilityGroup -AlterAvailabilityGroupReplicaFailed = Failed to alter the avilability group replica '{0}'. -ClusterPermissionsMissing = The cluster does not have permissions to manage the Availability Group on '{0}\\{1}'. Grant 'Connect SQL', 'Alter Any Availability Group', and 'View Server State' to either 'NT SERVICE\\ClusSvc' or 'NT AUTHORITY\\SYSTEM'. -CreateAvailabilityGroupReplicaFailed = Creating the Availability Group Replica failed. -CreateAvailabilityGroupFailed = Creating the availability group '{0}' failed with the error '{1}'. -DatabaseMirroringEndpointNotFound = No database mirroring endpoint was found on '{0}\{1}'. -InstanceNotPrimaryReplica = The instance '{0}' is not the primary replica for the availability group '{1}'. -RemoveAvailabilityGroupFailed = Failed to remove the availabilty group '{0}' from the '{1}' instance. - -# AlwaysOnAvailabilityGroupReplica -JoinAvailabilityGroupFailed = Failed to join the availability group replica '{0}'. -RemoveAvailabilityGroupReplicaFailed = Failed to remove the availability group replica '{0}' with the error '{1}'. -ReplicaNotFound = Unable to find the availability group replica '{0}' on the instance '{1}'. - -# SQLServerHelper -ExecuteQueryWithResultsFailed = Executing query with results failed on database '{0}'. -ExecuteNonQueryFailed = Executing non-query failed on database '{0}'. -AnalysisServicesFailedToConnect = Failed to connect to Analysis Services '{0}'. -AnalysisServicesNoServerObject = Did not get the expected Analysis Services server object. - -# Max degree of parallelism -MaxDopSetError = Unexpected result when trying to configure the max degree of parallelism server configuration option. -MaxDopParamMustBeNull = MaxDop parameter must be set to $null or not assigned if DynamicAlloc parameter is set to $true. - -# Server Memory -MaxMemoryParamMustBeNull = The parameter MaxMemory must be null when DynamicAlloc is set to true. -MaxMemoryParamMustNotBeNull = The parameter MaxMemory must not be null when DynamicAlloc is set to false. -AlterServerMemoryFailed = Failed to alter the server configuration memory for {0}\\{1}. -ErrorGetDynamicMaxMemory = Failed to calculate dynamically the maximum memory. - -# SQLServerDatabase -CreateDatabaseSetError = Failed to create the database named {2} on {0}\\{1}. -DropDatabaseSetError = Failed to drop the database named {2} on {0}\\{1}. -FailedToGetOwnerDatabase = Failed to get owner of the database named {0} on {1}\\{2}. -FailedToSetOwnerDatabase = Failed to set owner named {0} of the database named {1} on {2}\\{3}. - -# SQLServerRole -EnumMemberNamesServerRoleGetError = Failed to enumerate members of the server role named {2} on {0}\\{1}. -MembersToIncludeAndExcludeParamMustBeNull = The parameter MembersToInclude and/or MembersToExclude must not be set, or be set to $null, when parameter Members are used. -CreateServerRoleSetError = Failed to create the server role named {2} on {0}\\{1}. -DropServerRoleSetError = Failed to drop the server role named {2} on {0}\\{1}. -AddMemberServerRoleSetError = Failed to add member {3} to the server role named {2} on {0}\\{1}. -DropMemberServerRoleSetError = Failed to drop member {3} to the server role named {2} on {0}\\{1}. -'@ diff --git a/lib/puppet_x/dsc_resources/xSQLServer/xPDT.psm1 b/lib/puppet_x/dsc_resources/xSQLServer/xPDT.psm1 deleted file mode 100644 index 6334ef1a..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/xPDT.psm1 +++ /dev/null @@ -1,708 +0,0 @@ -Import-LocalizedData LocalizedData -filename xPDT.strings.psd1 - -function ThrowInvalidArgumentError -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $errorId, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $errorMessage - ) - - $errorCategory=[System.Management.Automation.ErrorCategory]::InvalidArgument - $exception = New-Object System.ArgumentException $errorMessage; - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - throw $errorRecord -} - -function ResolvePath -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Path - ) - - $Path = [Environment]::ExpandEnvironmentVariables($Path) - if(IsRootedPath $Path) - { - if(!(Test-Path $Path -PathType Leaf)) - { - ThrowInvalidArgumentError "CannotFindRootedPath" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.FileNotFound) - } - return $Path - } - else - { - $Path = (Get-Item -Path $Path -ErrorAction SilentlyContinue).FullName - if(!(Test-Path $Path -PathType Leaf)) - { - ThrowInvalidArgumentError "CannotFindRootedPath" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.FileNotFound) - } - return $Path - } - if([string]::IsNullOrEmpty($env:Path)) - { - ThrowInvalidArgumentError "EmptyEnvironmentPath" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.FileNotFound) - } - if((Split-Path $Path -Leaf) -ne $Path) - { - ThrowInvalidArgumentError "NotAbsolutePathOrFileName" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.AbsolutePathOrFileName) - } - foreach($rawSegment in $env:Path.Split(";")) - { - $segment = [Environment]::ExpandEnvironmentVariables($rawSegment) - $segmentRooted = $false - try - { - $segmentRooted=[IO.Path]::IsPathRooted($segment) - } - catch {} - if(!$segmentRooted) - { - continue - } - $candidate = join-path $segment $Path - if(Test-Path $candidate -PathType Leaf) - { - return $candidate - } - } - ThrowInvalidArgumentError "CannotFindRelativePath" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.FileNotFound) -} - -function IsRootedPath -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path - ) - - try - { - return [IO.Path]::IsPathRooted($Path) - } - catch - { - ThrowInvalidArgumentError "CannotGetIsPathRooted" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $_.Exception.Message) - } -} - -function ExtractArguments -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - $functionBoundParameters, - - [parameter(Mandatory = $true)] - [string[]] - $argumentNames, - - [string[]] - $newArgumentNames - ) - - $returnValue=@{} - - for($i=0;$i -lt $argumentNames.Count;$i++) - { - $argumentName = $argumentNames[$i] - - if($newArgumentNames -eq $null) - { - $newArgumentName = $argumentName - } - else - { - $newArgumentName = $newArgumentNames[$i] - } - - if($functionBoundParameters.ContainsKey($argumentName)) - { - $null = $returnValue.Add($newArgumentName,$functionBoundParameters[$argumentName]) - } - } - - return $returnValue -} - -function CallPInvoke -{ - $script:ProgramSource = @" -using System; -using System.Collections.Generic; -using System.Text; -using System.Security; -using System.Runtime.InteropServices; -using System.Diagnostics; -using System.Security.Principal; -using System.ComponentModel; -using System.IO; - -namespace Source -{ - [SuppressUnmanagedCodeSecurity] - public static class NativeMethods - { - //The following structs and enums are used by the various Win32 API's that are used in the code below - - [StructLayout(LayoutKind.Sequential)] - public struct STARTUPINFO - { - public Int32 cb; - public string lpReserved; - public string lpDesktop; - public string lpTitle; - public Int32 dwX; - public Int32 dwY; - public Int32 dwXSize; - public Int32 dwXCountChars; - public Int32 dwYCountChars; - public Int32 dwFillAttribute; - public Int32 dwFlags; - public Int16 wShowWindow; - public Int16 cbReserved2; - public IntPtr lpReserved2; - public IntPtr hStdInput; - public IntPtr hStdOutput; - public IntPtr hStdError; - } - - [StructLayout(LayoutKind.Sequential)] - public struct PROCESS_INFORMATION - { - public IntPtr hProcess; - public IntPtr hThread; - public Int32 dwProcessID; - public Int32 dwThreadID; - } - - [Flags] - public enum LogonType - { - LOGON32_LOGON_INTERACTIVE = 2, - LOGON32_LOGON_NETWORK = 3, - LOGON32_LOGON_BATCH = 4, - LOGON32_LOGON_SERVICE = 5, - LOGON32_LOGON_UNLOCK = 7, - LOGON32_LOGON_NETWORK_CLEARTEXT = 8, - LOGON32_LOGON_NEW_CREDENTIALS = 9 - } - - [Flags] - public enum LogonProvider - { - LOGON32_PROVIDER_DEFAULT = 0, - LOGON32_PROVIDER_WINNT35, - LOGON32_PROVIDER_WINNT40, - LOGON32_PROVIDER_WINNT50 - } - - [StructLayout(LayoutKind.Sequential)] - public struct SECURITY_ATTRIBUTES - { - public Int32 Length; - public IntPtr lpSecurityDescriptor; - public bool bInheritHandle; - } - - public enum SECURITY_IMPERSONATION_LEVEL - { - SecurityAnonymous, - SecurityIdentification, - SecurityImpersonation, - SecurityDelegation - } - - public enum TOKEN_TYPE - { - TokenPrimary = 1, - TokenImpersonation - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - internal struct TokPriv1Luid - { - public int Count; - public long Luid; - public int Attr; - } - - public const int GENERIC_ALL_ACCESS = 0x10000000; - public const int CREATE_NO_WINDOW = 0x08000000; - internal const int SE_PRIVILEGE_ENABLED = 0x00000002; - internal const int TOKEN_QUERY = 0x00000008; - internal const int TOKEN_ADJUST_PRIVILEGES = 0x00000020; - internal const string SE_INCRASE_QUOTA = "SeIncreaseQuotaPrivilege"; - - [DllImport("kernel32.dll", - EntryPoint = "CloseHandle", SetLastError = true, - CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] - public static extern bool CloseHandle(IntPtr handle); - - [DllImport("advapi32.dll", - EntryPoint = "CreateProcessAsUser", SetLastError = true, - CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] - public static extern bool CreateProcessAsUser( - IntPtr hToken, - string lpApplicationName, - string lpCommandLine, - ref SECURITY_ATTRIBUTES lpProcessAttributes, - ref SECURITY_ATTRIBUTES lpThreadAttributes, - bool bInheritHandle, - Int32 dwCreationFlags, - IntPtr lpEnvrionment, - string lpCurrentDirectory, - ref STARTUPINFO lpStartupInfo, - ref PROCESS_INFORMATION lpProcessInformation - ); - - [DllImport("advapi32.dll", EntryPoint = "DuplicateTokenEx")] - public static extern bool DuplicateTokenEx( - IntPtr hExistingToken, - Int32 dwDesiredAccess, - ref SECURITY_ATTRIBUTES lpThreadAttributes, - Int32 ImpersonationLevel, - Int32 dwTokenType, - ref IntPtr phNewToken - ); - - [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] - public static extern Boolean LogonUser( - String lpszUserName, - String lpszDomain, - String lpszPassword, - LogonType dwLogonType, - LogonProvider dwLogonProvider, - out IntPtr phToken - ); - - [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)] - internal static extern bool AdjustTokenPrivileges( - IntPtr htok, - bool disall, - ref TokPriv1Luid newst, - int len, - IntPtr prev, - IntPtr relen - ); - - [DllImport("kernel32.dll", ExactSpelling = true)] - internal static extern IntPtr GetCurrentProcess(); - - [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)] - internal static extern bool OpenProcessToken( - IntPtr h, - int acc, - ref IntPtr phtok - ); - - [DllImport("advapi32.dll", SetLastError = true)] - internal static extern bool LookupPrivilegeValue( - string host, - string name, - ref long pluid - ); - - public static void CreateProcessAsUser(string strCommand, string strDomain, string strName, string strPassword) - { - var hToken = IntPtr.Zero; - var hDupedToken = IntPtr.Zero; - TokPriv1Luid tp; - var pi = new PROCESS_INFORMATION(); - var sa = new SECURITY_ATTRIBUTES(); - sa.Length = Marshal.SizeOf(sa); - Boolean bResult = false; - try - { - bResult = LogonUser( - strName, - strDomain, - strPassword, - LogonType.LOGON32_LOGON_BATCH, - LogonProvider.LOGON32_PROVIDER_DEFAULT, - out hToken - ); - if (!bResult) - { - throw new Win32Exception("The user could not be logged on. Ensure that the user has an existing profile on the machine and that correct credentials are provided. Logon error #" + Marshal.GetLastWin32Error().ToString()); - } - IntPtr hproc = GetCurrentProcess(); - IntPtr htok = IntPtr.Zero; - bResult = OpenProcessToken( - hproc, - TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, - ref htok - ); - if(!bResult) - { - throw new Win32Exception("Open process token error #" + Marshal.GetLastWin32Error().ToString()); - } - tp.Count = 1; - tp.Luid = 0; - tp.Attr = SE_PRIVILEGE_ENABLED; - bResult = LookupPrivilegeValue( - null, - SE_INCRASE_QUOTA, - ref tp.Luid - ); - if(!bResult) - { - throw new Win32Exception("Error in looking up privilege of the process. This should not happen if DSC is running as LocalSystem Lookup privilege error #" + Marshal.GetLastWin32Error().ToString()); - } - bResult = AdjustTokenPrivileges( - htok, - false, - ref tp, - 0, - IntPtr.Zero, - IntPtr.Zero - ); - if(!bResult) - { - throw new Win32Exception("Token elevation error #" + Marshal.GetLastWin32Error().ToString()); - } - - bResult = DuplicateTokenEx( - hToken, - GENERIC_ALL_ACCESS, - ref sa, - (int)SECURITY_IMPERSONATION_LEVEL.SecurityIdentification, - (int)TOKEN_TYPE.TokenPrimary, - ref hDupedToken - ); - if(!bResult) - { - throw new Win32Exception("Duplicate Token error #" + Marshal.GetLastWin32Error().ToString()); - } - var si = new STARTUPINFO(); - si.cb = Marshal.SizeOf(si); - si.lpDesktop = ""; - bResult = CreateProcessAsUser( - hDupedToken, - null, - strCommand, - ref sa, - ref sa, - false, - 0, - IntPtr.Zero, - null, - ref si, - ref pi - ); - if(!bResult) - { - throw new Win32Exception("The process could not be created. Create process as user error #" + Marshal.GetLastWin32Error().ToString()); - } - } - finally - { - if (pi.hThread != IntPtr.Zero) - { - CloseHandle(pi.hThread); - } - if (pi.hProcess != IntPtr.Zero) - { - CloseHandle(pi.hProcess); - } - if (hDupedToken != IntPtr.Zero) - { - CloseHandle(hDupedToken); - } - } - } - } -} - -"@ - Add-Type -TypeDefinition $ProgramSource -ReferencedAssemblies "System.ServiceProcess" -} - -function GetWin32Process -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [PSCredential] - $Credential - ) - - $fileName = [io.path]::GetFileNameWithoutExtension($Path) - $GetProcesses = @(Get-Process -Name $fileName -ErrorAction SilentlyContinue) - $Processes = foreach($process in $GetProcesses) - { - if($Process.Path -ieq $Path) - { - try - { - [wmi]"Win32_Process.Handle='$($Process.Id)'" - } - catch - { - } - } - } - if($PSBoundParameters.ContainsKey('Credential')) - { - $Processes = $Processes | Where-Object {(GetWin32ProcessOwner $_) -eq $Credential.UserName} - } - if($Arguments -eq $null) {$Arguments = ""} - $Processes = $Processes | Where-Object {(GetWin32ProcessArgumentsFromCommandLine $_.CommandLine) -eq $Arguments} - - return $Processes -} - -function GetWin32ProcessOwner -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNull()] - $Process - ) - - try - { - $Owner = $Process.GetOwner() - } - catch - {} - if(($owner.Domain -ne $null) -and ($owner.Domain -ne $env:COMPUTERNAME)) - { - return $Owner.Domain + "\" + $Owner.User - } - else - { - return $Owner.User - } -} - -function GetWin32ProcessArgumentsFromCommandLine -{ - param - ( - [String] - $commandLine - ) - - if($commandLine -eq $null) - { - return "" - } - $commandLine=$commandLine.Trim() - if($commandLine.Length -eq 0) - { - return "" - } - if($commandLine[0] -eq '"') - { - $charToLookfor=[char]'"' - } - else - { - $charToLookfor=[char]' ' - } - $endOfCommand=$commandLine.IndexOf($charToLookfor ,1) - if($endOfCommand -eq -1) - { - return "" - } - return $commandLine.Substring($endOfCommand+1).Trim() -} - -function StartWin32Process -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [PSCredential] - $Credential, - - [Switch] - $AsTask - ) - - $GetArguments = ExtractArguments $PSBoundParameters ("Path","Arguments","Credential") - $Processes = @(GetWin32Process @getArguments) - if ($processes.Count -eq 0) - { - if($PSBoundParameters.ContainsKey("Credential")) - { - if($AsTask) - { - $ActionArguments = ExtractArguments $PSBoundParameters ` - ("Path", "Arguments") ` - ("Execute", "Argument") - if([string]::IsNullOrEmpty($Arguments)) - { - $null = $ActionArguments.Remove("Argument") - } - $TaskGuid = [guid]::NewGuid().ToString() - $Action = New-ScheduledTaskAction @ActionArguments - $null = Register-ScheduledTask -TaskName "xPDT $TaskGuid" -Action $Action -User $Credential.UserName -Password $Credential.GetNetworkCredential().Password -RunLevel Highest - $err = Start-ScheduledTask -TaskName "xPDT $TaskGuid" - } - else - { - try - { - CallPInvoke - [Source.NativeMethods]::CreateProcessAsUser(("$Path " + $Arguments),$Credential.GetNetworkCredential().Domain,$Credential.GetNetworkCredential().UserName,$Credential.GetNetworkCredential().Password) - } - catch - { - $exception = New-Object System.ArgumentException $_ - $errorCategory = [System.Management.Automation.ErrorCategory]::OperationStopped - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, "Win32Exception", $errorCategory, $null - $err = $errorRecord - } - } - } - else - { - $StartArguments = ExtractArguments $PSBoundParameters ` - ("Path", "Arguments", "Credential") ` - ("FilePath", "ArgumentList", "Credential") - if([string]::IsNullOrEmpty($Arguments)) - { - $null = $StartArguments.Remove("ArgumentList") - } - $err = Start-Process @StartArguments - } - if($err -ne $null) - { - throw $err - } - if (!(WaitForWin32ProcessStart @GetArguments)) - { -# ThrowInvalidArgumentError "FailureWaitingForProcessesToStart" ($LocalizedData.ErrorStarting -f $Path,$LocalizedData.FailureWaitingForProcessesToStart) - } - } - else - { - return ($LocalizedData.ProcessAlreadyStarted -f $Path,$Processes.ProcessId) - } - $Processes = @(GetWin32Process @getArguments) - return ($LocalizedData.ProcessStarted -f $Path,$Processes.ProcessId) -} - -function WaitForWin32ProcessStart -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [PSCredential] - $Credential, - - [Int] - $Delay = 60000 - ) - - $start = [DateTime]::Now - $GetArguments = ExtractArguments $PSBoundParameters ("Path","Arguments","Credential") - do - { - $value = @(GetWin32Process @GetArguments).Count -ge 1 - } while(!$value -and ([DateTime]::Now - $start).TotalMilliseconds -lt $Delay) - - return $value -} - -function WaitForWin32ProcessEnd -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Path, - - [String] - $Arguments, - - [PSCredential] - $Credential - ) - - $GetArguments = ExtractArguments $PSBoundParameters ("Path","Arguments","Credential") - While (WaitForWin32ProcessStart @GetArguments -Delay 1000) - { - Start-Sleep 1 - } - Get-ScheduledTask | Where-Object {($_.TaskName.StartsWith("xPDT")) -and ($_.Actions.Execute -eq $Path) -and ($_.Actions.Arguments -eq $Arguments)} | Where-Object {$_ -ne $null} | Unregister-ScheduledTask -Confirm:$false -} - -function NetUse -{ - param - ( - [parameter(Mandatory)] - [string] - $SourcePath, - - [parameter(Mandatory)] - [PSCredential] - $Credential, - - [string] - [ValidateSet("Present","Absent")] - $Ensure = "Present" - ) - - if(($SourcePath.Length -ge 2) -and ($SourcePath.Substring(0,2) -eq "\\")) - { - $args = @() - if ($Ensure -eq "Absent") - { - $args += "use", $SourcePath, "/del" - } - else - { - $args += "use", $SourcePath, $($Credential.GetNetworkCredential().Password), "/user:$($Credential.GetNetworkCredential().Domain)\$($Credential.GetNetworkCredential().UserName)" - } - - &"net" $args - } -} - -Export-ModuleMember ResolvePath,StartWin32Process,WaitForWin32ProcessEnd,NetUse diff --git a/lib/puppet_x/dsc_resources/xSQLServer/xSQLServer.psd1 b/lib/puppet_x/dsc_resources/xSQLServer/xSQLServer.psd1 deleted file mode 100644 index 83be64bb..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/xSQLServer.psd1 +++ /dev/null @@ -1,174 +0,0 @@ -@{ -# Version number of this module. -ModuleVersion = '7.0.0.0' - -# ID used to uniquely identify this module -GUID = '74e9ddb5-4cbc-4fa2-a222-2bcfb533fd66' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'Module with DSC Resources for deployment and configuration of Microsoft SQL Server.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Minimum version of the common language runtime (CLR) required by this module -CLRVersion = '4.0' - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/xSQLServer/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/xSQLServer' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - ReleaseNotes = '- Examples - - xSQLServerDatabaseRole - - 1-AddDatabaseRole.ps1 - - 2-RemoveDatabaseRole.ps1 - - xSQLServerRole - - 3-AddMembersToServerRole.ps1 - - 4-MembersToIncludeInServerRole.ps1 - - 5-MembersToExcludeInServerRole.ps1 - - xSQLServerSetup - - 1-InstallDefaultInstanceSingleServer.ps1 - - 2-InstallNamedInstanceSingleServer.ps1 - - 3-InstallNamedInstanceSingleServerFromUncPathUsingSourceCredential.ps1 - - 4-InstallNamedInstanceInFailoverClusterFirstNode.ps1 - - 5-InstallNamedInstanceInFailoverClusterSecondNode.ps1 - - xSQLServerReplication - - 1-ConfigureInstanceAsDistributor.ps1 - - 2-ConfigureInstanceAsPublisher.ps1 - - xSQLServerNetwork - - 1-EnableTcpIpOnCustomStaticPort.ps1 - - xSQLServerAvailabilityGroupListener - - 1-AddAvailabilityGroupListenerWithSameNameAsVCO.ps1 - - 2-AddAvailabilityGroupListenerWithDifferentNameAsVCO.ps1 - - 3-RemoveAvailabilityGroupListenerWithSameNameAsVCO.ps1 - - 4-RemoveAvailabilityGroupListenerWithDifferentNameAsVCO.ps1 - - 5-AddAvailabilityGroupListenerUsingDHCPWithDefaultServerSubnet.ps1 - - 6-AddAvailabilityGroupListenerUsingDHCPWithSpecificSubnet.ps1 - - xSQLServerEndpointPermission - - 1-AddConnectPermission.ps1 - - 2-RemoveConnectPermission.ps1 - - 3-AddConnectPermissionToAlwaysOnPrimaryAndSecondaryReplicaEachWithDifferentSqlServiceAccounts.ps1 - - 4-RemoveConnectPermissionToAlwaysOnPrimaryAndSecondaryReplicaEachWithDifferentSqlServiceAccounts.ps1 - - xSQLServerPermission - - 1-AddServerPermissionForLogin.ps1 - - 2-RemoveServerPermissionForLogin.ps1 - - xSQLServerEndpointState - - 1-MakeSureEndpointIsStarted.ps1 - - 2-MakeSureEndpointIsStopped.ps1 - - xSQLServerConfiguration - - 1-ConfigureTwoInstancesOnTheSameServerToEnableClr.ps1 - - 2-ConfigureInstanceToEnablePriorityBoost.ps1 - - xSQLServerEndpoint - - 1-CreateEndpointWithDefaultValues.ps1 - - 2-CreateEndpointWithSpecificPortAndIPAddress.ps1 - - 3-RemoveEndpoint.ps1 -- Changes to xSQLServerDatabaseRole - - Fixed code style, added updated parameter descriptions to schema.mof and README.md. -- Changes to xSQLServer - - Raised the CodeCov target to 70% which is the minimum and required target for HQRM resource. -- Changes to xSQLServerRole - - **BREAKING CHANGE: The resource has been reworked in it"s entirely.** Below is what has changed. - - The mandatory parameters now also include ServerRoleName. - - The ServerRole parameter was before an array of server roles, now this parameter is renamed to ServerRoleName and can only be set to one server role. - - ServerRoleName are no longer limited to built-in server roles. To add members to a built-in server role, set ServerRoleName to the name of the built-in server role. - - The ServerRoleName will be created when Ensure is set to "Present" (if it does not already exist), or removed if Ensure is set to "Absent". - - Three new parameters are added; Members, MembersToInclude and MembersToExclude. - - Members can be set to one or more logins, and those will _replace all_ the memberships in the server role. - - MembersToInclude and MembersToExclude can be set to one or more logins that will add or remove memberships, respectively, in the server role. MembersToInclude and MembersToExclude _can not_ be used at the same time as parameter Members. But both MembersToInclude and MembersToExclude can be used together at the same time. -- Changes to xSQLServerSetup - - Added a note to the README.md saying that it is not possible to add or remove features from a SQL Server failover cluster (issue 433). - - Changed so that it reports false if the desired state is not correct (issue 432). - - Added a test to make sure we always return false if a SQL Server failover cluster is missing features. - - Helper function Connect-SQLAnalysis - - Now has correct error handling, and throw does not used the unknown named parameter "-Message" (issue 436) - - Added tests for Connect-SQLAnalysis - - Changed to localized error messages. - - Minor changes to error handling. - - This adds better support for Addnode (issue 369). - - Now it skips cluster validation för add node (issue 442). - - Now it ignores parameters that are not allowed for action Addnode (issue 441). - - Added support for vNext CTP 1.4 (issue 472). -- Added new resource - - xSQLServerAlwaysOnAvailabilityGroupReplica -- Changes to xSQLServerDatabaseRecoveryModel - - Fixed code style, removed SQLServerDatabaseRecoveryModel functions from xSQLServerHelper. -- Changes to xSQLServerAlwaysOnAvailabilityGroup - - Fixed the permissions check loop so that it exits the loop after the function determines the required permissions are in place. -- Changes to xSQLServerAvailabilityGroupListener - - Removed the dependency of SQLPS provider (issue 460). - - Cleaned up code. - - Added test for more coverage. - - Fixed PSSA rule warnings (issue 255). - - Parameter Ensure now defaults to "Present" (issue 450). -- Changes to xSQLServerFirewall - - Now it will correctly create rules when the resource is used for two or more instances on the same server (issue 461). -- Changes to xSQLServerEndpointPermission - - Added description to the README.md - - Cleaned up code (issue 257 and issue 231) - - Now the default value for Ensure is "Present". - - Removed dependency of SQLPS provider (issue 483). - - Refactored tests so they use less code. -- Changes to README.md - - Adding deprecated tag to xSQLServerFailoverClusterSetup, xSQLAOGroupEnsure and xSQLAOGroupJoin in README.md so it it more clear that these resources has been replaced by xSQLServerSetup, xSQLServerAlwaysOnAvailabilityGroup and xSQLServerAlwaysOnAvailabilityGroupReplica respectively. -- Changes to xSQLServerEndpoint - - BREAKING CHANGE: Now SQLInstanceName is mandatory, and is a key, so SQLInstanceName has no longer a default value (issue 279). - - BREAKING CHANGE: Parameter AuthorizedUser has been removed (issue 466, issue 275 and issue 80). Connect permissions can be set using the resource xSQLServerEndpointPermission. - - Optional parameter IpAddress has been added. Default is to listen on any valid IP-address. (issue 232) - - Parameter Port now has a default value of 5022. - - Parameter Ensure now defaults to "Present". - - Resource now supports changing IP address and changing port. - - Added unit tests (issue 289) - - Added examples. -- Changes to xSQLServerEndpointState - - Cleaned up code, removed SupportsShouldProcess and fixed PSSA rules warnings (issue 258 and issue 230). - - Now the default value for the parameter State is "Started". - - Updated README.md with a description for the resources and revised the parameter descriptions. - - Removed dependency of SQLPS provider (issue 481). - - The parameter NodeName is no longer mandatory and has now the default value of $env:COMPUTERNAME. - - The parameter Name is now a key so it is now possible to change the state on more than one endpoint on the same instance. _Note: The resource still only supports Database Mirror endpoints at this time._ -- Changes to xSQLServerHelper module - - Removing helper function Get-SQLAlwaysOnEndpoint because there is no resource using it any longer. - - BREAKING CHANGE: Changed helper function Import-SQLPSModule to support SqlServer module (issue 91). The SqlServer module is the preferred module so if it is found it will be used, and if not found an attempt will be done to load SQLPS module instead. -- Changes to xSQLServerScript - - Updated tests for this resource, because they failed when Import-SQLPSModule was updated. -' - - } # End of PSData hashtable - -} # End of PrivateData hashtable -} - - - - - - diff --git a/lib/puppet_x/dsc_resources/xSQLServer/xSQLServerHelper.psm1 b/lib/puppet_x/dsc_resources/xSQLServer/xSQLServerHelper.psm1 deleted file mode 100644 index 110493f9..00000000 --- a/lib/puppet_x/dsc_resources/xSQLServer/xSQLServerHelper.psm1 +++ /dev/null @@ -1,1428 +0,0 @@ -# Load Localization Data -Import-LocalizedData LocalizedData -filename xSQLServer.strings.psd1 -ErrorAction SilentlyContinue -Import-LocalizedData USLocalizedData -filename xSQLServer.strings.psd1 -UICulture en-US -ErrorAction SilentlyContinue - -<# - .SYNOPSIS - Connect to a SQL Server Database Engine and return the server object. - - .PARAMETER SQLServer - String containing the host name of the SQL Server to connect to. - - .PARAMETER SQLInstanceName - String containing the SQL Server Database Engine instance to connect to. - - .PARAMETER SetupCredential - PSCredential object with the credentials to use to impersonate a user when connecting. - If this is not provided then the current user will be used to connect to the SQL Server Database Engine instance. -#> -function Connect-SQL -{ - [CmdletBinding()] - param - ( - [ValidateNotNull()] - [System.String] - $SQLServer = $env:COMPUTERNAME, - - [ValidateNotNull()] - [System.String] - $SQLInstanceName = "MSSQLSERVER", - - [ValidateNotNull()] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - $null = [System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.Smo') - - if ($SQLInstanceName -eq "MSSQLSERVER") - { - $connectSql = $SQLServer - } - else - { - $connectSql = "$SQLServer\$SQLInstanceName" - } - - if ($SetupCredential) - { - $sql = New-Object Microsoft.SqlServer.Management.Smo.Server - $sql.ConnectionContext.ConnectAsUser = $true - $sql.ConnectionContext.ConnectAsUserPassword = $SetupCredential.GetNetworkCredential().Password - $sql.ConnectionContext.ConnectAsUserName = $SetupCredential.GetNetworkCredential().UserName - $sql.ConnectionContext.ServerInstance = $connectSQL - $sql.ConnectionContext.connect() - } - else - { - $sql = New-Object Microsoft.SqlServer.Management.Smo.Server $connectSql - } - - if (!$sql) - { - Throw -Message "Failed connecting to SQL $connectSql" - } - - New-VerboseMessage -Message "Connected to SQL $connectSql" - - return $sql -} - -<# - .SYNOPSIS - Connect to a SQL Server Analysis Service and return the server object. - - .PARAMETER SQLServer - String containing the host name of the SQL Server to connect to. - - .PARAMETER SQLInstanceName - String containing the SQL Server Analysis Service instance to connect to. - - .PARAMETER SetupCredential - PSCredential object with the credentials to use to impersonate a user when connecting. - If this is not provided then the current user will be used to connect to the SQL Server Analysis Service instance. -#> -function Connect-SQLAnalysis -{ - [CmdletBinding()] - param - ( - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLServer = $env:COMPUTERNAME, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.String] - $SQLInstanceName = 'MSSQLSERVER', - - [Parameter()] - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $SetupCredential - ) - - $null = [System.Reflection.Assembly]::LoadWithPartialName('Microsoft.AnalysisServices') - - if ($SQLInstanceName -eq 'MSSQLSERVER') - { - $analysisServiceInstance = $SQLServer - } - else - { - $analysisServiceInstance = "$SQLServer\$SQLInstanceName" - } - - if ($SetupCredential) - { - $userName = $SetupCredential.GetNetworkCredential().UserName - $password = $SetupCredential.GetNetworkCredential().Password - - $analysisServicesDataSource = "Data Source=$analysisServiceInstance;User ID=$userName;Password=$password" - } - else - { - $analysisServicesDataSource = "Data Source=$analysisServiceInstance" - } - - try - { - $analysisServicesObject = New-Object -TypeName Microsoft.AnalysisServices.Server - if ($analysisServicesObject) - { - $analysisServicesObject.Connect($analysisServicesDataSource) - } - else - { - throw New-TerminatingError -ErrorType AnalysisServicesNoServerObject -ErrorCategory InvalidResult - } - - Write-Verbose -Message "Connected to Analysis Services $analysisServiceInstance." -Verbose - } - catch - { - throw New-TerminatingError -ErrorType AnalysisServicesFailedToConnect -FormatArgs @($analysisServiceInstance) -ErrorCategory ObjectNotFound -InnerException $_.Exception - } - - return $analysisServicesObject -} - -<# - .SYNOPSIS - Returns a localized error message. - - .PARAMETER ErrorType - String containing the key of the localized error message. - - .PARAMETER FormatArgs - Collection of strings to replace format objects in the error message. - - .PARAMETER ErrorCategory - The category to use for the error message. Default value is 'OperationStopped'. - Valid values are a value from the enumeration System.Management.Automation.ErrorCategory. - - .PARAMETER TargetObject - The object that was being operated on when the error occurred. - - .PARAMETER InnerException - Exception object that was thorwn when the error occured, which will be added to the final error message. -#> -function New-TerminatingError -{ - [CmdletBinding()] - [OutputType([System.Management.Automation.ErrorRecord])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $ErrorType, - - [Parameter(Mandatory = $false)] - [String[]] - $FormatArgs, - - [Parameter(Mandatory = $false)] - [System.Management.Automation.ErrorCategory] - $ErrorCategory = [System.Management.Automation.ErrorCategory]::OperationStopped, - - [Parameter(Mandatory = $false)] - [Object] - $TargetObject = $null, - - [Parameter(Mandatory = $false)] - [System.Exception] - $InnerException = $null - ) - - $errorMessage = $LocalizedData.$ErrorType - - if(!$errorMessage) - { - $errorMessage = ($LocalizedData.NoKeyFound -f $ErrorType) - - if(!$errorMessage) - { - $errorMessage = ("No Localization key found for key: {0}" -f $ErrorType) - } - } - - $errorMessage = ($errorMessage -f $FormatArgs) - - if( $InnerException ) - { - $errorMessage += " InnerException: $($InnerException.Message)" - } - - $callStack = Get-PSCallStack - - # Get Name of calling script - if($callStack[1] -and $callStack[1].ScriptName) - { - $scriptPath = $callStack[1].ScriptName - - $callingScriptName = $scriptPath.Split('\')[-1].Split('.')[0] - - $errorId = "$callingScriptName.$ErrorType" - } - else - { - $errorId = $ErrorType - } - - Write-Verbose -Message "$($USLocalizedData.$ErrorType -f $FormatArgs) | ErrorType: $errorId" - - $exception = New-Object System.Exception $errorMessage, $InnerException - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $ErrorCategory, $TargetObject - - return $errorRecord -} - -<# - .SYNOPSIS - Displays a localized warning message. - - .PARAMETER WarningType - String containing the key of the localized warning message. - - .PARAMETER FormatArgs - Collection of strings to replace format objects in warning message. -#> -function New-WarningMessage -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $WarningType, - - [String[]] - $FormatArgs - ) - - ## Attempt to get the string from the localized data - $warningMessage = $LocalizedData.$WarningType - - ## Ensure there is a message present in the localization file - if (!$warningMessage) - { - $errorParams = @{ - ErrorType = 'NoKeyFound' - FormatArgs = $WarningType - ErrorCategory = 'InvalidArgument' - TargetObject = 'New-WarningMessage' - } - - ## Raise an error indicating the localization data is not present - throw New-TerminatingError @errorParams - } - - ## Apply formatting - $warningMessage = $warningMessage -f $FormatArgs - - ## Write the message as a warning - Write-Warning -Message $warningMessage -} - -<# - .SYNOPSIS - Displays a standardized verbose message. - - .PARAMETER Message - String containing the key of the localized warning message. -#> -function New-VerboseMessage -{ - [CmdletBinding()] - [Alias()] - [OutputType([String])] - Param - ( - [Parameter(Mandatory=$true)] - $Message - ) - Write-Verbose -Message ((Get-Date -format yyyy-MM-dd_HH-mm-ss) + ": $Message") -Verbose -} - -<# - .SYNOPSIS - This method is used to compare current and desired values for any DSC resource. - - .PARAMETER CurrentValues - This is hashtable of the current values that are applied to the resource. - - .PARAMETER DesiredValues - This is a PSBoundParametersDictionary of the desired values for the resource. - - .PARAMETER ValuesToCheck - This is a list of which properties in the desired values list should be checked. - If this is empty then all values in DesiredValues are checked. -#> -function Test-SQLDscParameterState -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [HashTable] - $CurrentValues, - - [Parameter(Mandatory = $true)] - [Object] - $DesiredValues, - - [Parameter()] - [Array] - $ValuesToCheck - ) - - $returnValue = $true - - if (($DesiredValues.GetType().Name -ne "HashTable") ` - -and ($DesiredValues.GetType().Name -ne "CimInstance") ` - -and ($DesiredValues.GetType().Name -ne "PSBoundParametersDictionary")) - { - throw "Property 'DesiredValues' in Test-SQLDscParameterState must be either a " + ` - "Hashtable or CimInstance. Type detected was $($DesiredValues.GetType().Name)" - } - - if (($DesiredValues.GetType().Name -eq "CimInstance") -and ($null -eq $ValuesToCheck)) - { - throw "If 'DesiredValues' is a CimInstance then property 'ValuesToCheck' must contain a value" - } - - if (($null -eq $ValuesToCheck) -or ($ValuesToCheck.Count -lt 1)) - { - $keyList = $DesiredValues.Keys - } - else - { - $keyList = $ValuesToCheck - } - - $keyList | ForEach-Object -Process { - if (($_ -ne "Verbose")) - { - if (($CurrentValues.ContainsKey($_) -eq $false) ` - -or ($CurrentValues.$_ -ne $DesiredValues.$_) ` - -or (($DesiredValues.ContainsKey($_) -eq $true) -and ($DesiredValues.$_.GetType().IsArray))) - { - if ($DesiredValues.GetType().Name -eq "HashTable" -or ` - $DesiredValues.GetType().Name -eq "PSBoundParametersDictionary") - { - - $checkDesiredValue = $DesiredValues.ContainsKey($_) - } - else - { - $checkDesiredValue = Test-SPDSCObjectHasProperty $DesiredValues $_ - } - - if ($checkDesiredValue) - { - $desiredType = $DesiredValues.$_.GetType() - $fieldName = $_ - if ($desiredType.IsArray -eq $true) - { - if (($CurrentValues.ContainsKey($fieldName) -eq $false) ` - -or ($null -eq $CurrentValues.$fieldName)) - { - New-VerboseMessage -Message ("Expected to find an array value for " + ` - "property $fieldName in the current " + ` - "values, but it was either not present or " + ` - "was null. This has caused the test method " + ` - "to return false.") - - $returnValue = $false - } - else - { - $arrayCompare = Compare-Object -ReferenceObject $CurrentValues.$fieldName ` - -DifferenceObject $DesiredValues.$fieldName - if ($null -ne $arrayCompare) - { - New-VerboseMessage -Message ("Found an array for property $fieldName " + ` - "in the current values, but this array " + ` - "does not match the desired state. " + ` - "Details of the changes are below.") - $arrayCompare | ForEach-Object -Process { - New-VerboseMessage -Message "$($_.InputObject) - $($_.SideIndicator)" - } - - $returnValue = $false - } - } - } - else - { - switch ($desiredType.Name) - { - "String" { - if (-not [String]::IsNullOrEmpty($CurrentValues.$fieldName) -or ` - -not [String]::IsNullOrEmpty($DesiredValues.$fieldName)) - { - New-VerboseMessage -Message ("String value for property $fieldName does not match. " + ` - "Current state is '$($CurrentValues.$fieldName)' " + ` - "and Desired state is '$($DesiredValues.$fieldName)'") - - $returnValue = $false - } - } - "Int32" { - if (-not ($DesiredValues.$fieldName -eq 0) -or ` - -not ($null -eq $CurrentValues.$fieldName)) - { - New-VerboseMessage -Message ("Int32 value for property " + "$fieldName does not match. " + ` - "Current state is " + "'$($CurrentValues.$fieldName)' " + ` - "and desired state is " + "'$($DesiredValues.$fieldName)'") - - $returnValue = $false - } - } - "Int16" { - if (-not ($DesiredValues.$fieldName -eq 0) -or ` - -not ($null -eq $CurrentValues.$fieldName)) - { - New-VerboseMessage -Message ("Int32 value for property " + "$fieldName does not match. " + ` - "Current state is " + "'$($CurrentValues.$fieldName)' " + ` - "and desired state is " + "'$($DesiredValues.$fieldName)'") - - $returnValue = $false - } - } - default { - New-VerboseMessage -Message ("Unable to compare property $fieldName " + ` - "as the type ($($desiredType.Name)) is " + ` - "not handled by the Test-SQLDscParameterState cmdlet") - - $returnValue = $false - } - } - } - } - } - } - } - - return $returnValue -} - -<# - .SYNOPSIS - Connect to a SQL Server Database Engine and give the server permissions 'AlterAnyAvailabilityGroup' and 'ViewServerState' to the provided user. - - .PARAMETER SQLServer - String containing the host name of the SQL Server to connect to. - - .PARAMETER SQLInstanceName - String containing the SQL Server Database Engine instance to connect to. - - .PARAMETER SetupCredential - PSCredential object with the credentials to use to impersonate a user when connecting. - If this is not provided then the current user will be used to connect to the SQL Server Database Engine instance. - - .PARAMETER AuthorizedUser - String containing the user to give the server permissions 'AlterAnyAvailabilityGroup' and 'ViewServerState'. -#> -function Grant-ServerPerms -{ - [CmdletBinding()] - param - ( - [ValidateNotNull()] - [System.String] - $SQLServer = $env:COMPUTERNAME, - - [ValidateNotNull()] - [System.String] - $SQLInstanceName= "MSSQLSERVER", - - [ValidateNotNullOrEmpty()] - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential, - - [ValidateNotNullOrEmpty()] - [Parameter(Mandatory = $true)] - [System.String] - $AuthorizedUser - ) - - if(!$SQL) - { - $SQL = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName -SetupCredential $SetupCredential - } - Try{ - $sps = New-Object Microsoft.SqlServer.Management.Smo.ServerPermissionSet([Microsoft.SqlServer.Management.Smo.ServerPermission]::AlterAnyAvailabilityGroup) - $sps.Add([Microsoft.SqlServer.Management.Smo.ServerPermission]::ViewServerState) - $SQL.Grant($sps,$AuthorizedUser) - New-VerboseMessage -Message "Granted Permissions to $AuthorizedUser" - } - Catch{ - Write-Error "Failed to grant Permissions to $AuthorizedUser." - } -} - -<# - .SYNOPSIS - Connect to a Active Directory and give the Cluster Name Object all rights on the cluster Virtual Computer Object (VCO). - - .PARAMETER AvailabilityGroupNameListener - String containing the name of the Availabilty Group's Virtual Computer Object (VCO). - - .PARAMETER CNO - String containing the name of the Cluster Name Object (CNO) for the failover cluster. -#> -function Grant-CNOPerms -{ -[CmdletBinding()] - Param - ( - [ValidateNotNullOrEmpty()] - [Parameter(Mandatory = $true)] - [System.String] - $AvailabilityGroupNameListener, - - [ValidateNotNullOrEmpty()] - [Parameter(Mandatory = $true)] - [System.String] - $CNO - ) - - #Verify Active Directory Tools are installed, if they are load if not Throw Error - If (!(Get-Module -ListAvailable | Where-Object {$_.Name -eq "ActiveDirectory"})){ - Throw "Active Directory Module is not installed and is Required." - Exit - } - else{Import-Module ActiveDirectory -ErrorAction Stop -Verbose:$false} - Try{ - $AG = Get-ADComputer $AvailabilityGroupNameListener - - $comp = $AG.DistinguishedName # input AD computer distinguishedname - $acl = Get-Acl "AD:\$comp" - $u = Get-ADComputer $CNO # get the AD user object given full control to computer - $SID = [System.Security.Principal.SecurityIdentifier] $u.SID - - $identity = [System.Security.Principal.IdentityReference] $SID - $adRights = [System.DirectoryServices.ActiveDirectoryRights] "GenericAll" - $type = [System.Security.AccessControl.AccessControlType] "Allow" - $inheritanceType = [System.DirectoryServices.ActiveDirectorySecurityInheritance] "All" - $ace = New-Object System.DirectoryServices.ActiveDirectoryAccessRule $identity,$adRights,$type,$inheritanceType - - $acl.AddAccessRule($ace) - Set-Acl -AclObject $acl "AD:\$comp" - New-VerboseMessage -Message "Granted privileges on $comp to $CNO" - } - Catch{ - Throw "Failed to grant Permissions on $comp." - Exit - } -} - -<# - .SYNOPSIS - Create a new computer object for a Availabilty Group's Virtual Computer Object (VCO). - - .PARAMETER AvailabilityGroupNameListener - String containing the name of the Availabilty Group's Virtual Computer Object (VCO). - - .PARAMETER SQLServer - String containing the host name of the SQL Server to connect to. - - .PARAMETER SQLInstanceName - String containing the SQL Server Database Engine instance to connect to. - - .PARAMETER SetupCredential - PSCredential object with the credentials to use to impersonate a user when connecting. - If this is not provided then the current user will be used to connect to the SQL Server Database Engine instance. -#> -function New-ListenerADObject -{ -[CmdletBinding()] - Param - ( - [ValidateNotNullOrEmpty()] - [Parameter(Mandatory = $true)] - [System.String] - $AvailabilityGroupNameListener, - - [ValidateNotNull()] - [System.String] - $SQLServer = $env:COMPUTERNAME, - - [ValidateNotNull()] - [System.String] - $SQLInstanceName = "MSSQLSERVER", - - [ValidateNotNullOrEmpty()] - [Parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $SetupCredential - ) - - if(!$SQL) - { - $SQL = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName -SetupCredential $SetupCredential - } - - $CNO= $SQL.ClusterName - - #Verify Active Directory Tools are installed, if they are load if not Throw Error - If (!(Get-Module -ListAvailable | Where-Object {$_.Name -eq "ActiveDirectory"})){ - Throw "Active Directory Module is not installed and is Required." - Exit - } - else{Import-Module ActiveDirectory -ErrorAction Stop -Verbose:$false} - try{ - $CNO_OU = Get-ADComputer $CNO - #Accounts for the comma and CN= at the start of Distinguished Name - #We want to remove these plus the ClusterName to get the actual OU Path. - $AdditionalChars = 4 - $Trim = $CNO.Length+$AdditionalChars - $CNOlgth = $CNO_OU.DistinguishedName.Length - $trim - $OUPath = $CNO_OU.ToString().Substring($Trim,$CNOlgth) - } - catch{ - Throw ": Failed to find Computer in AD" - exit - } - - - $m = Get-ADComputer -Filter {Name -eq $AvailabilityGroupNameListener} -Server $env:USERDOMAIN | Select-Object -Property * | Measure-Object - - If ($m.Count -eq 0) - { - Try{ - #Create Computer Object for the AgListenerName - New-ADComputer -Name $AvailabilityGroupNameListener -SamAccountName $AvailabilityGroupNameListener -Path $OUPath -Enabled $false -Credential $SetupCredential - New-VerboseMessage -Message "Created Computer Object $AvailabilityGroupNameListener" - } - Catch{ - Throw "Failed to Create $AvailabilityGroupNameListener in $OUPath" - Exit - } - - $SuccessChk =0 - - #Check for AD Object Validate at least three successful attempts - $i=1 - While ($i -le 5) { - Try{ - $ListChk = Get-ADComputer -filter {Name -like $AvailabilityGroupNameListener} - If ($ListChk){$SuccessChk++} - Start-Sleep -Seconds 10 - If($SuccesChk -eq 3){break} - } - Catch{ - Throw "Failed Validate $AvailabilityGroupNameListener was created in $OUPath" - Exit - } - $i++ - } - } - Try{ - Grant-CNOPerms -AvailabilityGroupNameListener $AvailabilityGroupNameListener -CNO $CNO - } - Catch{ - Throw "Failed Validate grant permissions on $AvailabilityGroupNameListener in location $OUPAth to $CNO" - Exit - } - -} - -<# - .SYNOPSIS - Imports the module SQLPS in a standardized way. -#> -function Import-SQLPSModule -{ - [CmdletBinding()] - param() - - $module = (Get-Module -FullyQualifiedName 'SqlServer' -ListAvailable).Name - if ($module) - { - New-VerboseMessage -Message 'Preferred module SqlServer found.' - } - else - { - New-VerboseMessage -Message 'Module SqlServer not found, trying to use older SQLPS module.' - $module = (Get-Module -FullyQualifiedName 'SQLPS' -ListAvailable).Name - } - - if ($module) - { - try - { - Write-Debug -Message 'SQLPS module changes CWD to SQLSERVER:\ when loading, pushing location to pop it when module is loaded.' - Push-Location - - New-VerboseMessage -Message ('Importing {0} module.' -f $module) - - <# - SQLPS has unapproved verbs, disable checking to ignore Warnings. - Suppressing verbose so all cmdlet is not llsted. - #> - Import-Module -Name $module -DisableNameChecking -Verbose:$False -ErrorAction Stop - - Write-Debug -Message ('Module {0} imported.' -f $module) - } - catch - { - throw New-TerminatingError -ErrorType FailedToImportSqlModule -FormatArgs @($module) -ErrorCategory InvalidOperation -InnerException $_.Exception - } - finally - { - Write-Debug -Message 'Popping location back to what it was before importing SQLPS module.' - Pop-Location - } - } - else - { - throw New-TerminatingError -ErrorType SqlModuleNotFound -ErrorCategory InvalidOperation -InnerException $_.Exception - } -} - -<# - .SYNOPSIS - Returns the SQL Server instance name in the way SQLPS Provider expect it. - - .DESCRIPTION - The SQLPS Provider doesn't use the default instance name of MSSQLSERVER, instead it uses DEFAULT. - This function make sure the correct default instance name is returned. - - .PARAMETER InstanceName - String containing the SQL Server Database Engine instance to validate. -#> -function Get-SQLPSInstanceName -{ - [CmdletBinding()] - [OutputType([String])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $InstanceName - ) - - if( $InstanceName -eq "MSSQLSERVER" ) { - $InstanceName = "DEFAULT" - } - - return $InstanceName -} - -<# - .SYNOPSIS - Returns the SQL Server SQLPS provider server object. - - .PARAMETER InstanceName - String containing the SQL Server Database Engine instance to connect to. - - .PARAMETER NodeName - String containing the host name of the SQL Server to connect to. -#> -function Get-SQLPSInstance -{ - [CmdletBinding()] - [OutputType([String])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $InstanceName, - - [Parameter(Mandatory = $true)] - [System.String] - $NodeName - ) - - $InstanceName = Get-SQLPSInstanceName -InstanceName $InstanceName - $Path = "SQLSERVER:\SQL\$NodeName\$InstanceName" - - New-VerboseMessage -Message "Connecting to $Path as $([System.Security.Principal.WindowsIdentity]::GetCurrent().Name)" - - Import-SQLPSModule - $instance = Get-Item $Path - - return $instance -} - -<# - .SYNOPSIS - Restarts a SQL Server instance and associated services - - .PARAMETER SQLServer - Hostname of the SQL Server to be configured - - .PARAMETER SQLInstanceName - Name of the SQL instance to be configued. Default is 'MSSQLSERVER' - - .PARAMETER Timeout - Timeout value for restarting the SQL services. The default value is 120 seconds. - - .EXAMPLE - Restart-SqlService -SQLServer localhost - - .EXAMPLE - Restart-SqlService -SQLServer localhost -SQLInstanceName 'NamedInstance' - - .EXAMPLE - Restart-SqlService -SQLServer CLU01 -Timeout 300 -#> -function Restart-SqlService -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [String] - $SQLServer, - - [Parameter()] - [String] - $SQLInstanceName = 'MSSQLSERVER', - - [Parameter()] - [Int32] - $Timeout = 120 - ) - - ## Connect to the instance - $serverObject = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName - - if ($serverObject.IsClustered) - { - ## Get the cluster resources - New-VerboseMessage -Message 'Getting cluster resource for SQL Server' - $sqlService = Get-CimInstance -Namespace root/MSCluster -ClassName MSCluster_Resource -Filter "Type = 'SQL Server'" | - Where-Object { $_.PrivateProperties.InstanceName -eq $serverObject.ServiceName } - - New-VerboseMessage -Message 'Getting active cluster resource SQL Server Agent' - $agentService = $sqlService | Get-CimAssociatedInstance -ResultClassName MSCluster_Resource | - Where-Object { ($_.Type -eq "SQL Server Agent") -and ($_.State -eq 2) } - - ## Build a listing of resources being acted upon - $resourceNames = @($sqlService.Name, ($agentService | Select-Object -ExpandProperty Name)) -join "," - - ## Stop the SQL Server and dependent resources - New-VerboseMessage -Message "Bringing the SQL Server resources $resourceNames offline." - $sqlService | Invoke-CimMethod -MethodName TakeOffline -Arguments @{ Timeout = $Timeout } - - ## Start the SQL server resource - New-VerboseMessage -Message 'Bringing the SQL Server resource back online.' - $sqlService | Invoke-CimMethod -MethodName BringOnline -Arguments @{ Timeout = $Timeout } - - ## Start the SQL Agent resource - if ($agentService) - { - New-VerboseMessage -Message 'Bringing the SQL Server Agent resource online.' - $agentService | Invoke-CimMethod -MethodName BringOnline -Arguments @{ Timeout = $Timeout } - } - } - else - { - New-VerboseMessage -Message 'Getting SQL Service information' - $sqlService = Get-Service -DisplayName "SQL Server ($($serverObject.ServiceName))" - - ## Get all dependent services that are running. - ## There are scenarios where an automatic service is stopped and should not be restarted automatically. - $agentService = $sqlService.DependentServices | Where-Object { $_.Status -eq "Running" } - - ## Restart the SQL Server service - New-VerboseMessage -Message 'SQL Server service restarting' - $sqlService | Restart-Service -Force - - ## Start dependent services - $agentService | ForEach-Object { - New-VerboseMessage -Message "Starting $($_.DisplayName)" - $_ | Start-Service - } - } -} - -<# - .SYNOPSIS - This cmdlet is used to return the permission for a user in a database - - .PARAMETER SqlServerObject - This is the Server object returned by Connect-SQL - - .PARAMETER Name - This is the name of the user to get the current permissions for - - .PARAMETER Database - This is the name of the SQL database - - .PARAMETER PermissionState - If the permission should be granted or denied. Valid values are Grant or Deny -#> -function Get-SqlDatabasePermission -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.Object] - $SqlServerObject, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Database, - - [Parameter(Mandatory = $true)] - [ValidateSet('Grant','Deny')] - [ValidateNotNullOrEmpty()] - [System.String] - $PermissionState - ) - - Write-Verbose -Message 'Evaluating database and login.' - $sqlDatabase = $SqlServerObject.Databases[$Database] - $sqlLogin = $SqlServerObject.Logins[$Name] - $sqlInstanceName = $SqlServerObject.InstanceName - $sqlServer = $SqlServerObject.ComputerNamePhysicalNetBIOS - - # Initialize variable permission - [System.String[]] $permission = @() - - if ($sqlDatabase) - { - if ($sqlLogin) - { - Write-Verbose -Message "Getting permissions for user '$Name' in database '$Database'." - - $databasePermissionInfo = $sqlDatabase.EnumDatabasePermissions($Name) - $databasePermissionInfo = $databasePermissionInfo | Where-Object -FilterScript { - $_.PermissionState -eq $PermissionState - } - - foreach ($currentDatabasePermissionInfo in $databasePermissionInfo) - { - $permissionProperty = ($currentDatabasePermissionInfo.PermissionType | Get-Member -MemberType Property).Name - foreach ($currentPermissionProperty in $permissionProperty) - { - if ($currentDatabasePermissionInfo.PermissionType."$currentPermissionProperty") - { - $permission += $currentPermissionProperty - } - } - } - } - else - { - throw New-TerminatingError -ErrorType LoginNotFound ` - -FormatArgs @($Name,$sqlServer,$sqlInstanceName) ` - -ErrorCategory ObjectNotFound - } - } - else - { - throw New-TerminatingError -ErrorType NoDatabase ` - -FormatArgs @($Database,$sqlServer,$sqlInstanceName) ` - -ErrorCategory InvalidResult - } - - $permission -} - -<# - .SYNOPSIS - This cmdlet is used to grant or deny permissions for a user in a database - - .PARAMETER SqlServerObject - This is the Server object returned by Connect-SQL - - .PARAMETER Name - This is the name of the user to get the current permissions for - - .PARAMETER Database - This is the name of the SQL database - - .PARAMETER PermissionState - If the permission should be granted or denied. Valid values are Grant or Deny - - .PARAMETER Permissions - The permissions to be granted or denied for the user in the database. - Valid permissions can be found in the article SQL Server Permissions: - https://msdn.microsoft.com/en-us/library/ms191291.aspx#SQL Server Permissions -#> -function Add-SqlDatabasePermission -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.Object] - $SqlServerObject, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Database, - - [Parameter(Mandatory = $true)] - [ValidateSet('Grant','Deny')] - [ValidateNotNullOrEmpty()] - [System.String] - $PermissionState, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String[]] - $Permissions - ) - - Write-Verbose -Message 'Evaluating database and login.' - $sqlDatabase = $SqlServerObject.Databases[$Database] - $sqlLogin = $SqlServerObject.Logins[$Name] - $sqlInstanceName = $SqlServerObject.InstanceName - $sqlServer = $SqlServerObject.ComputerNamePhysicalNetBIOS - - if ($sqlDatabase) - { - if ($sqlLogin) - { - if (!$sqlDatabase.Users[$Name]) - { - try - { - Write-Verbose -Message ("Adding SQL login $Name as a user of database " + ` - "$Database on $sqlServer\$sqlInstanceName") - $sqlDatabaseUser = New-Object Microsoft.SqlServer.Management.Smo.User $sqlDatabase,$Name - $sqlDatabaseUser.Login = $Name - $sqlDatabaseUser.Create() - } - catch - { - Write-Verbose -Message ("Failed adding SQL login $Name as a user of " + ` - "database $Database on $sqlServer\$sqlInstanceName") - } - } - - if ($sqlDatabase.Users[$Name]) - { - try - { - Write-Verbose -Message ("$PermissionState the permissions '$Permissions' to the " + ` - "database '$Database' on the server $sqlServer$sqlInstanceName") - $permissionSet = New-Object -TypeName Microsoft.SqlServer.Management.Smo.DatabasePermissionSet - - foreach ($permission in $permissions) - { - $permissionSet."$permission" = $true - } - - switch ($PermissionState) - { - 'Grant' - { - $sqlDatabase.Grant($permissionSet,$Name) - } - - 'Deny' - { - $sqlDatabase.Deny($permissionSet,$Name) - } - } - } - catch - { - Write-Verbose -Message ("Failed setting SQL login $Name to permissions $permissions " + ` - "on database $Database on $sqlServer\$sqlInstanceName") - } - } - } - else - { - throw New-TerminatingError -ErrorType LoginNotFound ` - -FormatArgs @($Name,$sqlServer,$sqlInstanceName) ` - -ErrorCategory ObjectNotFound - } - } - else - { - throw New-TerminatingError -ErrorType NoDatabase ` - -FormatArgs @($Database,$sqlServer,$sqlInstanceName) ` - -ErrorCategory InvalidResult - } -} - -<# - .SYNOPSIS - This cmdlet is used to remove (revoke) permissions for a user in a database - - .PARAMETER SqlServerObject - This is the Server object returned by Connect-SQL. - - .PARAMETER Name - This is the name of the user for which permissions will be removed (revoked) - - .PARAMETER Database - This is the name of the SQL database - - .PARAMETER PermissionState - f the permission that should be removed was granted or denied. Valid values are Grant or Deny - - .PARAMETER Permissions - The permissions to be remove (revoked) for the user in the database. - Valid permissions can be found in the article SQL Server Permissions: - https://msdn.microsoft.com/en-us/library/ms191291.aspx#SQL Server Permissions. -#> -function Remove-SqlDatabasePermission -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.Object] - $SqlServerObject, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Database, - - [Parameter(Mandatory = $true)] - [ValidateSet('Grant','Deny')] - [ValidateNotNullOrEmpty()] - [System.String] - $PermissionState, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String[]] - $Permissions - ) - - Write-Verbose -Message 'Evaluating database and login' - $sqlDatabase = $SqlServerObject.Databases[$Database] - $sqlLogin = $SqlServerObject.Logins[$Name] - $sqlInstanceName = $SqlServerObject.InstanceName - $sqlServer = $SqlServerObject.ComputerNamePhysicalNetBIOS - - if ($sqlDatabase) - { - if ($sqlLogin) - { - if (!$sqlDatabase.Users[$Name]) - { - try - { - Write-Verbose -Message ("Adding SQL login $Name as a user of database " + ` - "$Database on $sqlServer\$sqlInstanceName") - $sqlDatabaseUser = New-Object -TypeName Microsoft.SqlServer.Management.Smo.User ` - -ArgumentList $sqlDatabase,$Name - $sqlDatabaseUser.Login = $Name - $sqlDatabaseUser.Create() - } - catch - { - Write-Verbose -Message ("Failed adding SQL login $Name as a user of " + ` - "database $Database on $sqlServer\$sqlInstanceName") - } - } - - if ($sqlDatabase.Users[$Name]) - { - try - { - Write-Verbose -Message ("Revoking $PermissionState permissions '$Permissions' to the " + ` - "database '$Database' on the server $sqlServer$sqlInstanceName") - $permissionSet = New-Object -TypeName Microsoft.SqlServer.Management.Smo.DatabasePermissionSet - - foreach ($permission in $permissions) - { - $permissionSet."$permission" = $false - } - - switch ($PermissionState) - { - 'Grant' - { - $sqlDatabase.Grant($permissionSet,$Name) - } - - 'Deny' - { - $sqlDatabase.Deny($permissionSet,$Name) - } - } - } - catch - { - Write-Verbose -Message ("Failed removing SQL login $Name to permissions $permissions " + ` - "on database $Database on $sqlServer\$sqlInstanceName") - } - } - } - else - { - throw New-TerminatingError -ErrorType LoginNotFound ` - -FormatArgs @($Name,$sqlServer,$sqlInstanceName) ` - -ErrorCategory ObjectNotFound - } - } - else - { - throw New-TerminatingError -ErrorType NoDatabase ` - -FormatArgs @($Database,$sqlServer,$sqlInstanceName) ` - -ErrorCategory InvalidResult - } -} - -<# - .SYNOPSIS - Executes a query on the specified database. - - .PARAMETER SQLServer - The hostname of the server that hosts the SQL instance. - - .PARAMETER SQLInstanceName - The name of the SQL instance that hosts the database. - - .PARAMETER Database - Specify the name of the database to execute the query on. - - .PARAMETER Query - The query string to execute. - - .PARAMETER WithResults - Specifies if the query should return results. - - .EXAMPLE - Invoke-Query -SQLServer Server1 -SQLInstanceName MSSQLSERVER -Database master -Query 'SELECT name FROM sys.databases' -WithResults - - .EXAMPLE - Invoke-Query -SQLServer Server1 -SQLInstanceName MSSQLSERVER -Database master -Query 'RESTORE DATABASE [NorthWinds] WITH RECOVERY' -#> -function Invoke-Query -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $SQLServer, - - [Parameter(Mandatory = $true)] - [String] - $SQLInstanceName, - - [Parameter(Mandatory = $true)] - [String] - $Database, - - [Parameter(Mandatory = $true)] - [String] - $Query, - - [Parameter()] - [Switch] - $WithResults - ) - - $serverObject = Connect-SQL -SQLServer $SQLServer -SQLInstanceName $SQLInstanceName - - if ( $WithResults ) - { - try - { - $result = $serverObject.Databases[$Database].ExecuteWithResults($Query) - } - catch - { - throw New-TerminatingError -ErrorType ExecuteQueryWithResultsFailed -FormatArgs $Database -ErrorCategory NotSpecified - } - } - else - { - try - { - $serverObject.Databases[$Database].ExecuteNonQuery($Query) - } - catch - { - throw New-TerminatingError -ErrorType ExecuteNonQueryFailed -FormatArgs $Database -ErrorCategory NotSpecified - } - } - - return $result -} - -<# - .SYNOPSIS - Executes the alter method on an Availability Group Replica object. - - .PARAMETER AvailabilityGroupReplica - The Availabilty Group Replica object that must be altered. -#> -function Update-AvailabilityGroupReplica -{ - param - ( - [Parameter(Mandatory = $true)] - [Microsoft.SqlServer.Management.Smo.AvailabilityReplica] - $AvailabilityGroupReplica - ) - - try - { - $originalErrorActionPreference = $ErrorActionPreference - $ErrorActionPreference = 'Stop' - $AvailabilityGroupReplica.Alter() - } - catch - { - throw New-TerminatingError -ErrorType AlterAvailabilityGroupReplicaFailed -FormatArgs $AvailabilityGroupReplica.Name -ErrorCategory OperationStopped - } - finally - { - $ErrorActionPreference = $originalErrorActionPreference - } -} - -function Test-LoginEffectivePermissions -{ - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $SQLServer, - - [Parameter(Mandatory = $true)] - [String] - $SQLInstanceName, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] - $LoginName, - - [Parameter(Mandatory = $true)] - [string[]] - $Permissions - ) - - # Assume the permissions are not present - $permissionsPresent = $false - - $invokeQueryParams = @{ - SQLServer = $SQLServer - SQLInstanceName = $SQLInstanceName - Database = 'master' - WithResults = $true - } - - $queryToGetEffectivePermissionsForLogin = " - EXECUTE AS LOGIN = '$LoginName' - SELECT DISTINCT permission_name - FROM fn_my_permissions(null,'SERVER') - REVERT - " - - New-VerboseMessage -Message "Getting the effective permissions for the login '$LoginName' on '$sqlInstanceName'." - - $loginEffectivePermissionsResult = Invoke-Query @invokeQueryParams -Query $queryToGetEffectivePermissionsForLogin - $loginEffectivePermissions = $loginEffectivePermissionsResult.Tables.Rows.permission_name - - if ( $null -ne $loginEffectivePermissions ) - { - $loginMissingPermissions = Compare-Object -ReferenceObject $Permissions -DifferenceObject $loginEffectivePermissions | - Where-Object -FilterScript { $_.SideIndicator -ne '=>' } | - Select-Object -ExpandProperty InputObject - - if ( $loginMissingPermissions.Count -eq 0 ) - { - $permissionsPresent = $true - } - } - - return $permissionsPresent -} diff --git a/lib/puppet_x/dsc_resources/xSmbShare/DscResources/MSFT_xSmbShare/MSFT_xSmbShare.psm1 b/lib/puppet_x/dsc_resources/xSmbShare/DscResources/MSFT_xSmbShare/MSFT_xSmbShare.psm1 deleted file mode 100644 index 642855f6..00000000 --- a/lib/puppet_x/dsc_resources/xSmbShare/DscResources/MSFT_xSmbShare/MSFT_xSmbShare.psm1 +++ /dev/null @@ -1,354 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $Path - ) - - $smbShare = Get-SmbShare -Name $Name -ErrorAction SilentlyContinue - $changeAccess = @() - $readAccess = @() - $fullAccess = @() - $noAccess = @() - if ($smbShare -ne $null) - { - $smbShareAccess = Get-SmbShareAccess -Name $Name - $smbShareAccess | % { - $access = $_; - if ($access.AccessRight -eq 'Change' -and $access.AccessControlType -eq 'Allow') - { - $changeAccess += $access.AccountName - } - elseif ($access.AccessRight -eq 'Read' -and $access.AccessControlType -eq 'Allow') - { - $readAccess += $access.AccountName - } - elseif ($access.AccessRight -eq 'Full' -and $access.AccessControlType -eq 'Allow') - { - $fullAccess += $access.AccountName - } - elseif ($access.AccessRight -eq 'Full' -and $access.AccessControlType -eq 'Deny') - { - $noAccess += $access.AccountName - } - } - } - else - { - Write-Verbose "Share with name $Name does not exist" - } - - $returnValue = @{ - Name = $smbShare.Name - Path = $smbShare.Path - Description = $smbShare.Description - ConcurrentUserLimit = $smbShare.ConcurrentUserLimit - EncryptData = $smbShare.EncryptData - FolderEnumerationMode = $smbShare.FolderEnumerationMode - ShareState = $smbShare.ShareState - ShareType = $smbShare.ShareType - ShadowCopy = $smbShare.ShadowCopy - Special = $smbShare.Special - ChangeAccess = $changeAccess - ReadAccess = $readAccess - FullAccess = $fullAccess - NoAccess = $noAccess - Ensure = if($smbShare) {"Present"} else {"Absent"} - } - - $returnValue -} - -function Set-AccessPermission -{ - [CmdletBinding()] - Param - ( - $ShareName, - - [string[]] - $UserName, - - [string] - [ValidateSet("Change","Full","Read","No")] - $AccessPermission - ) - $formattedString = '{0}{1}' -f $AccessPermission,"Access" - Write-Verbose -Message "Setting $formattedString for $UserName" - - if ($AccessPermission -eq "Change" -or $AccessPermission -eq "Read" -or $AccessPermission -eq "Full") - { - Grant-SmbShareAccess -Name $Name -AccountName $UserName -AccessRight $AccessPermission -Force - } - else - { - Block-SmbShareAccess -Name $Name -AccountName $userName -Force - } -} - -function Remove-AccessPermission -{ - [CmdletBinding()] - Param - ( - $ShareName, - - [string[]] - $UserName, - - [string] - [ValidateSet("Change","Full","Read","No")] - $AccessPermission - ) - $formattedString = '{0}{1}' -f $AccessPermission,"Access" - Write-Debug -Message "Removing $formattedString for $UserName" - - if ($AccessPermission -eq "Change" -or $AccessPermission -eq "Read" -or $AccessPermission -eq "Full") - { - Revoke-SmbShareAccess -Name $Name -AccountName $UserName -Force - } - else - { - UnBlock-SmbShareAccess -Name $Name -AccountName $userName -Force - } -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $Path, - - [System.String] - $Description, - - [System.String[]] - $ChangeAccess, - - [System.UInt32] - $ConcurrentUserLimit, - - [System.Boolean] - $EncryptData, - - [ValidateSet("AccessBased","Unrestricted")] - [System.String] - $FolderEnumerationMode, - - [System.String[]] - $FullAccess, - - [System.String[]] - $NoAccess, - - [System.String[]] - $ReadAccess, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = 'Present' - ) - - $psboundparameters.Remove("Debug") - - $shareExists = $false - $smbShare = Get-SmbShare -Name $Name -ErrorAction SilentlyContinue - if($smbShare -ne $null) - { - Write-Verbose -Message "Share with name $Name exists" - $shareExists = $true - } - if ($Ensure -eq "Present") - { - if ($shareExists -eq $false) - { - $psboundparameters.Remove("Ensure") - Write-Verbose "Creating share $Name to ensure it is Present" - New-SmbShare @psboundparameters - } - else - { - # Need to call either Set-SmbShare or *ShareAccess cmdlets - if ($psboundparameters.ContainsKey("ChangeAccess")) - { - $changeAccessValue = $psboundparameters["ChangeAccess"] - $psboundparameters.Remove("ChangeAccess") - } - if ($psboundparameters.ContainsKey("ReadAccess")) - { - $readAccessValue = $psboundparameters["ReadAccess"] - $psboundparameters.Remove("ReadAccess") - } - if ($psboundparameters.ContainsKey("FullAccess")) - { - $fullAccessValue = $psboundparameters["FullAccess"] - $psboundparameters.Remove("FullAccess") - } - if ($psboundparameters.ContainsKey("NoAccess")) - { - $noAccessValue = $psboundparameters["NoAccess"] - $psboundparameters.Remove("NoAccess") - } - - # Use Set-SmbShare for performing operations other than changing access - $psboundparameters.Remove("Ensure") - $psboundparameters.Remove("Path") - Set-SmbShare @PSBoundParameters -Force - - # Use *SmbShareAccess cmdlets to change access - $smbshareAccessValues = Get-SmbShareAccess -Name $Name - if ($ChangeAccess -ne $null) - { - # Blow off whatever is in there and replace it with this list - $smbshareAccessValues | ? {$_.AccessControlType -eq 'Allow' -and $_.AccessRight -eq 'Change'} ` - | % { - Remove-AccessPermission -ShareName $Name -UserName $_.AccountName -AccessPermission Change - } - - $changeAccessValue | % { - Set-AccessPermission -ShareName $Name -AccessPermission "Change" -Username $_ - } - } - $smbshareAccessValues = Get-SmbShareAccess -Name $Name - if ($ReadAccess -ne $null) - { - # Blow off whatever is in there and replace it with this list - $smbshareAccessValues | ? {$_.AccessControlType -eq 'Allow' -and $_.AccessRight -eq 'Read'} ` - | % { - Remove-AccessPermission -ShareName $Name -UserName $_.AccountName -AccessPermission Read - } - - $readAccessValue | % { - Set-AccessPermission -ShareName $Name -AccessPermission "Read" -Username $_ - } - } - $smbshareAccessValues = Get-SmbShareAccess -Name $Name - if ($FullAccess -ne $null) - { - # Blow off whatever is in there and replace it with this list - $smbshareAccessValues | ? {$_.AccessControlType -eq 'Allow' -and $_.AccessRight -eq 'Full'} ` - | % { - Remove-AccessPermission -ShareName $Name -UserName $_.AccountName -AccessPermission Full - } - - $fullAccessValue | % { - Set-AccessPermission -ShareName $Name -AccessPermission "Full" -Username $_ - } - } - $smbshareAccessValues = Get-SmbShareAccess -Name $Name - if ($NoAccess -ne $null) - { - # Blow off whatever is in there and replace it with this list - $smbshareAccessValues | ? {$_.AccessControlType -eq 'Deny'} ` - | % { - Remove-AccessPermission -ShareName $Name -UserName $_.AccountName -AccessPermission No - } - $noAccessValue | % { - Set-AccessPermission -ShareName $Name -AccessPermission "No" -Username $_ - } - } - } - } - else - { - Write-Verbose "Removing share $Name to ensure it is Absent" - Remove-SmbShare -name $Name -Force - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $Path, - - [System.String] - $Description, - - [System.String[]] - $ChangeAccess, - - [System.UInt32] - $ConcurrentUserLimit, - - [System.Boolean] - $EncryptData, - - [ValidateSet("AccessBased","Unrestricted")] - [System.String] - $FolderEnumerationMode, - - [System.String[]] - $FullAccess, - - [System.String[]] - $NoAccess, - - [System.String[]] - $ReadAccess, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = 'Present' - ) - $testResult = $false; - $share = Get-TargetResource -Name $Name -Path $Path -ErrorAction SilentlyContinue -ErrorVariable ev - if ($Ensure -ne "Absent") - { - if ($share.Ensure -eq "Absent") - { - $testResult = $false - } - elseif ($share.Ensure -eq "Present") - { - $Params = 'Name', 'Path', 'Description', 'ChangeAccess', 'ConcurrentUserLimit', 'EncryptData', 'FolderEnumerationMode', 'FullAccess', 'NoAccess', 'ReadAccess', 'Ensure' - if ($PSBoundParameters.Keys.Where({$_ -in $Params}) | ForEach-Object {Compare-Object -ReferenceObject $PSBoundParameters.$_ -DifferenceObject $share.$_}) - { - $testResult = $false - } - else - { - $testResult = $true - } - } - } - else - { - if ($share.Ensure -eq "Absent") - { - $testResult = $true - } - else - { - $testResult = $false - } - } - - $testResult -} - -Export-ModuleMember -Function *-TargetResource - diff --git a/lib/puppet_x/dsc_resources/xSmbShare/DscResources/MSFT_xSmbShare/MSFT_xSmbShare.schema.mof b/lib/puppet_x/dsc_resources/xSmbShare/DscResources/MSFT_xSmbShare/MSFT_xSmbShare.schema.mof deleted file mode 100644 index 23285d8e..00000000 --- a/lib/puppet_x/dsc_resources/xSmbShare/DscResources/MSFT_xSmbShare/MSFT_xSmbShare.schema.mof +++ /dev/null @@ -1,23 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xSmbShare")] -class MSFT_xSmbShare : OMI_BaseResource -{ - [Key, Description("Name of the SMB Share")] String Name; - [Required, Description("Path to the share")] String Path; - [Write, Description("Description of the share")] String Description; - [Write, Description("Specifies which user will be granted modify permission to access the share")] String ChangeAccess[]; - [Write, Description("Specifies the maximum number of concurrently connected users that the new SMB share may accommodate. If this parameter is set to zero (0), then the number of users is unlimited. The default value is zero (0).")] Uint32 ConcurrentUserLimit; - [Write, Description("Indicates that the share is encrypted.")] Boolean EncryptData; - [Write, Description("Specifies which files and folders in the new SMB share are visible to users."), ValueMap{"AccessBased","Unrestricted"}, Values{"AccessBased","Unrestricted"}] String FolderEnumerationMode; - [Write, Description("Specifies which accounts are granted full permission to access the share.")] String FullAccess[]; - [Write, Description("Specifies which accounts are denied access to the share.")] String NoAccess[]; - [Write, Description("Specifies which user is granted read permission to access the share.")] String ReadAccess[]; - [Write, Description("Specifies if the share should be added or removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Read, Description("Specfies the state of the share")] String ShareState; - [Read, Description("Specfies the type of the share")] String ShareType; - [Read, Description("Specifies if this share is a ShadowCopy")] String ShadowCopy; - [Read, Description("Specifies if this share is a Special Share. Admin share, default shares, IPC$ share are examples.")] String Special; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xSmbShare/LICENSE b/lib/puppet_x/dsc_resources/xSmbShare/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xSmbShare/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xSmbShare/xSmbShare.psd1 b/lib/puppet_x/dsc_resources/xSmbShare/xSmbShare.psd1 deleted file mode 100644 index e3887199..00000000 --- a/lib/puppet_x/dsc_resources/xSmbShare/xSmbShare.psd1 +++ /dev/null @@ -1,62 +0,0 @@ -@{ -# Version number of this module. -ModuleVersion = '2.0.0.0' - -# ID used to uniquely identify this module -GUID = '8831ca9a-3c47-4a5b-b401-29635dd24381' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2013 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'Module with DSC Resources for SmbShare area' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Minimum version of the common language runtime (CLR) required by this module -CLRVersion = '4.0' - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/xSmbShare/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/xSmbShare' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - ReleaseNotes = '* Converted appveyor.yml to install Pester from PSGallery instead of from Chocolatey. -* Added default value of "Present" for the Ensure parameter. (Note: due to how the module"s logic is written, this is a breaking change; DSC configs that did not specify a value for Ensure would have behaved as though it were set to Present in the Test-TargetResource function, but to absent in Set-TargetResource, removing the share instead of creating it.) - -' - - } # End of PSData hashtable - -} # End of PrivateData hashtable -} - - - - diff --git a/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlAlias/MSFT_xSqlAlias.psm1 b/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlAlias/MSFT_xSqlAlias.psm1 deleted file mode 100644 index 5ca3f2d5..00000000 --- a/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlAlias/MSFT_xSqlAlias.psm1 +++ /dev/null @@ -1,324 +0,0 @@ -# -# xSqlAlias: DSC resource to configure Client Aliases -# - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name - ) - - Write-Verbose -Message 'Get-TargetResource' - - $returnValue = @{ - Name = [System.String] - Protocol = [System.String] - ServerName = [System.String] - TCPPort = [System.Int32] - PipeName = [System.String] - Ensure = [System.String] - } - - if ($null -ne (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo' -Name "$Name" -ErrorAction SilentlyContinue)) - { - $ItemValue = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo' -Name "$Name" - - $returnValue.Name = $Name - $ItemConfig = $ItemValue."$Name" -split ',' - if ($ItemConfig[0] -eq 'DBMSSOCN') - { - $returnValue.Protocol = 'TCP' - $returnValue.ServerName = $ItemConfig[1] - $returnValue.TCPPort = $ItemConfig[2] - } - else - { - $returnValue.Protocol = 'NP' - $returnValue.PipeName = $ItemConfig[1] - } - } - $returnValue -} - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name, - - [ValidateSet("TCP","NP")] - [System.String] - $Protocol, - - [System.String] - $ServerName, - - [System.Int32] - $TCPPort, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure - ) - - Write-Verbose -Message 'Set-TargetResource' - - $ItemValue = [System.String] - - if ($Protocol -eq 'NP') - { - $ItemValue = "DBNMPNTW,\\$ServerName\PIPE\sql\query" - } - - if ($Protocol -eq 'TCP') - { - $ItemValue = "DBMSSOCN,$ServerName,$TCPPort" - } - - # Logic based on Ensure value - if ($Ensure -eq 'Present') - { - # Update the registry - if (Test-Path 'HKLM:\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo') - { - Write-Debug -Message 'Check if value requires changing' - $CurrentValue = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo' -Name "$Name" -ErrorAction SilentlyContinue - if ($ItemValue -ne ($CurrentValue).$Name) - { - Write-Debug -Message 'Set-ItemProperty' - Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo' -Name "$Name" -Value $ItemValue | Out-Null - } - } - else - { - Write-Debug -Message 'New-Item' - New-Item -Path 'HKLM:\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo' | Out-Null - Write-Debug -Message 'New-ItemProperty' - New-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo' -Name "$Name" -Value $ItemValue | Out-Null - } - - Write-Debug -Message 'Check OSArchitecture' - # If this is a 64 bit machine also update Wow6432Node - if ((Get-Wmiobject -class win32_OperatingSystem).OSArchitecture -eq '64-bit') - { - Write-Debug -Message 'Is 64Bit' - if (Test-Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\MSSQLServer\Client\ConnectTo') - { - Write-Debug -Message 'Check if value requires changing' - $CurrentValue = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\MSSQLServer\Client\ConnectTo' -Name "$Name" -ErrorAction SilentlyContinue - if ($ItemValue -ne ($CurrentValue).$Name) - { - Write-Debug -Message 'Set-ItemProperty' - Set-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\MSSQLServer\Client\ConnectTo' -Name "$Name" -Value $ItemValue | Out-Null - } - } - else - { - Write-Debug -Message 'New-Item' - New-Item -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\MSSQLServer\Client\ConnectTo' | Out-Null - Write-Debug -Message 'New-ItemProperty' - New-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\MSSQLServer\Client\ConnectTo' -Name "$Name" -Value $ItemValue | Out-Null - } - } - } - - - # Logic based on Ensure value - if ($Ensure -eq 'Absent') - { - # If the base path doesn't exist then we don't need to do anything - if (Test-Path 'HKLM:\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo') - { - Write-Debug -Message 'Remove-ItemProperty' - Remove-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo' -Name "$Name" | Out-Null - - Write-Debug -Message 'Check OSArchitecture' - # If this is a 64 bit machine also update Wow6432Node - if ((Get-Wmiobject -class win32_OperatingSystem).OSArchitecture -eq '64-bit' -and (Test-Path -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\MSSQLServer\Client\ConnectTo')) - { - Write-Debug -Message 'Remove-ItemProperty Wow6432Node' - Remove-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\MSSQLServer\Client\ConnectTo' -Name "$Name" - } - } - } -} - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name, - - [ValidateSet("TCP","NP")] - [System.String] - $Protocol, - - [System.String] - $ServerName, - - [System.Int32] - $TCPPort, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure - ) - - Write-Debug -Message 'Test-TargetResource' - - $result = [System.Boolean]$true - - if (Test-Path -Path 'HKLM:\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo') - { - Write-Debug -Message 'Alias registry container exists' - if ($null -ne (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo' -Name "$Name" -ErrorAction SilentlyContinue)) - { - Write-Debug -Message 'Existing alias found' - if ($Ensure -eq 'Present') - { - $ItemValue = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo' -Name "$Name" - - $ItemConfig = $ItemValue."$Name" -split ',' - - if ($Protocol -eq 'NP') - { - Write-Debug -Message 'Named Pipes' - if ($ItemConfig[0] -ne 'DBNMPNTW') - { - $result = $false - } - - if ($ItemConfig[1] -ne "\\$ServerName\PIPE\sql\query") - { - $result = $false - } - } - - if ($Protocol -eq 'TCP') - { - Write-Debug -Message 'TCP' - if ($ItemConfig[0] -ne 'DBMSSOCN') - { - $result = $false - } - - if ($ItemConfig[1] -ne $ServerName) - { - $result = $false - } - - if ($ItemConfig[2] -ne $TCPPort) - { - $result = $false - } - } - - # If this is a 64 bit machine also check Wow6432Node - if ((Get-Wmiobject -class win32_OperatingSystem).OSArchitecture -eq '64-bit') - { - Write-Debug -Message 'Wow6432Node' - if ($null -ne (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\MSSQLServer\Client\ConnectTo' -Name "$Name" -ErrorAction SilentlyContinue)) - { - Write-Debug -Message 'Existing alias found' - $ItemValue = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\MSSQLServer\Client\ConnectTo' -Name "$Name" - - $ItemConfig = $ItemValue."$Name" -split ',' - - if ($Protocol -eq 'NP') - { - Write-Debug -Message 'Named Pipes' - if ($ItemConfig[0] -ne 'DBNMPNTW') - { - $result = $false - } - - if ($ItemConfig[1] -ne "\\$ServerName\PIPE\sql\query") - { - $result = $false - } - } - - if ($Protocol -eq 'TCP') - { - Write-Debug -Message 'TCP' - if ($ItemConfig[0] -ne 'DBMSSOCN') - { - $result = $false - } - - if ($ItemConfig[1] -ne $ServerName) - { - $result = $false - } - - if ($ItemConfig[2] -ne $TCPPort) - { - $result = $false - } - } - } - else - { - $result = $false - } - } - } - else - { - $result = $false - } - } - else - { - if ($Ensure -eq 'Present') - { - $result = $false - } - else - { - $result = $true - } - } - } - else - { - if ($Ensure -eq 'Present') - { - $result = $false - } - else - { - $result = $true - } - } - - Write-Debug -Message "Test-TargetResource Result: $result" - - Return $result - -} - - - - - -Export-ModuleMember -Function *-TargetResource - - - - diff --git a/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlAlias/MSFT_xSqlAlias.schema.mof b/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlAlias/MSFT_xSqlAlias.schema.mof deleted file mode 100644 index 87f036ff..00000000 --- a/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlAlias/MSFT_xSqlAlias.schema.mof +++ /dev/null @@ -1,12 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xSqlAlias")] -class MSFT_xSqlAlias : OMI_BaseResource -{ - [Key] String Name; - [Write, ValueMap{"TCP","NP"}, Values{"TCP","NP"}] String Protocol; - [Write] String ServerName; - [Write] Sint32 TCPPort; - [Read] String PipeName; - [Write, ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; -}; - diff --git a/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlHAEndPoint/MSFT_xSqlHAEndPoint.psm1 b/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlHAEndPoint/MSFT_xSqlHAEndPoint.psm1 deleted file mode 100644 index d7a45d02..00000000 --- a/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlHAEndPoint/MSFT_xSqlHAEndPoint.psm1 +++ /dev/null @@ -1,156 +0,0 @@ -# -# xSqlEndPoint: DSC resouce to configure the given instance of Sql High Availability Service to listen port 5022 -# with given name, and to assign $AllowedUser to communicate the service through that endpoint. -# - -# -# The Get-TargetResource cmdlet. -# -function Get-TargetResource -{ - param - ( - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $InstanceName, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $AllowedUser, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $Name, - - [ValidateRange(1000,9999)] - [Uint32] $PortNumber = 5022 - ) - - $bConfigured = Test-TargetResource -InstanceName $InstanceName -AllowedUser $AllowedUser -Name $Name - - $returnValue = @{ - ServerInstance = $InstanceName - AllowedUser = $AllowedUser - EndPointName = $Name - PortNumber = $PortNumber - Configured = $bConfigured - } - - $returnValue -} - -# -# The Set-TargetResource cmdlet. -# -function Set-TargetResource -{ - param - ( - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $InstanceName, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $AllowedUser, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $Name, - - [ValidateRange(1000,9999)] - [Uint32] $PortNumber = 5022 - ) - - Write-Verbose -Message "Set EndPoint $Name on instance $InstanceName ..." - - try - { - $endpoint = New-SqlHadrEndpoint $Name -Port $PortNumber -Path "SQLSERVER:\SQL\$InstanceName" - Set-SqlHadrEndpoint -InputObject $endpoint -State "Started" - - OSQL -S $InstanceName -E -Q "GRANT CONNECT ON ENDPOINT::[$Name] TO [$AllowedUser]" - } - catch { - Write-Verbose -Message "Set EndPoint $Name on instance $InstanceName reached exception." - throw $_ - } - -} - -# -# The Test-TargetResource cmdlet. -# -function Test-TargetResource -{ - param - ( - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $InstanceName, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $AllowedUser, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $Name, - - [ValidateRange(1000,9999)] - [Uint32] $PortNumber = 5022 - ) - - if (!(Check-SqlInstance -InstanceName $InstanceName)) - { - Write-Verbose -Message "Can't find Sql Server instance $InstanceName" - return $false - } - - - Write-Verbose -Message "Test EndPoint $Name on instance $InstanceName ..." - - $endpoint = OSQL -S $InstanceName -E -Q "select count(*) from master.sys.endpoints where name = '$Name'" -h-1 - - return ([bool] [int] $endpoint[0].Trim() ) -} - -function Get-PureInstanceName ($InstanceName) -{ - $list = $InstanceName.Split("\") - if ($list.Count -gt 1) - { - $list[1] - } - else - { - "MSSQLSERVER" - } -} - -function Check-SqlInstance($InstanceName) -{ - $list = Get-Service -Name MSSQL* - $retInstanceName = $null - - $pureInstanceName = Get-PureInstanceName -InstanceName $InstanceName - - if ($pureInstanceName -eq "MSSQLSERVER") - { - if ($list.Name -contains "MSSQLSERVER") - { - $retInstanceName = $InstanceName - } - } - elseif ($list.Name -contains $("MSSQL$" + $pureInstanceName)) - { - Write-Verbose -Message "SQL Instance $InstanceName is present" - $retInstanceName = $pureInstanceName - } - - return ($retInstanceName -ne $null) -} - - -Export-ModuleMember -Function *-TargetResource - diff --git a/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlHAEndPoint/MSFT_xSqlHAEndPoint.schema.mof b/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlHAEndPoint/MSFT_xSqlHAEndPoint.schema.mof deleted file mode 100644 index 491b6987..00000000 --- a/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlHAEndPoint/MSFT_xSqlHAEndPoint.schema.mof +++ /dev/null @@ -1,12 +0,0 @@ -#pragma namespace("\\\\.\\root\\microsoft\\windows\\DesiredStateConfiguration") - -[ClassVersion("1.0.0"), FriendlyName("xSqlHAEndPoint")] -class MSFT_xSqlHAEndPoint : OMI_BaseResource -{ - [key, Description("Name of Sql Instance.")] string InstanceName; - - [required, Description("Windows Account that could access the HA database mirroring endpoing.")] string AllowedUser; - [key, Description("Unique name for HA database mirroring endpoint of the sql instance.")] string Name; - [write, Description("The single port number(nnnn) on which the Sql HA to listen to.")] Uint32 PortNumber; -}; - diff --git a/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlHAGroup/MSFT_xSqlHAGroup.psm1 b/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlHAGroup/MSFT_xSqlHAGroup.psm1 deleted file mode 100644 index f761fc32..00000000 --- a/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlHAGroup/MSFT_xSqlHAGroup.psm1 +++ /dev/null @@ -1,422 +0,0 @@ -# -# xSqlHAGroup: DSC resource to configure a Sql High Availability (HA) Group. If the HA Group does not exist, it will -# create one with given name on given sql instance, it also adds the database(s) to the group. If the HA group -# already exists, it will join sql instance to the group, replicate the database(s) in the group to local instance. -# - -# -# The Get-TargetResource cmdlet. -# -function Get-TargetResource -{ - param - ( - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $Name, - - [parameter(Mandatory)] - [ValidateNotNull()] - [string[]] $Database, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $ClusterName, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $DatabaseBackupPath, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $InstanceName, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $EndpointName, - - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [PSCredential] $DomainCredential, - - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [PSCredential] $SqlAdministratorCredential - ) - - if ($Database.Count -lt 1) - { - throw "Parameter Database does not have any database" - } - - $bConfigured = Test-TargetResource -Name $Name -Database $Database -ClusterName $ClusterName -DatabaseBackupPath $DatabaseBackupPath -InstanceName $InstanceName -EndpointName $EndpointName -DomainCredential $DomainCredential -SqlAdministratorCredential $SqlAdministratorCredential - - $returnValue = @{ - - Database = $Database - Name = $Name - ClusterName = $ClusterName - DatabaseBackupPath = $DatabaseBackupPath - InstanceName = $InstanceName - EndpointName = $EndpointName - - DomainCredential = $DomainCredential.UserName - SqlAdministratorCredential = $SqlAdministratorCredential.UserName - - Configured = $bConfigured - } - - $returnValue -} - -# -# The Set-TargetResource cmdlet. -# -function Set-TargetResource -{ - param - ( - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $Name, - - [parameter(Mandatory)] - [ValidateNotNull()] - [string[]] $Database, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $ClusterName, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $DatabaseBackupPath, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $InstanceName, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $EndpointName, - - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [PSCredential] $DomainCredential, - - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [PSCredential] $SqlAdministratorCredential - ) - - if ($Database.Count -lt 1) - { - throw "Parameter Database does not have any database" - } - - Write-Verbose -Message "Checking if SQL HAG $Name is present ..." - Write-Verbose -Message "Cluster: $ClusterName, Database: $Database" - - $bHAGExist = $false - $primaryReplica = $InstanceName - - $sa = $SqlAdministratorCredential.UserName - $saPassword = $SqlAdministratorCredential.GetNetworkCredential().Password - - try - { - ($oldToken, $context, $newToken) = ImpersonateAs -cred $DomainCredential - $nodes = Get-ClusterNode -Cluster $ClusterName - } - finally - { - if ($context) - { - $context.Undo() - $context.Dispose() - - CloseUserToken($newToken) - } - } - - foreach ($node in $nodes.Name) - { - $instance = Get-SQLInstanceName -node $node -InstanceName $InstanceName - - $bCheck = Check-SQLHAGroup -InstanceName $instance -Name $Name -sa $sa -saPassword $saPassword - if ($bCheck) - { - Write-Verbose -Message "Found SQL HAG $Name on instance $instance" - $bHAGExist = $true - - # check if it is the primary replica - $bPrimaryCheck = Check-SQLHAGroupPrimaryReplica -InstanceName $instance -Name $Name -sa $sa -saPassword $saPassword - if ($bPrimaryCheck) - { - $primaryReplica = $instance - } - } - } - - if ($bHAGExist) - { - Write-Verbose -Message "Add instance $InstanceName to SQL HAG $Name" - - $bCheckPreviousInstance = Check-SQLHAGroupReplicaExist -InstanceName $InstanceName -Name $Name -PrimaryInstanceName $primaryReplica -sa $sa -saPassword $saPassword - if ($bCheckPreviousInstance) - { - Write-Verbose -Message "SQLHAGroup $Name already has the instance $InstanceName, clean up first" - $query = "alter availability group $Name ` - remove replica on '$InstanceName'" - - Write-Verbose -Message "Query: $query" - osql -S $primaryReplica -U $sa -P $saPassword -Q $query - } - - - # Add this instance to HAG group on instance $primaryInstance - $query = "alter availability group $Name ` - add replica on '$InstanceName' with ` - ( ` - EndPoint_URL = 'TCP://$EndpointName', ` - Availability_Mode = Synchronous_Commit, ` - Failover_Mode = Automatic, ` - Secondary_Role(Allow_connections = ALL) ` - ) " - - Write-Verbose -Message "Query: $query" - osql -S $primaryReplica -U $sa -P $saPassword -Q $query - - # Add this node to HAG - osql -S $InstanceName -U $sa -P $saPassword -Q "ALTER AVAILABILITY GROUP $Name JOIN" - - # restore database - foreach($db in $Database) - { - $query = "restore database $db from disk = '$DatabaseBackupPath\$db.bak' with norecovery" - Write-Verbose -Message "Instance $InstanceName Query: $query" - osql -S $InstanceName -U $sa -P $saPassword -Q $query - - - $query = "restore log $db from disk = '$DatabaseBackupPath\$db.log' with norecovery " - Write-Verbose -Message "Query: $query" - osql -S $InstanceName -U $sa -P $saPassword -Q $query - - # Add database to HAG - osql -S $InstanceName -U $sa -P $saPassword -Q "ALTER DATABASE $db SET HADR AVAILABILITY GROUP = $Name" - } - } - - else # create - { - Write-Verbose -Message "Create SQL HAG $Name and primary instance $InstanceName" - - foreach($db in $Database) - { - Write-Verbose -Message "Create database $db ..." - osql -S $InstanceName -U $sa -P $saPassword -Q "if not exists (select * from master.sys.databases where name = '$db') begin Create database $db end;" - - Write-Verbose -Message "Backup to $DatabaseBackupPath .." - osql -S $InstanceName -U $sa -P $saPassword -Q "backup database $db to disk = '$DatabaseBackupPath\$db.bak' with format" - } - - $dblist = "$Database" -replace " ", ", " - - Write-Verbose -Message "AG: $Name " - $query = "Create Availability Group $Name ` - For Database $Database ` - Replica ON ` - '$InstanceName' with ` - ( ` - ENDPOINT_URL = 'TCP://$EndpointName', ` - Availability_Mode = Synchronous_Commit, ` - Failover_Mode = Automatic ` - )" - - Write-Verbose -Message "Create HAG : $query.." - osql -S $InstanceName -U $sa -P $saPassword -Q $query - - foreach($db in $Database) - { - Write-Verbose -Message "Backup Log to $DatabaseBackupPath .." - osql -S $InstanceName -U $sa -P $saPassword -Q "backup log $db to disk = '$DatabaseBackupPath\$db.log' with NOFormat" - } - } - - -} - -# -# The Test-TargetResource cmdlet. -# -function Test-TargetResource -{ - param - ( - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $Name, - - [parameter(Mandatory)] - [ValidateNotNull()] - [string[]] $Database, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $ClusterName, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $DatabaseBackupPath, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $InstanceName, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $EndpointName, - - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [PSCredential] $DomainCredential, - - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [PSCredential] $SqlAdministratorCredential - ) - - if ($Database.Count -lt 1) - { - throw "Parameter Database does not have any database" - } - - Write-Verbose -Message "Checking if SQL HA Group $Name on instance $InstanceName present ..." - - $sa = $SqlAdministratorCredential.UserName - $saPassword = $SqlAdministratorCredential.GetNetworkCredential().Password - - $bFound = Check-SQLHAGroup -InstanceName $InstanceName -Name $Name -sa $sa -saPassword $saPassword - if ($bFound) - { - Write-Verbose -Message "SQL HA Group $Name is present" - $true - } - else - { - Write-Verbose -Message "SQL HA Group $Name not found" - $false - } -} - - -function Check-SQLHAGroup($InstanceName, $Name, $sa, $saPassword) -{ - Write-Verbose -Message "Check HAG $Name including instance $InstanceName ..." - $query = OSQL -S $InstanceName -U $sa -P $saPassword -Q "select count(name) from master.sys.availability_groups where name = '$Name'" -h-1 - - Write-Verbose -Message "SQL: $query" - - [bool] [int] ([String] $query[0]).Trim() -} - - -function Check-SQLHAGroupPrimaryReplica($InstanceName, $Name, $sa, $saPassword) -{ - $query = OSQL -S $InstanceName -U $sa -P $saPassword -Q "select count(replica_id) from sys.dm_hadr_availability_replica_states s ` - inner join sys.availability_groups g on g.group_id = s.group_id ` - where g.name = '$Name' and s.role_desc = 'PRIMARY' and s.is_local = 1" -h-1 - [bool] [int] ([string] $query[0]).Trim() -} - -function Check-SQLHAGroupReplicaExist($InstanceName, $Name, $PrimaryInstanceName, $sa, $saPassword) -{ - $query = OSQL -S $PrimaryInstanceName -U $sa -P $saPassword -Q "select count(replica_id) from sys.availability_replicas r ` - inner join sys.availability_groups g on g.group_id = r.group_id ` - where g.name = '$Name' and r.replica_server_name = '$InstanceName' " -h-1 - [bool] [int] ([string] $query[0]).Trim() - -} - -function Get-PureInstanceName ($InstanceName) -{ - $list = $InstanceName.Split("\") - if ($list.Count -gt 1) - { - $list[1] - } - else - { - "MSSQLSERVER" - } -} - -function Get-SQLInstanceName ($node, $InstanceName) -{ - $pureInstanceName = Get-PureInstanceName -InstanceName $InstanceName - - if ("MSSQLSERVER" -eq $pureInstanceName) - { - $node - } - else - { - $node + "\" + $pureInstanceName - } -} - - -function Get-ImpersonatetLib -{ - if ($script:ImpersonateLib) - { - return $script:ImpersonateLib - } - - $sig = @' -[DllImport("advapi32.dll", SetLastError = true)] -public static extern bool LogonUser(string lpszUsername, string lpszDomain, string lpszPassword, int dwLogonType, int dwLogonProvider, ref IntPtr phToken); - -[DllImport("kernel32.dll")] -public static extern Boolean CloseHandle(IntPtr hObject); -'@ - $script:ImpersonateLib = Add-Type -PassThru -Namespace 'Lib.Impersonation' -Name ImpersonationLib -MemberDefinition $sig - - return $script:ImpersonateLib - -} - -function ImpersonateAs([PSCredential] $cred) -{ - [IntPtr] $userToken = [Security.Principal.WindowsIdentity]::GetCurrent().Token - $userToken - $ImpersonateLib = Get-ImpersonatetLib - - $bLogin = $ImpersonateLib::LogonUser($cred.GetNetworkCredential().UserName, $cred.GetNetworkCredential().Domain, $cred.GetNetworkCredential().Password, - 9, 0, [ref]$userToken) - - if ($bLogin) - { - $Identity = New-Object Security.Principal.WindowsIdentity $userToken - $context = $Identity.Impersonate() - } - else - { - throw "Can't Logon as User $cred.GetNetworkCredential().UserName." - } - $context, $userToken -} - -function CloseUserToken([IntPtr] $token) -{ - $ImpersonateLib = Get-ImpersonatetLib - - $bLogin = $ImpersonateLib::CloseHandle($token) - if (!$bLogin) - { - throw "Can't close token" - } -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlHAGroup/MSFT_xSqlHAGroup.schema.mof b/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlHAGroup/MSFT_xSqlHAGroup.schema.mof deleted file mode 100644 index 436e2d2f..00000000 --- a/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlHAGroup/MSFT_xSqlHAGroup.schema.mof +++ /dev/null @@ -1,19 +0,0 @@ -#pragma namespace("\\\\.\\root\\microsoft\\windows\\DesiredStateConfiguration") - -[ClassVersion("1.0.0"), FriendlyName("xSqlHAGroup")] -class MSFT_xSqlHAGroup : OMI_BaseResource -{ - [key, Description("The name of sql availability group")] string Name; - [required, Description("Array of databases on the local sql instance. Each database can belong to only one HA group.")] string Database[]; - [required, Description("The name of windows failover cluster for the availability group")] string ClusterName; - [required, Description("The net share for Sql replication initialization")] string DatabaseBackupPath; - [required, Description("Name of sql instance")] string InstanceName; - [required, Description("Name of EndPoint to access High Availability sql instance.")] string EndPointName; - - [Required, EmbeddedInstance("MSFT_Credential"), Description("Domain credential could get list of cluster nodes.")] - String DomainCredential; - - [Required, EmbeddedInstance("MSFT_Credential"), Description("Sql sa credential.")] - String SqlAdministratorCredential; -}; - diff --git a/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlHAService/MSFT_xSqlHAService.psm1 b/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlHAService/MSFT_xSqlHAService.psm1 deleted file mode 100644 index 56af5784..00000000 --- a/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlHAService/MSFT_xSqlHAService.psm1 +++ /dev/null @@ -1,223 +0,0 @@ -# -# xSQLService: DSC resource to enable Sql High Availability (HA) service on the given sql instance. -# - - -function RestartSqlServer() -{ - $list = Get-Service -Name MSSQL* - - foreach ($s in $list) - { - Set-Service -Name $s.Name -StartupType Automatic - if ($s.Status -ne "Stopped") - { - $s.Stop() - $s.WaitForStatus("Stopped") - $s.Refresh() - } - if ($s.Status -ne "Running") - { - $s.Start() - $s.WaitForStatus("Running") - $s.Refresh() - } - } -} - -function IsSQLLogin($SqlInstance, $SAPassword, $Login ) -{ - $query = OSQL -S $SqlInstance -U sa -P $SAPassword -Q "select count(name) from master.sys.server_principals where name = '$Login'" -h-1 - return ($query[0].Trim() -eq "1") -} - -function IsSrvRoleMember($SqlInstance, $SAPassword, $Login ) -{ - $query = OSQL -S $SqlInstance -U sa -P $SAPassword -Q "select IS_srvRoleMember('sysadmin', '$Login')" -h-1 - return ($query[0].Trim() -eq "1") -} - -function IsHAEnabled($SqlInstance, $SAPassword) -{ - $query = OSQL -S $SqlInstance -U sa -P $SAPassword -Q "select ServerProperty('IsHadrEnabled')" -h-1 - return ($query[0].Trim() -eq "1") -} - -# -# The Get-TargetResource cmdlet. -# -function Get-TargetResource -{ - param - ( - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $InstanceName, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [PSCredential] $SqlAdministratorCredential, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [PSCredential]$ServiceCredential - ) - - Write-Verbose -Message "Set SQL Service configuration ..." - - $SAPassword = $SqlAdministratorCredential.GetNetworkCredential().Password - - $ServiceAccount = $ServiceCredential.UserName - - - $bServiceAccountInSqlLogin = IsSQLLogin -SqlInstance $InstanceName -SAPassword $SAPassword -Login $ServiceAccount - - $bServiceAccountInSrvRole = IsSrvRoleMember -SqlInstance $InstanceName -SAPassword $SAPassword -Login $ServiceCredential.UserName - - $bSystemAccountInSrvRole = IsSrvRoleMember -SqlInstance $InstanceName -SAPassword $SAPassword -Login "NT AUTHORITY\SYSTEM" - - $bHAEnabled = IsHAEnabled -SqlInstance $InstanceName -SAPassword $SAPassword - - return @{ - ServiceAccount = $ServiceAccount - ServiceAccountInSqlLogin = $bServiceAccountInSqlLogin - ServiceAccountInSrvRole = $bServiceAccountInSrvRole - SystemAccountInSrvRole = $bSystemAccountInSrvRole - HAEnabled = $bHAEnabled - } -} - -# -# The Set-TargetResource cmdlet. -# -function Set-TargetResource -{ - param - ( - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $InstanceName, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [PSCredential] $SqlAdministratorCredential, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [PSCredential]$ServiceCredential - ) - - Write-Verbose -Message "Set SQL Service configuration ..." - - $SAPassword = $SqlAdministratorCredential.GetNetworkCredential().Password - - $ServiceAccount = $ServiceCredential.UserName - $ServicePassword = $ServiceCredential.GetNetworkCredential().Password - - $bCheck = IsSQLLogin -SqlInstance $InstanceName -SAPassword $SAPassword -Login $ServiceAccount - if ($false -eq $bCheck) - { - osql -S $InstanceName -U sa -P $SAPassword -Q "Create Login [$ServiceAccount] From Windows" - } - - $bCheck = IsSrvRoleMember -SqlInstance $InstanceName -SAPassword $SAPassword -Login $ServiceAccount - if ($false -eq $bCheck) - { - osql -S $InstanceName -U sa -P $SAPassword -Q "Exec master.sys.sp_addsrvrolemember '$ServiceAccount', 'sysadmin'" - } - - $bCheck = IsSrvRoleMember -SqlInstance $InstanceName -SAPassword $SAPassword -Login "NT AUTHORITY\SYSTEM" - if ($false -eq $bCheck) - { - osql -S $InstanceName -U sa -P $SAPassword -Q "Exec master.sys.sp_addsrvrolemember 'NT AUTHORITY\SYSTEM', 'sysadmin'" - } - - $serviceName = Get-SqlServiceName -InstanceName $InstanceName - $service = Get-WmiObject Win32_Service | ? { $_.Name -eq $serviceName } - $service.Change($null,$null,$null,$null,$null,$null,$ServiceAccount,$ServicePassword,$null,$null,$null) - - RestartSqlServer - - $bCheck = IsHAEnabled -SqlInstance $InstanceName -SAPassword $SAPassword - if ($false -eq $bCheck) - { - Enable-SqlAlwaysOn -ServerInstance $InstanceName -Force - RestartSqlServer - } - - # Tell the DSC Engine to restart the machine - #$global:DSCMachineStatus = 1 -} - -# -# The Test-TargetResource cmdlet. -# -function Test-TargetResource -{ - param - ( - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $InstanceName, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [PSCredential] $SqlAdministratorCredential, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [PSCredential]$ServiceCredential - ) - - Write-Verbose -Message "Test SQL Service configuration ..." - - $SAPassword = $SqlAdministratorCredential.GetNetworkCredential().Password - $ServiceAccount = $ServiceCredential.UserName - - $ret = IsSQLLogin -SqlInstance $InstanceName -SAPassword $SAPassword -Login $ServiceAccount - if ($false -eq $ret) - { - Write-Verbose -Message "$ServiceAccount is NOT in SqlServer login" - return $false - } - - $ret = IsSrvRoleMember -SqlInstance $InstanceName -SAPassword $SAPassword -Login $ServiceCredential.UserName - if ($false -eq $ret) - { - Write-Verbose -Message "$ServiceCredential.UserName is NOT in admin role" - return $false - } - - $ret = IsSrvRoleMember -SqlInstance $InstanceName -SAPassword $SAPassword -Login "NT AUTHORITY\SYSTEM" - if ($false -eq $ret) - { - Write-Verbose -Message "NT AUTHORITY\SYSTEM is NOT in admin role" - return $false - } - - $ret = IsHAEnabled -SqlInstance $InstanceName -SAPassword $SAPassword - if ($false -eq $ret) - { - Write-Verbose -Message "$InstanceName does NOT enable SQL HA." - return $false - } - - return $ret -} - - -function Get-SqlServiceName ($InstanceName) -{ - $list = $InstanceName.Split("\") - if ($list.Count -gt 1) - { - "MSSQL$" + $list[1] - } - else - { - "MSSQLSERVER" - } -} - -Export-ModuleMember -Function *-TargetResource - diff --git a/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlHAService/MSFT_xSqlHAService.schema.mof b/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlHAService/MSFT_xSqlHAService.schema.mof deleted file mode 100644 index b54da508..00000000 --- a/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlHAService/MSFT_xSqlHAService.schema.mof +++ /dev/null @@ -1,15 +0,0 @@ -#pragma namespace("\\\\.\\root\\microsoft\\windows\\DesiredStateConfiguration") - -[ClassVersion("1.0.0"), FriendlyName("xSqlHAService")] -class MSFT_xSqlHAService : OMI_BaseResource -{ - [key, Description("The name of Sql instance.")] - string InstanceName; - - [required, EmbeddedInstance("MSFT_Credential"), Description("Sql sa credential")] - string SqlAdministratorCredential; - - [required, EmbeddedInstance("MSFT_Credential"), Description("Domain credential to run sql service")] - String ServiceCredential; -}; - diff --git a/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlServerInstall/MSFT_xSqlServerInstall.psm1 b/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlServerInstall/MSFT_xSqlServerInstall.psm1 deleted file mode 100644 index 12209816..00000000 --- a/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlServerInstall/MSFT_xSqlServerInstall.psm1 +++ /dev/null @@ -1,337 +0,0 @@ -# -# xSQLServerInstall: DSC resource to install Sql Server Enterprise version. -# - -# Controls the default version identifier in paramters. -$DefaultVersionID = "120"; - -# -# The Get-TargetResource cmdlet. -# -function Get-TargetResource -{ - param - ( - [parameter(Mandatory)] - [string] $InstanceName = "MSSQLSERVER", - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $SourcePath, - - [PSCredential] $SourcePathCredential, - - [string]$VersionID=$DefaultVersionID, - - [string] $Features="SQLEngine,SSMS", - - [PSCredential] $SqlAdministratorCredential, - - [bool] $UpdateEnabled = $false, - [string] $SvcAccount = $NULL, - [string] $SysAdminAccounts = $NULL, - [string] $AgentSvcAccount = $NULL, - [string] $SqlCollation = $NULL, - [string] $InstallSqlDataDir = $NULL, - [string] $SqlTempDBDir = $NULL, - [string] $SqlUserDBDir = $NULL, - [string] $SqlUserDBLogDir = $NULL, - [string] $SqlBackupDir = $NULL - ) - - $list = Get-Service -Name MSSQL* - $retInstanceName = $null - - if ($InstanceName -eq "MSSQLSERVER") - { - if ($list.Name -contains "MSSQLSERVER") - { - $retInstanceName = $InstanceName - } - } - elseif ($list.Name -contains $("MSSQL$" + $InstanceName)) - { - Write-Verbose -Message "SQL Instance $InstanceName is present" - $retInstanceName = $InstanceName - } - - - $returnValue = @{ - InstanceName = $retInstanceName - } - - return $returnValue -} - - -# -# The Set-TargetResource cmdlet. -# -function Set-TargetResource -{ - param - ( - [parameter(Mandatory)] - [string] $InstanceName = "MSSQLSERVER", - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $SourcePath, - - [PSCredential] $SourcePathCredential, - - [string]$VersionID=$DefaultVersionID, - - [string] $Features="SQLEngine,SSMS", - - [PSCredential] $SqlAdministratorCredential, - - [bool] $UpdateEnabled = $false, - [string] $SvcAccount = $NULL, - [string] $SysAdminAccounts = $NULL, - [string] $AgentSvcAccount = $NULL, - [string] $SqlCollation = $NULL, - [string] $InstallSqlDataDir = $NULL, - [string] $SqlTempDBDir = $NULL, - [string] $SqlUserDBDir = $NULL, - [string] $SqlUserDBLogDir = $NULL, - [string] $SqlBackupDir = $NULL - ) - $LogPath = Join-Path $env:SystemDrive -ChildPath "Logs" - - if (!(Test-Path $LogPath)) - { - New-Item $LogPath -ItemType Directory - } - # SQL log from setup cmdline run output - $logFile = Join-Path $LogPath -ChildPath "sqlInstall-log-$($InstanceName).txt" - - # SQL installer path - $cmd = Join-Path $SourcePath -ChildPath "Setup.exe" - - # TCPENABLED- Specifies the state of the TCP protocol for the SQL Server service. - # NPENABLED- Specifies the state of the Named Pipes protocol for the SQL Server service - # tcp/ip and named pipes protocol needs to be enabled for web apps to access db instances. So these are being enabled as a part of default sql server installation - $cmd += " /Q /ACTION=Install /IACCEPTSQLSERVERLICENSETERMS /IndicateProgress " - $cmd += " /FEATURES=$Features /INSTANCENAME=$InstanceName " - - if ($SqlAdministratorCredential) - { - $saPwd = $SqlAdministratorCredential.GetNetworkCredential().Password - $cmd += " /TCPENABLED=1 /NPENABLED=1 /SECURITYMODE=SQL /SAPWD=$saPwd " - } - else - { - $cmd += " /TCPENABLED=1 /NPENABLED=1 " - } - - if ($UpdateEnabled) - { - $cmd += " /updateEnabled=true " - } - else - { - $cmd += " /updateEnabled=false " - } - - if ($SysAdminAccounts) - { - $cmd += " /SQLSYSADMINACCOUNTS=$SysAdminAccounts " - } - else - { - $cmd += " /SQLSYSADMINACCOUNTS=`"builtin\administrators`" " - } - - if ($SvcAccount) - { - $cmd += " /SQLSVCACCOUNT=$SvcAccount " - } - - if ($AgentSvcAccount) - { - $cmd += " /AGTSVCACCOUNT=$AgentSvcAccount " - } - - if ($SqlCollation) - { - $cmd += " /SQLCOLLATION=$SqlCollation " - } - - if ($InstallSqlDataDir) - { - $cmd += " /INSTALLSQLDATADIR=`"$InstallSqlDataDir`" " - } - - if ($SqlTempDBDir) - { - $cmd += " /SQLTEMPDBDIR=`"$SqlTempDBDir`" /SQLTEMPDBLOGDIR=`"$SqlTempDBDir`" " - } - - if ($SqlUserDBDir) - { - $cmd += " /SQLUSERDBDIR=`"$SqlUserDBDir`" " - } - - if ($SqlUserDBLogDir) - { - $cmd += " /SQLUSERDBLOGDIR=`"$SqlUserDBLogDir`" " - } - - if ($SqlBackupDir) - { - $cmd += " /SQLBACKUPDIR=`"$SqlBackupDir`" " - } - - Write-Verbose "SQL install cmdline: $cmd"; - $cmd += " > $logFile 2>&1 " - - NetUse -SharePath $SourcePath -SharePathCredential $SourcePathCredential -Ensure "Present"; - - # check that the sourcepath exists - Write-Verbose "Validating access to $SourcePath"; - if (!(Test-Path $SourcePath)) - { - # Throw an error message indicating SQL Server install media is not valid - $errorId = "InstallMediaNotFound"; - $exceptionStr = "SQL Server install media path was not found."; - $errorCategory = [System.Management.Automation.ErrorCategory]::ObjectNotFound; - $exception = New-Object System.InvalidOperationException $exceptionStr; - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null; - - $PSCmdlet.ThrowTerminatingError($errorRecord); - } - try - { - Invoke-Expression $cmd - } - finally - { - NetUse -SharePath $SourcePath -SharePathCredential $SourcePathCredential -Ensure "Absent" - } - # Check the SQL logs for installation status. - $installStatus = $false - try - { - # SQL Server log folder - $LogPath = Join-Path $env:ProgramFiles "Microsoft SQL Server\$VersionID\Setup Bootstrap\Log" - $sqlLog = Get-Content "$LogPath\summary.txt" - if($sqlLog -ne $null) - { - $message = $sqlLog | fl - if($message -ne $null) - { - # sample report when the install is succesful - # Overall summary: - # Final result: Passed - # Exit code (Decimal): 0 - $finalResult = $message[1] | Out-String - $exitCode = $message[2] | Out-String - - if(($finalResult.Contains("Passed") -eq $True) -and ($exitCode.Contains("0") -eq $True)) - { - $installStatus = $true - } - } - } - } - catch - { - Write-Verbose "SQL Installation did not succeed." - } - if($installStatus -eq $true) - { - # Tell the DSC Engine to restart the machine - $global:DSCMachineStatus = 1 - } - else - { - # Throw an error message indicating failure to install SQL Server install - $errorId = "InValidSQLServerInstall"; - $exceptionStr = "SQL Server installation did not succeed. For more details please refer to the logs under $LogPath folder." - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidResult; - $exception = New-Object System.InvalidOperationException $exceptionStr; - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord); - } -} -# -# The Test-TargetResource cmdlet. -# -function Test-TargetResource -{ - param - ( - [parameter(Mandatory)] - [string] $InstanceName = "MSSQLSERVER", - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $SourcePath, - - [PSCredential] $SourcePathCredential, - - [string]$VersionID=$DefaultVersionID, - - [string] $Features="SQLEngine,SSMS", - - [PSCredential] $SqlAdministratorCredential, - - [bool] $UpdateEnabled = $false, - [string] $SvcAccount = $NULL, - [string] $SysAdminAccounts = $NULL, - [string] $AgentSvcAccount = $NULL, - [string] $SqlCollation = $NULL, - [string] $InstallSqlDataDir = $NULL, - [string] $SqlTempDBDir = $NULL, - [string] $SqlUserDBDir = $NULL, - [string] $SqlUserDBLogDir = $NULL, - [string] $SqlBackupDir = $NULL - ) - - $info = Get-TargetResource -InstanceName $InstanceName -SourcePath $SourcePath -SqlAdministratorCredential $SqlAdministratorCredential - - return ($info.InstanceName -eq $InstanceName) -} - - - -function NetUse -{ - param - ( - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $SharePath, - - [PSCredential]$SharePathCredential, - - [string] $Ensure = "Present" - ) - - if ($null -eq $SharePathCredential) - { - return; - } - - Write-Verbose -Message "NetUse set share $SharePath ..." - - if ($Ensure -eq "Absent") - { - $cmd = "net use $SharePath /DELETE" - } - else - { - $cred = $SharePathCredential.GetNetworkCredential() - $pwd = $cred.Password - $user = $cred.Domain + "\" + $cred.UserName - $cmd = "net use $SharePath $pwd /user:$user" - } - - Invoke-Expression $cmd -} - -Export-ModuleMember -Function *-TargetResource - - diff --git a/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlServerInstall/MSFT_xSqlServerInstall.schema.mof b/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlServerInstall/MSFT_xSqlServerInstall.schema.mof deleted file mode 100644 index cdc420b2..00000000 --- a/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xSqlServerInstall/MSFT_xSqlServerInstall.schema.mof +++ /dev/null @@ -1,30 +0,0 @@ -#pragma namespace("\\\\.\\root\\microsoft\\windows\\DesiredStateConfiguration") - -[ClassVersion("1.0.0"), FriendlyName("xSqlServerInstall")] -class MSFT_xSqlServerInstall : OMI_BaseResource -{ - [key, Description("The name of sql instance.")] string InstanceName; - - [required, Description("The share path of sql server software.")] string SourcePath; - - [write, Description("The numeric version identifier for the instance to be installed")] string VersionID; - - [write,EmbeddedInstance("MSFT_Credential"), - Description("The credential that vm could use to access net share of sql server software.")] - string SourcePathCredential; - - [write, Description("List of names of Sql Server features to install")] string Features; - - [write, EmbeddedInstance("MSFT_Credential"), Description("Sql sa credential")] string SqlAdministratorCredential; - - [write, Description("Specify whether SQL server setup should discover and include product updates.")] boolean UpdateEnabled; - [write, Description("Specify the startup account for the SQL server service.")] string SvcAccount; - [write, Description("Specify logins to be members of the sysadmin role.")] string SysAdminAccounts; - [write, Description("Specify the account for SQL server agent service.")] string AgentSvcAccount; - [write, Description("Specify the default collation for SQL server")] string SqlCollation; - [write, Description("Specify the directory for SQL server system db files")] string InstallSqlDataDir; - [write, Description("Specify the directory for TempDB files.")] string SqlTempDBDir; - [write, Description("Specify the directory for UserDB data files.")] string SqlUserDBDir; - [write, Description("Specify the directory for UserDB log files.")] string SqlUserDBLogDir; - [write, Description("Specify the directory for backup files.")] string SqlBackupDir; -}; diff --git a/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xWaitForSqlHAGroup/MSFT_xWaitForSqlHAGroup.psm1 b/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xWaitForSqlHAGroup/MSFT_xWaitForSqlHAGroup.psm1 deleted file mode 100644 index 9a3a5c4e..00000000 --- a/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xWaitForSqlHAGroup/MSFT_xWaitForSqlHAGroup.psm1 +++ /dev/null @@ -1,284 +0,0 @@ -# -# xWaitForSqlHAGroup: DSC resource to wait for existency of given name of Sql HA group, it checks the state of -# the HA group with given interval until it exists or the number of retries is reached. -# - - -# -# The Get-TargetResource cmdlet. -# -function Get-TargetResource -{ - param - ( - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $Name, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $ClusterName, - - [UInt64] $RetryIntervalSec = 10, - [UInt32] $RetryCount = 10, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $InstanceName, - - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [PSCredential]$DomainCredential, - - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [PSCredential]$SqlAdministratorCredential - ) - - $sa = $SqlAdministratorCredential.UserName - $saPassword = $SqlAdministratorCredential.GetNetworkCredential().Password - - $bFound = Check-SQLHAGroup -InstanceName $InstanceName -Name $Name -sa $sa -saPassword $saPassword - - $returnValue = @{ - Name = $Name - InstanceName = $InstanceName - RetryIntervalSec = $RetryIntervalSec - RetryCount = $RetryCount - - HAGroupExist = $bFound - } - - $returnValue -} - -# -# The Set-TargetResource cmdlet. -# -function Set-TargetResource -{ - param - ( - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $Name, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $ClusterName, - - [UInt64] $RetryIntervalSec = 10, - [UInt32] $RetryCount = 10, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $InstanceName, - - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [PSCredential]$DomainCredential, - - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [PSCredential]$SqlAdministratorCredential - ) - - $bFound = $false - Write-Verbose -Message "Checking for SQL HA Group $Name on instance $InstanceName ..." - - $sa = $SqlAdministratorCredential.UserName - $saPassword = $SqlAdministratorCredential.GetNetworkCredential().Password - - for ($count = 0; $count -lt $RetryCount; $count++) - { - $bFound = Check-SQLHAGroupExist -ClusterName $ClusterName -Name $Name -domainCred $DomainCredential -sa $sa -saPassword $saPassword - if ($bFound) - { - Write-Verbose -Message "Found SQL HA Group $Name on instance $InstanceName" - break; - } - else - { - Write-Verbose -Message "SQL HA Group $Name on instance $InstanceName not found. Will retry again after $RetryIntervalSec sec" - Start-Sleep -Seconds $RetryIntervalSec - } - } - - - if (!$bFound) - { - throw "SQL HA Group $Name on instance $InstanceName not found afater $count attempt with $RetryIntervalSec sec interval" - } -} - -# -# The Test-TargetResource cmdlet. -# -function Test-TargetResource -{ - param - ( - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $Name, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $ClusterName, - - [UInt64] $RetryIntervalSec = 10, - [UInt32] $RetryCount = 10, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $InstanceName, - - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [PSCredential]$DomainCredential, - - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [PSCredential]$SqlAdministratorCredential - ) - - Write-Verbose -Message "Checking for SQL HA Group $Name on instance $InstanceName ..." - - $sa = $SqlAdministratorCredential.UserName - $saPassword = $SqlAdministratorCredential.GetNetworkCredential().Password - - $bFound = Check-SQLHAGroup -InstanceName $InstanceName -Name $Name -sa $sa -saPassword $saPassword - if ($bFound) - { - Write-Verbose -Message "Found SQL HA Group $Name on instance $InstanceName" - $true - } - else - { - Write-Verbose -Message "SQL HA Group $Name on instance $InstanceName not found" - $false - } -} - - -function Check-SQLHAGroup($InstanceName, $Name, $sa, $saPassword) -{ - $query = OSQL -S $InstanceName -U $sa -P $saPassword -Q "select count(name) from master.sys.availability_groups where name = '$Name'" -h-1 - [bool] [int] $query[0].Trim() -} - -function Check-SQLHAGroupExist($ClusterName, $Name, $sa, $saPassword, $domainCred) -{ - $bHAGExist = $false - - try - { - ($oldToken, $context, $newToken) = ImpersonateAs -cred $domainCred - $nodes = Get-ClusterNode -Cluster $ClusterName - } - finally - { - if ($context) - { - $context.Undo() - $context.Dispose() - - CloseUserToken($newToken) - } - } - - - foreach ($node in $nodes.Name) - { - $instance = Get-SQLInstanceName -node $node -InstanceName $InstanceName - $bCheck = Check-SQLHAGroup -InstanceName $instance -Name $Name -sa $sa -saPassword $saPassword - if ($bCheck) - { - $bHAGExist = $true - break - } - } - - $bHAGExist -} - -function Get-ImpersonatetLib -{ - if ($script:ImpersonateLib) - { - return $script:ImpersonateLib - } - - $sig = @' -[DllImport("advapi32.dll", SetLastError = true)] -public static extern bool LogonUser(string lpszUsername, string lpszDomain, string lpszPassword, int dwLogonType, int dwLogonProvider, ref IntPtr phToken); - -[DllImport("kernel32.dll")] -public static extern Boolean CloseHandle(IntPtr hObject); -'@ - $script:ImpersonateLib = Add-Type -PassThru -Namespace 'Lib.Impersonation' -Name ImpersonationLib -MemberDefinition $sig - - return $script:ImpersonateLib - -} - -function ImpersonateAs([PSCredential] $cred) -{ - [IntPtr] $userToken = [Security.Principal.WindowsIdentity]::GetCurrent().Token - $userToken - $ImpersonateLib = Get-ImpersonatetLib - - $bLogin = $ImpersonateLib::LogonUser($cred.GetNetworkCredential().UserName, $cred.GetNetworkCredential().Domain, $cred.GetNetworkCredential().Password, - 9, 0, [ref]$userToken) - - if ($bLogin) - { - $Identity = New-Object Security.Principal.WindowsIdentity $userToken - $context = $Identity.Impersonate() - } - else - { - throw "Can't Logon as User $cred.GetNetworkCredential().UserName." - } - $context, $userToken -} - -function CloseUserToken([IntPtr] $token) -{ - $ImpersonateLib = Get-ImpersonatetLib - - $bLogin = $ImpersonateLib::CloseHandle($token) - if (!$bLogin) - { - throw "Can't close token" - } -} - -function Get-PureInstanceName ($InstanceName) -{ - $list = $InstanceName.Split("\") - if ($list.Count -gt 1) - { - $list[1] - } - else - { - "MSSQLSERVER" - } -} - -function Get-SQLInstanceName ($node, $InstanceName) -{ - $pureInstanceName = Get-PureInstanceName -InstanceName $InstanceName - - if ("MSSQLSERVER" -eq $pureInstanceName) - { - $node - } - else - { - $node + "\" + $pureInstanceName - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xWaitForSqlHAGroup/MSFT_xWaitForSqlHAGroup.schema.mof b/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xWaitForSqlHAGroup/MSFT_xWaitForSqlHAGroup.schema.mof deleted file mode 100644 index 1f604c1f..00000000 --- a/lib/puppet_x/dsc_resources/xSqlPs/DSCResources/MSFT_xWaitForSqlHAGroup/MSFT_xWaitForSqlHAGroup.schema.mof +++ /dev/null @@ -1,18 +0,0 @@ -#pragma namespace("\\\\.\\root\\microsoft\\windows\\DesiredStateConfiguration") - -[ClassVersion("1.0.0.0"), FriendlyName("xWaitForSqlHAGroup")] -class MSFT_xWaitForSqlHAGroup : OMI_BaseResource -{ - [Key, Description("The name of Sql High Availability group")] String Name; - [required, Description("The name of windows failover cluster for the availability group.")] string ClusterName; - [Write, Description("Interval to check the HA group existency")] Uint64 RetryIntervalSec; - [Write, Description("Maximum number of retries to check HA group existency")] Uint32 RetryCount; - - [required, Description("The name of sql instance.")] string InstanceName; - - [Required, EmbeddedInstance("MSFT_Credential"), Description("Domain credential could get list of cluster nodes.")] - String DomainCredential; - - [Required, EmbeddedInstance("MSFT_Credential"), Description("Sql sa credential")] - String SqlAdministratorCredential; -}; diff --git a/lib/puppet_x/dsc_resources/xSqlPs/LICENSE b/lib/puppet_x/dsc_resources/xSqlPs/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xSqlPs/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xSqlPs/xSqlPs.psd1 b/lib/puppet_x/dsc_resources/xSqlPs/xSqlPs.psd1 deleted file mode 100644 index 72b7b43e..00000000 --- a/lib/puppet_x/dsc_resources/xSqlPs/xSqlPs.psd1 +++ /dev/null @@ -1,45 +0,0 @@ - - -@{ - - -ModuleVersion = '1.4.0.0' - -GUID = 'abee25c0-d40a-4bf2-a04e-ed059aba377b' - -Author = 'Microsoft Corporation' - -CompanyName = 'Microsoft Corporation' - -Copyright = '(c) 2014 Microsoft Corporation. All rights reserved.' - -Description = 'SQL module.' - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/xSqlPs/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/xSqlPs' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - ReleaseNotes = '* Converted appveyor.yml to install Pester from PSGallery instead of from Chocolatey. -* Fixed bugs in xSqlAlias that prevented the succesful creation of the aliases and caused errors. - -' - - } # End of PSData hashtable - -} # End of PrivateData hashtable -} - diff --git a/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xDisk/MSFT_xDisk.psm1 b/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xDisk/MSFT_xDisk.psm1 deleted file mode 100644 index 4b78dccf..00000000 --- a/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xDisk/MSFT_xDisk.psm1 +++ /dev/null @@ -1,806 +0,0 @@ -# Suppressed as per PSSA Rule Severity guidelines for unit/integration tests: -# https://github.com/PowerShell/DscResources/blob/master/PSSARuleSeverities.md -[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '')] -param () - -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Storage Common Modules -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'StorageDsc.Common' ` - -ChildPath 'StorageDsc.Common.psm1')) - -# Import the Storage Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'StorageDsc.ResourceHelper' ` - -ChildPath 'StorageDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$localizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xDisk' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# - .SYNOPSIS - Returns the current state of the Disk and Partition. - - .PARAMETER DriveLetter - Specifies the preferred letter to assign to the disk volume. - - .PARAMETER DiskId - Specifies the disk identifier for the disk to modify. - - .PARAMETER DiskIdType - Specifies the identifier type the DiskId contains. Defaults to Number. - - .PARAMETER Size - Specifies the size of new volume (use all available space on disk if not provided). - - .PARAMETER FSLabel - Specifies the volume label to assign to the volume. - - .PARAMETER AllocationUnitSize - Specifies the allocation unit size to use when formatting the volume. - - .PARAMETER FSFormat - Specifies the file system format of the new volume. - - .PARAMETER AllowDestructive - Specifies if potentially destructive operations may occur - - .PARAMETER ClearDisk - Specifies if the disks partition schema should be removed entirely, even if data and oem partitions are present. Only possible with AllowDestructive enabled. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $DriveLetter, - - [Parameter(Mandatory = $true)] - [System.String] - $DiskId, - - [Parameter()] - [ValidateSet('Number', 'UniqueId')] - [System.String] - $DiskIdType = 'Number', - - [Parameter()] - [System.UInt64] - $Size, - - [Parameter()] - [System.String] - $FSLabel, - - [Parameter()] - [System.UInt32] - $AllocationUnitSize, - - [Parameter()] - [ValidateSet('NTFS', 'ReFS')] - [System.String] - $FSFormat = 'NTFS', - - [Parameter()] - [System.Boolean] - $AllowDestructive, - - [Parameter()] - [System.Boolean] - $ClearDisk - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.GettingDiskMessage -f $DiskIdType, $DiskId, $DriveLetter) - ) -join '' ) - - # Validate the DriveLetter parameter - $DriveLetter = Assert-DriveLetterValid -DriveLetter $DriveLetter - - $diskIdParameter = @{ - $DiskIdType = $DiskId - } - - $disk = Get-Disk ` - @diskIdParameter ` - -ErrorAction SilentlyContinue - - $partition = Get-Partition ` - -DriveLetter $DriveLetter ` - -ErrorAction SilentlyContinue - - $volume = Get-Volume ` - -DriveLetter $DriveLetter ` - -ErrorAction SilentlyContinue - - $fileSystem = $volume.FileSystem - $FSLabel = $volume.FileSystemLabel - - $blockSize = (Get-CimInstance ` - -Query "SELECT BlockSize from Win32_Volume WHERE DriveLetter = '$($DriveLetter):'" ` - -ErrorAction SilentlyContinue).BlockSize - - $returnValue = @{ - DiskId = $DiskId - DiskIdType = $DiskIdType - DriveLetter = $partition.DriveLetter - Size = $partition.Size - FSLabel = $FSLabel - AllocationUnitSize = $blockSize - FSFormat = $fileSystem - } - - $returnValue -} # Get-TargetResource - -<# - .SYNOPSIS - Initializes the Disk and Partition and assigns the drive letter. - - .PARAMETER DriveLetter - Specifies the preferred letter to assign to the disk volume. - - .PARAMETER DiskId - Specifies the disk identifier for the disk to modify. - - .PARAMETER DiskIdType - Specifies the identifier type the DiskId contains. Defaults to Number. - - .PARAMETER Size - Specifies the size of new volume (use all available space on disk if not provided). - - .PARAMETER FSLabel - Specifies the volume label to assign to the volume. - - .PARAMETER AllocationUnitSize - Specifies the allocation unit size to use when formatting the volume. - - .PARAMETER FSFormat - Specifies the file system format of the new volume. - - .PARAMETER AllowDestructive - Specifies if potentially destructive operations may occur - - .PARAMETER ClearDisk - Specifies if the disks partition schema should be removed entirely, even if data and oem partitions are present. Only possible with AllowDestructive enabled. -#> -function Set-TargetResource -{ - # Should process is called in a helper functions but not directly in Set-TargetResource - [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSShouldProcess', '')] - [CmdletBinding(SupportsShouldProcess = $true)] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $DriveLetter, - - [Parameter(Mandatory = $true)] - [System.String] - $DiskId, - - [Parameter()] - [ValidateSet('Number', 'UniqueId')] - [System.String] - $DiskIdType = 'Number', - - [Parameter()] - [System.UInt64] - $Size, - - [Parameter()] - [System.String] - $FSLabel, - - [Parameter()] - [System.UInt32] - $AllocationUnitSize, - - [Parameter()] - [ValidateSet('NTFS', 'ReFS')] - [System.String] - $FSFormat = 'NTFS', - - [Parameter()] - [System.Boolean] - $AllowDestructive, - - [Parameter()] - [System.Boolean] - $ClearDisk - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.SettingDiskMessage -f $DiskIdType, $DiskId, $DriveLetter) - ) -join '' ) - - # Validate the DriveLetter parameter - $DriveLetter = Assert-DriveLetterValid -DriveLetter $DriveLetter - - $diskIdParameter = @{ - $DiskIdType = $DiskId - } - - $disk = Get-Disk ` - @diskIdParameter ` - -ErrorAction Stop - - if ($disk.IsOffline) - { - # Disk is offline, so bring it online - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.SetDiskOnlineMessage -f $DiskIdType, $DiskId) - ) -join '' ) - - $disk | Set-Disk -IsOffline $false - } # if - - if ($disk.IsReadOnly) - { - # Disk is read-only, so make it read/write - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.SetDiskReadWriteMessage -f $DiskIdType, $DiskId) - ) -join '' ) - - $disk | Set-Disk -IsReadOnly $false - } # if - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.CheckingDiskPartitionStyleMessage -f $DiskIdType, $DiskId) - ) -join '' ) - - if ($AllowDestructive -and $ClearDisk -and $disk.PartitionStyle -ne 'RAW') - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.ClearingDisk -f $DiskIdType, $DiskId) - ) -join '' ) - - $disk | Clear-Disk -RemoveData -RemoveOEM -Confirm:$true - $disk = $disk | Get-Disk - } - - switch ($disk.PartitionStyle) - { - 'RAW' - { - # The disk partition table is not yet initialized, so initialize it with GPT - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.InitializingDiskMessage -f $DiskIdType, $DiskId) - ) -join '' ) - - $disk | Initialize-Disk ` - -PartitionStyle 'GPT' - - break - } # 'RAW' - - 'GPT' - { - # The disk partition is already initialized with GPT. - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.DiskAlreadyInitializedMessage -f $DiskIdType, $DiskId) - ) -join '' ) - - break - } # 'GPT' - - default - { - # This disk is initialized but not as GPT - so raise an exception. - New-InvalidOperationException ` - -Message ($localizedData.DiskAlreadyInitializedError -f ` - $DiskIdType, $DiskId, $Disk.PartitionStyle) - } # default - } # switch - - # Get the partitions on the disk - $partition = $disk | Get-Partition -ErrorAction SilentlyContinue - - # Check if the disk has an existing partition assigned to the drive letter - $assignedPartition = $partition | - Where-Object -Property DriveLetter -eq $DriveLetter - - # Check if existing partition already has file system on it - if ($null -eq $assignedPartition) - { - # There is no partiton with this drive letter - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.DriveNotFoundOnPartitionMessage -f $DiskIdType, $DiskId, $DriveLetter) - ) -join '' ) - - # Are there any partitions defined on this disk? - if ($partition) - { - # There are partitions defined - identify if one matches the size required - if ($Size) - { - # Find the first basic partition matching the size - $partition = $partition | - Where-Object -Filter { $_.Type -eq 'Basic' -and $_.Size -eq $Size } | - Select-Object -First 1 - - if ($partition) - { - # A partition matching the required size was found - Write-Verbose -Message ($localizedData.MatchingPartitionFoundMessage -f ` - $DiskIdType, $DiskId, $partition.PartitionNumber) - } - else - { - # A partition matching the required size was not found - Write-Verbose -Message ($localizedData.MatchingPartitionNotFoundMessage -f ` - $DiskIdType, $DiskId) - } # if - } - else - { - # No size specified so no partition can be matched - $partition = $null - } # if - } # if - - # Do we need to create a new partition? - if (-not $partition) - { - # Attempt to create a new partition - $partitionParams = @{ - DriveLetter = $DriveLetter - } - - if ($Size) - { - # Use only a specific size - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.CreatingPartitionMessage ` - -f $DiskIdType, $DiskId, $DriveLetter, "$($Size/1KB) KB") - ) -join '' ) - - $partitionParams['Size'] = $Size - } - else - { - # Use the entire disk - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.CreatingPartitionMessage ` - -f $DiskIdType, $DiskId, $DriveLetter, 'all free space') - ) -join '' ) - - $partitionParams['UseMaximumSize'] = $true - } # if - - # Create the partition. - $partition = $disk | New-Partition @partitionParams - - <# - After creating the partition it can take a few seconds for it to become writeable - Wait for up to 30 seconds for the parition to become writeable - #> - $timeout = (Get-Date) + (New-Timespan -Second 30) - while ($partition.IsReadOnly -and (Get-Date) -lt $timeout) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - ($localizedData.NewPartitionIsReadOnlyMessage ` - -f $DiskIdType, $DiskId, $partition.PartitionNumber) - ) -join '' ) - - Start-Sleep -Seconds 1 - - # Pull the partition details again to check if it is readonly - $partition = $partition | Get-Partition - } # while - } # if - - if ($partition.IsReadOnly) - { - # The partition is still readonly - throw an exception - New-InvalidOperationException ` - -Message ($localizedData.ParitionIsReadOnlyError -f ` - $DiskIdType, $DiskId, $partition.PartitionNumber) - } # if - - $assignDriveLetter = $true - } - else - { - # The disk already has a partition on it that is assigned to the Drive Letter - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.PartitionAlreadyAssignedMessage -f ` - $DriveLetter, $assignedPartition.PartitionNumber) - ) -join '' ) - - $assignDriveLetter = $false - - if ($assignedPartition.Size -ne $Size) - { - if ($AllowDestructive) - { - if ($FSFormat -eq 'ReFS') - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.ResizeRefsNotPossible ` - -f $DriveLetter, $assignedPartition.Size, $Size) - ) -join '' ) - - } - else - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.SizeMismatchCorrection ` - -f $DriveLetter, $assignedPartition.Size, $Size) - ) -join '' ) - - $supportedSize = ($assignedPartition | Get-PartitionSupportedSize) - - if ($size -gt $supportedSize.SizeMax) - { - New-InvalidArgumentException -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.FreeSpaceViolationError ` - -f $DriveLetter, $assignedPartition.Size, $Size, $supportedSize.SizeMax) - ) -join '' ) -ArgumentName 'Size' -ErrorAction Stop - } - - $assignedPartition | Resize-Partition -Size $Size - } - } - } - } - - # Get the Volume on the partition - $volume = $partition | Get-Volume - - # Is the volume already formatted? - if ($volume.FileSystem -eq '') - { - # The volume is not formatted - $volParams = @{ - FileSystem = $FSFormat - Confirm = $false - } - - if ($FSLabel) - { - # Set the File System label on the new volume - $volParams["NewFileSystemLabel"] = $FSLabel - } # if - - if ($AllocationUnitSize) - { - # Set the Allocation Unit Size on the new volume - $volParams["AllocationUnitSize"] = $AllocationUnitSize - } # if - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.FormattingVolumeMessage -f $volParams.FileSystem) - ) -join '' ) - - # Format the volume - $volume = $partition | Format-Volume @VolParams - } - else - { - # The volume is already formatted - if ($PSBoundParameters.ContainsKey('FSFormat')) - { - # Check the filesystem format - $fileSystem = $volume.FileSystem - if ($fileSystem -ne $FSFormat) - { - # The file system format does not match - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.FileSystemFormatMismatch -f ` - $DriveLetter, $fileSystem, $FSFormat) - ) -join '' ) - - if ($AllowDestructive) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.VolumeFormatInProgress -f ` - $DriveLetter, $fileSystem, $FSFormat) - ) -join '' ) - - $formatParam = @{ - FileSystem = $FSFormat - Force = $true - } - - if ($PSBoundParameters.ContainsKey('AllocationUnitSize')) - { - $formatParam.Add('AllocationUnitSize', $AllocationUnitSize) - } - - $Volume | Format-Volume @formatParam - } - } # if - } # if - - # Check the volume label - if ($PSBoundParameters.ContainsKey('FSLabel')) - { - # The volume should have a label assigned - if ($volume.FileSystemLabel -ne $FSLabel) - { - # The volume lable needs to be changed because it is different. - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.ChangingVolumeLabelMessage ` - -f $DriveLetter, $FSLabel) - ) -join '' ) - - $volume | Set-Volume -NewFileSystemLabel $FSLabel - } # if - } # if - } # if - - # Assign the Drive Letter if it isn't assigned - if ($assignDriveLetter -and ($partition.DriveLetter -ne $DriveLetter)) - { - $null = $partition | Set-Partition -NewDriveLetter $DriveLetter - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.SuccessfullyInitializedMessage -f $DriveLetter) - ) -join '' ) - } # if -} # Set-TargetResource - -<# - .SYNOPSIS - Tests if the disk is initialized, the partion exists and the drive letter is assigned. - - .PARAMETER DriveLetter - Specifies the preferred letter to assign to the disk volume. - - .PARAMETER DiskId - Specifies the disk identifier for the disk to modify. - - .PARAMETER DiskIdType - Specifies the identifier type the DiskId contains. Defaults to Number. - - .PARAMETER Size - Specifies the size of new volume (use all available space on disk if not provided). - - .PARAMETER FSLabel - Specifies the volume label to assign to the volume. - - .PARAMETER AllocationUnitSize - Specifies the allocation unit size to use when formatting the volume. - - .PARAMETER FSFormat - Specifies the file system format of the new volume. - - .PARAMETER AllowDestructive - Specifies if potentially destructive operations may occur - - .PARAMETER ClearDisk - Specifies if the disks partition schema should be removed entirely, even if data and oem partitions are present. Only possible with AllowDestructive enabled. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $DriveLetter, - - [Parameter(Mandatory = $true)] - [System.String] - $DiskId, - - [Parameter()] - [ValidateSet('Number', 'UniqueId')] - [System.String] - $DiskIdType = 'Number', - - [Parameter()] - [System.UInt64] - $Size, - - [Parameter()] - [System.String] - $FSLabel, - - [Parameter()] - [System.UInt32] - $AllocationUnitSize, - - [Parameter()] - [ValidateSet('NTFS', 'ReFS')] - [System.String] - $FSFormat = 'NTFS', - - [Parameter()] - [System.Boolean] - $AllowDestructive, - - [Parameter()] - [System.Boolean] - $ClearDisk - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.TestingDiskMessage -f $DiskIdType, $DiskId, $DriveLetter) - ) -join '' ) - - # Validate the DriveLetter parameter - $DriveLetter = Assert-DriveLetterValid -DriveLetter $DriveLetter - - $diskIdParameter = @{ - $DiskIdType = $DiskId - } - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.CheckDiskInitializedMessage -f $DiskIdType, $DiskId) - ) -join '' ) - - $disk = Get-Disk ` - @diskIdParameter ` - -ErrorAction SilentlyContinue - - if (-not $disk) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.DiskNotFoundMessage -f $DiskIdType, $DiskId) - ) -join '' ) - - return $false - } # if - - if ($disk.IsOffline) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.DiskNotOnlineMessage -f $DiskIdType, $DiskId) - ) -join '' ) - - return $false - } # if - - if ($disk.IsReadOnly) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.DiskReadOnlyMessage -f $DiskIdType, $DiskId) - ) -join '' ) - - return $false - } # if - - if ($disk.PartitionStyle -ne 'GPT') - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.DiskNotGPTMessage -f $DiskIdType, $DiskId, $Disk.PartitionStyle) - ) -join '' ) - - return $false - } # if - - $partition = Get-Partition ` - -DriveLetter $DriveLetter ` - -ErrorAction SilentlyContinue - if ($partition.DriveLetter -ne $DriveLetter) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.DriveLetterNotFoundMessage -f $DriveLetter) - ) -join '' ) - - return $false - } # if - - # Drive size - if ($Size) - { - if ($partition.Size -ne $Size) - { - # The partition size mismatches - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.SizeMismatchMessage ` - -f $DriveLetter, $Partition.Size, $Size) - ) -join '' ) - - if ($AllowDestructive) - { - return $false - } - } # if - } # if - - $blockSize = (Get-CimInstance ` - -Query "SELECT BlockSize from Win32_Volume WHERE DriveLetter = '$($DriveLetter):'" ` - -ErrorAction SilentlyContinue).BlockSize - - if ($blockSize -gt 0 -and $AllocationUnitSize -ne 0) - { - if ($AllocationUnitSize -ne $blockSize) - { - # The allocation unit size mismatches - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.AllocationUnitSizeMismatchMessage ` - -f $DriveLetter, $($blockSize.BlockSize / 1KB), $($AllocationUnitSize / 1KB)) - ) -join '' ) - - if ($AllowDestructive) - { - return $false - } - } # if - } # if - - # Get the volume so the properties can be checked - $volume = Get-Volume ` - -DriveLetter $DriveLetter ` - -ErrorAction SilentlyContinue - - if ($PSBoundParameters.ContainsKey('FSFormat')) - { - # Check the filesystem format - $fileSystem = $volume.FileSystem - if ($fileSystem -ne $FSFormat) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.FileSystemFormatMismatch ` - -f $DriveLetter, $fileSystem, $FSFormat) - ) -join '' ) - - if ($AllowDestructive) - { - return $false - } - } # if - } # if - - if ($PSBoundParameters.ContainsKey('FSLabel')) - { - # Check the volume label - $label = $volume.FileSystemLabel - if ($label -ne $FSLabel) - { - # The assigned volume label is different and needs updating - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.DriveLabelMismatch ` - -f $DriveLetter, $label, $FSLabel) - ) -join '' ) - - return $false - } # if - } # if - - return $true -} # Test-TargetResource - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xDisk/MSFT_xDisk.schema.mof b/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xDisk/MSFT_xDisk.schema.mof deleted file mode 100644 index c4839eed..00000000 --- a/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xDisk/MSFT_xDisk.schema.mof +++ /dev/null @@ -1,14 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xDisk")] -class MSFT_xDisk : OMI_BaseResource -{ - [Key, Description("Specifies the identifier for which disk to modify.")] String DriveLetter; - [Required, Description("Specifies the disk identifier for the disk to modify.")] String DiskId; - [Write, Description("Specifies the identifier type the DiskId contains. Defaults to Number."), ValueMap{"Number","UniqueId"}, Values{"Number","UniqueId"}] String DiskIdType; - [Write, Description("Specifies the size of new volume. Leave empty to use the remaining free space.")] Uint64 Size; - [Write, Description("Define volume label if required.")] String FSLabel; - [Write, Description("Specifies the allocation unit size to use when formatting the volume.")] Uint32 AllocationUnitSize; - [Write, Description("Specifies the file system format of the new volume."), ValueMap{"NTFS","ReFS"}, Values{"NTFS","ReFS"}] String FSFormat; - [Write, Description("Specifies if potentially destructive operations may occur.")] Boolean AllowDestructive; - [Write, Description("Specifies if the disks partition schema should be removed entirely, even if data and oem partitions are present. Only possible with AllowDestructive enabled.")] Boolean ClearDisk; -}; diff --git a/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xDisk/en-us/MSFT_xDisk.strings.psd1 b/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xDisk/en-us/MSFT_xDisk.strings.psd1 deleted file mode 100644 index 28dfaa96..00000000 --- a/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xDisk/en-us/MSFT_xDisk.strings.psd1 +++ /dev/null @@ -1,38 +0,0 @@ -ConvertFrom-StringData @' - GettingDiskMessage = Getting disk with {0} '{1}' status for drive letter '{2}'. - SettingDiskMessage = Setting disk with {0} '{1}' status for drive letter '{2}'. - SetDiskOnlineMessage = Setting disk with {0} '{1}' online. - SetDiskReadWriteMessage = Setting disk with {0} '{1}' to read/write. - CheckingDiskPartitionStyleMessage = Checking disk with {0} '{1}' partition style. - InitializingDiskMessage = Initializing disk with {0} '{1}'. - DiskAlreadyInitializedMessage = Disk with {0} '{1}' is already initialized with GPT. - CreatingPartitionMessage = Creating partition on disk with {0} '{1}' with drive letter '{2}' using {3}. - FormattingVolumeMessage = Formatting the volume as '{0}'. - SuccessfullyInitializedMessage = Successfully initialized '{0}'. - ChangingDriveLetterMessage = The volume already exists, changing drive letter '{0}' to '{1}'. - AssigningDriveLetterMessage = Assigning drive letter '{0}'. - ChangingVolumeLabelMessage = Changing volume '{0}' label to '{1}'. - NewPartitionIsReadOnlyMessage = New partition '{2}' on disk with {0} '{1}' is readonly. Waiting for it to become writable. - TestingDiskMessage = Testing disk with {0} '{1}' status for drive letter '{2}'. - CheckDiskInitializedMessage = Checking if disk with {0} '{1}' is initialized. - DiskNotFoundMessage = Disk with {0} '{1}' was not found. - DiskNotOnlineMessage = Disk with {0} '{1}' is not online. - DiskReadOnlyMessage = Disk with {0} '{1}' is readonly. - DiskNotGPTMessage = Disk with {0} '{1}' is initialized with '{2}' partition style. GPT required. - DriveLetterNotFoundMessage = Drive {0} was not found. - SizeMismatchMessage = Partition assigned to drive {0} has size {1}, which does not match expected size {2}. - AllocationUnitSizeMismatchMessage = Volume assigned to drive {0} has allocation unit size {1} KB does not match expected allocation unit size {2} KB. - FileSystemFormatMismatch = Volume assigned to drive {0} filesystem format '{1}' does not match expected format '{2}'. - DriveLabelMismatch = Volume assigned to drive {0} label '{1}' does not match expected label '{2}'. - PartitionAlreadyAssignedMessage = Partition '{1}' is already assigned as drive {0}. - MatchingPartitionNotFoundMessage = Disk with {0} '{1}' already contains partitions, but none match required size. - MatchingPartitionFoundMessage = Disk with {0} '{1}' already contains partitions, and partition '{2}' matches required size. - DriveNotFoundOnPartitionMessage = Disk with {0} '{1}' does not contain a partition assigned to drive letter '{2}'. - ClearingDisk = Clearing disk with {0} '{1}' of all existing partitions and volumes. - DiskAlreadyInitializedError = Disk with {0} '{1}' is already initialized with {2}. - NewParitionIsReadOnlyError = New partition '{2}' on disk with {0} '{1}' did not become writable in the expected time. - VolumeFormatInProgress = Switch AllowDestructive is specified. Attempting to format volume on {0} with '{2}', was '{1}' - SizeMismatchCorrection = Switch AllowDestructive is specified. Attempting to resize partition {0} from {1} to {2} - FreeSpaceViolationError = Attempted to resize partition {0} from {1} to {2} while maximum allowed size was {3} - ResizeRefsNotPossible = Skipping resize of {0} from {1} to {2}. Resizing ReFS partitions is currently not possible. -'@ diff --git a/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xDiskAccessPath/MSFT_xDiskAccessPath.psm1 b/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xDiskAccessPath/MSFT_xDiskAccessPath.psm1 deleted file mode 100644 index a67e9f44..00000000 --- a/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xDiskAccessPath/MSFT_xDiskAccessPath.psm1 +++ /dev/null @@ -1,682 +0,0 @@ -# Suppressed as per PSSA Rule Severity guidelines for unit/integration tests: -# https://github.com/PowerShell/DscResources/blob/master/PSSARuleSeverities.md -[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '')] -param () - -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Storage Common Modules -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'StorageDsc.Common' ` - -ChildPath 'StorageDsc.Common.psm1')) - -# Import the Storage Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'StorageDsc.ResourceHelper' ` - -ChildPath 'StorageDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$localizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xDiskAccessPath' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# - .SYNOPSIS - Returns the current state of the Disk and Partition. - - .PARAMETER AccessPath - Specifies the access path folder to the assign the disk volume to - - .PARAMETER DiskId - Specifies the disk identifier for the disk to modify. - - .PARAMETER DiskIdType - Specifies the identifier type the DiskId contains. Defaults to Number. - - .PARAMETER Size - Specifies the size of new volume (use all available space on disk if not provided). - - .PARAMETER FSLabel - Specifies the volume label to assign to the volume. - - .PARAMETER AllocationUnitSize - Specifies the allocation unit size to use when formatting the volume. - - .PARAMETER FSFormat - Specifies the file system format of the new volume. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $AccessPath, - - [Parameter(Mandatory = $true)] - [System.String] - $DiskId, - - [Parameter()] - [ValidateSet('Number','UniqueId')] - [System.String] - $DiskIdType = 'Number', - - [Parameter()] - [System.UInt64] - $Size, - - [Parameter()] - [System.String] - $FSLabel, - - [Parameter()] - [System.UInt32] - $AllocationUnitSize, - - [Parameter()] - [ValidateSet('NTFS','ReFS')] - [System.String] - $FSFormat = 'NTFS' - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.GettingDiskMessage -f $DiskIdType,$DiskId,$AccessPath) - ) -join '' ) - - # Validate the AccessPath parameter adding a trailing slash - $AccessPath = Assert-AccessPathValid -AccessPath $AccessPath -Slash - - $diskIdParameter = @{ - $DiskIdType = $DiskId - } - - $disk = Get-Disk ` - @diskIdParameter ` - -ErrorAction SilentlyContinue - - # Get the partitions on the disk - $partition = $disk | Get-Partition -ErrorAction SilentlyContinue - - # Check if the disk has an existing partition assigned to the access path - $assignedPartition = $partition | - Where-Object -Property AccessPaths -Contains -Value $AccessPath - - $volume = $assignedPartition | Get-Volume - - $fileSystem = $volume.FileSystem - $FSLabel = $volume.FileSystemLabel - - # Prepare the AccessPath used in the CIM query (replaces '\' with '\\') - $queryAccessPath = $AccessPath -replace '\\','\\' - - $blockSize = (Get-CimInstance ` - -Query "SELECT BlockSize from Win32_Volume WHERE Name = '$queryAccessPath'" ` - -ErrorAction SilentlyContinue).BlockSize - - $returnValue = @{ - DiskId = $DiskId - DiskIdType = $DiskIdType - AccessPath = $AccessPath - Size = $assignedPartition.Size - FSLabel = $FSLabel - AllocationUnitSize = $blockSize - FSFormat = $fileSystem - } - $returnValue -} # Get-TargetResource - -<# - .SYNOPSIS - Initializes the Disk and Partition and assigns the access path. - - .PARAMETER AccessPath - Specifies the access path folder to the assign the disk volume to - - .PARAMETER DiskId - Specifies the disk identifier for the disk to modify. - - .PARAMETER DiskIdType - Specifies the identifier type the DiskId contains. Defaults to Number. - - .PARAMETER Size - Specifies the size of new volume (use all available space on disk if not provided). - - .PARAMETER FSLabel - Specifies the volume label to assign to the volume. - - .PARAMETER AllocationUnitSize - Specifies the allocation unit size to use when formatting the volume. - - .PARAMETER FSFormat - Specifies the file system format of the new volume. -#> -function Set-TargetResource -{ - # Should process is called in a helper functions but not directly in Set-TargetResource - [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSShouldProcess', '')] - [CmdletBinding(SupportsShouldProcess = $true)] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $AccessPath, - - [Parameter(Mandatory = $true)] - [System.String] - $DiskId, - - [Parameter()] - [ValidateSet('Number','UniqueId')] - [System.String] - $DiskIdType = 'Number', - - [Parameter()] - [System.UInt64] - $Size, - - [Parameter()] - [System.String] - $FSLabel, - - [Parameter()] - [System.UInt32] - $AllocationUnitSize, - - [Parameter()] - [ValidateSet('NTFS','ReFS')] - [System.String] - $FSFormat = 'NTFS' - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.SettingDiskMessage -f $DiskIdType,$DiskId,$AccessPath) - ) -join '' ) - - # Validate the AccessPath parameter adding a trailing slash - $AccessPath = Assert-AccessPathValid -AccessPath $AccessPath -Slash - - $diskIdParameter = @{ - $DiskIdType = $DiskId - } - - $disk = Get-Disk ` - @diskIdParameter ` - -ErrorAction Stop - - if ($disk.IsOffline) - { - # Disk is offline, so bring it online - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.SetDiskOnlineMessage -f $DiskIdType,$DiskId) - ) -join '' ) - - $disk | Set-Disk -IsOffline $false - } # if - - if ($disk.IsReadOnly) - { - # Disk is read-only, so make it read/write - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.SetDiskReadWriteMessage -f $DiskIdType,$DiskId) - ) -join '' ) - - $disk | Set-Disk -IsReadOnly $false - } # if - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.CheckingDiskPartitionStyleMessage -f $DiskIdType,$DiskId) - ) -join '' ) - - switch ($disk.PartitionStyle) - { - 'RAW' - { - # The disk partition table is not yet initialized, so initialize it with GPT - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.InitializingDiskMessage -f $DiskIdType,$DiskId) - ) -join '' ) - - $disk | Initialize-Disk ` - -PartitionStyle 'GPT' - break - } # 'RAW' - - 'GPT' - { - # The disk partition is already initialized with GPT. - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.DiskAlreadyInitializedMessage -f $DiskIdType,$DiskId) - ) -join '' ) - break - } # 'GPT' - - default - { - # This disk is initialized but not as GPT - so raise an exception. - New-InvalidOperationException ` - -Message ($localizedData.DiskAlreadyInitializedError -f ` - $DiskIdType,$DiskId,$Disk.PartitionStyle) - } # default - } # switch - - # Get the partitions on the disk - $partition = $disk | Get-Partition -ErrorAction SilentlyContinue - - # Check if the disk has an existing partition assigned to the access path - $assignedPartition = $partition | - Where-Object -Property AccessPaths -Contains -Value $AccessPath - - if ($null -eq $assignedPartition) - { - # There is no partiton with this access path - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.AccessPathNotFoundOnPartitionMessage -f $DiskIdType,$DiskId,$AccessPath) - ) -join '' ) - - # Are there any partitions defined on this disk? - if ($partition) - { - # There are partitions defined - identify if one matches the size required - if ($Size) - { - # Find the first basic partition matching the size - $partition = $partition | - Where-Object -Filter { $_.Type -eq 'Basic' -and $_.Size -eq $Size } | - Select-Object -First 1 - - if ($partition) - { - # A partition matching the required size was found - Write-Verbose -Message ($localizedData.MatchingPartitionFoundMessage -f ` - $DiskIdType,$DiskId,$partition.PartitionNumber) - } - else - { - # A partition matching the required size was not found - Write-Verbose -Message ($localizedData.MatchingPartitionNotFoundMessage -f ` - $DiskIdType,$DiskId) - } # if - } - else - { - # No size specified so no partition can be matched - $partition = $null - } # if - } # if - - # Do we need to create a new partition? - if (-not $partition) - { - # Attempt to create a new partition - $partitionParams = @{} - - if ($Size) - { - # Use only a specific size - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.CreatingPartitionMessage ` - -f $DiskIdType,$DiskId,"$($Size/1KB) KB") - ) -join '' ) - $partitionParams['Size'] = $Size - } - else - { - # Use the entire disk - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.CreatingPartitionMessage ` - -f $DiskIdType,$DiskId,'all free space') - ) -join '' ) - $partitionParams['UseMaximumSize'] = $true - } # if - - # Create the partition - $partition = $disk | New-Partition @partitionParams - - <# - After creating the partition it can take a few seconds for it to become writeable - Wait for up to 30 seconds for the partition to become writeable - #> - $timeout = (Get-Date) + (New-Timespan -Second 30) - while ($partition.IsReadOnly -and (Get-Date) -lt $timeout) - { - Write-Verbose -Message ($localizedData.NewPartitionIsReadOnlyMessage -f ` - $DiskIdType,$DiskId,$partition.PartitionNumber) - - Start-Sleep -Seconds 1 - - # Pull the partition details again to check if it is readonly - $partition = $partition | Get-Partition - } # while - } # if - - if ($partition.IsReadOnly) - { - # The partition is still readonly - throw an exception - New-InvalidOperationException ` - -Message ($localizedData.NewParitionIsReadOnlyError -f ` - $DiskIdType,$DiskId,$partition.PartitionNumber) - } # if - - $assignAccessPath = $true - } - else - { - # The disk already has a partition on it that is assigned to the access path - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.PartitionAlreadyAssignedMessage -f ` - $AccessPath,$partition.PartitionNumber) - ) -join '' ) - - $assignAccessPath = $false - } - - # Get the Volume on the partition - $volume = $partition | Get-Volume - - # Is the volume already formatted? - if ($volume.FileSystem -eq '') - { - # The volume is not formatted - $volParams = @{ - FileSystem = $FSFormat - Confirm = $false - } - - if ($FSLabel) - { - # Set the File System label on the new volume - $volParams["NewFileSystemLabel"] = $FSLabel - } # if - - if ($AllocationUnitSize) - { - # Set the Allocation Unit Size on the new volume - $volParams["AllocationUnitSize"] = $AllocationUnitSize - } # if - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.FormattingVolumeMessage -f $volParams.FileSystem) - ) -join '' ) - - # Format the volume - $volume = $partition | Format-Volume @VolParams - } - else - { - # The volume is already formatted - if ($PSBoundParameters.ContainsKey('FSFormat')) - { - # Check the filesystem format - $fileSystem = $volume.FileSystem - if ($fileSystem -ne $FSFormat) - { - # The file system format does not match - # There is nothing we can do to resolve this (yet) - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.FileSystemFormatMismatch -f ` - $AccessPath,$fileSystem,$FSFormat) - ) -join '' ) - } # if - } # if - - # Check the volume label - if ($PSBoundParameters.ContainsKey('FSLabel')) - { - # The volume should have a label assigned - if ($volume.FileSystemLabel -ne $FSLabel) - { - # The volume lable needs to be changed because it is different. - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.ChangingVolumeLabelMessage ` - -f $AccessPath,$FSLabel) - ) -join '' ) - - $volume | Set-Volume -NewFileSystemLabel $FSLabel - } # if - } # if - } # if - - # Assign the access path if it isn't assigned - if ($assignAccessPath) - { - <# - Add the partition access path, but do not pipe $disk to - Add-PartitionAccessPath because it is not supported in - Windows Server 2012 R2 - #> - $null = Add-PartitionAccessPath ` - -AccessPath $AccessPath ` - -DiskNumber $disk.Number ` - -PartitionNumber $partition.PartitionNumber - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.SuccessfullyInitializedMessage -f $AccessPath) - ) -join '' ) - } # if -} # Set-TargetResource - -<# - .SYNOPSIS - Tests if the disk is initialized, the partion exists and the access path is assigned. - - .PARAMETER AccessPath - Specifies the access path folder to the assign the disk volume to - - .PARAMETER DiskId - Specifies the disk identifier for the disk to modify. - - .PARAMETER DiskIdType - Specifies the identifier type the DiskId contains. Defaults to Number. - - .PARAMETER Size - Specifies the size of new volume (use all available space on disk if not provided). - - .PARAMETER FSLabel - Specifies the volume label to assign to the volume. - - .PARAMETER AllocationUnitSize - Specifies the allocation unit size to use when formatting the volume. - - .PARAMETER FSFormat - Specifies the file system format of the new volume. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $AccessPath, - - [Parameter(Mandatory = $true)] - [System.String] - $DiskId, - - [Parameter()] - [ValidateSet('Number','UniqueId')] - [System.String] - $DiskIdType = 'Number', - - [Parameter()] - [System.UInt64] - $Size, - - [Parameter()] - [System.String] - $FSLabel, - - [Parameter()] - [System.UInt32] - $AllocationUnitSize, - - [Parameter()] - [ValidateSet('NTFS','ReFS')] - [System.String] - $FSFormat = 'NTFS' - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.TestingDiskMessage -f $DiskIdType,$DiskId,$AccessPath) - ) -join '' ) - - # Validate the AccessPath parameter adding a trailing slash - $AccessPath = Assert-AccessPathValid -AccessPath $AccessPath -Slash - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.CheckDiskInitializedMessage -f $DiskIdType,$DiskId) - ) -join '' ) - - $diskIdParameter = @{ - $DiskIdType = $DiskId - } - - $disk = Get-Disk ` - @diskIdParameter ` - -ErrorAction SilentlyContinue - - if (-not $disk) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.DiskNotFoundMessage -f $DiskIdType,$DiskId) - ) -join '' ) - return $false - } # if - - if ($disk.IsOffline) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.DiskNotOnlineMessage -f $DiskIdType,$DiskId) - ) -join '' ) - return $false - } # if - - if ($disk.IsReadOnly) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.DiskReadOnlyMessage -f $DiskIdType,$DiskId) - ) -join '' ) - return $false - } # if - - if ($disk.PartitionStyle -ne 'GPT') - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.DiskNotGPTMessage -f $DiskIdType,$DiskId,$Disk.PartitionStyle) - ) -join '' ) - return $false - } # if - - # Get the partitions on the disk - $partition = $disk | Get-Partition -ErrorAction SilentlyContinue - - # Check if the disk has an existing partition assigned to the access path - $assignedPartition = $partition | - Where-Object -Property AccessPaths -Contains -Value $AccessPath - - if (-not $assignedPartition) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.AccessPathNotFoundMessage -f $AccessPath) - ) -join '' ) - return $false - } # if - - # Partition size was passed so check it - if ($Size) - { - if ($assignedPartition.Size -ne $Size) - { - # The partition size mismatches but can't be changed (yet) - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.SizeMismatchMessage -f ` - $AccessPath,$assignedPartition.Size,$Size) - ) -join '' ) - } # if - } # if - - # Prepare the AccessPath used in the CIM query (replaces '\' with '\\') - $queryAccessPath = $AccessPath -replace '\\','\\' - - $blockSize = (Get-CimInstance ` - -Query "SELECT BlockSize from Win32_Volume WHERE Name = '$queryAccessPath'" ` - -ErrorAction SilentlyContinue).BlockSize - - if ($blockSize -gt 0 -and $AllocationUnitSize -ne 0) - { - if ($AllocationUnitSize -ne $blockSize) - { - # The allocation unit size mismatches but can't be changed (yet) - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.AllocationUnitSizeMismatchMessage -f ` - $AccessPath,$($blockSize.BlockSize/1KB),$($AllocationUnitSize/1KB)) - ) -join '' ) - } # if - } # if - - # Get the volume so the properties can be checked - $volume = $assignedPartition | Get-Volume - - if ($PSBoundParameters.ContainsKey('FSFormat')) - { - # Check the filesystem format - $fileSystem = $volume.FileSystem - if ($fileSystem -ne $FSFormat) - { - # The file system format does not match but can't be changed (yet) - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.FileSystemFormatMismatch -f ` - $AccessPath,$fileSystem,$FSFormat) - ) -join '' ) - } # if - } # if - - if ($PSBoundParameters.ContainsKey('FSLabel')) - { - # Check the volume label - $label = $volume.FileSystemLabel - if ($label -ne $FSLabel) - { - # The assigned volume label is different and needs updating - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.DriveLabelMismatch -f ` - $AccessPAth,$label,$FSLabel) - ) -join '' ) - return $false - } # if - } # if - - return $true -} # Test-TargetResource - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xDiskAccessPath/MSFT_xDiskAccessPath.schema.mof b/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xDiskAccessPath/MSFT_xDiskAccessPath.schema.mof deleted file mode 100644 index f792348f..00000000 --- a/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xDiskAccessPath/MSFT_xDiskAccessPath.schema.mof +++ /dev/null @@ -1,12 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xDiskAccessPath")] -class MSFT_xDiskAccessPath : OMI_BaseResource -{ - [Key, Description("Specifies the access path folder to the assign the disk volume to.")] String AccessPath; - [Required, Description("Specifies the disk identifier for the disk to modify.")] String DiskId; - [Write, Description("Specifies the identifier type the DiskId contains. Defaults to Number."), ValueMap{"Number","UniqueId"}, Values{"Number","UniqueId"}] String DiskIdType; - [Write, Description("Specifies the size of new volume.")] Uint64 Size; - [Write, Description("Define volume label if required.")] String FSLabel; - [Write, Description("Specifies the allocation unit size to use when formatting the volume.")] Uint32 AllocationUnitSize; - [Write, Description("Specifies the file system format of the new volume."), ValueMap{"NTFS","ReFS"}, Values{"NTFS","ReFS"}] String FSFormat; -}; diff --git a/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xDiskAccessPath/en-us/MSFT_xDiskAccessPath.strings.psd1 b/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xDiskAccessPath/en-us/MSFT_xDiskAccessPath.strings.psd1 deleted file mode 100644 index de5a2615..00000000 --- a/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xDiskAccessPath/en-us/MSFT_xDiskAccessPath.strings.psd1 +++ /dev/null @@ -1,34 +0,0 @@ -ConvertFrom-StringData @' - GettingDiskMessage = Getting disk with {0} '{1}' status for access path '{2}'. - SettingDiskMessage = Setting disk with {0} '{1}' status for access path '{2}'. - SetDiskOnlineMessage = Setting disk with {0} '{1}' online. - SetDiskReadWriteMessage = Setting disk with {0} '{1}' to read/write. - CheckingDiskPartitionStyleMessage = Checking disk with {0} '{1}' partition style. - InitializingDiskMessage = Initializing disk with {0} '{1}'. - DiskAlreadyInitializedMessage = Disk with {0} '{1}' is already initialized with GPT. - CreatingPartitionMessage = Creating partition on disk with {0} '{1}' using {2}. - FormattingVolumeMessage = Formatting the volume as '{0}'. - SuccessfullyInitializedMessage = Successfully initialized volume and assigned to access path '{0}'. - ChangingDriveLetterMessage = The volume already exists, changing access path '{0}' to '{1}'. - AssigningDriveLetterMessage = Assigning access path '{0}'. - ChangingVolumeLabelMessage = Changing Volume assigned to access path '{0}' label to '{1}'. - NewPartitionIsReadOnlyMessage = New partition '{1}' on disk with {0} '{1}' is readonly. Waiting for it to become writable. - TestingDiskMessage = Testing disk with {0} '{1}' status for access path '{2}'. - CheckDiskInitializedMessage = Checking if disk with {0} '{1}' is initialized. - DiskNotFoundMessage = Disk with {0} '{1}' was not found. - DiskNotOnlineMessage = Disk with {0} '{1}' is not online. - DiskReadOnlyMessage = Disk with {0} '{1}'is readonly. - DiskNotGPTMessage = Disk with {0} '{1}' is initialised with '{2}' partition style. GPT required. - AccessPathNotFoundMessage = A volume assigned to access path '{0}' was not found. - SizeMismatchMessage = Partition assigned to access path '{0}' has size {1}, which does not match expected size {2}. - AllocationUnitSizeMismatchMessage = Volume assigned to access path '{0}' has allocation unit size {1} KB does not match expected allocation unit size {2} KB. - FileSystemFormatMismatch = Volume assigned to access path '{0}' filesystem format '{1}' does not match expected format '{2}'. - DriveLabelMismatch = Volume assigned to access path '{0}' label '{1}' does not match expected label '{2}'. - PartitionAlreadyAssignedMessage = Partition '{1}' is already assigned to access path '{0}'. - MatchingPartitionNotFoundMessage = Disk with {0} '{1}' already contains paritions, but none match required size. - MatchingPartitionFoundMessage = Disk with {0} '{1}' already contains paritions, and partition '{2}' matches required size. - AccessPathNotFoundOnPartitionMessage = Disk with {0} '{1}' does not contain a partition assigned to access path '{2}'. - - DiskAlreadyInitializedError = Disk with {0} '{1}' is already initialized with {2}. - NewParitionIsReadOnlyError = New partition '{2}' on disk with {0} '{1}' did not become writable in the expected time. -'@ diff --git a/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xMountImage/MSFT_xMountImage.psm1 b/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xMountImage/MSFT_xMountImage.psm1 deleted file mode 100644 index 061857c4..00000000 --- a/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xMountImage/MSFT_xMountImage.psm1 +++ /dev/null @@ -1,591 +0,0 @@ -# Suppressed as per PSSA Rule Severity guidelines for unit/integration tests: -# https://github.com/PowerShell/DscResources/blob/master/PSSARuleSeverities.md -[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '')] -param () - -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Storage Common Modules -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'StorageDsc.Common' ` - -ChildPath 'StorageDsc.Common.psm1')) - -# Import the Storage Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'StorageDsc.ResourceHelper' ` - -ChildPath 'StorageDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$localizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xMountImage' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# - .SYNOPSIS - Returns the current mount state of the VHD or ISO file. - - .PARAMETER ImagePath - Specifies the path of the VHD or ISO file. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $ImagePath - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.GettingMountedImageMessage ` - -f $ImagePath) - ) -join '' ) - - $diskImage = Get-DiskImage -ImagePath $ImagePath - - if ($diskImage.Attached) - { - $returnValue = @{ - ImagePath = $ImagePath - DriveLetter = '' - StorageType = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.DiskImage.StorageType] $diskImage.StorageType - Access = 'ReadOnly' - Ensure = 'Present' - } - - # Determine the Disk Image Access mode - if ($diskImage.StorageType ` - -eq [Microsoft.PowerShell.Cmdletization.GeneratedTypes.DiskImage.StorageType]::ISO) - { - # Get the Drive Letter the ISO is mounted as - $volume = $diskImage | Get-Volume - $returnValue.Driveletter = $volume.DriveLetter - } - else - { - # Look up the disk and find out if it is readwrite. - $disk = Get-Disk -Number $diskImage.Number - if (-not $disk.IsReadOnly) - { - $returnValue.Access = 'ReadWrite' - } # if - - # Find the first 'Basic' partition - $partitions = $disk | Get-Partition - $partition = $partitions | Where-Object -Property Type -EQ 'Basic' - - # Find the first volume in the partition and get the mounted Drive Letter - $volumes = $partition | Get-Volume - $volume = $volumes | Select-Object -First 1 - - $returnValue.Driveletter = $volume.DriveLetter - } # if - } - else - { - $returnValue = @{ - ImagePath = $ImagePath - Ensure = 'Absent' - } - } # if - - $returnValue -} # Get-TargetResource - -<# - .SYNOPSIS - Mounts or dismounts the ISO or VHD. - - .PARAMETER ImagePath - Specifies the path of the VHD or ISO file. - - .PARAMETER DriveLetter - Specifies the drive letter to mount this VHD or ISO to. - - .PARAMETER StorageType - Specifies the storage type of a file. If the StorageType parameter is not specified, then the storage type is determined by file extension. - - .PARAMETER Access - Allows a VHD file to be mounted in read-only or read-write mode. ISO files are mounted in read-only mode regardless of what parameter value you provide. - - .PARAMETER Ensure - Determines whether the setting should be applied or removed. -#> -function Set-TargetResource -{ - # Should process is called in a helper functions but not directly in Set-TargetResource - [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSShouldProcess', '')] - [CmdletBinding(SupportsShouldProcess = $true)] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $ImagePath, - - [Parameter()] - [System.String] - $DriveLetter, - - [Parameter()] - [ValidateSet('ISO','VHD','VHDx','VHDSet')] - [System.String] - $StorageType, - - [Parameter()] - [ValidateSet('ReadOnly','ReadWrite')] - [System.String] - $Access, - - [Parameter()] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present' - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.SettingMountedImageMessage ` - -f $ImagePath) - ) -join '' ) - - # Check the parameter combo passed is valid, and throw if not. - $null = Test-ParameterValid @PSBoundParameters - - # Get the current mount state of this disk image - $currentState = Get-TargetResource -ImagePath $ImagePath - - # Remove Ensure from PSBoundParameters so it can be splatted - $null = $PSBoundParameters.Remove('Ensure') - - if ($Ensure -eq 'Present') - { - # Get the normalized DriveLetter (colon removed) - $normalizedDriveLetter = Assert-DriveLetterValid -DriveLetter $DriveLetter - - # The Disk Image should be mounted - $needsMount = $false - if ($currentState.Ensure -eq 'Absent') - { - $needsMount = $true - } - else - { - if ($currentState.DriveLetter -ne $normalizedDriveLetter) - { - # The disk image is mounted to the wrong DriveLetter -remount disk - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.DismountingImageMessage ` - -f $ImagePath,$currentState.DriveLetter) - ) -join '' ) - - Dismount-DiskImage -ImagePath $ImagePath - $needsMount = $true - } # if - } # if - - if ($currentState.StorageType -ne 'ISO') - { - if ($PSBoundParameters.ContainsKey('Access')) - { - # For VHD/VHDx/VHDSet disks check the access mode - if ($currentState.Access -ne $Access) - { - # The access mode is wrong -remount disk - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.DismountingImageMessage ` - -f $ImagePath,$currentState.DriveLetter) - ) -join '' ) - - Dismount-DiskImage -ImagePath $ImagePath - $needsMount = $true - } # if - } # if - } # if - - if ($needsMount) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.MountingImageMessage ` - -f $ImagePath,$normalizedDriveLetter) - ) -join '' ) - - Mount-DiskImageToLetter @PSBoundParameters - } # if - } - else - { - # The Disk Image should not be mounted - if ($currentState.Ensure -eq 'Present') - { - # It is mounted so dismount it - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.DismountingImageMessage ` - -f $ImagePath,$currentState.DriveLetter) - ) -join '' ) - - Dismount-DiskImage -ImagePath $ImagePath - } - } # if -} # Set-TargetResource - -<# - .SYNOPSIS - Tests if the ISO or VHD file mount is in the correct state. - - .PARAMETER ImagePath - Specifies the path of the VHD or ISO file. - - .PARAMETER DriveLetter - Specifies the drive letter to mount this VHD or ISO to. - - .PARAMETER StorageType - Specifies the storage type of a file. If the StorageType parameter is not specified, then the storage type is determined by file extension. - - .PARAMETER Access - Allows a VHD file to be mounted in read-only or read-write mode. ISO files are mounted in read-only mode regardless of what parameter value you provide. - - .PARAMETER Ensure - Determines whether the setting should be applied or removed. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $ImagePath, - - [Parameter()] - [System.String] - $DriveLetter, - - [Parameter()] - [ValidateSet('ISO','VHD','VHDx','VHDSet')] - [System.String] - $StorageType, - - [Parameter()] - [ValidateSet('ReadOnly','ReadWrite')] - [System.String] - $Access, - - [Parameter()] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present' - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.TestingMountedImageMessage ` - -f $DriveLetter) - ) -join '' ) - - # Check the parameter combo passed is valid, and throw if not. - $null = Test-ParameterValid @PSBoundParameters - - # Get the current mount state of this disk image - $currentState = Get-TargetResource -ImagePath $ImagePath - - if ($Ensure -eq 'Present') - { - # Get the normalized DriveLetter (colon removed) - $normalizedDriveLetter = Assert-DriveLetterValid -DriveLetter $DriveLetter - - # The Disk Image should be mounted - if ($currentState.Ensure -eq 'Absent') - { - # The disk image isn't mounted - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.ImageIsNotMountedButShouldBeMessage ` - -f $ImagePath,$normalizedDriveLetter) - ) -join '' ) - return $false - } # if - - if ($currentState.DriveLetter -ne $normalizedDriveLetter) - { - # The disk image is mounted to the wrong DriveLetter - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.ImageIsMountedToTheWrongDriveLetterMessage ` - -f $ImagePath,$currentState.DriveLetter,$normalizedDriveLetter) - ) -join '' ) - return $false - } # if - - if ($currentState.StorageType -ne 'ISO') - { - if ($PSBoundParameters.ContainsKey('Access')) - { - # For VHD/VHDx/VHDSet disks check the access mode - if ($currentState.Access -ne $Access) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.VHDAccessModeMismatchMessage ` - -f $ImagePath,$normalizedDriveLetter,$currentState.Access,$Access) - ) -join '' ) - return $false - } # if - } # if - } # if - - # The Disk Image is mounted to the expected Drive - nothing to change. - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.ImageIsMountedAndShouldBeMessage ` - -f $ImagePath,$normalizedDriveLetter) - ) -join '' ) - } - else - { - # The Disk Image should not be mounted - if ($currentState.Ensure -eq 'Present') - { - # The disk image is mounted - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.ImageIsMountedButShouldNotBeMessage ` - -f $ImagePath,$currentState.DriveLetter) - ) -join '' ) - return $false - } # if - - # The image is not mounted and should not be - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.ImageIsNotMountedAndShouldNotBeMessage ` - -f $ImagePath) - ) -join '' ) - } # if - - # No changes are needed - return $true -} # Test-TargetResource - -<# - .SYNOPSIS - Validates that the parameters passed are valid. If the parameter combination - is invalid then an exception will be thrown. Also validates the DriveLetter - value that is passed is valid. - - .PARAMETER ImagePath - Specifies the path of the VHD or ISO file. - - .PARAMETER DriveLetter - Specifies the drive letter to mount this VHD or ISO to. - - .PARAMETER StorageType - Specifies the storage type of a file. If the StorageType parameter is not specified, then the storage type is determined by file extension. - - .PARAMETER Access - Allows a VHD file to be mounted in read-only or read-write mode. ISO files are mounted in read-only mode regardless of what parameter value you provide. - - .PARAMETER Ensure - Determines whether the setting should be applied or removed. - - .OUTPUTS - If ensure is present then returns a normalized array of Drive Letters. -#> -function Test-ParameterValid -{ - [CmdletBinding()] - [OutputType([String[]])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $ImagePath, - - [Parameter()] - [System.String] - $DriveLetter, - - [Parameter()] - [ValidateSet('ISO','VHD','VHDx','VHDSet')] - [System.String] - $StorageType, - - [Parameter()] - [ValidateSet('ReadOnly','ReadWrite')] - [System.String] - $Access, - - [Parameter()] - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present' - ) - - if ($Ensure -eq 'Absent') - { - if ($PSBoundParameters.ContainsKey('DriveLetter')) - { - # The DriveLetter should not be set if Ensure is Absent - New-InvalidOperationException ` - -Message ($localizedData.InvalidParameterSpecifiedError -f ` - 'Absent','DriveLetter') - } # if - - if ($PSBoundParameters.ContainsKey('StorageType')) - { - # The StorageType should not be set if Ensure is Absent - New-InvalidOperationException ` - -Message ($localizedData.InvalidParameterSpecifiedError -f ` - 'Absent','StorageType') - } # if - - if ($PSBoundParameters.ContainsKey('Access')) - { - # The Access should not be set if Ensure is Absent - New-InvalidOperationException ` - -Message ($localizedData.InvalidParameterSpecifiedError -f ` - 'Absent','Access') - } # if - } - else - { - if (-not (Test-Path -Path $ImagePath)) - { - # The file specified by ImagePath should be found - New-InvalidOperationException ` - -Message ($localizedData.DiskImageFileNotFoundError -f ` - $ImagePath) - } # if - - if ($PSBoundParameters.ContainsKey('DriveLetter')) - { - # Test the Drive Letter to ensure it is valid - $normalizedDriveLetter = Assert-DriveLetterValid -DriveLetter $DriveLetter - } - else - { - # Drive letter is not specified but Ensure is present. - New-InvalidOperationException ` - -Message ($localizedData.InvalidParameterNotSpecifiedError -f ` - 'Present','DriveLetter') - } # if - } # if -} # Test-ParameterValid - -<# - .SYNOPSIS - Mounts a Disk Image to a specific Drive Letter. - - .PARAMETER ImagePath - Specifies the path of the VHD or ISO file. - - .PARAMETER DriveLetter - Specifies the drive letter to mount this VHD or ISO to. - - .PARAMETER StorageType - Specifies the storage type of a file. If the StorageType parameter is not specified, then the storage type is determined by file extension. - - .PARAMETER Access - Allows a VHD file to be mounted in read-only or read-write mode. ISO files are mounted in read-only mode regardless of what parameter value you provide. -#> -function Mount-DiskImageToLetter -{ - [CmdletBinding()] - [OutputType([String[]])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $ImagePath, - - [Parameter()] - [System.String] - $DriveLetter, - - [Parameter()] - [ValidateSet('ISO','VHD','VHDx','VHDSet')] - [System.String] - $StorageType, - - [Parameter()] - [ValidateSet('ReadOnly','ReadWrite')] - [System.String] - $Access - ) - - # Get the normalized DriveLetter (colon removed) - $normalizedDriveLetter = Assert-DriveLetterValid -DriveLetter $DriveLetter - - # Mount the Diskimage - $mountParams = @{ ImagePath = $ImagePath } - if ($PSBoundParameters.ContainsKey('Access')) - { - $mountParams += @{ Access = $Access } - } # if - $null = Mount-DiskImage @mountParams - - # Get the DiskImage object - $diskImage = Get-DiskImage -ImagePath $ImagePath - - # Determine the Storage Type expected - if (-not $PSBoundParameters.ContainsKey('StorageType')) - { - $StorageType = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.DiskImage.StorageType] $diskImage.StorageType - } # if - - # Different StorageType images require different methods of getting the Volume object. - if ($StorageType -eq [Microsoft.PowerShell.Cmdletization.GeneratedTypes.DiskImage.StorageType]::ISO) - { - # This is a ISO diskimage - $volume = $diskImage | Get-Volume - } - else - { - # This is a VHD/VHDx/VHDSet diskimage - $disk = Get-Disk -Number $diskImage.Number - - # Find the first 'Basic' partition to mount - $partitions = $disk | Get-Partition - $partition = $partitions | Where-Object -Property Type -EQ 'Basic' - - # Find the first volume in the partition and get the mounted Drive Letter - $volumes = $partition | Get-Volume - $volume = $volumes | Select-Object -First 1 - } # if - - $currentDriveLetter = $volume.DriveLetter - - # Verify that the drive letter assigned to the drive is the one needed. - if ($currentDriveLetter -ne $normalizedDriveLetter) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.ChangingImageDriveLetterMessage ` - -f $ImagePath,$currentDriveLetter,$normalizedDriveLetter) - ) -join '' ) - - <# - Use CIM to change the DriveLetter. - The Win32_Volume must be looked up using the ObjectId found in the Volume object - ObjectId is more verbose than DeviceId in Windows 10 Anniversary Edition, look for - DeviceId in the ObjectId string to match volumes. - #> - $cimVolume = Get-CimInstance -ClassName Win32_Volume | - Where-Object -FilterScript { $volume.ObjectId.IndexOf($_.DeviceId) -ne -1 } - - Set-CimInstance ` - -InputObject $cimVolume ` - -Property @{ DriveLetter = "$($normalizedDriveLetter):" } - } # if -} # Mount-DiskImageToLetter - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xMountImage/MSFT_xMountImage.schema.mof b/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xMountImage/MSFT_xMountImage.schema.mof deleted file mode 100644 index 84c67135..00000000 --- a/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xMountImage/MSFT_xMountImage.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xMountImage")] -class MSFT_xMountImage : OMI_BaseResource -{ - [Key, Description("Specifies the path of the VHD or ISO file.")] String ImagePath; - [Write, Description("Specifies the drive letter to mount this VHD or ISO to.")] String DriveLetter; - [Write, Description("Specifies the storage type of a file. If the StorageType parameter is not specified, then the storage type is determined by file extension."), ValueMap{"ISO","VHD","VHDx","VHDSet"}, Values{"ISO","VHD","VHDx","VHDSet"}] String StorageType; - [Write, Description("Allows a VHD file to be mounted in read-only or read-write mode. ISO files are mounted in read-only mode regardless of what parameter value you provide."), ValueMap{"ReadOnly","ReadWrite"}, Values{"ReadOnly","ReadWrite"}] String Access; - [Write, Description("Determines whether the VHD or ISO should be mounted or not."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; -}; - diff --git a/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xMountImage/en-us/MSFT_xMountImage.strings.psd1 b/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xMountImage/en-us/MSFT_xMountImage.strings.psd1 deleted file mode 100644 index e5eb28e2..00000000 --- a/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xMountImage/en-us/MSFT_xMountImage.strings.psd1 +++ /dev/null @@ -1,22 +0,0 @@ -ConvertFrom-StringData @' - GettingMountedImageMessage = Getting Mounted Drive for image file '{0}'. - - SettingMountedImageMessage = Setting Mounted Drive for image file '{0}'. - DismountingImageMessage = The image file '{0}' is being dismounted from drive '{1}'. - - TestingMountedImageMessage = Testing Mounted Drive for image file '{0}'. - ImageIsNotMountedButShouldBeMessage = The image file '{0}' is not mounted to drive '{1}' but should be. Change required. - ImageIsMountedToTheWrongDriveLetterMessage = The image file '{0}' is mounted as drive '{1}' but should be mounted as drive '{2}'. Change required. - VHDAccessModeMismatchMessage = The image file '{0}' is mounted to drive '{1}' but the access is '{2}' and should be '{3}'. Change required. - ImageIsMountedAndShouldBeMessage = The image file '{0}' is mounted to drive '{1}' and should be. - ImageIsMountedButShouldNotBeMessage = The image file '{0}' is mounted to drive '{1}' but should not be. Change required. - ImageIsNotMountedAndShouldNotBeMessage = The image file '{0}' is not mounted and should not be. - - TestingMountedImageError = Testing Mounted Drive for image file '{0}'. - InvalidParameterSpecifiedError = Ensure is '{0}' but '{1}' was specified. - InvalidParameterNotSpecifiedError = Ensure is '{0}' but '{1}' was not specified. - DiskImageFileNotFoundError = The image file '{0}' could not be found. - - MountingImageMessage = The image file '{0}' is being mounted as drive '{1}'. - ChangingImageDriveLetterMessage = The image file '{0}' mounted as drive '{1}' will be changed to '{2}'. -'@ diff --git a/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xWaitForDisk/MSFT_xWaitForDisk.psm1 b/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xWaitForDisk/MSFT_xWaitForDisk.psm1 deleted file mode 100644 index ab8af9f1..00000000 --- a/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xWaitForDisk/MSFT_xWaitForDisk.psm1 +++ /dev/null @@ -1,231 +0,0 @@ -# Suppressed as per PSSA Rule Severity guidelines for unit/integration tests: -# https://github.com/PowerShell/DscResources/blob/master/PSSARuleSeverities.md -[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '')] -param () - -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Storage Common Modules -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'StorageDsc.Common' ` - -ChildPath 'StorageDsc.Common.psm1')) - -# Import the Storage Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'StorageDsc.ResourceHelper' ` - -ChildPath 'StorageDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$localizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xWaitForDisk' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# - .SYNOPSIS - Returns the current state of the wait for disk resource. - - .PARAMETER DiskId - Specifies the disk identifier for the disk to wait for. - - .PARAMETER DiskIdType - Specifies the identifier type the DiskId contains. Defaults to Number. - - .PARAMETER RetryIntervalSec - Specifies the number of seconds to wait for the disk to become available. - - .PARAMETER RetryCount - The number of times to loop the retry interval while waiting for the disk. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $DiskId, - - [Parameter()] - [ValidateSet('Number','UniqueId')] - [System.String] - $DiskIdType = 'Number', - - [Parameter()] - [System.UInt32] - $RetryIntervalSec = 10, - - [Parameter()] - [System.UInt32] - $RetryCount = 60 - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.GettingWaitForDiskStatusMessage -f $DiskIdType,$DiskId) - ) -join '' ) - - $returnValue = @{ - DiskId = $DiskId - DiskIdType = $DiskIdType - RetryIntervalSec = $RetryIntervalSec - RetryCount = $RetryCount - } - return $returnValue -} # function Get-TargetResource - -<# - .SYNOPSIS - Sets the current state of the wait for disk resource. - - .PARAMETER DiskId - Specifies the disk identifier for the disk to wait for. - - .PARAMETER DiskIdType - Specifies the identifier type the DiskId contains. Defaults to Number. - - .PARAMETER RetryIntervalSec - Specifies the number of seconds to wait for the disk to become available. - - .PARAMETER RetryCount - The number of times to loop the retry interval while waiting for the disk. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $DiskId, - - [Parameter()] - [ValidateSet('Number','UniqueId')] - [System.String] - $DiskIdType = 'Number', - - [Parameter()] - [System.UInt32] - $RetryIntervalSec = 10, - - [Parameter()] - [System.UInt32] - $RetryCount = 60 - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.CheckingForDiskStatusMessage -f $DiskIdType,$DiskId) - ) -join '' ) - - $diskFound = $false - - $diskIdParameter = @{ - $DiskIdType = $DiskId - } - - for ($count = 0; $count -lt $RetryCount; $count++) - { - $disk = Get-Disk ` - @diskIdParameter ` - -ErrorAction SilentlyContinue - if ($disk) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.DiskFoundMessage -f $DiskIdType,$DiskId,$disk.FriendlyName) - ) -join '' ) - - $diskFound = $true - break - } - else - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.DiskNotFoundMessage -f $DiskIdType,$DiskId,$RetryIntervalSec) - ) -join '' ) - - Start-Sleep -Seconds $RetryIntervalSec - } # if - } # for - - if (-not $diskFound) - { - New-InvalidOperationException ` - -Message $($localizedData.DiskNotFoundAfterError -f $DiskIdType,$DiskId,$RetryCount) - } # if -} # function Set-TargetResource - -<# - .SYNOPSIS - Tests the current state of the wait for disk resource. - - .PARAMETER DiskId - Specifies the disk identifier for the disk to wait for. - - .PARAMETER DiskIdType - Specifies the identifier type the DiskId contains. Defaults to Number. - - .PARAMETER RetryIntervalSec - Specifies the number of seconds to wait for the disk to become available. - - .PARAMETER RetryCount - The number of times to loop the retry interval while waiting for the disk. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $DiskId, - - [Parameter()] - [ValidateSet('Number','UniqueId')] - [System.String] - $DiskIdType = 'Number', - - [Parameter()] - [System.UInt32] - $RetryIntervalSec = 10, - - [Parameter()] - [System.UInt32] - $RetryCount = 60 - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.CheckingForDiskStatusMessage -f $DiskIdType,$DiskId) - ) -join '' ) - - $diskIdParameter = @{ - $DiskIdType = $DiskId - } - - $disk = Get-Disk ` - @diskIdParameter ` - -ErrorAction SilentlyContinue - - if ($disk) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.DiskFoundMessage -f $DiskIdType,$DiskId,$disk.FriendlyName) - ) -join '' ) - - return $true - } - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.DiskNotFoundMessage -f $DiskIdType,$DiskId) - ) -join '' ) - - return $false -} # function Test-TargetResource - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xWaitForDisk/MSFT_xWaitForDisk.schema.mof b/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xWaitForDisk/MSFT_xWaitForDisk.schema.mof deleted file mode 100644 index 0d805552..00000000 --- a/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xWaitForDisk/MSFT_xWaitForDisk.schema.mof +++ /dev/null @@ -1,9 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xWaitForDisk")] -class MSFT_xWaitForDisk : OMI_BaseResource -{ - [Key, Description("Specifies the disk identifier for the disk to wait for.")] String DiskId; - [Write, Description("Specifies the identifier type the DiskId contains. Defaults to Number."), ValueMap{"Number","UniqueId"}, Values{"Number","UniqueId"}] String DiskIdType; - [Write, Description("Specifies the number of seconds to wait for the disk to become available.")] Uint32 RetryIntervalSec; - [Write, Description("The number of times to loop the retry interval while waiting for the disk.")] Uint32 RetryCount; -}; diff --git a/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xWaitForDisk/en-us/MSFT_xWaitForDisk.strings.psd1 b/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xWaitForDisk/en-us/MSFT_xWaitForDisk.strings.psd1 deleted file mode 100644 index 67cafd58..00000000 --- a/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xWaitForDisk/en-us/MSFT_xWaitForDisk.strings.psd1 +++ /dev/null @@ -1,12 +0,0 @@ -ConvertFrom-StringData @' - GettingWaitForDiskStatusMessage = Getting Wait for Disk status for disk with {0} '{1}'. - - SettingWaitForDiskStatusMessage = Waiting for disk status on disk with {0} '{1}'. - CheckingForDiskStatusMessage = Checking for disk with {0} '{1}'. - DiskFoundMessage = Found disk with {0} '{1}' named '{2}'. - DiskNotFoundRetryingMessage = Disk with {0} '{1}' not found, retrying in {2} seconds. - DiskNotFoundAfterError = Disk with {0} '{1}' not found after {2} counts. - - TestingWaitForDiskStatusMessage = Testing Wait for Disk status on disk with {0} '{1}'. - DiskNotFoundMessage = Disk with {0} '{1}' not found. -'@ diff --git a/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xWaitForVolume/MSFT_xWaitForVolume.psm1 b/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xWaitForVolume/MSFT_xWaitForVolume.psm1 deleted file mode 100644 index eafb9d3b..00000000 --- a/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xWaitForVolume/MSFT_xWaitForVolume.psm1 +++ /dev/null @@ -1,210 +0,0 @@ -# Suppressed as per PSSA Rule Severity guidelines for unit/integration tests: -# https://github.com/PowerShell/DscResources/blob/master/PSSARuleSeverities.md -[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '')] -param () - -$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' - -# Import the Storage Common Modules -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'StorageDsc.Common' ` - -ChildPath 'StorageDsc.Common.psm1')) - -# Import the Storage Resource Helper Module -Import-Module -Name (Join-Path -Path $modulePath ` - -ChildPath (Join-Path -Path 'StorageDsc.ResourceHelper' ` - -ChildPath 'StorageDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$localizedData = Get-LocalizedData ` - -ResourceName 'MSFT_xWaitForVolume' ` - -ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path) - -<# - .SYNOPSIS - Returns the current state of the wait for drive resource. - - .PARAMETER DriveLetter - Specifies the name of the drive to wait for. - - .PARAMETER RetryIntervalSec - Specifies the number of seconds to wait for the drive to become available. - - .PARAMETER RetryCount - The number of times to loop the retry interval while waiting for the drive. -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [String] - $DriveLetter, - - [Parameter()] - [UInt32] - $RetryIntervalSec = 10, - - [Parameter()] - [UInt32] - $RetryCount = 60 - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.GettingWaitForVolumeStatusMessage -f $DriveLetter) - ) -join '' ) - - # Validate the DriveLetter parameter - $DriveLetter = Assert-DriveLetterValid -DriveLetter $DriveLetter - - $returnValue = @{ - DriveLetter = $DriveLetter - RetryIntervalSec = $RetryIntervalSec - RetryCount = $RetryCount - } - return $returnValue -} # function Get-TargetResource - -<# - .SYNOPSIS - Sets the current state of the wait for drive resource. - - .PARAMETER DriveLetter - Specifies the name of the drive to wait for. - - .PARAMETER RetryIntervalSec - Specifies the number of seconds to wait for the drive to become available. - - .PARAMETER RetryCount - The number of times to loop the retry interval while waiting for the drive. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [String] - $DriveLetter, - - [Parameter()] - [UInt32] - $RetryIntervalSec = 10, - - [Parameter()] - [UInt32] - $RetryCount = 60 - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.CheckingForVolumeStatusMessage -f $DriveLetter) - ) -join '' ) - - # Validate the DriveLetter parameter - $DriveLetter = Assert-DriveLetterValid -DriveLetter $DriveLetter - - $volumeFound = $false - - for ($count = 0; $count -lt $RetryCount; $count++) - { - $volume = Get-Volume -DriveLetter $DriveLetter -ErrorAction SilentlyContinue - if ($volume) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.VolumeFoundMessage -f $DriveLetter) - ) -join '' ) - - $volumeFound = $true - break - } - else - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.VolumeNotFoundMessage -f $DriveLetter,$RetryIntervalSec) - ) -join '' ) - - Start-Sleep -Seconds $RetryIntervalSec - - # This command forces a refresh of the PS Drive subsystem. - # So triggers any "missing" drives to show up. - $null = Get-PSDrive - } # if - } # for - - if (-not $volumeFound) - { - New-InvalidOperationException ` - -Message $($localizedData.VolumeNotFoundAfterError -f $DriveLetter,$RetryCount) - } # if -} # function Set-TargetResource - -<# - .SYNOPSIS - Tests the current state of the wait for drive resource. - - .PARAMETER DriveLetter - Specifies the name of the drive to wait for. - - .PARAMETER RetryIntervalSec - Specifies the number of seconds to wait for the drive to become available. - - .PARAMETER RetryCount - The number of times to loop the retry interval while waiting for the drive. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [String] - $DriveLetter, - - [Parameter()] - [UInt32] - $RetryIntervalSec = 10, - - [Parameter()] - [UInt32] - $RetryCount = 60 - ) - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.TestingWaitForVolumeStatusMessage -f $DriveLetter) - ) -join '' ) - - # Validate the DriveLetter parameter - $DriveLetter = Assert-DriveLetterValid -DriveLetter $DriveLetter - - # This command forces a refresh of the PS Drive subsystem. - # So triggers any "missing" drives to show up. - $null = Get-PSDrive - - $volume = Get-Volume -DriveLetter $DriveLetter -ErrorAction SilentlyContinue - if ($volume) - { - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.VolumeFoundMessage -f $DriveLetter) - ) -join '' ) - - return $true - } - - Write-Verbose -Message ( @( - "$($MyInvocation.MyCommand): " - $($localizedData.VolumeNotFoundMessage -f $DriveLetter) - ) -join '' ) - - return $false -} # function Test-TargetResource - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xWaitForVolume/MSFT_xWaitForVolume.schema.mof b/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xWaitForVolume/MSFT_xWaitForVolume.schema.mof deleted file mode 100644 index 5c2fce88..00000000 --- a/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xWaitForVolume/MSFT_xWaitForVolume.schema.mof +++ /dev/null @@ -1,8 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xWaitForVolume")] -class MSFT_xWaitForVolume : OMI_BaseResource -{ - [Key, Description("Specifies the drive letter of the volume to wait for.")] String DriveLetter; - [Write, Description("Specifies the number of seconds to wait for the volume to become available.")] Uint32 RetryIntervalSec; - [Write, Description("The number of times to loop the retry interval while waiting for the volume.")] Uint32 RetryCount; -}; diff --git a/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xWaitForVolume/en-us/MSFT_xWaitForVolume.strings.psd1 b/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xWaitForVolume/en-us/MSFT_xWaitForVolume.strings.psd1 deleted file mode 100644 index 17115e90..00000000 --- a/lib/puppet_x/dsc_resources/xStorage/DSCResources/MSFT_xWaitForVolume/en-us/MSFT_xWaitForVolume.strings.psd1 +++ /dev/null @@ -1,12 +0,0 @@ -ConvertFrom-StringData @' - GettingWaitForVolumeStatusMessage = Getting Wait for Volume status for volume '{0}'. - - SettingWaitForVolumeStatusMessage = Waiting for Volume status on volume '{0}'. - CheckingForVolumeStatusMessage = Checking for volume '{0}'. - VolumeFoundMessage = Found volume '{0}'. - VolumeNotFoundRetryingMessage = Volume '{0}' not found, retrying in {1} seconds. - VolumeNotFoundAfterError = Volume '{0}' not found after {1} counts. - - TestingWaitForVolumeStatusMessage = Teting Wait for Volume status on volume '{0}'. - VolumeNotFoundMessage = Volume '{0}' not found. -'@ diff --git a/lib/puppet_x/dsc_resources/xStorage/LICENSE b/lib/puppet_x/dsc_resources/xStorage/LICENSE deleted file mode 100644 index 5f178f93..00000000 --- a/lib/puppet_x/dsc_resources/xStorage/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Michael Greene - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - diff --git a/lib/puppet_x/dsc_resources/xStorage/Modules/StorageDsc.Common/StorageDsc.Common.psm1 b/lib/puppet_x/dsc_resources/xStorage/Modules/StorageDsc.Common/StorageDsc.Common.psm1 deleted file mode 100644 index 3b29f1d2..00000000 --- a/lib/puppet_x/dsc_resources/xStorage/Modules/StorageDsc.Common/StorageDsc.Common.psm1 +++ /dev/null @@ -1,107 +0,0 @@ -# Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` - -ChildPath (Join-Path -Path 'StorageDsc.ResourceHelper' ` - -ChildPath 'StorageDsc.ResourceHelper.psm1')) - -# Import Localization Strings -$localizedData = Get-LocalizedData ` - -ResourceName 'StorageDsc.Common' ` - -ResourcePath $PSScriptRoot - -<# - .SYNOPSIS - Validates a Drive Letter, removing or adding the trailing colon if required. - - .PARAMETER DriveLetter - The Drive Letter string to validate. - - .PARAMETER Colon - Will ensure the returned string will include or exclude a colon. -#> -function Assert-DriveLetterValid -{ - [CmdletBinding()] - [OutputType([String])] - param - ( - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [System.String] - $DriveLetter, - - [Switch] - $Colon - ) - - $Matches = @([regex]::matches($DriveLetter, '^([A-Za-z]):?$', 'IgnoreCase')) - if (-not $Matches) - { - # DriveLetter format is invalid - New-InvalidArgumentException ` - -Message $($LocalizedData.InvalidDriveLetterFormatError -f $DriveLetter) ` - -ArgumentName 'DriveLetter' - } - # This is the drive letter without a colon - $DriveLetter = $Matches.Groups[1].Value - if ($Colon) - { - $DriveLetter = $DriveLetter + ':' - } # if - return $DriveLetter -} # end function Assert-DriveLetterValid - -<# - .SYNOPSIS - Validates an Access Path, removing or adding the trailing slash if required. - If the Access Path does not exist or is not a folder then an exception will - be thrown. - - .PARAMETER AccessPath - The Access Path string to validate. - - .PARAMETER Slash - Will ensure the returned path will include or exclude a slash. -#> -function Assert-AccessPathValid -{ - [CmdletBinding()] - [OutputType([String])] - param - ( - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [System.String] - $AccessPath, - - [Switch] - $Slash - ) - - if (-not (Test-Path -Path $AccessPath -PathType Container)) - { - # AccessPath is invalid - New-InvalidArgumentException ` - -Message $($LocalizedData.InvalidAccessPathError -f $AccessPath) ` - -ArgumentName 'AccessPath' - } # if - - # Remove or Add the trailing slash - if($AccessPath.EndsWith('\')) - { - if (-not $Slash) - { - $AccessPath = $AccessPath.TrimEnd('\') - } # if - } - else - { - if ($Slash) - { - $AccessPath = "$AccessPath\" - } # if - } # if - - return $AccessPath -} # end function Assert-AccessPathValid - -Export-ModuleMember -Function @( 'Assert-DriveLetterValid', 'Assert-AccessPathValid' ) diff --git a/lib/puppet_x/dsc_resources/xStorage/Modules/StorageDsc.Common/en-us/StorageDsc.Common.strings.psd1 b/lib/puppet_x/dsc_resources/xStorage/Modules/StorageDsc.Common/en-us/StorageDsc.Common.strings.psd1 deleted file mode 100644 index 8d5e1305..00000000 --- a/lib/puppet_x/dsc_resources/xStorage/Modules/StorageDsc.Common/en-us/StorageDsc.Common.strings.psd1 +++ /dev/null @@ -1,4 +0,0 @@ -ConvertFrom-StringData @' - InvalidDriveLetterFormatError = Drive Letter format '{0}' is not valid. - InvalidAccessPathError = Access Path '{0}' is not found. -'@ diff --git a/lib/puppet_x/dsc_resources/xStorage/Modules/StorageDsc.ResourceHelper/StorageDsc.ResourceHelper.psm1 b/lib/puppet_x/dsc_resources/xStorage/Modules/StorageDsc.ResourceHelper/StorageDsc.ResourceHelper.psm1 deleted file mode 100644 index f4d2fe68..00000000 --- a/lib/puppet_x/dsc_resources/xStorage/Modules/StorageDsc.ResourceHelper/StorageDsc.ResourceHelper.psm1 +++ /dev/null @@ -1,170 +0,0 @@ -<# - .SYNOPSIS - Tests if the current machine is a Nano server. -#> -function Test-IsNanoServer -{ - if (Test-Command -Name Get-ComputerInfo) - { - $computerInfo = Get-ComputerInfo - - if ("Server" -eq $computerInfo.OsProductType ` - -and "NanoServer" -eq $computerInfo.OsServerLevel) - { - return $true - } - } - - return $false -} - -<# - .SYNOPSIS - Tests if the the specified command is found. -#> -function Test-Command -{ - param - ( - [String] $Name - ) - - return ($null -ne (Get-Command -Name $Name -ErrorAction Continue 2> $null)) -} - -<# - .SYNOPSIS - Creates and throws an invalid argument exception - - .PARAMETER Message - The message explaining why this error is being thrown - - .PARAMETER ArgumentName - The name of the invalid argument that is causing this error to be thrown -#> -function New-InvalidArgumentException -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Message, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $ArgumentName - ) - - $argumentException = New-Object -TypeName 'ArgumentException' -ArgumentList @( $Message, - $ArgumentName ) - $newObjectParams = @{ - TypeName = 'System.Management.Automation.ErrorRecord' - ArgumentList = @( $argumentException, $ArgumentName, 'InvalidArgument', $null ) - } - $errorRecord = New-Object @newObjectParams - - throw $errorRecord -} - -<# - .SYNOPSIS - Creates and throws an invalid operation exception - - .PARAMETER Message - The message explaining why this error is being thrown - - .PARAMETER ErrorRecord - The error record containing the exception that is causing this terminating error -#> -function New-InvalidOperationException -{ - [CmdletBinding()] - param - ( - [ValidateNotNullOrEmpty()] - [String] - $Message, - - [ValidateNotNull()] - [System.Management.Automation.ErrorRecord] - $ErrorRecord - ) - - if ($null -eq $Message) - { - $invalidOperationException = New-Object -TypeName 'InvalidOperationException' - } - elseif ($null -eq $ErrorRecord) - { - $invalidOperationException = - New-Object -TypeName 'InvalidOperationException' -ArgumentList @( $Message ) - } - else - { - $invalidOperationException = - New-Object -TypeName 'InvalidOperationException' -ArgumentList @( $Message, - $ErrorRecord.Exception ) - } - - $newObjectParams = @{ - TypeName = 'System.Management.Automation.ErrorRecord' - ArgumentList = @( $invalidOperationException.ToString(), 'MachineStateIncorrect', - 'InvalidOperation', $null ) - } - $errorRecordToThrow = New-Object @newObjectParams - throw $errorRecordToThrow -} - -<# - .SYNOPSIS - Retrieves the localized string data based on the machine's culture. - Falls back to en-US strings if the machine's culture is not supported. - - .PARAMETER ResourceName - The name of the resource as it appears before '.strings.psd1' of the localized string file. - - For example: - For WindowsOptionalFeature: MSFT_xWindowsOptionalFeature - For Service: MSFT_xServiceResource - For Registry: MSFT_xRegistryResource - - .PARAMETER ResourcePath - The path the resource file is located in. -#> -function Get-LocalizedData -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $ResourceName, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $ResourcePath - ) - - $localizedStringFileLocation = Join-Path -Path $ResourcePath -ChildPath $PSUICulture - - if (-not (Test-Path -Path $localizedStringFileLocation)) - { - # Fallback to en-US - $localizedStringFileLocation = Join-Path -Path $ResourcePath -ChildPath 'en-US' - } - - Import-LocalizedData ` - -BindingVariable 'localizedData' ` - -FileName "$ResourceName.strings.psd1" ` - -BaseDirectory $localizedStringFileLocation - - return $localizedData -} - -Export-ModuleMember -Function @( 'Test-IsNanoServer', 'New-InvalidArgumentException', - 'New-InvalidOperationException', 'Get-LocalizedData' ) diff --git a/lib/puppet_x/dsc_resources/xStorage/xStorage.psd1 b/lib/puppet_x/dsc_resources/xStorage/xStorage.psd1 deleted file mode 100644 index d9a63e9d..00000000 --- a/lib/puppet_x/dsc_resources/xStorage/xStorage.psd1 +++ /dev/null @@ -1,137 +0,0 @@ -# -# Module manifest for module 'xStorage' -# -# Generated on: 6/14/2015 -# - -@{ - -# Script module or binary module file associated with this manifest. -# RootModule = '' - -# Version number of this module. -ModuleVersion = '3.2.0.0' - -# ID used to uniquely identify this module -GUID = '00d73ca1-58b5-46b7-ac1a-5bfcf5814faf' - -# Author of this module -Author = 'PowerShell DSC' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '2015' - -# Description of the functionality provided by this module -Description = 'This module contains all resources related to the PowerShell Storage module, or pertaining to disk management.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Name of the Windows PowerShell host required by this module -# PowerShellHostName = '' - -# Minimum version of the Windows PowerShell host required by this module -# PowerShellHostVersion = '' - -# Minimum version of Microsoft .NET Framework required by this module -# DotNetFrameworkVersion = '' - -# Minimum version of the common language runtime (CLR) required by this module -# CLRVersion = '' - -# Processor architecture (None, X86, Amd64) required by this module -# ProcessorArchitecture = '' - -# Modules that must be imported into the global environment prior to importing this module -# RequiredModules = @() - -# Assemblies that must be loaded prior to importing this module -# RequiredAssemblies = @() - -# Script files (.ps1) that are run in the caller's environment prior to importing this module. -# ScriptsToProcess = @() - -# Type files (.ps1xml) to be loaded when importing this module -# TypesToProcess = @() - -# Format files (.ps1xml) to be loaded when importing this module -# FormatsToProcess = @() - -# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess -# NestedModules = @() - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Variables to export from this module -VariablesToExport = '*' - -# Aliases to export from this module -AliasesToExport = '*' - -# DSC resources to export from this module -# DscResourcesToExport = @() - -# List of all modules packaged with this module -# ModuleList = @() - -# List of all files packaged with this module -# FileList = @() - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/xStorage/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/xStorage' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - ReleaseNotes = '- xDisk: - - Fix error message when new partition does not become writable before timeout. - - Removed unneeded timeout initialization code. -- xDiskAccessPath: - - Fix error message when new partition does not become writable before timeout. - - Removed unneeded timeout initialization code. - - Fix error when used on Windows Server 2012 R2 - See [Issue 102](https://github.com/PowerShell/xStorage/issues/102). -- Added the VS Code PowerShell extension formatting settings that cause PowerShell - files to be formatted as per the DSC Resource kit style guidelines. -- Removed requirement on Hyper-V PowerShell module to execute integration tests. -- xMountImage: - - Fix error when mounting VHD on Windows Server 2012 R2 - See [Issue 105](https://github.com/PowerShell/xStorage/issues/105) - -' - - } # End of PSData hashtable - -} # End of PrivateData hashtable - -# HelpInfo URI of this module -# HelpInfoURI = '' - -# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. -# DefaultCommandPrefix = '' - -} - - - - - - - diff --git a/lib/puppet_x/dsc_resources/xTimeZone/DSCResources/SetTimeZone.cs b/lib/puppet_x/dsc_resources/xTimeZone/DSCResources/SetTimeZone.cs deleted file mode 100644 index 8a71c3c6..00000000 --- a/lib/puppet_x/dsc_resources/xTimeZone/DSCResources/SetTimeZone.cs +++ /dev/null @@ -1,268 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Security; -using System.Runtime.InteropServices; -using Microsoft.Win32; -namespace Microsoft.PowerShell.xTimeZone -{ - [StructLayoutAttribute(LayoutKind.Sequential)] - public struct SystemTime - { - [MarshalAs(UnmanagedType.U2)] - public short Year; - [MarshalAs(UnmanagedType.U2)] - public short Month; - [MarshalAs(UnmanagedType.U2)] - public short DayOfWeek; - [MarshalAs(UnmanagedType.U2)] - public short Day; - [MarshalAs(UnmanagedType.U2)] - public short Hour; - [MarshalAs(UnmanagedType.U2)] - public short Minute; - [MarshalAs(UnmanagedType.U2)] - public short Second; - [MarshalAs(UnmanagedType.U2)] - public short Milliseconds; - } - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] - public struct TimeZoneInformation - { - [MarshalAs(UnmanagedType.I4)] - public int Bias; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x20)] - public string StandardName; - public SystemTime StandardDate; - [MarshalAs(UnmanagedType.I4)] - public int StandardBias; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x20)] - public string DaylightName; - public SystemTime DaylightDate; - [MarshalAs(UnmanagedType.I4)] - public int DaylightBias; - } - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] - public struct DynamicTimeZoneInformation - { - public int Bias; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] - public string StandardName; - public SystemTime StandardDate; - public int StandardBias; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] - public string DaylightName; - public SystemTime DaylightDate; - public int DaylightBias; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] - public string TimeZoneKeyName; - [MarshalAs(UnmanagedType.U1)] - public bool DynamicDaylightTimeDisabled; - } - [StructLayout(LayoutKind.Sequential)] - public struct RegistryTimeZoneInformation - { - [MarshalAs(UnmanagedType.I4)] - public int Bias; - [MarshalAs(UnmanagedType.I4)] - public int StandardBias; - [MarshalAs(UnmanagedType.I4)] - public int DaylightBias; - public SystemTime StandardDate; - public SystemTime DaylightDate; - public RegistryTimeZoneInformation(TimeZoneInformation tzi) - { - this.Bias = tzi.Bias; - this.StandardDate = tzi.StandardDate; - this.StandardBias = tzi.StandardBias; - this.DaylightDate = tzi.DaylightDate; - this.DaylightBias = tzi.DaylightBias; - } - public RegistryTimeZoneInformation(byte[] bytes) - { - if ((bytes == null) || (bytes.Length != 0x2c)) - { - throw new ArgumentException("Argument_InvalidREG_TZI_FORMAT"); - } - this.Bias = BitConverter.ToInt32(bytes, 0); - this.StandardBias = BitConverter.ToInt32(bytes, 4); - this.DaylightBias = BitConverter.ToInt32(bytes, 8); - this.StandardDate.Year = BitConverter.ToInt16(bytes, 12); - this.StandardDate.Month = BitConverter.ToInt16(bytes, 14); - this.StandardDate.DayOfWeek = BitConverter.ToInt16(bytes, 0x10); - this.StandardDate.Day = BitConverter.ToInt16(bytes, 0x12); - this.StandardDate.Hour = BitConverter.ToInt16(bytes, 20); - this.StandardDate.Minute = BitConverter.ToInt16(bytes, 0x16); - this.StandardDate.Second = BitConverter.ToInt16(bytes, 0x18); - this.StandardDate.Milliseconds = BitConverter.ToInt16(bytes, 0x1a); - this.DaylightDate.Year = BitConverter.ToInt16(bytes, 0x1c); - this.DaylightDate.Month = BitConverter.ToInt16(bytes, 30); - this.DaylightDate.DayOfWeek = BitConverter.ToInt16(bytes, 0x20); - this.DaylightDate.Day = BitConverter.ToInt16(bytes, 0x22); - this.DaylightDate.Hour = BitConverter.ToInt16(bytes, 0x24); - this.DaylightDate.Minute = BitConverter.ToInt16(bytes, 0x26); - this.DaylightDate.Second = BitConverter.ToInt16(bytes, 40); - this.DaylightDate.Milliseconds = BitConverter.ToInt16(bytes, 0x2a); - } - } - public class TokenPrivilegesAccess - { - [DllImport("advapi32.dll", CharSet = CharSet.Auto)] - public static extern int OpenProcessToken(int ProcessHandle, int DesiredAccess, - ref int tokenhandle); - [DllImport("kernel32.dll", CharSet = CharSet.Auto)] - public static extern int GetCurrentProcess(); - [DllImport("advapi32.dll", CharSet = CharSet.Auto)] - public static extern int LookupPrivilegeValue(string lpsystemname, string lpname, - [MarshalAs(UnmanagedType.Struct)] ref LUID lpLuid); - [DllImport("advapi32.dll", CharSet = CharSet.Auto)] - public static extern int AdjustTokenPrivileges(int tokenhandle, int disableprivs, - [MarshalAs(UnmanagedType.Struct)]ref TOKEN_PRIVILEGE Newstate, int bufferlength, - int PreivousState, int Returnlength); - public const int TOKEN_ASSIGN_PRIMARY = 0x00000001; - public const int TOKEN_DUPLICATE = 0x00000002; - public const int TOKEN_IMPERSONATE = 0x00000004; - public const int TOKEN_QUERY = 0x00000008; - public const int TOKEN_QUERY_SOURCE = 0x00000010; - public const int TOKEN_ADJUST_PRIVILEGES = 0x00000020; - public const int TOKEN_ADJUST_GROUPS = 0x00000040; - public const int TOKEN_ADJUST_DEFAULT = 0x00000080; - public const UInt32 SE_PRIVILEGE_ENABLED_BY_DEFAULT = 0x00000001; - public const UInt32 SE_PRIVILEGE_ENABLED = 0x00000002; - public const UInt32 SE_PRIVILEGE_REMOVED = 0x00000004; - public const UInt32 SE_PRIVILEGE_USED_FOR_ACCESS = 0x80000000; - public static bool EnablePrivilege(string privilege) - { - try - { - int token = 0; - int retVal = 0; - TOKEN_PRIVILEGE TP = new TOKEN_PRIVILEGE(); - LUID LD = new LUID(); - retVal = OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, ref token); - retVal = LookupPrivilegeValue(null, privilege, ref LD); - TP.PrivilegeCount = 1; - var luidAndAtt = new LUID_AND_ATTRIBUTES(); - luidAndAtt.Attributes = SE_PRIVILEGE_ENABLED; - luidAndAtt.Luid = LD; - TP.Privilege = luidAndAtt; - retVal = AdjustTokenPrivileges(token, 0, ref TP, 1024, 0, 0); - return true; - } - catch - { - return false; - } - } - public static bool DisablePrivilege(string privilege) - { - try - { - int token = 0; - int retVal = 0; - TOKEN_PRIVILEGE TP = new TOKEN_PRIVILEGE(); - LUID LD = new LUID(); - retVal = OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, ref token); - retVal = LookupPrivilegeValue(null, privilege, ref LD); - TP.PrivilegeCount = 1; - // TP.Attributes should be none (not set) to disable privilege - var luidAndAtt = new LUID_AND_ATTRIBUTES(); - luidAndAtt.Luid = LD; - TP.Privilege = luidAndAtt; - retVal = AdjustTokenPrivileges(token, 0, ref TP, 1024, 0, 0); - return true; - } - catch - { - return false; - } - } - } - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] - public struct LUID - { - internal uint LowPart; - internal uint HighPart; - } - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] - public struct LUID_AND_ATTRIBUTES - { - internal LUID Luid; - internal uint Attributes; - } - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] - public struct TOKEN_PRIVILEGE - { - internal uint PrivilegeCount; - internal LUID_AND_ATTRIBUTES Privilege; - } - public class TimeZone - { - public const int ERROR_ACCESS_DENIED = 0x005; - public const int CORSEC_E_MISSING_STRONGNAME = -2146233317; - [DllImport("kernel32.dll", CharSet = CharSet.Auto)] - private static extern bool SetTimeZoneInformation([In] ref TimeZoneInformation lpTimeZoneInformation); - [DllImport("kernel32.dll", CharSet = CharSet.Auto)] - private static extern bool SetDynamicTimeZoneInformation([In] ref DynamicTimeZoneInformation lpTimeZoneInformation); - public static void Set(string name) - { - var regTimeZones = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones"); - // Print out all the possible time-zones. - //foreach(var subKey in regTimeZones.GetSubKeyNames()) - //{ - // Console.WriteLine(subKey); - //} - var subKey = regTimeZones.GetSubKeyNames().Where(s => s == name).First(); - string daylightName = (string)regTimeZones.OpenSubKey(subKey).GetValue("Dlt"); - string standardName = (string)regTimeZones.OpenSubKey(subKey).GetValue("Std"); - byte[] tzi = (byte[])regTimeZones.OpenSubKey(subKey).GetValue("TZI"); - var regTzi = new RegistryTimeZoneInformation(tzi); - TokenPrivilegesAccess.EnablePrivilege("SeTimeZonePrivilege"); - bool didSet; - if (Environment.OSVersion.Version.Major < 6) - { - var tz = new TimeZoneInformation(); - tz.Bias = regTzi.Bias; - tz.DaylightBias = regTzi.DaylightBias; - tz.StandardBias = regTzi.StandardBias; - tz.DaylightDate = regTzi.DaylightDate; - tz.StandardDate = regTzi.StandardDate; - tz.DaylightName = daylightName; - tz.StandardName = standardName; - didSet = TimeZone.SetTimeZoneInformation(ref tz); - } - else - { - var tz = new DynamicTimeZoneInformation(); - tz.Bias = regTzi.Bias; - tz.DaylightBias = regTzi.DaylightBias; - tz.StandardBias = regTzi.StandardBias; - tz.DaylightDate = regTzi.DaylightDate; - tz.StandardDate = regTzi.StandardDate; - tz.DaylightName = daylightName; - tz.StandardName = standardName; - tz.TimeZoneKeyName = subKey; - tz.DynamicDaylightTimeDisabled = false; - didSet = TimeZone.SetDynamicTimeZoneInformation(ref tz); - } - int lastError = Marshal.GetLastWin32Error(); - TokenPrivilegesAccess.DisablePrivilege("SeTimeZonePrivilege"); - if (! didSet) - { - if (lastError == TimeZone.ERROR_ACCESS_DENIED) - { - throw new SecurityException("Access denied changing System Timezone."); - } - else if (lastError == TimeZone.CORSEC_E_MISSING_STRONGNAME) - { - throw new SystemException("Application is not signed."); - } - else - { - throw new SystemException("Win32Error: " + lastError + "\nHRESULT: " + Marshal.GetHRForLastWin32Error()); - } - } - } - } -} diff --git a/lib/puppet_x/dsc_resources/xTimeZone/DSCResources/TimezoneHelper.psm1 b/lib/puppet_x/dsc_resources/xTimeZone/DSCResources/TimezoneHelper.psm1 deleted file mode 100644 index db060482..00000000 --- a/lib/puppet_x/dsc_resources/xTimeZone/DSCResources/TimezoneHelper.psm1 +++ /dev/null @@ -1,189 +0,0 @@ -#region localizeddata -if (Test-Path "${PSScriptRoot}\${PSUICulture}") -{ - Import-LocalizedData ` - -BindingVariable LocalizedData ` - -Filename TimezoneHelper.psd1 ` - -BaseDirectory "${PSScriptRoot}\${PSUICulture}" -} -else -{ - #fallback to en-US - Import-LocalizedData ` - -BindingVariable LocalizedData ` - -Filename TimezoneHelper.psd1 ` - -BaseDirectory "${PSScriptRoot}\en-US" -} -#endregion - -<# - .SYNOPSIS - Internal function to throw terminating error with specified errroCategory, errorId and errorMessage -#> -function New-TerminatingError -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory)] - [String] $ErrorId, - - [Parameter(Mandatory)] - [String] $ErrorMessage, - - [Parameter(Mandatory)] - [System.Management.Automation.ErrorCategory] $ErrorCategory - ) - - $exception = New-Object System.InvalidOperationException $errorMessage - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - throw $errorRecord -} # function New-TerminatingError - -<# - .SYNOPSIS - Get the of the current timezone Id. - -#> -function Get-TimeZoneId -{ - [CmdletBinding()] - param() - - if (Test-Command -Name 'Get-Timezone' -Module 'Microsoft.PowerShell.Management') - { - Write-Verbose -Message ($LocalizedData.GettingTimezoneMessage -f 'Cmdlets') - - $Timezone = (Get-Timezone).StandardName - } - else - { - Write-Verbose -Message ($LocalizedData.GettingTimezoneMessage -f 'CIM') - - $TimeZone = (Get-CimInstance ` - -ClassName WIN32_Timezone ` - -Namespace root\cimv2).StandardName - } - - Write-Verbose -Message ($LocalizedData.CurrentTimezoneMessage ` - -f $Timezone) - - $timeZoneInfo = [System.TimeZoneInfo]::GetSystemTimeZones() | - Where-Object StandardName -eq $TimeZone - - return $timeZoneInfo.Id -} # function Get-TimeZoneId - -<# - .SYNOPSIS - Compare a timezone Id with the current timezone Id -#> -function Test-TimeZoneId -{ - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [System.String] - $TimeZoneId - ) - # Test Expected is same as Current - $currentTimeZoneId = Get-TimeZoneId - - return $TimeZoneId -eq $currentTimeZoneId -} # function Test-TimeZoneId - -<# - .SYNOPSIS - Sets the current timezone using a timezone Id -#> -function Set-TimeZoneId -{ - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [System.String] - $TimeZoneId - ) - - if (Test-Command -Name 'Set-Timezone' -Module 'Microsoft.PowerShell.Management') - { - Set-Timezone -Id $TimezoneId - } - else - { - if (Test-Command -Name 'Add-Type' -Module 'Microsoft.Powershell.Utility') - { - # We can use Reflection to modify the TimeZone - Write-Verbose -Message ($LocalizedData.SettingTimezoneMessage ` - -f $TimeZoneId,'.NET') - - Set-TimeZoneUsingNET -TimezoneId $TimeZoneId - } - else - { - # For anything else use TZUTIL.EXE - Write-Verbose -Message ($LocalizedData.SettingTimezoneMessage ` - -f $TimeZoneId,'TZUTIL.EXE') - - try - { - & tzutil.exe @('/s',$TimeZoneId) - } - catch - { - $ErrorMsg = $_.Exception.Message - Write-Verbose -Message $ErrorMsg - } # try - } # if - } # if - - Write-Verbose -Message ($LocalizedData.TimezoneUpdatedMessage ` - -f $TimeZone) -} # function Set-TimeZoneId - -<# - .SYNOPSIS - This function exists so that the ::Set method can be mocked by Pester. -#> -function Set-TimeZoneUsingNET { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [System.String] - $TimeZoneId - ) - - # Add the [TimeZoneHelper.TimeZone] type if it is not defined. - if (-not ([System.Management.Automation.PSTypeName]'TimeZoneHelper.TimeZone').Type) - { - Write-Verbose -Message ($LocalizedData.AddingSetTimeZonedotNetTypeMessage) - $SetTimeZoneCs = Get-Content ` - -Path (Join-Path -Path $PSScriptRoot -ChildPath 'SetTimeZone.cs') ` - -Raw - Add-Type ` - -Language CSharp ` - -TypeDefinition $SetTimeZoneCs - } # if - - [Microsoft.PowerShell.xTimeZone.TimeZone]::Set($TimeZoneId) -} # function Set-TimeZoneUsingNET - -<# - .SYNOPSIS - This function tests if a cmdlet exists. -#> -function Test-Command { - [CmdletBinding()] - [OutputType([boolean])] - param( - [Parameter(Mandatory = $true)] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [System.String] - $Module - ) - - return ($null -ne (Get-Command @PSBoundParameters -ErrorAction SilentlyContinue)) -} # function Test-Command diff --git a/lib/puppet_x/dsc_resources/xTimeZone/DSCResources/en-us/TimezoneHelper.psd1 b/lib/puppet_x/dsc_resources/xTimeZone/DSCResources/en-us/TimezoneHelper.psd1 deleted file mode 100644 index 3224adb2..00000000 --- a/lib/puppet_x/dsc_resources/xTimeZone/DSCResources/en-us/TimezoneHelper.psd1 +++ /dev/null @@ -1,8 +0,0 @@ -# culture="en-US" -ConvertFrom-StringData -StringData @' - CurrentTimezoneMessage=Current Timezone is set to '{0}' - GettingTimezoneCimMessage=Getting current Timezone using {0} - SettingTimezoneMessage=Setting Timezone to '{0}' using {1} - TimezoneUpdatedMessage=Timezone has been updated to '{0}' - AddingSetTimeZonedotNetTypeMessage=Adding .NET Set Timezone Type -'@ diff --git a/lib/puppet_x/dsc_resources/xTimeZone/DSCResources/xTimeZone/en-us/xTimeZone.psd1 b/lib/puppet_x/dsc_resources/xTimeZone/DSCResources/xTimeZone/en-us/xTimeZone.psd1 deleted file mode 100644 index ebbbfe2e..00000000 --- a/lib/puppet_x/dsc_resources/xTimeZone/DSCResources/xTimeZone/en-us/xTimeZone.psd1 +++ /dev/null @@ -1,6 +0,0 @@ -# culture="en-US" -ConvertFrom-StringData -StringData @' - ReplaceSystemTimezoneMessage=Replace the System Time Zone - SettingTimezoneMessage=Setting the TimeZone. - TimezoneAlreadySetMessage=TimeZone already set to {0}. -'@ diff --git a/lib/puppet_x/dsc_resources/xTimeZone/DSCResources/xTimeZone/xTimeZone.psm1 b/lib/puppet_x/dsc_resources/xTimeZone/DSCResources/xTimeZone/xTimeZone.psm1 deleted file mode 100644 index 4e7e2e81..00000000 --- a/lib/puppet_x/dsc_resources/xTimeZone/DSCResources/xTimeZone/xTimeZone.psm1 +++ /dev/null @@ -1,119 +0,0 @@ -#--------------------------------------------------------------------------------- -#The sample scripts are not supported under any Microsoft standard support -#program or service. The sample scripts are provided AS IS without warranty -#of any kind. Microsoft further disclaims all implied warranties including, -#without limitation, any implied warranties of merchantability or of fitness for -#a particular purpose. The entire risk arising out of the use or performance of -#the sample scripts and documentation remains with you. In no event shall -#Microsoft, its authors, or anyone else involved in the creation, production, or -#delivery of the scripts be liable for any damages whatsoever (including, -#without limitation, damages for loss of business profits, business interruption, -#loss of business information, or other pecuniary loss) arising out of the use -#of or inability to use the sample scripts or documentation, even if Microsoft -#has been advised of the possibility of such damages -#--------------------------------------------------------------------------------- -#region localizeddata -if (Test-Path "${PSScriptRoot}\${PSUICulture}") -{ - Import-LocalizedData ` - -BindingVariable LocalizedData ` - -Filename xTimeZone.psd1 ` - -BaseDirectory "${PSScriptRoot}\${PSUICulture}" -} -else -{ - #fallback to en-US - Import-LocalizedData ` - -BindingVariable LocalizedData ` - -Filename xTimeZone.psd1 ` - -BaseDirectory "${PSScriptRoot}\en-US" -} -#endregion - -# Load the Helper Module -Import-Module -Name "$PSScriptRoot\..\TimezoneHelper.psm1" -Verbose:$false - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [String] - $IsSingleInstance, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $TimeZone - ) - - # Get the current TimeZone Id - $CurrentTimeZone = Get-TimeZoneId - - $returnValue = @{ - TimeZone = $CurrentTimeZone - IsSingleInstance = 'Yes' - } - - # Output the target resource - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [String] - $IsSingleInstance, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $TimeZone - ) - - $CurrentTimeZone = Get-TimeZoneId - - if($PSCmdlet.ShouldProcess("'$TimeZone'",$LocalizedData.ReplaceSystemTimezoneMessage)) - { - if($CurrentTimeZone -ne $TimeZone) - { - Write-Verbose -Message ($LocalizedData.SettingTimezoneMessage) - Set-TimeZoneId -TimeZone $TimeZone - } - else - { - Write-Verbose -Message ($LocalizedData.TimezoneAlreadySetMessage ` - -f $Timezone) - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet('Yes')] - [String] - $IsSingleInstance, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $TimeZone - ) - return Test-TimeZoneId -TimeZoneId $TimeZone -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xTimeZone/DSCResources/xTimeZone/xTimeZone.schema.mof b/lib/puppet_x/dsc_resources/xTimeZone/DSCResources/xTimeZone/xTimeZone.schema.mof deleted file mode 100644 index 1c0432f6..00000000 --- a/lib/puppet_x/dsc_resources/xTimeZone/DSCResources/xTimeZone/xTimeZone.schema.mof +++ /dev/null @@ -1,6 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xTimeZone")] -class xTimeZone : OMI_BaseResource -{ - [Key, Description("Specifies the resource is a single instance, the value must be 'Yes'"), ValueMap{"Yes"}, Values{"Yes"}] String IsSingleInstance; - [Required, Description("Specifies the TimeZone.")] String TimeZone; -}; diff --git a/lib/puppet_x/dsc_resources/xTimeZone/LICENSE b/lib/puppet_x/dsc_resources/xTimeZone/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xTimeZone/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xTimeZone/xTimeZone.psd1 b/lib/puppet_x/dsc_resources/xTimeZone/xTimeZone.psd1 deleted file mode 100644 index ad8a094b..00000000 --- a/lib/puppet_x/dsc_resources/xTimeZone/xTimeZone.psd1 +++ /dev/null @@ -1,66 +0,0 @@ -@{ - -# Version number of this module. -ModuleVersion = '1.6.0.0' - -# ID used to uniquely identify this module -GUID = 'd75e53f2-47fc-4ee7-97af-8d257d3e0151' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'This DSC Resources can easily set the System Time Zone.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Functions to export from this module -# FunctionsToExport = '' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Variables to export from this module -VariablesToExport = '*' - -# Aliases to export from this module -AliasesToExport = '*' - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/xTimeZone/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/xTimeZone' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - ReleaseNotes = '* Add support for Nano Server and WMF5.1 via Get-Timezone/Set-Timezone cmdlets. -* Minor changes to bring make resource ready for HQRM. -* Renamed and reworked functions in TimezoneHelper.psm1 to prevent conflicts with new built-in WMF5.1 Timezone Cmdlets. -* Fixed localization so that failback to en-US if culture specific language files not available. -* Moved code to init C' - - } # End of PSData hashtable - -} # End of PrivateData hashtable -} - - - diff --git a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/Helper.psm1 b/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/Helper.psm1 deleted file mode 100644 index 2f87aaf7..00000000 --- a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/Helper.psm1 +++ /dev/null @@ -1,63 +0,0 @@ -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData -StringData @' - ModuleNotFound = Please ensure that the PowerShell module for role {0} is installed. -'@ -} - -<# - .SYNOPSIS - Internal function to throw terminating error with specified - errroCategory, errorId and errorMessage - .PARAMETER ErrorId - Specifies the Id error message. - .PARAMETER ErrorMessage - Specifies full Error Message to be returned. - .PARAMETER ErrorCategory - Specifies Error Category. -#> -function New-TerminatingError -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory)] - [String] $ErrorId, - - [Parameter(Mandatory)] - [String] $ErrorMessage, - - [Parameter(Mandatory)] - [System.Management.Automation.ErrorCategory] $ErrorCategory - ) - - $exception = New-Object System.InvalidOperationException $ErrorMessage - $errorRecord = New-Object System.Management.Automation.ErrorRecord ` - $exception, $ErrorId, $ErrorCategory, $null - throw $errorRecord -} - -<# - .SYNOPSIS - Internal function to assert if the module exists - .PARAMETER ModuleName - Module to test -#> -function Assert-Module -{ - [CmdletBinding()] - param - ( - [String]$ModuleName = 'WebAdministration' - ) - - if(-not(Get-Module -Name $ModuleName -ListAvailable)) - { - $errorMsg = $($LocalizedData.ModuleNotFound) -f $ModuleName - New-TerminatingError -ErrorId 'ModuleNotFound' ` - -ErrorMessage $errorMsg ` - -ErrorCategory ObjectNotFound - } -} diff --git a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIIsHandler/MSFT_xIisHandler.psm1 b/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIIsHandler/MSFT_xIisHandler.psm1 deleted file mode 100644 index a6bf6d7b..00000000 --- a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIIsHandler/MSFT_xIisHandler.psm1 +++ /dev/null @@ -1,959 +0,0 @@ -# Load the Helper Module -Import-Module -Name "$PSScriptRoot\..\Helper.psm1" - -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData -StringData @' - NoWebAdministrationModule = Please ensure that WebAdministration module is installed. - AddingHandler = Adding handler '{0}' - RemovingHandler = Removing handler '{0}' - HandlerExists = Handler with name '{0}' already exist - HandlerNotPresent = Handler with name '{0}' is not present as requested - HandlerNotSupported = The handler with name '{0}' is not supported. - VerboseGetTargetPresent = Handler is present - VerboseGetTargetAbsent = Handler is absent -'@ -} - -#region script variables -$script:handlers = @{ - 'aspq-Integrated-4.0' = (New-Object PSObject -Property @{ - Name = 'aspq-Integrated-4.0'; - Path = '*.aspq'; - Verb = 'GET,HEAD,POST,DEBUG'; - Type = 'System.Web.HttpForbiddenHandler'; - PreCondition = 'integratedMode,runtimeVersionv4.0' - }); - - 'aspq-ISAPI-4.0_32bit' = (New-Object PSObject -Property @{ - Name = 'aspq-ISAPI-4.0_32bit'; - Path = '*.aspq'; - Verb = '*'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv4.0,bitness32'; - ResponseBufferLimit = '0' - }); - - 'aspq-ISAPI-4.0_64bit' = (New-Object PSObject -Property @{ - Name = 'aspq-ISAPI-4.0_64bit'; - Path = '*.aspq'; - Verb = '*'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv4.0,bitness64'; - ResponseBufferLimit = '0' - }); - - 'AssemblyResourceLoader-Integrated-4.0' = (New-Object PSObject -Property @{ - Name = 'AssemblyResourceLoader-Integrated-4.0'; - Path = 'WebResource.axd'; - Verb = 'GET,DEBUG'; - Type = 'System.Web.Handlers.AssemblyResourceLoader'; - PreCondition = 'integratedMode,runtimeVersionv4.0' - }); - - 'AssemblyResourceLoader-Integrated' = (New-Object PSObject -Property @{ - Name = 'AssemblyResourceLoader-Integrated'; - Path = 'WebResource.axd'; - Verb = 'GET,DEBUG'; - Type = 'System.Web.Handlers.AssemblyResourceLoader'; - PreCondition = 'integratedMode' - }); - - 'AXD-ISAPI-2.0-64' = (New-Object PSObject -Property @{ - Name = 'AXD-ISAPI-2.0-64'; - Path = '*.axd'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv2.0,bitness64'; - ResponseBufferLimit = '0' - }); - - 'AXD-ISAPI-2.0' = (New-Object PSObject -Property @{ - Name = 'AXD-ISAPI-2.0'; - Path = '*.axd'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv2.0,bitness32'; - ResponseBufferLimit = '0' - }); - - 'AXD-ISAPI-4.0_32bit' = (New-Object PSObject -Property @{ - Name = 'AXD-ISAPI-4.0_32bit'; - Path = '*.axd'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv4.0,bitness32'; - ResponseBufferLimit = '0' - }); - - 'AXD-ISAPI-4.0_64bit' = (New-Object PSObject -Property @{ - Name = 'AXD-ISAPI-4.0_64bit'; - Path = '*.axd'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv4.0,bitness64'; - ResponseBufferLimit = '0' - }); - - 'CGI-exe' = (New-Object PSObject -Property @{ - Name = 'CGI-exe'; - Path = '*.exe'; - Verb = '*'; - Modules = 'CgiModule'; - ResourceType = 'File'; - RequireAccess = 'Execute'; - AllowPathInfo = 'true' - }); - - 'ClientLoggingHandler' = (New-Object PSObject -Property @{ - Name = 'ClientLoggingHandler'; - Path = '*.log'; - Verb = 'POST'; - Modules = 'ClientLoggingHandler'; - ResourceType = 'Unspecified'; - RequireAccess = 'None' - }); - - 'cshtm-Integrated-4.0' = (New-Object PSObject -Property @{ - Name = 'cshtm-Integrated-4.0'; - Path = '*.cshtm'; - Verb = 'GET,HEAD,POST,DEBUG'; - Type = 'System.Web.HttpForbiddenHandler'; - PreCondition = 'integratedMode,runtimeVersionv4.0' - }); - - 'cshtm-ISAPI-4.0_32bit' = (New-Object PSObject -Property @{ - Name = 'cshtm-ISAPI-4.0_32bit'; - Path = '*.cshtm'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv4.0,bitness32'; - ResponseBufferLimit = '0' - }); - - 'cshtm-ISAPI-4.0_64bit' = (New-Object PSObject -Property @{ - Name = 'cshtm-ISAPI-4.0_64bit'; - Path = '*.cshtm'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv4.0,bitness64'; - ResponseBufferLimit = '0' - }); - - 'cshtml-Integrated-4.0' = (New-Object PSObject -Property @{ - Name = 'cshtml-Integrated-4.0'; - Path = '*.cshtml'; - Verb = 'GET,HEAD,POST,DEBUG'; - Type = 'System.Web.HttpForbiddenHandler'; - PreCondition = 'integratedMode,runtimeVersionv4.0' - }); - - 'cshtml-ISAPI-4.0_32bit' = (New-Object PSObject -Property @{ - Name = 'cshtml-ISAPI-4.0_32bit'; - Path = '*.cshtml'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv4.0,bitness32'; - ResponseBufferLimit = '0' - }); - - 'cshtml-ISAPI-4.0_64bit' = (New-Object PSObject -Property @{ - Name = 'cshtml-ISAPI-4.0_64bit'; - Path = '*.cshtml'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv4.0,bitness64'; - ResponseBufferLimit = '0' - }); - - 'ExtensionlessUrlHandler-Integrated-4.0' = (New-Object PSObject -Property @{ - Name = 'ExtensionlessUrlHandler-Integrated-4.0'; - Path = '*.'; - Verb = 'GET,HEAD,POST,DEBUG'; - Type = 'System.Web.Handlers.TransferRequestHandler'; - PreCondition = 'integratedMode,runtimeVersionv4.0'; - ResponseBufferLimit = '0' - }); - - 'ExtensionlessUrlHandler-ISAPI-4.0_32bit' = (New-Object PSObject -Property @{ - Name = 'ExtensionlessUrlHandler-ISAPI-4.0_32bit'; - Path = '*.'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv4.0,bitness32'; - ResponseBufferLimit = '0' - }); - - 'ExtensionlessUrlHandler-ISAPI-4.0_64bit' = (New-Object PSObject -Property @{ - Name = 'ExtensionlessUrlHandler-ISAPI-4.0_64bit'; - Path = '*.'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv4.0,bitness64'; - ResponseBufferLimit = '0' - }); - - 'HttpRemotingHandlerFactory-rem-Integrated-4.0' = (New-Object PSObject -Property @{ - Name = 'HttpRemotingHandlerFactory-rem-Integrated-4.0'; - Path = '*.rem'; - Verb = 'GET,HEAD,POST,DEBUG'; - Type = 'System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory,;System.Runtime.Remoting,;Version = 4.0.0.0,;Culture = neutral,;PublicKeyToken = b77a5c561934e089'; - PreCondition = 'integratedMode,runtimeVersionv4.0' - }); - - 'HttpRemotingHandlerFactory-rem-Integrated' = (New-Object PSObject -Property @{ - Name = 'HttpRemotingHandlerFactory-rem-Integrated'; - Path = '*.rem'; - Verb = 'GET,HEAD,POST,DEBUG'; - Type = 'System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory,;System.Runtime.Remoting,;Version = 2.0.0.0,;Culture = neutral,;PublicKeyToken = b77a5c561934e089'; - PreCondition = 'integratedMode,runtimeVersionv2.0' - }); - - 'HttpRemotingHandlerFactory-rem-ISAPI-2.0-64' = (New-Object PSObject -Property @{ - Name = 'HttpRemotingHandlerFactory-rem-ISAPI-2.0-64'; - Path = '*.rem'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv2.0,bitness64'; - ResponseBufferLimit = '0' - }); - - 'HttpRemotingHandlerFactory-rem-ISAPI-2.0' = (New-Object PSObject -Property @{ - Name = 'HttpRemotingHandlerFactory-rem-ISAPI-2.0'; - Path = '*.rem'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv2.0,bitness32'; - ResponseBufferLimit = '0' - }); - - 'HttpRemotingHandlerFactory-rem-ISAPI-4.0_32bit' = (New-Object PSObject -Property @{ - Name = 'HttpRemotingHandlerFactory-rem-ISAPI-4.0_32bit'; - Path = '*.rem'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv4.0,bitness32'; - ResponseBufferLimit = '0' - }); - - 'HttpRemotingHandlerFactory-rem-ISAPI-4.0_64bit' = (New-Object PSObject -Property @{ - Name = 'HttpRemotingHandlerFactory-rem-ISAPI-4.0_64bit'; - Path = '*.rem'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv4.0,bitness64'; - ResponseBufferLimit = '0' - }); - - 'HttpRemotingHandlerFactory-soap-Integrated-4.0' = (New-Object PSObject -Property @{ - Name = 'HttpRemotingHandlerFactory-soap-Integrated-4.0'; - Path = '*.soap'; - Verb = 'GET,HEAD,POST,DEBUG'; - Type = 'System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory,;System.Runtime.Remoting,;Version = 4.0.0.0,;Culture = neutral,;PublicKeyToken = b77a5c561934e089'; - PreCondition = 'integratedMode,runtimeVersionv4.0' - }); - - 'HttpRemotingHandlerFactory-soap-Integrated' = (New-Object PSObject -Property @{ - Name = 'HttpRemotingHandlerFactory-soap-Integrated'; - Path = '*.soap'; - Verb = 'GET,HEAD,POST,DEBUG'; - Type = 'System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory,;System.Runtime.Remoting,;Version = 2.0.0.0,;Culture = neutral,;PublicKeyToken = b77a5c561934e089'; - PreCondition = 'integratedMode,runtimeVersionv2.0' - }); - - 'HttpRemotingHandlerFactory-soap-ISAPI-2.0-64' = (New-Object PSObject -Property @{ - Name = 'HttpRemotingHandlerFactory-soap-ISAPI-2.0-64'; - Path = '*.soap'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv2.0,bitness64'; - ResponseBufferLimit = '0' - }); - - 'HttpRemotingHandlerFactory-soap-ISAPI-2.0' = (New-Object PSObject -Property @{ - Name = 'HttpRemotingHandlerFactory-soap-ISAPI-2.0'; - Path = '*.soap'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv2.0,bitness32'; - ResponseBufferLimit = '0' - }); - - 'HttpRemotingHandlerFactory-soap-ISAPI-4.0_32bit' = (New-Object PSObject -Property @{ - Name = 'HttpRemotingHandlerFactory-soap-ISAPI-4.0_32bit'; - Path = '*.soap'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv4.0,bitness32'; - ResponseBufferLimit = '0' - }); - - 'HttpRemotingHandlerFactory-soap-ISAPI-4.0_64bit' = (New-Object PSObject -Property @{ - Name = 'HttpRemotingHandlerFactory-soap-ISAPI-4.0_64bit'; - Path = '*.soap'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv4.0,bitness64'; - ResponseBufferLimit = '0' - }); - - 'ISAPI-dll' = (New-Object PSObject -Property @{ - Name = 'ISAPI-dll'; - Path = '*.dll'; - Verb = '*'; - Modules = 'IsapiModule'; - ResourceType = 'File'; - RequireAccess = 'Execute'; - AllowPathInfo = 'true' - }); - - 'OPTIONSVerbHandler' = (New-Object PSObject -Property @{ - Name = 'OPTIONSVerbHandler'; - Path = '*'; - Verb = 'OPTIONS'; - Modules = 'ProtocolSupportModule'; - RequireAccess = 'None' - }); - - 'PageHandlerFactory-Integrated-4.0' = (New-Object PSObject -Property @{ - Name = 'PageHandlerFactory-Integrated-4.0'; - Path = '*.aspx'; - Verb = 'GET,HEAD,POST,DEBUG'; - Type = 'System.Web.UI.PageHandlerFactory'; - PreCondition = 'integratedMode,runtimeVersionv4.0' - }); - - 'PageHandlerFactory-Integrated' = (New-Object PSObject -Property @{ - Name = 'PageHandlerFactory-Integrated'; - Path = '*.aspx'; - Verb = 'GET,HEAD,POST,DEBUG'; - Type = 'System.Web.UI.PageHandlerFactory'; - PreCondition = 'integratedMode' - }); - - 'PageHandlerFactory-ISAPI-2.0-64' = (New-Object PSObject -Property @{ - Name = 'PageHandlerFactory-ISAPI-2.0-64'; - Path = '*.aspx'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv2.0,bitness64'; - ResponseBufferLimit = '0' - }); - - 'PageHandlerFactory-ISAPI-2.0' = (New-Object PSObject -Property @{ - Name = 'PageHandlerFactory-ISAPI-2.0'; - Path = '*.aspx'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv2.0,bitness32'; - ResponseBufferLimit = '0' - }); - - 'PageHandlerFactory-ISAPI-4.0_32bit' = (New-Object PSObject -Property @{ - Name = 'PageHandlerFactory-ISAPI-4.0_32bit'; - Path = '*.aspx'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv4.0,bitness32'; - ResponseBufferLimit = '0' - }); - - 'PageHandlerFactory-ISAPI-4.0_64bit' = (New-Object PSObject -Property @{ - Name = 'PageHandlerFactory-ISAPI-4.0_64bit'; - Path = '*.aspx'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv4.0,bitness64'; - ResponseBufferLimit = '0' - }); - - 'rules-Integrated-4.0' = (New-Object PSObject -Property @{ - Name = 'rules-Integrated-4.0'; - Path = '*.rules'; - Verb = '*'; - Type = 'System.ServiceModel.Activation.ServiceHttpHandlerFactory,;System.ServiceModel.Activation,;Version = 4.0.0.0,;Culture = neutral,;PublicKeyToken = 31bf3856ad364e35'; - PreCondition = 'integratedMode,runtimeVersionv4.0' - }); - - 'rules-ISAPI-4.0_32bit' = (New-Object PSObject -Property @{ - Name = 'rules-ISAPI-4.0_32bit'; - Path = '*.rules'; - Verb = '*'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv4.0,bitness32'; - ResponseBufferLimit = '0' - }); - - 'rules-ISAPI-4.0_64bit' = (New-Object PSObject -Property @{ - Name = 'rules-ISAPI-4.0_64bit'; - Path = '*.rules'; - Verb = '*'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv4.0,bitness64'; - ResponseBufferLimit = '0' - }); - - 'ScriptHandlerFactoryAppServices-Integrated-4.0' = (New-Object PSObject -Property @{ - Name = 'ScriptHandlerFactoryAppServices-Integrated-4.0'; - Path = '*_AppService.axd'; - Verb = '*'; - Type = 'System.Web.Script.Services.ScriptHandlerFactory,;System.Web.Extensions,;Version = 4.0.0.0,;Culture = neutral,;PublicKeyToken = 31BF3856AD364E35'; - PreCondition = 'integratedMode,runtimeVersionv4.0' - }); - - 'ScriptResourceIntegrated-4.0' = (New-Object PSObject -Property @{ - Name = 'ScriptResourceIntegrated-4.0'; - Path = '*ScriptResource.axd'; - Verb = 'GET,HEAD'; - Type = 'System.Web.Handlers.ScriptResourceHandler,;System.Web.Extensions,;Version = 4.0.0.0,;Culture = neutral,;PublicKeyToken = 31BF3856AD364E35'; - PreCondition = 'integratedMode,runtimeVersionv4.0' - }); - - 'SecurityCertificate' = (New-Object PSObject -Property @{ - Name = 'SecurityCertificate'; - Path = '*.cer'; - Verb = 'GET,HEAD,POST'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\system32\inetsrv\asp.dll'; - ResourceType = 'File' - }); - - 'SimpleHandlerFactory-Integrated-4.0' = (New-Object PSObject -Property @{ - Name = 'SimpleHandlerFactory-Integrated-4.0'; - Path = '*.ashx'; - Verb = 'GET,HEAD,POST,DEBUG'; - Type = 'System.Web.UI.SimpleHandlerFactory'; - PreCondition = 'integratedMode,runtimeVersionv4.0' - }); - - 'SimpleHandlerFactory-Integrated' = (New-Object PSObject -Property @{ - Name = 'SimpleHandlerFactory-Integrated'; - Path = '*.ashx'; - Verb = 'GET,HEAD,POST,DEBUG'; - Type = 'System.Web.UI.SimpleHandlerFactory'; - PreCondition = 'integratedMode' - }); - - 'SimpleHandlerFactory-ISAPI-2.0-64' = (New-Object PSObject -Property @{ - Name = 'SimpleHandlerFactory-ISAPI-2.0-64'; - Path = '*.ashx'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv2.0,bitness64'; - ResponseBufferLimit = '0' - }); - - 'SimpleHandlerFactory-ISAPI-2.0' = (New-Object PSObject -Property @{ - Name = 'SimpleHandlerFactory-ISAPI-2.0'; - Path = '*.ashx'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv2.0,bitness32'; - ResponseBufferLimit = '0' - }); - - 'SimpleHandlerFactory-ISAPI-4.0_32bit' = (New-Object PSObject -Property @{ - Name = 'SimpleHandlerFactory-ISAPI-4.0_32bit'; - Path = '*.ashx'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv4.0,bitness32'; - ResponseBufferLimit = '0' - }); - - 'SimpleHandlerFactory-ISAPI-4.0_64bit' = (New-Object PSObject -Property @{ - Name = 'SimpleHandlerFactory-ISAPI-4.0_64bit'; - Path = '*.ashx'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv4.0,bitness64'; - ResponseBufferLimit = '0' - }); - - 'SSINC-shtm' = (New-Object PSObject -Property @{ - Name = 'SSINC-shtm'; - Path = '*.shtm'; - Verb = 'GET,HEAD,POST'; - Modules = 'ServerSideIncludeModule'; - ResourceType = 'File' - }); - - 'SSINC-shtml' = (New-Object PSObject -Property @{ - Name = 'SSINC-shtml'; - Path = '*.shtml'; - Verb = 'GET,HEAD,POST'; - Modules = 'ServerSideIncludeModule'; - ResourceType = 'File' - }); - - 'SSINC-stm' = (New-Object PSObject -Property @{ - Name = 'SSINC-stm'; - Path = '*.stm'; - Verb = 'GET,HEAD,POST'; - Modules = 'ServerSideIncludeModule'; - ResourceType = 'File' - }); - - 'StaticFile' = (New-Object PSObject -Property @{ - Name = 'StaticFile'; - Path = '*'; - Verb = '*'; - Modules = 'StaticFileModule,DefaultDocumentModule,DirectoryListingModule'; - ResourceType = 'Either'; - RequireAccess = 'Read' - }); - - 'svc-Integrated-4.0' = (New-Object PSObject -Property @{ - Name = 'svc-Integrated-4.0'; - Path = '*.svc'; - Verb = '*'; - Type = 'System.ServiceModel.Activation.ServiceHttpHandlerFactory,;System.ServiceModel.Activation,;Version = 4.0.0.0,;Culture = neutral,;PublicKeyToken = 31bf3856ad364e35'; - PreCondition = 'integratedMode,runtimeVersionv4.0' - }); - - 'svc-ISAPI-4.0_32bit' = (New-Object PSObject -Property @{ - Name = 'svc-ISAPI-4.0_32bit'; - Path = '*.svc'; - Verb = '*'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv4.0,bitness32'; - ResponseBufferLimit = '0' - }); - - 'svc-ISAPI-4.0_64bit' = (New-Object PSObject -Property @{ - Name = 'svc-ISAPI-4.0_64bit'; - Path = '*.svc'; - Verb = '*'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv4.0,bitness64'; - ResponseBufferLimit = '0' - }); - - 'TraceHandler-Integrated-4.0' = (New-Object PSObject -Property @{ - Name = 'TraceHandler-Integrated-4.0'; - Path = 'trace.axd'; - Verb = 'GET,HEAD,POST,DEBUG'; - Type = 'System.Web.Handlers.TraceHandler'; - PreCondition = 'integratedMode,runtimeVersionv4.0' - }); - - 'TraceHandler-Integrated' = (New-Object PSObject -Property @{ - Name = 'TraceHandler-Integrated'; - Path = 'trace.axd'; - Verb = 'GET,HEAD,POST,DEBUG'; - Type = 'System.Web.Handlers.TraceHandler'; - PreCondition = 'integratedMode' - }); - - 'TRACEVerbHandler' = (New-Object PSObject -Property @{ - Name = 'TRACEVerbHandler'; - Path = '*'; - Verb = 'TRACE'; - Modules = 'ProtocolSupportModule'; - RequireAccess = 'None' - }); - - 'vbhtm-Integrated-4.0' = (New-Object PSObject -Property @{ - Name = 'vbhtm-Integrated-4.0'; - Path = '*.vbhtm'; - Verb = 'GET,HEAD,POST,DEBUG'; - Type = 'System.Web.HttpForbiddenHandler'; - PreCondition = 'integratedMode,runtimeVersionv4.0' - }); - - 'vbhtm-ISAPI-4.0_32bit' = (New-Object PSObject -Property @{ - Name = 'vbhtm-ISAPI-4.0_32bit'; - Path = '*.vbhtm'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv4.0,bitness32'; - ResponseBufferLimit = '0' - }); - - 'vbhtm-ISAPI-4.0_64bit' = (New-Object PSObject -Property @{ - Name = 'vbhtm-ISAPI-4.0_64bit'; - Path = '*.vbhtm'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv4.0,bitness64'; - ResponseBufferLimit = '0' - }); - - 'vbhtml-Integrated-4.0' = (New-Object PSObject -Property @{ - Name = 'vbhtml-Integrated-4.0'; - Path = '*.vbhtml'; - Verb = 'GET,HEAD,POST,DEBUG'; - Type = 'System.Web.HttpForbiddenHandler'; - PreCondition = 'integratedMode,runtimeVersionv4.0' - }); - - 'vbhtml-ISAPI-4.0_32bit' = (New-Object PSObject -Property @{ - Name = 'vbhtml-ISAPI-4.0_32bit'; - Path = '*.vbhtml'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv4.0,bitness32'; - ResponseBufferLimit = '0' - }); - - 'vbhtml-ISAPI-4.0_64bit' = (New-Object PSObject -Property @{ - Name = 'vbhtml-ISAPI-4.0_64bit'; - Path = '*.vbhtml'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv4.0,bitness64'; - ResponseBufferLimit = '0' - }); - - 'WebAdminHandler-Integrated-4.0' = (New-Object PSObject -Property @{ - Name = 'WebAdminHandler-Integrated-4.0'; - Path = 'WebAdmin.axd'; - Verb = 'GET,DEBUG'; - Type = 'System.Web.Handlers.WebAdminHandler'; - PreCondition = 'integratedMode,runtimeVersionv4.0' - }); - - 'WebAdminHandler-Integrated' = (New-Object PSObject -Property @{ - Name = 'WebAdminHandler-Integrated'; - Path = 'WebAdmin.axd'; - Verb = 'GET,DEBUG'; - Type = 'System.Web.Handlers.WebAdminHandler'; - PreCondition = 'integratedMode' - }); - - 'WebDAV' = (New-Object PSObject -Property @{ - Name = 'WebDAV'; - Path = '*'; - Verb = 'PROPFIND,PROPPATCH,MKCOL,PUT,COPY,DELETE,MOVE,LOCK,UNLOCK'; - Modules = 'WebDAVModule'; - ResourceType = 'Unspecified'; - RequireAccess = 'None' - }); - - 'WebServiceHandlerFactory-Integrated-4.0' = (New-Object PSObject -Property @{ - Name = 'WebServiceHandlerFactory-Integrated-4.0'; - Path = '*.asmx'; - Verb = 'GET,HEAD,POST,DEBUG'; - Type = 'System.Web.Script.Services.ScriptHandlerFactory,;System.Web.Extensions,;Version = 4.0.0.0,;Culture = neutral,;PublicKeyToken = 31bf3856ad364e35'; - PreCondition = 'integratedMode,runtimeVersionv4.0' - }); - - 'WebServiceHandlerFactory-Integrated' = (New-Object PSObject -Property @{ - Name = 'WebServiceHandlerFactory-Integrated'; - Path = '*.asmx'; - Verb = 'GET,HEAD,POST,DEBUG'; - Type = 'System.Web.Services.Protocols.WebServiceHandlerFactory,;System.Web.Services,;Version = 2.0.0.0,;Culture = neutral,;PublicKeyToken = b03f5f7f11d50a3a'; - PreCondition = 'integratedMode,runtimeVersionv2.0' - }); - - 'WebServiceHandlerFactory-ISAPI-2.0-64' = (New-Object PSObject -Property @{ - Name = 'WebServiceHandlerFactory-ISAPI-2.0-64'; - Path = '*.asmx'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv2.0,bitness64'; - ResponseBufferLimit = '0' - }); - - 'WebServiceHandlerFactory-ISAPI-2.0' = (New-Object PSObject -Property @{ - Name = 'WebServiceHandlerFactory-ISAPI-2.0'; - Path = '*.asmx'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv2.0,bitness32'; - ResponseBufferLimit = '0' - }); - - 'WebServiceHandlerFactory-ISAPI-4.0_32bit' = (New-Object PSObject -Property @{ - Name = 'WebServiceHandlerFactory-ISAPI-4.0_32bit'; - Path = '*.asmx'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv4.0,bitness32'; - ResponseBufferLimit = '0' - }); - - 'WebServiceHandlerFactory-ISAPI-4.0_64bit' = (New-Object PSObject -Property @{ - Name = 'WebServiceHandlerFactory-ISAPI-4.0_64bit'; - Path = '*.asmx'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv4.0,bitness64'; - ResponseBufferLimit = '0' - }); - - 'xamlx-Integrated-4.0' = (New-Object PSObject -Property @{ - Name = 'xamlx-Integrated-4.0'; - Path = '*.xamlx'; - Verb = 'GET,HEAD,POST,DEBUG'; - Type = 'System.Xaml.Hosting.XamlHttpHandlerFactory,;System.Xaml.Hosting,;Version = 4.0.0.0,;Culture = neutral,;PublicKeyToken = 31bf3856ad364e35'; - PreCondition = 'integratedMode,runtimeVersionv4.0' - }); - - 'xamlx-ISAPI-4.0_32bit' = (New-Object PSObject -Property @{ - Name = 'xamlx-ISAPI-4.0_32bit'; - Path = '*.xamlx'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv4.0,bitness32'; - ResponseBufferLimit = '0' - }); - - 'xamlx-ISAPI-4.0_64bit' = (New-Object PSObject -Property @{ - Name = 'xamlx-ISAPI-4.0_64bit'; - Path = '*.xamlx'; - Verb = 'GET,HEAD,POST,DEBUG'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv4.0,bitness64'; - ResponseBufferLimit = '0' - }); - - 'xoml-Integrated-4.0' = (New-Object PSObject -Property @{ - Name = 'xoml-Integrated-4.0'; - Path = '*.xoml'; - Verb = '*'; - Type = 'System.ServiceModel.Activation.ServiceHttpHandlerFactory,;System.ServiceModel.Activation,;Version = 4.0.0.0,;Culture = neutral,;PublicKeyToken = 31bf3856ad364e35'; - PreCondition = 'integratedMode,runtimeVersionv4.0' - }); - - 'xoml-ISAPI-4.0_32bit' = (New-Object PSObject -Property @{ - Name = 'xoml-ISAPI-4.0_32bit'; - Path = '*.xoml'; - Verb = '*'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv4.0,bitness32'; - ResponseBufferLimit = '0' - }); - - 'xoml-ISAPI-4.0_64bit' = (New-Object PSObject -Property @{ - Name = 'xoml-ISAPI-4.0_64bit'; - Path = '*.xoml'; - Verb = '*'; - Modules = 'IsapiModule'; - ScriptProcessor = '%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll'; - PreCondition = 'classicMode,runtimeVersionv4.0,bitness64'; - ResponseBufferLimit = '0' - }) -} - -#endregion -function Get-TargetResource -{ - <# - .SYNOPSIS - This will return a hashtable of results - #> - - [OutputType([Hashtable])] - param - ( - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [String] $Name, - - [Parameter(Mandatory)] - [ValidateSet('Present', 'Absent')] - [String] $Ensure - ) - - # Check if WebAdministration module is present for IIS cmdlets - Assert-Module - - $handler = Get-Handler -Name $Name - - if ($null -eq $handler) - { - Write-Verbose -Message $LocalizedData.VerboseGetTargetAbsent - return @{ - Ensure = 'Absent' - Name = $Name - } - } - else - { - Write-Verbose -Message $LocalizedData.VerboseGetTargetPresent - return @{ - Ensure = 'Present' - Name = $Name - } - } -} -function Set-TargetResource -{ - <# - .SYNOPSIS - This will set the desired state - - .NOTES - There are a few limitations with this resource: - It only supports builtin handlers, that come with IIS, not third party ones. - Removing handlers should be no problem, but all new handlers are added at the - top of the list, meaning, they are tried first. There is no way of ordering the - handler list except for removing all and then adding them in the correct order. - #> - - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")] - param - ( - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [String] $Name, - - [Parameter(Mandatory)] - [ValidateSet('Present', 'Absent')] - [String] $Ensure - ) - - Assert-Module - - [String] $psPathRoot = 'MACHINE/WEBROOT/APPHOST' - [String] $sectionNode = 'system.webServer/handlers' - - $handler = Get-Handler -Name $Name - - if ($null -eq $handler -and $Ensure -eq 'Present') - { - # add the handler - Add-Handler -Name $Name - Write-Verbose -Message ($LocalizedData.AddingHandler -f $Name) - } - elseif ($null -ne $handler -and $Ensure -eq 'Absent') - { - # remove the handler - Remove-WebConfigurationProperty -PSPath $psPathRoot ` - -Filter $sectionNode ` - -Name '.' ` - -AtElement @{name="$Name"} - Write-Verbose -Message ($LocalizedData.RemovingHandler -f $Name) - } -} -function Test-TargetResource -{ - <# - .SYNOPSIS - This tests the desired state. If the state is not correct it will return $false. - If the state is correct it will return $true - #> - - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [String] $Name, - - [Parameter(Mandatory)] - [ValidateSet('Present', 'Absent')] - [String] $Ensure - ) - - Assert-Module - - $handler = Get-Handler -Name $Name - - if (($null -eq $handler -and $Ensure -eq 'Present') -or ` - ($null -ne $handler -and $Ensure -eq 'Absent')) - { - return $false - } - elseif ($null -ne $handler -and $Ensure -eq 'Present') - { - # Handler is present - Write-Verbose -Message ($LocalizedData.HandlerExists -f $Name) - return $true - } - else - { - # Handler not present and should not be there. - Write-Verbose -Message ($LocalizedData.HandlerNotPresent -f $Name) - return $true - } -} - -#region Helper Functions - -function Get-Handler -{ - param - ( - [String] $Name - ) - - [String] $filter = "system.webServer/handlers/Add[@Name='" + $Name + "']" - return Get-WebConfigurationProperty -PSPath 'MACHINE/WEBROOT/APPHOST' ` - -Filter $filter ` - -Name '.' -} - -function Add-Handler -{ - param - ( - [String] $Name - ) - - # check whether our dictionary has an item with the specified key - if ($script:handlers.ContainsKey($Name)) - { - # add the new handler - Add-WebConfigurationProperty -PSPath 'MACHINE/WEBROOT/APPHOST' ` - -Filter 'system.webServer/handlers' ` - -Name '.' ` - -Value $script:handlers[$Name] - } - else - { - New-TerminatingError -ErrorId 'HandlerNotSupported' ` - -ErrorMessage $($LocalizedData.HandlerNotSupported -f $Name) ` - -ErrorCategory InvalidArgument - } -} - -#endregion - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIIsHandler/MSFT_xIisHandler.schema.mof b/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIIsHandler/MSFT_xIisHandler.schema.mof deleted file mode 100644 index 3541a39a..00000000 --- a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIIsHandler/MSFT_xIisHandler.schema.mof +++ /dev/null @@ -1,6 +0,0 @@ -[ClassVersion("1.0.0"), FriendlyName("xIisHandler")] -class MSFT_xIisHandler : OMI_BaseResource -{ - [Key] string Name; - [Required,ValueMap{"Present", "Absent"},Values{"Present", "Absent"}] string Ensure; -}; diff --git a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisFeatureDelegation/MSFT_xIisFeatureDelegation.psm1 b/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisFeatureDelegation/MSFT_xIisFeatureDelegation.psm1 deleted file mode 100644 index 618b8f93..00000000 --- a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisFeatureDelegation/MSFT_xIisFeatureDelegation.psm1 +++ /dev/null @@ -1,146 +0,0 @@ -# Load the Helper Module -Import-Module -Name "$PSScriptRoot\..\Helper.psm1" - -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData -StringData @' - NoWebAdministrationModule = Please ensure that WebAdministration module is installed. - UnableToGetConfig = Unable to get configuration data for '{0}'. - ChangedMessage = Changed overrideMode for '{0}' to '{1}'. - VerboseGetTargetResource = Get-TargetResource has been run. -'@ -} - -function Get-TargetResource -{ - <# - .SYNOPSIS - This will return a hashtable of results - #> - - [OutputType([Hashtable])] - param - ( - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [String] $SectionName, - - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [ValidateSet('Allow', 'Deny')] - [String] $OverrideMode - ) - - [String] $oMode = Get-OverrideMode -Section $SectionName - - Write-Verbose -Message $LocalizedData.VerboseGetTargetResource - - return @{ - SectionName = $SectionName - OverrideMode = $oMode - } -} - -function Set-TargetResource -{ - <# - .SYNOPSIS - This will set the desired state - #> - - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")] - param - ( - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [String] $SectionName, - - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [ValidateSet('Allow', 'Deny')] - [String] $OverrideMode - ) - - Write-Verbose($($LocalizedData.ChangedMessage) -f $SectionName, $OverrideMode) - - Set-WebConfiguration -Location '' ` - -Filter "/system.webServer/$SectionName" ` - -PSPath 'machine/webroot/apphost' ` - -Metadata 'overrideMode' ` - -Value $OverrideMode -} - -function Test-TargetResource -{ - <# - .SYNOPSIS - This tests the desired state. If the state is not correct it will return $false. - If the state is correct it will return $true - #> - - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [String] $SectionName, - - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [ValidateSet('Allow', 'Deny')] - [String] $OverrideMode - ) - - [String] $oMode = Get-OverrideMode -Section $SectionName - - if ($oMode -eq $OverrideMode) - { - return $true - } - - return $false -} - -#region Helper functions -function Get-OverrideMode -{ - <# - .NOTES - Check for a single value. - If $oMode is anything but Allow or Deny, we have a problem with our - Get-WebConfiguration call or the ApplicationHost.config file is corrupted. - #> - - param - ( - [String] $Section - ) - - Assert-Module - - Write-Verbose -Message 'Getting override mode' - - $webConfig = Get-WebConfiguration -Location '' ` - -Filter /system.webServer/$Section ` - -Metadata - - $oMode = $webConfig.Metadata.effectiveOverrideMode - - if ($oMode -notmatch "^(Allow|Deny)$") - { - $errorMessage = $($LocalizedData.UnableToGetConfig) -f $Section - New-TerminatingError -ErrorId UnableToGetConfig ` - -ErrorMessage $errorMessage ` - -ErrorCategory:InvalidResult - } - - return $oMode -} - - -#endregion - -Export-ModuleMember -function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisFeatureDelegation/MSFT_xIisFeatureDelegation.schema.mof b/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisFeatureDelegation/MSFT_xIisFeatureDelegation.schema.mof deleted file mode 100644 index 329a4a35..00000000 --- a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisFeatureDelegation/MSFT_xIisFeatureDelegation.schema.mof +++ /dev/null @@ -1,6 +0,0 @@ -[ClassVersion("1.0.0"), FriendlyName("xIisFeatureDelegation")] -class MSFT_xIisFeatureDelegation : OMI_BaseResource -{ - [Key] string SectionName; - [Key,ValueMap{"Allow", "Deny"},Values{"Allow", "Deny"}] string OverrideMode; -}; diff --git a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisLogging/MSFT_xIisLogging.psm1 b/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisLogging/MSFT_xIisLogging.psm1 deleted file mode 100644 index 0ae3fb91..00000000 --- a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisLogging/MSFT_xIisLogging.psm1 +++ /dev/null @@ -1,311 +0,0 @@ -# Load the Helper Module -Import-Module -Name "$PSScriptRoot\..\Helper.psm1" - -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData -StringData @' - VerboseGetTargetResult = Get-TargetResource has been run. - VerboseSetTargetUpdateLogPath = LogPath is not in the desired state and will be updated. - VerboseSetTargetUpdateLogFlags = LogFlags do not match and will be updated. - VerboseSetTargetUpdateLogPeriod = LogPeriod is not in the desired state and will be updated. - VerboseSetTargetUpdateLogTruncateSize = TruncateSize is not in the desired state and will be updated. - VerboseSetTargetUpdateLoglocalTimeRollover = LoglocalTimeRollover is not in the desired state and will be updated. - VerboseSetTargetUpdateLogFormat = LogFormat is not in the desired state and will be updated - VerboseTestTargetFalseLogPath = LogPath does match desired state. - VerboseTestTargetFalseLogFlags = LogFlags does not match desired state. - VerboseTestTargetFalseLogPeriod = LogPeriod does not match desired state. - VerboseTestTargetFalseLogTruncateSize = LogTruncateSize does not match desired state. - VerboseTestTargetFalseLoglocalTimeRollover = LoglocalTimeRollover does not match desired state. - VerboseTestTargetFalseLogFormat = LogFormat does not match desired state. - WarningLogPeriod = LogTruncateSize has is an input as will overwrite this desired state. - WarningIncorrectLogFormat = LogFormat is not W3C, as a result LogFlags will not be used. -'@ -} - -<# - .SYNOPSIS - This will return a hashtable of results about the given LogPath -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [String] $LogPath - ) - - Assert-Module - - $currentLogSettings = Get-WebConfiguration ` - -filter '/system.applicationHost/sites/siteDefaults/Logfile' - - Write-Verbose -Message ($LocalizedData.VerboseGetTargetResult) - - return @{ - LogPath = $currentLogSettings.directory - LogFlags = [Array]$currentLogSettings.LogExtFileFlags - LogPeriod = $currentLogSettings.period - LogTruncateSize = $currentLogSettings.truncateSize - LoglocalTimeRollover = $currentLogSettings.localTimeRollover - LogFormat = $currentLogSettings.logFormat - } -} - -<# - .SYNOPSIS - This will set the desired state -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [String] $LogPath, - - [ValidateSet('Date','Time','ClientIP','UserName','SiteName','ComputerName','ServerIP','Method','UriStem','UriQuery','HttpStatus','Win32Status','BytesSent','BytesRecv','TimeTaken','ServerPort','UserAgent','Cookie','Referer','ProtocolVersion','Host','HttpSubStatus')] - [String[]] $LogFlags, - - [ValidateSet('Hourly','Daily','Weekly','Monthly','MaxSize')] - [String] $LogPeriod, - - [ValidateScript({ - ([ValidateRange(1048576, 4294967295)] $valueAsUInt64 = [UInt64]::Parse($_)) - })] - [String] $LogTruncateSize, - - [Boolean] $LoglocalTimeRollover, - - [ValidateSet('IIS','W3C','NCSA')] - [String] $LogFormat - ) - - Assert-Module - - $currentLogState = Get-TargetResource -LogPath $LogPath - - # Update LogFormat if needed - if ($PSBoundParameters.ContainsKey('LogFormat') -and ` - ($LogFormat -ne $currentLogState.LogFormat)) - { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdateLogFormat) - Set-WebConfigurationProperty '/system.applicationHost/sites/siteDefaults/logfile' ` - -Name logFormat ` - -Value $LogFormat - } - - # Update LogPath if needed - if ($PSBoundParameters.ContainsKey('LogPath') -and ($LogPath -ne $currentLogState.LogPath)) - { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdateLogPath) - Set-WebConfigurationProperty '/system.applicationHost/sites/siteDefaults/logfile' ` - -Name directory ` - -Value $LogPath - } - - # Update Logflags if needed; also sets logformat to W3C - if ($PSBoundParameters.ContainsKey('LogFlags') -and ` - (-not (Compare-LogFlags -LogFlags $LogFlags))) - { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdateLogFlags) - Set-WebConfigurationProperty '/system.Applicationhost/Sites/SiteDefaults/logfile' ` - -Name logFormat ` - -Value 'W3C' - Set-WebConfigurationProperty '/system.Applicationhost/Sites/SiteDefaults/logfile' ` - -Name logExtFileFlags ` - -Value ($LogFlags -join ',') - } - - # Update Log Period if needed - if ($PSBoundParameters.ContainsKey('LogPeriod') -and ` - ($LogPeriod -ne $currentLogState.LogPeriod)) - { - if ($PSBoundParameters.ContainsKey('LogTruncateSize')) - { - Write-Verbose -Message ($LocalizedData.WarningLogPeriod) - } - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdateLogPeriod) - Set-WebConfigurationProperty '/system.Applicationhost/Sites/SiteDefaults/logfile' ` - -Name period ` - -Value $LogPeriod - } - - # Update LogTruncateSize if needed - if ($PSBoundParameters.ContainsKey('LogTruncateSize') -and ` - ($LogTruncateSize -ne $currentLogState.LogTruncateSize)) - { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdateLogTruncateSize) - Set-WebConfigurationProperty '/system.Applicationhost/Sites/SiteDefaults/logfile' ` - -Name truncateSize ` - -Value $LogTruncateSize - Set-WebConfigurationProperty '/system.Applicationhost/Sites/SiteDefaults/logfile' ` - -Name period ` - -Value 'MaxSize' - } - - # Update LoglocalTimeRollover if needed - if ($PSBoundParameters.ContainsKey('LoglocalTimeRollover') -and ` - ($LoglocalTimeRollover -ne ` - ([System.Convert]::ToBoolean($currentLogState.LoglocalTimeRollover)))) - { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdateLoglocalTimeRollover) - Set-WebConfigurationProperty '/system.Applicationhost/Sites/SiteDefaults/logfile' ` - -Name localTimeRollover ` - -Value $LoglocalTimeRollover - } -} - -<# - .SYNOPSIS - This tests the desired state. If the state is not correct it will return $false. - If the state is correct it will return $true -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [String] $LogPath, - - [ValidateSet('Date','Time','ClientIP','UserName','SiteName','ComputerName','ServerIP','Method','UriStem','UriQuery','HttpStatus','Win32Status','BytesSent','BytesRecv','TimeTaken','ServerPort','UserAgent','Cookie','Referer','ProtocolVersion','Host','HttpSubStatus')] - [String[]] $LogFlags, - - [ValidateSet('Hourly','Daily','Weekly','Monthly','MaxSize')] - [String] $LogPeriod, - - [ValidateScript({ - ([ValidateRange(1048576, 4294967295)] $valueAsUInt64 = [UInt64]::Parse($_)) - })] - [String] $LogTruncateSize, - - [Boolean] $LoglocalTimeRollover, - - [ValidateSet('IIS','W3C','NCSA')] - [String] $LogFormat - ) - - Assert-Module - - $currentLogState = Get-TargetResource -LogPath $LogPath - - # Check LogFormat - if ($PSBoundParameters.ContainsKey('LogFormat')) - { - # Warn if LogFlags are passed in and Current LogFormat is not W3C - if ($PSBoundParameters.ContainsKey('LogFlags') -and ` - $LogFormat -ne 'W3C') - { - Write-Verbose -Message ($LocalizedData.WarningIncorrectLogFormat) - } - - # Warn if LogFlags are passed in and Desired LogFormat is not W3C - if($PSBoundParameters.ContainsKey('LogFlags') -and ` - $currentLogState.LogFormat -ne 'W3C') - { - Write-Verbose -Message ($LocalizedData.WarningIncorrectLogFormat) - } - - # Check LogFormat - if ($LogFormat -ne $currentLogState.LogFormat) - { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseLogFormat) - return $false - } - } - - # Check LogFlags - if ($PSBoundParameters.ContainsKey('LogFlags') -and ` - (-not (Compare-LogFlags -LogFlags $LogFlags))) - { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseLogFlags) - return $false - } - - # Check LogPath - if ($PSBoundParameters.ContainsKey('LogPath') -and ` - ($LogPath -ne $currentLogState.LogPath)) - { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseLogPath) - return $false - } - - # Check LogPeriod - if ($PSBoundParameters.ContainsKey('LogPeriod') -and ` - ($LogPeriod -ne $currentLogState.LogPeriod)) - { - if ($PSBoundParameters.ContainsKey('LogTruncateSize')) - { - Write-Verbose -Message ($LocalizedData.WarningLogPeriod) - } - - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseLogPeriod) - return $false - } - - # Check LogTruncateSize - if ($PSBoundParameters.ContainsKey('LogTruncateSize') -and ` - ($LogTruncateSize -ne $currentLogState.LogTruncateSize)) - { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseLogTruncateSize) - return $false - } - - # Check LoglocalTimeRollover - if ($PSBoundParameters.ContainsKey('LoglocalTimeRollover') -and ` - ($LoglocalTimeRollover -ne ` - ([System.Convert]::ToBoolean($currentLogState.LoglocalTimeRollover)))) - { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseLoglocalTimeRollover) - return $false - } - - return $true - -} - -#region Helper functions - -<# - .SYNOPSIS - Helper function used to validate the logflags status. - Returns False if the loglfags do not match and true if they do - - .PARAMETER LogFlags - Specifies flags to check -#> -function Compare-LogFlags -{ - [CmdletBinding()] - [OutputType([Boolean])] - param - ( - [ValidateSet('Date','Time','ClientIP','UserName','SiteName','ComputerName','ServerIP','Method','UriStem','UriQuery','HttpStatus','Win32Status','BytesSent','BytesRecv','TimeTaken','ServerPort','UserAgent','Cookie','Referer','ProtocolVersion','Host','HttpSubStatus')] - [String[]] $LogFlags - ) - - $currentLogFlags = (Get-WebConfigurationProperty ` - -Filter '/system.Applicationhost/Sites/SiteDefaults/logfile' ` - -Name LogExtFileFlags) -split ',' | ` - Sort-Object - - $proposedLogFlags = $LogFlags -split ',' | Sort-Object - - if (Compare-Object -ReferenceObject $currentLogFlags ` - -DifferenceObject $proposedLogFlags) - { - return $false - } - - return $true - -} - -#endregion - -Export-ModuleMember -function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisLogging/MSFT_xIisLogging.schema.mof b/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisLogging/MSFT_xIisLogging.schema.mof deleted file mode 100644 index 234f8b1c..00000000 --- a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisLogging/MSFT_xIisLogging.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ -[ClassVersion("1.0.0"), FriendlyName("xIisLogging")] -class MSFT_xIisLogging : OMI_BaseResource -{ - [Key, Description ("The directory to be used for logfiles")] String LogPath; - [Write, Description ("The W3C logging fields"), ValueMap{"Date","Time","ClientIP","UserName","SiteName","ComputerName","ServerIP","Method","UriStem","UriQuery","HttpStatus","Win32Status","BytesSent","BytesRecv","TimeTaken","ServerPort","UserAgent","Cookie","Referer","ProtocolVersion","Host","HttpSubStatus"}, Values{"Date","Time","ClientIP","UserName","SiteName","ComputerName","ServerIP","Method","UriStem","UriQuery","HttpStatus","Win32Status","BytesSent","BytesRecv","TimeTaken","ServerPort","UserAgent","Cookie","Referer","ProtocolVersion","Host","HttpSubStatus"}] String LogFlags[]; - [Write, Description ("How often the log file should rollover"), ValueMap{"Hourly","Daily","Weekly","Monthly","MaxSize"}, Values{"Hourly","Daily","Weekly","Monthly","MaxSize"}] String LogPeriod; - [Write, Description ("How large the file should be before it is truncated")] String LogTruncateSize; - [Write, Description ("Use the localtime for file naming and rollover")] Boolean LoglocalTimeRollover; - [Write, Description ("Format of the Logfiles. Only W3C supports LogFlags"), ValueMap{"IIS","W3C","NCSA"}, Values{"IIS","W3C","NCSA"}] String LogFormat; -}; diff --git a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisMimeTypeMapping/MSFT_xIisMimeTypeMapping.psm1 b/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisMimeTypeMapping/MSFT_xIisMimeTypeMapping.psm1 deleted file mode 100644 index 4423852f..00000000 --- a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisMimeTypeMapping/MSFT_xIisMimeTypeMapping.psm1 +++ /dev/null @@ -1,192 +0,0 @@ -# Load the Helper Module -Import-Module -Name "$PSScriptRoot\..\Helper.psm1" - -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData -StringData @' - NoWebAdministrationModule = Please ensure that WebAdministration module is installed. - AddingType = Adding MIMEType '{0}' for extension '{1}' - RemovingType = Removing MIMEType '{0}' for extension '{1}' - TypeExists = MIMEType '{0}' for extension '{1}' already exist - TypeNotPresent = MIMEType '{0}' for extension '{1}' is not present as requested - TypeStatusUnknown = MIMEType '{0}' for extension '{1}' is is an unknown status - VerboseGetTargetPresent = MIMEType is present - VerboseGetTargetAbsent = MIMEType is absent - VerboseSetTargetError = Cannot set type -'@ -} - -function Get-TargetResource -{ - <# - .SYNOPSIS - This will return a hashtable of results - #> - [OutputType([Hashtable])] - param - ( - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [String] $Extension, - - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [String] $MimeType, - - [ValidateSet('Present', 'Absent')] - [Parameter(Mandatory)] - [String] $Ensure - ) - - # Check if WebAdministration module is present for IIS cmdlets - Assert-Module - - $mt = Get-Mapping -Extension $Extension -Type $MimeType - - if ($null -eq $mt) - { - Write-Verbose -Message $LocalizedData.VerboseGetTargetAbsent - return @{ - Ensure = 'Absent' - Extension = $null - MimeType = $null - } - } - else - { - Write-Verbose -Message $LocalizedData.VerboseGetTargetPresent - return @{ - Ensure = 'Present' - Extension = $mt.fileExtension - MimeType = $mt.mimeType - } - } -} -function Set-TargetResource -{ - <# - .SYNOPSIS - This will set the desired state - #> - param - ( - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [String] $Extension, - - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [String] $MimeType, - - [ValidateSet('Present', 'Absent')] - [Parameter(Mandatory)] - [String] $Ensure - ) - - Assert-Module - - [String] $psPathRoot = 'MACHINE/WEBROOT/APPHOST' - [String] $sectionNode = 'system.webServer/staticContent' - - $mt = Get-Mapping -Extension $Extension -Type $MimeType - - if ($null -eq $mt -and $Ensure -eq 'Present') - { - # add the MimeType - Add-WebConfigurationProperty -PSPath $psPathRoot ` - -Filter $sectionNode ` - -Name '.' ` - -Value @{fileExtension="$Extension";mimeType="$MimeType"} - Write-Verbose -Message ($LocalizedData.AddingType -f $MimeType,$Extension); - } - elseif ($null -ne $mt -and $Ensure -eq 'Absent') - { - # remove the MimeType - Remove-WebConfigurationProperty -PSPath $psPathRoot ` - -Filter $sectionNode ` - -Name '.' ` - -AtElement @{fileExtension="$Extension"} - Write-Verbose -Message ($LocalizedData.RemovingType -f $MimeType,$Extension); - } - else - { - Write-Verbose -Message $LocalizedData.VerboseSetTargetError - } -} - -function Test-TargetResource -{ - <# - .SYNOPSIS - This tests the desired state. If the state is not correct it will return $false. - If the state is correct it will return $true - #> - - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [String] $Extension, - - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [String] $MimeType, - - [ValidateSet('Present', 'Absent')] - [Parameter(Mandatory)] - [String] $Ensure - ) - - [Boolean] $DesiredConfigurationMatch = $true; - - Assert-Module - - $mt = Get-Mapping -Extension $Extension -Type $MimeType - - if (($null -eq $mt -and $Ensure -eq 'Present') -or ($null -ne $mt -and $Ensure -eq 'Absent')) - { - $DesiredConfigurationMatch = $false; - } - elseif ($null -ne $mt -and $Ensure -eq 'Present') - { - # Already there - Write-Verbose -Message ($LocalizedData.TypeExists -f $MimeType,$Extension); - } - elseif ($null -eq $mt -and $Ensure -eq 'Absent') - { - # TypeNotPresent - Write-Verbose -Message ($LocalizedData.TypeNotPresent -f $MimeType,$Extension); - } - else - { - $DesiredConfigurationMatch = $false; - Write-Verbose -Message ($LocalizedData.TypeStatusUnknown -f $MimeType,$Extension); - } - - return $DesiredConfigurationMatch -} - -#region Helper Functions - -function Get-Mapping -{ - - [CmdletBinding()] - param - ( - [String] $Extension, - - [String] $Type - ) - - [String] $filter = "system.webServer/staticContent/mimeMap[@fileExtension='" + ` - $Extension + "' and @mimeType='" + $Type + "']" - return Get-WebConfigurationProperty -PSPath 'MACHINE/WEBROOT/APPHOST' -Filter $filter -Name . -} - -#endregion - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisMimeTypeMapping/MSFT_xIisMimeTypeMapping.schema.mof b/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisMimeTypeMapping/MSFT_xIisMimeTypeMapping.schema.mof deleted file mode 100644 index 1dadb389..00000000 --- a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisMimeTypeMapping/MSFT_xIisMimeTypeMapping.schema.mof +++ /dev/null @@ -1,7 +0,0 @@ -[ClassVersion("1.0.0"), FriendlyName("xIisMimeTypeMapping")] -class MSFT_xIisMimeTypeMapping : OMI_BaseResource -{ - [Key] string Extension; - [Key] string MimeType; - [Required,ValueMap{"Present", "Absent"},Values{"Present", "Absent"}] string Ensure; -}; diff --git a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisModule/MSFT_xIisModule.psm1 b/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisModule/MSFT_xIisModule.psm1 deleted file mode 100644 index efdca6ba..00000000 --- a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisModule/MSFT_xIisModule.psm1 +++ /dev/null @@ -1,414 +0,0 @@ -# Load the Helper Module -Import-Module -Name "$PSScriptRoot\..\Helper.psm1" - -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData -StringData @' - VerboseGetTargetResource = Get-TargetResource has been run. - VerboseSetTargetRemoveHandler = Removing handler - VerboseSetTargetAddHandler = Adding handler. - VerboseSetTargetAddfastCgi = Adding fastCgi. - VerboseTestTargetResource = Get-TargetResource has been run. - VerboseGetIisHandler = Getting Handler for {0} in Site {1} - VerboseTestTargetResourceImplVerb = Matched Verb {0} - VerboseTestTargetResourceImplExtraVerb = Extra Verb {0} - VerboseTestTargetResourceImplRequestPath = RequestPath is {0} - VerboseTestTargetResourceImplPath = Path is {0} - VerboseTestTargetResourceImplresourceStatusRequestPath = StatusRequestPath is {0} - VerboseTestTargetResourceImplresourceStatusPath = StatusPath is {0} - VerboseTestTargetResourceImplModulePresent = Module present is {0} - VerboseTestTargetResourceImplModuleConfigured = ModuleConfigured is {0} -'@ -} -function Get-TargetResource -{ - <# - .SYNOPSIS - This will return a hashtable of results - #> - - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [String] $Path, - - [Parameter(Mandatory = $true)] - [String] $Name, - - [Parameter(Mandatory = $true)] - [String] $RequestPath, - - [Parameter(Mandatory = $true)] - [String[]] $Verb, - - [ValidateSet('FastCgiModule')] - [String] $ModuleType = 'FastCgiModule', - - [String] $SiteName - ) - - Assert-Module - - $currentVerbs = @() - $Ensure = 'Absent' - - $modulePresent = $false; - - $handler = Get-IisHandler -Name $Name -SiteName $SiteName - - if($handler ) - { - $Ensure = 'Present' - $modulePresent = $true; - } - - foreach($thisVerb in $handler.Verb) - { - $currentVerbs += $thisVerb - } - - $fastCgiSetup = $false - - if($handler.Modules -eq 'FastCgiModule') - { - $fastCgi = Get-WebConfiguration /system.webServer/fastCgi/* ` - -PSPath (Get-IisSitePath ` - -SiteName $SiteName) | ` - Where-Object{$_.FullPath -ieq $handler.ScriptProcessor} - if($fastCgi) - { - $fastCgiSetup = $true - } - } - - Write-Verbose -Message $LocalizedData.VerboseGetTargetResource - - $returnValue = @{ - Path = $handler.ScriptProcessor - Name = $handler.Name - RequestPath = $handler.Path - Verb = $currentVerbs - SiteName = $SiteName - Ensure = $Ensure - ModuleType = $handler.Modules - EndPointSetup = $fastCgiSetup - } - - $returnValue - -} - -function Set-TargetResource -{ - <# - .SYNOPSIS - This will set the desired state - #> - - [CmdletBinding()] - param - ( - [ValidateSet('Present','Absent')] - [String] $Ensure, - - [Parameter(Mandatory = $true)] - [String] $Path, - - [Parameter(Mandatory = $true)] - [String] $Name, - - [Parameter(Mandatory = $true)] - [String] $RequestPath, - - [Parameter(Mandatory = $true)] - [String[]] $Verb, - - [ValidateSet('FastCgiModule')] - [String] $ModuleType = 'FastCgiModule', - - [String] $SiteName - ) - - $getParameters = Get-PSBoundParameters -FunctionParameters $PSBoundParameters - $resourceStatus = Get-TargetResource @GetParameters - $resourceTests = Test-TargetResourceImpl @PSBoundParameters -ResourceStatus $resourceStatus - if($resourceTests.Result) - { - return - } - - if($Ensure -eq 'Present') - { - if($resourceTests.ModulePresent -and -not $resourceTests.ModuleConfigured) - { - Write-Verbose -Message $LocalizedData.VerboseSetTargetRemoveHandler - Remove-IisHandler - } - - if(-not $resourceTests.ModulePresent -or -not $resourceTests.ModuleConfigured) - { - Write-Verbose -Message $LocalizedData.VerboseSetTargetAddHandler - Add-webconfiguration /system.webServer/handlers iis:\ -Value @{ - Name = $Name - Path = $RequestPath - Verb = $Verb -join ',' - Module = $ModuleType - ScriptProcessor = $Path - } - } - - if(-not $resourceTests.EndPointSetup) - { - Write-Verbose -Message $LocalizedData.VerboseSetTargetAddfastCgi - Add-WebConfiguration /system.webServer/fastCgi iis:\ -Value @{ - FullPath = $Path - } - } - } - else - { - Write-Verbose -Message $LocalizedData.VerboseSetTargetRemoveHandler - Remove-IisHandler - } -} - -function Test-TargetResource -{ - <# - .SYNOPSIS - This tests the desired state. If the state is not correct it will return $false. - If the state is correct it will return $true - #> - - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [ValidateSet('Present','Absent')] - [String] $Ensure, - - [Parameter(Mandatory = $true)] - [String] $Path, - - [Parameter(Mandatory = $true)] - [String] $Name, - - [Parameter(Mandatory = $true)] - [String] $RequestPath, - - [Parameter(Mandatory = $true)] - [String[]] $Verb, - - [ValidateSet('FastCgiModule')] - [String] $ModuleType = 'FastCgiModule', - - [String] $SiteName - ) - - $getParameters = Get-PSBoundParameters -FunctionParameters $PSBoundParameters - $resourceStatus = Get-TargetResource @GetParameters - - Write-Verbose -Message $LocalizedData.VerboseTestTargetResource - - return (Test-TargetResourceImpl @PSBoundParameters -ResourceStatus $resourceStatus).Result -} - -#region Helper Functions - -function Get-PSBoundParameters -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [Hashtable] $FunctionParameters - ) - - [Hashtable] $getParameters = @{} - foreach($key in $FunctionParameters.Keys) - { - if($key -ine 'Ensure') - { - $getParameters.Add($key, $FunctionParameters.$key) | Out-Null - } - } - - return $getParameters -} - -function Get-IisSitePath -{ - [OutputType([System.String])] - [CmdletBinding()] - param - ( - [String] $SiteName - ) - - if (-not $SiteName) - { - return 'IIS:\' - } - else - { - return Join-Path 'IIS:\sites\' $SiteName - } -} - -function Get-IisHandler -{ - <# - .NOTES - Get a list on IIS handlers - #> - [CmdletBinding()] - param - ( - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - - [String] $Name, - - [String] $SiteName - ) - - Write-Verbose -Message ($LocalizedData.VerboseGetIisHandler -f $Name,$SiteName) - return Get-Webconfiguration -Filter 'System.WebServer/handlers/*' ` - -PSPath (Get-IisSitePath ` - -SiteName $SiteName) | ` - Where-Object{$_.Name -ieq $Name} -} - -function Remove-IisHandler -{ - <# - .NOTES - Remove an IIS Handler - #> - param - ( - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - - [String] $Name, - - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - - [String] $SiteName - ) - - $handler = Get-IisHandler @PSBoundParameters - - if($handler) - { - Clear-WebConfiguration -PSPath $handler.PSPath ` - -Filter $handler.ItemXPath ` - -Location $handler.Location - } -} - -function Test-TargetResourceImpl -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [String] $Path, - - [Parameter(Mandatory = $true)] - [String] $Name, - - [Parameter(Mandatory = $true)] - [String] $RequestPath, - - [Parameter(Mandatory = $true)] - [String[]] $Verb, - - [ValidateSet('FastCgiModule')] - [String] $ModuleType = 'FastCgiModule', - - [String] $SiteName, - - [ValidateSet('Present','Absent')] - [String] $Ensure, - - [Parameter(Mandatory = $true)] - [HashTable] $resourceStatus - ) - - $matchedVerbs = @() - $mismatchVerbs =@() - foreach($thisVerb in $resourceStatus.Verb) - { - if($Verb -icontains $thisVerb) - { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetResourceImplVerb ` - -f $Verb) - $matchedVerbs += $thisVerb - } - else - { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetResourceImplExtraVerb ` - -f $Verb) - $mismatchVerbs += $thisVerb - } - } - - $modulePresent = $false - if($resourceStatus.Name.Length -gt 0) - { - $modulePresent = $true - } - - Write-Verbose -Message ($LocalizedData.VerboseTestTargetResourceImplRequestPath ` - -f $RequestPath) - Write-Verbose -Message ($LocalizedData.VerboseTestTargetResourceImplPath ` - -f $Path) - Write-Verbose -Message ($LocalizedData.VerboseTestTargetResourceImplresourceStatusRequestPath ` - -f $($resourceStatus.RequestPath)) - Write-Verbose -Message ($LocalizedData.VerboseTestTargetResourceImplresourceStatusPath ` - -f $($resourceStatus.Path)) - - $moduleConfigured = $false - if($modulePresent -and ` - $mismatchVerbs.Count -eq 0 -and ` - $matchedVerbs.Count-eq $Verb.Count -and ` - $resourceStatus.Path -eq $Path -and ` - $resourceStatus.RequestPath -eq $RequestPath) - { - $moduleConfigured = $true - } - - Write-Verbose -Message ($LocalizedData.VerboseTestTargetResourceImplModulePresent ` - -f $ModulePresent) - Write-Verbose -Message ($LocalizedData.VerboseTestTargetResourceImplModuleConfigured ` - -f $ModuleConfigured) - if($moduleConfigured -and ($ModuleType -ne 'FastCgiModule' -or $resourceStatus.EndPointSetup)) - { - return @{ - Result = $true - ModulePresent = $modulePresent - ModuleConfigured = $moduleConfigured - } - } - else - { - return @{ - Result = $false - ModulePresent = $modulePresent - ModuleConfigured = $moduleConfigured - } - } -} - - -#endregion - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisModule/MSFT_xIisModule.schema.mof b/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisModule/MSFT_xIisModule.schema.mof deleted file mode 100644 index 135e12d7..00000000 --- a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisModule/MSFT_xIisModule.schema.mof +++ /dev/null @@ -1,17 +0,0 @@ - -[ClassVersion("1.0.0"), FriendlyName("xIisModule")] -class MSFT_xIisModule : OMI_BaseResource -{ - [Key, Description("The path to the module, usually a dll, to be added to IIS.")] String Path; - [Required, Description("The logical name of the module to add to IIS.")] String Name; - [Required, Description("The allowed request Path example: *.php")] String RequestPath; - [Required, Description("The supported verbs for the module.")] String Verb[]; - [Write, Description("The IIS Site to register the module.")] String SiteName; - [Write, Description("Should the module be present or absent."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, Description("The type of the module."), ValueMap{"FastCgiModule"}, Values{"FastCgiModule"}] String ModuleType; - [Read, Description("The End Point is setup. Such as a Fast Cgi endpoint.")] Boolean EndPointSetup; -}; - - - - diff --git a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisModule/xIisModuleDesigner.ps1 b/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisModule/xIisModuleDesigner.ps1 deleted file mode 100644 index 3f9c39c6..00000000 --- a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xIisModule/xIisModuleDesigner.ps1 +++ /dev/null @@ -1,50 +0,0 @@ -$diff = join-Path ${env:ProgramFiles(x86)} "Beyond compare 2\bc2.exe" -$friendlyName = "xIisModule" -$resourceName = "MSFT_$friendlyName" -$classVersion = "1.0.0" - -$scriptRoot = Split-Path $MyInvocation.MyCommand.Path -$originalModuleRoot = join-Path $scriptroot "..\.." -$originalModuleRootPath = Resolve-Path $originalModuleRoot -$moduleRoot = Join-Path $env:temp "$($originalModuleRootPath.path | split-path -Leaf)Temp" - -$resources = @() - -#Key properties -$resources += New-xDscResourceProperty -Name Path -Type String -Attribute Key -Description "The path to the module, usually a dll, to be added to IIS." - - -#Required Properites -$resources += New-xDscResourceProperty -Name Name -Type String -Attribute Required -Description "The logical name of the module to add to IIS." -$resources += New-xDscResourceProperty -Name RequestPath -Type String -Attribute Required -Description "The allowed request Path example: *.php" -$resources += New-xDscResourceProperty -Name Verb -Type String[] -Attribute Required -Description "The supported verbs for the module." - -#Write Properties -$resources += New-xDscResourceProperty -Name SiteName -Type String -Attribute Write -Description "The IIS Site to register the module." -$resources += New-xDscResourceProperty -Name Ensure -Type String -Attribute Write -Description "Should the module be present or absent." -ValidateSet @("Present","Absent") -$resources += New-xDscResourceProperty -Name ModuleType -Type String -Attribute Write -Description "The type of the module." -ValidateSet @("FastCgiModule") - -#Read Properties -$resources += New-xDscResourceProperty -Name EndPointSetup -Type Boolean -Attribute Read -Description "The End Point is setup. Such as a Fast Cgi endpoint." - - - -Write-Verbose "updating..." -Verbose - -# Create a New template resource to a temporary folder -New-xDscResource -Property $resources -ClassVersion $classVersion -Name $resourceName -Path $moduleRoot -FriendlyName $friendlyName - - -# Use your favorite diff program to compare and merge the current resource and the existing resource - -if((test-Path $diff)) -{ - &$diff $originalModuleRoot $moduleRoot -} -else -{ - Write-Warning "Diff propgram not found!`r`nUse your favorite diff program to compare and merge:`r`n `t$($originalModuleRootPath.path)`r`n and:`r`n `t$moduleRoot" -} - - - diff --git a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xSSLSettings/MSFT_xSSLSettings.psm1 b/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xSSLSettings/MSFT_xSSLSettings.psm1 deleted file mode 100644 index 7e7fbb30..00000000 --- a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xSSLSettings/MSFT_xSSLSettings.psm1 +++ /dev/null @@ -1,175 +0,0 @@ -# Load the Helper Module -Import-Module -Name "$PSScriptRoot\..\Helper.psm1" - -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData -StringData @' - UnableToFindConfig = Unable to find configuration in AppHost Config. - SettingsslConfig = Setting {0} ssl binding to {1}. - sslBindingsCorrect = ssl Bindings for {0} are correct. - sslBindingsAbsent = ssl Bindings for {0} are absent. - VerboseGetTargetResource = Get-TargetResource has been run. -'@ -} - -<# - .SYNOPSIS - This will return a hashtable of results including Name, Bindings, and Ensure -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [String] $Name, - - [Parameter(Mandatory = $true)] - [AllowEmptyString()] - [ValidateSet('','Ssl','SslNegotiateCert','SslRequireCert','Ssl128')] - [String[]] $Bindings - ) - - Assert-Module - - $ensure = 'Absent' - - try - { - $params = @{ - PSPath = 'MACHINE/WEBROOT/APPHOST' - Location = $Name - Filter = 'system.webServer/security/access' - Name = 'sslFlags' - } - - $sslSettings = Get-WebConfigurationProperty @params - - # If SSL is configured at all this will be a String else - # it willl be a configuration object. - if ($sslSettings.GetType().FullName -eq 'System.String') - { - $Bindings = $sslSettings.Split(',') - $ensure = 'Present' - } - } - catch [Exception] - { - $errorMessage = $LocalizedData.UnableToFindConfig - New-TerminatingError -ErrorId 'UnableToFindConfig'` - -ErrorMessage $errorMessage` - -ErrorCategory 'InvalidResult' - } - - Write-Verbose -Message $LocalizedData.VerboseGetTargetResource - - return @{ - Name = $Name - Bindings = $Bindings - Ensure = $ensure - } -} - -<# - .SYNOPSIS - This will update the desired state based on the Bindings passed in -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [String] $Name, - - [Parameter(Mandatory = $true)] - [AllowEmptyString()] - [ValidateSet('','Ssl','SslNegotiateCert','SslRequireCert','Ssl128')] - [String[]] $Bindings, - - [ValidateSet('Present','Absent')] - [String] $Ensure = 'Present' - ) - - Assert-Module - - if ($Ensure -eq 'Absent' -or $Bindings.toLower().Contains('none')) - { - $params = @{ - PSPath = 'MACHINE/WEBROOT/APPHOST' - Location = $Name - Filter = 'system.webServer/security/access' - Name = 'sslFlags' - Value = '' - } - - Write-Verbose -Message ($LocalizedData.SettingsslConfig -f $Name, 'None') - Set-WebConfigurationProperty @params - } - - else - { - $sslBindings = $Bindings -join ',' - $params = @{ - PSPath = 'MACHINE/WEBROOT/APPHOST' - Location = $Name - Filter = 'system.webServer/security/access' - Name = 'sslFlags' - Value = $sslBindings - } - - Write-Verbose -Message ($LocalizedData.SettingsslConfig -f $Name, $params.Value) - Set-WebConfigurationProperty @params - } -} - -<# - .SYNOPSIS - This tests the desired state. If the state is not correct it will return $false. - If the state is correct it will return $true -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [String] $Name, - - [Parameter(Mandatory = $true)] - [AllowEmptyString()] - [ValidateSet('','Ssl','SslNegotiateCert','SslRequireCert','Ssl128')] - [String[]] $Bindings, - - [ValidateSet('Present','Absent')] - [String] $Ensure = 'Present' - ) - - $sslSettings = Get-TargetResource -Name $Name -Bindings $Bindings - - if ($Ensure -eq 'Present' -and $sslSettings.Ensure -eq 'Present') - { - $sslComp = Compare-Object -ReferenceObject $Bindings ` - -DifferenceObject $sslSettings.Bindings ` - -PassThru - if ($null -eq $sslComp) - { - Write-Verbose -Message ($LocalizedData.sslBindingsCorrect -f $Name) - return $true; - } - } - - if ($Ensure -eq 'Absent' -and $sslSettings.Ensure -eq 'Absent') - { - Write-Verbose -Message ($LocalizedData.sslBindingsAbsent -f $Name) - return $true; - } - - return $false; -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xSSLSettings/MSFT_xSSLSettings.schema.mof b/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xSSLSettings/MSFT_xSSLSettings.schema.mof deleted file mode 100644 index 8239042b..00000000 --- a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xSSLSettings/MSFT_xSSLSettings.schema.mof +++ /dev/null @@ -1,7 +0,0 @@ -[ClassVersion("1.0.0"), FriendlyName("xSSLSettings")] -class MSFT_xSSLSettings : OMI_BaseResource -{ - [Key, Description("Name of website in which to modify the SSL Settings")] String Name; - [Required, Description("The Bindings in which to modify for the website"), ValueMap{"","Ssl","SslNegotiateCert","SslRequireCert","Ssl128"},Values{"","Ssl","SslNegotiateCert","SslRequireCert","Ssl128"}] String Bindings[]; - [Write,ValueMap{"Present", "Absent"},Values{"Present", "Absent"},Description("Whether the bindings should be present or absent")] String Ensure; -}; diff --git a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebAppPool/MSFT_xWebAppPool.psm1 b/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebAppPool/MSFT_xWebAppPool.psm1 deleted file mode 100644 index db2652a1..00000000 --- a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebAppPool/MSFT_xWebAppPool.psm1 +++ /dev/null @@ -1,927 +0,0 @@ -#requires -Version 4.0 -Modules CimCmdlets - -# Load the Helper Module -Import-Module -Name "$PSScriptRoot\..\Helper.psm1" - -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData -StringData @' - ErrorAppCmdNonZeroExitCode = AppCmd.exe has exited with error code "{0}". - VerboseAppPoolFound = Application pool "{0}" was found. - VerboseAppPoolNotFound = Application pool "{0}" was not found. - VerboseEnsureNotInDesiredState = The "Ensure" state of application pool "{0}" does not match the desired state. - VerbosePropertyNotInDesiredState = The "{0}" property of application pool "{1}" does not match the desired state. - VerboseCredentialToBeCleared = Custom account credentials of application pool "{0}" need to be cleared because the "identityType" property is not set to "SpecificUser". - VerboseCredentialToBeIgnored = The "Credential" property is only valid when the "identityType" property is set to "SpecificUser". - VerboseResourceInDesiredState = The target resource is already in the desired state. No action is required. - VerboseResourceNotInDesiredState = The target resource is not in the desired state. - VerboseNewAppPool = Creating application pool "{0}". - VerboseRemoveAppPool = Removing application pool "{0}". - VerboseStartAppPool = Starting application pool "{0}". - VerboseStopAppPool = Stopping application pool "{0}". - VerboseSetProperty = Setting the "{0}" property of application pool "{1}". - VerboseClearCredential = Clearing custom account credentials of application pool "{0}" because the "identityType" property is not set to "SpecificUser". - VerboseRestartScheduleValueAdd = Adding value "{0}" to the "restartSchedule" collection of application pool "{1}". - VerboseRestartScheduleValueRemove = Removing value "{0}" from the "restartSchedule" collection of application pool "{1}". -'@ -} - -# Writable properties except Ensure and Credential. -data PropertyData -{ - @( - # General - @{Name = 'State'; Path = 'state'} - @{Name = 'autoStart'; Path = 'autoStart'} - @{Name = 'CLRConfigFile'; Path = 'CLRConfigFile'} - @{Name = 'enable32BitAppOnWin64'; Path = 'enable32BitAppOnWin64'} - @{Name = 'enableConfigurationOverride'; Path = 'enableConfigurationOverride'} - @{Name = 'managedPipelineMode'; Path = 'managedPipelineMode'} - @{Name = 'managedRuntimeLoader'; Path = 'managedRuntimeLoader'} - @{Name = 'managedRuntimeVersion'; Path = 'managedRuntimeVersion'} - @{Name = 'passAnonymousToken'; Path = 'passAnonymousToken'} - @{Name = 'startMode'; Path = 'startMode'} - @{Name = 'queueLength'; Path = 'queueLength'} - - # CPU - @{Name = 'cpuAction'; Path = 'cpu.action'} - @{Name = 'cpuLimit'; Path = 'cpu.limit'} - @{Name = 'cpuResetInterval'; Path = 'cpu.resetInterval'} - @{Name = 'cpuSmpAffinitized'; Path = 'cpu.smpAffinitized'} - @{Name = 'cpuSmpProcessorAffinityMask'; Path = 'cpu.smpProcessorAffinityMask'} - @{Name = 'cpuSmpProcessorAffinityMask2'; Path = 'cpu.smpProcessorAffinityMask2'} - - # Process Model - @{Name = 'identityType'; Path = 'processModel.identityType'} - @{Name = 'idleTimeout'; Path = 'processModel.idleTimeout'} - @{Name = 'idleTimeoutAction'; Path = 'processModel.idleTimeoutAction'} - @{Name = 'loadUserProfile'; Path = 'processModel.loadUserProfile'} - @{Name = 'logEventOnProcessModel'; Path = 'processModel.logEventOnProcessModel'} - @{Name = 'logonType'; Path = 'processModel.logonType'} - @{Name = 'manualGroupMembership'; Path = 'processModel.manualGroupMembership'} - @{Name = 'maxProcesses'; Path = 'processModel.maxProcesses'} - @{Name = 'pingingEnabled'; Path = 'processModel.pingingEnabled'} - @{Name = 'pingInterval'; Path = 'processModel.pingInterval'} - @{Name = 'pingResponseTime'; Path = 'processModel.pingResponseTime'} - @{Name = 'setProfileEnvironment'; Path = 'processModel.setProfileEnvironment'} - @{Name = 'shutdownTimeLimit'; Path = 'processModel.shutdownTimeLimit'} - @{Name = 'startupTimeLimit'; Path = 'processModel.startupTimeLimit'} - - # Process Orphaning - @{Name = 'orphanActionExe'; Path = 'failure.orphanActionExe'} - @{Name = 'orphanActionParams'; Path = 'failure.orphanActionParams'} - @{Name = 'orphanWorkerProcess'; Path = 'failure.orphanWorkerProcess'} - - # Rapid-Fail Protection - @{Name = 'loadBalancerCapabilities'; Path = 'failure.loadBalancerCapabilities'} - @{Name = 'rapidFailProtection'; Path = 'failure.rapidFailProtection'} - @{Name = 'rapidFailProtectionInterval'; Path = 'failure.rapidFailProtectionInterval'} - @{Name = 'rapidFailProtectionMaxCrashes'; Path = 'failure.rapidFailProtectionMaxCrashes'} - @{Name = 'autoShutdownExe'; Path = 'failure.autoShutdownExe'} - @{Name = 'autoShutdownParams'; Path = 'failure.autoShutdownParams'} - - # Recycling - @{Name = 'disallowOverlappingRotation'; Path = 'recycling.disallowOverlappingRotation'} - @{Name = 'disallowRotationOnConfigChange'; Path = 'recycling.disallowRotationOnConfigChange'} - @{Name = 'logEventOnRecycle'; Path = 'recycling.logEventOnRecycle'} - @{Name = 'restartMemoryLimit'; Path = 'recycling.periodicRestart.memory'} - @{Name = 'restartPrivateMemoryLimit'; Path = 'recycling.periodicRestart.privateMemory'} - @{Name = 'restartRequestsLimit'; Path = 'recycling.periodicRestart.requests'} - @{Name = 'restartTimeLimit'; Path = 'recycling.periodicRestart.time'} - @{Name = 'restartSchedule'; Path = 'recycling.periodicRestart.schedule'} - ) -} - -function Get-TargetResource -{ - <# - .SYNOPSIS - This will return a hashtable of results - #> - - [CmdletBinding()] - [OutputType([Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateLength(1, 64)] - [String] $Name - ) - - Assert-Module - - # XPath -Filter is case-sensitive. Use Where-Object to get the target application pool by name. - $appPool = Get-WebConfiguration -Filter '/system.applicationHost/applicationPools/add' | - Where-Object -FilterScript {$_.name -eq $Name} - - $cimCredential = $null - - if ($null -eq $appPool) - { - Write-Verbose -Message ($LocalizedData['VerboseAppPoolNotFound'] -f $Name) - - $ensureResult = 'Absent' - } - else - { - Write-Verbose -Message ($LocalizedData['VerboseAppPoolFound'] -f $Name) - - $ensureResult = 'Present' - - if ($appPool.processModel.identityType -eq 'SpecificUser') - { - $cimCredential = New-CimInstance -ClientOnly ` - -ClassName MSFT_Credential ` - -Namespace root/microsoft/windows/DesiredStateConfiguration ` - -Property @{ - UserName = [String]$appPool.processModel.userName - Password = [String]$appPool.processModel.password - } - } - } - - $returnValue = @{ - Name = $Name - Ensure = $ensureResult - Credential = $cimCredential - } - - $PropertyData.Where( - { - $_.Name -ne 'restartSchedule' - } - ).ForEach( - { - $property = Get-Property -Object $appPool -PropertyName $_.Path - $returnValue.Add($_.Name, $property) - } - ) - - $restartScheduleCurrent = [String[]]@( - @($appPool.recycling.periodicRestart.schedule.Collection).ForEach('value') - ) - - $returnValue.Add('restartSchedule', $restartScheduleCurrent) - - return $returnValue -} - -function Set-TargetResource -{ - <# - .SYNOPSIS - This will set the desired state - #> - - [CmdletBinding(SupportsShouldProcess = $true)] - param - ( - [Parameter(Mandatory = $true)] - [ValidateLength(1, 64)] - [String] $Name, - - [ValidateSet('Present', 'Absent')] - [String] $Ensure = 'Present', - - [ValidateSet('Started', 'Stopped')] - [String] $State, - - [Boolean] $autoStart, - - [String] $CLRConfigFile, - - [Boolean] $enable32BitAppOnWin64, - - [Boolean] $enableConfigurationOverride, - - [ValidateSet('Integrated', 'Classic')] - [String] $managedPipelineMode, - - [String] $managedRuntimeLoader, - - [ValidateSet('v4.0', 'v2.0', '')] - [String] $managedRuntimeVersion, - - [Boolean] $passAnonymousToken, - - [ValidateSet('OnDemand', 'AlwaysRunning')] - [String] $startMode, - - [ValidateRange(10, 65535)] - [UInt32] $queueLength, - - [ValidateSet('NoAction', 'KillW3wp', 'Throttle', 'ThrottleUnderLoad')] - [String] $cpuAction, - - [ValidateRange(0, 100000)] - [UInt32] $cpuLimit, - - [ValidateScript({ - ([ValidateRange(0, 1440)]$valueInMinutes = [TimeSpan]::Parse($_).TotalMinutes); $? - })] - [String] $cpuResetInterval, - - [Boolean] $cpuSmpAffinitized, - - [UInt32] $cpuSmpProcessorAffinityMask, - - [UInt32] $cpuSmpProcessorAffinityMask2, - - [ValidateSet( - 'ApplicationPoolIdentity', 'LocalService', 'LocalSystem', - 'NetworkService', 'SpecificUser' - )] - [String] $identityType, - - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [ValidateScript({ - ([ValidateRange(0, 43200)]$valueInMinutes = [TimeSpan]::Parse($_).TotalMinutes); $? - })] - [String] $idleTimeout, - - [ValidateSet('Terminate', 'Suspend')] - [String] $idleTimeoutAction, - - [Boolean] $loadUserProfile, - - [String] $logEventOnProcessModel, - - [ValidateSet('LogonBatch', 'LogonService')] - [String] $logonType, - - [Boolean] $manualGroupMembership, - - [ValidateRange(0, 2147483647)] - [UInt32] $maxProcesses, - - [Boolean] $pingingEnabled, - - [ValidateScript({ - ([ValidateRange(1, 4294967)]$valueInSeconds = [TimeSpan]::Parse($_).TotalSeconds); $? - })] - [String] $pingInterval, - - [ValidateScript({ - ([ValidateRange(1, 4294967)]$valueInSeconds = [TimeSpan]::Parse($_).TotalSeconds); $? - })] - [String] $pingResponseTime, - - [Boolean] $setProfileEnvironment, - - [ValidateScript({ - ([ValidateRange(1, 4294967)]$valueInSeconds = [TimeSpan]::Parse($_).TotalSeconds); $? - })] - [String] $shutdownTimeLimit, - - [ValidateScript({ - ([ValidateRange(1, 4294967)]$valueInSeconds = [TimeSpan]::Parse($_).TotalSeconds); $? - })] - [String] $startupTimeLimit, - - [String] $orphanActionExe, - - [String] $orphanActionParams, - - [Boolean] $orphanWorkerProcess, - - [ValidateSet('HttpLevel', 'TcpLevel')] - [String] $loadBalancerCapabilities, - - [Boolean] $rapidFailProtection, - - [ValidateScript({ - ([ValidateRange(1, 144000)]$valueInMinutes = [TimeSpan]::Parse($_).TotalMinutes); $? - })] - [String] $rapidFailProtectionInterval, - - [ValidateRange(0, 2147483647)] - [UInt32] $rapidFailProtectionMaxCrashes, - - [String] $autoShutdownExe, - - [String] $autoShutdownParams, - - [Boolean] $disallowOverlappingRotation, - - [Boolean] $disallowRotationOnConfigChange, - - [String] $logEventOnRecycle, - - [UInt32] $restartMemoryLimit, - - [UInt32] $restartPrivateMemoryLimit, - - [UInt32] $restartRequestsLimit, - - [ValidateScript({ - ([ValidateRange(0, 432000)]$valueInMinutes = [TimeSpan]::Parse($_).TotalMinutes); $? - })] - [String] $restartTimeLimit, - - [ValidateScript({ - ($_ -eq '') -or - (& { - ([ValidateRange(0, 86399)]$valueInSeconds = [TimeSpan]::Parse($_).TotalSeconds); $? - }) - })] - [String[]] $restartSchedule - ) - - if (-not $PSCmdlet.ShouldProcess($Name)) - { - return - } - - Assert-Module - - $appPool = Get-WebConfiguration -Filter '/system.applicationHost/applicationPools/add' | - Where-Object -FilterScript {$_.name -eq $Name} - - if ($Ensure -eq 'Present') - { - # Create Application Pool - if ($null -eq $appPool) - { - Write-Verbose -Message ($LocalizedData['VerboseAppPoolNotFound'] -f $Name) - Write-Verbose -Message ($LocalizedData['VerboseNewAppPool'] -f $Name) - - $appPool = New-WebAppPool -Name $Name -ErrorAction Stop - } - - # Set Application Pool Properties - if ($null -ne $appPool) - { - Write-Verbose -Message ($LocalizedData['VerboseAppPoolFound'] -f $Name) - - $PropertyData.Where( - { - ($_.Name -in $PSBoundParameters.Keys) -and - ($_.Name -notin @('State', 'restartSchedule')) - } - ).ForEach( - { - $propertyName = $_.Name - $propertyPath = $_.Path - $property = Get-Property -Object $appPool -PropertyName $propertyPath - - if ( - $PSBoundParameters[$propertyName] -ne $property - ) - { - Write-Verbose -Message ( - $LocalizedData['VerboseSetProperty'] -f $propertyName, $Name - ) - - Invoke-AppCmd -ArgumentList 'set', 'apppool', $Name, ( - '/{0}:{1}' -f $propertyPath, $PSBoundParameters[$propertyName] - ) - } - } - ) - - if ($PSBoundParameters.ContainsKey('Credential')) - { - if ($PSBoundParameters['identityType'] -eq 'SpecificUser') - { - if ($appPool.processModel.userName -ne $Credential.UserName) - { - Write-Verbose -Message ( - $LocalizedData['VerboseSetProperty'] -f 'Credential (userName)', $Name - ) - - Invoke-AppCmd -ArgumentList 'set', 'apppool', $Name, ( - '/processModel.userName:{0}' -f $Credential.UserName - ) - } - - $clearTextPassword = $Credential.GetNetworkCredential().Password - - if ($appPool.processModel.password -cne $clearTextPassword) - { - Write-Verbose -Message ( - $LocalizedData['VerboseSetProperty'] -f 'Credential (password)', $Name - ) - - Invoke-AppCmd -ArgumentList 'set', 'apppool', $Name, ( - '/processModel.password:{0}' -f $clearTextPassword - ) - } - } - else - { - Write-Verbose -Message ($LocalizedData['VerboseCredentialToBeIgnored']) - } - } - - # Ensure userName and password are cleared if identityType isn't set to SpecificUser. - if ( - ( - ( - ($PSBoundParameters.ContainsKey('identityType') -eq $true) -and - ($PSBoundParameters['identityType'] -ne 'SpecificUser') - ) -or - ( - ($PSBoundParameters.ContainsKey('identityType') -eq $false) -and - ($appPool.processModel.identityType -ne 'SpecificUser') - ) - ) -and - ( - ([String]::IsNullOrEmpty($appPool.processModel.userName) -eq $false) -or - ([String]::IsNullOrEmpty($appPool.processModel.password) -eq $false) - ) - ) - { - Write-Verbose -Message ($LocalizedData['VerboseClearCredential'] -f $Name) - - Invoke-AppCmd -ArgumentList 'set', 'apppool', $Name, '/processModel.userName:' - Invoke-AppCmd -ArgumentList 'set', 'apppool', $Name, '/processModel.password:' - } - - if ($PSBoundParameters.ContainsKey('restartSchedule')) - { - # Normalize the restartSchedule array values. - $restartScheduleDesired = [String[]]@( - $restartSchedule.Where( - { - $_ -ne '' - } - ).ForEach( - { - [TimeSpan]::Parse($_).ToString('hh\:mm\:ss') - } - ) | - Select-Object -Unique - ) - - $restartScheduleCurrent = [String[]]@( - @($appPool.recycling.periodicRestart.schedule.Collection).ForEach('value') - ) - - Compare-Object -ReferenceObject $restartScheduleDesired ` - -DifferenceObject $restartScheduleCurrent | - ForEach-Object -Process { - - # Add value - if ($_.SideIndicator -eq '<=') - { - Write-Verbose -Message ( - $LocalizedData['VerboseRestartScheduleValueAdd'] -f - $_.InputObject, $Name - ) - - Invoke-AppCmd -ArgumentList 'set', 'apppool', $Name, ( - "/+recycling.periodicRestart.schedule.[value='{0}']" -f $_.InputObject - ) - } - # Remove value - else - { - Write-Verbose -Message ( - $LocalizedData['VerboseRestartScheduleValueRemove'] -f - $_.InputObject, $Name - ) - - Invoke-AppCmd -ArgumentList 'set', 'apppool', $Name, ( - "/-recycling.periodicRestart.schedule.[value='{0}']" -f $_.InputObject - ) - } - - } - } - - if ($PSBoundParameters.ContainsKey('State') -and $appPool.state -ne $State) - { - if ($State -eq 'Started') - { - Write-Verbose -Message ($LocalizedData['VerboseStartAppPool'] -f $Name) - - Start-WebAppPool -Name $Name -ErrorAction Stop - } - else - { - Write-Verbose -Message ($LocalizedData['VerboseStopAppPool'] -f $Name) - - Stop-WebAppPool -Name $Name -ErrorAction Stop - } - } - } - } - else - { - # Remove Application Pool - if ($null -ne $appPool) - { - Write-Verbose -Message ($LocalizedData['VerboseAppPoolFound'] -f $Name) - - if ($appPool.state -eq 'Started') - { - Write-Verbose -Message ($LocalizedData['VerboseStopAppPool'] -f $Name) - - Stop-WebAppPool -Name $Name -ErrorAction Stop - } - - Write-Verbose -Message ($LocalizedData['VerboseRemoveAppPool'] -f $Name) - - Remove-WebAppPool -Name $Name -ErrorAction Stop - } - else - { - Write-Verbose -Message ($LocalizedData['VerboseAppPoolNotFound'] -f $Name) - } - } -} - -function Test-TargetResource -{ - <# - .SYNOPSIS - This tests the desired state. If the state is not correct it will return $false. - If the state is correct it will return $true - #> - - [OutputType([Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateLength(1, 64)] - [String] $Name, - - [ValidateSet('Present', 'Absent')] - [String] $Ensure = 'Present', - - [ValidateSet('Started', 'Stopped')] - [String] $State, - - [Boolean] $autoStart, - - [String] $CLRConfigFile, - - [Boolean] $enable32BitAppOnWin64, - - [Boolean] $enableConfigurationOverride, - - [ValidateSet('Integrated', 'Classic')] - [String] $managedPipelineMode, - - [String] $managedRuntimeLoader, - - [ValidateSet('v4.0', 'v2.0', '')] - [String] $managedRuntimeVersion, - - [Boolean] $passAnonymousToken, - - [ValidateSet('OnDemand', 'AlwaysRunning')] - [String] $startMode, - - [ValidateRange(10, 65535)] - [UInt32] $queueLength, - - [ValidateSet('NoAction', 'KillW3wp', 'Throttle', 'ThrottleUnderLoad')] - [String] $cpuAction, - - [ValidateRange(0, 100000)] - [UInt32] $cpuLimit, - - [ValidateScript({ - ([ValidateRange(0, 1440)]$valueInMinutes = [TimeSpan]::Parse($_).TotalMinutes); $? - })] - [String] $cpuResetInterval, - - [Boolean] $cpuSmpAffinitized, - - [UInt32] $cpuSmpProcessorAffinityMask, - - [UInt32] $cpuSmpProcessorAffinityMask2, - - [ValidateSet( - 'ApplicationPoolIdentity', 'LocalService', 'LocalSystem', - 'NetworkService', 'SpecificUser' - )] - [String] $identityType, - - [System.Management.Automation.PSCredential] - [System.Management.Automation.Credential()] - $Credential, - - [ValidateScript({ - ([ValidateRange(0, 43200)]$valueInMinutes = [TimeSpan]::Parse($_).TotalMinutes); $? - })] - [String] $idleTimeout, - - [ValidateSet('Terminate', 'Suspend')] - [String] $idleTimeoutAction, - - [Boolean] $loadUserProfile, - - [String] $logEventOnProcessModel, - - [ValidateSet('LogonBatch', 'LogonService')] - [String] $logonType, - - [Boolean] $manualGroupMembership, - - [ValidateRange(0, 2147483647)] - [UInt32] $maxProcesses, - - [Boolean] $pingingEnabled, - - [ValidateScript({ - ([ValidateRange(1, 4294967)]$valueInSeconds = [TimeSpan]::Parse($_).TotalSeconds); $? - })] - [String] $pingInterval, - - [ValidateScript({ - ([ValidateRange(1, 4294967)]$valueInSeconds = [TimeSpan]::Parse($_).TotalSeconds); $? - })] - [String] $pingResponseTime, - - [Boolean] $setProfileEnvironment, - - [ValidateScript({ - ([ValidateRange(1, 4294967)]$valueInSeconds = [TimeSpan]::Parse($_).TotalSeconds); $? - })] - [String] $shutdownTimeLimit, - - [ValidateScript({ - ([ValidateRange(1, 4294967)]$valueInSeconds = [TimeSpan]::Parse($_).TotalSeconds); $? - })] - [String] $startupTimeLimit, - - [String] $orphanActionExe, - - [String] $orphanActionParams, - - [Boolean] $orphanWorkerProcess, - - [ValidateSet('HttpLevel', 'TcpLevel')] - [String] $loadBalancerCapabilities, - - [Boolean] $rapidFailProtection, - - [ValidateScript({ - ([ValidateRange(1, 144000)]$valueInMinutes = [TimeSpan]::Parse($_).TotalMinutes); $? - })] - [String] $rapidFailProtectionInterval, - - [ValidateRange(0, 2147483647)] - [UInt32] $rapidFailProtectionMaxCrashes, - - [String] $autoShutdownExe, - - [String] $autoShutdownParams, - - [Boolean] $disallowOverlappingRotation, - - [Boolean] $disallowRotationOnConfigChange, - - [String] $logEventOnRecycle, - - [UInt32] $restartMemoryLimit, - - [UInt32] $restartPrivateMemoryLimit, - - [UInt32] $restartRequestsLimit, - - [ValidateScript({ - ([ValidateRange(0, 432000)]$valueInMinutes = [TimeSpan]::Parse($_).TotalMinutes); $? - })] - [String] $restartTimeLimit, - - [ValidateScript({ - ($_ -eq '') -or - (& { - ([ValidateRange(0, 86399)]$valueInSeconds = [TimeSpan]::Parse($_).TotalSeconds); $? - }) - })] - [String[]] $restartSchedule - ) - - Assert-Module - - $inDesiredState = $true - - $appPool = Get-WebConfiguration -Filter '/system.applicationHost/applicationPools/add' | - Where-Object -FilterScript {$_.name -eq $Name} - - if ( - ($Ensure -eq 'Absent' -and $null -ne $appPool) -or - ($Ensure -eq 'Present' -and $null -eq $appPool) - ) - { - $inDesiredState = $false - - if ($null -ne $appPool) - { - Write-Verbose -Message ($LocalizedData['VerboseAppPoolFound'] -f $Name) - } - else - { - Write-Verbose -Message ($LocalizedData['VerboseAppPoolNotFound'] -f $Name) - } - - Write-Verbose -Message ($LocalizedData['VerboseEnsureNotInDesiredState'] -f $Name) - } - - if ($Ensure -eq 'Present' -and $null -ne $appPool) - { - Write-Verbose -Message ($LocalizedData['VerboseAppPoolFound'] -f $Name) - - $PropertyData.Where( - { - ($_.Name -in $PSBoundParameters.Keys) -and - ($_.Name -ne 'restartSchedule') - } - ).ForEach( - { - $propertyName = $_.Name - $propertyPath = $_.Path - $property = Get-Property -Object $appPool -PropertyName $propertyPath - - if ( - $PSBoundParameters[$propertyName] -ne $property - ) - { - Write-Verbose -Message ( - $LocalizedData['VerbosePropertyNotInDesiredState'] -f $propertyName, $Name - ) - - $inDesiredState = $false - } - } - ) - - if ($PSBoundParameters.ContainsKey('Credential')) - { - if ($PSBoundParameters['identityType'] -eq 'SpecificUser') - { - if ($appPool.processModel.userName -ne $Credential.UserName) - { - Write-Verbose -Message ( - $LocalizedData['VerbosePropertyNotInDesiredState'] -f - 'Credential (userName)', $Name - ) - - $inDesiredState = $false - } - - $clearTextPassword = $Credential.GetNetworkCredential().Password - - if ($appPool.processModel.password -cne $clearTextPassword) - { - Write-Verbose -Message ( - $LocalizedData['VerbosePropertyNotInDesiredState'] -f - 'Credential (password)', $Name - ) - - $inDesiredState = $false - } - } - else - { - Write-Verbose -Message ($LocalizedData['VerboseCredentialToBeIgnored']) - } - } - - # Ensure userName and password are cleared if identityType isn't set to SpecificUser. - if ( - ( - ( - ($PSBoundParameters.ContainsKey('identityType') -eq $true) -and - ($PSBoundParameters['identityType'] -ne 'SpecificUser') - ) -or - ( - ($PSBoundParameters.ContainsKey('identityType') -eq $false) -and - ($appPool.processModel.identityType -ne 'SpecificUser') - ) - ) -and - ( - ([String]::IsNullOrEmpty($appPool.processModel.userName) -eq $false) -or - ([String]::IsNullOrEmpty($appPool.processModel.password) -eq $false) - ) - ) - { - Write-Verbose -Message ($LocalizedData['VerboseCredentialToBeCleared'] -f $Name) - - $inDesiredState = $false - } - - if ($PSBoundParameters.ContainsKey('restartSchedule')) - { - # Normalize the restartSchedule array values. - $restartScheduleDesired = [String[]]@( - $restartSchedule.Where( - { - $_ -ne '' - } - ).ForEach( - { - [TimeSpan]::Parse($_).ToString('hh\:mm\:ss') - } - ) | - Select-Object -Unique - ) - - $restartScheduleCurrent = [String[]]@( - @($appPool.recycling.periodicRestart.schedule.Collection).ForEach('value') - ) - - if ( - Compare-Object -ReferenceObject $restartScheduleDesired ` - -DifferenceObject $restartScheduleCurrent - ) - { - Write-Verbose -Message ( - $LocalizedData['VerbosePropertyNotInDesiredState'] -f 'restartSchedule', $Name - ) - - $inDesiredState = $false - } - } - } - - if ($inDesiredState -eq $true) - { - Write-Verbose -Message ($LocalizedData['VerboseResourceInDesiredState']) - } - else - { - Write-Verbose -Message ($LocalizedData['VerboseResourceNotInDesiredState']) - } - - return $inDesiredState -} - -#region Helper Functions - -function Get-Property -{ - param - ( - [object] $Object, - [string] $PropertyName) - - $parts = $PropertyName.Split('.') - $firstPart = $parts[0] - - $value = $Object.$firstPart - if ($parts.Count -gt 1) - { - $newParts = @() - 1..($parts.Count -1) | ForEach-Object { - $newParts += $parts[$_] - } - - $newName = ($newParts -join '.') - return Get-Property -Object $value -PropertyName $newName - } - else - { - return $value - } -} - -<# - .SYNOPSIS - Runs appcmd.exe - if there's an error then the application will terminate - - .PARAMETER ArgumentList - Optional list of string arguments to be passed into appcmd.exe - -#> -function Invoke-AppCmd -{ - [CmdletBinding()] - param - ( - [String[]] $ArgumentList - ) - - <# - This is a local preference for the function which will terminate - the program if there's an error invoking appcmd.exe - #> - $ErrorActionPreference = 'Stop' - - $appcmdFilePath = "$env:SystemRoot\System32\inetsrv\appcmd.exe" - - $appcmdResult = $(& $appcmdFilePath $ArgumentList) - Write-Verbose -Message $($appcmdResult).ToString() - - if ($LASTEXITCODE -ne 0) - { - $errorMessage = $LocalizedData['ErrorAppCmdNonZeroExitCode'] -f $LASTEXITCODE - - New-TerminatingError -ErrorId 'ErrorAppCmdNonZeroExitCode' ` - -ErrorMessage $errorMessage ` - -ErrorCategory 'InvalidResult' - } -} - -#endregion Helper Functions - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebAppPool/MSFT_xWebAppPool.schema.mof b/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebAppPool/MSFT_xWebAppPool.schema.mof deleted file mode 100644 index 984ce32e..00000000 --- a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebAppPool/MSFT_xWebAppPool.schema.mof +++ /dev/null @@ -1,55 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xWebAppPool")] -class MSFT_xWebAppPool : OMI_BaseResource -{ - [Key, Description("Indicates the application pool name. The value must contain between 1 and 64 characters.")] String Name; - [Write, Description("Indicates if the application pool exists. Set this property to Absent to ensure that the application pool does not exist. Setting it to Present (the default value) ensures that the application pool exists."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, Description("Indicates the state of the application pool. The values that are allowed for this property are: Started, Stopped."), ValueMap{"Started","Stopped"}, Values{"Started","Stopped"}] String State; - [Write, Description("When set to true, indicates to the World Wide Web Publishing Service (W3SVC) that the application pool should be automatically started when it is created or when IIS is started.")] Boolean autoStart; - [Write, Description("Indicates the .NET configuration file for the application pool.")] String CLRConfigFile; - [Write, Description("When set to true, enables a 32-bit application to run on a computer that runs a 64-bit version of Windows.")] Boolean enable32BitAppOnWin64; - [Write, Description("When set to true, indicates that delegated settings in Web.config files will processed for applications within this application pool. When set to false, all settings in Web.config files will be ignored for this application pool.")] Boolean enableConfigurationOverride; - [Write, Description("Indicates the request-processing mode that is used to process requests for managed content. The values that are allowed for this property are: Integrated, Classic."), ValueMap{"Integrated","Classic"},Values{"Integrated","Classic"}] String managedPipelineMode; - [Write, Description("Indicates the managed loader to use for pre-loading the application pool.")] String managedRuntimeLoader; - [Write, Description("Indicates the CLR version to be used by the application pool. The values that are allowed for this property are: v4.0, v2.0, and ''."), ValueMap{"v4.0","v2.0",""},Values{"v4.0","v2.0",""}] String managedRuntimeVersion; - [Write, Description("When set to true, the Windows Process Activation Service (WAS) creates and passes a token for the built-in IUSR anonymous user account to the Anonymous authentication module. The Anonymous authentication module uses the token to impersonate the built-in account. When this property is set to false, the token will not be passed.")] Boolean passAnonymousToken; - [Write, Description("Indicates the startup type for the application pool. The values that are allowed for this property are: OnDemand, AlwaysRunning."), ValueMap{"OnDemand","AlwaysRunning"},Values{"OnDemand","AlwaysRunning"}] String startMode; - [Write, Description("Indicates the maximum number of requests that HTTP.sys will queue for the application pool. The value must be a valid integer between 10 and 65535.")] UInt32 queueLength; - [Write, Description("Configures the action that IIS takes when a worker process exceeds its configured CPU limit. The values that are allowed for this property are: NoAction, KillW3wp, Throttle, and ThrottleUnderLoad."), ValueMap{"NoAction","KillW3wp","Throttle","ThrottleUnderLoad"},Values{"NoAction","KillW3wp","Throttle","ThrottleUnderLoad"}] String cpuAction; - [Write, Description("Configures the maximum percentage of CPU time (in 1/1000ths of one percent) that the worker processes in the application pool are allowed to consume over a period of time as indicated by the cpuResetInterval property. The value must be a valid integer between 0 and 100000.")] UInt32 cpuLimit; - [Write, Description("Indicates the reset period (in minutes) for CPU monitoring and throttling limits on the application pool. The value must be a string representation of a TimeSpan value. The valid range (in minutes) is 0 to 1440. Setting the value of this property to 0 disables CPU monitoring.")] String cpuResetInterval; - [Write, Description("Indicates whether a particular worker process assigned to the application pool should also be assigned to a given CPU.")] Boolean cpuSmpAffinitized; - [Write, Description("Indicates the hexadecimal processor mask for multi-processor computers, which indicates to which CPU the worker processes in the application pool should be bound. Before this property takes effect, the cpuSmpAffinitized property must be set to true for the application pool. The value must be a valid integer between 0 and 4294967295.")] UInt32 cpuSmpProcessorAffinityMask; - [Write, Description("Indicates the high-order DWORD hexadecimal processor mask for 64-bit multi-processor computers, which indicates to which CPU the worker processes in the application pool should be bound. Before this property takes effect, the cpuSmpAffinitized property must be set to true for the application pool. The value must be a valid integer between 0 and 4294967295.")] UInt32 cpuSmpProcessorAffinityMask2; - [Write, Description("Indicates the account identity under which the application pool runs. The values that are allowed for this property are: ApplicationPoolIdentity, LocalService, LocalSystem, NetworkService, and SpecificUser."), ValueMap{"ApplicationPoolIdentity","LocalService","LocalSystem","NetworkService","SpecificUser"}, Values{"ApplicationPoolIdentity","LocalService","LocalSystem","NetworkService","SpecificUser"}] String identityType; - [Write, Description("Indicates the custom account crededentials. This property is only valid when the identityType property is set to SpecificUser."), EmbeddedInstance("MSFT_Credential")] String Credential; - [Write, Description("Indicates the amount of time (in minutes) a worker process will remain idle before it shuts down. The value must be a string representation of a TimeSpan value and must be less than the restartTimeLimit property value. The valid range (in minutes) is 0 to 43200.")] String idleTimeout; - [Write, Description("Indicates the action to perform when the idle timeout duration has been reached. The values that are allowed for this property are: Terminate, Suspend."), ValueMap{"Terminate","Suspend"}, Values{"Terminate","Suspend"}] String idleTimeoutAction; - [Write, Description("Indicates whether IIS loads the user profile for the application pool identity.")] Boolean loadUserProfile; - [Write, Description("Indicates that IIS should generate an event log entry for each occurrence of the specified process model events.")] String logEventOnProcessModel; - [Write, Description("Indicates the logon type for the process identity. The values that are allowed for this property are: LogonBatch, LogonService."), ValueMap{"LogonBatch","LogonService"},Values{"LogonBatch","LogonService"}] String logonType; - [Write, Description("Indicates whether the IIS_IUSRS group Security Identifier (SID) is added to the worker process token.")] Boolean manualGroupMembership; - [Write, Description("Indicates the maximum number of worker processes that would be used for the application pool. The value must be a valid integer between 0 and 2147483647.")] UInt32 maxProcesses; - [Write, Description("Indicates whether pinging (health monitoring) is enabled for the worker process(es) serving this application pool.")] Boolean pingingEnabled; - [Write, Description("Indicates the period of time (in seconds) between health monitoring pings sent to the worker process(es) serving this application pool. The value must be a string representation of a TimeSpan value. The valid range (in seconds) is 1 to 4294967.")] String pingInterval; - [Write, Description("Indicates the maximum time (in seconds) that a worker process is given to respond to a health monitoring ping. The value must be a string representation of a TimeSpan value. The valid range (in seconds) is 1 to 4294967.")] String pingResponseTime; - [Write, Description("Indicates the environment to be set based on the user profile for the new process.")] Boolean setProfileEnvironment; - [Write, Description("Indicates the period of time (in seconds) a worker process is given to finish processing requests and shut down. The value must be a string representation of a TimeSpan value. The valid range (in seconds) is 1 to 4294967.")] String shutdownTimeLimit; - [Write, Description("Indicates the period of time (in seconds) a worker process is given to start up and initialize. The value must be a string representation of a TimeSpan value. The valid range (in seconds) is 1 to 4294967.")] String startupTimeLimit; - [Write, Description("Indicates an executable to run when a worker process is orphaned.")] String orphanActionExe; - [Write, Description("Indicates parameters for the executable that is specified in the orphanActionExe property.")] String orphanActionParams; - [Write, Description("Indicates whether to assign a worker process to an orphan state instead of terminating it when the application pool fails. If true, an unresponsive worker process will be orphaned instead of terminated.")] Boolean orphanWorkerProcess; - [Write, Description("Indicates the response behavior of a service when it is unavailable. The values that are allowed for this property are: HttpLevel, TcpLevel. If set to HttpLevel and the application pool is stopped, HTTP.sys will return HTTP 503 error. If set to TcpLevel, HTTP.sys will reset the connection."), ValueMap{"HttpLevel","TcpLevel"},Values{"HttpLevel","TcpLevel"}] String loadBalancerCapabilities; - [Write, Description("Indicates whether rapid-fail protection is enabled. If true, the application pool is shut down if there are a specified number of worker process crashes within a specified time period.")] Boolean rapidFailProtection; - [Write, Description("Indicates the time interval (in minutes) during which the specified number of worker process crashes must occur before the application pool is shut down by rapid-fail protection. The value must be a string representation of a TimeSpan value. The valid range (in minutes) is 1 to 144000.")] String rapidFailProtectionInterval; - [Write, Description("Indicates the maximum number of worker process crashes permitted before the application pool is shut down by rapid-fail protection. The value must be a valid integer between 0 and 2147483647.")] UInt32 rapidFailProtectionMaxCrashes; - [Write, Description("Indicates an executable to run when the application pool is shut down by rapid-fail protection.")] String autoShutdownExe; - [Write, Description("Indicates parameters for the executable that is specified in the autoShutdownExe property.")] String autoShutdownParams; - [Write, Description("Indicates whether the W3SVC service should start another worker process to replace the existing worker process while that process is shutting down. If true, the application pool recycle will happen such that the existing worker process exits before another worker process is created.")] Boolean disallowOverlappingRotation; - [Write, Description("Indicates whether the W3SVC service should rotate worker processes in the application pool when the configuration has changed. If true, the application pool will not recycle when its configuration is changed.")] Boolean disallowRotationOnConfigChange; - [Write, Description("Indicates that IIS should generate an event log entry for each occurrence of the specified recycling events.")] String logEventOnRecycle; - [Write, Description("Indicates the maximum amount of virtual memory (in KB) a worker process can consume before causing the application pool to recycle. The value must be a valid integer between 0 and 4294967295. A value of 0 means there is no limit.")] UInt32 restartMemoryLimit; - [Write, Description("Indicates the maximum amount of private memory (in KB) a worker process can consume before causing the application pool to recycle. The value must be a valid integer between 0 and 4294967295. A value of 0 means there is no limit.")] UInt32 restartPrivateMemoryLimit; - [Write, Description("Indicates the maximum number of requests the application pool can process before it is recycled. The value must be a valid integer between 0 and 4294967295. A value of 0 means the application pool can process an unlimited number of requests.")] UInt32 restartRequestsLimit; - [Write, Description("Indicates the period of time (in minutes) after which the application pool will recycle. The value must be a string representation of a TimeSpan value. The valid range (in minutes) is 0 to 432000. A value of 0 means the application pool does not recycle on a regular interval.")] String restartTimeLimit; - [Write, Description("Indicates a set of specific local times, in 24 hour format, when the application pool is recycled. The value must be an array of string representations of TimeSpan values. TimeSpan values must be between 00:00:00 and 23:59:59 seconds inclusive, with a granularity of 60 seconds. Setting the value of this property to '' disables the schedule.")] String restartSchedule[]; -}; diff --git a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebAppPoolDefaults/MSFT_xWebAppPoolDefaults.psm1 b/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebAppPoolDefaults/MSFT_xWebAppPoolDefaults.psm1 deleted file mode 100644 index 3328e89d..00000000 --- a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebAppPoolDefaults/MSFT_xWebAppPoolDefaults.psm1 +++ /dev/null @@ -1,215 +0,0 @@ -# Load the Helper Module -Import-Module -Name "$PSScriptRoot\..\Helper.psm1" - -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData -StringData @' - NoWebAdministrationModule = Please ensure that WebAdministration module is installed. - SettingValue = Changing default value '{0}' to '{1}' - ValueOk = Default value '{0}' is already '{1}' - VerboseGetTargetResource = Get-TargetResource has been run. -'@ -} - -function Get-TargetResource -{ - <# - .SYNOPSIS - This will return a hashtable of results - #> - - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory)] - [ValidateSet('Machine')] - [String] $ApplyTo - ) - - Assert-Module - - Write-Verbose -Message $LocalizedData.VerboseGetTargetResource - - return @{ - ManagedRuntimeVersion = (Get-Value -Path '' -Name 'managedRuntimeVersion') - IdentityType = ( Get-Value -Path 'processModel' -Name 'identityType') - } -} - - -function Set-TargetResource -{ - <# - .SYNOPSIS - This will set the desired state - #> - - [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - param - ( - [ValidateSet('Machine')] - [Parameter(Mandatory = $true)] - [String] $ApplyTo, - - [ValidateSet('','v2.0','v4.0')] - [String] $ManagedRuntimeVersion, - - [ValidateSet('ApplicationPoolIdentity','LocalService','LocalSystem','NetworkService')] - [String] $IdentityType - ) - - Assert-Module - - Set-Value -Path '' -Name 'managedRuntimeVersion' -NewValue $ManagedRuntimeVersion - Set-Value -Path 'processModel' -Name 'identityType' -NewValue $IdentityType -} - -function Test-TargetResource -{ - <# - .SYNOPSIS - This tests the desired state. If the state is not correct it will return $false. - If the state is correct it will return $true - #> - - [CmdletBinding()] - [OutputType([System.Boolean])] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - param - ( - [ValidateSet('Machine')] - [Parameter(Mandatory = $true)] - [String] $ApplyTo, - - [ValidateSet('','v2.0','v4.0')] - [String] $ManagedRuntimeVersion, - - [ValidateSet('ApplicationPoolIdentity','LocalService','LocalSystem','NetworkService')] - [String] $IdentityType - ) - - Assert-Module - - if (-not((Confirm-Value -Path '' ` - -Name 'managedRuntimeVersion' ` - -NewValue $ManagedRuntimeVersion))) - { - return $false - } - - if (-not((Confirm-Value -Path 'processModel' ` - -Name 'identityType' ` - -NewValue $IdentityType))) - { - return $false - } - - return $true -} - -#region Helper Functions - -function Confirm-Value -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [String] $Path, - - [String] $Name, - - [String] $NewValue - ) - - if (-not($NewValue)) - { - # if no new value was specified, we assume this value is okay. - return $true - } - - $existingValue = Get-Value -Path $Path -Name $Name - if ($existingValue -ne $NewValue) - { - return $false - } - else - { - $relPath = $Path + '/' + $Name - Write-Verbose($LocalizedData.ValueOk -f $relPath,$NewValue); - return $true - } -} - -function Set-Value -{ - [CmdletBinding()] - param - ( - [String] $Path, - - [String] $Name, - - [String] $NewValue - ) - - # if the variable doesn't exist, the user doesn't want to change this value - if (-not($NewValue)) - { - return - } - - $existingValue = Get-Value -Path $Path -Name $Name - if ($existingValue -ne $NewValue) - { - if ($Path -ne '') - { - $Path = '/' + $Path - } - - Set-WebConfigurationProperty ` - -PSPath 'MACHINE/WEBROOT/APPHOST' ` - -Filter "system.applicationHost/applicationPools/applicationPoolDefaults$Path" ` - -Name $Name ` - -Value "$NewValue" - - $relPath = $Path + '/' + $Name - Write-Verbose($LocalizedData.SettingValue -f $relPath,$NewValue); - - } - -} - -function Get-Value -{ - - [CmdletBinding()] - param - ( - [String] $Path, - - [String] $Name - ) - - { - if ($Path -ne '') - { - $Path = '/' + $Path - } - - return Get-WebConfigurationProperty ` - -PSPath 'MACHINE/WEBROOT/APPHOST' ` - -Filter "system.applicationHost/applicationPools/applicationPoolDefaults$Path" ` - -Name $Name - - } - -} - -#endregion - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebAppPoolDefaults/MSFT_xWebAppPoolDefaults.schema.mof b/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebAppPoolDefaults/MSFT_xWebAppPoolDefaults.schema.mof deleted file mode 100644 index 99b2f22c..00000000 --- a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebAppPoolDefaults/MSFT_xWebAppPoolDefaults.schema.mof +++ /dev/null @@ -1,8 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xWebAppPoolDefaults")] -class MSFT_xWebAppPoolDefaults : OMI_BaseResource -{ - [Key, Description("Dummy value because we need a key, always 'Machine'"), ValueMap{"Machine"}, Values{"Machine"}] string ApplyTo; - [write, Description("applicationPools/applicationPoolDefaults/managedRuntimeVersion"), ValueMap{"","v2.0","v4.0"}, Values{"","v2.0","v4.0"}] string ManagedRuntimeVersion; - [write, Description("applicationPools/applicationPoolDefaults/processModel/identityType"), ValueMap{"ApplicationPoolIdentity","LocalService","LocalSystem","NetworkService"}, Values{"ApplicationPoolIdentity","LocalService","LocalSystem","NetworkService"}] string IdentityType; -}; diff --git a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebApplication/MSFT_xWebApplication.psm1 b/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebApplication/MSFT_xWebApplication.psm1 deleted file mode 100644 index 0b18377f..00000000 --- a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebApplication/MSFT_xWebApplication.psm1 +++ /dev/null @@ -1,834 +0,0 @@ -# Load the Helper Module -Import-Module -Name "$PSScriptRoot\..\Helper.psm1" - -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData -StringData @' - ErrorWebApplicationTestAutoStartProviderFailure = Desired AutoStartProvider is not valid due to a conflicting Global Property. Ensure that the serviceAutoStartProvider is a unique key. - VerboseGetTargetResource = Get-TargetResource has been run. - VerboseSetTargetAbsent = Removing existing Web Application "{0}". - VerboseSetTargetPresent = Creating new Web application "{0}". - VerboseSetTargetPhysicalPath = Updating physical path for Web application "{0}". - VerboseSetTargetWebAppPool = Updating application pool for Web application "{0}". - VerboseSetTargetSslFlags = Updating SslFlags for Web application "{0}". - VerboseSetTargetAuthenticationInfo = Updating AuthenticationInfo for Web application "{0}". - VerboseSetTargetPreload = Updating Preload for Web application "{0}". - VerboseSetTargetAutostart = Updating AutoStart for Web application "{0}". - VerboseSetTargetIISAutoStartProviders = Updating AutoStartProviders for IIS. - VerboseSetTargetWebApplicationAutoStartProviders = Updating AutoStartProviders for Web application "{0}". - VerboseSetTargetEnabledProtocols = Updating EnabledProtocols for Web application "{0}". - VerboseTestTargetFalseAbsent = Web application "{0}" is absent and should not absent. - VerboseTestTargetFalsePresent = Web application $Name should be absent and is not absent. - VerboseTestTargetFalsePhysicalPath = Physical path for web application "{0}" does not match desired state. - VerboseTestTargetFalseWebAppPool = Web application pool for web application "{0}" does not match desired state. - VerboseTestTargetFalseSslFlags = SslFlags for web application "{0}" are not in the desired state. - VerboseTestTargetFalseAuthenticationInfo = AuthenticationInfo for web application "{0}" is not in the desired state. - VerboseTestTargetFalsePreload = Preload for web application "{0}" is not in the desired state. - VerboseTestTargetFalseAutostart = Autostart for web application "{0}" is not in the desired state. - VerboseTestTargetFalseAutoStartProviders = AutoStartProviders for web application "{0}" are not in the desired state. - VerboseTestTargetFalseIISAutoStartProviders = AutoStartProviders for IIS are not in the desired state. - VerboseTestTargetFalseWebApplicationAutoStartProviders = AutoStartProviders for web application "{0}" are not in the desired state. - VerboseTestTargetFalseEnabledProtocols = EnabledProtocols for web application "{0}" are not in the desired state. -'@ -} - -<# -.SYNOPSIS - This will return a hashtable of results -#> -function Get-TargetResource -{ - - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [String] $Website, - - [Parameter(Mandatory = $true)] - [String] $Name, - - [Parameter(Mandatory = $true)] - [String] $WebAppPool, - - [Parameter(Mandatory = $true)] - [String] $PhysicalPath - ) - - Assert-Module - - $webApplication = Get-WebApplication -Site $Website -Name $Name - $cimAuthentication = Get-AuthenticationInfo -Site $Website -Name $Name - $currentSslFlags = (Get-SslFlags -Location "${Website}/${Name}") - - $Ensure = 'Absent' - - if ($webApplication.Count -eq 1) - { - $Ensure = 'Present' - } - - Write-Verbose -Message $LocalizedData.VerboseGetTargetResource - - $returnValue = @{ - Website = $Website - Name = $Name - WebAppPool = $webApplication.applicationPool - PhysicalPath = $webApplication.PhysicalPath - AuthenticationInfo = $cimAuthentication - SslFlags = [Array]$currentSslFlags - PreloadEnabled = $webApplication.preloadEnabled - ServiceAutoStartProvider = $webApplication.serviceAutoStartProvider - ServiceAutoStartEnabled = $webApplication.serviceAutoStartEnabled - EnabledProtocols = [Array]$webApplication.EnabledProtocols - Ensure = $Ensure - } - - return $returnValue - -} - - <# - .SYNOPSIS - This will set the desired state - #> -function Set-TargetResource -{ - - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [String] $Website, - - [Parameter(Mandatory = $true)] - [String] $Name, - - [Parameter(Mandatory = $true)] - [String] $WebAppPool, - - [Parameter(Mandatory = $true)] - [String] $PhysicalPath, - - [ValidateSet('Present','Absent')] - [String] $Ensure = 'Present', - - [AllowEmptyString()] - [ValidateSet('','Ssl','SslNegotiateCert','SslRequireCert','Ssl128')] - [String[]]$SslFlags = '', - - [Microsoft.Management.Infrastructure.CimInstance] - $AuthenticationInfo, - - [Boolean] - $PreloadEnabled, - - [Boolean] - $ServiceAutoStartEnabled, - - [String] - $ServiceAutoStartProvider, - - [String] - $ApplicationType, - - [ValidateSet('http','https','net.tcp','net.msmq','net.pipe')] - [String[]] $EnabledProtocols - ) - - Assert-Module - - if ($Ensure -eq 'Present') - { - $webApplication = Get-WebApplication -Site $Website -Name $Name - - if ($AuthenticationInfo -eq $null) - { - $AuthenticationInfo = Get-DefaultAuthenticationInfo - } - - if ($webApplication.count -eq 0) - { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetPresent -f $Name) - New-WebApplication -Site $Website -Name $Name ` - -PhysicalPath $PhysicalPath ` - -ApplicationPool $WebAppPool - $webApplication = Get-WebApplication -Site $Website -Name $Name - } - - # Update Physical Path if required - if (($PSBoundParameters.ContainsKey('PhysicalPath') -and ` - $webApplication.physicalPath -ne $PhysicalPath)) - { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetPhysicalPath -f $Name) - #Note: read this before touching the next line of code: - # https://github.com/PowerShell/xWebAdministration/issues/222 - Set-WebConfigurationProperty ` - -Filter "$($webApplication.ItemXPath)/virtualDirectory[@path='/']" ` - -Name physicalPath ` - -Value $PhysicalPath - } - - # Update AppPool if required - if ($PSBoundParameters.ContainsKey('WebAppPool') -and ` - ($webApplication.applicationPool -ne $WebAppPool)) - { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetWebAppPool -f $Name) - #Note: read this before touching the next line of code: - # https://github.com/PowerShell/xWebAdministration/issues/222 - Set-WebConfigurationProperty ` - -Filter $webApplication.ItemXPath ` - -Name applicationPool ` - -Value $WebAppPool - } - - # Update SslFlags if required - if ($PSBoundParameters.ContainsKey('SslFlags') -and ` - (-not (Test-SslFlags -Location "${Website}/${Name}" -SslFlags $SslFlags))) - { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetSslFlags -f $Name) - $params = @{ - PSPath = 'MACHINE/WEBROOT/APPHOST' - Location = "${Website}/${Name}" - Filter = 'system.webServer/security/access' - Name = 'sslFlags' - Value = ($sslflags -join ',') - } - Set-WebConfigurationProperty @params - } - - # Set Authentication; if not defined then pass in DefaultAuthenticationInfo - if ($PSBoundParameters.ContainsKey('AuthenticationInfo') -and ` - (-not (Test-AuthenticationInfo -Site $Website ` - -Name $Name ` - -AuthenticationInfo $AuthenticationInfo))) - { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetAuthenticationInfo -f $Name) - Set-AuthenticationInfo -Site $Website ` - -Name $Name ` - -AuthenticationInfo $AuthenticationInfo ` - -ErrorAction Stop ` - -Verbose - } - - # Update Preload if required - if ($PSBoundParameters.ContainsKey('preloadEnabled') -and ` - $webApplication.preloadEnabled -ne $PreloadEnabled) - { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetPreload -f $Name) - Set-ItemProperty -Path "IIS:\Sites\$Website\$Name" ` - -Name preloadEnabled ` - -Value $preloadEnabled ` - -ErrorAction Stop - } - - # Update AutoStart if required - if ($PSBoundParameters.ContainsKey('ServiceAutoStartEnabled') -and ` - $webApplication.serviceAutoStartEnabled -ne $ServiceAutoStartEnabled) - { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetAutostart -f $Name) - Set-ItemProperty -Path "IIS:\Sites\$Website\$Name" ` - -Name serviceAutoStartEnabled ` - -Value $serviceAutoStartEnabled ` - -ErrorAction Stop - } - - # Update AutoStartProviders if required - if ($PSBoundParameters.ContainsKey('ServiceAutoStartProvider') -and ` - $webApplication.serviceAutoStartProvider -ne $ServiceAutoStartProvider) - { - if (-not (Confirm-UniqueServiceAutoStartProviders ` - -ServiceAutoStartProvider $ServiceAutoStartProvider ` - -ApplicationType $ApplicationType)) - { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetIISAutoStartProviders) - Add-WebConfiguration ` - -filter /system.applicationHost/serviceAutoStartProviders ` - -Value @{name=$ServiceAutoStartProvider; type=$ApplicationType} ` - -ErrorAction Stop - } - Write-Verbose -Message ` - ($LocalizedData.VerboseSetTargetWebApplicationAutoStartProviders -f $Name) - Set-ItemProperty -Path "IIS:\Sites\$Website\$Name" ` - -Name serviceAutoStartProvider ` - -Value $ServiceAutoStartProvider ` - -ErrorAction Stop - } - - # Update EnabledProtocols if required - if ($PSBoundParameters.ContainsKey('EnabledProtocols') -and ` - (-not(Confirm-UniqueEnabledProtocols ` - -ExistingProtocols $webApplication.EnabledProtocols ` - -ProposedProtocols $EnabledProtocols ))) - { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetEnabledProtocols -f $Name) - # Make input bindings which are an array, into a string - $stringafiedEnabledProtocols = $EnabledProtocols -join ' ' - Set-ItemProperty -Path "IIS:\Sites\$Website\$Name" ` - -Name EnabledProtocols ` - -Value $stringafiedEnabledProtocols ` - -ErrorAction Stop - } - } - - if ($Ensure -eq 'Absent') - { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetAbsent -f $Name) - Remove-WebApplication -Site $Website -Name $Name - } - -} - -<# -.SYNOPSIS - This tests the desired state. If the state is not correct it will return $false. - If the state is correct it will return $true -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [String] $Website, - - [Parameter(Mandatory = $true)] - [String] $Name, - - [Parameter(Mandatory = $true)] - [String] $WebAppPool, - - [Parameter(Mandatory = $true)] - [String] $PhysicalPath, - - [ValidateSet('Present','Absent')] - [String] $Ensure = 'Present', - - [AllowEmptyString()] - [ValidateSet('','Ssl','SslNegotiateCert','SslRequireCert','Ssl128')] - [String[]]$SslFlags = '', - - [Microsoft.Management.Infrastructure.CimInstance] - $AuthenticationInfo, - - [Boolean] - $preloadEnabled, - - [Boolean] - $serviceAutoStartEnabled, - - [String] - $serviceAutoStartProvider, - - [String] - $ApplicationType, - - [ValidateSet('http','https','net.tcp','net.msmq','net.pipe')] - [String[]] $EnabledProtocols - ) - - Assert-Module - - $webApplication = Get-WebApplication -Site $Website -Name $Name - - if ($AuthenticationInfo -eq $null) - { - $AuthenticationInfo = Get-DefaultAuthenticationInfo - } - - if ($webApplication.count -eq 0 -and $Ensure -eq 'Present') - { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseAbsent -f $Name) - return $false - } - - if ($webApplication.count -eq 1 -and $Ensure -eq 'Absent') - { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalsePresent -f $Name) - return $false - } - - if ($webApplication.count -eq 1 -and $Ensure -eq 'Present') - { - #Check Physical Path - if ($webApplication.physicalPath -ne $PhysicalPath) - { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalsePhysicalPath -f $Name) - return $false - } - - #Check AppPool - if ($webApplication.applicationPool -ne $WebAppPool) - { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseWebAppPool -f $Name) - return $false - } - - #Check SslFlags - if ($PSBoundParameters.ContainsKey('SslFlags') -and ` - (-not (Test-SslFlags -Location "${Website}/${Name}" -SslFlags $SslFlags))) - { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseSslFlags -f $Name) - return $false - } - - #Check AuthenticationInfo - if ($PSBoundParameters.ContainsKey('AuthenticationInfo') -and ` - (-not (Test-AuthenticationInfo -Site $Website ` - -Name $Name ` - -AuthenticationInfo $AuthenticationInfo))) - { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseAuthenticationInfo ` - -f $Name) - return $false - } - - #Check Preload - if ($PSBoundParameters.ContainsKey('preloadEnabled') -and ` - $webApplication.preloadEnabled -ne $PreloadEnabled) - { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalsePreload -f $Name) - return $false - } - - #Check AutoStartEnabled - if($PSBoundParameters.ContainsKey('ServiceAutoStartEnabled') -and ` - $webApplication.serviceAutoStartEnabled -ne $ServiceAutoStartEnabled) - { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseAutostart -f $Name) - return $false - } - - #Check AutoStartProviders - if ($PSBoundParameters.ContainsKey('ServiceAutoStartProvider') -and ` - $webApplication.serviceAutoStartProvider -ne $ServiceAutoStartProvider) - { - if (-not (Confirm-UniqueServiceAutoStartProviders ` - -serviceAutoStartProvider $ServiceAutoStartProvider ` - -ApplicationType $ApplicationType)) - { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseIISAutoStartProviders) - return $false - } - Write-Verbose -Message ` - ($LocalizedData.VerboseTestTargetFalseWebApplicationAutoStartProviders -f $Name) - return $false - } - - # Update EnabledProtocols if required - if ($PSBoundParameters.ContainsKey('EnabledProtocols') -and ` - (-not(Confirm-UniqueEnabledProtocols ` - -ExistingProtocols $webApplication.EnabledProtocols ` - -ProposedProtocols $EnabledProtocols ))) - { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseEnabledProtocols ` - -f $Name) - return $false - } - - } - - return $true - -} - -<# -.SYNOPSIS - Helper function used to validate that the EnabledProtocols are unique. - Returns $false if EnabledProtocols are not unique and $true if they are -.PARAMETER ExistingProtocols - Specifies existing SMTP bindings -.PARAMETER ProposedProtocols - Specifies desired SMTP bindings. -.NOTES - ExistingProtocols is a String whereas ProposedProtocols is an array of Strings - so we need to do some extra work in comparing them -#> -function Confirm-UniqueEnabledProtocols -{ - [CmdletBinding()] - [OutputType([Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [AllowEmptyString()] - [String] $ExistingProtocols, - - [Parameter(Mandatory = $true)] - [String[]] $ProposedProtocols - ) - - $inputToCheck = @() - foreach ($proposedProtocol in $ProposedProtocols) - { - $inputToCheck += $proposedProtocol - } - - $existingProtocolsToCheck = $existingProtocols -split ',' - - $existingToCheck = @() - foreach ($existingProtocol in $existingProtocolsToCheck) - { - $existingToCheck += $existingProtocol.Trim() - } - - $sortedExistingProtocols = $existingToCheck | Sort-Object -Unique - $sortedInputProtocols = $inputToCheck | Sort-Object -Unique - - - if (Compare-Object -ReferenceObject $sortedExistingProtocols ` - -DifferenceObject $sortedInputProtocols ` - -PassThru) - { - return $false - } - - return $true -} - -#region Helper Functions - -<# -.SYNOPSIS - Helper function used to validate that the AutoStartProviders is unique to other - websites. Returns False if the AutoStartProviders exist. -.PARAMETER serviceAutoStartProvider - Specifies the name of the AutoStartProviders. -.PARAMETER ExcludeStopped - Specifies the name of the Application Type for the AutoStartProvider. -.NOTES - This tests for the existance of a AutoStartProviders which is globally assigned. - As AutoStartProviders need to be uniquely named it will check for this and error out if - attempting to add a duplicatly named AutoStartProvider. - Name is passed in to bubble to any error messages during the test. -#> -function Confirm-UniqueServiceAutoStartProviders -{ - [CmdletBinding()] - [OutputType([Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [String] $ServiceAutoStartProvider, - - [Parameter(Mandatory = $true)] - [String] $ApplicationType - ) - - $WebSiteAutoStartProviders = (Get-WebConfiguration ` - -filter /system.applicationHost/serviceAutoStartProviders).Collection - - $ExistingObject = $WebSiteAutoStartProviders | ` - Where-Object -Property Name -eq -Value $serviceAutoStartProvider | ` - Select-Object Name,Type - - $ProposedObject = @(New-Object -TypeName PSObject -Property @{ - name = $ServiceAutoStartProvider - type = $ApplicationType - }) - - if(-not $ExistingObject) - { - return $false - } - - if(-not (Compare-Object -ReferenceObject $ExistingObject ` - -DifferenceObject $ProposedObject ` - -Property name)) - { - if(Compare-Object -ReferenceObject $ExistingObject ` - -DifferenceObject $ProposedObject ` - -Property type) - { - $ErrorMessage = $LocalizedData.ErrorWebApplicationTestAutoStartProviderFailure - New-TerminatingError ` - -ErrorId 'ErrorWebApplicationTestAutoStartProviderFailure' ` - -ErrorMessage $ErrorMessage ` - -ErrorCategory 'InvalidResult' - } - } - - return $true - -} - -<# -.SYNOPSIS - Helper function used to validate that the authenticationProperties for an Application. -.PARAMETER Site - Specifies the name of the Website. -.PARAMETER Name - Specifies the name of the Application. -#> -function Get-AuthenticationInfo -{ - [CmdletBinding()] - [OutputType([Microsoft.Management.Infrastructure.CimInstance])] - param - ( - [Parameter(Mandatory = $true)] - [String] $Site, - - [Parameter(Mandatory = $true)] - [String] $Name - ) - - $authenticationProperties = @{} - foreach ($type in @('Anonymous', 'Basic', 'Digest', 'Windows')) - { - $authenticationProperties[$type] = [String](Test-AuthenticationEnabled -Site $Site ` - -Name $Name ` - -Type $type) - } - - return New-CimInstance ` - -ClassName MSFT_xWebApplicationAuthenticationInformation ` - -ClientOnly -Property $authenticationProperties - -} - -<# -.SYNOPSIS - Helper function used to build a default CimInstance for AuthenticationInformation -#> -function Get-DefaultAuthenticationInfo -{ - New-CimInstance -ClassName MSFT_xWebApplicationAuthenticationInformation ` - -ClientOnly ` - -Property @{Anonymous=$false;Basic=$false;Digest=$false;Windows=$false} -} - -<# -.SYNOPSIS - Helper function used to return the SSLFlags on an Application. -.PARAMETER Location - Specifies the path in the IIS: PSDrive to the Application -#> -function Get-SslFlags -{ - [CmdletBinding()] - [OutputType([System.String])] - param - ( - [Parameter(Mandatory = $true)] - [String] $Location - ) - - $SslFlags = Get-WebConfiguration ` - -PSPath IIS:\Sites ` - -Location $Location ` - -Filter 'system.webserver/security/access' | ` - ForEach-Object { $_.sslFlags } - - if ($null -eq $SslFlags) - { - [String]::Empty - } - - return $SslFlags -} - -<# -.SYNOPSIS - Helper function used to set authenticationProperties for an Application. -.PARAMETER Site - Specifies the name of the Website. -.PARAMETER Name - Specifies the name of the Application. -.PARAMETER Type - Specifies the type of Authentication, -Limited to the set: ('Anonymous','Basic','Digest','Windows'). -.PARAMETER Enabled - Whether the Authentication is enabled or not. -#> -function Set-Authentication -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [String] $Site, - - [Parameter(Mandatory = $true)] - [String] $Name, - - [Parameter(Mandatory = $true)] - [ValidateSet('Anonymous','Basic','Digest','Windows')] - [String] $Type, - - [Boolean] $Enabled - ) - - Set-WebConfigurationProperty ` - -Filter /system.WebServer/security/authentication/${Type}Authentication ` - -Name enabled ` - -Value $Enabled ` - -Location "${Site}/${Name}" -} - -<# -.SYNOPSIS - Helper function used to validate that the authenticationProperties for an Application. -.PARAMETER Site - Specifies the name of the Website. -.PARAMETER Name - Specifies the name of the Application. -.PARAMETER AuthenticationInfo - A CimInstance of what state the AuthenticationInfo should be. -#> -function Set-AuthenticationInfo -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [String] $Site, - - [Parameter(Mandatory = $true)] - [String] $Name, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [Microsoft.Management.Infrastructure.CimInstance] $AuthenticationInfo - ) - - foreach ($type in @('Anonymous', 'Basic', 'Digest', 'Windows')) - { - $enabled = ($AuthenticationInfo.CimInstanceProperties[$type].Value -eq $true) - Set-Authentication -Site $Site ` - -Name $Name ` - -Type $type ` - -Enabled $enabled - } -} - -<# -.SYNOPSIS - Helper function used to test the authenticationProperties state for an Application. - Will return that value which will either [String]True or [String]False -.PARAMETER Site - Specifies the name of the Website. -.PARAMETER Name - Specifies the name of the Application. -.PARAMETER Type - Specifies the type of Authentication, - limited to the set: ('Anonymous','Basic','Digest','Windows'). -#> - -function Test-AuthenticationEnabled -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [String] $Site, - - [Parameter(Mandatory = $true)] - [String] $Name, - - [Parameter(Mandatory = $true)] - [ValidateSet('Anonymous','Basic','Digest','Windows')] - [String] $Type - ) - - - $prop = Get-WebConfigurationProperty ` - -Filter /system.WebServer/security/authentication/${Type}Authentication ` - -Name enabled ` - -Location "${Site}/${Name}" - - return $prop.Value - -} - -<# -.SYNOPSIS - Helper function used to test the authenticationProperties state for an Application. - Will return that result which will either [boolean]$True or [boolean]$False for use in - Test-TargetResource. - Uses Test-AuthenticationEnabled to determine this. First incorrect result will break - this function out. -.PARAMETER Site - Specifies the name of the Website. -.PARAMETER Name - Specifies the name of the Application. -.PARAMETER AuthenticationInfo - A CimInstance of what state the AuthenticationInfo should be. -#> - -function Test-AuthenticationInfo -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [String] $Site, - - [Parameter(Mandatory = $true)] - [String] $Name, - - [Parameter(Mandatory=$true)] - [ValidateNotNullOrEmpty()] - [Microsoft.Management.Infrastructure.CimInstance] $AuthenticationInfo - ) - - foreach ($type in @('Anonymous', 'Basic', 'Digest', 'Windows')) - { - - $expected = $AuthenticationInfo.CimInstanceProperties[$type].Value - $actual = Test-AuthenticationEnabled -Site $Site ` - -Name $Name ` - -Type $type - if ($expected -ne $actual) - { - return $false - } - } - - return $true - -} - -<# -.SYNOPSIS - Helper function used to test the SSLFlags on an Application. - Will return $true if they match and $false if they do not. -.PARAMETER SslFlags - Specifies the SslFlags to Test -.PARAMETER Location - Specifies the path in the IIS: PSDrive to the Application -#> -function Test-SslFlags -{ - [CmdletBinding()] - [OutputType([Boolean])] - param - ( - [AllowEmptyString()] - [ValidateSet('','Ssl','SslNegotiateCert','SslRequireCert','Ssl128')] - [String[]] $SslFlags = '', - - [Parameter(Mandatory = $true)] - [String] $Location - ) - - $CurrentSslFlags = Get-SslFlags -Location $Location - - if(Compare-Object -ReferenceObject $CurrentSslFlags ` - -DifferenceObject $SslFlags) - { - return $false - } - - return $true -} - -#endregion - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebApplication/MSFT_xWebApplication.schema.mof b/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebApplication/MSFT_xWebApplication.schema.mof deleted file mode 100644 index 3b8da457..00000000 --- a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebApplication/MSFT_xWebApplication.schema.mof +++ /dev/null @@ -1,25 +0,0 @@ -[ClassVersion("1.0.0")] -class MSFT_xWebApplicationAuthenticationInformation -{ - [Write] Boolean Anonymous; - [Write] Boolean Basic; - [Write] Boolean Digest; - [Write] Boolean Windows; -}; - -[ClassVersion("1.0.0.0"), FriendlyName("xWebApplication")] -class MSFT_xWebApplication : OMI_BaseResource -{ - [Key, Description("Name of website with which web application is associated")] String Website; - [Key, Description("Name of web application")] String Name; - [Required, Description("Web application pool for the web application")] String WebAppPool; - [Required, Description("Physical path for the web application directory")] String PhysicalPath; - [Write, Description("Whether web application should be present or absent"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, Description("SSLFlags for the application"), ValueMap{"","Ssl","SslNegotiateCert","SslRequireCert","Ssl128"},Values{"","Ssl","SslNegotiateCert","SslRequireCert","Ssl128"}] String SslFlags[]; - [write, EmbeddedInstance("MSFT_xWebApplicationAuthenticationInformation"), Description("Hashtable containing authentication information (Anonymous, Basic, Digest, Windows)")] String AuthenticationInfo; - [Write, Description ("Allows a Application to automatically start without a request")] Boolean PreloadEnabled; - [Write, Description ("Enables Autostart on an Application.")] Boolean ServiceAutoStartEnabled; - [Write, Description ("Adds a AutostartProvider")] String ServiceAutoStartProvider; - [Write, Description ("Adds a AutostartProvider ApplicationType")] String ApplicationType; - [Write, Description ("Adds EnabledProtocols on an Application"), ValueMap{"http","https","net.tcp","net.msmq","net.pipe"},Values{"http","https","net.tcp","net.msmq","net.pipe"}] String EnabledProtocols[]; -}; diff --git a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebConfigKeyValue/MSFT_xWebConfigKeyValue.psm1 b/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebConfigKeyValue/MSFT_xWebConfigKeyValue.psm1 deleted file mode 100644 index dd8a59ab..00000000 --- a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebConfigKeyValue/MSFT_xWebConfigKeyValue.psm1 +++ /dev/null @@ -1,404 +0,0 @@ - -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData -StringData @' - VerboseGetTargetCheckingTarget = Checking for the existance of key "{0}" in ConfigSection "{1}" located at "{2}" - VerboseGetTargetAttributeCheck = Checking if key "{0}" is an Attribute - VerboseGetTargetKeyNotFound = Key "{0}" has not been found. - VerboseGetTargetKeyFound = Key "{0}" has been found - VerboseSetTargetCheckingKey = Checking for existance of key "{0}" - VerboseSetTargetAddItem = Key "{0}" does not exist, adding key - VerboseSetTargetEditItem = Key "{0}" exists, editing key - VerboseSetTargetRemoveItem = Key "{0}" exists, removing key - VerboseTestTargetCheckingTarget = Checking for the existance of key "{0}" in ConfigSection "{1}" located at "{2}" - VerboseTestTargetKeyNotFound = Key "{0}" has not been found. - VerboseTestTargetKeyWasFound = Key "{0}" has been found. -'@ -} - -<# - .SYNOPSIS - Gets the value of the specified key in the config file -#> -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] $WebsitePath, - - [parameter(Mandatory = $true)] - [ValidateSet('AppSettings')] - [System.String] $ConfigSection, - - [parameter(Mandatory = $true)] - [String] $Key - ) - - Write-Verbose ` - -Message ($LocalizedData.VerboseGetTargetCheckingTarget -f $Key, $ConfigSection, $WebsitePath ) - - $existingValue = Get-ItemValue ` - -Key $Key ` - -IsAttribute $false ` - -WebsitePath $WebsitePath ` - -ConfigSection $ConfigSection - - if ( $null -eq $existingValue ) - { - Write-Verbose ` - -Message ($LocalizedData.VerboseGetTargetAttributeCheck -f $Key ) - - $existingValue = Get-ItemValue ` - -Key $Key ` - -IsAttribute $true ` - -WebsitePath $WebsitePath ` - -ConfigSection $ConfigSection - } - - if ( $existingValue.Length -eq 0 ) - { - Write-Verbose ` - -Message ($LocalizedData.VerboseGetTargetKeyNotFound -f $Key ) - - return @{ - Ensure = 'Absent' - Key = $Key - Value = $existingValue - } - } - - Write-Verbose ` - -Message ($LocalizedData.VerboseGetTargetKeyFound -f $Key ) - - return @{ - Ensure = 'Present' - Key = $Key - Value = $existingValue - } -} - -<# - .SYNOPSIS - Sets the value of the specified key in the config file -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] $WebsitePath, - - [parameter(Mandatory = $true)] - [ValidateSet('AppSettings')] - [System.String] $ConfigSection, - - [parameter(Mandatory = $true)] - [String] $Key, - - [ValidateSet('Present','Absent')] - [System.String] $Ensure = 'Present', - - [String] $Value, - - [System.Boolean] $IsAttribute - ) - - if ($Ensure -eq 'Present') - { - Write-Verbose ` - -Message ($LocalizedData.VerboseSetTargetCheckingKey -f $Key ) - - $existingValue = Get-ItemValue ` - -Key $Key ` - -IsAttribute $IsAttribute ` - -WebsitePath $WebsitePath ` - -ConfigSection $ConfigSection - - if ( (-not $IsAttribute -and ($null -eq $existingValue) ) ` - -or ( $IsAttribute -and ($existingValue.Length -eq 0) ) ) - { - Write-Verbose ` - -Message ($LocalizedData.VerboseSetTargetAddItem -f $Key ) - - Add-Item ` - -Key $Key ` - -Value $Value ` - -IsAttribute $IsAttribute ` - -WebsitePath $WebsitePath ` - -ConfigSection $ConfigSection - } - else - { - $propertyName = 'value' - - if ( $IsAttribute ) - { - $propertyName = $Key - } - - Write-Verbose ` - -Message ($LocalizedData.VerboseSetTargetEditItem -f $Key ) - - Edit-Item ` - -PropertyName $propertyName ` - -OldValue $Key ` - -NewValue $Value ` - -IsAttribute $IsAttribute ` - -WebsitePath $WebsitePath ` - -ConfigSection $ConfigSection - } - } - else - { - Write-Verbose ` - -Message ($LocalizedData.VerboseSetTargetRemoveItem -f $Key ) - - Remove-Item ` - -Key $Key ` - -IsAttribute $IsAttribute ` - -WebsitePath $WebsitePath ` - -ConfigSection $ConfigSection - } -} - -<# - .SYNOPSIS - Tests the value of the specified key in the config file -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] $WebsitePath, - - [parameter(Mandatory = $true)] - [ValidateSet('AppSettings')] - [System.String] $ConfigSection, - - [parameter(Mandatory = $true)] - [String] $Key, - - [String] $Value, - - [ValidateSet('Present','Absent')] - [System.String] $Ensure = 'Present', - - [System.Boolean] $IsAttribute - ) - - if ( -not $PSBoundParameters.ContainsKey('IsAttribute') ) - { - $IsAttribute = $false - } - - Write-Verbose ` - -Message ($LocalizedData.VerboseTestTargetCheckingTarget -f $Key, $ConfigSection, $WebsitePath ) - - $existingValue = Get-ItemValue ` - -Key $Key ` - -IsAttribute $IsAttribute ` - -WebsitePath $WebsitePath ` - -ConfigSection $ConfigSection - - if ( $Ensure -eq 'Present' ) - { - if ( ( $null -eq $existingValue ) -or ( $existingValue -ne $Value ) ` - -or ($existingValue.Length -eq 0) ) - { - Write-Verbose ` - -Message ($LocalizedData.VerboseTestTargetKeyNotFound -f $Key ) - return $false - } - } - else - { - if ( ( $null -ne $existingValue ) -or ( $existingValue.Length -ne 0 ) ) - { - Write-Verbose ` - -Message ($LocalizedData.VerboseTestTargetKeyNotFound -f $Key ) - - return $false - } - } - - Write-Verbose ` - -Message ($LocalizedData.VerboseTestTargetKeyWasFound -f $Key) - - return $true -} - -# region Helper Functions - -function Add-Item -{ - param - ( - [string] $Key, - - [string] $Value, - - [Boolean] $isAttribute, - - [string] $WebsitePath, - - [string] $ConfigSection - ) - - $itemCollection = @{ - Key = $Key; - Value = $Value; - } - - if ( -not $isAttribute ) - { - Add-WebConfigurationProperty ` - -Filter $ConfigSection ` - -Name '.' ` - -Value $itemCollection ` - -PSPath $WebsitePath - } - else - { - Set-WebConfigurationProperty ` - -Filter $ConfigSection ` - -PSPath $WebsitePath ` - -Name $Key ` - -Value $Value ` - -WarningAction Stop - } -} - -function Edit-Item -{ - param - ( - [string] $PropertyName, - - [string] $OldValue, - - [string] $NewValue, - - [Boolean] $IsAttribute, - - [string] $WebsitePath, - - [string] $ConfigSection - ) - - if ( -not $IsAttribute ) - { - $filter = "$ConfigSection/add[@key=`'$OldValue`']" - - Set-WebConfigurationProperty -Filter $filter ` - -PSPath $WebsitePath ` - -Name $PropertyName ` - -Value $NewValue ` - -WarningAction Stop - } - else - { - Set-WebConfigurationProperty ` - -Filter $ConfigSection ` - -PSPath $WebsitePath ` - -Name $PropertyName ` - -Value $NewValue ` - -WarningAction Stop - } -} - -function Remove-Item -{ - param - ( - [string] $Key, - - [Boolean] $IsAttribute, - - [string] $WebsitePath, - - [string] $ConfigSection - ) - - if ( -not $isAttribute ) - { - $filter = "$ConfigSection/add[@key=`'$key`']" - Clear-WebConfiguration ` - -Filter $filter ` - -PSPath $WebsitePath ` - -WarningAction Stop - } - else - { - $filter = "$ConfigSection/@$key" - - <# - This is a workaround to ensure if appSettings has no collection - and we try to delete the only attribute, the entire node is not deleted. - if we try removing the only attribute even if there is one collection item, - the node is preserved. - #> - Add-Item ` - -Key 'dummyKey' ` - -Value 'dummyValue' ` - -IsAttribute $false ` - -WebsitePath $WebsitePath ` - -ConfigSection $ConfigSection - - Clear-WebConfiguration ` - -Filter $filter ` - -PSPath $WebsitePath ` - -WarningAction Stop - - Remove-Item ` - -Key 'dummyKey' ` - -IsAttribute $false ` - -WebsitePath $WebsitePath ` - -ConfigSection $ConfigSection - } -} - -function Get-ItemValue -{ - param - ( - [string] $Key, - - [Boolean] $isAttribute, - - [string] $WebsitePath, - - # If this is null $value.Value will be null - [string] $ConfigSection - ) - - if (-not $isAttribute) - { - $filter = "$ConfigSection/add[@key=`'$key`']" - $value = Get-WebConfigurationProperty ` - -Filter $filter ` - -Name 'value' ` - -PSPath $WebsitePath - } - else - { - $value = Get-WebConfigurationProperty ` - -Filter $ConfigSection ` - -Name "$Key" ` - -PSPath $WebsitePath - } - - return $value.Value -} - -# endregion - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebConfigKeyValue/MSFT_xWebConfigKeyValue.schema.mof b/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebConfigKeyValue/MSFT_xWebConfigKeyValue.schema.mof deleted file mode 100644 index 1b504152..00000000 --- a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebConfigKeyValue/MSFT_xWebConfigKeyValue.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xWebConfigKeyValue")] -class MSFT_xWebConfigKeyValue : OMI_BaseResource -{ - [Key, Description("Path to website location(IIS or WebAdministration format)")] String WebsitePath; - [Key, Description("Config Section to be update"), ValueMap{"AppSettings"}, Values{"AppSettings"}] String ConfigSection; - [Key, Description("Key for AppSettings")] String Key; - [Write, ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, Description("Value for AppSettings")] String Value; - [Write, Description("If the given key value pair is for attribute, default is element")] Boolean IsAttribute; -}; diff --git a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebSiteDefaults/MSFT_xWebSiteDefaults.psm1 b/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebSiteDefaults/MSFT_xWebSiteDefaults.psm1 deleted file mode 100644 index cd738a7f..00000000 --- a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebSiteDefaults/MSFT_xWebSiteDefaults.psm1 +++ /dev/null @@ -1,245 +0,0 @@ -# Load the Helper Module -Import-Module -Name "$PSScriptRoot\..\Helper.psm1" - -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData -StringData @' - NoWebAdministrationModule = Please ensure that WebAdministration module is installed. - SettingValue = Changing default Value '{0}' to '{1}' - ValueOk = Default Value '{0}' is already '{1}' - VerboseGetTargetResource = Get-TargetResource has been run. -'@ -} -function Get-TargetResource -{ - <# - .SYNOPSIS - This will return a hashtable of results - #> - - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory)] - [ValidateSet('Machine')] - [String] - $ApplyTo - ) - - Assert-Module - - Write-Verbose -Message $LocalizedData.VerboseGetTargetResource - - return @{ - LogFormat = (Get-Value 'siteDefaults/logFile' 'logFormat') - TraceLogDirectory = ( Get-Value 'siteDefaults/traceFailedRequestsLogging' 'directory') - DefaultApplicationPool = (Get-Value 'applicationDefaults' 'applicationPool') - AllowSubDirConfig = (Get-Value 'virtualDirectoryDefaults' 'allowSubDirConfig') - ApplyTo = 'Machine' - LogDirectory = (Get-Value 'siteDefaults/logFile' 'directory') - } - -} - -function Set-TargetResource -{ - <# - .SYNOPSIS - This will set the desired state - - .NOTES - Only a limited number of settings are supported at this time - We try to cover the most common use cases - We have a single parameter for each setting - #> - - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - param - ( - [ValidateSet('Machine')] - [Parameter(Mandatory = $true)] - [String] $ApplyTo, - - [ValidateSet('W3C','IIS','NCSA','Custom')] - [String] $LogFormat, - - [String] $LogDirectory, - - [String] $TraceLogDirectory, - - [String] $DefaultApplicationPool, - - [ValidateSet('true','false')] - [String] $AllowSubDirConfig - ) - - Assert-Module - - Set-Value 'siteDefaults/logFile' 'logFormat' $LogFormat - Set-Value 'siteDefaults/logFile' 'directory' $LogDirectory - Set-Value 'siteDefaults/traceFailedRequestsLogging' 'directory' $TraceLogDirectory - Set-Value 'applicationDefaults' 'applicationPool' $DefaultApplicationPool - Set-Value 'virtualDirectoryDefaults' 'allowSubDirConfig' $AllowSubDirConfig - -} - -function Test-TargetResource -{ - <# - .SYNOPSIS - This tests the desired state. If the state is not correct it will return $false. - If the state is correct it will return $true - #> - - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [OutputType([System.Boolean])] - param - ( - [ValidateSet('Machine')] - [Parameter(Mandatory = $true)] - [String] $ApplyTo, - - [ValidateSet('W3C','IIS','NCSA','Custom')] - [String] $LogFormat, - - [String] $LogDirectory, - - [String] $TraceLogDirectory, - - [String] $DefaultApplicationPool, - - [ValidateSet('true','false')] - [String] $AllowSubDirConfig - ) - - Assert-Module - - # check for the various given settings: - - if (-not(Confirm-Value -Path 'virtualDirectoryDefaults' ` - -Name 'allowSubDirConfig' ` - -NewValue $AllowSubDirConfig)) - { - return $false - } - - if (-not(Confirm-Value -Path 'siteDefaults/logFile' ` - -Name 'logFormat' ` - -NewValue $LogFormat)) - { - return $false - } - - if (-not(Confirm-Value -Path 'siteDefaults/logFile' ` - -Name 'directory' ` - -NewValue $LogDirectory)) - { - return $false - } - - if (-not(Confirm-Value -Path 'siteDefaults/traceFailedRequestsLogging' ` - -Name 'directory' ` - -NewValue $TraceLogDirectory)) - { - return $false - } - - if (-not(Confirm-Value -Path 'applicationDefaults' ` - -Name 'applicationPool' ` - -NewValue $DefaultApplicationPool)) - { - return $false - } - - return $true - -} - -#region Helper Functions - -function Confirm-Value -{ - [OutputType([System.Boolean])] - [CmdletBinding()] - param - ( - [String] $Path, - - [String] $Name, - - [String] $NewValue - ) - - if (-not($NewValue)) - { - return $true - } - - $existingValue = Get-Value -Path $Path -Name $Name - if ($existingValue -ne $NewValue) - { - return $false - } - else - { - $relPath = $Path + '/' + $Name - Write-Verbose($LocalizedData.ValueOk -f $relPath,$NewValue); - return $true - } - -} - -function Set-Value -{ - [CmdletBinding()] - param - ( - [String] $Path, - - [String] $Name, - - [String] $NewValue - ) - - # if the variable doesn't exist, the user doesn't want to change this Value - if (-not($NewValue)) - { - return - } - - # get the existing Value to compare - $existingValue = Get-Value -Path $Path -Name $Name - if ($existingValue -ne $NewValue) - { - Set-WebConfigurationProperty -PSPath 'MACHINE/WEBROOT/APPHOST' ` - -Filter "system.applicationHost/sites/$Path" ` - -Name $Name ` - -Value "$NewValue" - $relPath = $Path + '/' + $Name - Write-Verbose($LocalizedData.SettingValue -f $relPath,$NewValue); - } - -} - -function Get-Value -{ - [CmdletBinding()] - param - ( - [String] $Path, - - [String] $Name - ) - - return Get-WebConfigurationProperty -PSPath 'MACHINE/WEBROOT/APPHOST' ` - -Filter "system.applicationHost/sites/$Path" ` - -Name $Name -} - -#endregion - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebSiteDefaults/MSFT_xWebSiteDefaults.schema.mof b/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebSiteDefaults/MSFT_xWebSiteDefaults.schema.mof deleted file mode 100644 index 44b54049..00000000 --- a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebSiteDefaults/MSFT_xWebSiteDefaults.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ -[ClassVersion("1.0.0"), FriendlyName("xWebSiteDefaults")] -class MSFT_xWebSiteDefaults : OMI_BaseResource -{ - [Key, Description("Dummy value because we need a key, always 'Machine'"), ValueMap{"Machine"}, Values{"Machine"}] string ApplyTo; - [write, Description("sites/siteDefaults/logFile/logFormat"), ValueMap{"W3C","IIS","NCSA","Custom"}, Values{"W3C","IIS","NCSA","Custom"}] string LogFormat; - [write, Description("sites/siteDefaults/logFile/directory")] string LogDirectory; - [write, Description("sites/siteDefaults/traceFailedRequestsLogging/directory")] string TraceLogDirectory; - [write, Description("sites/applicationDefaults/applicationPool")] string DefaultApplicationPool; - [write, Description("sites/virtualDirectoryDefaults/allowSubDirConfig"), ValueMap{"true","false"}, Values{"true","false"}] string AllowSubDirConfig; -}; diff --git a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebVirtualDirectory/MSFT_xWebVirtualDirectory.psm1 b/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebVirtualDirectory/MSFT_xWebVirtualDirectory.psm1 deleted file mode 100644 index c3f8dc0c..00000000 --- a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebVirtualDirectory/MSFT_xWebVirtualDirectory.psm1 +++ /dev/null @@ -1,211 +0,0 @@ -# Load the Helper Module -Import-Module -Name "$PSScriptRoot\..\Helper.psm1" - -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData -StringData @' - VerboseGetTargetResource = Get-TargetResource has been run. - VerboseSetTargetPhysicalPath = Updating physical path for web virtual directory "{0}". - VerboseSetTargetCreateVirtualDirectory = Creating new Web Virtual Directory "{0}". - VerboseSetTargetRemoveVirtualDirectory = Removing existing Virtual Directory "{0}". - VerboseTestTargetFalse = Physical path "{0}" for web virtual directory "{1}" does not match desired state. - VerboseTestTargetTrue = Web virtual directory is in required state. - VerboseTestTargetAbsentTrue = Web virtual directory "{0}" should be absent and is absent. -'@ -} - -function Get-TargetResource -{ - <# - .SYNOPSIS - This will return a hashtable of results - #> - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $Website, - - [Parameter(Mandatory = $true)] - [AllowEmptyString()] - [System.String] - $WebApplication, - - [Parameter(Mandatory = $true)] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [System.String] - $PhysicalPath - ) - - Assert-Module - - $virtualDirectory = Get-WebVirtualDirectory -Site $Website ` - -Name $Name ` - -Application $WebApplication - - $PhysicalPath = '' - $Ensure = 'Absent' - - if ($virtualDirectory.Count -eq 1) - { - $PhysicalPath = $virtualDirectory.PhysicalPath - $Ensure = 'Present' - } - - Write-Verbose -Message ($LocalizedData.VerboseGetTargetResource) - - $returnValue = @{ - Name = $Name - Website = $Website - WebApplication = $WebApplication - PhysicalPath = $PhysicalPath - Ensure = $Ensure - } - - return $returnValue -} - -function Set-TargetResource -{ - <# - .SYNOPSIS - This will set the desired state - #> - [CmdletBinding()] - param - ( - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present', - - [Parameter(Mandatory = $true)] - [System.String] - $Website, - - [Parameter(Mandatory = $true)] - [AllowEmptyString()] - [System.String] - $WebApplication, - - [Parameter(Mandatory = $true)] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [System.String] - $PhysicalPath - ) - - Assert-Module - - if ($Ensure -eq 'Present') - { - $virtualDirectory = Get-WebVirtualDirectory -Site $Website ` - -Name $Name ` - -Application $WebApplication - if ($virtualDirectory.count -eq 0) - { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetCreateVirtualDirectory -f $Name) - New-WebVirtualDirectory -Site $Website ` - -Application $WebApplication ` - -Name $Name ` - -PhysicalPath $PhysicalPath - } - else - { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetPhysicalPath -f $Name) - - if ($WebApplication.Length -gt 0) - { - $ItemPath = "IIS:Sites\$Website\$WebApplication\$Name" - } - else - { - $ItemPath = "IIS:Sites\$Website\$Name" - } - - Set-ItemProperty -Path $ItemPath ` - -Name physicalPath ` - -Value $PhysicalPath - } - } - - if ($Ensure -eq 'Absent') - { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetRemoveVirtualDirectory -f $Name) - Remove-WebVirtualDirectory -Site $Website ` - -Application $WebApplication ` - -Name $Name - } -} - -function Test-TargetResource -{ - <# - .SYNOPSIS - This tests the desired state. If the state is not correct it will return $false. - If the state is correct it will return $true - #> - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [ValidateSet('Present','Absent')] - [System.String] - $Ensure = 'Present', - - [Parameter(Mandatory = $true)] - [System.String] - $Website, - - [Parameter(Mandatory = $true)] - [AllowEmptyString()] - [System.String] - $WebApplication, - - [Parameter(Mandatory = $true)] - [System.String] - $Name, - - [Parameter(Mandatory = $true)] - [System.String] - $PhysicalPath - ) - - Assert-Module - - $virtualDirectory = Get-WebVirtualDirectory -Site $Website ` - -Name $Name ` - -Application $WebApplication - - if ($virtualDirectory.Count -eq 1 -and $Ensure -eq 'Present') - { - if ($virtualDirectory.PhysicalPath -eq $PhysicalPath) - { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetTrue) - return $true - } - else - { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalse -f $PhysicalPath, $Name) - return $false - } - } - - if ($virtualDirectory.count -eq 0 -and $Ensure -eq 'Absent') - { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetAbsentTrue -f $Name) - return $true - } - - return $false -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebVirtualDirectory/MSFT_xWebVirtualDirectory.schema.mof b/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebVirtualDirectory/MSFT_xWebVirtualDirectory.schema.mof deleted file mode 100644 index 30523659..00000000 --- a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebVirtualDirectory/MSFT_xWebVirtualDirectory.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xWebVirtualDirectory")] -class MSFT_xWebVirtualDirectory : OMI_BaseResource -{ - [Key, Description("Name of website with which Web Application is associated")] string Website; - [Key, Description("Web application name for the virtual directory")] string WebApplication; - [Key, Description("Name of virtual directory")] string Name; - [Required, Description("Physical path for the virtual directory")] string PhysicalPath; - [Write, Description("Whether virtual directory should be present or absent"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; -}; diff --git a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebsite/MSFT_xWebsite.psm1 b/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebsite/MSFT_xWebsite.psm1 deleted file mode 100644 index c4edfcd9..00000000 --- a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebsite/MSFT_xWebsite.psm1 +++ /dev/null @@ -1,2106 +0,0 @@ -#requires -Version 4.0 -Modules CimCmdlets - -# Load the Helper Module -Import-Module -Name "$PSScriptRoot\..\Helper.psm1" -Verbose:$false - -# Localized messages -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData -StringData @' - ErrorWebsiteNotFound = The requested website "{0}" cannot be found on the target machine. - ErrorWebsiteDiscoveryFailure = Failure to get the requested website "{0}" information from the target machine. - ErrorWebsiteCreationFailure = Failure to successfully create the website "{0}". Error: "{1}". - ErrorWebsiteRemovalFailure = Failure to successfully remove the website "{0}". Error: "{1}". - ErrorWebsiteBindingUpdateFailure = Failure to successfully update the bindings for website "{0}". Error: "{1}". - ErrorWebsiteBindingInputInvalidation = Desired website bindings are not valid for website "{0}". - ErrorWebsiteCompareFailure = Failure to successfully compare properties for website "{0}". Error: "{1}". - ErrorWebBindingCertificate = Failure to add certificate to web binding. Please make sure that the certificate thumbprint "{0}" is valid. Error: "{1}". - ErrorWebsiteStateFailure = Failure to successfully set the state of the website "{0}". Error: "{1}". - ErrorWebsiteBindingConflictOnStart = Website "{0}" could not be started due to binding conflict. Ensure that the binding information for this website does not conflict with any existing website's bindings before trying to start it. - ErrorWebBindingInvalidIPAddress = Failure to validate the IPAddress property value "{0}". Error: "{1}". - ErrorWebBindingInvalidPort = Failure to validate the Port property value "{0}". The port number must be a positive integer between 1 and 65535. - ErrorWebBindingMissingBindingInformation = The BindingInformation property is required for bindings of type "{0}". - ErrorWebBindingMissingCertificateThumbprint = The CertificateThumbprint property is required for bindings of type "{0}". - ErrorWebBindingMissingSniHostName = The HostName property is required for use with Server Name Indication. - ErrorWebsitePreloadFailure = Failure to set Preload on Website "{0}". Error: "{1}". - ErrorWebsiteAutoStartFailure = Failure to set AutoStart on Website "{0}". Error: "{1}". - ErrorWebsiteAutoStartProviderFailure = Failure to set AutoStartProvider on Website "{0}". Error: "{1}". - ErrorWebsiteTestAutoStartProviderFailure = Desired AutoStartProvider is not valid due to a conflicting Global Property. Ensure that the serviceAutoStartProvider is a unique key." - VerboseSetTargetUpdatedPhysicalPath = Physical Path for website "{0}" has been updated to "{1}". - VerboseGetTargetAbsent = No Website exists with this name. - VerboseGetTargetPresent = A single Website exists with this name - VerboseSetTargetUpdatedApplicationPool = Application Pool for website "{0}" has been updated to "{1}". - VerboseSetTargetUpdatedBindingInfo = Bindings for website "{0}" have been updated. - VerboseSetTargetUpdatedEnabledProtocols = Enabled Protocols for website "{0}" have been updated to "{1}". - VerboseSetTargetUpdatedState = State for website "{0}" has been updated to "{1}". - VerboseSetTargetWebsiteCreated = Successfully created website "{0}". - VerboseSetTargetWebsiteStarted = Successfully started website "{0}". - VerboseSetTargetWebsiteRemoved = Successfully removed website "{0}". - VerboseSetTargetAuthenticationInfoUpdated = Successfully updated AuthenticationInfo on website "{0}". - VerboseSetTargetWebsitePreloadUpdated = Successfully updated Preload on website "{0}". - VerboseSetTargetWebsiteAutoStartUpdated = Successfully updated AutoStart on website "{0}". - VerboseSetTargetWebsiteAutoStartProviderUpdated = Successfully updated AutoStartProvider on website "{0}". - VerboseSetTargetIISAutoStartProviderUpdated = Successfully updated AutoStartProvider in IIS. - VerboseSetTargetUpdateLogPath = LogPath does not match and will be updated on Website "{0}". - VerboseSetTargetUpdateLogFlags = LogFlags do not match and will be updated on Website "{0}". - VerboseSetTargetUpdateLogPeriod = LogPeriod does not match and will be updated on Website "{0}". - VerboseSetTargetUpdateLogTruncateSize = TruncateSize does not match and will be updated on Website "{0}". - VerboseSetTargetUpdateLoglocalTimeRollover = LoglocalTimeRollover does not match and will be updated on Website "{0}". - VerboseSetTargetUpdateLogFormat = LogFormat is not in the desired state and will be updated on Website "{0}" - VerboseTestTargetFalseEnsure = The Ensure state for website "{0}" does not match the desired state. - VerboseTestTargetFalsePhysicalPath = Physical Path of website "{0}" does not match the desired state. - VerboseTestTargetFalseState = The state of website "{0}" does not match the desired state. - VerboseTestTargetFalseApplicationPool = Application Pool for website "{0}" does not match the desired state. - VerboseTestTargetFalseBindingInfo = Bindings for website "{0}" do not match the desired state. - VerboseTestTargetFalseEnabledProtocols = Enabled Protocols for website "{0}" do not match the desired state. - VerboseTestTargetFalseDefaultPage = Default Page for website "{0}" does not match the desired state. - VerboseTestTargetTrueResult = The target resource is already in the desired state. No action is required. - VerboseTestTargetFalseResult = The target resource is not in the desired state. - VerboseTestTargetFalsePreload = Preload for website "{0}" do not match the desired state. - VerboseTestTargetFalseAutoStart = AutoStart for website "{0}" do not match the desired state. - VerboseTestTargetFalseAuthenticationInfo = AuthenticationInfo for website "{0}" is not in the desired state. - VerboseTestTargetFalseIISAutoStartProvider = AutoStartProvider for IIS is not in the desired state - VerboseTestTargetFalseWebsiteAutoStartProvider = AutoStartProvider for website "{0}" is not in the desired state - VerboseTestTargetFalseLogPath = LogPath does not match desired state on Website "{0}". - VerboseTestTargetFalseLogFlags = LogFlags does not match desired state on Website "{0}". - VerboseTestTargetFalseLogPeriod = LogPeriod does not match desired state on Website "{0}". - VerboseTestTargetFalseLogTruncateSize = LogTruncateSize does not match desired state on Website "{0}". - VerboseTestTargetFalseLoglocalTimeRollover = LoglocalTimeRollover does not match desired state on Website "{0}". - VerboseTestTargetFalseLogFormat = LogFormat does not match desired state on Website "{0}". - VerboseConvertToWebBindingIgnoreBindingInformation = BindingInformation is ignored for bindings of type "{0}" in case at least one of the following properties is specified: IPAddress, Port, HostName. - VerboseConvertToWebBindingDefaultPort = Port is not specified. The default "{0}" port "{1}" will be used. - VerboseConvertToWebBindingDefaultCertificateStoreName = CertificateStoreName is not specified. The default value "{0}" will be used. - VerboseTestBindingInfoSameIPAddressPortHostName = BindingInfo contains multiple items with the same IPAddress, Port, and HostName combination. - VerboseTestBindingInfoSamePortDifferentProtocol = BindingInfo contains items that share the same Port but have different Protocols. - VerboseTestBindingInfoSameProtocolBindingInformation = BindingInfo contains multiple items with the same Protocol and BindingInformation combination. - VerboseTestBindingInfoInvalidCatch = Unable to validate BindingInfo: "{0}". - VerboseUpdateDefaultPageUpdated = Default page for website "{0}" has been updated to "{1}". - WarningLogPeriod = LogTruncateSize has is an input as will overwrite this desired state on Website "{0}". - WarningIncorrectLogFormat = LogFormat is not W3C, as a result LogFlags will not be used on Website "{0}". -'@ -} - -<# - .SYNOPSYS - The Get-TargetResource cmdlet is used to fetch the status of role or Website on - the target machine. It gives the Website info of the requested role/feature on the - target machine. - - .PARAMETER Name - Name of the website -#> -function Get-TargetResource -{ - - [CmdletBinding()] - [OutputType([Hashtable])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Name - ) - - Assert-Module - - $website = Get-Website | Where-Object -FilterScript {$_.Name -eq $Name} - - if ($website.Count -eq 0) - { - Write-Verbose -Message ($LocalizedData.VerboseGetTargetAbsent) - $ensureResult = 'Absent' - } - elseif ($website.Count -eq 1) - { - Write-Verbose -Message ($LocalizedData.VerboseGetTargetPresent) - $ensureResult = 'Present' - - $cimBindings = @(ConvertTo-CimBinding -InputObject $website.bindings.Collection) - - $allDefaultPages = @( - Get-WebConfiguration -Filter '//defaultDocument/files/*' -PSPath "IIS:\Sites\$Name" | - ForEach-Object -Process {Write-Output -InputObject $_.value} - ) - $cimAuthentication = Get-AuthenticationInfo -Site $Name - $websiteAutoStartProviders = (Get-WebConfiguration ` - -filter /system.applicationHost/serviceAutoStartProviders).Collection - $webConfiguration = $websiteAutoStartProviders | ` - Where-Object -Property Name -eq -Value $ServiceAutoStartProvider | ` - Select-Object Name,Type - } - # Multiple websites with the same name exist. This is not supported and is an error - else - { - $errorMessage = $LocalizedData.ErrorWebsiteDiscoveryFailure -f $Name - New-TerminatingError -ErrorId 'WebsiteDiscoveryFailure' ` - -ErrorMessage $errorMessage ` - -ErrorCategory 'InvalidResult' - } - - # Add all website properties to the hash table - return @{ - Ensure = $ensureResult - Name = $Name - PhysicalPath = $website.PhysicalPath - State = $website.State - ApplicationPool = $website.ApplicationPool - BindingInfo = $cimBindings - DefaultPage = $allDefaultPages - EnabledProtocols = $website.EnabledProtocols - AuthenticationInfo = $cimAuthentication - PreloadEnabled = $website.applicationDefaults.preloadEnabled - ServiceAutoStartProvider = $website.applicationDefaults.serviceAutoStartProvider - ServiceAutoStartEnabled = $website.applicationDefaults.serviceAutoStartEnabled - ApplicationType = $webConfiguration.Type - LogPath = $website.logfile.directory - LogFlags = [Array]$website.logfile.LogExtFileFlags - LogPeriod = $website.logfile.period - LogtruncateSize = $website.logfile.truncateSize - LoglocalTimeRollover = $website.logfile.localTimeRollover - LogFormat = $website.logfile.logFormat - } -} - -<# - .SYNOPSYS - The Set-TargetResource cmdlet is used to create, delete or configure a website on the - target machine. - - .PARAMETER PhysicalPath - Specifies the physical path of the web site. Don't set this if the site will be deployed by an external tool that updates the path. -#> -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present', - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Name, - - [String] - $PhysicalPath, - - [ValidateSet('Started', 'Stopped')] - [String] - $State = 'Started', - - # The application pool name must contain between 1 and 64 characters - [ValidateLength(1, 64)] - [String] - $ApplicationPool, - - [Microsoft.Management.Infrastructure.CimInstance[]] - $BindingInfo, - - [String[]] - $DefaultPage, - - [String] - $EnabledProtocols, - - [Microsoft.Management.Infrastructure.CimInstance] - $AuthenticationInfo, - - [Boolean] - $PreloadEnabled, - - [Boolean] - $ServiceAutoStartEnabled, - - [String] - $ServiceAutoStartProvider, - - [String] - $ApplicationType, - - [String] - $LogPath, - - [ValidateSet('Date','Time','ClientIP','UserName','SiteName','ComputerName','ServerIP','Method','UriStem','UriQuery','HttpStatus','Win32Status','BytesSent','BytesRecv','TimeTaken','ServerPort','UserAgent','Cookie','Referer','ProtocolVersion','Host','HttpSubStatus')] - [String[]] - $LogFlags, - - [ValidateSet('Hourly','Daily','Weekly','Monthly','MaxSize')] - [String] - $LogPeriod, - - [ValidateScript({ - ([ValidateRange(1048576, 4294967295)] $valueAsUInt64 = [UInt64]::Parse($_)) - })] - [String] - $LogTruncateSize, - - [Boolean] - $LoglocalTimeRollover, - - [ValidateSet('IIS','W3C','NCSA')] - [String] - $LogFormat - ) - - Assert-Module - - $website = Get-Website | Where-Object -FilterScript {$_.Name -eq $Name} - - if ($Ensure -eq 'Present') - { - if ($null -ne $website) - { - # Update Physical Path if required - if ([String]::IsNullOrEmpty($PhysicalPath) -eq $false -and ` - $website.PhysicalPath -ne $PhysicalPath) - { - Set-ItemProperty -Path "IIS:\Sites\$Name" ` - -Name physicalPath ` - -Value $PhysicalPath ` - -ErrorAction Stop - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdatedPhysicalPath ` - -f $Name, $PhysicalPath) - } - - # Update Application Pool if required - if ($PSBoundParameters.ContainsKey('ApplicationPool') -and ` - $website.ApplicationPool -ne $ApplicationPool) - { - Set-ItemProperty -Path "IIS:\Sites\$Name" ` - -Name applicationPool ` - -Value $ApplicationPool ` - -ErrorAction Stop - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdatedApplicationPool ` - -f $Name, $ApplicationPool) - } - - # Update Bindings if required - if ($PSBoundParameters.ContainsKey('BindingInfo') -and ` - $null -ne $BindingInfo) - { - if (-not (Test-WebsiteBinding -Name $Name ` - -BindingInfo $BindingInfo)) - { - Update-WebsiteBinding -Name $Name ` - -BindingInfo $BindingInfo - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdatedBindingInfo ` - -f $Name) - } - } - - # Update Enabled Protocols if required - if ($PSBoundParameters.ContainsKey('EnabledProtocols') -and ` - $website.EnabledProtocols -ne $EnabledProtocols) - { - Set-ItemProperty -Path "IIS:\Sites\$Name" ` - -Name enabledProtocols ` - -Value $EnabledProtocols ` - -ErrorAction Stop - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdatedEnabledProtocols ` - -f $Name, $EnabledProtocols) - } - - # Update Default Pages if required - if ($PSBoundParameters.ContainsKey('DefaultPage') -and ` - $null -ne $DefaultPage) - { - Update-DefaultPage -Name $Name ` - -DefaultPage $DefaultPage - } - - # Update State if required - if ($PSBoundParameters.ContainsKey('State') -and ` - $website.State -ne $State) - { - if ($State -eq 'Started') - { - # Ensure that there are no other running websites with binding information that - # will conflict with this website before starting - if (-not (Confirm-UniqueBinding -Name $Name -ExcludeStopped)) - { - # Return error and do not start the website - $errorMessage = $LocalizedData.ErrorWebsiteBindingConflictOnStart ` - -f $Name - New-TerminatingError -ErrorId 'WebsiteBindingConflictOnStart' ` - -ErrorMessage $errorMessage ` - -ErrorCategory 'InvalidResult' - } - - try - { - Start-Website -Name $Name -ErrorAction Stop - } - catch - { - $errorMessage = $LocalizedData.ErrorWebsiteStateFailure ` - -f $Name, $_.Exception.Message - New-TerminatingError -ErrorId 'WebsiteStateFailure' ` - -ErrorMessage $errorMessage ` - -ErrorCategory 'InvalidOperation' - } - } - else - { - try - { - Stop-Website -Name $Name -ErrorAction Stop - } - catch - { - $errorMessage = $LocalizedData.ErrorWebsiteStateFailure ` - -f $Name, $_.Exception.Message - New-TerminatingError -ErrorId 'WebsiteStateFailure' ` - -ErrorMessage $errorMessage ` - -ErrorCategory 'InvalidOperation' - } - } - - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdatedState ` - -f $Name, $State) - } - - # Set Authentication; if not defined then pass in DefaultAuthenticationInfo - if ($PSBoundParameters.ContainsKey('AuthenticationInfo') -and ` - (-not (Test-AuthenticationInfo -Site $Name ` - -AuthenticationInfo $AuthenticationInfo))) - { - Set-AuthenticationInfo -Site $Name ` - -AuthenticationInfo $AuthenticationInfo ` - -ErrorAction Stop - Write-Verbose -Message ($LocalizedData.VerboseSetTargetAuthenticationInfoUpdated ` - -f $Name) - } - - # Update Preload if required - if ($PSBoundParameters.ContainsKey('preloadEnabled') -and ` - ($website.applicationDefaults.preloadEnabled -ne $PreloadEnabled)) - { - Set-ItemProperty -Path "IIS:\Sites\$Name" ` - -Name applicationDefaults.preloadEnabled ` - -Value $PreloadEnabled ` - -ErrorAction Stop - Write-Verbose -Message ($LocalizedData.VerboseSetTargetWebsitePreloadUpdated ` - -f $Name) - } - - # Update AutoStart if required - if ($PSBoundParameters.ContainsKey('ServiceAutoStartEnabled') -and ` - ($website.applicationDefaults.ServiceAutoStartEnabled -ne $ServiceAutoStartEnabled)) - { - Set-ItemProperty -Path "IIS:\Sites\$Name" ` - -Name applicationDefaults.serviceAutoStartEnabled ` - -Value $ServiceAutoStartEnabled ` - -ErrorAction Stop - Write-Verbose -Message ($LocalizedData.VerboseSetTargetWebsiteAutoStartUpdated ` - -f $Name) - } - - # Update AutoStartProviders if required - if ($PSBoundParameters.ContainsKey('ServiceAutoStartProvider') -and ` - ($website.applicationDefaults.ServiceAutoStartProvider -ne ` - $ServiceAutoStartProvider)) - { - if (-not (Confirm-UniqueServiceAutoStartProviders ` - -ServiceAutoStartProvider $ServiceAutoStartProvider ` - -ApplicationType $ApplicationType)) - { - Add-WebConfiguration -filter /system.applicationHost/serviceAutoStartProviders ` - -Value @{ - name=$ServiceAutoStartProvider - type=$ApplicationType} ` - -ErrorAction Stop - Write-Verbose -Message ` - ($LocalizedData.VerboseSetTargetIISAutoStartProviderUpdated) - } - Set-ItemProperty -Path "IIS:\Sites\$Name" ` - -Name applicationDefaults.serviceAutoStartProvider ` - -Value $ServiceAutoStartProvider -ErrorAction Stop - Write-Verbose -Message ` - ($LocalizedData.VerboseSetTargetWebsiteAutoStartProviderUpdated ` - -f $Name) - } - - # Update LogFormat if Needed - if ($PSBoundParameters.ContainsKey('LogFormat') -and ` - ($LogFormat -ne $website.logfile.LogFormat)) - { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdateLogFormat ` - -f $Name) - - # In Windows Server 2008 R2, Set-ItemProperty only accepts index values to the LogFile.LogFormat property - $site = Get-Item "IIS:\Sites\$Name" - $site.LogFile.LogFormat = $LogFormat - $site | Set-Item - } - - # Update LogFlags if required - if ($PSBoundParameters.ContainsKey('LogFlags') -and ` - (-not (Compare-LogFlags -Name $Name -LogFlags $LogFlags))) - { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdateLogFlags ` - -f $Name) - - # Set-ItemProperty has no effect with the LogFile.LogExtFileFlags property - $site = Get-Item "IIS:\Sites\$Name" - $site.LogFile.LogFormat = 'W3C' - $site.LogFile.LogExtFileFlags = $LogFlags -join ',' - $site | Set-Item - } - - # Update LogPath if required - if ($PSBoundParameters.ContainsKey('LogPath') -and ` - ($LogPath -ne $website.logfile.directory)) - { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdateLogPath ` - -f $Name) - Set-ItemProperty -Path "IIS:\Sites\$Name" ` - -Name LogFile.directory -value $LogPath - } - - # Update LogPeriod if needed - if ($PSBoundParameters.ContainsKey('LogPeriod') -and ` - ($LogPeriod -ne $website.logfile.period)) - { - if ($PSBoundParameters.ContainsKey('LogTruncateSize')) - { - Write-Verbose -Message ($LocalizedData.WarningLogPeriod -f $Name) - } - - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdateLogPeriod) - - # In Windows Server 2008 R2, Set-ItemProperty only accepts index values to the LogFile.Period property - $site = Get-Item "IIS:\Sites\$Name" - $site.LogFile.Period = $LogPeriod - $site | Set-Item - } - - # Update LogTruncateSize if needed - if ($PSBoundParameters.ContainsKey('LogTruncateSize') -and ` - ($LogTruncateSize -ne $website.logfile.LogTruncateSize)) - { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdateLogTruncateSize ` - -f $Name) - Set-ItemProperty -Path "IIS:\Sites\$Name" ` - -Name LogFile.truncateSize -Value $LogTruncateSize - Set-ItemProperty -Path "IIS:\Sites\$Name" ` - -Name LogFile.period -Value 'MaxSize' - } - - # Update LoglocalTimeRollover if neeed - if ($PSBoundParameters.ContainsKey('LoglocalTimeRollover') -and ` - ($LoglocalTimeRollover -ne ` - ([System.Convert]::ToBoolean($website.logfile.LocalTimeRollover)))) - { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdateLoglocalTimeRollover ` - -f $Name) - Set-ItemProperty -Path "IIS:\Sites\$Name" ` - -Name LogFile.localTimeRollover -Value $LoglocalTimeRollover - } - - } - # Create website if it does not exist - else - { - try - { - $PSBoundParameters.GetEnumerator() | Where-Object -FilterScript { - $_.Key -in (Get-Command -Name New-Website ` - -Module WebAdministration).Parameters.Keys - } | ForEach-Object -Begin { - $newWebsiteSplat = @{} - } -Process { - $newWebsiteSplat.Add($_.Key, $_.Value) - } - - # If there are no other websites, specify the Id Parameter for the new website. - # Otherwise an error can occur on systems running Windows Server 2008 R2. - if (-not (Get-Website)) - { - $newWebsiteSplat.Add('Id', 1) - } - - if ([String]::IsNullOrEmpty($PhysicalPath)) { - # If no physical path is provided run New-Website with -Force flag - $website = New-Website @newWebsiteSplat -ErrorAction Stop -Force - } else { - # If physical path is provided don't run New-Website with -Force flag to verify that the path exists - $website = New-Website @newWebsiteSplat -ErrorAction Stop - } - - Write-Verbose -Message ($LocalizedData.VerboseSetTargetWebsiteCreated ` - -f $Name) - } - catch - { - $errorMessage = $LocalizedData.ErrorWebsiteCreationFailure ` - -f $Name, $_.Exception.Message - New-TerminatingError -ErrorId 'WebsiteCreationFailure' ` - -ErrorMessage $errorMessage ` - -ErrorCategory 'InvalidOperation' - } - - Stop-Website -Name $website.Name -ErrorAction Stop - - # Clear default bindings if new bindings defined and are different - if ($PSBoundParameters.ContainsKey('BindingInfo') -and ` - $null -ne $BindingInfo) - { - if (-not (Test-WebsiteBinding -Name $Name ` - -BindingInfo $BindingInfo)) - { - Update-WebsiteBinding -Name $Name -BindingInfo $BindingInfo - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdatedBindingInfo ` - -f $Name) - } - } - - # Update Enabled Protocols if required - if ($PSBoundParameters.ContainsKey('EnabledProtocols') ` - -and $website.EnabledProtocols ` - -ne $EnabledProtocols) - { - Set-ItemProperty -Path "IIS:\Sites\$Name" ` - -Name enabledProtocols ` - -Value $EnabledProtocols ` - -ErrorAction Stop - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdatedEnabledProtocols ` - -f $Name, $EnabledProtocols) - } - - # Update Default Pages if required - if ($PSBoundParameters.ContainsKey('DefaultPage') -and ` - $null -ne $DefaultPage) - { - Update-DefaultPage -Name $Name ` - -DefaultPage $DefaultPage - } - - # Start website if required - if ($State -eq 'Started') - { - # Ensure that there are no other running websites with binding information that - # will conflict with this website before starting - if (-not (Confirm-UniqueBinding -Name $Name -ExcludeStopped)) - { - # Return error and do not start the website - $errorMessage = $LocalizedData.ErrorWebsiteBindingConflictOnStart ` - -f $Name - New-TerminatingError -ErrorId 'WebsiteBindingConflictOnStart' ` - -ErrorMessage $errorMessage ` - -ErrorCategory 'InvalidResult' - } - - try - { - Start-Website -Name $Name -ErrorAction Stop - Write-Verbose -Message ($LocalizedData.VerboseSetTargetWebsiteStarted ` - -f $Name) - } - catch - { - $errorMessage = $LocalizedData.ErrorWebsiteStateFailure ` - -f $Name, $_.Exception.Message - New-TerminatingError -ErrorId 'WebsiteStateFailure' ` - -ErrorMessage $errorMessage ` - -ErrorCategory 'InvalidOperation' - } - } - - # Set Authentication; if not defined then pass in DefaultAuthenticationInfo - if ($PSBoundParameters.ContainsKey('AuthenticationInfo') -and ` - (-not (Test-AuthenticationInfo -Site $Name ` - -AuthenticationInfo $AuthenticationInfo))) - { - Set-AuthenticationInfo -Site $Name ` - -AuthenticationInfo $AuthenticationInfo ` - -ErrorAction Stop - Write-Verbose -Message ($LocalizedData.VerboseSetTargetAuthenticationInfoUpdated ` - -f $Name) - } - - # Update Preload if required - if ($PSBoundParameters.ContainsKey('preloadEnabled') -and ` - ($website.applicationDefaults.preloadEnabled -ne $PreloadEnabled)) - { - Set-ItemProperty -Path "IIS:\Sites\$Name" ` - -Name applicationDefaults.preloadEnabled ` - -Value $PreloadEnabled ` - -ErrorAction Stop - Write-Verbose -Message ($LocalizedData.VerboseSetTargetWebsitePreloadUpdated ` - -f $Name) - } - - # Update AutoStart if required - if ($PSBoundParameters.ContainsKey('ServiceAutoStartEnabled') -and ` - ($website.applicationDefaults.ServiceAutoStartEnabled -ne $ServiceAutoStartEnabled)) - { - Set-ItemProperty -Path "IIS:\Sites\$Name" ` - -Name applicationDefaults.serviceAutoStartEnabled ` - -Value $ServiceAutoStartEnabled ` - -ErrorAction Stop - Write-Verbose -Message ($LocalizedData.VerboseSetTargetWebsiteAutoStartUpdated ` - -f $Name) - } - - # Update AutoStartProviders if required - if ($PSBoundParameters.ContainsKey('ServiceAutoStartProvider') -and ` - ($website.applicationDefaults.ServiceAutoStartProvider ` - -ne $ServiceAutoStartProvider)) - { - if (-not (Confirm-UniqueServiceAutoStartProviders ` - -ServiceAutoStartProvider $ServiceAutoStartProvider ` - -ApplicationType $ApplicationType)) - { - Add-WebConfiguration -filter /system.applicationHost/serviceAutoStartProviders ` - -Value @{ - name=$ServiceAutoStartProvider; - type=$ApplicationType - } ` - -ErrorAction Stop - Write-Verbose -Message ` - ($LocalizedData.VerboseSetTargetIISAutoStartProviderUpdated) - } - Set-ItemProperty -Path "IIS:\Sites\$Name" ` - -Name applicationDefaults.serviceAutoStartProvider ` - -Value $ServiceAutoStartProvider -ErrorAction Stop - Write-Verbose -Message ` - ($LocalizedData.VerboseSetTargetWebsiteAutoStartProviderUpdated ` - -f $Name) - } - - # Update LogFormat if Needed - if ($PSBoundParameters.ContainsKey('LogFormat') -and ` - ($LogFormat -ne $website.logfile.LogFormat)) - { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdateLogFormat -f $Name) - - # In Windows Server 2008 R2, Set-ItemProperty only accepts index values to the LogFile.LogFormat property - $site = Get-Item "IIS:\Sites\$Name" - $site.LogFile.LogFormat = $LogFormat - $site | Set-Item - } - - # Update LogFlags if required - if ($PSBoundParameters.ContainsKey('LogFlags') -and ` - (-not (Compare-LogFlags -Name $Name -LogFlags $LogFlags))) - { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdateLogFlags ` - -f $Name) - - # Set-ItemProperty has no effect with the LogFile.LogExtFileFlags property - $site = Get-Item "IIS:\Sites\$Name" - $site.LogFile.LogFormat = 'W3C' - $site.LogFile.LogExtFileFlags = $LogFlags -join ',' - $site | Set-Item - } - - # Update LogPath if required - if ($PSBoundParameters.ContainsKey('LogPath') -and ` - ($LogPath -ne $website.logfile.directory)) - { - - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdateLogPath ` - -f $Name) - Set-ItemProperty -Path "IIS:\Sites\$Name" ` - -Name LogFile.directory -value $LogPath - } - - # Update LogPeriod if needed - if ($PSBoundParameters.ContainsKey('LogPeriod') -and ` - ($LogPeriod -ne $website.logfile.period)) - { - if ($PSBoundParameters.ContainsKey('LogTruncateSize')) - { - Write-Verbose -Message ($LocalizedData.WarningLogPeriod ` - -f $Name) - } - - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdateLogPeriod) - - # In Windows Server 2008 R2, Set-ItemProperty only accepts index values to the LogFile.Period property - $site = Get-Item "IIS:\Sites\$Name" - $site.LogFile.Period = $LogPeriod - $site | Set-Item - } - - # Update LogTruncateSize if needed - if ($PSBoundParameters.ContainsKey('LogTruncateSize') -and ` - ($LogTruncateSize -ne $website.logfile.LogTruncateSize)) - { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdateLogTruncateSize ` - -f $Name) - Set-ItemProperty -Path "IIS:\Sites\$Name" ` - -Name LogFile.truncateSize -Value $LogTruncateSize - Set-ItemProperty -Path "IIS:\Sites\$Name" ` - -Name LogFile.period -Value 'MaxSize' - } - - # Update LoglocalTimeRollover if neeed - if ($PSBoundParameters.ContainsKey('LoglocalTimeRollover') -and ` - ($LoglocalTimeRollover -ne ` - ([System.Convert]::ToBoolean($website.logfile.LocalTimeRollover)))) - { - Write-Verbose -Message ($LocalizedData.VerboseSetTargetUpdateLoglocalTimeRollover ` - -f $Name) - Set-ItemProperty -Path "IIS:\Sites\$Name" ` - -Name LogFile.localTimeRollover -Value $LoglocalTimeRollover - } - } - } - # Remove website - else - { - try - { - Remove-Website -Name $Name -ErrorAction Stop - Write-Verbose -Message ($LocalizedData.VerboseSetTargetWebsiteRemoved ` - -f $Name) - } - catch - { - $errorMessage = $LocalizedData.ErrorWebsiteRemovalFailure ` - -f $Name, $_.Exception.Message - New-TerminatingError -ErrorId 'WebsiteRemovalFailure' ` - -ErrorMessage $errorMessage ` - -ErrorCategory 'InvalidOperation' - } - } -} - -<# - .SYNOPSIS - The Test-TargetResource cmdlet is used to validate if the role or feature is in a state as - expected in the instance document. -#> -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([Boolean])] - param - ( - [ValidateSet('Present', 'Absent')] - [String] - $Ensure = 'Present', - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Name, - - [String] - $PhysicalPath, - - [ValidateSet('Started', 'Stopped')] - [String] - $State = 'Started', - - # The application pool name must contain between 1 and 64 characters - [ValidateLength(1, 64)] - [String] - $ApplicationPool, - - [Microsoft.Management.Infrastructure.CimInstance[]] - $BindingInfo, - - [String[]] - $DefaultPage, - - [String] - $EnabledProtocols, - - [Microsoft.Management.Infrastructure.CimInstance] - $AuthenticationInfo, - - [Boolean] - $PreloadEnabled, - - [Boolean] - $ServiceAutoStartEnabled, - - [String] - $ServiceAutoStartProvider, - - [String] - $ApplicationType, - - [String] - $LogPath, - - [ValidateSet('Date','Time','ClientIP','UserName','SiteName','ComputerName','ServerIP','Method','UriStem','UriQuery','HttpStatus','Win32Status','BytesSent','BytesRecv','TimeTaken','ServerPort','UserAgent','Cookie','Referer','ProtocolVersion','Host','HttpSubStatus')] - [String[]] - $LogFlags, - - [ValidateSet('Hourly','Daily','Weekly','Monthly','MaxSize')] - [String] - $LogPeriod, - - [ValidateScript({ - ([ValidateRange(1048576, 4294967295)] $valueAsUInt64 = [UInt64]::Parse($_)) - })] - [String] - $LogTruncateSize, - - [Boolean] - $LoglocalTimeRollover, - - [ValidateSet('IIS','W3C','NCSA')] - [String] - $LogFormat - ) - - Assert-Module - - $inDesiredState = $true - - $website = Get-Website | Where-Object -FilterScript {$_.Name -eq $Name} - - # Check Ensure - if (($Ensure -eq 'Present' -and $null -eq $website) -or ` - ($Ensure -eq 'Absent' -and $null -ne $website)) - { - $inDesiredState = $false - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseEnsure ` - -f $Name) - } - - # Only check properties if website exists - if ($Ensure -eq 'Present' -and ` - $null -ne $website) - { - # Check Physical Path property - if ([String]::IsNullOrEmpty($PhysicalPath) -eq $false -and ` - $website.PhysicalPath -ne $PhysicalPath) - { - $inDesiredState = $false - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalsePhysicalPath ` - -f $Name) - } - - # Check State - if ($PSBoundParameters.ContainsKey('State') -and $website.State -ne $State) - { - $inDesiredState = $false - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseState ` - -f $Name) - } - - # Check Application Pool property - if ($PSBoundParameters.ContainsKey('ApplicationPool') -and ` - $website.ApplicationPool -ne $ApplicationPool) - { - $inDesiredState = $false - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseApplicationPool ` - -f $Name) - } - - # Check Binding properties - if ($PSBoundParameters.ContainsKey('BindingInfo') -and ` - $null -ne $BindingInfo) - { - if (-not (Test-WebsiteBinding -Name $Name -BindingInfo $BindingInfo)) - { - $inDesiredState = $false - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseBindingInfo ` - -f $Name) - } - } - - # Check Enabled Protocols - if ($PSBoundParameters.ContainsKey('EnabledProtocols') -and ` - $website.EnabledProtocols -ne $EnabledProtocols) - { - $inDesiredState = $false - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseEnabledProtocols ` - -f $Name) - } - - # Check Default Pages - if ($PSBoundParameters.ContainsKey('DefaultPage') -and ` - $null -ne $DefaultPage) - { - $allDefaultPages = @( - Get-WebConfiguration -Filter '//defaultDocument/files/*' ` - -PSPath "IIS:\Sites\$Name" | - ForEach-Object -Process { Write-Output -InputObject $_.value } - ) - - foreach ($page in $DefaultPage) - { - if ($allDefaultPages -inotcontains $page) - { - $inDesiredState = $false - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseDefaultPage ` - -f $Name) - } - } - } - - #Check AuthenticationInfo - if ($PSBoundParameters.ContainsKey('AuthenticationInfo') -and ` - (-not (Test-AuthenticationInfo -Site $Name ` - -AuthenticationInfo $AuthenticationInfo))) - { - $inDesiredState = $false - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseAuthenticationInfo) - } - - #Check Preload - if($PSBoundParameters.ContainsKey('preloadEnabled') -and ` - $website.applicationDefaults.preloadEnabled -ne $PreloadEnabled) - { - $inDesiredState = $false - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalsePreload ` - -f $Name) - } - - #Check AutoStartEnabled - if($PSBoundParameters.ContainsKey('serviceAutoStartEnabled') -and ` - $website.applicationDefaults.serviceAutoStartEnabled -ne $ServiceAutoStartEnabled) - { - $inDesiredState = $false - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseAutoStart ` - -f $Name) - } - - #Check AutoStartProviders - if($PSBoundParameters.ContainsKey('serviceAutoStartProvider') -and ` - $website.applicationDefaults.serviceAutoStartProvider -ne $ServiceAutoStartProvider) - { - if (-not (Confirm-UniqueServiceAutoStartProviders ` - -serviceAutoStartProvider $ServiceAutoStartProvider ` - -ApplicationType $ApplicationType)) - { - $inDesiredState = $false - Write-Verbose -Message ($LocalizedData.VerboseSetTargetIISAutoStartProviderUpdated) - } - } - - # Check LogFormat - if ($PSBoundParameters.ContainsKey('LogFormat')) - { - # Warn if LogFlags are passed in and Current LogFormat is not W3C - if ($PSBoundParameters.ContainsKey('LogFlags') -and ` - $LogFormat -ne 'W3C') - { - Write-Verbose -Message ($LocalizedData.WarningIncorrectLogFormat ` - -f $Name) - } - - # Warn if LogFlags are passed in and Desired LogFormat is not W3C - if($PSBoundParameters.ContainsKey('LogFlags') -and ` - $website.logfile.LogFormat -ne 'W3C') - { - Write-Verbose -Message ($LocalizedData.WarningIncorrectLogFormat ` - -f $Name) - } - - # Check Log Format - if ($LogFormat -ne $website.logfile.LogFormat) - { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseLogFormat ` - -f $Name) - return $false - } - } - - # Check LogFlags - if ($PSBoundParameters.ContainsKey('LogFlags') -and ` - (-not (Compare-LogFlags -Name $Name -LogFlags $LogFlags))) - { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseLogFlags) - return $false - } - - # Check LogPath - if ($PSBoundParameters.ContainsKey('LogPath') -and ` - ($LogPath -ne $website.logfile.directory)) - { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseLogPath ` - -f $Name) - return $false - } - - # Check LogPeriod - if ($PSBoundParameters.ContainsKey('LogPeriod') -and ` - ($LogPeriod -ne $website.logfile.period)) - { - if ($PSBoundParameters.ContainsKey('LogTruncateSize')) - { - Write-Verbose -Message ($LocalizedData.WarningLogPeriod ` - -f $Name) - } - - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseLogPeriod ` - -f $Name) - return $false - } - - # Check LogTruncateSize - if ($PSBoundParameters.ContainsKey('LogTruncateSize') -and ` - ($LogTruncateSize -ne $website.logfile.LogTruncateSize)) - { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseLogTruncateSize ` - -f $Name) - return $false - } - - # Check LoglocalTimeRollover - if ($PSBoundParameters.ContainsKey('LoglocalTimeRollover') -and ` - ($LoglocalTimeRollover -ne ` - ([System.Convert]::ToBoolean($website.logfile.LocalTimeRollover)))) - { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseLoglocalTimeRollover ` - -f $Name) - return $false - } - } - - if ($inDesiredState -eq $true) - { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetTrueResult) - } - else - { - Write-Verbose -Message ($LocalizedData.VerboseTestTargetFalseResult) - } - - return $inDesiredState -} - -#region Helper Functions - -<# - .SYNOPSIS - Helper function used to validate that the logflags status. - Returns False if the loglfags do not match and true if they do - - .PARAMETER LogFlags - Specifies flags to check - - .PARAMETER Name - Specifies website to check the flags on -#> -function Compare-LogFlags -{ - [CmdletBinding()] - [OutputType([Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [String[]] - [ValidateSet('Date','Time','ClientIP','UserName','SiteName','ComputerName','ServerIP','Method','UriStem','UriQuery','HttpStatus','Win32Status','BytesSent','BytesRecv','TimeTaken','ServerPort','UserAgent','Cookie','Referer','ProtocolVersion','Host','HttpSubStatus')] - $LogFlags, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Name - - ) - - $currentLogFlags = (Get-Website -Name $Name).logfile.logExtFileFlags -split ',' | Sort-Object - $proposedLogFlags = $LogFlags -split ',' | Sort-Object - - if (Compare-Object -ReferenceObject $currentLogFlags -DifferenceObject $proposedLogFlags) - { - return $false - } - - return $true - -} - -<# - .SYNOPSIS - Helper function used to validate that the website's binding information is unique to other - websites. Returns False if at least one of the bindings is already assigned to another - website. - - .PARAMETER Name - Specifies the name of the website. - - .PARAMETER ExcludeStopped - Omits stopped websites. - - .NOTES - This function tests standard ('http' and 'https') bindings only. - It is technically possible to assign identical non-standard bindings (such as 'net.tcp') - to different websites. -#> -function Confirm-UniqueBinding -{ - [CmdletBinding()] - [OutputType([Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Name, - - [Parameter(Mandatory = $false)] - [Switch] - $ExcludeStopped - ) - - $website = Get-Website | Where-Object -FilterScript { $_.Name -eq $Name } - - if (-not $website) - { - $errorMessage = $LocalizedData.ErrorWebsiteNotFound ` - -f $Name - New-TerminatingError -ErrorId 'WebsiteNotFound' ` - -ErrorMessage $errorMessage ` - -ErrorCategory 'InvalidResult' - } - - $referenceObject = @( - $website.bindings.Collection | - Where-Object -FilterScript { $_.protocol -in @('http', 'https') } | - ConvertTo-WebBinding -Verbose:$false - ) - - if ($ExcludeStopped) - { - $otherWebsiteFilter = { $_.Name -ne $website.Name -and $_.State -ne 'Stopped' } - } - else - { - $otherWebsiteFilter = { $_.Name -ne $website.Name } - } - - $differenceObject = @( - Get-Website | - Where-Object -FilterScript $otherWebsiteFilter | - ForEach-Object -Process { $_.bindings.Collection } | - Where-Object -FilterScript { $_.protocol -in @('http', 'https') } | - ConvertTo-WebBinding -Verbose:$false - ) - - # Assume that bindings are unique - $result = $true - - $compareSplat = @{ - ReferenceObject = $referenceObject - DifferenceObject = $differenceObject - Property = @('protocol', 'bindingInformation') - ExcludeDifferent = $true - IncludeEqual = $true - } - - if (Compare-Object @compareSplat) - { - $result = $false - } - - return $result -} - -<# - .SYNOPSIS - Helper function used to validate that the AutoStartProviders is unique to other websites. - returns False if the AutoStartProviders exist. - - .PARAMETER ServiceAutoStartProvider - Specifies the name of the AutoStartProviders. - - .PARAMETER ApplicationType - Specifies the name of the Application Type for the AutoStartProvider. - - .NOTES - This tests for the existance of a AutoStartProviders which is globally assigned. - As AutoStartProviders need to be uniquely named it will check for this and error out if - attempting to add a duplicatly named AutoStartProvider. - Name is passed in to bubble to any error messages during the test. -#> -function Confirm-UniqueServiceAutoStartProviders -{ - [CmdletBinding()] - [OutputType([Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [String] - $ServiceAutoStartProvider, - - [Parameter(Mandatory = $true)] - [String] - $ApplicationType - ) - - $websiteASP = (Get-WebConfiguration ` - -filter /system.applicationHost/serviceAutoStartProviders).Collection - - $existingObject = $websiteASP | ` - Where-Object -Property Name -eq -Value $ServiceAutoStartProvider | ` - Select-Object Name,Type - - $proposedObject = @(New-Object -TypeName PSObject -Property @{ - name = $ServiceAutoStartProvider - type = $ApplicationType - }) - - if(-not $existingObject) - { - return $false - } - - if(-not (Compare-Object -ReferenceObject $existingObject ` - -DifferenceObject $proposedObject ` - -Property name)) - { - if(Compare-Object -ReferenceObject $existingObject ` - -DifferenceObject $proposedObject ` - -Property type) - { - $errorMessage = $LocalizedData.ErrorWebsiteTestAutoStartProviderFailure - New-TerminatingError -ErrorId 'ErrorWebsiteTestAutoStartProviderFailure' ` - -ErrorMessage $errorMessage ` - -ErrorCategory 'InvalidResult'` - } - } - - return $true - -} - -<# - .SYNOPSIS - Converts IIS elements to instances of the MSFT_xWebBindingInformation CIM class. -#> -function ConvertTo-CimBinding -{ - [CmdletBinding()] - [OutputType([Microsoft.Management.Infrastructure.CimInstance])] - param - ( - [Parameter(Mandatory = $true, ValueFromPipeline = $true)] - [AllowEmptyCollection()] - [AllowNull()] - [Object[]] - $InputObject - ) - - begin - { - $cimClassName = 'MSFT_xWebBindingInformation' - $cimNamespace = 'root/microsoft/Windows/DesiredStateConfiguration' - } - - process - { - foreach ($binding in $InputObject) - { - [Hashtable]$cimProperties = @{ - Protocol = [String]$binding.protocol - BindingInformation = [String]$binding.bindingInformation - } - - if ($binding.Protocol -in @('http', 'https')) - { - # Extract IPv6 address - if ($binding.bindingInformation -match '^\[(.*?)\]\:(.*?)\:(.*?)$') - { - $IPAddress = $Matches[1] - $Port = $Matches[2] - $HostName = $Matches[3] - } - else - { - $IPAddress, $Port, $HostName = $binding.bindingInformation -split '\:' - } - - if ([String]::IsNullOrEmpty($IPAddress)) - { - $IPAddress = '*' - } - - $cimProperties.Add('IPAddress', [String]$IPAddress) - $cimProperties.Add('Port', [UInt16]$Port) - $cimProperties.Add('HostName', [String]$HostName) - } - else - { - $cimProperties.Add('IPAddress', [String]::Empty) - $cimProperties.Add('Port', [UInt16]::MinValue) - $cimProperties.Add('HostName', [String]::Empty) - } - - if ([Environment]::OSVersion.Version -ge '6.2') - { - $cimProperties.Add('SslFlags', [String]$binding.sslFlags) - } - - $cimProperties.Add('CertificateThumbprint', [String]$binding.certificateHash) - $cimProperties.Add('CertificateStoreName', [String]$binding.certificateStoreName) - - New-CimInstance -ClassName $cimClassName ` - -Namespace $cimNamespace ` - -Property $cimProperties ` - -ClientOnly - } - } -} - -<# - .SYNOPSIS - Converts instances of the MSFT_xWebBindingInformation CIM class to the IIS - element representation. - - .LINK - https://www.iis.net/configreference/system.applicationhost/sites/site/bindings/binding -#> -function ConvertTo-WebBinding -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true, ValueFromPipeline = $true)] - [AllowEmptyCollection()] - [AllowNull()] - [Object[]] - $InputObject - ) - process - { - foreach ($binding in $InputObject) - { - $outputObject = @{ - protocol = $binding.Protocol - } - - if ($binding -is [Microsoft.Management.Infrastructure.CimInstance]) - { - if ($binding.Protocol -in @('http', 'https')) - { - if (-not [String]::IsNullOrEmpty($binding.BindingInformation)) - { - if (-not [String]::IsNullOrEmpty($binding.IPAddress) -or - -not [String]::IsNullOrEmpty($binding.Port) -or - -not [String]::IsNullOrEmpty($binding.HostName) - ) - { - $isJoinRequired = $true - Write-Verbose -Message ` - ($LocalizedData.VerboseConvertToWebBindingIgnoreBindingInformation ` - -f $binding.Protocol) - } - else - { - $isJoinRequired = $false - } - } - else - { - $isJoinRequired = $true - } - - # Construct the bindingInformation attribute - if ($isJoinRequired -eq $true) - { - $ipAddressString = Format-IPAddressString -InputString $binding.IPAddress ` - -ErrorAction Stop - - if ([String]::IsNullOrEmpty($binding.Port)) - { - switch ($binding.Protocol) - { - 'http' { $portNumberString = '80' } - 'https' { $portNumberString = '443' } - } - - Write-Verbose -Message ` - ($LocalizedData.VerboseConvertToWebBindingDefaultPort ` - -f $binding.Protocol, $portNumberString) - } - else - { - if (Test-PortNumber -InputString $binding.Port) - { - $portNumberString = $binding.Port - } - else - { - $errorMessage = $LocalizedData.ErrorWebBindingInvalidPort ` - -f $binding.Port - New-TerminatingError -ErrorId 'WebBindingInvalidPort' ` - -ErrorMessage $errorMessage ` - -ErrorCategory 'InvalidArgument' - } - } - - $bindingInformation = $ipAddressString, ` - $portNumberString, ` - $binding.HostName -join ':' - $outputObject.Add('bindingInformation', [String]$bindingInformation) - } - else - { - $outputObject.Add('bindingInformation', [String]$binding.BindingInformation) - } - } - else - { - if ([String]::IsNullOrEmpty($binding.BindingInformation)) - { - $errorMessage = $LocalizedData.ErrorWebBindingMissingBindingInformation ` - -f $binding.Protocol - New-TerminatingError -ErrorId 'WebBindingMissingBindingInformation' ` - -ErrorMessage $errorMessage ` - -ErrorCategory 'InvalidArgument' - } - else - { - $outputObject.Add('bindingInformation', [String]$binding.BindingInformation) - } - } - - # SSL-related properties - if ($binding.Protocol -eq 'https') - { - if ([String]::IsNullOrEmpty($binding.CertificateThumbprint)) - { - $errorMessage = $LocalizedData.ErrorWebBindingMissingCertificateThumbprint ` - -f $binding.Protocol - New-TerminatingError -ErrorId 'WebBindingMissingCertificateThumbprint' ` - -ErrorMessage $errorMessage ` - -ErrorCategory 'InvalidArgument' - } - - if ([String]::IsNullOrEmpty($binding.CertificateStoreName)) - { - $certificateStoreName = 'MY' - Write-Verbose -Message ` - ($LocalizedData.VerboseConvertToWebBindingDefaultCertificateStoreName ` - -f $certificateStoreName) - } - else - { - $certificateStoreName = $binding.CertificateStoreName - } - - # Remove the Left-to-Right Mark character - $certificateHash = $binding.CertificateThumbprint -replace '^\u200E' - - $outputObject.Add('certificateHash', [String]$certificateHash) - $outputObject.Add('certificateStoreName', [String]$certificateStoreName) - - if ([Environment]::OSVersion.Version -ge '6.2') - { - $sslFlags = [Int64]$binding.SslFlags - - if ($sslFlags -in @(1, 3) -and [String]::IsNullOrEmpty($binding.HostName)) - { - $errorMessage = $LocalizedData.ErrorWebBindingMissingSniHostName - New-TerminatingError -ErrorId 'WebBindingMissingSniHostName' ` - -ErrorMessage $errorMessage ` - -ErrorCategory 'InvalidArgument' - } - - $outputObject.Add('sslFlags', $sslFlags) - } - } - else - { - # Ignore SSL-related properties for non-SSL bindings - $outputObject.Add('certificateHash', [String]::Empty) - $outputObject.Add('certificateStoreName', [String]::Empty) - - if ([Environment]::OSVersion.Version -ge '6.2') - { - $outputObject.Add('sslFlags', [Int64]0) - } - } - } - else - { - <# - WebAdministration can throw the following exception if there are non-standard - bindings (such as 'net.tcp'): 'The data is invalid. - (Exception from HRESULT: 0x8007000D)' - - Steps to reproduce: - 1) Add 'net.tcp' binding - 2) Execute {Get-Website | ` - ForEach-Object {$_.bindings.Collection} | ` - Select-Object *} - - Workaround is to create a new custom object and use dot notation to - access binding properties. - #> - - $outputObject.Add('bindingInformation', [String]$binding.bindingInformation) - $outputObject.Add('certificateHash', [String]$binding.certificateHash) - $outputObject.Add('certificateStoreName', [String]$binding.certificateStoreName) - - if ([Environment]::OSVersion.Version -ge '6.2') - { - $outputObject.Add('sslFlags', [Int64]$binding.sslFlags) - } - } - - Write-Output -InputObject ([PSCustomObject]$outputObject) - } - } -} - -<# - .SYNOPSYS - Formats the input IP address string for use in the bindingInformation attribute. -#> -function Format-IPAddressString -{ - [CmdletBinding()] - [OutputType([String])] - param - ( - [Parameter(Mandatory = $true)] - [AllowEmptyString()] - [AllowNull()] - [String] - $InputString - ) - - if ([String]::IsNullOrEmpty($InputString) -or $InputString -eq '*') - { - $outputString = '*' - } - else - { - try - { - $ipAddress = [IPAddress]::Parse($InputString) - - switch ($ipAddress.AddressFamily) - { - 'InterNetwork' - { - $outputString = $ipAddress.IPAddressToString - } - 'InterNetworkV6' - { - $outputString = '[{0}]' -f $ipAddress.IPAddressToString - } - } - } - catch - { - $errorMessage = $LocalizedData.ErrorWebBindingInvalidIPAddress ` - -f $InputString, $_.Exception.Message - New-TerminatingError -ErrorId 'WebBindingInvalidIPAddress' ` - -ErrorMessage $errorMessage ` - -ErrorCategory 'InvalidArgument' - } - } - - return $outputString -} - -<# - .SYNOPSIS - Helper function used to validate that the authenticationProperties for an Application. - - .PARAMETER Site - Specifies the name of the Website. -#> -function Get-AuthenticationInfo -{ - [CmdletBinding()] - [OutputType([Microsoft.Management.Infrastructure.CimInstance])] - param - ( - [Parameter(Mandatory = $true)] - [String]$Site - ) - - $authenticationProperties = @{} - foreach ($type in @('Anonymous', 'Basic', 'Digest', 'Windows')) - { - $authenticationProperties[$type] = [String](Test-AuthenticationEnabled -Site $Site ` - -Type $type) - } - - return New-CimInstance ` - -ClassName MSFT_xWebAuthenticationInformation ` - -ClientOnly -Property $authenticationProperties -} - -<# - .SYNOPSIS - Helper function used to build a default CimInstance for AuthenticationInformation -#> -function Get-DefaultAuthenticationInfo -{ - New-CimInstance -ClassName MSFT_xWebAuthenticationInformation ` - -ClientOnly ` - -Property @{ Anonymous = $false; Basic = $false; Digest = $false; Windows = $false } -} - -<# - .SYNOPSIS - Helper function used to set authenticationProperties for an Application - - .PARAMETER Site - Specifies the name of the Website. - - .PARAMETER Type - Specifies the type of Authentication. - Limited to the set: ('Anonymous','Basic','Digest','Windows') - - .PARAMETER Enabled - Whether the Authentication is enabled or not. -#> -function Set-Authentication -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [String]$Site, - - [Parameter(Mandatory = $true)] - [ValidateSet('Anonymous','Basic','Digest','Windows')] - [String]$Type, - - [Boolean]$Enabled - ) - - Set-WebConfigurationProperty ` - -Filter /system.WebServer/security/authentication/${Type}Authentication ` - -Name enabled ` - -Value $Enabled ` - -Location $Site -} - -<# - .SYNOPSIS - Helper function used to validate that the authenticationProperties for an Application. - - .PARAMETER Site - Specifies the name of the Website. - - .PARAMETER AuthenticationInfo - A CimInstance of what state the AuthenticationInfo should be. -#> -function Set-AuthenticationInfo -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [String]$Site, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [Microsoft.Management.Infrastructure.CimInstance]$AuthenticationInfo - ) - - foreach ($type in @('Anonymous', 'Basic', 'Digest', 'Windows')) - { - $enabled = ($AuthenticationInfo.CimInstanceProperties[$type].Value -eq $true) - Set-Authentication -Site $Site -Type $type -Enabled $enabled - } -} - -<# - .SYNOPSIS - Helper function used to test the authenticationProperties state for an Application. - Will return that value which will either [String]True or [String]False - - .PARAMETER Site - Specifies the name of the Website. - - .PARAMETER Type - Specifies the type of Authentication. - Limited to the set: ('Anonymous','Basic','Digest','Windows'). -#> -function Test-AuthenticationEnabled -{ - [CmdletBinding()] - [OutputType([Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [String]$Site, - - [Parameter(Mandatory = $true)] - [ValidateSet('Anonymous','Basic','Digest','Windows')] - [String]$Type - ) - - - $prop = Get-WebConfigurationProperty ` - -Filter /system.WebServer/security/authentication/${Type}Authentication ` - -Name enabled ` - -Location $Site - - return $prop.Value -} - -<# - .SYNOPSIS - Helper function used to test the authenticationProperties state for an Application. - Will return that result for use in Test-TargetResource. Uses Test-AuthenticationEnabled - to determine this. First incorrect result will break this function out. - - .PARAMETER Site - Specifies the name of the Website. - - .PARAMETER AuthenticationInfo - A CimInstance of what state the AuthenticationInfo should be. -#> -function Test-AuthenticationInfo -{ - [CmdletBinding()] - [OutputType([Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [String]$Site, - - [Parameter(Mandatory=$true)] - [ValidateNotNullOrEmpty()] - [Microsoft.Management.Infrastructure.CimInstance]$AuthenticationInfo - ) - - $result = $true - - foreach ($type in @('Anonymous', 'Basic', 'Digest', 'Windows')) - { - $expected = $AuthenticationInfo.CimInstanceProperties[$type].Value - $actual = Test-AuthenticationEnabled -Site $Site -Type $type - if ($expected -ne $actual) - { - $result = $false - break - } - } - - return $result -} - -<# - .SYNOPSIS - Validates the desired binding information (i.e. no duplicate IP address, port, and - host name combinations). -#> -function Test-BindingInfo -{ - [CmdletBinding()] - [OutputType([Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [Microsoft.Management.Infrastructure.CimInstance[]] - $BindingInfo - ) - - $isValid = $true - - try - { - # Normalize the input (helper functions will perform additional validations) - $bindings = @(ConvertTo-WebBinding -InputObject $bindingInfo | ConvertTo-CimBinding) - $standardBindings = @($bindings | ` - Where-Object -FilterScript {$_.Protocol -in @('http', 'https')}) - $nonStandardBindings = @($bindings | ` - Where-Object -FilterScript {$_.Protocol -notin @('http', 'https')}) - - if ($standardBindings.Count -ne 0) - { - # IP address, port, and host name combination must be unique - if (($standardBindings | Group-Object -Property IPAddress, Port, HostName) | ` - Where-Object -FilterScript {$_.Count -ne 1}) - { - $isValid = $false - Write-Verbose -Message ` - ($LocalizedData.VerboseTestBindingInfoSameIPAddressPortHostName) - } - - # A single port cannot be simultaneously specified for bindings with different protocols - foreach ($groupByPort in ($standardBindings | Group-Object -Property Port)) - { - if (($groupByPort.Group | Group-Object -Property Protocol).Length -ne 1) - { - $isValid = $false - Write-Verbose -Message ` - ($LocalizedData.VerboseTestBindingInfoSamePortDifferentProtocol) - break - } - } - } - - if ($nonStandardBindings.Count -ne 0) - { - if (($nonStandardBindings | ` - Group-Object -Property Protocol, BindingInformation) | ` - Where-Object -FilterScript {$_.Count -ne 1}) - { - $isValid = $false - Write-Verbose -Message ` - ($LocalizedData.VerboseTestBindingInfoSameProtocolBindingInformation) - } - } - } - catch - { - $isValid = $false - Write-Verbose -Message ($LocalizedData.VerboseTestBindingInfoInvalidCatch ` - -f $_.Exception.Message) - } - - return $isValid -} - -<# - .SYNOPSIS - Validates that an input string represents a valid port number. - The port number must be a positive integer between 1 and 65535. -#> -function Test-PortNumber -{ - [CmdletBinding()] - [OutputType([Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [AllowEmptyString()] - [AllowNull()] - [String] - $InputString - ) - - try - { - $isValid = [UInt16]$InputString -ne 0 - } - catch - { - $isValid = $false - } - - return $isValid -} - -<# - .SYNOPSIS - Helper function used to validate and compare website bindings of current to desired. - Returns True if bindings do not need to be updated. -#> -function Test-WebsiteBinding -{ - [CmdletBinding()] - [OutputType([Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Name, - - [Parameter(Mandatory = $true)] - [Microsoft.Management.Infrastructure.CimInstance[]] - $BindingInfo - ) - - $inDesiredState = $true - - # Ensure that desired binding information is valid (i.e. no duplicate IP address, port, and - # host name combinations). - if (-not (Test-BindingInfo -BindingInfo $BindingInfo)) - { - $errorMessage = $LocalizedData.ErrorWebsiteBindingInputInvalidation ` - -f $Name - New-TerminatingError -ErrorId 'WebsiteBindingInputInvalidation' ` - -ErrorMessage $errorMessage ` - -ErrorCategory 'InvalidResult' - } - - try - { - $website = Get-Website | Where-Object -FilterScript {$_.Name -eq $Name} - - # Normalize binding objects to ensure they have the same representation - $currentBindings = @(ConvertTo-WebBinding -InputObject $website.bindings.Collection ` - -Verbose:$false) - $desiredBindings = @(ConvertTo-WebBinding -InputObject $BindingInfo ` - -Verbose:$false) - - $propertiesToCompare = 'protocol', ` - 'bindingInformation', ` - 'certificateHash', ` - 'certificateStoreName' - - # The sslFlags attribute was added in IIS 8.0. - # This check is needed for backwards compatibility with Windows Server 2008 R2. - if ([Environment]::OSVersion.Version -ge '6.2') - { - $propertiesToCompare += 'sslFlags' - } - - if (Compare-Object -ReferenceObject $currentBindings ` - -DifferenceObject $desiredBindings ` - -Property $propertiesToCompare) - { - $inDesiredState = $false - } - } - catch - { - $errorMessage = $LocalizedData.ErrorWebsiteCompareFailure ` - -f $Name, $_.Exception.Message - New-TerminatingError -ErrorId 'WebsiteCompareFailure' ` - -ErrorMessage $errorMessage ` - -ErrorCategory 'InvalidResult' - } - - return $inDesiredState -} - -<# - .SYNOPSIS - Helper function used to update default pages of website. -#> -function Update-DefaultPage -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [String] - $Name, - - [Parameter(Mandatory = $true)] - [String[]] - $DefaultPage - ) - - $allDefaultPages = @( - Get-WebConfiguration -Filter '//defaultDocument/files/*' ` - -PSPath "IIS:\Sites\$Name" | - ForEach-Object -Process { Write-Output -InputObject $_.value } - ) - - foreach ($page in $DefaultPage) - { - if ($allDefaultPages -inotcontains $page) - { - Add-WebConfiguration -Filter '//defaultDocument/files' ` - -PSPath "IIS:\Sites\$Name" ` - -Value @{ value = $page } - Write-Verbose -Message ($LocalizedData.VerboseUpdateDefaultPageUpdated ` - -f $Name, $page) - } - } -} - -<# - .SYNOPSIS - Updates website bindings. -#> -function Update-WebsiteBinding -{ - [CmdletBinding()] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] - $Name, - - [Parameter(Mandatory = $false)] - [Microsoft.Management.Infrastructure.CimInstance[]] - $BindingInfo - ) - - # Use Get-WebConfiguration instead of Get-Website to retrieve XPath of the target website. - # XPath -Filter is case-sensitive. Use Where-Object to get the target website by name. - $website = Get-WebConfiguration -Filter '/system.applicationHost/sites/site' | - Where-Object -FilterScript {$_.Name -eq $Name} - - if (-not $website) - { - $errorMessage = $LocalizedData.ErrorWebsiteNotFound ` - -f $Name - New-TerminatingError -ErrorId 'WebsiteNotFound' ` - -ErrorMessage $errorMessage ` - -ErrorCategory 'InvalidResult' - } - - ConvertTo-WebBinding -InputObject $BindingInfo -ErrorAction Stop | - ForEach-Object -Begin { - Clear-WebConfiguration -Filter "$($website.ItemXPath)/bindings" -Force -ErrorAction Stop - } -Process { - - $properties = $_ - - try - { - Add-WebConfiguration -Filter "$($website.ItemXPath)/bindings" -Value @{ - protocol = $properties.protocol - bindingInformation = $properties.bindingInformation - } -Force -ErrorAction Stop - } - catch - { - $errorMessage = $LocalizedData.ErrorWebsiteBindingUpdateFailure ` - -f $Name, $_.Exception.Message - New-TerminatingError -ErrorId 'WebsiteBindingUpdateFailure' ` - -ErrorMessage $errorMessage ` - -ErrorCategory 'InvalidResult' - } - - if ($properties.protocol -eq 'https') - { - if ([Environment]::OSVersion.Version -ge '6.2') - { - try - { - Set-WebConfigurationProperty ` - -Filter "$($website.ItemXPath)/bindings/binding[last()]" ` - -Name sslFlags ` - -Value $properties.sslFlags ` - -Force ` - -ErrorAction Stop - } - catch - { - $errorMessage = $LocalizedData.ErrorWebsiteBindingUpdateFailure ` - -f $Name, $_.Exception.Message - New-TerminatingError ` - -ErrorId 'WebsiteBindingUpdateFailure' ` - -ErrorMessage $errorMessage ` - -ErrorCategory 'InvalidResult' - } - } - - try - { - $binding = Get-WebConfiguration ` - -Filter "$($website.ItemXPath)/bindings/binding[last()]" ` - -ErrorAction Stop - $binding.AddSslCertificate($properties.certificateHash, ` - $properties.certificateStoreName) - } - catch - { - $errorMessage = $LocalizedData.ErrorWebBindingCertificate ` - -f $properties.certificateHash, $_.Exception.Message - New-TerminatingError ` - -ErrorId 'WebBindingCertificate' ` - -ErrorMessage $errorMessage ` - -ErrorCategory 'InvalidOperation' - } - } - } -} - -#endregion - -Export-ModuleMember -Function *-TargetResource - - diff --git a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebsite/MSFT_xWebsite.schema.mof b/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebsite/MSFT_xWebsite.schema.mof deleted file mode 100644 index fc452e3e..00000000 --- a/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebsite/MSFT_xWebsite.schema.mof +++ /dev/null @@ -1,45 +0,0 @@ -[ClassVersion("1.0.0")] -class MSFT_xWebBindingInformation -{ - [Required,ValueMap{"http","https","msmq.formatname","net.msmq","net.pipe","net.tcp"},Values{"http","https","msmq.formatname","net.msmq","net.pipe","net.tcp"}] String Protocol; - [Write] String BindingInformation; - [Write] String IPAddress; - [Write] UInt16 Port; - [Write] String HostName; - [Write] String CertificateThumbprint; - [Write,ValueMap{"My", "WebHosting"},Values{"My", "WebHosting"}] String CertificateStoreName; - [Write,ValueMap{"0","1","2","3"},Values{"0","1","2","3"}] String SslFlags; -}; - -[ClassVersion("1.0.0")] -class MSFT_xWebAuthenticationInformation -{ - [Write] Boolean Anonymous; - [Write] Boolean Basic; - [Write] Boolean Digest; - [Write] Boolean Windows; -}; - -[ClassVersion("2.0.0"), FriendlyName("xWebsite")] -class MSFT_xWebsite : OMI_BaseResource -{ - [Write,ValueMap{"Present", "Absent"},Values{"Present", "Absent"}] String Ensure; - [Key] String Name; - [Write] String PhysicalPath; - [Write,ValueMap{"Started","Stopped"},Values{"Started", "Stopped"}] String State; - [Write] String ApplicationPool; - [Write, EmbeddedInstance("MSFT_xWebBindingInformation"), Description("Website's binding information in the form of an array of embedded instances of the MSFT_xWebBindingInformation CIM class.")] String BindingInfo[]; - [Write] String DefaultPage[]; - [Write] String EnabledProtocols; - [write, EmbeddedInstance("MSFT_xWebAuthenticationInformation"), Description("Hashtable containing authentication information (Anonymous, Basic, Digest, Windows)")] String AuthenticationInfo; - [Write, Description ("Allows the Website to automatically start without a request")] Boolean PreloadEnabled; - [Write, Description ("Enables Autostart on a Website.")] Boolean ServiceAutoStartEnabled; - [Write, Description ("Adds a AutostartProvider")] String ServiceAutoStartProvider; - [Write, Description ("Adds a AutostartProvider ApplicationType")] String ApplicationType; - [Write, Description ("The directory to be used for logfiles")] String LogPath; - [Write, Description ("The W3C logging fields"), ValueMap{"Date","Time","ClientIP","UserName","SiteName","ComputerName","ServerIP","Method","UriStem","UriQuery","HttpStatus","Win32Status","BytesSent","BytesRecv","TimeTaken","ServerPort","UserAgent","Cookie","Referer","ProtocolVersion","Host","HttpSubStatus"},Values{"Date","Time","ClientIP","UserName","SiteName","ComputerName","ServerIP","Method","UriStem","UriQuery","HttpStatus","Win32Status","BytesSent","BytesRecv","TimeTaken","ServerPort","UserAgent","Cookie","Referer","ProtocolVersion","Host","HttpSubStatus"}] String LogFlags[]; - [Write, Description ("How often the log file should rollover"), ValueMap{"Hourly","Daily","Weekly","Monthly","MaxSize"},Values{"Hourly","Daily","Weekly","Monthly","MaxSize"}] String LogPeriod; - [Write, Description ("How large the file should be before it is truncated")] String LogTruncateSize; - [Write, Description ("Use the localtime for file naming and rollover")] Boolean LoglocalTimeRollover; - [Write, Description ("Format of the Logfiles. Only W3C supports LogFlags"), ValueMap{"IIS","W3C","NCSA"}, Values{"IIS","W3C","NCSA"}] String LogFormat; -}; diff --git a/lib/puppet_x/dsc_resources/xWebAdministration/LICENSE b/lib/puppet_x/dsc_resources/xWebAdministration/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xWebAdministration/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xWebAdministration/xWebAdministration.psd1 b/lib/puppet_x/dsc_resources/xWebAdministration/xWebAdministration.psd1 deleted file mode 100644 index c03ad7c8..00000000 --- a/lib/puppet_x/dsc_resources/xWebAdministration/xWebAdministration.psd1 +++ /dev/null @@ -1,69 +0,0 @@ -@{ -# Version number of this module. -ModuleVersion = '1.18.0.0' - -# ID used to uniquely identify this module -GUID = 'b3239f27-d7d3-4ae6-a5d2-d9a1c97d6ae4' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2013 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'Module with DSC Resources for Web Administration' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Minimum version of the common language runtime (CLR) required by this module -CLRVersion = '4.0' - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/xWebAdministration/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/xWebAdministration' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - ReleaseNotes = '* Added sample for **xWebVirtualDirectory** for creating a new virtual directory. Bugfix for 195. -* Added integration tests for **xWebVirtualDirectory**. Fixes 188. -* xWebsite: - * Fixed bugs when setting log properties, fixes 299. - -' - - } # End of PSData hashtable - -} # End of PrivateData hashtable - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' -} - - - - - - - - - diff --git a/lib/puppet_x/dsc_resources/xWebDeploy/DSCResources/xWebDeploy/xWebDeploy.Schema.psm1 b/lib/puppet_x/dsc_resources/xWebDeploy/DSCResources/xWebDeploy/xWebDeploy.Schema.psm1 deleted file mode 100644 index 8907c3ab..00000000 --- a/lib/puppet_x/dsc_resources/xWebDeploy/DSCResources/xWebDeploy/xWebDeploy.Schema.psm1 +++ /dev/null @@ -1,73 +0,0 @@ -# Composite configuration to install the Web Deploy 3.5 IIS extension (MSDeploy) from default URL : http://go.microsoft.com/fwlink/?LinkID=309497. Supports MSWebDeploy sync, dump verbs with iisApp , contentPath parameters. -# Examples of sync verb used with ContentPath and iisApp paramters: -# -verb:sync -source:package=$SourcePath -dest:contentPath=$Destination -# -verb:sync -source:package=$SourcePath -dest:iisApp=$Destination -# -# Default path where the resource is expected to be placed: $env:ProgramFiles# \WindowsPowerShell\Modules\xWebDeploy\InstallerMsi . -# Change the default path if needed. - -#Install Web Deploy 3.5 -Configuration xInstallWebDeploy -{ - param - ( - [Parameter(Mandatory = $true)] - [Validateset("Present","Absent")] - [String] - $Ensure, - - [string] $WebDeployMsi = "http://go.microsoft.com/fwlink/?LinkID=309497" - - ) - - Package InstallWebDeployTool - { - Path = $WebDeployMsi - ProductId = "{1A81DA24-AF0B-4406-970E-54400D6EC118}" - Name = "Microsoft Web Deploy 3.5" - Arguments = "/quiet" - Ensure = $Ensure - } -} - -# Composite configuration to install an IIS site from a given package. Note that the package has to be created using webdeploy extension. -Configuration xWebDeploy -{ - param( - - [Parameter(Mandatory = $true)] - [string] $SourcePath, - - [Parameter(Mandatory = $true)] - [string] $Destination, - - [Parameter(Mandatory = $true)] - [Validateset("Present","Absent")] - [String] - $Ensure, - - [string] $WebDeployMsi = "http://go.microsoft.com/fwlink/?LinkID=309497" - - - ) - Import-DSCResource -Name xWebPackageDeploy - #Install WebDeploy IIS extension on the machine - xInstallWebDeploy InstallWebDeployTool - { - Ensure = $Ensure - WebDeployMsi = $WebDeployMsi - } - - #Deploy a web package in IIS - xWebPackageDeploy DeployWebPackage - { - SourcePath = $SourcePath - Destination = $Destination - Ensure = $Ensure - - } -} - -Export-ModuleMember -Function xInstallWebDeploy -Export-ModuleMember -Function xWebDeploy - diff --git a/lib/puppet_x/dsc_resources/xWebDeploy/DSCResources/xWebDeploy/xWebDeploy.psd1 b/lib/puppet_x/dsc_resources/xWebDeploy/DSCResources/xWebDeploy/xWebDeploy.psd1 deleted file mode 100644 index 96327c45..00000000 --- a/lib/puppet_x/dsc_resources/xWebDeploy/DSCResources/xWebDeploy/xWebDeploy.psd1 +++ /dev/null @@ -1,96 +0,0 @@ -# -# Module manifest for module composite resource 'xWebDeploy' -# -# Generated on: 8/23/2014 -# - -@{ - -# Script module or binary module file associated with this manifest. -RootModule = 'xWebDeploy.Schema.psm1' - -# Version number of this module. -ModuleVersion = '1.0' - -# ID used to uniquely identify this module -GUID = '09ad042a-8bd0-4045-b771-f2ac9b62fbdf' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft. All rights reserved.' - -# Description of the functionality provided by this module -# Description = '' - -# Minimum version of the Windows PowerShell engine required by this module -# PowerShellVersion = '' - -# Name of the Windows PowerShell host required by this module -# PowerShellHostName = '' - -# Minimum version of the Windows PowerShell host required by this module -# PowerShellHostVersion = '' - -# Minimum version of Microsoft .NET Framework required by this module -# DotNetFrameworkVersion = '' - -# Minimum version of the common language runtime (CLR) required by this module -# CLRVersion = '' - -# Processor architecture (None, X86, Amd64) required by this module -# ProcessorArchitecture = '' - -# Modules that must be imported into the global environment prior to importing this module -# RequiredModules = @() - -# Assemblies that must be loaded prior to importing this module -# RequiredAssemblies = @() - -# Script files (.ps1) that are run in the caller's environment prior to importing this module. -# ScriptsToProcess = @() - -# Type files (.ps1xml) to be loaded when importing this module -# TypesToProcess = @() - -# Format files (.ps1xml) to be loaded when importing this module -# FormatsToProcess = @() - -# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess -# NestedModules = @() - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Variables to export from this module -VariablesToExport = '*' - -# Aliases to export from this module -AliasesToExport = '*' - -# List of all modules packaged with this module -# ModuleList = @() - -# List of all files packaged with this module -# FileList = @() - -# Private data to pass to the module specified in RootModule/ModuleToProcess -# PrivateData = '' - -# HelpInfo URI of this module -# HelpInfoURI = '' - -# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. -# DefaultCommandPrefix = '' - -} - - - diff --git a/lib/puppet_x/dsc_resources/xWebDeploy/DSCResources/xWebPackageDeploy/xWebPackageDeploy.psm1 b/lib/puppet_x/dsc_resources/xWebDeploy/DSCResources/xWebPackageDeploy/xWebPackageDeploy.psm1 deleted file mode 100644 index b293bb65..00000000 --- a/lib/puppet_x/dsc_resources/xWebDeploy/DSCResources/xWebPackageDeploy/xWebPackageDeploy.psm1 +++ /dev/null @@ -1,203 +0,0 @@ -######################################################################################################################################### -# xWebPackageDeploy module for deploying IIS WebSite using web deploy IIS extension. This resource assumes that WebDeploy tool -# is installed in IIS. -######################################################################################################################################### - - -######################################################################################################################################### -# Get-TargetResource ([string]$SourcePath, [string]$Destination) : given the package and IIS website name or content path, determine whether -# the package is deployed and return the result -######################################################################################################################################### - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [parameter(Mandatory = $true)] - [System.String] - $Destination - ) - - $appCmd = "$env:PROGRAMFILES\IIS\Microsoft Web Deploy V3\msdeploy.exe" - $ensure = "Absent" - Write-Verbose -Message "Calling msdeploy.exe to retrieve the site content in a zip file format" - & $appCmd -verb:sync "-source:contentPath=$Destination" "-dest:package=$SourcePath" - - # $Destination in this case points to website content full path. - if(Test-Path($Destination)) - { - $ensure = "Present" - } - else - { - # this is the case where $Destination points to IIS website name and not the website content path - $site = Get-ItemProperty -Path "IIS:\Sites\$Destination" -ErrorAction SilentlyContinue - if ($site -ne $null) - { - $path = $site.physicalPath - if(Test-Path($path)) - { - $ensure = "Present" - } - } - } - - $returnValue = @{ - SourcePath = $SourcePath - Destination = $Destination - Ensure = $ensure} - - $returnValue - -} - -######################################################################################################################################### -# Set-TargetResource ([string]$SourcePath, [string]$Destination, [string]$Ensure) : given the package and IIS website name or content path, deploy/remove -# the website content -######################################################################################################################################### - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [parameter(Mandatory = $true)] - [System.String] - $Destination, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present" - ) - - Write-Verbose -Message "Calling msdeploy.exe to sync the site content from a given zip package" - - $app = "$env:PROGRAMFILES\IIS\Microsoft Web Deploy V3" - - $appCmd = Join-Path $app -ChildPath "msdeploy.exe" - $appCmd = "& '$appCmd'" - - if($Ensure -eq "Present") - { - #sync the given package content into iis - - if($Destination.Contains("\")) - { - #this is the case when iis site content path is specified - $appCmd += "-verb:sync -source:package=$SourcePath -dest:contentPath=$Destination" - } - else - { - #this is the case when iis site name is specified - $appCmd += "-verb:sync -source:package=$SourcePath -dest:iisApp=$Destination" - } - Write-Verbose -Message $appCmd - Invoke-Expression $appCmd - - } - else - { - #delete the website content - if($Destination.Contains("\")) - { - # $SourcePath in this case points to physical path of the website. - Remove-Item -Path $Destination -Recurse -ErrorAction SilentlyContinue - } - else - { - # this is the case where $SourcePath points to IIS website name and not the actual path - $site = Get-ItemProperty -Path "IIS:\Sites\$Destination" -ErrorAction SilentlyContinue - if ($site -ne $null) - { - $path = $site.physicalPath - $files = Get-Item -Path $path -ErrorAction SilentlyContinue - Remove-Item -Path $files -Recurse -ErrorAction SilentlyContinue - } - } - - } -} - -######################################################################################################################################### -# Test-TargetResource ([string]$SourcePath, [string]$Destination, [string]$Ensure) : given the package and IIS website name or content path, -# determine whether the package is deployed or not. -######################################################################################################################################### - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $SourcePath, - - [parameter(Mandatory = $true)] - [System.String] - $Destination, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = "Present" - ) - $result = $false - $appCmd = "$env:PROGRAMFILES\IIS\Microsoft Web Deploy V3\msdeploy.exe" - - #get all the files from a given package - $packageFiles = & $appCmd -verb:dump "-source:package=$SourcePath" - - if($Ensure -eq "Present") - { - #find all the files for a given site - $siteFiles = & $appCmd -verb:dump "-source:contentPath=$Destination" - # the packages exported using webdeploy tool, contain 2 extra entries with site name. Skipping those.. - #compare based on the number of files - if(($packageFiles.Count -eq $siteFiles.Count) -or (($packageFiles.Count -2) -eq $siteFiles.Count) ) - { - $result = $true - } - } - else - { - #find the website's physical path if $Destination points to a site name - $site = Get-ItemProperty -Path "IIS:\Sites\$Destination" -ErrorAction SilentlyContinue - if ($site -ne $null) - { - $path = $site.physicalPath - $files = Get-Item -Path $path -ErrorAction SilentlyContinue - if ($files -ne $null) - { - $f = $files.GetFiles() - } - if($f.Count >1) - { - $result = $true - } - } - #this is the case when $Destination points to the website's physical path - else - { - if(Test-Path($Destination)) - { - $result = $true - } - } - } - $result -} - - - - - diff --git a/lib/puppet_x/dsc_resources/xWebDeploy/DSCResources/xWebPackageDeploy/xWebPackageDeploy.schema.mof b/lib/puppet_x/dsc_resources/xWebDeploy/DSCResources/xWebPackageDeploy/xWebPackageDeploy.schema.mof deleted file mode 100644 index a1c6e81a..00000000 --- a/lib/puppet_x/dsc_resources/xWebDeploy/DSCResources/xWebPackageDeploy/xWebPackageDeploy.schema.mof +++ /dev/null @@ -1,12 +0,0 @@ -#pragma namespace("\\\\.\\root\\microsoft\\windows\\DesiredStateConfiguration") - -[ClassVersion("1.0.0.0"), FriendlyName("xWebPackageDeploy")] -class xWebPackageDeploy : OMI_BaseResource -{ - [Required, Description("Full path to the zip package.")] String SourcePath; - [Key, Description("WebDeploy destination for content path or website name).")] String Destination; - [Write, Description("Desired state of resource."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xWebDeploy/LICENSE b/lib/puppet_x/dsc_resources/xWebDeploy/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xWebDeploy/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xWebDeploy/xWebDeploy.psd1 b/lib/puppet_x/dsc_resources/xWebDeploy/xWebDeploy.psd1 deleted file mode 100644 index fb43765b..00000000 --- a/lib/puppet_x/dsc_resources/xWebDeploy/xWebDeploy.psd1 +++ /dev/null @@ -1,119 +0,0 @@ -# -# Module manifest for module composite resource 'xWebDeploy' -# -# Generated on: 8/23/2014 -# - -@{ - -# Script module or binary module file associated with this manifest. -RootModule = '' - -# Version number of this module. -ModuleVersion = '1.2.0.0' - -# ID used to uniquely identify this module -GUID = 'caf7c498-948e-4b0d-b877-15b0e173a4c5' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'DSC resources for installing an IIS site using the WebDeploy IIS extension' - -# Minimum version of the Windows PowerShell engine required by this module -# PowerShellVersion = '' - -# Name of the Windows PowerShell host required by this module -# PowerShellHostName = '' - -# Minimum version of the Windows PowerShell host required by this module -# PowerShellHostVersion = '' - -# Minimum version of Microsoft .NET Framework required by this module -# DotNetFrameworkVersion = '' - -# Minimum version of the common language runtime (CLR) required by this module -# CLRVersion = '' - -# Processor architecture (None, X86, Amd64) required by this module -# ProcessorArchitecture = '' - -# Modules that must be imported into the global environment prior to importing this module -# RequiredModules = @() - -# Assemblies that must be loaded prior to importing this module -# RequiredAssemblies = @() - -# Script files (.ps1) that are run in the caller's environment prior to importing this module. -# ScriptsToProcess = @() - -# Type files (.ps1xml) to be loaded when importing this module -# TypesToProcess = @() - -# Format files (.ps1xml) to be loaded when importing this module -# FormatsToProcess = @() - -# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess -# NestedModules = @() - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Variables to export from this module -VariablesToExport = '*' - -# Aliases to export from this module -AliasesToExport = '*' - -# List of all modules packaged with this module -# ModuleList = @() - -# List of all files packaged with this module -# FileList = @() - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/xWebDeploy/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/xWebDeploy' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - ReleaseNotes = '* xWebPackageDeploy: Fixed comparison to check if Destination contains any backslash - -' - - } # End of PSData hashtable - -} # End of PrivateData hashtable - -# HelpInfo URI of this module -# HelpInfoURI = '' - -# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. -# DefaultCommandPrefix = '' - -} - - - diff --git a/lib/puppet_x/dsc_resources/xWinEventLog/DSCResources/MSFT_xWinEventLog/MSFT_xWinEventLog.psm1 b/lib/puppet_x/dsc_resources/xWinEventLog/DSCResources/MSFT_xWinEventLog/MSFT_xWinEventLog.psm1 deleted file mode 100644 index 63778a26..00000000 --- a/lib/puppet_x/dsc_resources/xWinEventLog/DSCResources/MSFT_xWinEventLog/MSFT_xWinEventLog.psm1 +++ /dev/null @@ -1,240 +0,0 @@ -function New-TerminatingError -{ - param - ( - [Parameter(Mandatory)] - [String]$errorId, - - [Parameter(Mandatory)] - [String]$errorMessage, - - [Parameter(Mandatory)] - [System.Management.Automation.ErrorCategory]$errorCategory - ) - - $exception = New-Object System.InvalidOperationException $errorMessage - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - throw $errorRecord -} - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $LogName - ) - - try - { - $log = Get-WinEvent -ListLog $logName - $returnValue = @{ - LogName = [System.String]$LogName - LogFilePath = [system.String]$log.LogFilePath - MaximumSizeInBytes = [System.Int64]$log.MaximumSizeInBytes - IsEnabled = [System.Boolean]$log.IsEnabled - LogMode = [System.String]$log.LogMode - SecurityDescriptor = [System.String]$log.SecurityDescriptor - } - - return $returnValue - }catch - { - write-Debug "ERROR: $($_|fl * -force|out-string)" - New-TerminatingError -errorId 'GetWinEventLogFailed' -errorMessage $_.Exception -errorCategory InvalidOperation - } -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $LogName, - - [System.Int64] - $MaximumSizeInBytes, - - [System.Boolean] - $IsEnabled, - - [ValidateSet("AutoBackup","Circular","Retain")] - [System.String] - $LogMode, - - [System.String] - $SecurityDescriptor, - - [System.String] - $LogFilePath - ) - - try - { - $log = Get-WinEvent -ListLog $logName - $update = $false - - if ($PSBoundParameters.ContainsKey('MaximumSizeInBytes') -and $MaximumSizeInBytes -ne $log.MaximumSizeInBytes) { - Set-MaximumSizeInBytes -LogName $LogName -MaximumSizeInBytes $MaximumSizeInBytes - } - - if ($PSBoundParameters.ContainsKey('LogMode') -and $LogMode -ne $log.LogMode){ - Set-LogMode -LogName $LogName -LogMode $LogMode - } - - if ($PSBoundParameters.ContainsKey('SecurityDescriptor') -and $SecurityDescriptor -ne $log.SecurityDescriptor) { - Set-SecurityDescriptor -LogName $LogName -SecurityDescriptor $SecurityDescriptor - } - - if ($PSBoundParameters.ContainsKey("IsEnabled") -and $IsEnabled -ne $log.IsEnabled) { - Set-IsEnabled -LogName $LogName -IsEnabled $IsEnabled - } - - if ($PSBoundParameters.ContainsKey("LogFilePath") -and $LogFilePath -ne $log.LogFilePath) { - Set-LogFilePath -LogName $LogName -LogFilePath $LogFilePath - } - - - }catch - { - Write-Debug "ERROR: $($_|fl * -force|out-string)" - New-TerminatingError -errorId 'SetWinEventLogFailed' -errorMessage $_.Exception -errorCategory InvalidOperation - } - - -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $LogName, - - [System.Int64] - $MaximumSizeInBytes, - - [System.Boolean] - $IsEnabled, - - [ValidateSet("AutoBackup","Circular","Retain")] - [System.String] - $LogMode, - - [System.String] - $SecurityDescriptor, - - [System.String] - $LogFilePath - ) - - try - { - $log = Get-WinEvent -ListLog $logName - if ($PSBoundParameters.ContainsKey("MaximumSizeInBytes") -and $log.MaximumSizeInBytes -ne $MaximumSizeInBytes ) { return $false} - if ($PSBoundParameters.ContainsKey("IsEnabled") -and $log.IsEnabled -ne $IsEnabled ) { return $false} - if ($PSBoundParameters.ContainsKey("LogMode") -and $log.LogMode -ne $LogMode ) { return $false} - if ($PSBoundParameters.ContainsKey("SecurityDescriptor") -and $log.SecurityDescriptor -ne $SecurityDescriptor ) { return $false} - if ($PSBoundParameters.ContainsKey("LogFilePath") -and $log.LogFilePath -ne $LogFilePath ) { return $false} - return $true - }catch - { - write-Debug "ERROR: $($_|fl * -force|out-string)" - New-TerminatingError -errorId 'TestWinEventLogFailed' -errorMessage $_.Exception -errorCategory InvalidOperation - } - -} - -Function Set-MaximumSizeInBytes{ - [CmdletBinding()] - param( - [System.String] - $LogName, - - [System.Int64] - $MaximumSizeInBytes - - ) - - $log = Get-WinEvent -ListLog $logName - $log.MaximumSizeInBytes = $MaximumSizeInBytes - $log.SaveChanges() - -} - -Function Set-LogMode{ - [CmdletBinding()] - param( - [System.String] - $LogName, - - [System.String] - $LogMode - ) - - $log = Get-WinEvent -ListLog $LogName - $log.LogMode = $LogMode - $log.SaveChanges() -} - -Function Set-SecurityDescriptor{ - [CmdletBinding()] - param( - [System.String] - $LogName, - - [System.String] - $SecurityDescriptor - ) - - $log = Get-WinEvent -ListLog $LogName - $log.SecurityDescriptor = $SecurityDescriptor - $log.SaveChanges() -} - - -Function Set-IsEnabled{ - [CmdletBinding()] - param( - [System.String] - $LogName, - - [System.Boolean] - $IsEnabled - ) - - $log = Get-WinEvent -ListLog $LogName - $log.IsEnabled = $IsEnabled - $log.SaveChanges() - -} - -Function Set-LogFilePath{ - [CmdletBinding()] - param( - [System.String] - $LogName, - - [System.String] - $LogFilePath - ) - - $log = Get-WinEvent -ListLog $LogName - $log.LogFilePath = $LogFilePath - $log.SaveChanges() -} - -Export-ModuleMember -Function *-TargetResource - - - diff --git a/lib/puppet_x/dsc_resources/xWinEventLog/DSCResources/MSFT_xWinEventLog/MSFT_xWinEventLog.schema.mof b/lib/puppet_x/dsc_resources/xWinEventLog/DSCResources/MSFT_xWinEventLog/MSFT_xWinEventLog.schema.mof deleted file mode 100644 index 69c766e2..00000000 --- a/lib/puppet_x/dsc_resources/xWinEventLog/DSCResources/MSFT_xWinEventLog/MSFT_xWinEventLog.schema.mof +++ /dev/null @@ -1,14 +0,0 @@ - -[ClassVersion("1.0.0.1"), FriendlyName("xWinEventLog")] -class MSFT_xWinEventLog : OMI_BaseResource -{ - [Key, Description("Name of the event log")] String LogName; - [Write, Description("sizethat the event log file is allowed to be When the file reaches this maximum size it is considered full")] Sint64 MaximumSizeInBytes; - [Write] Boolean IsEnabled; - [Write, ValueMap{"AutoBackup","Circular","Retain"}, Values{"AutoBackup","Circular","Retain"}] String LogMode; - [Write] String SecurityDescriptor; - [Write] String LogFilePath; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xWinEventLog/LICENSE b/lib/puppet_x/dsc_resources/xWinEventLog/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xWinEventLog/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xWinEventLog/xWinEventLog.psd1 b/lib/puppet_x/dsc_resources/xWinEventLog/xWinEventLog.psd1 deleted file mode 100644 index 095b3e66..00000000 --- a/lib/puppet_x/dsc_resources/xWinEventLog/xWinEventLog.psd1 +++ /dev/null @@ -1,98 +0,0 @@ -# -# Module manifest for module 'xWinEventLog' -# -# Generated by: Microsoft Corporation -# -# Generated on: 5/24/2014 -# - -@{ - -# Script module or binary module file associated with this manifest. -# RootModule = '' - -# Version number of this module. -ModuleVersion = '1.1.0.0' - -# ID used to uniquely identify this module -GUID = '5b4a0524-9c3f-44d6-933e-717c5c22b16a' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft Corporation. All rights reserved' - -# Description of the functionality provided by this module -Description = 'Configure Windows Event Logs' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Name of the Windows PowerShell host required by this module -# PowerShellHostName = '' - -# Minimum version of the Windows PowerShell host required by this module -# PowerShellHostVersion = '' - -# Minimum version of Microsoft .NET Framework required by this module -# DotNetFrameworkVersion = '' - -# Minimum version of the common language runtime (CLR) required by this module -# CLRVersion = '' - -# Processor architecture (None, X86, Amd64) required by this module -# ProcessorArchitecture = '' - -# Modules that must be imported into the global environment prior to importing this module -# RequiredModules = @() - -# Assemblies that must be loaded prior to importing this module -# RequiredAssemblies = @() - -# Script files (.ps1) that are run in the caller's environment prior to importing this module. -# ScriptsToProcess = @() - -# Type files (.ps1xml) to be loaded when importing this module -# TypesToProcess = @() - -# Format files (.ps1xml) to be loaded when importing this module -# FormatsToProcess = @() - -# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess -NestedModules = '.\xWinEventLog.psm1' - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Variables to export from this module -VariablesToExport = '*' - -# Aliases to export from this module -AliasesToExport = '*' - -# List of all modules packaged with this module -# ModuleList = @() - -# List of all files packaged with this module -# FileList = @() - -# Private data to pass to the module specified in RootModule/ModuleToProcess -# PrivateData = '' - -# HelpInfo URI of this module -# HelpInfoURI = '' - -# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. -# DefaultCommandPrefix = '' - -} - - - diff --git a/lib/puppet_x/dsc_resources/xWinEventLog/xWinEventLog.psm1 b/lib/puppet_x/dsc_resources/xWinEventLog/xWinEventLog.psm1 deleted file mode 100644 index 2ef23e95..00000000 --- a/lib/puppet_x/dsc_resources/xWinEventLog/xWinEventLog.psm1 +++ /dev/null @@ -1,18 +0,0 @@ - -function Show-xWinEventLogExamples -{ - $path = Join-Path $PSScriptRoot 'Examples\*' - if ($Host.Name -eq 'Windows PowerShell ISE Host') - { - psedit $path - } - else - { - $files = @() - foreach ($f in dir $path) - { - $files += "$($f.FullName)" - } - PowerShell_ise -file $($files -join ",") - } -} diff --git a/lib/puppet_x/dsc_resources/xWindowsEventForwarding/DSCResources/MSFT_xWEFCollector/MSFT_xWEFCollector.psm1 b/lib/puppet_x/dsc_resources/xWindowsEventForwarding/DSCResources/MSFT_xWEFCollector/MSFT_xWEFCollector.psm1 deleted file mode 100644 index 63e585cd..00000000 --- a/lib/puppet_x/dsc_resources/xWindowsEventForwarding/DSCResources/MSFT_xWEFCollector/MSFT_xWEFCollector.psm1 +++ /dev/null @@ -1,77 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Name - ) - - $ServiceStartMode = (Get-WmiObject -Query "Select * From Win32_Service Where Name='Wecsvc'").StartMode - $Ensure = if ($ServiceStartMode -eq 'Auto') {'Present'} else {'Absent'} - - - $returnValue = @{ - Ensure = [System.String]$Ensure - Name = [System.String]$Name - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [parameter(Mandatory = $true)] - [System.String] - $Name - ) - - if ($Ensure -eq 'Present') {wecutil qc /q} - if ($Ensure -eq 'Absent') { - Stop-Service Wecsvc - $Service = Get-WmiObject -Query "Select * From Win32_Service Where Name='Wecsvc'" - $Service.ChangeStartMode("Disabled") - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [parameter(Mandatory = $true)] - [System.String] - $Name - ) - - $ServiceStartMode = (Get-WmiObject -Query "Select * From Win32_Service Where Name='Wecsvc'").StartMode - - if ($Ensure -eq 'Present') { - if ($ServiceStartMode -eq 'Auto') {$result = [System.Boolean]$true} else {$result = [System.Boolean]$false} - } - if ($Ensure -eq 'Absent') { - if ($ServiceStartMode -eq 'Disabled') {$result = [System.Boolean]$true} else {$result = [System.Boolean]$false} - } - - $result -} - - -Export-ModuleMember -Function *-TargetResource - diff --git a/lib/puppet_x/dsc_resources/xWindowsEventForwarding/DSCResources/MSFT_xWEFCollector/MSFT_xWEFCollector.schema.mof b/lib/puppet_x/dsc_resources/xWindowsEventForwarding/DSCResources/MSFT_xWEFCollector/MSFT_xWEFCollector.schema.mof deleted file mode 100644 index fb9494d2..00000000 --- a/lib/puppet_x/dsc_resources/xWindowsEventForwarding/DSCResources/MSFT_xWEFCollector/MSFT_xWEFCollector.schema.mof +++ /dev/null @@ -1,8 +0,0 @@ - -[ClassVersion("0.1.0.0"), FriendlyName("xWEFCollector")] -class MSFT_xWEFCollector : OMI_BaseResource -{ - [Write, Description("Determines whether the Collector service should be enabled or disabled"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Key, Description("Provide a unique name for the setting")] String Name; -}; - diff --git a/lib/puppet_x/dsc_resources/xWindowsEventForwarding/DSCResources/MSFT_xWEFSubscription/MSFT_xWEFSubscription.psm1 b/lib/puppet_x/dsc_resources/xWindowsEventForwarding/DSCResources/MSFT_xWEFSubscription/MSFT_xWEFSubscription.psm1 deleted file mode 100644 index 946fb02a..00000000 --- a/lib/puppet_x/dsc_resources/xWindowsEventForwarding/DSCResources/MSFT_xWEFSubscription/MSFT_xWEFSubscription.psm1 +++ /dev/null @@ -1,331 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $SubscriptionID, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = 'Present', - - [parameter(Mandatory = $true)] - [ValidateSet("CollectorInitiated","SourceInitiated")] - [System.String] - $SubscriptionType - ) - - if ((get-service wecsvc).Status -ne 'Running') {throw 'The xWEFSubscription resource requires that the Wecsvc service be in a running state. Set the xWEFCollectorService resource to Ensure = Present or use wecutil qc.'} - - $EnumSubs = wecutil es - if ($EnumSubs -contains $SubscriptionID) { - [xml]$GetSub = wecutil gs $SubscriptionID /format:xml - } - - $returnValue = @{ - SubscriptionID = [System.String]$GetSub.Subscription.SubscriptionId - Ensure = if ($Ensure -eq 'Present' -AND $EnumSubs -contains $SubscriptionID) {[System.String]'Present'} else {$null} - SubscriptionType = [System.String]$GetSub.Subscription.SubscriptionType - Description = [System.String]$GetSub.Subscription.Description - Enabled = [System.String]$GetSub.Subscription.Enabled - DeliveryMode = [System.String]$GetSub.Subscription.Delivery.Mode - MaxItems = [System.Int32]$GetSub.Subscription.Delivery.Batching.MaxItems - MaxLatencyTime = [System.UInt64]$GetSub.Subscription.Delivery.Batching.MaxLatencyTime - HeartBeatInterval = [System.UInt64]$GetSub.Subscription.Delivery.PushSettings.Heartbeat.Interval - ReadExistingEvents = [System.String]$GetSub.Subscription.ReadExistingEvents - TransportName = [System.String]$GetSub.Subscription.TransportName - ContentFormat = [System.String]$GetSub.Subscription.ContentFormat - Locale = [System.String]$GetSub.Subscription.Locale.Language - LogFile = [System.String]$GetSub.Subscription.LogFile - CredentialsType = [System.String]$GetSub.Subscription.CredentialsType - AllowedSourceNonDomainComputers = [System.String[]]$GetSub.Subscription.AllowedSourceNonDomainComputers - AllowedSourceDomainComputers = [System.String]$GetSub.Subscription.AllowedSourceDomainComputers - Query = [System.String[]]$GetSub.Subscription.Query.'#cdata-section' - } - - $returnValue -} -# Get-TargetResource -SubscriptionID TestSub -Ensure Present -SubscriptionType CollectorInitiated - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $SubscriptionID, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = 'Present', - - [parameter(Mandatory = $true)] - [ValidateSet("CollectorInitiated","SourceInitiated")] - [System.String] - $SubscriptionType, - - [System.String] - $Description, - - [ValidateSet("true","false")] - [System.String] - $Enabled = 'true', - - [ValidateSet("Push","Pull")] - [System.String] - $DeliveryMode = 'Push', - - [System.Int32] - $MaxItems = 1, - - [System.UInt64] - $MaxLatencyTime = 20000, - - [System.UInt64] - $HeartBeatInterval = 20000, - - [ValidateSet("true","false")] - [System.String] - $ReadExistingEvents = 'false', - - [ValidateSet("HTTP","HTTPS")] - [System.String] - $TransportName = 'HTTP', - - [System.String] - $TransportPort = '5985', - - [System.String] - $ContentFormat = 'RenderedText', - - [System.String] - $Locale = 'en-US', - - [System.String] - $LogFile = 'ForwardedEvents', - - [ValidateSet("Default","Basic","Negotiate","Digest")] - [System.String] - $CredentialsType = 'Default', - - [System.String[]] - $AllowedSourceNonDomainComputers, - - [System.String] - $AllowedSourceDomainComputers = 'O:NSG:NSD:(A;;GA;;;DC)(A;;GA;;;NS)', - - [System.String[]] - $Query = @('Application:*','System:*'), - - [System.String[]] - $Address = @('source.wef.test') - ) - - if ((get-service wecsvc).Status -ne 'Running') {throw 'The xWEFSubscription resource requires that the Wecsvc service be in a running state. Set the xWEFCollectorService resource to Ensure = Present or use wecutil qc.'} - - if ($Ensure -eq 'Present') { - $Create = @" - - - $SubscriptionID - $SubscriptionType - $Description - $Enabled - http://schemas.microsoft.com/wbem/wsman/1/windows/EventLog - Custom - - - $MaxItems - $MaxLatencyTime - - - - - - - -"@ - - foreach ($q in $Query){ - $h = Convert-QueryString $q - $Create += @" - -"@ - } - - $Create += @" -]]> - - $ReadExistingEvents - $TransportName - $TransportPort - $ContentFormat - - $LogFile - Microsoft-Windows-EventCollector - $CredentialsType - -"@ - - if ($SubscriptionType -eq 'CollectorInitiated') { - $Create += @" - - -"@ - foreach ($a in $Address) { - $Create += @" - -
$a
-
-"@ - } - $Create += @" - -
-"@ - } - - if ($SubscriptionType -eq 'SourceInitiated') { - $Create += @" - $AllowedSourceNonDomainComputers - $AllowedSourceDomainComputers -"@ - } - - $Create += @" - -
-"@ - Write-Verbose "SubscriptionID: $SubscriptionID" - $TempFileName = "$([system.guid]::newguid().guid).tmp" - $Create | Set-Content $env:TEMP\$TempFileName - - $EnumSubs = wecutil es - if ($EnumSubs -contains $SubscriptionID) { - WecUtil ds $subscriptionid - } - WecUtil cs $env:TEMP\$TempFileName - - Remove-Item $env:TEMP\$TempFileName -Force - } - - if ($Ensure -eq 'Absent') { - $EnumSubs = wecutil es - if ($EnumSubs -contains $SubscriptionID) { - wecutil ds $SubscriptionID - } - } -} -# Set-TargetResource -SubscriptionID TestSub -Ensure Present -SubscriptionType CollectorInitiated - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $SubscriptionID, - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = 'Present', - - [parameter(Mandatory = $true)] - [ValidateSet("CollectorInitiated","SourceInitiated")] - [System.String] - $SubscriptionType, - - [System.String] - $Description, - - [ValidateSet("true","false")] - [System.String] - $Enabled = 'true', - - [ValidateSet("Push","Pull")] - [System.String] - $DeliveryMode = 'Push', - - [System.Int32] - $MaxItems = 1, - - [System.UInt64] - $MaxLatencyTime = 20000, - - [System.UInt64] - $HeartBeatInterval = 20000, - - [ValidateSet("true","false")] - [System.String] - $ReadExistingEvents = 'false', - - [ValidateSet("HTTP","HTTPS")] - [System.String] - $TransportName = 'HTTP', - - [System.String] - $TransportPort = '5985', - - [System.String] - $ContentFormat = 'RenderedText', - - [System.String] - $Locale = 'en-US', - - [System.String] - $LogFile = 'ForwardedEvents', - - [ValidateSet("Default","Basic","Negotiate","Digest")] - [System.String] - $CredentialsType = 'Default', - - [System.String[]] - $AllowedSourceNonDomainComputers, - - [System.String] - $AllowedSourceDomainComputers = 'O:NSG:NSD:(A;;GA;;;DC)(A;;GA;;;NS)', - - [System.String[]] - $Query = @('Application:*','System:*'), - - [System.String[]] - $Address = @('source.wef.test') - ) - - if ((get-service wecsvc).Status -ne 'Running') {throw 'The xWEFSubscription resource requires that the Wecsvc service be in a running state. Set the xWEFCollectorService resource to Ensure = Present or use wecutil qc.'} - - $Get = Get-TargetResource -SubscriptionID $SubscriptionID -SubscriptionType $SubscriptionType - - $result = [System.Boolean]$true - - foreach ($g in $Get.Keys) { - if ($PSBoundParameters.$g) { - $test = $Get.$g -eq $PSBoundParameters.$g - if ($test -eq [System.Boolean]$false) {$result = [System.Boolean]$false} - } - } - - $result -} -# Test-TargetResource -SubscriptionID TestSub -Ensure Present -SubscriptionType CollectorInitiated - - -function Convert-QueryString { -param ( -[parameter(Mandatory = $true)] -[string[]] -$string -) - return @{Path=$($string.split(':')[0]);Select=$($string.split(':')[1])} -} - - -Export-ModuleMember -Function *-TargetResource \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xWindowsEventForwarding/DSCResources/MSFT_xWEFSubscription/MSFT_xWEFSubscription.schema.mof b/lib/puppet_x/dsc_resources/xWindowsEventForwarding/DSCResources/MSFT_xWEFSubscription/MSFT_xWEFSubscription.schema.mof deleted file mode 100644 index 0ccfb1ce..00000000 --- a/lib/puppet_x/dsc_resources/xWindowsEventForwarding/DSCResources/MSFT_xWEFSubscription/MSFT_xWEFSubscription.schema.mof +++ /dev/null @@ -1,26 +0,0 @@ - -[ClassVersion("0.1.0.0"), FriendlyName("xWEFSubscription")] -class MSFT_xWEFSubscription : OMI_BaseResource -{ - [Key, Description("Name of the Subscription")] String SubscriptionID; - [Write, Description("Determines whether to validate or remove the scubscription"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Required, Description("Type of Subscription to create"), ValueMap{"CollectorInitiated","SourceInitiated"}, Values{"CollectorInitiated","SourceInitiated"}] String SubscriptionType; - [Write, Description("Description of the Collector subscription")] String Description; - [Write, Description("Sets whether the subscription will be enabled, default true"), ValueMap{"true","false"}, Values{"true","false"}] String Enabled; - [Write, Description("Configures whether the collector will pull events from source nodes or if the source nodes will push events to the collector, default push"), ValueMap{"Push","Pull"}, Values{"Push","Pull"}] String DeliveryMode; - [Write, Description("The number of events that can occur on the source before they are submitted to the collector, default 1")] Sint32 MaxItems; - [Write, Description("The maximum amount of time that can pass before events are submitted to the collector, default 20000")] Uint64 MaxLatencyTime; - [Write, Description("Frequency to verify connectivity, default 20000")] Uint64 HeartBeatInterval; - [Write, Description("Should the collector read existing or only new events, default false"), ValueMap{"true","false"}, Values{"true","false"}] String ReadExistingEvents; - [Write, Description("Determines whether to require SSL, default HTTP"), ValueMap{"HTTP","HTTPS"}, Values{"HTTP","HTTPS"}] String TransportName; - [Write, Description("Set the port number that WinRM should use to make a connection, default 5985")] String TransportPort; - [Write, Description("Format that event logs will be submitted in, default RenderedText")] String ContentFormat; - [Write, Description("Sets the subscription Locale, default en-US")] String Locale; - [Write, Description("Sets the event log that the collected events will be written to, default ForwardedEvents")] String LogFile; - [Write, Description("Sets the credential type used for authenticating to WinRM, default Default"), ValueMap{"Default","Basic","Negotiate","Digest"}, Values{"Default","Basic","Negotiate","Digest"}] String CredentialsType; - [Write, Description("This parameter has not been fully implemented, only required for source initiated scenarios, provide XML to set IssuerCAList, AllowedSubjectList, or DeniedSubjectList if this will be used, default empty string")] String AllowedSourceNonDomainComputers[]; - [Write, Description("In Source Initiated scenario this SDDL determines who can push events, default O:NSG:NSD:(A;;GA;;;DC)(A;;GA;;;NS) which equates to Domain Computers and Network Service")] String AllowedSourceDomainComputers; - [Write, Description("Expects an array of hashtables that set which events should be collected, default is all application and system logs")] String Query[]; - [Write, Description("Expects an array of source node FQDNs, default source.wef.test to prevent errors when only staging test subscription")] String Address[]; -}; - diff --git a/lib/puppet_x/dsc_resources/xWindowsEventForwarding/LICENSE b/lib/puppet_x/dsc_resources/xWindowsEventForwarding/LICENSE deleted file mode 100644 index 5f178f93..00000000 --- a/lib/puppet_x/dsc_resources/xWindowsEventForwarding/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Michael Greene - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - diff --git a/lib/puppet_x/dsc_resources/xWindowsEventForwarding/xWindowsEventForwarding.psd1 b/lib/puppet_x/dsc_resources/xWindowsEventForwarding/xWindowsEventForwarding.psd1 deleted file mode 100644 index 228cef3b..00000000 --- a/lib/puppet_x/dsc_resources/xWindowsEventForwarding/xWindowsEventForwarding.psd1 +++ /dev/null @@ -1,120 +0,0 @@ -# -# Module manifest for module 'xWindowsEventForwarding' -# -# Generated by: PowerShell Team -# -# Generated on: 3/26/2015 -# - -@{ - -# Script module or binary module file associated with this manifest. -# RootModule = '' - -# Version number of this module. -ModuleVersion = '1.0.0.0' - -# ID used to uniquely identify this module -GUID = 'ab5e14f9-156e-49d2-ae1b-96576a929f3b' - -# Author of this module -Author = 'PowerShell Team' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '2015' - -# Description of the functionality provided by this module -Description = 'This module can be used to manage configuration of a Windows Event Forwarding server in a Colelctor role.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '5.0' - -# Name of the Windows PowerShell host required by this module -# PowerShellHostName = '' - -# Minimum version of the Windows PowerShell host required by this module -# PowerShellHostVersion = '' - -# Minimum version of Microsoft .NET Framework required by this module -# DotNetFrameworkVersion = '' - -# Minimum version of the common language runtime (CLR) required by this module -# CLRVersion = '' - -# Processor architecture (None, X86, Amd64) required by this module -# ProcessorArchitecture = '' - -# Modules that must be imported into the global environment prior to importing this module -# RequiredModules = @() - -# Assemblies that must be loaded prior to importing this module -# RequiredAssemblies = @() - -# Script files (.ps1) that are run in the caller's environment prior to importing this module. -# ScriptsToProcess = @() - -# Type files (.ps1xml) to be loaded when importing this module -# TypesToProcess = @() - -# Format files (.ps1xml) to be loaded when importing this module -# FormatsToProcess = @() - -# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess -# NestedModules = @() - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Variables to export from this module -VariablesToExport = '*' - -# Aliases to export from this module -AliasesToExport = '*' - -# DSC resources to export from this module -# DscResourcesToExport = @() - -# List of all modules packaged with this module -# ModuleList = @() - -# List of all files packaged with this module -# FileList = @() - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - # Tags = @() - - # A URL to the license for this module. - # LicenseUri = '' - - # A URL to the main website for this project. - # ProjectUri = '' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - # ReleaseNotes = '' - - } # End of PSData hashtable - -} # End of PrivateData hashtable - -# HelpInfo URI of this module -# HelpInfoURI = '' - -# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. -# DefaultCommandPrefix = '' - -} - diff --git a/lib/puppet_x/dsc_resources/xWindowsRestore/DSCResources/xSystemRestore/xSystemRestore.psm1 b/lib/puppet_x/dsc_resources/xWindowsRestore/DSCResources/xSystemRestore/xSystemRestore.psm1 deleted file mode 100644 index 4e9b3475..00000000 --- a/lib/puppet_x/dsc_resources/xWindowsRestore/DSCResources/xSystemRestore/xSystemRestore.psm1 +++ /dev/null @@ -1,120 +0,0 @@ -#--------------------------------------------------------------------------------- #The sample scripts are not supported under any Microsoft standard support #program or service. The sample scripts are provided AS IS without warranty #of any kind. Microsoft further disclaims all implied warranties including, #without limitation, any implied warranties of merchantability or of fitness for #a particular purpose. The entire risk arising out of the use or performance of #the sample scripts and documentation remains with you. In no event shall #Microsoft, its authors, or anyone else involved in the creation, production, or #delivery of the scripts be liable for any damages whatsoever (including, #without limitation, damages for loss of business profits, business interruption, #loss of business information, or other pecuniary loss) arising out of the use #of or inability to use the sample scripts or documentation, even if Microsoft #has been advised of the possibility of such damages #--------------------------------------------------------------------------------- - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure - ) - - #Get the status of system restore on the target computer. - $GetSystemRestore = Get-CimInstance -Class SystemRestoreConfig -Namespace 'root\default' - - $returnValue = @{ - Ensure = $Ensure - } - - #Check if the system restore is enabled or disabled. - If($GetSystemRestore.RPSessionInterval -eq 1) - { - $returnValue.Ensure = 'Present' - } - Else - { - $returnValue.Ensure = 'Absent' - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [System.String[]] - $Drive - ) - - Switch($Ensure) - { - 'Present' - { - If($PSCmdlet.ShouldProcess("'$Drive'","Enable the system restore")) - { - Try - { - Write-Verbose "Enable the System Restore feature on the '$Drive' file system drive." - Enable-ComputerRestore -Drive $Drive -ErrorAction Stop - } - Catch - { - $ErrorMsg = $_.Exception.Message - Write-Verbose $ErrorMsg - } - } - } - 'Absent' - { - If($PSCmdlet.ShouldProcess("$Drive","Disable the system restore")) - { - Try - { - Write-Verbose "Disable the System Restore feature on the '$Drive' file system drive." - Disable-ComputerRestore -Drive $Drive - } - Catch - { - $ErrorMsg = $_.Exception.Message - Write-Verbose $ErrorMsg - } - } - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [System.String[]] - $Drive - ) - - #Output the result of Get-TargetResource function. - $Get = Get-TargetResource -Ensure $Ensure - - If($Ensure -eq $Get.Ensure) - { - return $true - } - Else - { - return $false - } -} - - -Export-ModuleMember -Function *-TargetResource - - - diff --git a/lib/puppet_x/dsc_resources/xWindowsRestore/DSCResources/xSystemRestore/xSystemRestore.schema.mof b/lib/puppet_x/dsc_resources/xWindowsRestore/DSCResources/xSystemRestore/xSystemRestore.schema.mof deleted file mode 100644 index 7e6968e8..00000000 --- a/lib/puppet_x/dsc_resources/xWindowsRestore/DSCResources/xSystemRestore/xSystemRestore.schema.mof +++ /dev/null @@ -1,10 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xSystemRestore")] -class xSystemRestore : OMI_BaseResource -{ - [Key, Description("Indicates that the computer restore is enabled or is disabled."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, Description("Specifies the file system drives. Enter one or more file system drive letters, each followed by a colon and a backslash and enclosed in quotation marks, such as 'C:\' or 'D:\'.")] String Drive[]; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xWindowsRestore/DSCResources/xSystemRestorePoint/xSystemRestorePoint.psm1 b/lib/puppet_x/dsc_resources/xWindowsRestore/DSCResources/xSystemRestorePoint/xSystemRestorePoint.psm1 deleted file mode 100644 index 009081de..00000000 --- a/lib/puppet_x/dsc_resources/xWindowsRestore/DSCResources/xSystemRestorePoint/xSystemRestorePoint.psm1 +++ /dev/null @@ -1,205 +0,0 @@ -#--------------------------------------------------------------------------------- #The sample scripts are not supported under any Microsoft standard support #program or service. The sample scripts are provided AS IS without warranty #of any kind. Microsoft further disclaims all implied warranties including, #without limitation, any implied warranties of merchantability or of fitness for #a particular purpose. The entire risk arising out of the use or performance of #the sample scripts and documentation remains with you. In no event shall #Microsoft, its authors, or anyone else involved in the creation, production, or #delivery of the scripts be liable for any damages whatsoever (including, #without limitation, damages for loss of business profits, business interruption, #loss of business information, or other pecuniary loss) arising out of the use #of or inability to use the sample scripts or documentation, even if Microsoft #has been advised of the possibility of such damages #--------------------------------------------------------------------------------- - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Description, - - [ValidateSet("APPLICATION_INSTALL","APPLICATION_UNINSTALL","DEVICE_DRIVER_INSTALL","MODIFY_SETTINGS","CANCELLED_OPERATION")] - [System.String] - $RestorePointType = 'APPLICATION_INSTALL', - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = 'Present' - ) - - #Get the latest status of system restore point. - $LatestRestorePoint = Get-ComputerRestorePoint | Select-Object -Last 1 - - $returnValue = @{ - Description = If($LatestRestorePoint.Description){$LatestRestorePoint.Description}Else{"None"} - RestorePointType = If($LatestRestorePoint.RestorePointType){$LatestRestorePoint.RestorePointType}Else{"None"} - Ensure = $Ensure - } - - - If($($Description -eq $LatestRestorePoint.Description) -and $($(ConvertRestorePointValue -RestoreType $RestorePointType) -eq $LatestRestorePoint.RestorePointType)) - { - $returnValue.Ensure = "Present" - } - Else - { - $returnValue.Ensure = "Absent" - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Description, - - [ValidateSet("APPLICATION_INSTALL","APPLICATION_UNINSTALL","DEVICE_DRIVER_INSTALL","MODIFY_SETTINGS","CANCELLED_OPERATION")] - [System.String] - $RestorePointType = 'APPLICATION_INSTALL', - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = 'Present' - ) - - Switch($Ensure) - { - 'Present' - { - If($PSCmdlet.ShouldProcess("$Description","Creating restore point")) - { - Try - { - Write-Verbose "Creating a system restore point on the target computer." - Checkpoint-Computer -Description $Description -RestorePointType $RestorePointType - } - Catch - { - $ErrorMsg = $_.Exception.Message - Write-Verbose $ErrorMsg - } - } - } - - 'Absent' - { - -$Definition = @" -[DllImport ("Srclient.dll")] -public static extern int SRRemoveRestorePoint (int index); -"@ - $Assemblies = [AppDomain]::CurrentDomain.GetAssemblies() - $isExists = ($Assemblies | Foreach {$_.GetTypes()} | Where {$_.FullName -eq "SystemRestore.DeleteRestorePoint"}) -ne $null - - If (!$isExists) - { - Add-Type -memberDefinition $Definition -Name DeleteRestorePoint -NameSpace SystemRestore -PassThru - } - - $RestorePoints = Get-ComputerRestorePoint | Where{$_.Description -eq "$Description" -and $_.RestorePointType -eq "$(ConvertRestorePointValue -RestoreType $RestorePointType)"} - - Foreach($RestorePoint in $RestorePoints) - { - If($PSCmdlet.ShouldProcess("$Description","Deleting restore point")) - { - Try - { - Write-Verbose "Deleting the restore point." - [SystemRestore.DeleteRestorePoint]::SRRemoveRestorePoint($restorePoint.SequenceNumber) | Out-Null - } - Catch - { - Write-Verbose "Failed to remove the restore point." - } - } - } - } - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Description, - - [ValidateSet("APPLICATION_INSTALL","APPLICATION_UNINSTALL","DEVICE_DRIVER_INSTALL","MODIFY_SETTINGS","CANCELLED_OPERATION")] - [System.String] - $RestorePointType = 'APPLICATION_INSTALL', - - [ValidateSet("Present","Absent")] - [System.String] - $Ensure = 'Present' - ) - - #Get the output of Get-TargetResource function. - $Get = Get-TargetResource -Description $Description -RestorePointType $RestorePointType - - Switch($Ensure) - { - 'Present' - { - #If the value of $Get.Ensure is "Present", it indicates that the current restore point is the same as the accepted value. - If($Get.Ensure -eq "Present") - { - return $true - } - Else - { - return $false - } - } - 'Absent' - { - If($Get.Ensure -eq "Present") - { - return $false - } - Else - { - return $true - } - } - } -} - - -Function ConvertRestorePointValue -{ - Param - ( - $RestoreType - ) - - Switch($RestoreType) - { - "APPLICATION_INSTALL" - { - $Value = 0 - } - "APPLICATION_UNINSTALL" - { - $Value = 1 - } - "DEVICE_DRIVER_INSTALL" - { - $Value = 10 - } - "MODIFY_SETTINGS" - { - $Value = 12 - } - "CANCELLED_OPERATION" - { - $Value = 13 - } - } - return $Value -} - - -Export-ModuleMember -Function *-TargetResource - diff --git a/lib/puppet_x/dsc_resources/xWindowsRestore/DSCResources/xSystemRestorePoint/xSystemRestorePoint.schema.mof b/lib/puppet_x/dsc_resources/xWindowsRestore/DSCResources/xSystemRestorePoint/xSystemRestorePoint.schema.mof deleted file mode 100644 index 3622f676..00000000 --- a/lib/puppet_x/dsc_resources/xWindowsRestore/DSCResources/xSystemRestorePoint/xSystemRestorePoint.schema.mof +++ /dev/null @@ -1,11 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xSystemRestorePoint")] -class xSystemRestorePoint : OMI_BaseResource -{ - [Key, Description("Specifies a descriptive name for the restore point.")] String Description; - [Write, Description("Specifies the type of restore point. The default is APPLICATION_INSTALL."), ValueMap{"APPLICATION_INSTALL","APPLICATION_UNINSTALL","DEVICE_DRIVER_INSTALL","MODIFY_SETTINGS","CANCELLED_OPERATION"}, Values{"APPLICATION_INSTALL","APPLICATION_UNINSTALL","DEVICE_DRIVER_INSTALL","MODIFY_SETTINGS","CANCELLED_OPERATION"}] String RestorePointType; - [Write, Description("Indicates if the specified restore point created. Set this property to 'Absent' to ensure that the restore point does not exist. Set it to 'Present' to ensure that the restore point does exist. The default is 'Present'."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xWindowsRestore/LICENSE b/lib/puppet_x/dsc_resources/xWindowsRestore/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xWindowsRestore/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xWindowsRestore/xWindowsRestore.psd1 b/lib/puppet_x/dsc_resources/xWindowsRestore/xWindowsRestore.psd1 deleted file mode 100644 index 21358614..00000000 --- a/lib/puppet_x/dsc_resources/xWindowsRestore/xWindowsRestore.psd1 +++ /dev/null @@ -1,31 +0,0 @@ -@{ -# Version number of this module. -ModuleVersion = '1.0.0' - -# ID used to uniquely identify this module -GUID = '32fe8783-1978-4d79-bf90-fddca2bbbf7b' - -# Author of this module -Author = 'OneScript Team' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'This DSC Module includes 2 DSC resources, xSystemRestore resource can configure system restore and xSystemRestorePoint resource can create or remove an restore point in Windows.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Minimum version of the common language runtime (CLR) required by this module -CLRVersion = '4.0' - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' -} diff --git a/lib/puppet_x/dsc_resources/xWindowsUpdate/DscResources/MSFT_xMicrosoftUpdate/MSFT_xMicrosoftUpdate.psm1 b/lib/puppet_x/dsc_resources/xWindowsUpdate/DscResources/MSFT_xMicrosoftUpdate/MSFT_xMicrosoftUpdate.psm1 deleted file mode 100644 index cb2ca8e6..00000000 --- a/lib/puppet_x/dsc_resources/xWindowsUpdate/DscResources/MSFT_xMicrosoftUpdate/MSFT_xMicrosoftUpdate.psm1 +++ /dev/null @@ -1,122 +0,0 @@ -function Write-DeprecatedMessage -{ - Write-Warning -Message 'xMicrosoftUpdate is deprecated. Please use xWindows Update Agent' -} - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure - ) - - Write-DeprecatedMessage - Write-Verbose -Message "Getting Windows Update Agent services..." - #Get the registered update services - $UpdateServices = (New-Object -ComObject Microsoft.Update.ServiceManager).Services - - $returnValue = @{ - Ensure = $Ensure - } - - #Check if the microsoft update service is registered - if($UpdateServices | Where-Object {$_.ServiceID -eq '7971f918-a847-4430-9279-4a52d1efe18d'}) - { - Write-Verbose -Message "Microsoft Update Present..." - $returnValue.Ensure = 'Present' - } - Else - { - Write-Verbose -Message "Microsoft Update Absent..." - $returnValue.Ensure = 'Absent' - } - - $returnValue -} - - -function Set-TargetResource -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure - ) - - Write-DeprecatedMessage - Switch($Ensure) - { - 'Present' - { - If($PSCmdlet.ShouldProcess("Enable Microsoft Update")) - { - Try - { - Write-Verbose -Message "Enable the Microsoft Update setting" - (New-Object -ComObject Microsoft.Update.ServiceManager).AddService2('7971f918-a847-4430-9279-4a52d1efe18d',7,"") - Restart-Service wuauserv -ErrorAction SilentlyContinue - } - Catch - { - $ErrorMsg = $_.Exception.Message - Write-Verbose $ErrorMsg - } - } - } - 'Absent' - { - If($PSCmdlet.ShouldProcess("$Drive","Disable Microsoft Update")) - { - Try - { - Write-Verbose -Message "Disable the Microsoft Update setting" - (New-Object -ComObject Microsoft.Update.ServiceManager).RemoveService('7971f918-a847-4430-9279-4a52d1efe18d') - } - Catch - { - $ErrorMsg = $_.Exception.Message - Write-Verbose $ErrorMsg - } - } - } - } -} - -function Test-TargetResource -{ - # Verbose messages are written in Get. - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")] - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure - ) - - #Output the result of Get-TargetResource function. - - $Get = Get-TargetResource -Ensure $Ensure - - If($Ensure -eq $Get.Ensure) - { - return $true - } - Else - { - return $false - } -} - - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xWindowsUpdate/DscResources/MSFT_xMicrosoftUpdate/MSFT_xMicrosoftUpdate.schema.mof b/lib/puppet_x/dsc_resources/xWindowsUpdate/DscResources/MSFT_xMicrosoftUpdate/MSFT_xMicrosoftUpdate.schema.mof deleted file mode 100644 index 61ece228..00000000 --- a/lib/puppet_x/dsc_resources/xWindowsUpdate/DscResources/MSFT_xMicrosoftUpdate/MSFT_xMicrosoftUpdate.schema.mof +++ /dev/null @@ -1,6 +0,0 @@ - -[ClassVersion("0.1.0.0"), FriendlyName("xMicrosoftUpdate")] -class MSFT_xMicrosoftUpdate : OMI_BaseResource -{ - [Key, Description("Indicates that the Microsoft Update is enabled or is disabled."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; -}; diff --git a/lib/puppet_x/dsc_resources/xWindowsUpdate/DscResources/MSFT_xWindowsUpdate/MSFT_xWindowsUpdate.psm1 b/lib/puppet_x/dsc_resources/xWindowsUpdate/DscResources/MSFT_xWindowsUpdate/MSFT_xWindowsUpdate.psm1 deleted file mode 100644 index ad669919..00000000 --- a/lib/puppet_x/dsc_resources/xWindowsUpdate/DscResources/MSFT_xWindowsUpdate/MSFT_xWindowsUpdate.psm1 +++ /dev/null @@ -1,418 +0,0 @@ -Data LocalizedData -{ - # culture="en-US"e - ConvertFrom-StringData @' - GettingHotfixMessage=Getting the hotfix patch with ID {0}. - ValidatingPathUri=Validating path/URI. - ErrorPathUriSpecifiedTogether=Hotfix path and Uri parameters cannot be specified together. - ErrorInvalidFilePathMsu=Filename provided is an invalid file path for hotfix since it does not have the msu suffix to it. - StartKeyWord=START - EndKeyWord= END - FailedKeyword = FAILED - ActionDownloadFromUri= Download from {0} using BitsTransfer. - ActionInstallUsingwsusa = Install using wsusa.exe - ActionUninstallUsingwsusa = Uninstall using wsusa.exe - DownloadingPackageTo = Downloading package to filepath {0} - FileDoesntExist=The given path {0} does not exist. - LogNotSpecified=Log name hasn't been specified. Hotfix will use the temporary log {0} . - ErrorOccuredOnHotfixInstall = \nCould not install the windows update. Details are stored in the log {0} . Error message is \n\n {1} .\n\nPlease look at Windows Update error codes here for more information - http://technet.microsoft.com/en-us/library/dd939837(WS.10).aspx . - ErrorOccuredOnHotfixUninnstall = \nCould not uninstall the windows update. Details are stored in the log {0} . Error message is \n\n {1} .\n\nPlease look at Windows Update error codes here for more information - http://technet.microsoft.com/en-us/library/dd939837(WS.10).aspx . - TestingEnsure = Testing whether hotfix is {0}. - InvalidPath=The specified Path ({0}) is not in a valid format. Valid formats are local paths, UNC, and HTTP. - InvalidBinaryType=The specified Path ({0}) does not appear to specify an MSU file and as such is not supported. - TestStandardArgumentsPathWasPath = Test-StandardArguments, Path was {0}. - NeedToDownloadFileFromSchemeDestinationWillBeDestName = Need to download file from {0}, destination will be {1}. - TheUriSchemeWasUriScheme = The uri scheme was {0}. - MountSharePath=Mount share to get media. - NeedsMoreInfo=Id is required. - InvalidIdFormat=Id must be formated either KBNNNNNNN or NNNNNNN. - DownloadHTTPFile=Download the media over HTTP or HTTPS. - CreatingCacheLocation = Creating cache location. - CouldNotOpenDestFile=Cannot open the file {0} for writing. - CreatingTheSchemeStream = Creating the {0} stream. - SettingDefaultCredential = Setting default credential. - SettingAuthenticationLevel = Setting authentication level. - IgnoringBadCertificates = Ignoring bad certificates. - GettingTheSchemeResponseStream = Getting the {0} response stream. - ErrorOutString = Error: {0}. - CopyingTheSchemeStreamBytesToTheDiskCache = Copying the {0} stream bytes to the disk cache. - RedirectingPackagePathToCacheFileLocation = Redirecting package path to cache file location. - ThePathExtensionWasPathExt = The path extension was {0} - CreatingTheDestinationCacheFile = Creating the destination cache file. -'@ -} - -$CacheLocation = "$env:ProgramData\Microsoft\Windows\PowerShell\Configuration\BuiltinProvCache\MSFT_xWindowsUpdate" - -# Get-TargetResource function -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - Param - ( - [parameter(Mandatory = $true)] - [System.String] - $Path, - - [parameter(Mandatory = $true)] - [System.String] - $Id - ) - Set-StrictMode -Version latest - - $uri, $kbId = Test-StandardArguments -Path $Path -Id $Id - - Write-Verbose $($LocalizedData.GettingHotfixMessage -f ${Id}) - - $hotfix = Get-HotFix -Id "KB$kbId" - - $returnValue = @{ - Path = '' - Id = $hotfix.HotFixId - Log = '' - } - - $returnValue - -} - -$Debug = $true -Function Trace-Message -{ - param([string] $Message) - Set-StrictMode -Version latest - if($Debug) - { - Write-Verbose $Message - } -} - -Function New-InvalidArgumentException -{ - param( - [string] $Message, - [string] $ParamName - ) - Set-StrictMode -Version latest - - $exception = new-object System.ArgumentException $Message,$ParamName - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception,$ParamName,'InvalidArgument',$null - throw $errorRecord -} - -# The Set-TargetResource cmdlet -function Set-TargetResource -{ - # should be [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidGlobalVars", "DSCMachineStatus")], but it doesn't work - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidGlobalVars", "")] - [CmdletBinding()] - Param - ( - [parameter(Mandatory = $true)] - [System.String] - $Path, - - [parameter(Mandatory = $true)] - [System.String] - $Id, - - [System.String] - $Log, - - [ValidateSet('Present','Absent')] - [System.String] - $Ensure='Present', - - [pscredential] $Credential - - ) - Set-StrictMode -Version latest - if (!$Log) - { - $Log = [IO.Path]::GetTempFileName() - $Log += '.etl' - - Write-Verbose "$($LocalizedData.LogNotSpecified -f ${Log})" - } - $uri, $kbId = Test-StandardArguments -Path $Path -Id $Id - - - - if($Ensure -eq 'Present') - { - $filePath = Test-WindowsUpdatePath -uri $uri -Credential $Credential - Write-Verbose "$($LocalizedData.StartKeyWord) $($LocalizedData.ActionInstallUsingwsusa)" - - Start-Process -FilePath 'wusa.exe' -ArgumentList "`"$filepath`" /quiet /norestart /log:`"$Log`"" -Wait -NoNewWindow -ErrorAction SilentlyContinue - $errorOccured = Get-WinEvent -Path $Log -Oldest | Where-Object {$_.Id -eq 3} - if($errorOccured) - { - $errorMessage= $errorOccured.Message - Throw "$($LocalizedData.ErrorOccuredOnHotfixInstall -f ${Log}, ${errorMessage})" - } - - Write-Verbose "$($LocalizedData.EndKeyWord) $($LocalizedData.ActionInstallUsingwsusa)" - } - else - { - $argumentList = "/uninstall /KB:$kbId /quiet /norestart /log:`"$Log`"" - - Write-Verbose "$($LocalizedData.StartKeyWord) $($LocalizedData.ActionUninstallUsingwsusa) Arguments: $ArgumentList" - - Start-Process -FilePath 'wusa.exe' -ArgumentList $argumentList -Wait -NoNewWindow -ErrorAction SilentlyContinue - #Read the log and see if there was an error event - $errorOccured = Get-WinEvent -Path $Log -Oldest | Where-Object {$_.Id -eq 3} - if($errorOccured) - { - $errorMessage= $errorOccured.Message - Throw "$($LocalizedData.ErrorOccuredOnHotfixUninstall -f ${Log}, ${errorMessage})" - } - - Write-Verbose "$($LocalizedData.EndKeyWord) $($LocalizedData.ActionUninstallUsingwsusa)" - - - } - - if (Test-Path -Path 'variable:\LASTEXITCODE') - { - if ($LASTEXITCODE -eq 3010) - { - # reboot machine if exitcode indicates reboot. - $global:DSCMachineStatus = 1 - } - } -} - - -# Function to test if Hotfix is installed. -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.String] - $Path, - - [parameter(Mandatory = $true)] - [System.String] - $Id, - - [System.String] - $Log, - - [ValidateSet('Present','Absent')] - [System.String] - $Ensure='Present', - - [pscredential] $Credential - ) - Set-StrictMode -Version latest - Write-Verbose "$($LocalizedData.TestingEnsure -f ${Ensure})" - $uri, $kbId = Test-StandardArguments -Path $Path -Id $Id - - # This is not the correct way to test to see if an update is applicable to a machine - # but, WUSA does not currently expose a way to ask. - $result = Get-HotFix -Id "KB$kbId" -ErrorAction SilentlyContinue - $returnValue= [bool]$result - if($Ensure -eq 'Present') - { - - Return $returnValue - } - else - { - Return !$returnValue - } - -} - -Function Test-StandardArguments -{ - param( - [string] - $Path, - - [string] - $Id - ) - Set-StrictMode -Version latest - - Trace-Message ($LocalizedData.TestStandardArgumentsPathWasPath -f $Path) - $uri = $null - try - { - $uri = [uri] $Path - } - catch - { - New-InvalidArgumentException ($LocalizedData.InvalidPath -f $Path) 'Path' - } - - if(-not @('file', 'http', 'https') -contains $uri.Scheme) - { - Trace-Message ($Localized.TheUriSchemeWasUriScheme -f $uri.Scheme) - New-InvalidArgumentException ($LocalizedData.InvalidPath -f $Path) 'Path' - } - - $pathExt = [System.IO.Path]::GetExtension($Path) - Trace-Message ($LocalizedData.ThePathExtensionWasPathExt -f $pathExt) - if(-not @('.msu') -contains $pathExt.ToLower()) - { - New-InvalidArgumentException ($LocalizedData.InvalidBinaryType -f $Path) 'Path' - } - - if(-not $Id) - { - New-InvalidArgumentException ($LocalizedData.NeedsMoreInfo -f $Path) 'Id' - } - else - { - if($Id -match 'kb[0-9]+') - { - if($Matches[0] -eq $id) - { - $kbId = $id.Substring(2) - } - else - { - New-InvalidArgumentException ($LocalizedData.InvalidIdFormat -f $Path) 'Id' - } - } - elseif($id -match '[0-9]+') - { - if($Matches[0] -eq $id) - { - $kbId = $id - } - else - { - New-InvalidArgumentException ($LocalizedData.InvalidIdFormat -f $Path) 'Id' - } - } - } - - return @($uri, $kbId) -} - - -function Test-WindowsUpdatePath -{ - <# - .SYNOPSIS - Validate path, if necessary, cache file and return the location to be accessed - #> - param( - [parameter(Mandatory = $true)] - [System.Uri] $uri, - - [pscredential] $Credential - ) - Set-StrictMode -Version latest - - if($uri.IsUnc) - { - $psdriveArgs = @{Name=([guid]::NewGuid());PSProvider='FileSystem';Root=(Split-Path $uri.LocalPath)} - if($Credential) - { - #We need to optionally include these and then splat the hash otherwise - #we pass a null for Credential which causes the cmdlet to pop a dialog up - $psdriveArgs['Credential'] = $Credential - } - - $psdrive = New-PSDrive @psdriveArgs - $Path = Join-Path $psdrive.Root (Split-Path -Leaf $uri.LocalPath) #Necessary? - } - elseif(@('http', 'https') -contains $uri.Scheme) - { - $scheme = $uri.Scheme - $outStream = $null - $responseStream = $null - - try - { - Trace-Message ($LocalizedData.CreatingCacheLocation) - - if(-not (Test-Path -PathType Container $CacheLocation)) - { - mkdir $CacheLocation | Out-Null - } - - $destName = Join-Path $CacheLocation (Split-Path -Leaf $uri.LocalPath) - - Trace-Message ($LocalizedData.NeedToDownloadFileFromSchemeDestinationWillBeDestName -f $scheme, $destName) - - try - { - Trace-Message ($LocalizedData.CreatingTheDestinationCacheFile) - $outStream = New-Object System.IO.FileStream $destName, 'Create' - } - catch - { - #Should never happen since we own the cache directory - Throw-TerminatingError ($LocalizedData.CouldNotOpenDestFile -f $destName) $_ - } - - try - { - Trace-Message ($LocalizedData.CreatingTheSchemeStream -f $scheme) - $request = [System.Net.WebRequest]::Create($uri) - Trace-Message ($LocalizedData.SettingDefaultCredential) - $request.Credentials = [System.Net.CredentialCache]::DefaultCredentials - if ($scheme -eq 'http') - { - Trace-Message ($LocalizedData.SettingAuthenticationLevel) - # default value is MutualAuthRequested, which applies to https scheme - $request.AuthenticationLevel = [System.Net.Security.AuthenticationLevel]::None - } - if ($scheme -eq 'https') - { - Trace-Message ($LocalizedData.IgnoringBadCertificates) - $request.ServerCertificateValidationCallBack = {$true} - } - Trace-Message ($LocalizedData.GettingTheSchemeResponseStream -f $scheme) - $responseStream = (([System.Net.HttpWebRequest]$request).GetResponse()).GetResponseStream() - } - catch - { - Trace-Message ($LocalizedData.ErrorOutString -f ($_ | Out-String)) - Throw-TerminatingError ($LocalizedData.CouldNotGetHttpStream -f $scheme, $Path) $_ - } - - try - { - Trace-Message ($LocalizedData.CopyingTheSchemeStreamBytesToTheDiskCache -f $scheme) - $responseStream.CopyTo($outStream) - $responseStream.Flush() - $outStream.Flush() - } - catch - { - Trace-Message ($LocalizedData.ErrorOutString -f ($_ | Out-String)) - Throw-TerminatingError ($LocalizedData.ErrorCopyingDataToFile -f $Path,$destName) $_ - } - } - finally - { - if($outStream) - { - $outStream.Close() - } - - if($responseStream) - { - $responseStream.Close() - } - } - Trace-Message ($LocalizedData.RedirectingPackagePathToCacheFileLocation) - $Path = $downloadedFileName = $destName - } - return $Path -} - -Export-ModuleMember -Function *-TargetResource - - - diff --git a/lib/puppet_x/dsc_resources/xWindowsUpdate/DscResources/MSFT_xWindowsUpdate/MSFT_xWindowsUpdate.schema.mof b/lib/puppet_x/dsc_resources/xWindowsUpdate/DscResources/MSFT_xWindowsUpdate/MSFT_xWindowsUpdate.schema.mof deleted file mode 100644 index f48ddfb4..00000000 --- a/lib/puppet_x/dsc_resources/xWindowsUpdate/DscResources/MSFT_xWindowsUpdate/MSFT_xWindowsUpdate.schema.mof +++ /dev/null @@ -1,13 +0,0 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xHotfix")] -class MSFT_xWindowsUpdate : OMI_BaseResource -{ - // We can have multiple versions of an update for a single ID, the indentifier is in the file, - // Therefore the file path should be the key - [key, Description("Specifies the path that contains the msu file for the hotfix installation.")] String Path; - [required, Description("Specifies the Hotfix ID.")] String Id; - [Write, Description("Specifies the location of the log that contains information from the installation.")] String Log; - [Write, Description("Specifies whether the hotfix needs to be installed or uninstalled."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [write, Description("Specifies the credential to use to authenticate to a UNC share if the path is on a UNC share."),EmbeddedInstance("MSFT_Credential")] string Credential; -}; - - diff --git a/lib/puppet_x/dsc_resources/xWindowsUpdate/DscResources/MSFT_xWindowsUpdateAgent/MSFT_xWindowsUpdateAgent.psm1 b/lib/puppet_x/dsc_resources/xWindowsUpdate/DscResources/MSFT_xWindowsUpdateAgent/MSFT_xWindowsUpdateAgent.psm1 deleted file mode 100644 index 2e0e97fd..00000000 --- a/lib/puppet_x/dsc_resources/xWindowsUpdate/DscResources/MSFT_xWindowsUpdateAgent/MSFT_xWindowsUpdateAgent.psm1 +++ /dev/null @@ -1,614 +0,0 @@ -Set-StrictMode -Version latest -$script:WuaSearchString = 'IsAssigned=1 and IsHidden=0 and IsInstalled=0' -function Get-WuaServiceManager -{ - return (New-Object -ComObject Microsoft.Update.ServiceManager) -} - -function Add-WuaService -{ - param( - [Parameter(Mandatory=$true)] - [string] - $ServiceId, - - [int] - $Flags = 7, - - [string] - $AuthorizationCabPath = [string]::Empty - - ) - - $wuaServiceManager = Get-WuaServiceManager - $wuaServiceManager.AddService2($ServiceId, $Flags, $AuthorizationCabPath) -} - -function Remove-WuaService -{ - param( - [Parameter(Mandatory=$true)] - [string] - $ServiceId - ) - - $wuaServiceManager = Get-WuaServiceManager - $wuaServiceManager.RemoveService($ServiceId) -} - -function Get-WuaSearchString -{ - param( - [switch] - $security, - [switch] - $optional, - [switch] - $important - ) - $securityCategoryId = "'0FA1201D-4330-4FA8-8AE9-B877473B6441'" - <# - - - - - - # invalid, would not install anything - not security and not optional and not important - #> - # security and optional and important - # not security and optional and important - if($optional -and $important) - { - # Installing everything not hidden and not already installed - return 'IsHidden=0 and IsInstalled=0' - } - # security and optional and not important - elseif ($security -and $optional) { - # or can only be used at the top most boolean expression - return "(IsAssigned=0 and IsHidden=0 and IsInstalled=0) or (CategoryIds contains $securityCategoryId and IsHidden=0 and IsInstalled=0)" - } - # security and not optional and important - elseif($security -and $important ){ - # Installing everything not hidden, - # not optional (optional are not assigned) and not already installed - return 'IsAssigned=1 and IsHidden=0 and IsInstalled=0' - } - elseif ($optional -and $important) { - # Installing everything not hidden, - # not optional (optional are not assigned) and not already installed - return 'IsHidden=0 and IsInstalled=0' - - } - # security and not optional and not important - elseif ($security) { - # Installing everything that is security and not hidden, - # and not already installed - return "CategoryIds contains $securityCategoryId and IsHidden=0 and IsInstalled=0" - } - # not security and not optional and important - elseif ($important) { - # Installing everything that is not hidden, - # is assigned (not optional) and not already installed - # not valid cannot do not contains or a boolean not - # Note important updates will include security updates - return "IsAssigned=1 and IsHidden=0 and IsInstalled=0" - } - # not security and optional and not important - elseif ($optional) { - # Installing everything that is not hidden, - # is not assigned (is optional) and not already installed - # not valid cannot do not contains or a boolean not - - # Note optional updates may include security updates - return "IsAssigned=0 and IsHidden=0 and IsInstalled=0" - } - - return "CategoryIds contains $securityCategoryId and IsHidden=0 and IsInstalled=0" - -} - -function Get-WuaAu -{ - return (New-Object -ComObject 'Microsoft.Update.AutoUpdate') -} - -function Get-WuaAuSettings -{ - return (Get-WuaAu).Settings -} - -function Get-WuaWrapper { - param( - [ScriptBlock] $tryBlock, - [object[]] $argumentList, - [Parameter(ParameterSetName='OneValue')] - [object] $ExceptionReturnValue = $null - ) - - try { - return Invoke-Command -ScriptBlock $tryBlock -NoNewScope -ArgumentList $argumentList - } - catch [System.Runtime.InteropServices.COMException] - { - switch($_.Exception.HResult) - { - # 0x8024001e -2145124322 WU_E_SERVICE_STOP Operation did not complete because the service or system was being shut down. wuerror.h - -2145124322 { - Write-Warning 'Got an error that WU service is stopping. Handling the error.' - return $ExceptionReturnValue - } - # 0x8024402c -2145107924 WU_E_PT_WINHTTP_NAME_NOT_RESOLVED Same as ERROR_WINHTTP_NAME_NOT_RESOLVED - the proxy server or target server name cannot be resolved. wuerror.h - -2145107924 { - # TODO: add retry for this error - Write-Warning 'Got an error that WU could not resolve the name of the update service. Handling the error.' - return $ExceptionReturnValue - } - # 0x8024401c -2145107940 WU_E_PT_HTTP_STATUS_REQUEST_TIMEOUT Same as HTTP status 408 - the server timed out waiting for the request. wuerror.h - -2145107940 { - # TODO: add retry for this error - Write-Warning 'Got an error a request timed out (http status 408 or equivalent) when WU was communicating with the update service. Handling the error.' - return $ExceptionReturnValue - } - # 0x8024402f -2145107921 WU_E_PT_ECP_SUCCEEDED_WITH_ERRORS External cab file processing completed with some errors. wuerror.h - -2145107921 { - # No retry needed - Write-Warning 'Got an error that CAB processing completed with some errors.' - return $ExceptionReturnValue - } - default { - throw - } - } - } -} - -function Get-WuaAuNotificationLevel -{ - return Get-WuaWrapper -tryBlock { - switch ((Get-WuaAuSettings).NotificationLevel) { - 0 { return 'Not Configured' } - 1 { return 'Disabled' } - 2 { return 'Notify before download' } - 3 { return 'Notify before installation' } - 4 { return 'Scheduled installation' } - default { return 'Reserved'} - } - } -ExceptionReturnValue [string]::Empty -} - -function Invoke-WuaDownloadUpdates -{ - param( - [Parameter(Mandatory=$true)] - [ValidateNotNullOrEmpty()] - [object] $UpdateCollection - ) - - $downloader = (Get-WuaSession).CreateUpdateDownloader() - $downloader.Updates = $UpdateCollection - - Write-Verbose -Message 'Downloading updates...' -Verbose - $downloadResult = $downloader.Download() -} - -function Invoke-WuaInstallUpdates -{ - param( - [Parameter(Mandatory=$true)] - [ValidateNotNullOrEmpty()] - [object] $UpdateCollection - ) - - $installer = (Get-WuaSession).CreateUpdateInstaller() - - $installer.Updates = $UpdateCollection - Write-Verbose -Message 'Installing updates...' -Verbose - $installResult = $installer.Install() -} - -function Set-WuaAuNotificationLevel -{ - param( - [ValidateSet('Not Configured','Disabled','Notify before download','Notify before installation','Scheduled installation','ScheduledInstallation')] - [string] - $notificationLevel - ) - $intNotificationLevel = Get-WuaAuNotificationLevelInt -notificationLevel $notificationLevel - - $settings = Get-WuaAuSettings - $settings.NotificationLevel = $intNotificationLevel - $settings.Save() -} - -function Get-WuaAuNotificationLevelInt { - param( - [ValidateSet('Not Configured','Disabled','Notify before download','Notify before installation','Scheduled installation','ScheduledInstallation')] - [string] - $notificationLevel - ) - $intNotificationLevel =0 - - switch -Regex ($notificationLevel) { - '^Not\s*Configured$' { $intNotificationLevel = 0 } - '^Disabled$' { $intNotificationLevel = 1 } - '^Notify\s*before\s*download$' { $intNotificationLevel = 2 } - '^Notify\s*before\s*installation$' { $intNotificationLevel = 3 } - '^Scheduled\s*installation$' { $intNotificationLevel = 4 } - default { throw 'Invalid notification level'} - } - - return $intNotificationLevel -} - -function Get-WuaSystemInfo -{ - return (New-Object -ComObject 'Microsoft.Update.SystemInfo') -} - -function Get-WuaRebootRequired -{ - return Get-WuaWrapper -tryBlock { - Write-Verbose -Message 'TryGet RebootRequired...' -Verbose - $rebootRequired = (Get-WuaSystemInfo).rebootRequired - Write-Verbose -Message "Got rebootRequired: $rebootRequired" -Verbose - return $rebootRequired - } -ExceptionReturnValue $true - -} -function Get-WuaSession -{ - return (New-Object -ComObject 'Microsoft.Update.Session') -} - -function get-WuaSearcher -{ - [cmdletbinding(DefaultParameterSetName='category')] - param( - [parameter(Mandatory = $true, ParameterSetName = 'searchString')] - [System.String] - $SearchString, - - [parameter(ParameterSetName = 'category')] - [ValidateSet("Security","Important","Optional")] - [AllowEmptyCollection()] - [AllowNull()] - [System.String[]] - $Category= @('Security') - - ) - - $memberSearchString = $SearchString - if($PSCmdlet.ParameterSetName -eq 'category') - { - $searchStringParams = @{} - foreach($CategoryItem in $Category) - { - $searchStringParams[$CategoryItem]=$true - } - $memberSearchString = (Get-WuaSearchString @searchStringParams) - } - - return Get-WuaWrapper -tryBlock { - param( - [parameter(Mandatory = $true)] - [System.String] - $memberSearchString - ) - Write-Verbose -Message "Searching for updating using: $memberSearchString" -Verbose - return ((Get-WuaSession).CreateUpdateSearcher()).Search($memberSearchString) - } -argumentList @($memberSearchString) -} - -function Test-SearchResult -{ - [CmdletBinding()] - [OutputType([bool])] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNull()] - [System.Object] - $SearchResult - ) - - if(!(@($SearchResult | get-member |Select-Object -ExpandProperty Name) -contains 'Updates')) - { - Write-Verbose 'Did not find updates on SearchResult' - return $false - } - if(!(@(Get-Member -InputObject $SearchResult.Updates |Select-Object -ExpandProperty Name) -contains 'Count')) - { - Write-Verbose 'Did not find count on updates on SearchResult' - return $false - } - return $true -} - -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Yes")] - [System.String] - $IsSingleInstance, - - [ValidateSet("Security","Important","Optional")] - [AllowEmptyCollection()] - [AllowNull()] - [System.String[]] - $Category= @('Security'), - - [ValidateSet("Disabled","ScheduledInstallation")] - [System.String] - $Notifications, - - [parameter(Mandatory = $true)] - [ValidateSet("WindowsUpdate","MicrosoftUpdate","WSUS")] - [System.String] - $Source, - - [bool] - $UpdateNow = $false - ) - - Test-TargetResourceProperties @PSBoundParameters - $totalUpdatesNotInstalled = $null - $UpdateNowReturn = $null - $rebootRequired = $null - if($UpdateNow) - { - $rebootRequired = Get-WuaRebootRequired - $SearchResult = (get-WuaSearcher -Category $Category) - $totalUpdatesNotInstalled = 0 - if($SearchResult -and (Test-SearchResult -SearchResult $SearchResult)) - { - $totalUpdatesNotInstalled = $SearchResult.Updates.Count - } - $UpdateNowReturn = $false - if($totalUpdatesNotInstalled -eq 0 -and !$rebootRequired) - { - $UpdateNowReturn = $true - } - } - - $notificationLevel = (Get-WuaAuNotificationLevel) - - - $CategoryReturn = $Category - - $SourceReturn = 'WindowsUpdate' - $UpdateServices = (Get-WuaServiceManager).Services - #Check if the microsoft update service is registered - $defaultService = @($UpdateServices).where{$_.IsDefaultAuService} - Write-Verbose -Message "Get default search service: $($defaultService.ServiceId)" - if($defaultService.ServiceId -eq '7971f918-a847-4430-9279-4a52d1efe18d') - { - $SourceReturn = 'MicrosoftUpdate' - } - elseif ($defaultService.IsManaged) { - $SourceReturn = 'WSUS' - } - - $returnValue = @{ - IsSingleInstance = 'Yes' - Category = $CategoryReturn - AutomaticUpdatesNotificationSetting = $notificationLevel - TotalUpdatesNotInstalled = $totalUpdatesNotInstalled - RebootRequired = $rebootRequired - Notifications = $notificationLevel - Source = $SourceReturn - UpdateNow = $UpdateNowReturn - } - $returnValue -} - - -function Set-TargetResource -{ - # should be [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidGlobalVars", "DSCMachineStatus")], but it doesn't work - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidGlobalVars", "")] - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Yes")] - [System.String] - $IsSingleInstance, - - [ValidateSet("Security","Important","Optional")] - [System.String[]] - $Category= @('Security'), - - [ValidateSet("Disabled","ScheduledInstallation")] - [System.String] - $Notifications, - - [parameter(Mandatory = $true)] - [ValidateSet("WindowsUpdate","MicrosoftUpdate","WSUS")] - [System.String] - $Source, - - [bool] - $UpdateNow = $false - ) - - Test-TargetResourceProperties @PSBoundParameters - - $Get = Get-TargetResource @PSBoundParameters - - $updateCompliant = ($UpdateNow -eq $false -or $Get.UpdateNow -eq $UpdateNow) - Write-Verbose "updateNow compliant: $updateCompliant" - $notificationCompliant = (!$Notifications -or $Notifications -eq $Get.Notifications) - Write-Verbose "notifications compliant: $notificationCompliant" - $SourceCompliant = (!$Source -or $Source -eq $Get.Source) - Write-Verbose "service compliant: $notificationCompliant" - - If(!$updateCompliant -and $PSCmdlet.ShouldProcess("Install Updates")) - { - $SearchResult = (get-WuaSearcher -Category $Category) - if($SearchResult -and $SearchResult.Updates.Count -gt 0) - { - Write-Verbose -Verbose -Message 'Installing updates...' - #Write Results - foreach($update in $SearchResult.Updates) - { - $title = $update.Title - Write-Verbose -Message "Found update: $Title" -Verbose - } - - Invoke-WuaDownloadUpdates -UpdateCollection $SearchResult.Updates - - Invoke-WuaInstallUpdates -UpdateCollection $SearchResult.Updates - - - } - else - { - Write-Verbose -Verbose -Message 'No updates' - } - Write-Verbose -Verbose -Message 'Checking for a reboot...' - $rebootRequired = (Get-WuaRebootRequired) - if($rebootRequired) - { - Write-Verbose -Verbose -Message 'A reboot was required' - $global:DSCMachineStatus = 1 - } - else { - Write-Verbose -Verbose -Message 'A reboot was NOT required' - } - } - - If(!$notificationCompliant -and $PSCmdlet.ShouldProcess("Set notifications to: $notifications")) - { - Try - { - #TODO verify that group policy is not overriding this settings - # if it is throw an error, if it conflicts - Set-WuaAuNotificationLevel -notificationLevel $Notifications - } - Catch - { - $ErrorMsg = $_.Exception.Message - Write-Verbose $ErrorMsg - } - } - - If(!$SourceCompliant ) - { - if($Source -eq 'MicrosoftUpdate' -and $PSCmdlet.ShouldProcess("Enable Microsoft Update Service")) - { - Write-Verbose "Enable the Microsoft Update setting" - Add-WuaService -ServiceId '7971f918-a847-4430-9279-4a52d1efe18d' - Restart-Service wuauserv -ErrorAction SilentlyContinue - } - elseif($PSCmdlet.ShouldProcess("Disable Microsoft Update Service")) { - Write-Verbose "Disable the Microsoft Update setting" - Remove-WuaService -ServiceId '7971f918-a847-4430-9279-4a52d1efe18d' - } - - } -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Yes")] - [System.String] - $IsSingleInstance, - - [ValidateSet("Security","Important","Optional")] - [System.String[]] - $Category= @('Security'), - - [ValidateSet("Disabled","ScheduledInstallation")] - [System.String] - $Notifications, - - [parameter(Mandatory = $true)] - [ValidateSet("WindowsUpdate","MicrosoftUpdate","WSUS")] - [System.String] - $Source, - - [bool] - $UpdateNow = $false - ) - - Test-TargetResourceProperties @PSBoundParameters - #Output the result of Get-TargetResource function. - $Get = Get-TargetResource @PSBoundParameters - - $updateCompliant = ($UpdateNow -eq $false -or $Get.UpdateNow -eq $UpdateNow) - Write-Verbose "updateNow compliant: $updateCompliant" - $notificationCompliant = (!$Notifications -or $Notifications -eq $Get.Notifications) - Write-Verbose "notifications compliant: $notificationCompliant" - $SourceCompliant = (!$Source -or $Source -eq $Get.Source) - Write-Verbose "service compliant: $notificationCompliant" - If($updateCompliant -and $notificationCompliant -and $SourceCompliant) - { - return $true - } - Else - { - return $false - } -} - -function Test-TargetResourceProperties -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateSet("Yes")] - [System.String] - $IsSingleInstance, - - [ValidateSet("Security","Important","Optional")] - [AllowEmptyCollection()] - [AllowNull()] - [System.String[]] - $Category, - - [ValidateSet("Disabled","ScheduledInstallation")] - [System.String] - $Notifications, - - [parameter(Mandatory = $true)] - [ValidateSet("WindowsUpdate","MicrosoftUpdate","WSUS")] - [System.String] - $Source, - - [bool] - $UpdateNow - ) - $searchStringParams = @{} - foreach($CategoryItem in $Category) - { - $searchStringParams[$CategoryItem.ToLowerInvariant()]=$true - } - - if($UpdateNow -and (!$Category -or $Category.Count -eq 0)) - { - Write-Warning 'Defaulting to updating to security updates only. Please specify Category to avoid this warning.' - } - elseif ($searchStringParams.ContainsKey('important') -and !$searchStringParams.ContainsKey('security') ) { - Write-Warning "Important updates will include security updates. Please include Security in category to avoid this warning." - } - elseif ($searchStringParams.ContainsKey('optional') -and !$searchStringParams.ContainsKey('security') ) { - Write-Verbose "Optional updates may include security updates." - } - - if($Source -eq 'WSUS') - { - throw 'The WSUS service option is not implemented.' - } -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xWindowsUpdate/DscResources/MSFT_xWindowsUpdateAgent/MSFT_xWindowsUpdateAgent.schema.mof b/lib/puppet_x/dsc_resources/xWindowsUpdate/DscResources/MSFT_xWindowsUpdateAgent/MSFT_xWindowsUpdateAgent.schema.mof deleted file mode 100644 index cf5543f4..00000000 --- a/lib/puppet_x/dsc_resources/xWindowsUpdate/DscResources/MSFT_xWindowsUpdateAgent/MSFT_xWindowsUpdateAgent.schema.mof +++ /dev/null @@ -1,17 +0,0 @@ - -[ClassVersion("0.1.0.0"), FriendlyName("xWindowsUpdateAgent")] -class MSFT_xWindowsUpdateAgent : OMI_BaseResource -{ - [Key, Description("Specifies the resource is a single instance, the value must be 'Yes'"), ValueMap{"Yes"}, Values{"Yes"}] String IsSingleInstance; - [write, Description("Indicates if the resource should ensure all Windows Updates are installed or if Automatic updates should be disabled."), ValueMap{"Security","Important","Optional"}, - Values{"Security","Important","Optional"}] String Category[]; - [Write, Description("Indicates if Windows update agent should notify about updates, see:https://msdn.microsoft.com/en-us/library/windows/desktop/aa385806%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396."), - ValueMap{"Disabled","ScheduledInstallation"}, - Values{"Disabled","ScheduledInstallation"}] String Notifications; - [Required, Description("Indicates which source service Windows update agent should use. Note: WSUS is not implemented in this resource."), ValueMap{"WindowsUpdate","MicrosoftUpdate","WSUS"}, - Values{"WindowsUpdate","MicrosoftUpdate","WSUS"}] String Source; - [Write, Description("Indicates if the resource should trigger an update during consistency.")] boolean UpdateNow; - [Read, Description("Automatic Updates Notification Setting")] String AutomaticUpdatesNotificationSetting; - [Read, Description("Count of updates not installed. Only returned if UpdateNow is specified.")] uint32 TotalUpdatesNotInstalled; - [Read, Description("Indicates if Wua Requires a reboot. Only returned if UpdateNow is specified.")] boolean RebootRequired; -}; diff --git a/lib/puppet_x/dsc_resources/xWindowsUpdate/LICENSE b/lib/puppet_x/dsc_resources/xWindowsUpdate/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xWindowsUpdate/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xWindowsUpdate/xWindowsUpdate.psd1 b/lib/puppet_x/dsc_resources/xWindowsUpdate/xWindowsUpdate.psd1 deleted file mode 100644 index f0693d33..00000000 --- a/lib/puppet_x/dsc_resources/xWindowsUpdate/xWindowsUpdate.psd1 +++ /dev/null @@ -1,60 +0,0 @@ -@{ -# Version number of this module. -ModuleVersion = '2.7.0.0' - -# ID used to uniquely identify this module -GUID = 'a9cba250-ea73-4d82-b31b-7e58cc50ffd1' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'Module with DSC Resources for Windows Update' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Minimum version of the common language runtime (CLR) required by this module -CLRVersion = '4.0' - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/PowerShell/xWindowsUpdate/blob/master/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/PowerShell/xWindowsUpdate' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - ReleaseNotes = '* xWindowsUpdateAgent: Fix Get-TargetResource returning incorrect key - -' - - } # End of PSData hashtable - -} # End of PrivateData hashtable -} - - - diff --git a/lib/puppet_x/dsc_resources/xWordPress/DscResources/MSFT_xWordPressSite/MSFT_xWordPressSite.psm1 b/lib/puppet_x/dsc_resources/xWordPress/DscResources/MSFT_xWordPressSite/MSFT_xWordPressSite.psm1 deleted file mode 100644 index ea577a06..00000000 --- a/lib/puppet_x/dsc_resources/xWordPress/DscResources/MSFT_xWordPressSite/MSFT_xWordPressSite.psm1 +++ /dev/null @@ -1,156 +0,0 @@ -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData @' -WordPressInstallationSiteNotFound=Not able to connect to wordpress site using {0}. -WordPressInstallationFailed=Request to connect to wordpress site failed. Returned Status Code is {0], Description is {1}. -'@ -} - -$Debug = $true -Function Trace-Message -{ - param([string] $Message) - if($Debug) - { - Write-Verbose $Message - } -} - -# The Get-TargetResource cmdlet is used to fetch the status of role or Website on the target machine. -# It gives the Website info of the requested role/feature on the target machine. -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Uri, - - [parameter(Mandatory = $true)] - [System.String] - $Title, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $AdministratorCredential, - - [parameter(Mandatory = $true)] - [System.String] - $AdministratorEmail - ) - - $Ensure = "Absent" - try - { - $response = Invoke-WebRequest -UseBasicParsing -Uri $Uri - if(-not ($response.Content -like "*WordPress › Installation*")) - { - $Ensure = "Present" - } - } - catch - { - Write-Verbose ($($LocalizedData.WordPressInstallationSiteNotFound) -f ${Uri}) - return $false - } - - $getTargetResourceResult = @{ - Uri = $Uri - Ensure = $Ensure - Title = $Title - AdministratorEmail = $AdministratorCredential - } - - return $getTargetResourceResult; -} - - -# The Set-TargetResource cmdlet is used to create, delete or configuure a website on the target machine. -function Set-TargetResource -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Uri, - - [parameter(Mandatory = $true)] - [System.String] - $Title, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $AdministratorCredential, - - [parameter(Mandatory = $true)] - [System.String] - $AdministratorEmail, - - [ValidateSet("Present", "Absent")] - [string]$Ensure = "Present" - ) - - if((Test-TargetResource @psboundparameters)) - { - return - } - - $status = Get-TargetResource @psboundparameters - Trace-Message "Get Wordpress site resource completed." - - $result = Invoke-WebRequest -UseBasicParsing -Uri "$Uri/wp-admin/install.php?step=2" -Method Post -Body "weblog_title=$Title&user_name=$($AdministratorCredential.UserName)&admin_password=$($AdministratorCredential.GetNetworkCredential().Password)&admin_password2=$($AdministratorCredential.GetNetworkCredential().Password)&admin_email=$AdministratorEmail&Submit=Install+WordPress" - - if ($result.StatusCode -ne 200) - { - Write-Verbose ($($LocalizedData.WordPressInstallationFailed) -f $result.StatusCode, $result.StatusDescription) - } -} - - -# The Test-TargetResource cmdlet is used to validate if the role or feature is in a state as expected in the instance document. -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Uri, - - [parameter(Mandatory = $true)] - [System.String] - $Title, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $AdministratorCredential, - - [parameter(Mandatory = $true)] - [System.String] - $AdministratorEmail, - - [ValidateSet("Present", "Absent")] - [string]$Ensure = "Present" ) - - $handlerState = Get-TargetResource @psboundparameters - - if($handlerState.Ensure -eq "Present" ) - { - return $true - } - else - { - return $false - } - -} - -Export-ModuleMember -Function *-TargetResource diff --git a/lib/puppet_x/dsc_resources/xWordPress/DscResources/MSFT_xWordPressSite/MSFT_xWordPressSite.schema.mof b/lib/puppet_x/dsc_resources/xWordPress/DscResources/MSFT_xWordPressSite/MSFT_xWordPressSite.schema.mof deleted file mode 100644 index 267491f6..00000000 --- a/lib/puppet_x/dsc_resources/xWordPress/DscResources/MSFT_xWordPressSite/MSFT_xWordPressSite.schema.mof +++ /dev/null @@ -1,13 +0,0 @@ - -[ClassVersion("1.0.0"), FriendlyName("xWordPressSite")] -class MSFT_xWordPressSite : OMI_BaseResource -{ - [Key, Description("The WordPress Site URI.")] String Uri; - [Required, Description("The WordPress Site Default page title.")] String Title; - [Required, EmbeddedInstance("MSFT_Credential"), Description("The username and password of the WordPress administrator to create when creating the site.")] String AdministratorCredential; - [Required, Description("The email address of the WordPress administrator to create.")] String AdministratorEmail; - [Write, Description("Should the module be present or absent."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; -}; - - - diff --git a/lib/puppet_x/dsc_resources/xWordPress/DscResources/MSFT_xWordPressSite/xWordPressSite.ps1 b/lib/puppet_x/dsc_resources/xWordPress/DscResources/MSFT_xWordPressSite/xWordPressSite.ps1 deleted file mode 100644 index ce933462..00000000 --- a/lib/puppet_x/dsc_resources/xWordPress/DscResources/MSFT_xWordPressSite/xWordPressSite.ps1 +++ /dev/null @@ -1,55 +0,0 @@ -# Sample script to create the template or update the Wordpress Resource - -# Resource Details -# Friendly name of the resource: -$friendlyName = "xWordPressSite" -# Name of the resource: -$resourceName = "MSFT_$friendlyName" -# Class Version of the resource: -$classVersion = "1.0.0" - - -# Various Paths -$diff = join-Path ${env:ProgramFiles(x86)} "Beyond compare 2\bc2.exe" -$scriptRoot = Split-Path $MyInvocation.MyCommand.Path -$originalModuleRoot = join-Path $scriptroot "..\.." -$originalModuleRootPath = Resolve-Path $originalModuleRoot -$moduleRoot = Join-Path $env:temp "$($originalModuleRootPath.path | split-path -Leaf)Temp" - -$resources = @() -$schemaPath = (join-path $scriptRoot "$resourceName.schema.mof") - -#Key properties -$resources += New-xDscResourceProperty -Name Uri -Type String -Attribute Key -Description "The WordPress Site URI." - - -#Required Properites -$resources += New-xDscResourceProperty -Name Title -Type String -Attribute Required -Description "The WordPress Site Default page title." -$resources += New-xDscResourceProperty -Name AdministratorCredential -Type PSCredential -Attribute Required -Description "The username and password of the WordPress administrator to create when creating the site." -$resources += New-xDscResourceProperty -Name AdministratorEmail -Type String -Attribute Required -Description "The email address of the WordPress administrator to create." - -#Write Properties -$resources += New-xDscResourceProperty -Name Ensure -Type String -Attribute Write -Description "Currenly only Present is allowed." -ValidateSet @("Present") - -#Read Properties -#$resources += New-xDscResourceProperty -Name EndPointSetup -Type Boolean -Attribute Read -Description "The End Point is setup. Such as a Fast Cgi endpoint." - - - -Write-Host updating... - -# Create a New template resource to a temporary folder -New-xDscResource -Property $resources -ClassVersion $classVersion -Name $resourceName -Path $moduleRoot -FriendlyName $friendlyName - - -# Use your favorite diff program to compare and merge the current resource and the existing resource -if((test-Path $diff)) -{ - &$diff $originalModuleRoot $moduleRoot -} -else -{ - Write-Warning "Diff propgram not found!`r`nUse your favorite diff program to compare and merge:`r`n `t$($originalModuleRootPath.path)`r`n and:`r`n `t$moduleRoot" -} - - diff --git a/lib/puppet_x/dsc_resources/xWordPress/DscResources/xIisWordPressSite/xIisWordPressSite.Schema.psm1 b/lib/puppet_x/dsc_resources/xWordPress/DscResources/xIisWordPressSite/xIisWordPressSite.Schema.psm1 deleted file mode 100644 index 6009fbfe..00000000 --- a/lib/puppet_x/dsc_resources/xWordPress/DscResources/xIisWordPressSite/xIisWordPressSite.Schema.psm1 +++ /dev/null @@ -1,84 +0,0 @@ -# Composite configuration to install the IIS WordPress IIS site -# This does not setup the actual WordPress Site -configuration xIisWordPressSite -{ - param - ( - [Parameter(Mandatory = $true)] - [string] $DestinationPath, - - [Parameter(Mandatory = $true)] - [string] $DownloadUri, - - [Parameter(Mandatory = $true)] - [string] $PackageFolder, - - [Parameter(Mandatory = $true)] - [string] $Configuration - ) - - [string] $BinaryFolder = Join-Path $DestinationPath "WordPress" - - # Make sure the WordPress site folder is present - File WordPressFolder - { - DestinationPath = $BinaryFolder - Type = "Directory" - Ensure = "Present" - - } - - # Make sure the default IIS does not interfere with the WordPress site - # Should be removed once WordPress site launches by it is own URL and not using iis default url - xWebSite DefaultIisSite - { - Name = "Default Web Site" - PhysicalPath = "$env:SystemDrive\inetpub\wwwroot" - Ensure = "Present" - State = "Started" - BindingInfo = MSFT_xWebBindingInformation - { - Protocol = "HTTP" - Port = 9090 - } - } - - # Make sure the WordPress Iis site is present - xWebSite WordPressIisSite - { - Name = "WordPress" - PhysicalPath = $BinaryFolder - Ensure = "Present" - State = "Started" - DefaultPage = @("index.php") - DependsOn = @("[File]WordPressFolder","[xWebSite]DefaultIisSite") - } - - $WordPressZip = Join-Path $PackageFolder "WordPress.zip" - # Make sure the WordPress archive is in the package folder - xRemoteFile WordPressArchive - { - Uri = $DownloadUri - DestinationPath = $WordPressZip - } - - # Make sure the WordPress archive contents are in the WordPress root folder - xArchive WordPress - { - Path = $WordPressZip - Destination = $DestinationPath - DependsOn = @("[xRemoteFile]WordPressArchive","[File]WordPressFolder") - } - - # Make sure the WordPress configuration file is present - File WordPressConfig - { - Contents = $Configuration - DestinationPath = (Join-Path $BinaryFolder "wp-config.php") - DependsOn = @("[xArchive]WordPress") - MatchSource = $true - } -} - - - diff --git a/lib/puppet_x/dsc_resources/xWordPress/DscResources/xIisWordPressSite/xIisWordPressSite.psd1 b/lib/puppet_x/dsc_resources/xWordPress/DscResources/xIisWordPressSite/xIisWordPressSite.psd1 deleted file mode 100644 index a504c2bc..00000000 --- a/lib/puppet_x/dsc_resources/xWordPress/DscResources/xIisWordPressSite/xIisWordPressSite.psd1 +++ /dev/null @@ -1,96 +0,0 @@ -# -# Module manifest for module 'xIisWordPressSite' -# -# Generated on: 6/23/2014 -# - -@{ - -# Script module or binary module file associated with this manifest. -RootModule = 'xIisWordPressSite.Schema.psm1' - -# Version number of this module. -ModuleVersion = '1.0' - -# ID used to uniquely identify this module -GUID = 'af68428d-cfd6-41f3-9521-874614eb6d50' - -# Author of this module -Author = 'Microsoft Coropration' - -# Company or vendor of this module -CompanyName = 'Microsoft Coropration' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft Coropration. All rights reserved.' - -# Description of the functionality provided by this module -# Description = '' - -# Minimum version of the Windows PowerShell engine required by this module -# PowerShellVersion = '' - -# Name of the Windows PowerShell host required by this module -# PowerShellHostName = '' - -# Minimum version of the Windows PowerShell host required by this module -# PowerShellHostVersion = '' - -# Minimum version of Microsoft .NET Framework required by this module -# DotNetFrameworkVersion = '' - -# Minimum version of the common language runtime (CLR) required by this module -# CLRVersion = '' - -# Processor architecture (None, X86, Amd64) required by this module -# ProcessorArchitecture = '' - -# Modules that must be imported into the global environment prior to importing this module -# RequiredModules = @() - -# Assemblies that must be loaded prior to importing this module -# RequiredAssemblies = @() - -# Script files (.ps1) that are run in the caller's environment prior to importing this module. -# ScriptsToProcess = @() - -# Type files (.ps1xml) to be loaded when importing this module -# TypesToProcess = @() - -# Format files (.ps1xml) to be loaded when importing this module -# FormatsToProcess = @() - -# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess -# NestedModules = @() - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' - -# Variables to export from this module -VariablesToExport = '*' - -# Aliases to export from this module -AliasesToExport = '*' - -# List of all modules packaged with this module -# ModuleList = @() - -# List of all files packaged with this module -# FileList = @() - -# Private data to pass to the module specified in RootModule/ModuleToProcess -# PrivateData = '' - -# HelpInfo URI of this module -# HelpInfoURI = '' - -# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. -# DefaultCommandPrefix = '' - -} - - - diff --git a/lib/puppet_x/dsc_resources/xWordPress/LICENSE b/lib/puppet_x/dsc_resources/xWordPress/LICENSE deleted file mode 100644 index 567fd6a5..00000000 --- a/lib/puppet_x/dsc_resources/xWordPress/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/lib/puppet_x/dsc_resources/xWordPress/xWordPress.psd1 b/lib/puppet_x/dsc_resources/xWordPress/xWordPress.psd1 deleted file mode 100644 index bd96e31e..00000000 --- a/lib/puppet_x/dsc_resources/xWordPress/xWordPress.psd1 +++ /dev/null @@ -1,36 +0,0 @@ -@{ -# Version number of this module. -ModuleVersion = '1.1.0.0' - -# ID used to uniquely identify this module -GUID = 'f7a98e58-27fd-4fc8-8467-ae28bfc6cf63' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2014 Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'Module with DSC Resources for configuring WordPress' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '4.0' - -# Minimum version of the common language runtime (CLR) required by this module -CLRVersion = '4.0' - -# Script module or binary module file associated with this manifest. -#RootModule = '' - -# Functions to export from this module -FunctionsToExport = '*' - -# Cmdlets to export from this module -CmdletsToExport = '*' -} - - diff --git a/spec/unit/puppet/type/dsc_archive_spec.rb b/spec/unit/puppet/type/dsc_archive_spec.rb deleted file mode 100644 index d4593955..00000000 --- a/spec/unit/puppet/type/dsc_archive_spec.rb +++ /dev/null @@ -1,403 +0,0 @@ -#!/usr/bin/env ruby -require 'spec_helper' - -describe Puppet::Type.type(:dsc_archive) do - - let :dsc_archive do - Puppet::Type.type(:dsc_archive).new( - :name => 'foo', - :dsc_path => 'foo', - :dsc_destination => 'foo', - ) - end - - it 'should allow all properties to be specified' do - expect { Puppet::Type.type(:dsc_archive).new( - :name => 'foo', - :dsc_ensure => 'Present', - :dsc_path => 'foo', - :dsc_destination => 'foo', - :dsc_validate => true, - :dsc_checksum => 'SHA-1', - :dsc_force => true, - :dsc_credential => {"user"=>"user", "password"=>"password"}, - )}.to_not raise_error - end - - it "should stringify normally" do - expect(dsc_archive.to_s).to eq("Dsc_archive[foo]") - end - - it 'should default to ensure => present' do - expect(dsc_archive[:ensure]).to eq :present - end - - it 'should accept dsc_ensure predefined value Present' do - dsc_archive[:dsc_ensure] = 'Present' - expect(dsc_archive[:dsc_ensure]).to eq('Present') - end - - it 'should accept dsc_ensure predefined value present' do - dsc_archive[:dsc_ensure] = 'present' - expect(dsc_archive[:dsc_ensure]).to eq('present') - end - - it 'should accept dsc_ensure predefined value present and update ensure with this value (ensure end value should be a symbol)' do - dsc_archive[:dsc_ensure] = 'present' - expect(dsc_archive[:ensure]).to eq(dsc_archive[:dsc_ensure].downcase.to_sym) - end - - it 'should accept dsc_ensure predefined value Absent' do - dsc_archive[:dsc_ensure] = 'Absent' - expect(dsc_archive[:dsc_ensure]).to eq('Absent') - end - - it 'should accept dsc_ensure predefined value absent' do - dsc_archive[:dsc_ensure] = 'absent' - expect(dsc_archive[:dsc_ensure]).to eq('absent') - end - - it 'should accept dsc_ensure predefined value absent and update ensure with this value (ensure end value should be a symbol)' do - dsc_archive[:dsc_ensure] = 'absent' - expect(dsc_archive[:ensure]).to eq(dsc_archive[:dsc_ensure].downcase.to_sym) - end - - it 'should not accept values not equal to predefined values' do - expect{dsc_archive[:dsc_ensure] = 'invalid value'}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_ensure' do - expect{dsc_archive[:dsc_ensure] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_ensure' do - expect{dsc_archive[:dsc_ensure] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_ensure' do - expect{dsc_archive[:dsc_ensure] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_ensure' do - expect{dsc_archive[:dsc_ensure] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should require that dsc_path is specified' do - #dsc_archive[:dsc_path] - expect { Puppet::Type.type(:dsc_archive).new( - :name => 'foo', - :dsc_destination => 'foo', - )}.to raise_error(Puppet::Error, /dsc_path is a required attribute/) - end - - it 'should not accept array for dsc_path' do - expect{dsc_archive[:dsc_path] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_path' do - expect{dsc_archive[:dsc_path] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_path' do - expect{dsc_archive[:dsc_path] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_path' do - expect{dsc_archive[:dsc_path] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should require that dsc_destination is specified' do - #dsc_archive[:dsc_destination] - expect { Puppet::Type.type(:dsc_archive).new( - :name => 'foo', - :dsc_path => 'foo', - )}.to raise_error(Puppet::Error, /dsc_destination is a required attribute/) - end - - it 'should not accept array for dsc_destination' do - expect{dsc_archive[:dsc_destination] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_destination' do - expect{dsc_archive[:dsc_destination] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_destination' do - expect{dsc_archive[:dsc_destination] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_destination' do - expect{dsc_archive[:dsc_destination] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_validate' do - expect{dsc_archive[:dsc_validate] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should accept boolean for dsc_validate' do - dsc_archive[:dsc_validate] = true - expect(dsc_archive[:dsc_validate]).to eq(true) - end - - it "should accept boolean-like value 'true' and munge this value to boolean for dsc_validate" do - dsc_archive[:dsc_validate] = 'true' - expect(dsc_archive[:dsc_validate]).to eq(true) - end - - it "should accept boolean-like value 'false' and munge this value to boolean for dsc_validate" do - dsc_archive[:dsc_validate] = 'false' - expect(dsc_archive[:dsc_validate]).to eq(false) - end - - it "should accept boolean-like value 'True' and munge this value to boolean for dsc_validate" do - dsc_archive[:dsc_validate] = 'True' - expect(dsc_archive[:dsc_validate]).to eq(true) - end - - it "should accept boolean-like value 'False' and munge this value to boolean for dsc_validate" do - dsc_archive[:dsc_validate] = 'False' - expect(dsc_archive[:dsc_validate]).to eq(false) - end - - it "should accept boolean-like value :true and munge this value to boolean for dsc_validate" do - dsc_archive[:dsc_validate] = :true - expect(dsc_archive[:dsc_validate]).to eq(true) - end - - it "should accept boolean-like value :false and munge this value to boolean for dsc_validate" do - dsc_archive[:dsc_validate] = :false - expect(dsc_archive[:dsc_validate]).to eq(false) - end - - it 'should not accept int for dsc_validate' do - expect{dsc_archive[:dsc_validate] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_validate' do - expect{dsc_archive[:dsc_validate] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should accept dsc_checksum predefined value SHA-1' do - dsc_archive[:dsc_checksum] = 'SHA-1' - expect(dsc_archive[:dsc_checksum]).to eq('SHA-1') - end - - it 'should accept dsc_checksum predefined value sha-1' do - dsc_archive[:dsc_checksum] = 'sha-1' - expect(dsc_archive[:dsc_checksum]).to eq('sha-1') - end - - it 'should accept dsc_checksum predefined value SHA-256' do - dsc_archive[:dsc_checksum] = 'SHA-256' - expect(dsc_archive[:dsc_checksum]).to eq('SHA-256') - end - - it 'should accept dsc_checksum predefined value sha-256' do - dsc_archive[:dsc_checksum] = 'sha-256' - expect(dsc_archive[:dsc_checksum]).to eq('sha-256') - end - - it 'should accept dsc_checksum predefined value SHA-512' do - dsc_archive[:dsc_checksum] = 'SHA-512' - expect(dsc_archive[:dsc_checksum]).to eq('SHA-512') - end - - it 'should accept dsc_checksum predefined value sha-512' do - dsc_archive[:dsc_checksum] = 'sha-512' - expect(dsc_archive[:dsc_checksum]).to eq('sha-512') - end - - it 'should accept dsc_checksum predefined value CreatedDate' do - dsc_archive[:dsc_checksum] = 'CreatedDate' - expect(dsc_archive[:dsc_checksum]).to eq('CreatedDate') - end - - it 'should accept dsc_checksum predefined value createddate' do - dsc_archive[:dsc_checksum] = 'createddate' - expect(dsc_archive[:dsc_checksum]).to eq('createddate') - end - - it 'should accept dsc_checksum predefined value ModifiedDate' do - dsc_archive[:dsc_checksum] = 'ModifiedDate' - expect(dsc_archive[:dsc_checksum]).to eq('ModifiedDate') - end - - it 'should accept dsc_checksum predefined value modifieddate' do - dsc_archive[:dsc_checksum] = 'modifieddate' - expect(dsc_archive[:dsc_checksum]).to eq('modifieddate') - end - - it 'should not accept values not equal to predefined values' do - expect{dsc_archive[:dsc_checksum] = 'invalid value'}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_checksum' do - expect{dsc_archive[:dsc_checksum] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_checksum' do - expect{dsc_archive[:dsc_checksum] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_checksum' do - expect{dsc_archive[:dsc_checksum] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_checksum' do - expect{dsc_archive[:dsc_checksum] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_force' do - expect{dsc_archive[:dsc_force] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should accept boolean for dsc_force' do - dsc_archive[:dsc_force] = true - expect(dsc_archive[:dsc_force]).to eq(true) - end - - it "should accept boolean-like value 'true' and munge this value to boolean for dsc_force" do - dsc_archive[:dsc_force] = 'true' - expect(dsc_archive[:dsc_force]).to eq(true) - end - - it "should accept boolean-like value 'false' and munge this value to boolean for dsc_force" do - dsc_archive[:dsc_force] = 'false' - expect(dsc_archive[:dsc_force]).to eq(false) - end - - it "should accept boolean-like value 'True' and munge this value to boolean for dsc_force" do - dsc_archive[:dsc_force] = 'True' - expect(dsc_archive[:dsc_force]).to eq(true) - end - - it "should accept boolean-like value 'False' and munge this value to boolean for dsc_force" do - dsc_archive[:dsc_force] = 'False' - expect(dsc_archive[:dsc_force]).to eq(false) - end - - it "should accept boolean-like value :true and munge this value to boolean for dsc_force" do - dsc_archive[:dsc_force] = :true - expect(dsc_archive[:dsc_force]).to eq(true) - end - - it "should accept boolean-like value :false and munge this value to boolean for dsc_force" do - dsc_archive[:dsc_force] = :false - expect(dsc_archive[:dsc_force]).to eq(false) - end - - it 'should not accept int for dsc_force' do - expect{dsc_archive[:dsc_force] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_force' do - expect{dsc_archive[:dsc_force] = 16}.to raise_error(Puppet::ResourceError) - end - - it "should not accept empty password for dsc_credential" do - expect{dsc_archive[:dsc_credential] = {"user"=>"user", "password"=>""}}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_credential' do - expect{dsc_archive[:dsc_credential] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_credential' do - expect{dsc_archive[:dsc_credential] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_credential' do - expect{dsc_archive[:dsc_credential] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_credential' do - expect{dsc_archive[:dsc_credential] = 16}.to raise_error(Puppet::ResourceError) - end - - # Configuration PROVIDER TESTS - - describe "powershell provider tests" do - - it "should successfully instanciate the provider" do - described_class.provider(:powershell).new(dsc_archive) - end - - before(:each) do - @provider = described_class.provider(:powershell).new(dsc_archive) - end - - describe "when dscmeta_module_name existing/is defined " do - - it "should compute powershell dsc test script with Invoke-DscResource" do - expect(@provider.ps_script_content('test')).to match(/Invoke-DscResource/) - end - - it "should compute powershell dsc test script with method Test" do - expect(@provider.ps_script_content('test')).to match(/Method\s+=\s*'test'/) - end - - it "should compute powershell dsc set script with Invoke-DscResource" do - expect(@provider.ps_script_content('set')).to match(/Invoke-DscResource/) - end - - it "should compute powershell dsc test script with method Set" do - expect(@provider.ps_script_content('set')).to match(/Method\s+=\s*'set'/) - end - - end - - describe "when dsc_ensure is 'present'" do - - before(:each) do - dsc_archive.original_parameters[:dsc_ensure] = 'present' - dsc_archive[:dsc_ensure] = 'present' - @provider = described_class.provider(:powershell).new(dsc_archive) - end - - it "should update :ensure to :present" do - expect(dsc_archive[:ensure]).to eq(:present) - end - - it "should compute powershell dsc test script in which ensure value is 'present'" do - expect(@provider.ps_script_content('test')).to match(/ensure = 'present'/) - end - - it "should compute powershell dsc set script in which ensure value is 'present'" do - expect(@provider.ps_script_content('set')).to match(/ensure = 'present'/) - end - - end - - describe "when dsc_ensure is 'absent'" do - - before(:each) do - dsc_archive.original_parameters[:dsc_ensure] = 'absent' - dsc_archive[:dsc_ensure] = 'absent' - @provider = described_class.provider(:powershell).new(dsc_archive) - end - - it "should update :ensure to :absent" do - expect(dsc_archive[:ensure]).to eq(:absent) - end - - it "should compute powershell dsc test script in which ensure value is 'present'" do - expect(@provider.ps_script_content('test')).to match(/ensure = 'present'/) - end - - it "should compute powershell dsc set script in which ensure value is 'absent'" do - expect(@provider.ps_script_content('set')).to match(/ensure = 'absent'/) - end - - end - - describe "when dsc_resource has credentials" do - - it "should convert credential hash to a pscredential object" do - expect(@provider.ps_script_content('test')).to match(/| new-pscredential'/) - end - - end - - - end -end diff --git a/spec/unit/puppet/type/dsc_environment_spec.rb b/spec/unit/puppet/type/dsc_environment_spec.rb deleted file mode 100644 index 6dd86c0e..00000000 --- a/spec/unit/puppet/type/dsc_environment_spec.rb +++ /dev/null @@ -1,244 +0,0 @@ -#!/usr/bin/env ruby -require 'spec_helper' - -describe Puppet::Type.type(:dsc_environment) do - - let :dsc_environment do - Puppet::Type.type(:dsc_environment).new( - :name => 'foo', - :dsc_name => 'foo', - ) - end - - it 'should allow all properties to be specified' do - expect { Puppet::Type.type(:dsc_environment).new( - :name => 'foo', - :dsc_name => 'foo', - :dsc_value => 'foo', - :dsc_ensure => 'Present', - :dsc_path => true, - )}.to_not raise_error - end - - it "should stringify normally" do - expect(dsc_environment.to_s).to eq("Dsc_environment[foo]") - end - - it 'should default to ensure => present' do - expect(dsc_environment[:ensure]).to eq :present - end - - it 'should require that dsc_name is specified' do - #dsc_environment[:dsc_name] - expect { Puppet::Type.type(:dsc_environment).new( - :name => 'foo', - )}.to raise_error(Puppet::Error, /dsc_name is a required attribute/) - end - - it 'should not accept array for dsc_name' do - expect{dsc_environment[:dsc_name] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_name' do - expect{dsc_environment[:dsc_name] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_name' do - expect{dsc_environment[:dsc_name] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_name' do - expect{dsc_environment[:dsc_name] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_value' do - expect{dsc_environment[:dsc_value] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_value' do - expect{dsc_environment[:dsc_value] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_value' do - expect{dsc_environment[:dsc_value] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_value' do - expect{dsc_environment[:dsc_value] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should accept dsc_ensure predefined value Present' do - dsc_environment[:dsc_ensure] = 'Present' - expect(dsc_environment[:dsc_ensure]).to eq('Present') - end - - it 'should accept dsc_ensure predefined value present' do - dsc_environment[:dsc_ensure] = 'present' - expect(dsc_environment[:dsc_ensure]).to eq('present') - end - - it 'should accept dsc_ensure predefined value present and update ensure with this value (ensure end value should be a symbol)' do - dsc_environment[:dsc_ensure] = 'present' - expect(dsc_environment[:ensure]).to eq(dsc_environment[:dsc_ensure].downcase.to_sym) - end - - it 'should accept dsc_ensure predefined value Absent' do - dsc_environment[:dsc_ensure] = 'Absent' - expect(dsc_environment[:dsc_ensure]).to eq('Absent') - end - - it 'should accept dsc_ensure predefined value absent' do - dsc_environment[:dsc_ensure] = 'absent' - expect(dsc_environment[:dsc_ensure]).to eq('absent') - end - - it 'should accept dsc_ensure predefined value absent and update ensure with this value (ensure end value should be a symbol)' do - dsc_environment[:dsc_ensure] = 'absent' - expect(dsc_environment[:ensure]).to eq(dsc_environment[:dsc_ensure].downcase.to_sym) - end - - it 'should not accept values not equal to predefined values' do - expect{dsc_environment[:dsc_ensure] = 'invalid value'}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_ensure' do - expect{dsc_environment[:dsc_ensure] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_ensure' do - expect{dsc_environment[:dsc_ensure] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_ensure' do - expect{dsc_environment[:dsc_ensure] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_ensure' do - expect{dsc_environment[:dsc_ensure] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_path' do - expect{dsc_environment[:dsc_path] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should accept boolean for dsc_path' do - dsc_environment[:dsc_path] = true - expect(dsc_environment[:dsc_path]).to eq(true) - end - - it "should accept boolean-like value 'true' and munge this value to boolean for dsc_path" do - dsc_environment[:dsc_path] = 'true' - expect(dsc_environment[:dsc_path]).to eq(true) - end - - it "should accept boolean-like value 'false' and munge this value to boolean for dsc_path" do - dsc_environment[:dsc_path] = 'false' - expect(dsc_environment[:dsc_path]).to eq(false) - end - - it "should accept boolean-like value 'True' and munge this value to boolean for dsc_path" do - dsc_environment[:dsc_path] = 'True' - expect(dsc_environment[:dsc_path]).to eq(true) - end - - it "should accept boolean-like value 'False' and munge this value to boolean for dsc_path" do - dsc_environment[:dsc_path] = 'False' - expect(dsc_environment[:dsc_path]).to eq(false) - end - - it "should accept boolean-like value :true and munge this value to boolean for dsc_path" do - dsc_environment[:dsc_path] = :true - expect(dsc_environment[:dsc_path]).to eq(true) - end - - it "should accept boolean-like value :false and munge this value to boolean for dsc_path" do - dsc_environment[:dsc_path] = :false - expect(dsc_environment[:dsc_path]).to eq(false) - end - - it 'should not accept int for dsc_path' do - expect{dsc_environment[:dsc_path] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_path' do - expect{dsc_environment[:dsc_path] = 16}.to raise_error(Puppet::ResourceError) - end - - # Configuration PROVIDER TESTS - - describe "powershell provider tests" do - - it "should successfully instanciate the provider" do - described_class.provider(:powershell).new(dsc_environment) - end - - before(:each) do - @provider = described_class.provider(:powershell).new(dsc_environment) - end - - describe "when dscmeta_module_name existing/is defined " do - - it "should compute powershell dsc test script with Invoke-DscResource" do - expect(@provider.ps_script_content('test')).to match(/Invoke-DscResource/) - end - - it "should compute powershell dsc test script with method Test" do - expect(@provider.ps_script_content('test')).to match(/Method\s+=\s*'test'/) - end - - it "should compute powershell dsc set script with Invoke-DscResource" do - expect(@provider.ps_script_content('set')).to match(/Invoke-DscResource/) - end - - it "should compute powershell dsc test script with method Set" do - expect(@provider.ps_script_content('set')).to match(/Method\s+=\s*'set'/) - end - - end - - describe "when dsc_ensure is 'present'" do - - before(:each) do - dsc_environment.original_parameters[:dsc_ensure] = 'present' - dsc_environment[:dsc_ensure] = 'present' - @provider = described_class.provider(:powershell).new(dsc_environment) - end - - it "should update :ensure to :present" do - expect(dsc_environment[:ensure]).to eq(:present) - end - - it "should compute powershell dsc test script in which ensure value is 'present'" do - expect(@provider.ps_script_content('test')).to match(/ensure = 'present'/) - end - - it "should compute powershell dsc set script in which ensure value is 'present'" do - expect(@provider.ps_script_content('set')).to match(/ensure = 'present'/) - end - - end - - describe "when dsc_ensure is 'absent'" do - - before(:each) do - dsc_environment.original_parameters[:dsc_ensure] = 'absent' - dsc_environment[:dsc_ensure] = 'absent' - @provider = described_class.provider(:powershell).new(dsc_environment) - end - - it "should update :ensure to :absent" do - expect(dsc_environment[:ensure]).to eq(:absent) - end - - it "should compute powershell dsc test script in which ensure value is 'present'" do - expect(@provider.ps_script_content('test')).to match(/ensure = 'present'/) - end - - it "should compute powershell dsc set script in which ensure value is 'absent'" do - expect(@provider.ps_script_content('set')).to match(/ensure = 'absent'/) - end - - end - - end -end diff --git a/spec/unit/puppet/type/dsc_file_spec.rb b/spec/unit/puppet/type/dsc_file_spec.rb deleted file mode 100644 index 6df79085..00000000 --- a/spec/unit/puppet/type/dsc_file_spec.rb +++ /dev/null @@ -1,559 +0,0 @@ -#!/usr/bin/env ruby -require 'spec_helper' - -describe Puppet::Type.type(:dsc_file) do - - let :dsc_file do - Puppet::Type.type(:dsc_file).new( - :name => 'foo', - :dsc_destinationpath => 'foo', - ) - end - - it 'should allow all properties to be specified' do - expect { Puppet::Type.type(:dsc_file).new( - :name => 'foo', - :dsc_destinationpath => 'foo', - :dsc_ensure => 'Present', - :dsc_type => 'File', - :dsc_sourcepath => 'foo', - :dsc_contents => 'foo', - :dsc_checksum => 'SHA-1', - :dsc_recurse => true, - :dsc_force => true, - :dsc_credential => {"user"=>"user", "password"=>"password"}, - :dsc_attributes => 'ReadOnly', - :dsc_dependson => ["foo", "bar", "spec"], - :dsc_matchsource => true, - )}.to_not raise_error - end - - it "should stringify normally" do - expect(dsc_file.to_s).to eq("Dsc_file[foo]") - end - - it 'should default to ensure => present' do - expect(dsc_file[:ensure]).to eq :present - end - - it 'should require that dsc_destinationpath is specified' do - #dsc_file[:dsc_destinationpath] - expect { Puppet::Type.type(:dsc_file).new( - :name => 'foo', - )}.to raise_error(Puppet::Error, /dsc_destinationpath is a required attribute/) - end - - it 'should not accept array for dsc_destinationpath' do - expect{dsc_file[:dsc_destinationpath] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_destinationpath' do - expect{dsc_file[:dsc_destinationpath] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_destinationpath' do - expect{dsc_file[:dsc_destinationpath] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_destinationpath' do - expect{dsc_file[:dsc_destinationpath] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should accept dsc_ensure predefined value Present' do - dsc_file[:dsc_ensure] = 'Present' - expect(dsc_file[:dsc_ensure]).to eq('Present') - end - - it 'should accept dsc_ensure predefined value present' do - dsc_file[:dsc_ensure] = 'present' - expect(dsc_file[:dsc_ensure]).to eq('present') - end - - it 'should accept dsc_ensure predefined value present and update ensure with this value (ensure end value should be a symbol)' do - dsc_file[:dsc_ensure] = 'present' - expect(dsc_file[:ensure]).to eq(dsc_file[:dsc_ensure].downcase.to_sym) - end - - it 'should accept dsc_ensure predefined value Absent' do - dsc_file[:dsc_ensure] = 'Absent' - expect(dsc_file[:dsc_ensure]).to eq('Absent') - end - - it 'should accept dsc_ensure predefined value absent' do - dsc_file[:dsc_ensure] = 'absent' - expect(dsc_file[:dsc_ensure]).to eq('absent') - end - - it 'should accept dsc_ensure predefined value absent and update ensure with this value (ensure end value should be a symbol)' do - dsc_file[:dsc_ensure] = 'absent' - expect(dsc_file[:ensure]).to eq(dsc_file[:dsc_ensure].downcase.to_sym) - end - - it 'should not accept values not equal to predefined values' do - expect{dsc_file[:dsc_ensure] = 'invalid value'}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_ensure' do - expect{dsc_file[:dsc_ensure] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_ensure' do - expect{dsc_file[:dsc_ensure] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_ensure' do - expect{dsc_file[:dsc_ensure] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_ensure' do - expect{dsc_file[:dsc_ensure] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should accept dsc_type predefined value File' do - dsc_file[:dsc_type] = 'File' - expect(dsc_file[:dsc_type]).to eq('File') - end - - it 'should accept dsc_type predefined value file' do - dsc_file[:dsc_type] = 'file' - expect(dsc_file[:dsc_type]).to eq('file') - end - - it 'should accept dsc_type predefined value Directory' do - dsc_file[:dsc_type] = 'Directory' - expect(dsc_file[:dsc_type]).to eq('Directory') - end - - it 'should accept dsc_type predefined value directory' do - dsc_file[:dsc_type] = 'directory' - expect(dsc_file[:dsc_type]).to eq('directory') - end - - it 'should not accept values not equal to predefined values' do - expect{dsc_file[:dsc_type] = 'invalid value'}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_type' do - expect{dsc_file[:dsc_type] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_type' do - expect{dsc_file[:dsc_type] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_type' do - expect{dsc_file[:dsc_type] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_type' do - expect{dsc_file[:dsc_type] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_sourcepath' do - expect{dsc_file[:dsc_sourcepath] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_sourcepath' do - expect{dsc_file[:dsc_sourcepath] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_sourcepath' do - expect{dsc_file[:dsc_sourcepath] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_sourcepath' do - expect{dsc_file[:dsc_sourcepath] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_contents' do - expect{dsc_file[:dsc_contents] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_contents' do - expect{dsc_file[:dsc_contents] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_contents' do - expect{dsc_file[:dsc_contents] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_contents' do - expect{dsc_file[:dsc_contents] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should accept dsc_checksum predefined value SHA-1' do - dsc_file[:dsc_checksum] = 'SHA-1' - expect(dsc_file[:dsc_checksum]).to eq('SHA-1') - end - - it 'should accept dsc_checksum predefined value sha-1' do - dsc_file[:dsc_checksum] = 'sha-1' - expect(dsc_file[:dsc_checksum]).to eq('sha-1') - end - - it 'should accept dsc_checksum predefined value SHA-256' do - dsc_file[:dsc_checksum] = 'SHA-256' - expect(dsc_file[:dsc_checksum]).to eq('SHA-256') - end - - it 'should accept dsc_checksum predefined value sha-256' do - dsc_file[:dsc_checksum] = 'sha-256' - expect(dsc_file[:dsc_checksum]).to eq('sha-256') - end - - it 'should accept dsc_checksum predefined value SHA-512' do - dsc_file[:dsc_checksum] = 'SHA-512' - expect(dsc_file[:dsc_checksum]).to eq('SHA-512') - end - - it 'should accept dsc_checksum predefined value sha-512' do - dsc_file[:dsc_checksum] = 'sha-512' - expect(dsc_file[:dsc_checksum]).to eq('sha-512') - end - - it 'should accept dsc_checksum predefined value CreatedDate' do - dsc_file[:dsc_checksum] = 'CreatedDate' - expect(dsc_file[:dsc_checksum]).to eq('CreatedDate') - end - - it 'should accept dsc_checksum predefined value createddate' do - dsc_file[:dsc_checksum] = 'createddate' - expect(dsc_file[:dsc_checksum]).to eq('createddate') - end - - it 'should accept dsc_checksum predefined value ModifiedDate' do - dsc_file[:dsc_checksum] = 'ModifiedDate' - expect(dsc_file[:dsc_checksum]).to eq('ModifiedDate') - end - - it 'should accept dsc_checksum predefined value modifieddate' do - dsc_file[:dsc_checksum] = 'modifieddate' - expect(dsc_file[:dsc_checksum]).to eq('modifieddate') - end - - it 'should not accept values not equal to predefined values' do - expect{dsc_file[:dsc_checksum] = 'invalid value'}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_checksum' do - expect{dsc_file[:dsc_checksum] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_checksum' do - expect{dsc_file[:dsc_checksum] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_checksum' do - expect{dsc_file[:dsc_checksum] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_checksum' do - expect{dsc_file[:dsc_checksum] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_recurse' do - expect{dsc_file[:dsc_recurse] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should accept boolean for dsc_recurse' do - dsc_file[:dsc_recurse] = true - expect(dsc_file[:dsc_recurse]).to eq(true) - end - - it "should accept boolean-like value 'true' and munge this value to boolean for dsc_recurse" do - dsc_file[:dsc_recurse] = 'true' - expect(dsc_file[:dsc_recurse]).to eq(true) - end - - it "should accept boolean-like value 'false' and munge this value to boolean for dsc_recurse" do - dsc_file[:dsc_recurse] = 'false' - expect(dsc_file[:dsc_recurse]).to eq(false) - end - - it "should accept boolean-like value 'True' and munge this value to boolean for dsc_recurse" do - dsc_file[:dsc_recurse] = 'True' - expect(dsc_file[:dsc_recurse]).to eq(true) - end - - it "should accept boolean-like value 'False' and munge this value to boolean for dsc_recurse" do - dsc_file[:dsc_recurse] = 'False' - expect(dsc_file[:dsc_recurse]).to eq(false) - end - - it "should accept boolean-like value :true and munge this value to boolean for dsc_recurse" do - dsc_file[:dsc_recurse] = :true - expect(dsc_file[:dsc_recurse]).to eq(true) - end - - it "should accept boolean-like value :false and munge this value to boolean for dsc_recurse" do - dsc_file[:dsc_recurse] = :false - expect(dsc_file[:dsc_recurse]).to eq(false) - end - - it 'should not accept int for dsc_recurse' do - expect{dsc_file[:dsc_recurse] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_recurse' do - expect{dsc_file[:dsc_recurse] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_force' do - expect{dsc_file[:dsc_force] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should accept boolean for dsc_force' do - dsc_file[:dsc_force] = true - expect(dsc_file[:dsc_force]).to eq(true) - end - - it "should accept boolean-like value 'true' and munge this value to boolean for dsc_force" do - dsc_file[:dsc_force] = 'true' - expect(dsc_file[:dsc_force]).to eq(true) - end - - it "should accept boolean-like value 'false' and munge this value to boolean for dsc_force" do - dsc_file[:dsc_force] = 'false' - expect(dsc_file[:dsc_force]).to eq(false) - end - - it "should accept boolean-like value 'True' and munge this value to boolean for dsc_force" do - dsc_file[:dsc_force] = 'True' - expect(dsc_file[:dsc_force]).to eq(true) - end - - it "should accept boolean-like value 'False' and munge this value to boolean for dsc_force" do - dsc_file[:dsc_force] = 'False' - expect(dsc_file[:dsc_force]).to eq(false) - end - - it "should accept boolean-like value :true and munge this value to boolean for dsc_force" do - dsc_file[:dsc_force] = :true - expect(dsc_file[:dsc_force]).to eq(true) - end - - it "should accept boolean-like value :false and munge this value to boolean for dsc_force" do - dsc_file[:dsc_force] = :false - expect(dsc_file[:dsc_force]).to eq(false) - end - - it 'should not accept int for dsc_force' do - expect{dsc_file[:dsc_force] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_force' do - expect{dsc_file[:dsc_force] = 16}.to raise_error(Puppet::ResourceError) - end - - it "should not accept empty password for dsc_credential" do - expect{dsc_file[:dsc_credential] = {"user"=>"user", "password"=>""}}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_credential' do - expect{dsc_file[:dsc_credential] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_credential' do - expect{dsc_file[:dsc_credential] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_credential' do - expect{dsc_file[:dsc_credential] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_credential' do - expect{dsc_file[:dsc_credential] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should accept dsc_attributes predefined value ReadOnly' do - dsc_file[:dsc_attributes] = 'ReadOnly' - expect(dsc_file[:dsc_attributes]).to eq(['ReadOnly']) - end - - it 'should accept dsc_attributes predefined value readonly' do - dsc_file[:dsc_attributes] = 'readonly' - expect(dsc_file[:dsc_attributes]).to eq(['readonly']) - end - - it 'should accept dsc_attributes predefined value Hidden' do - dsc_file[:dsc_attributes] = 'Hidden' - expect(dsc_file[:dsc_attributes]).to eq(['Hidden']) - end - - it 'should accept dsc_attributes predefined value hidden' do - dsc_file[:dsc_attributes] = 'hidden' - expect(dsc_file[:dsc_attributes]).to eq(['hidden']) - end - - it 'should accept dsc_attributes predefined value System' do - dsc_file[:dsc_attributes] = 'System' - expect(dsc_file[:dsc_attributes]).to eq(['System']) - end - - it 'should accept dsc_attributes predefined value system' do - dsc_file[:dsc_attributes] = 'system' - expect(dsc_file[:dsc_attributes]).to eq(['system']) - end - - it 'should accept dsc_attributes predefined value Archive' do - dsc_file[:dsc_attributes] = 'Archive' - expect(dsc_file[:dsc_attributes]).to eq(['Archive']) - end - - it 'should accept dsc_attributes predefined value archive' do - dsc_file[:dsc_attributes] = 'archive' - expect(dsc_file[:dsc_attributes]).to eq(['archive']) - end - - it 'should not accept values not equal to predefined values' do - expect{dsc_file[:dsc_attributes] = 'invalid value'}.to raise_error(Puppet::ResourceError) - end - - it 'should accept array of predefined values for dsc_attributes' do - dsc_file[:dsc_attributes] = ["ReadOnly", "Hidden", "System", "Archive"] - expect(dsc_file[:dsc_attributes]).to eq(["ReadOnly", "Hidden", "System", "Archive"]) - end - - it 'should not accept boolean for dsc_attributes' do - expect{dsc_file[:dsc_attributes] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_attributes' do - expect{dsc_file[:dsc_attributes] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_attributes' do - expect{dsc_file[:dsc_attributes] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should accept array for dsc_dependson' do - dsc_file[:dsc_dependson] = ["foo", "bar", "spec"] - expect(dsc_file[:dsc_dependson]).to eq(["foo", "bar", "spec"]) - end - - it 'should not accept boolean for dsc_dependson' do - expect{dsc_file[:dsc_dependson] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_dependson' do - expect{dsc_file[:dsc_dependson] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_dependson' do - expect{dsc_file[:dsc_dependson] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_matchsource' do - expect{dsc_file[:dsc_matchsource] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should accept boolean for dsc_matchsource' do - dsc_file[:dsc_matchsource] = true - expect(dsc_file[:dsc_matchsource]).to eq(true) - end - - it "should accept boolean-like value 'true' and munge this value to boolean for dsc_matchsource" do - dsc_file[:dsc_matchsource] = 'true' - expect(dsc_file[:dsc_matchsource]).to eq(true) - end - - it "should accept boolean-like value 'false' and munge this value to boolean for dsc_matchsource" do - dsc_file[:dsc_matchsource] = 'false' - expect(dsc_file[:dsc_matchsource]).to eq(false) - end - - it "should accept boolean-like value 'True' and munge this value to boolean for dsc_matchsource" do - dsc_file[:dsc_matchsource] = 'True' - expect(dsc_file[:dsc_matchsource]).to eq(true) - end - - it "should accept boolean-like value 'False' and munge this value to boolean for dsc_matchsource" do - dsc_file[:dsc_matchsource] = 'False' - expect(dsc_file[:dsc_matchsource]).to eq(false) - end - - it "should accept boolean-like value :true and munge this value to boolean for dsc_matchsource" do - dsc_file[:dsc_matchsource] = :true - expect(dsc_file[:dsc_matchsource]).to eq(true) - end - - it "should accept boolean-like value :false and munge this value to boolean for dsc_matchsource" do - dsc_file[:dsc_matchsource] = :false - expect(dsc_file[:dsc_matchsource]).to eq(false) - end - - it 'should not accept int for dsc_matchsource' do - expect{dsc_file[:dsc_matchsource] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_matchsource' do - expect{dsc_file[:dsc_matchsource] = 16}.to raise_error(Puppet::ResourceError) - end - - # Configuration PROVIDER TESTS - - describe "powershell provider tests" do - - it "should successfully instanciate the provider" do - described_class.provider(:powershell).new(dsc_file) - end - - before(:each) do - @provider = described_class.provider(:powershell).new(dsc_file) - end - - describe "when dsc_ensure is 'present'" do - - before(:each) do - dsc_file.original_parameters[:dsc_ensure] = 'present' - dsc_file[:dsc_ensure] = 'present' - @provider = described_class.provider(:powershell).new(dsc_file) - end - - it "should update :ensure to :present" do - expect(dsc_file[:ensure]).to eq(:present) - end - - it "should compute powershell dsc test script in which ensure value is 'present'" do - expect(@provider.ps_script_content('test')).to match(/ensure = 'present'/) - end - - it "should compute powershell dsc set script in which ensure value is 'present'" do - expect(@provider.ps_script_content('set')).to match(/ensure = 'present'/) - end - - end - - describe "when dsc_ensure is 'absent'" do - - before(:each) do - dsc_file.original_parameters[:dsc_ensure] = 'absent' - dsc_file[:dsc_ensure] = 'absent' - @provider = described_class.provider(:powershell).new(dsc_file) - end - - it "should update :ensure to :absent" do - expect(dsc_file[:ensure]).to eq(:absent) - end - - it "should compute powershell dsc test script in which ensure value is 'present'" do - expect(@provider.ps_script_content('test')).to match(/ensure = 'present'/) - end - - it "should compute powershell dsc set script in which ensure value is 'absent'" do - expect(@provider.ps_script_content('set')).to match(/ensure = 'absent'/) - end - - end - - describe "when dsc_resource has credentials" do - - it "should convert credential hash to a pscredential object" do - expect(@provider.ps_script_content('test')).to match(/| new-pscredential'/) - end - - end - - - end -end diff --git a/spec/unit/puppet/type/dsc_group_spec.rb b/spec/unit/puppet/type/dsc_group_spec.rb deleted file mode 100644 index f44894ef..00000000 --- a/spec/unit/puppet/type/dsc_group_spec.rb +++ /dev/null @@ -1,280 +0,0 @@ -#!/usr/bin/env ruby -require 'spec_helper' - -describe Puppet::Type.type(:dsc_group) do - - let :dsc_group do - Puppet::Type.type(:dsc_group).new( - :name => 'foo', - :dsc_groupname => 'foo', - ) - end - - it 'should allow all properties to be specified' do - expect { Puppet::Type.type(:dsc_group).new( - :name => 'foo', - :dsc_groupname => 'foo', - :dsc_ensure => 'Present', - :dsc_description => 'foo', - :dsc_members => ["foo", "bar", "spec"], - :dsc_memberstoinclude => ["foo", "bar", "spec"], - :dsc_memberstoexclude => ["foo", "bar", "spec"], - :dsc_credential => {"user"=>"user", "password"=>"password"}, - )}.to_not raise_error - end - - it "should stringify normally" do - expect(dsc_group.to_s).to eq("Dsc_group[foo]") - end - - it 'should default to ensure => present' do - expect(dsc_group[:ensure]).to eq :present - end - - it 'should require that dsc_groupname is specified' do - #dsc_group[:dsc_groupname] - expect { Puppet::Type.type(:dsc_group).new( - :name => 'foo', - )}.to raise_error(Puppet::Error, /dsc_groupname is a required attribute/) - end - - it 'should not accept array for dsc_groupname' do - expect{dsc_group[:dsc_groupname] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_groupname' do - expect{dsc_group[:dsc_groupname] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_groupname' do - expect{dsc_group[:dsc_groupname] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_groupname' do - expect{dsc_group[:dsc_groupname] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should accept dsc_ensure predefined value Present' do - dsc_group[:dsc_ensure] = 'Present' - expect(dsc_group[:dsc_ensure]).to eq('Present') - end - - it 'should accept dsc_ensure predefined value present' do - dsc_group[:dsc_ensure] = 'present' - expect(dsc_group[:dsc_ensure]).to eq('present') - end - - it 'should accept dsc_ensure predefined value present and update ensure with this value (ensure end value should be a symbol)' do - dsc_group[:dsc_ensure] = 'present' - expect(dsc_group[:ensure]).to eq(dsc_group[:dsc_ensure].downcase.to_sym) - end - - it 'should accept dsc_ensure predefined value Absent' do - dsc_group[:dsc_ensure] = 'Absent' - expect(dsc_group[:dsc_ensure]).to eq('Absent') - end - - it 'should accept dsc_ensure predefined value absent' do - dsc_group[:dsc_ensure] = 'absent' - expect(dsc_group[:dsc_ensure]).to eq('absent') - end - - it 'should accept dsc_ensure predefined value absent and update ensure with this value (ensure end value should be a symbol)' do - dsc_group[:dsc_ensure] = 'absent' - expect(dsc_group[:ensure]).to eq(dsc_group[:dsc_ensure].downcase.to_sym) - end - - it 'should not accept values not equal to predefined values' do - expect{dsc_group[:dsc_ensure] = 'invalid value'}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_ensure' do - expect{dsc_group[:dsc_ensure] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_ensure' do - expect{dsc_group[:dsc_ensure] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_ensure' do - expect{dsc_group[:dsc_ensure] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_ensure' do - expect{dsc_group[:dsc_ensure] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_description' do - expect{dsc_group[:dsc_description] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_description' do - expect{dsc_group[:dsc_description] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_description' do - expect{dsc_group[:dsc_description] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_description' do - expect{dsc_group[:dsc_description] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should accept array for dsc_members' do - dsc_group[:dsc_members] = ["foo", "bar", "spec"] - expect(dsc_group[:dsc_members]).to eq(["foo", "bar", "spec"]) - end - - it 'should not accept boolean for dsc_members' do - expect{dsc_group[:dsc_members] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_members' do - expect{dsc_group[:dsc_members] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_members' do - expect{dsc_group[:dsc_members] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should accept array for dsc_memberstoinclude' do - dsc_group[:dsc_memberstoinclude] = ["foo", "bar", "spec"] - expect(dsc_group[:dsc_memberstoinclude]).to eq(["foo", "bar", "spec"]) - end - - it 'should not accept boolean for dsc_memberstoinclude' do - expect{dsc_group[:dsc_memberstoinclude] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_memberstoinclude' do - expect{dsc_group[:dsc_memberstoinclude] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_memberstoinclude' do - expect{dsc_group[:dsc_memberstoinclude] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should accept array for dsc_memberstoexclude' do - dsc_group[:dsc_memberstoexclude] = ["foo", "bar", "spec"] - expect(dsc_group[:dsc_memberstoexclude]).to eq(["foo", "bar", "spec"]) - end - - it 'should not accept boolean for dsc_memberstoexclude' do - expect{dsc_group[:dsc_memberstoexclude] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_memberstoexclude' do - expect{dsc_group[:dsc_memberstoexclude] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_memberstoexclude' do - expect{dsc_group[:dsc_memberstoexclude] = 16}.to raise_error(Puppet::ResourceError) - end - - it "should not accept empty password for dsc_credential" do - expect{dsc_group[:dsc_credential] = {"user"=>"user", "password"=>""}}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_credential' do - expect{dsc_group[:dsc_credential] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_credential' do - expect{dsc_group[:dsc_credential] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_credential' do - expect{dsc_group[:dsc_credential] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_credential' do - expect{dsc_group[:dsc_credential] = 16}.to raise_error(Puppet::ResourceError) - end - - # Configuration PROVIDER TESTS - - describe "powershell provider tests" do - - it "should successfully instanciate the provider" do - described_class.provider(:powershell).new(dsc_group) - end - - before(:each) do - @provider = described_class.provider(:powershell).new(dsc_group) - end - - describe "when dscmeta_module_name existing/is defined " do - - it "should compute powershell dsc test script with Invoke-DscResource" do - expect(@provider.ps_script_content('test')).to match(/Invoke-DscResource/) - end - - it "should compute powershell dsc test script with method Test" do - expect(@provider.ps_script_content('test')).to match(/Method\s+=\s*'test'/) - end - - it "should compute powershell dsc set script with Invoke-DscResource" do - expect(@provider.ps_script_content('set')).to match(/Invoke-DscResource/) - end - - it "should compute powershell dsc test script with method Set" do - expect(@provider.ps_script_content('set')).to match(/Method\s+=\s*'set'/) - end - - end - - describe "when dsc_ensure is 'present'" do - - before(:each) do - dsc_group.original_parameters[:dsc_ensure] = 'present' - dsc_group[:dsc_ensure] = 'present' - @provider = described_class.provider(:powershell).new(dsc_group) - end - - it "should update :ensure to :present" do - expect(dsc_group[:ensure]).to eq(:present) - end - - it "should compute powershell dsc test script in which ensure value is 'present'" do - expect(@provider.ps_script_content('test')).to match(/ensure = 'present'/) - end - - it "should compute powershell dsc set script in which ensure value is 'present'" do - expect(@provider.ps_script_content('set')).to match(/ensure = 'present'/) - end - - end - - describe "when dsc_ensure is 'absent'" do - - before(:each) do - dsc_group.original_parameters[:dsc_ensure] = 'absent' - dsc_group[:dsc_ensure] = 'absent' - @provider = described_class.provider(:powershell).new(dsc_group) - end - - it "should update :ensure to :absent" do - expect(dsc_group[:ensure]).to eq(:absent) - end - - it "should compute powershell dsc test script in which ensure value is 'present'" do - expect(@provider.ps_script_content('test')).to match(/ensure = 'present'/) - end - - it "should compute powershell dsc set script in which ensure value is 'absent'" do - expect(@provider.ps_script_content('set')).to match(/ensure = 'absent'/) - end - - end - - describe "when dsc_resource has credentials" do - - it "should convert credential hash to a pscredential object" do - expect(@provider.ps_script_content('test')).to match(/| new-pscredential'/) - end - - end - - - end -end diff --git a/spec/unit/puppet/type/dsc_log_spec.rb b/spec/unit/puppet/type/dsc_log_spec.rb deleted file mode 100644 index 9c2ab511..00000000 --- a/spec/unit/puppet/type/dsc_log_spec.rb +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env ruby -require 'spec_helper' - -describe Puppet::Type.type(:dsc_log) do - - let :dsc_log do - Puppet::Type.type(:dsc_log).new( - :name => 'foo', - ) - end - - it 'should allow all properties to be specified' do - expect { Puppet::Type.type(:dsc_log).new( - :name => 'foo', - :dsc_message => 'foo', - )}.to_not raise_error - end - - it "should stringify normally" do - expect(dsc_log.to_s).to eq("Dsc_log[foo]") - end - - it 'should not accept array for dsc_message' do - expect{dsc_log[:dsc_message] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_message' do - expect{dsc_log[:dsc_message] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_message' do - expect{dsc_log[:dsc_message] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_message' do - expect{dsc_log[:dsc_message] = 16}.to raise_error(Puppet::ResourceError) - end - - # Configuration PROVIDER TESTS - - describe "powershell provider tests" do - - it "should successfully instanciate the provider" do - described_class.provider(:powershell).new(dsc_log) - end - - before(:each) do - @provider = described_class.provider(:powershell).new(dsc_log) - end - - describe "when dscmeta_module_name existing/is defined " do - - it "should compute powershell dsc test script with Invoke-DscResource" do - expect(@provider.ps_script_content('test')).to match(/Invoke-DscResource/) - end - - it "should compute powershell dsc test script with method Test" do - expect(@provider.ps_script_content('test')).to match(/Method\s+=\s*'test'/) - end - - it "should compute powershell dsc set script with Invoke-DscResource" do - expect(@provider.ps_script_content('set')).to match(/Invoke-DscResource/) - end - - it "should compute powershell dsc test script with method Set" do - expect(@provider.ps_script_content('set')).to match(/Method\s+=\s*'set'/) - end - - end - - end -end diff --git a/spec/unit/puppet/type/dsc_package_spec.rb b/spec/unit/puppet/type/dsc_package_spec.rb deleted file mode 100644 index f09c180a..00000000 --- a/spec/unit/puppet/type/dsc_package_spec.rb +++ /dev/null @@ -1,484 +0,0 @@ -#!/usr/bin/env ruby -require 'spec_helper' - -describe Puppet::Type.type(:dsc_package) do - - let :dsc_package do - Puppet::Type.type(:dsc_package).new( - :name => 'foo', - :dsc_name => 'foo', - :dsc_productid => 'foo', - ) - end - - it 'should allow all properties to be specified' do - expect { Puppet::Type.type(:dsc_package).new( - :name => 'foo', - :dsc_ensure => 'Present', - :dsc_name => 'foo', - :dsc_path => 'foo', - :dsc_productid => 'foo', - :dsc_arguments => 'foo', - :dsc_credential => {"user"=>"user", "password"=>"password"}, - :dsc_returncode => [32, 64, 128], - :dsc_logpath => 'foo', - :dsc_packagedescription => 'foo', - :dsc_publisher => 'foo', - :dsc_installedon => 'foo', - :dsc_size => 32, - :dsc_version => 'foo', - :dsc_installed => true, - )}.to_not raise_error - end - - it "should stringify normally" do - expect(dsc_package.to_s).to eq("Dsc_package[foo]") - end - - it 'should default to ensure => present' do - expect(dsc_package[:ensure]).to eq :present - end - - it 'should accept dsc_ensure predefined value Present' do - dsc_package[:dsc_ensure] = 'Present' - expect(dsc_package[:dsc_ensure]).to eq('Present') - end - - it 'should accept dsc_ensure predefined value present' do - dsc_package[:dsc_ensure] = 'present' - expect(dsc_package[:dsc_ensure]).to eq('present') - end - - it 'should accept dsc_ensure predefined value present and update ensure with this value (ensure end value should be a symbol)' do - dsc_package[:dsc_ensure] = 'present' - expect(dsc_package[:ensure]).to eq(dsc_package[:dsc_ensure].downcase.to_sym) - end - - it 'should accept dsc_ensure predefined value Absent' do - dsc_package[:dsc_ensure] = 'Absent' - expect(dsc_package[:dsc_ensure]).to eq('Absent') - end - - it 'should accept dsc_ensure predefined value absent' do - dsc_package[:dsc_ensure] = 'absent' - expect(dsc_package[:dsc_ensure]).to eq('absent') - end - - it 'should accept dsc_ensure predefined value absent and update ensure with this value (ensure end value should be a symbol)' do - dsc_package[:dsc_ensure] = 'absent' - expect(dsc_package[:ensure]).to eq(dsc_package[:dsc_ensure].downcase.to_sym) - end - - it 'should not accept values not equal to predefined values' do - expect{dsc_package[:dsc_ensure] = 'invalid value'}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_ensure' do - expect{dsc_package[:dsc_ensure] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_ensure' do - expect{dsc_package[:dsc_ensure] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_ensure' do - expect{dsc_package[:dsc_ensure] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_ensure' do - expect{dsc_package[:dsc_ensure] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should require that dsc_name is specified' do - #dsc_package[:dsc_name] - expect { Puppet::Type.type(:dsc_package).new( - :name => 'foo', - :dsc_productid => 'foo', - )}.to raise_error(Puppet::Error, /dsc_name is a required attribute/) - end - - it 'should not accept array for dsc_name' do - expect{dsc_package[:dsc_name] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_name' do - expect{dsc_package[:dsc_name] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_name' do - expect{dsc_package[:dsc_name] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_name' do - expect{dsc_package[:dsc_name] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_path' do - expect{dsc_package[:dsc_path] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_path' do - expect{dsc_package[:dsc_path] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_path' do - expect{dsc_package[:dsc_path] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_path' do - expect{dsc_package[:dsc_path] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should require that dsc_productid is specified' do - #dsc_package[:dsc_productid] - expect { Puppet::Type.type(:dsc_package).new( - :name => 'foo', - :dsc_name => 'foo', - )}.to raise_error(Puppet::Error, /dsc_productid is a required attribute/) - end - - it 'should not accept array for dsc_productid' do - expect{dsc_package[:dsc_productid] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_productid' do - expect{dsc_package[:dsc_productid] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_productid' do - expect{dsc_package[:dsc_productid] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_productid' do - expect{dsc_package[:dsc_productid] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_arguments' do - expect{dsc_package[:dsc_arguments] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_arguments' do - expect{dsc_package[:dsc_arguments] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_arguments' do - expect{dsc_package[:dsc_arguments] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_arguments' do - expect{dsc_package[:dsc_arguments] = 16}.to raise_error(Puppet::ResourceError) - end - - it "should not accept empty password for dsc_credential" do - expect{dsc_package[:dsc_credential] = {"user"=>"user", "password"=>""}}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_credential' do - expect{dsc_package[:dsc_credential] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_credential' do - expect{dsc_package[:dsc_credential] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_credential' do - expect{dsc_package[:dsc_credential] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_credential' do - expect{dsc_package[:dsc_credential] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should accept array for dsc_returncode' do - dsc_package[:dsc_returncode] = [32, 64, 128] - expect(dsc_package[:dsc_returncode]).to eq([32, 64, 128]) - end - - it 'should not accept boolean for dsc_returncode' do - expect{dsc_package[:dsc_returncode] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should accept uint for dsc_returncode' do - dsc_package[:dsc_returncode] = 32 - expect(dsc_package[:dsc_returncode]).to eq([32]) - end - - it 'should not accept signed (negative) value for dsc_returncode' do - value = -32 - expect(value).to be < 0 - expect{dsc_package[:dsc_returncode] = value}.to raise_error(Puppet::ResourceError) - end - - it 'should accept string-like uint for dsc_returncode' do - dsc_package[:dsc_returncode] = '16' - expect(dsc_package[:dsc_returncode]).to eq([16]) - end - - it 'should accept string-like uint for dsc_returncode' do - dsc_package[:dsc_returncode] = '32' - expect(dsc_package[:dsc_returncode]).to eq([32]) - end - - it 'should accept string-like uint for dsc_returncode' do - dsc_package[:dsc_returncode] = '64' - expect(dsc_package[:dsc_returncode]).to eq([64]) - end - - it 'should accept uint[] for dsc_returncode' do - dsc_package[:dsc_returncode] = [32, 64, 128] - expect(dsc_package[:dsc_returncode]).to eq([32, 64, 128]) - end - - it 'should accept string-like uint[] for dsc_returncode' do - dsc_package[:dsc_returncode] = ["16", "32", "64"] - expect(dsc_package[:dsc_returncode]).to eq([16, 32, 64]) - end - - it 'should not accept array for dsc_logpath' do - expect{dsc_package[:dsc_logpath] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_logpath' do - expect{dsc_package[:dsc_logpath] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_logpath' do - expect{dsc_package[:dsc_logpath] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_logpath' do - expect{dsc_package[:dsc_logpath] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_packagedescription' do - expect{dsc_package[:dsc_packagedescription] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_packagedescription' do - expect{dsc_package[:dsc_packagedescription] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_packagedescription' do - expect{dsc_package[:dsc_packagedescription] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_packagedescription' do - expect{dsc_package[:dsc_packagedescription] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_publisher' do - expect{dsc_package[:dsc_publisher] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_publisher' do - expect{dsc_package[:dsc_publisher] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_publisher' do - expect{dsc_package[:dsc_publisher] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_publisher' do - expect{dsc_package[:dsc_publisher] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_installedon' do - expect{dsc_package[:dsc_installedon] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_installedon' do - expect{dsc_package[:dsc_installedon] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_installedon' do - expect{dsc_package[:dsc_installedon] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_installedon' do - expect{dsc_package[:dsc_installedon] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_size' do - expect{dsc_package[:dsc_size] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_size' do - expect{dsc_package[:dsc_size] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should accept uint for dsc_size' do - dsc_package[:dsc_size] = 32 - expect(dsc_package[:dsc_size]).to eq(32) - end - - it 'should not accept signed (negative) value for dsc_size' do - value = -32 - expect(value).to be < 0 - expect{dsc_package[:dsc_size] = value}.to raise_error(Puppet::ResourceError) - end - - it 'should accept string-like uint for dsc_size' do - dsc_package[:dsc_size] = '16' - expect(dsc_package[:dsc_size]).to eq(16) - end - - it 'should accept string-like uint for dsc_size' do - dsc_package[:dsc_size] = '32' - expect(dsc_package[:dsc_size]).to eq(32) - end - - it 'should accept string-like uint for dsc_size' do - dsc_package[:dsc_size] = '64' - expect(dsc_package[:dsc_size]).to eq(64) - end - - it 'should not accept array for dsc_version' do - expect{dsc_package[:dsc_version] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_version' do - expect{dsc_package[:dsc_version] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_version' do - expect{dsc_package[:dsc_version] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_version' do - expect{dsc_package[:dsc_version] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_installed' do - expect{dsc_package[:dsc_installed] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should accept boolean for dsc_installed' do - dsc_package[:dsc_installed] = true - expect(dsc_package[:dsc_installed]).to eq(true) - end - - it "should accept boolean-like value 'true' and munge this value to boolean for dsc_installed" do - dsc_package[:dsc_installed] = 'true' - expect(dsc_package[:dsc_installed]).to eq(true) - end - - it "should accept boolean-like value 'false' and munge this value to boolean for dsc_installed" do - dsc_package[:dsc_installed] = 'false' - expect(dsc_package[:dsc_installed]).to eq(false) - end - - it "should accept boolean-like value 'True' and munge this value to boolean for dsc_installed" do - dsc_package[:dsc_installed] = 'True' - expect(dsc_package[:dsc_installed]).to eq(true) - end - - it "should accept boolean-like value 'False' and munge this value to boolean for dsc_installed" do - dsc_package[:dsc_installed] = 'False' - expect(dsc_package[:dsc_installed]).to eq(false) - end - - it "should accept boolean-like value :true and munge this value to boolean for dsc_installed" do - dsc_package[:dsc_installed] = :true - expect(dsc_package[:dsc_installed]).to eq(true) - end - - it "should accept boolean-like value :false and munge this value to boolean for dsc_installed" do - dsc_package[:dsc_installed] = :false - expect(dsc_package[:dsc_installed]).to eq(false) - end - - it 'should not accept int for dsc_installed' do - expect{dsc_package[:dsc_installed] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_installed' do - expect{dsc_package[:dsc_installed] = 16}.to raise_error(Puppet::ResourceError) - end - - # Configuration PROVIDER TESTS - - describe "powershell provider tests" do - - it "should successfully instanciate the provider" do - described_class.provider(:powershell).new(dsc_package) - end - - before(:each) do - @provider = described_class.provider(:powershell).new(dsc_package) - end - - describe "when dscmeta_module_name existing/is defined " do - - it "should compute powershell dsc test script with Invoke-DscResource" do - expect(@provider.ps_script_content('test')).to match(/Invoke-DscResource/) - end - - it "should compute powershell dsc test script with method Test" do - expect(@provider.ps_script_content('test')).to match(/Method\s+=\s*'test'/) - end - - it "should compute powershell dsc set script with Invoke-DscResource" do - expect(@provider.ps_script_content('set')).to match(/Invoke-DscResource/) - end - - it "should compute powershell dsc test script with method Set" do - expect(@provider.ps_script_content('set')).to match(/Method\s+=\s*'set'/) - end - - end - - describe "when dsc_ensure is 'present'" do - - before(:each) do - dsc_package.original_parameters[:dsc_ensure] = 'present' - dsc_package[:dsc_ensure] = 'present' - @provider = described_class.provider(:powershell).new(dsc_package) - end - - it "should update :ensure to :present" do - expect(dsc_package[:ensure]).to eq(:present) - end - - it "should compute powershell dsc test script in which ensure value is 'present'" do - expect(@provider.ps_script_content('test')).to match(/ensure = 'present'/) - end - - it "should compute powershell dsc set script in which ensure value is 'present'" do - expect(@provider.ps_script_content('set')).to match(/ensure = 'present'/) - end - - end - - describe "when dsc_ensure is 'absent'" do - - before(:each) do - dsc_package.original_parameters[:dsc_ensure] = 'absent' - dsc_package[:dsc_ensure] = 'absent' - @provider = described_class.provider(:powershell).new(dsc_package) - end - - it "should update :ensure to :absent" do - expect(dsc_package[:ensure]).to eq(:absent) - end - - it "should compute powershell dsc test script in which ensure value is 'present'" do - expect(@provider.ps_script_content('test')).to match(/ensure = 'present'/) - end - - it "should compute powershell dsc set script in which ensure value is 'absent'" do - expect(@provider.ps_script_content('set')).to match(/ensure = 'absent'/) - end - - end - - describe "when dsc_resource has credentials" do - - it "should convert credential hash to a pscredential object" do - expect(@provider.ps_script_content('test')).to match(/| new-pscredential'/) - end - - end - - - end -end diff --git a/spec/unit/puppet/type/dsc_registry_spec.rb b/spec/unit/puppet/type/dsc_registry_spec.rb deleted file mode 100644 index c33484b6..00000000 --- a/spec/unit/puppet/type/dsc_registry_spec.rb +++ /dev/null @@ -1,401 +0,0 @@ -#!/usr/bin/env ruby -require 'spec_helper' - -describe Puppet::Type.type(:dsc_registry) do - - let :dsc_registry do - Puppet::Type.type(:dsc_registry).new( - :name => 'foo', - :dsc_key => 'foo', - :dsc_valuename => 'foo', - ) - end - - it 'should allow all properties to be specified' do - expect { Puppet::Type.type(:dsc_registry).new( - :name => 'foo', - :dsc_key => 'foo', - :dsc_valuename => 'foo', - :dsc_valuedata => ["foo", "bar", "spec"], - :dsc_valuetype => 'String', - :dsc_ensure => 'Present', - :dsc_hex => true, - :dsc_force => true, - )}.to_not raise_error - end - - it "should stringify normally" do - expect(dsc_registry.to_s).to eq("Dsc_registry[foo]") - end - - it 'should default to ensure => present' do - expect(dsc_registry[:ensure]).to eq :present - end - - it 'should require that dsc_key is specified' do - #dsc_registry[:dsc_key] - expect { Puppet::Type.type(:dsc_registry).new( - :name => 'foo', - :dsc_valuename => 'foo', - )}.to raise_error(Puppet::Error, /dsc_key is a required attribute/) - end - - it 'should not accept array for dsc_key' do - expect{dsc_registry[:dsc_key] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_key' do - expect{dsc_registry[:dsc_key] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_key' do - expect{dsc_registry[:dsc_key] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_key' do - expect{dsc_registry[:dsc_key] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should require that dsc_valuename is specified' do - #dsc_registry[:dsc_valuename] - expect { Puppet::Type.type(:dsc_registry).new( - :name => 'foo', - :dsc_key => 'foo', - )}.to raise_error(Puppet::Error, /dsc_valuename is a required attribute/) - end - - it 'should not accept array for dsc_valuename' do - expect{dsc_registry[:dsc_valuename] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_valuename' do - expect{dsc_registry[:dsc_valuename] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_valuename' do - expect{dsc_registry[:dsc_valuename] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_valuename' do - expect{dsc_registry[:dsc_valuename] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should accept array for dsc_valuedata' do - dsc_registry[:dsc_valuedata] = ["foo", "bar", "spec"] - expect(dsc_registry[:dsc_valuedata]).to eq(["foo", "bar", "spec"]) - end - - it 'should not accept boolean for dsc_valuedata' do - expect{dsc_registry[:dsc_valuedata] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_valuedata' do - expect{dsc_registry[:dsc_valuedata] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_valuedata' do - expect{dsc_registry[:dsc_valuedata] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should accept dsc_valuetype predefined value String' do - dsc_registry[:dsc_valuetype] = 'String' - expect(dsc_registry[:dsc_valuetype]).to eq('String') - end - - it 'should accept dsc_valuetype predefined value string' do - dsc_registry[:dsc_valuetype] = 'string' - expect(dsc_registry[:dsc_valuetype]).to eq('string') - end - - it 'should accept dsc_valuetype predefined value Binary' do - dsc_registry[:dsc_valuetype] = 'Binary' - expect(dsc_registry[:dsc_valuetype]).to eq('Binary') - end - - it 'should accept dsc_valuetype predefined value binary' do - dsc_registry[:dsc_valuetype] = 'binary' - expect(dsc_registry[:dsc_valuetype]).to eq('binary') - end - - it 'should accept dsc_valuetype predefined value Dword' do - dsc_registry[:dsc_valuetype] = 'Dword' - expect(dsc_registry[:dsc_valuetype]).to eq('Dword') - end - - it 'should accept dsc_valuetype predefined value dword' do - dsc_registry[:dsc_valuetype] = 'dword' - expect(dsc_registry[:dsc_valuetype]).to eq('dword') - end - - it 'should accept dsc_valuetype predefined value Qword' do - dsc_registry[:dsc_valuetype] = 'Qword' - expect(dsc_registry[:dsc_valuetype]).to eq('Qword') - end - - it 'should accept dsc_valuetype predefined value qword' do - dsc_registry[:dsc_valuetype] = 'qword' - expect(dsc_registry[:dsc_valuetype]).to eq('qword') - end - - it 'should accept dsc_valuetype predefined value MultiString' do - dsc_registry[:dsc_valuetype] = 'MultiString' - expect(dsc_registry[:dsc_valuetype]).to eq('MultiString') - end - - it 'should accept dsc_valuetype predefined value multistring' do - dsc_registry[:dsc_valuetype] = 'multistring' - expect(dsc_registry[:dsc_valuetype]).to eq('multistring') - end - - it 'should accept dsc_valuetype predefined value ExpandString' do - dsc_registry[:dsc_valuetype] = 'ExpandString' - expect(dsc_registry[:dsc_valuetype]).to eq('ExpandString') - end - - it 'should accept dsc_valuetype predefined value expandstring' do - dsc_registry[:dsc_valuetype] = 'expandstring' - expect(dsc_registry[:dsc_valuetype]).to eq('expandstring') - end - - it 'should not accept values not equal to predefined values' do - expect{dsc_registry[:dsc_valuetype] = 'invalid value'}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_valuetype' do - expect{dsc_registry[:dsc_valuetype] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_valuetype' do - expect{dsc_registry[:dsc_valuetype] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_valuetype' do - expect{dsc_registry[:dsc_valuetype] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_valuetype' do - expect{dsc_registry[:dsc_valuetype] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should accept dsc_ensure predefined value Present' do - dsc_registry[:dsc_ensure] = 'Present' - expect(dsc_registry[:dsc_ensure]).to eq('Present') - end - - it 'should accept dsc_ensure predefined value present' do - dsc_registry[:dsc_ensure] = 'present' - expect(dsc_registry[:dsc_ensure]).to eq('present') - end - - it 'should accept dsc_ensure predefined value present and update ensure with this value (ensure end value should be a symbol)' do - dsc_registry[:dsc_ensure] = 'present' - expect(dsc_registry[:ensure]).to eq(dsc_registry[:dsc_ensure].downcase.to_sym) - end - - it 'should accept dsc_ensure predefined value Absent' do - dsc_registry[:dsc_ensure] = 'Absent' - expect(dsc_registry[:dsc_ensure]).to eq('Absent') - end - - it 'should accept dsc_ensure predefined value absent' do - dsc_registry[:dsc_ensure] = 'absent' - expect(dsc_registry[:dsc_ensure]).to eq('absent') - end - - it 'should accept dsc_ensure predefined value absent and update ensure with this value (ensure end value should be a symbol)' do - dsc_registry[:dsc_ensure] = 'absent' - expect(dsc_registry[:ensure]).to eq(dsc_registry[:dsc_ensure].downcase.to_sym) - end - - it 'should not accept values not equal to predefined values' do - expect{dsc_registry[:dsc_ensure] = 'invalid value'}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_ensure' do - expect{dsc_registry[:dsc_ensure] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_ensure' do - expect{dsc_registry[:dsc_ensure] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_ensure' do - expect{dsc_registry[:dsc_ensure] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_ensure' do - expect{dsc_registry[:dsc_ensure] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_hex' do - expect{dsc_registry[:dsc_hex] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should accept boolean for dsc_hex' do - dsc_registry[:dsc_hex] = true - expect(dsc_registry[:dsc_hex]).to eq(true) - end - - it "should accept boolean-like value 'true' and munge this value to boolean for dsc_hex" do - dsc_registry[:dsc_hex] = 'true' - expect(dsc_registry[:dsc_hex]).to eq(true) - end - - it "should accept boolean-like value 'false' and munge this value to boolean for dsc_hex" do - dsc_registry[:dsc_hex] = 'false' - expect(dsc_registry[:dsc_hex]).to eq(false) - end - - it "should accept boolean-like value 'True' and munge this value to boolean for dsc_hex" do - dsc_registry[:dsc_hex] = 'True' - expect(dsc_registry[:dsc_hex]).to eq(true) - end - - it "should accept boolean-like value 'False' and munge this value to boolean for dsc_hex" do - dsc_registry[:dsc_hex] = 'False' - expect(dsc_registry[:dsc_hex]).to eq(false) - end - - it "should accept boolean-like value :true and munge this value to boolean for dsc_hex" do - dsc_registry[:dsc_hex] = :true - expect(dsc_registry[:dsc_hex]).to eq(true) - end - - it "should accept boolean-like value :false and munge this value to boolean for dsc_hex" do - dsc_registry[:dsc_hex] = :false - expect(dsc_registry[:dsc_hex]).to eq(false) - end - - it 'should not accept int for dsc_hex' do - expect{dsc_registry[:dsc_hex] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_hex' do - expect{dsc_registry[:dsc_hex] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_force' do - expect{dsc_registry[:dsc_force] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should accept boolean for dsc_force' do - dsc_registry[:dsc_force] = true - expect(dsc_registry[:dsc_force]).to eq(true) - end - - it "should accept boolean-like value 'true' and munge this value to boolean for dsc_force" do - dsc_registry[:dsc_force] = 'true' - expect(dsc_registry[:dsc_force]).to eq(true) - end - - it "should accept boolean-like value 'false' and munge this value to boolean for dsc_force" do - dsc_registry[:dsc_force] = 'false' - expect(dsc_registry[:dsc_force]).to eq(false) - end - - it "should accept boolean-like value 'True' and munge this value to boolean for dsc_force" do - dsc_registry[:dsc_force] = 'True' - expect(dsc_registry[:dsc_force]).to eq(true) - end - - it "should accept boolean-like value 'False' and munge this value to boolean for dsc_force" do - dsc_registry[:dsc_force] = 'False' - expect(dsc_registry[:dsc_force]).to eq(false) - end - - it "should accept boolean-like value :true and munge this value to boolean for dsc_force" do - dsc_registry[:dsc_force] = :true - expect(dsc_registry[:dsc_force]).to eq(true) - end - - it "should accept boolean-like value :false and munge this value to boolean for dsc_force" do - dsc_registry[:dsc_force] = :false - expect(dsc_registry[:dsc_force]).to eq(false) - end - - it 'should not accept int for dsc_force' do - expect{dsc_registry[:dsc_force] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_force' do - expect{dsc_registry[:dsc_force] = 16}.to raise_error(Puppet::ResourceError) - end - - # Configuration PROVIDER TESTS - - describe "powershell provider tests" do - - it "should successfully instanciate the provider" do - described_class.provider(:powershell).new(dsc_registry) - end - - before(:each) do - @provider = described_class.provider(:powershell).new(dsc_registry) - end - - describe "when dscmeta_module_name existing/is defined " do - - it "should compute powershell dsc test script with Invoke-DscResource" do - expect(@provider.ps_script_content('test')).to match(/Invoke-DscResource/) - end - - it "should compute powershell dsc test script with method Test" do - expect(@provider.ps_script_content('test')).to match(/Method\s+=\s*'test'/) - end - - it "should compute powershell dsc set script with Invoke-DscResource" do - expect(@provider.ps_script_content('set')).to match(/Invoke-DscResource/) - end - - it "should compute powershell dsc test script with method Set" do - expect(@provider.ps_script_content('set')).to match(/Method\s+=\s*'set'/) - end - - end - - describe "when dsc_ensure is 'present'" do - - before(:each) do - dsc_registry.original_parameters[:dsc_ensure] = 'present' - dsc_registry[:dsc_ensure] = 'present' - @provider = described_class.provider(:powershell).new(dsc_registry) - end - - it "should update :ensure to :present" do - expect(dsc_registry[:ensure]).to eq(:present) - end - - it "should compute powershell dsc test script in which ensure value is 'present'" do - expect(@provider.ps_script_content('test')).to match(/ensure = 'present'/) - end - - it "should compute powershell dsc set script in which ensure value is 'present'" do - expect(@provider.ps_script_content('set')).to match(/ensure = 'present'/) - end - - end - - describe "when dsc_ensure is 'absent'" do - - before(:each) do - dsc_registry.original_parameters[:dsc_ensure] = 'absent' - dsc_registry[:dsc_ensure] = 'absent' - @provider = described_class.provider(:powershell).new(dsc_registry) - end - - it "should update :ensure to :absent" do - expect(dsc_registry[:ensure]).to eq(:absent) - end - - it "should compute powershell dsc test script in which ensure value is 'present'" do - expect(@provider.ps_script_content('test')).to match(/ensure = 'present'/) - end - - it "should compute powershell dsc set script in which ensure value is 'absent'" do - expect(@provider.ps_script_content('set')).to match(/ensure = 'absent'/) - end - - end - - end -end diff --git a/spec/unit/puppet/type/dsc_script_spec.rb b/spec/unit/puppet/type/dsc_script_spec.rb deleted file mode 100644 index 82eefc3a..00000000 --- a/spec/unit/puppet/type/dsc_script_spec.rb +++ /dev/null @@ -1,183 +0,0 @@ -#!/usr/bin/env ruby -require 'spec_helper' - -describe Puppet::Type.type(:dsc_script) do - - let :dsc_script do - Puppet::Type.type(:dsc_script).new( - :name => 'foo', - :dsc_getscript => 'foo', - :dsc_setscript => 'foo', - :dsc_testscript => 'foo', - ) - end - - it 'should allow all properties to be specified' do - expect { Puppet::Type.type(:dsc_script).new( - :name => 'foo', - :dsc_getscript => 'foo', - :dsc_setscript => 'foo', - :dsc_testscript => 'foo', - :dsc_credential => {"user"=>"user", "password"=>"password"}, - :dsc_result => 'foo', - )}.to_not raise_error - end - - it "should stringify normally" do - expect(dsc_script.to_s).to eq("Dsc_script[foo]") - end - - it 'should require that dsc_getscript is specified' do - #dsc_script[:dsc_getscript] - expect { Puppet::Type.type(:dsc_script).new( - :name => 'foo', - :dsc_setscript => 'foo', - :dsc_testscript => 'foo', - )}.to raise_error(Puppet::Error, /dsc_getscript is a required attribute/) - end - - it 'should not accept array for dsc_getscript' do - expect{dsc_script[:dsc_getscript] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_getscript' do - expect{dsc_script[:dsc_getscript] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_getscript' do - expect{dsc_script[:dsc_getscript] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_getscript' do - expect{dsc_script[:dsc_getscript] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should require that dsc_setscript is specified' do - #dsc_script[:dsc_setscript] - expect { Puppet::Type.type(:dsc_script).new( - :name => 'foo', - :dsc_getscript => 'foo', - :dsc_testscript => 'foo', - )}.to raise_error(Puppet::Error, /dsc_setscript is a required attribute/) - end - - it 'should not accept array for dsc_setscript' do - expect{dsc_script[:dsc_setscript] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_setscript' do - expect{dsc_script[:dsc_setscript] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_setscript' do - expect{dsc_script[:dsc_setscript] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_setscript' do - expect{dsc_script[:dsc_setscript] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should require that dsc_testscript is specified' do - #dsc_script[:dsc_testscript] - expect { Puppet::Type.type(:dsc_script).new( - :name => 'foo', - :dsc_getscript => 'foo', - :dsc_setscript => 'foo', - )}.to raise_error(Puppet::Error, /dsc_testscript is a required attribute/) - end - - it 'should not accept array for dsc_testscript' do - expect{dsc_script[:dsc_testscript] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_testscript' do - expect{dsc_script[:dsc_testscript] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_testscript' do - expect{dsc_script[:dsc_testscript] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_testscript' do - expect{dsc_script[:dsc_testscript] = 16}.to raise_error(Puppet::ResourceError) - end - - it "should not accept empty password for dsc_credential" do - expect{dsc_script[:dsc_credential] = {"user"=>"user", "password"=>""}}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_credential' do - expect{dsc_script[:dsc_credential] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_credential' do - expect{dsc_script[:dsc_credential] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_credential' do - expect{dsc_script[:dsc_credential] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_credential' do - expect{dsc_script[:dsc_credential] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_result' do - expect{dsc_script[:dsc_result] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_result' do - expect{dsc_script[:dsc_result] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_result' do - expect{dsc_script[:dsc_result] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_result' do - expect{dsc_script[:dsc_result] = 16}.to raise_error(Puppet::ResourceError) - end - - # Configuration PROVIDER TESTS - - describe "powershell provider tests" do - - it "should successfully instanciate the provider" do - described_class.provider(:powershell).new(dsc_script) - end - - before(:each) do - @provider = described_class.provider(:powershell).new(dsc_script) - end - - describe "when dscmeta_module_name existing/is defined " do - - it "should compute powershell dsc test script with Invoke-DscResource" do - expect(@provider.ps_script_content('test')).to match(/Invoke-DscResource/) - end - - it "should compute powershell dsc test script with method Test" do - expect(@provider.ps_script_content('test')).to match(/Method\s+=\s*'test'/) - end - - it "should compute powershell dsc set script with Invoke-DscResource" do - expect(@provider.ps_script_content('set')).to match(/Invoke-DscResource/) - end - - it "should compute powershell dsc test script with method Set" do - expect(@provider.ps_script_content('set')).to match(/Method\s+=\s*'set'/) - end - - end - - describe "when dsc_resource has credentials" do - - it "should convert credential hash to a pscredential object" do - expect(@provider.ps_script_content('test')).to match(/| new-pscredential'/) - end - - end - - - end -end diff --git a/spec/unit/puppet/type/dsc_service_spec.rb b/spec/unit/puppet/type/dsc_service_spec.rb deleted file mode 100644 index 5bcda026..00000000 --- a/spec/unit/puppet/type/dsc_service_spec.rb +++ /dev/null @@ -1,438 +0,0 @@ -#!/usr/bin/env ruby -require 'spec_helper' - -describe Puppet::Type.type(:dsc_service) do - - let :dsc_service do - Puppet::Type.type(:dsc_service).new( - :name => 'foo', - :dsc_name => 'foo', - ) - end - - it 'should allow all properties to be specified' do - expect { Puppet::Type.type(:dsc_service).new( - :name => 'foo', - :dsc_name => 'foo', - :dsc_state => 'Running', - :dsc_startuptype => 'Automatic', - :dsc_builtinaccount => 'LocalSystem', - :dsc_credential => {"user"=>"user", "password"=>"password"}, - :dsc_status => 'foo', - :dsc_displayname => 'foo', - :dsc_description => 'foo', - :dsc_path => 'foo', - :dsc_dependencies => ["foo", "bar", "spec"], - :dsc_ensure => 'Present', - )}.to_not raise_error - end - - it "should stringify normally" do - expect(dsc_service.to_s).to eq("Dsc_service[foo]") - end - - it 'should default to ensure => present' do - expect(dsc_service[:ensure]).to eq :present - end - - it 'should require that dsc_name is specified' do - #dsc_service[:dsc_name] - expect { Puppet::Type.type(:dsc_service).new( - :name => 'foo', - )}.to raise_error(Puppet::Error, /dsc_name is a required attribute/) - end - - it 'should not accept array for dsc_name' do - expect{dsc_service[:dsc_name] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_name' do - expect{dsc_service[:dsc_name] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_name' do - expect{dsc_service[:dsc_name] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_name' do - expect{dsc_service[:dsc_name] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should accept dsc_state predefined value Running' do - dsc_service[:dsc_state] = 'Running' - expect(dsc_service[:dsc_state]).to eq('Running') - end - - it 'should accept dsc_state predefined value running' do - dsc_service[:dsc_state] = 'running' - expect(dsc_service[:dsc_state]).to eq('running') - end - - it 'should accept dsc_state predefined value Stopped' do - dsc_service[:dsc_state] = 'Stopped' - expect(dsc_service[:dsc_state]).to eq('Stopped') - end - - it 'should accept dsc_state predefined value stopped' do - dsc_service[:dsc_state] = 'stopped' - expect(dsc_service[:dsc_state]).to eq('stopped') - end - - it 'should not accept values not equal to predefined values' do - expect{dsc_service[:dsc_state] = 'invalid value'}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_state' do - expect{dsc_service[:dsc_state] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_state' do - expect{dsc_service[:dsc_state] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_state' do - expect{dsc_service[:dsc_state] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_state' do - expect{dsc_service[:dsc_state] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should accept dsc_startuptype predefined value Automatic' do - dsc_service[:dsc_startuptype] = 'Automatic' - expect(dsc_service[:dsc_startuptype]).to eq('Automatic') - end - - it 'should accept dsc_startuptype predefined value automatic' do - dsc_service[:dsc_startuptype] = 'automatic' - expect(dsc_service[:dsc_startuptype]).to eq('automatic') - end - - it 'should accept dsc_startuptype predefined value Manual' do - dsc_service[:dsc_startuptype] = 'Manual' - expect(dsc_service[:dsc_startuptype]).to eq('Manual') - end - - it 'should accept dsc_startuptype predefined value manual' do - dsc_service[:dsc_startuptype] = 'manual' - expect(dsc_service[:dsc_startuptype]).to eq('manual') - end - - it 'should accept dsc_startuptype predefined value Disabled' do - dsc_service[:dsc_startuptype] = 'Disabled' - expect(dsc_service[:dsc_startuptype]).to eq('Disabled') - end - - it 'should accept dsc_startuptype predefined value disabled' do - dsc_service[:dsc_startuptype] = 'disabled' - expect(dsc_service[:dsc_startuptype]).to eq('disabled') - end - - it 'should not accept values not equal to predefined values' do - expect{dsc_service[:dsc_startuptype] = 'invalid value'}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_startuptype' do - expect{dsc_service[:dsc_startuptype] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_startuptype' do - expect{dsc_service[:dsc_startuptype] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_startuptype' do - expect{dsc_service[:dsc_startuptype] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_startuptype' do - expect{dsc_service[:dsc_startuptype] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should accept dsc_builtinaccount predefined value LocalSystem' do - dsc_service[:dsc_builtinaccount] = 'LocalSystem' - expect(dsc_service[:dsc_builtinaccount]).to eq('LocalSystem') - end - - it 'should accept dsc_builtinaccount predefined value localsystem' do - dsc_service[:dsc_builtinaccount] = 'localsystem' - expect(dsc_service[:dsc_builtinaccount]).to eq('localsystem') - end - - it 'should accept dsc_builtinaccount predefined value LocalService' do - dsc_service[:dsc_builtinaccount] = 'LocalService' - expect(dsc_service[:dsc_builtinaccount]).to eq('LocalService') - end - - it 'should accept dsc_builtinaccount predefined value localservice' do - dsc_service[:dsc_builtinaccount] = 'localservice' - expect(dsc_service[:dsc_builtinaccount]).to eq('localservice') - end - - it 'should accept dsc_builtinaccount predefined value NetworkService' do - dsc_service[:dsc_builtinaccount] = 'NetworkService' - expect(dsc_service[:dsc_builtinaccount]).to eq('NetworkService') - end - - it 'should accept dsc_builtinaccount predefined value networkservice' do - dsc_service[:dsc_builtinaccount] = 'networkservice' - expect(dsc_service[:dsc_builtinaccount]).to eq('networkservice') - end - - it 'should not accept values not equal to predefined values' do - expect{dsc_service[:dsc_builtinaccount] = 'invalid value'}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_builtinaccount' do - expect{dsc_service[:dsc_builtinaccount] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_builtinaccount' do - expect{dsc_service[:dsc_builtinaccount] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_builtinaccount' do - expect{dsc_service[:dsc_builtinaccount] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_builtinaccount' do - expect{dsc_service[:dsc_builtinaccount] = 16}.to raise_error(Puppet::ResourceError) - end - - it "should not accept empty password for dsc_credential" do - expect{dsc_service[:dsc_credential] = {"user"=>"user", "password"=>""}}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_credential' do - expect{dsc_service[:dsc_credential] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_credential' do - expect{dsc_service[:dsc_credential] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_credential' do - expect{dsc_service[:dsc_credential] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_credential' do - expect{dsc_service[:dsc_credential] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_status' do - expect{dsc_service[:dsc_status] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_status' do - expect{dsc_service[:dsc_status] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_status' do - expect{dsc_service[:dsc_status] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_status' do - expect{dsc_service[:dsc_status] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_displayname' do - expect{dsc_service[:dsc_displayname] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_displayname' do - expect{dsc_service[:dsc_displayname] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_displayname' do - expect{dsc_service[:dsc_displayname] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_displayname' do - expect{dsc_service[:dsc_displayname] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_description' do - expect{dsc_service[:dsc_description] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_description' do - expect{dsc_service[:dsc_description] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_description' do - expect{dsc_service[:dsc_description] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_description' do - expect{dsc_service[:dsc_description] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_path' do - expect{dsc_service[:dsc_path] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_path' do - expect{dsc_service[:dsc_path] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_path' do - expect{dsc_service[:dsc_path] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_path' do - expect{dsc_service[:dsc_path] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should accept array for dsc_dependencies' do - dsc_service[:dsc_dependencies] = ["foo", "bar", "spec"] - expect(dsc_service[:dsc_dependencies]).to eq(["foo", "bar", "spec"]) - end - - it 'should not accept boolean for dsc_dependencies' do - expect{dsc_service[:dsc_dependencies] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_dependencies' do - expect{dsc_service[:dsc_dependencies] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_dependencies' do - expect{dsc_service[:dsc_dependencies] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should accept dsc_ensure predefined value Present' do - dsc_service[:dsc_ensure] = 'Present' - expect(dsc_service[:dsc_ensure]).to eq('Present') - end - - it 'should accept dsc_ensure predefined value present' do - dsc_service[:dsc_ensure] = 'present' - expect(dsc_service[:dsc_ensure]).to eq('present') - end - - it 'should accept dsc_ensure predefined value present and update ensure with this value (ensure end value should be a symbol)' do - dsc_service[:dsc_ensure] = 'present' - expect(dsc_service[:ensure]).to eq(dsc_service[:dsc_ensure].downcase.to_sym) - end - - it 'should accept dsc_ensure predefined value Absent' do - dsc_service[:dsc_ensure] = 'Absent' - expect(dsc_service[:dsc_ensure]).to eq('Absent') - end - - it 'should accept dsc_ensure predefined value absent' do - dsc_service[:dsc_ensure] = 'absent' - expect(dsc_service[:dsc_ensure]).to eq('absent') - end - - it 'should accept dsc_ensure predefined value absent and update ensure with this value (ensure end value should be a symbol)' do - dsc_service[:dsc_ensure] = 'absent' - expect(dsc_service[:ensure]).to eq(dsc_service[:dsc_ensure].downcase.to_sym) - end - - it 'should not accept values not equal to predefined values' do - expect{dsc_service[:dsc_ensure] = 'invalid value'}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_ensure' do - expect{dsc_service[:dsc_ensure] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_ensure' do - expect{dsc_service[:dsc_ensure] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_ensure' do - expect{dsc_service[:dsc_ensure] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_ensure' do - expect{dsc_service[:dsc_ensure] = 16}.to raise_error(Puppet::ResourceError) - end - - # Configuration PROVIDER TESTS - - describe "powershell provider tests" do - - it "should successfully instanciate the provider" do - described_class.provider(:powershell).new(dsc_service) - end - - before(:each) do - @provider = described_class.provider(:powershell).new(dsc_service) - end - - describe "when dscmeta_module_name existing/is defined " do - - it "should compute powershell dsc test script with Invoke-DscResource" do - expect(@provider.ps_script_content('test')).to match(/Invoke-DscResource/) - end - - it "should compute powershell dsc test script with method Test" do - expect(@provider.ps_script_content('test')).to match(/Method\s+=\s*'test'/) - end - - it "should compute powershell dsc set script with Invoke-DscResource" do - expect(@provider.ps_script_content('set')).to match(/Invoke-DscResource/) - end - - it "should compute powershell dsc test script with method Set" do - expect(@provider.ps_script_content('set')).to match(/Method\s+=\s*'set'/) - end - - end - - describe "when dsc_ensure is 'present'" do - - before(:each) do - dsc_service.original_parameters[:dsc_ensure] = 'present' - dsc_service[:dsc_ensure] = 'present' - @provider = described_class.provider(:powershell).new(dsc_service) - end - - it "should update :ensure to :present" do - expect(dsc_service[:ensure]).to eq(:present) - end - - it "should compute powershell dsc test script in which ensure value is 'present'" do - expect(@provider.ps_script_content('test')).to match(/ensure = 'present'/) - end - - it "should compute powershell dsc set script in which ensure value is 'present'" do - expect(@provider.ps_script_content('set')).to match(/ensure = 'present'/) - end - - end - - describe "when dsc_ensure is 'absent'" do - - before(:each) do - dsc_service.original_parameters[:dsc_ensure] = 'absent' - dsc_service[:dsc_ensure] = 'absent' - @provider = described_class.provider(:powershell).new(dsc_service) - end - - it "should update :ensure to :absent" do - expect(dsc_service[:ensure]).to eq(:absent) - end - - it "should compute powershell dsc test script in which ensure value is 'present'" do - expect(@provider.ps_script_content('test')).to match(/ensure = 'present'/) - end - - it "should compute powershell dsc set script in which ensure value is 'absent'" do - expect(@provider.ps_script_content('set')).to match(/ensure = 'absent'/) - end - - end - - describe "when dsc_resource has credentials" do - - it "should convert credential hash to a pscredential object" do - expect(@provider.ps_script_content('test')).to match(/| new-pscredential'/) - end - - end - - - end -end diff --git a/spec/unit/puppet/type/dsc_user_spec.rb b/spec/unit/puppet/type/dsc_user_spec.rb deleted file mode 100644 index 8c5b4c36..00000000 --- a/spec/unit/puppet/type/dsc_user_spec.rb +++ /dev/null @@ -1,435 +0,0 @@ -#!/usr/bin/env ruby -require 'spec_helper' - -describe Puppet::Type.type(:dsc_user) do - - let :dsc_user do - Puppet::Type.type(:dsc_user).new( - :name => 'foo', - :dsc_username => 'foo', - ) - end - - it 'should allow all properties to be specified' do - expect { Puppet::Type.type(:dsc_user).new( - :name => 'foo', - :dsc_username => 'foo', - :dsc_ensure => 'Present', - :dsc_fullname => 'foo', - :dsc_description => 'foo', - :dsc_password => {"user"=>"user", "password"=>"password"}, - :dsc_disabled => true, - :dsc_passwordneverexpires => true, - :dsc_passwordchangerequired => true, - :dsc_passwordchangenotallowed => true, - )}.to_not raise_error - end - - it "should stringify normally" do - expect(dsc_user.to_s).to eq("Dsc_user[foo]") - end - - it 'should default to ensure => present' do - expect(dsc_user[:ensure]).to eq :present - end - - it 'should require that dsc_username is specified' do - #dsc_user[:dsc_username] - expect { Puppet::Type.type(:dsc_user).new( - :name => 'foo', - )}.to raise_error(Puppet::Error, /dsc_username is a required attribute/) - end - - it 'should not accept array for dsc_username' do - expect{dsc_user[:dsc_username] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_username' do - expect{dsc_user[:dsc_username] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_username' do - expect{dsc_user[:dsc_username] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_username' do - expect{dsc_user[:dsc_username] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should accept dsc_ensure predefined value Present' do - dsc_user[:dsc_ensure] = 'Present' - expect(dsc_user[:dsc_ensure]).to eq('Present') - end - - it 'should accept dsc_ensure predefined value present' do - dsc_user[:dsc_ensure] = 'present' - expect(dsc_user[:dsc_ensure]).to eq('present') - end - - it 'should accept dsc_ensure predefined value present and update ensure with this value (ensure end value should be a symbol)' do - dsc_user[:dsc_ensure] = 'present' - expect(dsc_user[:ensure]).to eq(dsc_user[:dsc_ensure].downcase.to_sym) - end - - it 'should accept dsc_ensure predefined value Absent' do - dsc_user[:dsc_ensure] = 'Absent' - expect(dsc_user[:dsc_ensure]).to eq('Absent') - end - - it 'should accept dsc_ensure predefined value absent' do - dsc_user[:dsc_ensure] = 'absent' - expect(dsc_user[:dsc_ensure]).to eq('absent') - end - - it 'should accept dsc_ensure predefined value absent and update ensure with this value (ensure end value should be a symbol)' do - dsc_user[:dsc_ensure] = 'absent' - expect(dsc_user[:ensure]).to eq(dsc_user[:dsc_ensure].downcase.to_sym) - end - - it 'should not accept values not equal to predefined values' do - expect{dsc_user[:dsc_ensure] = 'invalid value'}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_ensure' do - expect{dsc_user[:dsc_ensure] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_ensure' do - expect{dsc_user[:dsc_ensure] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_ensure' do - expect{dsc_user[:dsc_ensure] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_ensure' do - expect{dsc_user[:dsc_ensure] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_fullname' do - expect{dsc_user[:dsc_fullname] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_fullname' do - expect{dsc_user[:dsc_fullname] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_fullname' do - expect{dsc_user[:dsc_fullname] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_fullname' do - expect{dsc_user[:dsc_fullname] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_description' do - expect{dsc_user[:dsc_description] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_description' do - expect{dsc_user[:dsc_description] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_description' do - expect{dsc_user[:dsc_description] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_description' do - expect{dsc_user[:dsc_description] = 16}.to raise_error(Puppet::ResourceError) - end - - it "should not accept empty password for dsc_password" do - expect{dsc_user[:dsc_password] = {"user"=>"user", "password"=>""}}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_password' do - expect{dsc_user[:dsc_password] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_password' do - expect{dsc_user[:dsc_password] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_password' do - expect{dsc_user[:dsc_password] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_password' do - expect{dsc_user[:dsc_password] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_disabled' do - expect{dsc_user[:dsc_disabled] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should accept boolean for dsc_disabled' do - dsc_user[:dsc_disabled] = true - expect(dsc_user[:dsc_disabled]).to eq(true) - end - - it "should accept boolean-like value 'true' and munge this value to boolean for dsc_disabled" do - dsc_user[:dsc_disabled] = 'true' - expect(dsc_user[:dsc_disabled]).to eq(true) - end - - it "should accept boolean-like value 'false' and munge this value to boolean for dsc_disabled" do - dsc_user[:dsc_disabled] = 'false' - expect(dsc_user[:dsc_disabled]).to eq(false) - end - - it "should accept boolean-like value 'True' and munge this value to boolean for dsc_disabled" do - dsc_user[:dsc_disabled] = 'True' - expect(dsc_user[:dsc_disabled]).to eq(true) - end - - it "should accept boolean-like value 'False' and munge this value to boolean for dsc_disabled" do - dsc_user[:dsc_disabled] = 'False' - expect(dsc_user[:dsc_disabled]).to eq(false) - end - - it "should accept boolean-like value :true and munge this value to boolean for dsc_disabled" do - dsc_user[:dsc_disabled] = :true - expect(dsc_user[:dsc_disabled]).to eq(true) - end - - it "should accept boolean-like value :false and munge this value to boolean for dsc_disabled" do - dsc_user[:dsc_disabled] = :false - expect(dsc_user[:dsc_disabled]).to eq(false) - end - - it 'should not accept int for dsc_disabled' do - expect{dsc_user[:dsc_disabled] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_disabled' do - expect{dsc_user[:dsc_disabled] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_passwordneverexpires' do - expect{dsc_user[:dsc_passwordneverexpires] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should accept boolean for dsc_passwordneverexpires' do - dsc_user[:dsc_passwordneverexpires] = true - expect(dsc_user[:dsc_passwordneverexpires]).to eq(true) - end - - it "should accept boolean-like value 'true' and munge this value to boolean for dsc_passwordneverexpires" do - dsc_user[:dsc_passwordneverexpires] = 'true' - expect(dsc_user[:dsc_passwordneverexpires]).to eq(true) - end - - it "should accept boolean-like value 'false' and munge this value to boolean for dsc_passwordneverexpires" do - dsc_user[:dsc_passwordneverexpires] = 'false' - expect(dsc_user[:dsc_passwordneverexpires]).to eq(false) - end - - it "should accept boolean-like value 'True' and munge this value to boolean for dsc_passwordneverexpires" do - dsc_user[:dsc_passwordneverexpires] = 'True' - expect(dsc_user[:dsc_passwordneverexpires]).to eq(true) - end - - it "should accept boolean-like value 'False' and munge this value to boolean for dsc_passwordneverexpires" do - dsc_user[:dsc_passwordneverexpires] = 'False' - expect(dsc_user[:dsc_passwordneverexpires]).to eq(false) - end - - it "should accept boolean-like value :true and munge this value to boolean for dsc_passwordneverexpires" do - dsc_user[:dsc_passwordneverexpires] = :true - expect(dsc_user[:dsc_passwordneverexpires]).to eq(true) - end - - it "should accept boolean-like value :false and munge this value to boolean for dsc_passwordneverexpires" do - dsc_user[:dsc_passwordneverexpires] = :false - expect(dsc_user[:dsc_passwordneverexpires]).to eq(false) - end - - it 'should not accept int for dsc_passwordneverexpires' do - expect{dsc_user[:dsc_passwordneverexpires] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_passwordneverexpires' do - expect{dsc_user[:dsc_passwordneverexpires] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_passwordchangerequired' do - expect{dsc_user[:dsc_passwordchangerequired] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should accept boolean for dsc_passwordchangerequired' do - dsc_user[:dsc_passwordchangerequired] = true - expect(dsc_user[:dsc_passwordchangerequired]).to eq(true) - end - - it "should accept boolean-like value 'true' and munge this value to boolean for dsc_passwordchangerequired" do - dsc_user[:dsc_passwordchangerequired] = 'true' - expect(dsc_user[:dsc_passwordchangerequired]).to eq(true) - end - - it "should accept boolean-like value 'false' and munge this value to boolean for dsc_passwordchangerequired" do - dsc_user[:dsc_passwordchangerequired] = 'false' - expect(dsc_user[:dsc_passwordchangerequired]).to eq(false) - end - - it "should accept boolean-like value 'True' and munge this value to boolean for dsc_passwordchangerequired" do - dsc_user[:dsc_passwordchangerequired] = 'True' - expect(dsc_user[:dsc_passwordchangerequired]).to eq(true) - end - - it "should accept boolean-like value 'False' and munge this value to boolean for dsc_passwordchangerequired" do - dsc_user[:dsc_passwordchangerequired] = 'False' - expect(dsc_user[:dsc_passwordchangerequired]).to eq(false) - end - - it "should accept boolean-like value :true and munge this value to boolean for dsc_passwordchangerequired" do - dsc_user[:dsc_passwordchangerequired] = :true - expect(dsc_user[:dsc_passwordchangerequired]).to eq(true) - end - - it "should accept boolean-like value :false and munge this value to boolean for dsc_passwordchangerequired" do - dsc_user[:dsc_passwordchangerequired] = :false - expect(dsc_user[:dsc_passwordchangerequired]).to eq(false) - end - - it 'should not accept int for dsc_passwordchangerequired' do - expect{dsc_user[:dsc_passwordchangerequired] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_passwordchangerequired' do - expect{dsc_user[:dsc_passwordchangerequired] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_passwordchangenotallowed' do - expect{dsc_user[:dsc_passwordchangenotallowed] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should accept boolean for dsc_passwordchangenotallowed' do - dsc_user[:dsc_passwordchangenotallowed] = true - expect(dsc_user[:dsc_passwordchangenotallowed]).to eq(true) - end - - it "should accept boolean-like value 'true' and munge this value to boolean for dsc_passwordchangenotallowed" do - dsc_user[:dsc_passwordchangenotallowed] = 'true' - expect(dsc_user[:dsc_passwordchangenotallowed]).to eq(true) - end - - it "should accept boolean-like value 'false' and munge this value to boolean for dsc_passwordchangenotallowed" do - dsc_user[:dsc_passwordchangenotallowed] = 'false' - expect(dsc_user[:dsc_passwordchangenotallowed]).to eq(false) - end - - it "should accept boolean-like value 'True' and munge this value to boolean for dsc_passwordchangenotallowed" do - dsc_user[:dsc_passwordchangenotallowed] = 'True' - expect(dsc_user[:dsc_passwordchangenotallowed]).to eq(true) - end - - it "should accept boolean-like value 'False' and munge this value to boolean for dsc_passwordchangenotallowed" do - dsc_user[:dsc_passwordchangenotallowed] = 'False' - expect(dsc_user[:dsc_passwordchangenotallowed]).to eq(false) - end - - it "should accept boolean-like value :true and munge this value to boolean for dsc_passwordchangenotallowed" do - dsc_user[:dsc_passwordchangenotallowed] = :true - expect(dsc_user[:dsc_passwordchangenotallowed]).to eq(true) - end - - it "should accept boolean-like value :false and munge this value to boolean for dsc_passwordchangenotallowed" do - dsc_user[:dsc_passwordchangenotallowed] = :false - expect(dsc_user[:dsc_passwordchangenotallowed]).to eq(false) - end - - it 'should not accept int for dsc_passwordchangenotallowed' do - expect{dsc_user[:dsc_passwordchangenotallowed] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_passwordchangenotallowed' do - expect{dsc_user[:dsc_passwordchangenotallowed] = 16}.to raise_error(Puppet::ResourceError) - end - - # Configuration PROVIDER TESTS - - describe "powershell provider tests" do - - it "should successfully instanciate the provider" do - described_class.provider(:powershell).new(dsc_user) - end - - before(:each) do - @provider = described_class.provider(:powershell).new(dsc_user) - end - - describe "when dscmeta_module_name existing/is defined " do - - it "should compute powershell dsc test script with Invoke-DscResource" do - expect(@provider.ps_script_content('test')).to match(/Invoke-DscResource/) - end - - it "should compute powershell dsc test script with method Test" do - expect(@provider.ps_script_content('test')).to match(/Method\s+=\s*'test'/) - end - - it "should compute powershell dsc set script with Invoke-DscResource" do - expect(@provider.ps_script_content('set')).to match(/Invoke-DscResource/) - end - - it "should compute powershell dsc test script with method Set" do - expect(@provider.ps_script_content('set')).to match(/Method\s+=\s*'set'/) - end - - end - - describe "when dsc_ensure is 'present'" do - - before(:each) do - dsc_user.original_parameters[:dsc_ensure] = 'present' - dsc_user[:dsc_ensure] = 'present' - @provider = described_class.provider(:powershell).new(dsc_user) - end - - it "should update :ensure to :present" do - expect(dsc_user[:ensure]).to eq(:present) - end - - it "should compute powershell dsc test script in which ensure value is 'present'" do - expect(@provider.ps_script_content('test')).to match(/ensure = 'present'/) - end - - it "should compute powershell dsc set script in which ensure value is 'present'" do - expect(@provider.ps_script_content('set')).to match(/ensure = 'present'/) - end - - end - - describe "when dsc_ensure is 'absent'" do - - before(:each) do - dsc_user.original_parameters[:dsc_ensure] = 'absent' - dsc_user[:dsc_ensure] = 'absent' - @provider = described_class.provider(:powershell).new(dsc_user) - end - - it "should update :ensure to :absent" do - expect(dsc_user[:ensure]).to eq(:absent) - end - - it "should compute powershell dsc test script in which ensure value is 'present'" do - expect(@provider.ps_script_content('test')).to match(/ensure = 'present'/) - end - - it "should compute powershell dsc set script in which ensure value is 'absent'" do - expect(@provider.ps_script_content('set')).to match(/ensure = 'absent'/) - end - - end - - describe "when dsc_resource has credentials" do - - it "should convert credential hash to a pscredential object" do - expect(@provider.ps_script_content('test')).to match(/| new-pscredential'/) - end - - end - - - end -end diff --git a/spec/unit/puppet/type/dsc_windowsfeature_spec.rb b/spec/unit/puppet/type/dsc_windowsfeature_spec.rb deleted file mode 100644 index 6cf19f77..00000000 --- a/spec/unit/puppet/type/dsc_windowsfeature_spec.rb +++ /dev/null @@ -1,308 +0,0 @@ -#!/usr/bin/env ruby -require 'spec_helper' - -describe Puppet::Type.type(:dsc_windowsfeature) do - - let :dsc_windowsfeature do - Puppet::Type.type(:dsc_windowsfeature).new( - :name => 'foo', - :dsc_name => 'foo', - ) - end - - it 'should allow all properties to be specified' do - expect { Puppet::Type.type(:dsc_windowsfeature).new( - :name => 'foo', - :dsc_name => 'foo', - :dsc_ensure => 'Present', - :dsc_displayname => 'foo', - :dsc_source => 'foo', - :dsc_includeallsubfeature => true, - :dsc_logpath => 'foo', - :dsc_credential => {"user"=>"user", "password"=>"password"}, - )}.to_not raise_error - end - - it "should stringify normally" do - expect(dsc_windowsfeature.to_s).to eq("Dsc_windowsfeature[foo]") - end - - it 'should default to ensure => present' do - expect(dsc_windowsfeature[:ensure]).to eq :present - end - - it 'should require that dsc_name is specified' do - #dsc_windowsfeature[:dsc_name] - expect { Puppet::Type.type(:dsc_windowsfeature).new( - :name => 'foo', - )}.to raise_error(Puppet::Error, /dsc_name is a required attribute/) - end - - it 'should not accept array for dsc_name' do - expect{dsc_windowsfeature[:dsc_name] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_name' do - expect{dsc_windowsfeature[:dsc_name] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_name' do - expect{dsc_windowsfeature[:dsc_name] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_name' do - expect{dsc_windowsfeature[:dsc_name] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should accept dsc_ensure predefined value Present' do - dsc_windowsfeature[:dsc_ensure] = 'Present' - expect(dsc_windowsfeature[:dsc_ensure]).to eq('Present') - end - - it 'should accept dsc_ensure predefined value present' do - dsc_windowsfeature[:dsc_ensure] = 'present' - expect(dsc_windowsfeature[:dsc_ensure]).to eq('present') - end - - it 'should accept dsc_ensure predefined value present and update ensure with this value (ensure end value should be a symbol)' do - dsc_windowsfeature[:dsc_ensure] = 'present' - expect(dsc_windowsfeature[:ensure]).to eq(dsc_windowsfeature[:dsc_ensure].downcase.to_sym) - end - - it 'should accept dsc_ensure predefined value Absent' do - dsc_windowsfeature[:dsc_ensure] = 'Absent' - expect(dsc_windowsfeature[:dsc_ensure]).to eq('Absent') - end - - it 'should accept dsc_ensure predefined value absent' do - dsc_windowsfeature[:dsc_ensure] = 'absent' - expect(dsc_windowsfeature[:dsc_ensure]).to eq('absent') - end - - it 'should accept dsc_ensure predefined value absent and update ensure with this value (ensure end value should be a symbol)' do - dsc_windowsfeature[:dsc_ensure] = 'absent' - expect(dsc_windowsfeature[:ensure]).to eq(dsc_windowsfeature[:dsc_ensure].downcase.to_sym) - end - - it 'should not accept values not equal to predefined values' do - expect{dsc_windowsfeature[:dsc_ensure] = 'invalid value'}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_ensure' do - expect{dsc_windowsfeature[:dsc_ensure] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_ensure' do - expect{dsc_windowsfeature[:dsc_ensure] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_ensure' do - expect{dsc_windowsfeature[:dsc_ensure] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_ensure' do - expect{dsc_windowsfeature[:dsc_ensure] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_displayname' do - expect{dsc_windowsfeature[:dsc_displayname] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_displayname' do - expect{dsc_windowsfeature[:dsc_displayname] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_displayname' do - expect{dsc_windowsfeature[:dsc_displayname] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_displayname' do - expect{dsc_windowsfeature[:dsc_displayname] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_source' do - expect{dsc_windowsfeature[:dsc_source] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_source' do - expect{dsc_windowsfeature[:dsc_source] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_source' do - expect{dsc_windowsfeature[:dsc_source] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_source' do - expect{dsc_windowsfeature[:dsc_source] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_includeallsubfeature' do - expect{dsc_windowsfeature[:dsc_includeallsubfeature] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should accept boolean for dsc_includeallsubfeature' do - dsc_windowsfeature[:dsc_includeallsubfeature] = true - expect(dsc_windowsfeature[:dsc_includeallsubfeature]).to eq(true) - end - - it "should accept boolean-like value 'true' and munge this value to boolean for dsc_includeallsubfeature" do - dsc_windowsfeature[:dsc_includeallsubfeature] = 'true' - expect(dsc_windowsfeature[:dsc_includeallsubfeature]).to eq(true) - end - - it "should accept boolean-like value 'false' and munge this value to boolean for dsc_includeallsubfeature" do - dsc_windowsfeature[:dsc_includeallsubfeature] = 'false' - expect(dsc_windowsfeature[:dsc_includeallsubfeature]).to eq(false) - end - - it "should accept boolean-like value 'True' and munge this value to boolean for dsc_includeallsubfeature" do - dsc_windowsfeature[:dsc_includeallsubfeature] = 'True' - expect(dsc_windowsfeature[:dsc_includeallsubfeature]).to eq(true) - end - - it "should accept boolean-like value 'False' and munge this value to boolean for dsc_includeallsubfeature" do - dsc_windowsfeature[:dsc_includeallsubfeature] = 'False' - expect(dsc_windowsfeature[:dsc_includeallsubfeature]).to eq(false) - end - - it "should accept boolean-like value :true and munge this value to boolean for dsc_includeallsubfeature" do - dsc_windowsfeature[:dsc_includeallsubfeature] = :true - expect(dsc_windowsfeature[:dsc_includeallsubfeature]).to eq(true) - end - - it "should accept boolean-like value :false and munge this value to boolean for dsc_includeallsubfeature" do - dsc_windowsfeature[:dsc_includeallsubfeature] = :false - expect(dsc_windowsfeature[:dsc_includeallsubfeature]).to eq(false) - end - - it 'should not accept int for dsc_includeallsubfeature' do - expect{dsc_windowsfeature[:dsc_includeallsubfeature] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_includeallsubfeature' do - expect{dsc_windowsfeature[:dsc_includeallsubfeature] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_logpath' do - expect{dsc_windowsfeature[:dsc_logpath] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_logpath' do - expect{dsc_windowsfeature[:dsc_logpath] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_logpath' do - expect{dsc_windowsfeature[:dsc_logpath] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_logpath' do - expect{dsc_windowsfeature[:dsc_logpath] = 16}.to raise_error(Puppet::ResourceError) - end - - it "should not accept empty password for dsc_credential" do - expect{dsc_windowsfeature[:dsc_credential] = {"user"=>"user", "password"=>""}}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_credential' do - expect{dsc_windowsfeature[:dsc_credential] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_credential' do - expect{dsc_windowsfeature[:dsc_credential] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_credential' do - expect{dsc_windowsfeature[:dsc_credential] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_credential' do - expect{dsc_windowsfeature[:dsc_credential] = 16}.to raise_error(Puppet::ResourceError) - end - - # Configuration PROVIDER TESTS - - describe "powershell provider tests" do - - it "should successfully instanciate the provider" do - described_class.provider(:powershell).new(dsc_windowsfeature) - end - - before(:each) do - @provider = described_class.provider(:powershell).new(dsc_windowsfeature) - end - - describe "when dscmeta_module_name existing/is defined " do - - it "should compute powershell dsc test script with Invoke-DscResource" do - expect(@provider.ps_script_content('test')).to match(/Invoke-DscResource/) - end - - it "should compute powershell dsc test script with method Test" do - expect(@provider.ps_script_content('test')).to match(/Method\s+=\s*'test'/) - end - - it "should compute powershell dsc set script with Invoke-DscResource" do - expect(@provider.ps_script_content('set')).to match(/Invoke-DscResource/) - end - - it "should compute powershell dsc test script with method Set" do - expect(@provider.ps_script_content('set')).to match(/Method\s+=\s*'set'/) - end - - end - - describe "when dsc_ensure is 'present'" do - - before(:each) do - dsc_windowsfeature.original_parameters[:dsc_ensure] = 'present' - dsc_windowsfeature[:dsc_ensure] = 'present' - @provider = described_class.provider(:powershell).new(dsc_windowsfeature) - end - - it "should update :ensure to :present" do - expect(dsc_windowsfeature[:ensure]).to eq(:present) - end - - it "should compute powershell dsc test script in which ensure value is 'present'" do - expect(@provider.ps_script_content('test')).to match(/ensure = 'present'/) - end - - it "should compute powershell dsc set script in which ensure value is 'present'" do - expect(@provider.ps_script_content('set')).to match(/ensure = 'present'/) - end - - end - - describe "when dsc_ensure is 'absent'" do - - before(:each) do - dsc_windowsfeature.original_parameters[:dsc_ensure] = 'absent' - dsc_windowsfeature[:dsc_ensure] = 'absent' - @provider = described_class.provider(:powershell).new(dsc_windowsfeature) - end - - it "should update :ensure to :absent" do - expect(dsc_windowsfeature[:ensure]).to eq(:absent) - end - - it "should compute powershell dsc test script in which ensure value is 'present'" do - expect(@provider.ps_script_content('test')).to match(/ensure = 'present'/) - end - - it "should compute powershell dsc set script in which ensure value is 'absent'" do - expect(@provider.ps_script_content('set')).to match(/ensure = 'absent'/) - end - - end - - describe "when dsc_resource has credentials" do - - it "should convert credential hash to a pscredential object" do - expect(@provider.ps_script_content('test')).to match(/| new-pscredential'/) - end - - end - - - end -end diff --git a/spec/unit/puppet/type/dsc_windowsoptionalfeature_spec.rb b/spec/unit/puppet/type/dsc_windowsoptionalfeature_spec.rb deleted file mode 100644 index 429557ec..00000000 --- a/spec/unit/puppet/type/dsc_windowsoptionalfeature_spec.rb +++ /dev/null @@ -1,413 +0,0 @@ -#!/usr/bin/env ruby -require 'spec_helper' - -describe Puppet::Type.type(:dsc_windowsoptionalfeature) do - - let :dsc_windowsoptionalfeature do - Puppet::Type.type(:dsc_windowsoptionalfeature).new( - :name => 'foo', - :dsc_name => 'foo', - ) - end - - it 'should allow all properties to be specified' do - expect { Puppet::Type.type(:dsc_windowsoptionalfeature).new( - :name => 'foo', - :dsc_name => 'foo', - :dsc_ensure => 'Enable', - :dsc_source => ["foo", "bar", "spec"], - :dsc_nowindowsupdatecheck => true, - :dsc_removefilesondisable => true, - :dsc_loglevel => 'ErrorsOnly', - :dsc_logpath => 'foo', - :dsc_customproperties => ["foo", "bar", "spec"], - :dsc_description => 'foo', - :dsc_displayname => 'foo', - )}.to_not raise_error - end - - it "should stringify normally" do - expect(dsc_windowsoptionalfeature.to_s).to eq("Dsc_windowsoptionalfeature[foo]") - end - - it 'should default to ensure => enable' do - expect(dsc_windowsoptionalfeature[:ensure]).to eq :enable - end - - it 'should require that dsc_name is specified' do - #dsc_windowsoptionalfeature[:dsc_name] - expect { Puppet::Type.type(:dsc_windowsoptionalfeature).new( - :name => 'foo', - )}.to raise_error(Puppet::Error, /dsc_name is a required attribute/) - end - - it 'should not accept array for dsc_name' do - expect{dsc_windowsoptionalfeature[:dsc_name] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_name' do - expect{dsc_windowsoptionalfeature[:dsc_name] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_name' do - expect{dsc_windowsoptionalfeature[:dsc_name] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_name' do - expect{dsc_windowsoptionalfeature[:dsc_name] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should accept dsc_ensure predefined value Enable' do - dsc_windowsoptionalfeature[:dsc_ensure] = 'Enable' - expect(dsc_windowsoptionalfeature[:dsc_ensure]).to eq('Enable') - end - - it 'should accept dsc_ensure predefined value enable' do - dsc_windowsoptionalfeature[:dsc_ensure] = 'enable' - expect(dsc_windowsoptionalfeature[:dsc_ensure]).to eq('enable') - end - - it 'should accept dsc_ensure predefined value enable and update ensure with this value (ensure end value should be a symbol)' do - dsc_windowsoptionalfeature[:dsc_ensure] = 'enable' - expect(dsc_windowsoptionalfeature[:ensure]).to eq(dsc_windowsoptionalfeature[:dsc_ensure].downcase.to_sym) - end - - it 'should accept dsc_ensure predefined value Disable' do - dsc_windowsoptionalfeature[:dsc_ensure] = 'Disable' - expect(dsc_windowsoptionalfeature[:dsc_ensure]).to eq('Disable') - end - - it 'should accept dsc_ensure predefined value disable' do - dsc_windowsoptionalfeature[:dsc_ensure] = 'disable' - expect(dsc_windowsoptionalfeature[:dsc_ensure]).to eq('disable') - end - - it 'should accept dsc_ensure predefined value disable and update ensure with this value (ensure end value should be a symbol)' do - dsc_windowsoptionalfeature[:dsc_ensure] = 'disable' - expect(dsc_windowsoptionalfeature[:ensure]).to eq(dsc_windowsoptionalfeature[:dsc_ensure].downcase.to_sym) - end - - it 'should not accept values not equal to predefined values' do - expect{dsc_windowsoptionalfeature[:dsc_ensure] = 'invalid value'}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_ensure' do - expect{dsc_windowsoptionalfeature[:dsc_ensure] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_ensure' do - expect{dsc_windowsoptionalfeature[:dsc_ensure] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_ensure' do - expect{dsc_windowsoptionalfeature[:dsc_ensure] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_ensure' do - expect{dsc_windowsoptionalfeature[:dsc_ensure] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should accept array for dsc_source' do - dsc_windowsoptionalfeature[:dsc_source] = ["foo", "bar", "spec"] - expect(dsc_windowsoptionalfeature[:dsc_source]).to eq(["foo", "bar", "spec"]) - end - - it 'should not accept boolean for dsc_source' do - expect{dsc_windowsoptionalfeature[:dsc_source] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_source' do - expect{dsc_windowsoptionalfeature[:dsc_source] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_source' do - expect{dsc_windowsoptionalfeature[:dsc_source] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_nowindowsupdatecheck' do - expect{dsc_windowsoptionalfeature[:dsc_nowindowsupdatecheck] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should accept boolean for dsc_nowindowsupdatecheck' do - dsc_windowsoptionalfeature[:dsc_nowindowsupdatecheck] = true - expect(dsc_windowsoptionalfeature[:dsc_nowindowsupdatecheck]).to eq(true) - end - - it "should accept boolean-like value 'true' and munge this value to boolean for dsc_nowindowsupdatecheck" do - dsc_windowsoptionalfeature[:dsc_nowindowsupdatecheck] = 'true' - expect(dsc_windowsoptionalfeature[:dsc_nowindowsupdatecheck]).to eq(true) - end - - it "should accept boolean-like value 'false' and munge this value to boolean for dsc_nowindowsupdatecheck" do - dsc_windowsoptionalfeature[:dsc_nowindowsupdatecheck] = 'false' - expect(dsc_windowsoptionalfeature[:dsc_nowindowsupdatecheck]).to eq(false) - end - - it "should accept boolean-like value 'True' and munge this value to boolean for dsc_nowindowsupdatecheck" do - dsc_windowsoptionalfeature[:dsc_nowindowsupdatecheck] = 'True' - expect(dsc_windowsoptionalfeature[:dsc_nowindowsupdatecheck]).to eq(true) - end - - it "should accept boolean-like value 'False' and munge this value to boolean for dsc_nowindowsupdatecheck" do - dsc_windowsoptionalfeature[:dsc_nowindowsupdatecheck] = 'False' - expect(dsc_windowsoptionalfeature[:dsc_nowindowsupdatecheck]).to eq(false) - end - - it "should accept boolean-like value :true and munge this value to boolean for dsc_nowindowsupdatecheck" do - dsc_windowsoptionalfeature[:dsc_nowindowsupdatecheck] = :true - expect(dsc_windowsoptionalfeature[:dsc_nowindowsupdatecheck]).to eq(true) - end - - it "should accept boolean-like value :false and munge this value to boolean for dsc_nowindowsupdatecheck" do - dsc_windowsoptionalfeature[:dsc_nowindowsupdatecheck] = :false - expect(dsc_windowsoptionalfeature[:dsc_nowindowsupdatecheck]).to eq(false) - end - - it 'should not accept int for dsc_nowindowsupdatecheck' do - expect{dsc_windowsoptionalfeature[:dsc_nowindowsupdatecheck] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_nowindowsupdatecheck' do - expect{dsc_windowsoptionalfeature[:dsc_nowindowsupdatecheck] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_removefilesondisable' do - expect{dsc_windowsoptionalfeature[:dsc_removefilesondisable] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should accept boolean for dsc_removefilesondisable' do - dsc_windowsoptionalfeature[:dsc_removefilesondisable] = true - expect(dsc_windowsoptionalfeature[:dsc_removefilesondisable]).to eq(true) - end - - it "should accept boolean-like value 'true' and munge this value to boolean for dsc_removefilesondisable" do - dsc_windowsoptionalfeature[:dsc_removefilesondisable] = 'true' - expect(dsc_windowsoptionalfeature[:dsc_removefilesondisable]).to eq(true) - end - - it "should accept boolean-like value 'false' and munge this value to boolean for dsc_removefilesondisable" do - dsc_windowsoptionalfeature[:dsc_removefilesondisable] = 'false' - expect(dsc_windowsoptionalfeature[:dsc_removefilesondisable]).to eq(false) - end - - it "should accept boolean-like value 'True' and munge this value to boolean for dsc_removefilesondisable" do - dsc_windowsoptionalfeature[:dsc_removefilesondisable] = 'True' - expect(dsc_windowsoptionalfeature[:dsc_removefilesondisable]).to eq(true) - end - - it "should accept boolean-like value 'False' and munge this value to boolean for dsc_removefilesondisable" do - dsc_windowsoptionalfeature[:dsc_removefilesondisable] = 'False' - expect(dsc_windowsoptionalfeature[:dsc_removefilesondisable]).to eq(false) - end - - it "should accept boolean-like value :true and munge this value to boolean for dsc_removefilesondisable" do - dsc_windowsoptionalfeature[:dsc_removefilesondisable] = :true - expect(dsc_windowsoptionalfeature[:dsc_removefilesondisable]).to eq(true) - end - - it "should accept boolean-like value :false and munge this value to boolean for dsc_removefilesondisable" do - dsc_windowsoptionalfeature[:dsc_removefilesondisable] = :false - expect(dsc_windowsoptionalfeature[:dsc_removefilesondisable]).to eq(false) - end - - it 'should not accept int for dsc_removefilesondisable' do - expect{dsc_windowsoptionalfeature[:dsc_removefilesondisable] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_removefilesondisable' do - expect{dsc_windowsoptionalfeature[:dsc_removefilesondisable] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should accept dsc_loglevel predefined value ErrorsOnly' do - dsc_windowsoptionalfeature[:dsc_loglevel] = 'ErrorsOnly' - expect(dsc_windowsoptionalfeature[:dsc_loglevel]).to eq('ErrorsOnly') - end - - it 'should accept dsc_loglevel predefined value errorsonly' do - dsc_windowsoptionalfeature[:dsc_loglevel] = 'errorsonly' - expect(dsc_windowsoptionalfeature[:dsc_loglevel]).to eq('errorsonly') - end - - it 'should accept dsc_loglevel predefined value ErrorsAndWarning' do - dsc_windowsoptionalfeature[:dsc_loglevel] = 'ErrorsAndWarning' - expect(dsc_windowsoptionalfeature[:dsc_loglevel]).to eq('ErrorsAndWarning') - end - - it 'should accept dsc_loglevel predefined value errorsandwarning' do - dsc_windowsoptionalfeature[:dsc_loglevel] = 'errorsandwarning' - expect(dsc_windowsoptionalfeature[:dsc_loglevel]).to eq('errorsandwarning') - end - - it 'should accept dsc_loglevel predefined value ErrorsAndWarningAndInformation' do - dsc_windowsoptionalfeature[:dsc_loglevel] = 'ErrorsAndWarningAndInformation' - expect(dsc_windowsoptionalfeature[:dsc_loglevel]).to eq('ErrorsAndWarningAndInformation') - end - - it 'should accept dsc_loglevel predefined value errorsandwarningandinformation' do - dsc_windowsoptionalfeature[:dsc_loglevel] = 'errorsandwarningandinformation' - expect(dsc_windowsoptionalfeature[:dsc_loglevel]).to eq('errorsandwarningandinformation') - end - - it 'should not accept values not equal to predefined values' do - expect{dsc_windowsoptionalfeature[:dsc_loglevel] = 'invalid value'}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_loglevel' do - expect{dsc_windowsoptionalfeature[:dsc_loglevel] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_loglevel' do - expect{dsc_windowsoptionalfeature[:dsc_loglevel] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_loglevel' do - expect{dsc_windowsoptionalfeature[:dsc_loglevel] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_loglevel' do - expect{dsc_windowsoptionalfeature[:dsc_loglevel] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_logpath' do - expect{dsc_windowsoptionalfeature[:dsc_logpath] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_logpath' do - expect{dsc_windowsoptionalfeature[:dsc_logpath] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_logpath' do - expect{dsc_windowsoptionalfeature[:dsc_logpath] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_logpath' do - expect{dsc_windowsoptionalfeature[:dsc_logpath] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should accept array for dsc_customproperties' do - dsc_windowsoptionalfeature[:dsc_customproperties] = ["foo", "bar", "spec"] - expect(dsc_windowsoptionalfeature[:dsc_customproperties]).to eq(["foo", "bar", "spec"]) - end - - it 'should not accept boolean for dsc_customproperties' do - expect{dsc_windowsoptionalfeature[:dsc_customproperties] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_customproperties' do - expect{dsc_windowsoptionalfeature[:dsc_customproperties] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_customproperties' do - expect{dsc_windowsoptionalfeature[:dsc_customproperties] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_description' do - expect{dsc_windowsoptionalfeature[:dsc_description] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_description' do - expect{dsc_windowsoptionalfeature[:dsc_description] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_description' do - expect{dsc_windowsoptionalfeature[:dsc_description] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_description' do - expect{dsc_windowsoptionalfeature[:dsc_description] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_displayname' do - expect{dsc_windowsoptionalfeature[:dsc_displayname] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_displayname' do - expect{dsc_windowsoptionalfeature[:dsc_displayname] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_displayname' do - expect{dsc_windowsoptionalfeature[:dsc_displayname] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_displayname' do - expect{dsc_windowsoptionalfeature[:dsc_displayname] = 16}.to raise_error(Puppet::ResourceError) - end - - # Configuration PROVIDER TESTS - - describe "powershell provider tests" do - - it "should successfully instanciate the provider" do - described_class.provider(:powershell).new(dsc_windowsoptionalfeature) - end - - before(:each) do - @provider = described_class.provider(:powershell).new(dsc_windowsoptionalfeature) - end - - describe "when dscmeta_module_name existing/is defined " do - - it "should compute powershell dsc test script with Invoke-DscResource" do - expect(@provider.ps_script_content('test')).to match(/Invoke-DscResource/) - end - - it "should compute powershell dsc test script with method Test" do - expect(@provider.ps_script_content('test')).to match(/Method\s+=\s*'test'/) - end - - it "should compute powershell dsc set script with Invoke-DscResource" do - expect(@provider.ps_script_content('set')).to match(/Invoke-DscResource/) - end - - it "should compute powershell dsc test script with method Set" do - expect(@provider.ps_script_content('set')).to match(/Method\s+=\s*'set'/) - end - - end - - describe "when dsc_ensure is 'enable'" do - - before(:each) do - dsc_windowsoptionalfeature.original_parameters[:dsc_ensure] = 'enable' - dsc_windowsoptionalfeature[:dsc_ensure] = 'enable' - @provider = described_class.provider(:powershell).new(dsc_windowsoptionalfeature) - end - - it "should update :ensure to :enable" do - expect(dsc_windowsoptionalfeature[:ensure]).to eq(:enable) - end - - it "should compute powershell dsc test script in which ensure value is 'enable'" do - expect(@provider.ps_script_content('test')).to match(/ensure = 'enable'/) - end - - it "should compute powershell dsc set script in which ensure value is 'enable'" do - expect(@provider.ps_script_content('set')).to match(/ensure = 'enable'/) - end - - end - - describe "when dsc_ensure is 'disable'" do - - before(:each) do - dsc_windowsoptionalfeature.original_parameters[:dsc_ensure] = 'disable' - dsc_windowsoptionalfeature[:dsc_ensure] = 'disable' - @provider = described_class.provider(:powershell).new(dsc_windowsoptionalfeature) - end - - it "should update :ensure to :disable" do - expect(dsc_windowsoptionalfeature[:ensure]).to eq(:disable) - end - - it "should compute powershell dsc test script in which ensure value is 'enable'" do - expect(@provider.ps_script_content('test')).to match(/ensure = 'enable'/) - end - - it "should compute powershell dsc set script in which ensure value is 'disable'" do - expect(@provider.ps_script_content('set')).to match(/ensure = 'disable'/) - end - - end - - end -end diff --git a/spec/unit/puppet/type/dsc_windowsprocess_spec.rb b/spec/unit/puppet/type/dsc_windowsprocess_spec.rb deleted file mode 100644 index e72c9962..00000000 --- a/spec/unit/puppet/type/dsc_windowsprocess_spec.rb +++ /dev/null @@ -1,479 +0,0 @@ -#!/usr/bin/env ruby -require 'spec_helper' - -describe Puppet::Type.type(:dsc_windowsprocess) do - - let :dsc_windowsprocess do - Puppet::Type.type(:dsc_windowsprocess).new( - :name => 'foo', - :dsc_path => 'foo', - :dsc_arguments => 'foo', - ) - end - - it 'should allow all properties to be specified' do - expect { Puppet::Type.type(:dsc_windowsprocess).new( - :name => 'foo', - :dsc_path => 'foo', - :dsc_arguments => 'foo', - :dsc_credential => {"user"=>"user", "password"=>"password"}, - :dsc_ensure => 'Present', - :dsc_standardoutputpath => 'foo', - :dsc_standarderrorpath => 'foo', - :dsc_standardinputpath => 'foo', - :dsc_workingdirectory => 'foo', - :dsc_pagedmemorysize => 64, - :dsc_nonpagedmemorysize => 64, - :dsc_virtualmemorysize => 64, - :dsc_handlecount => -32, - :dsc_processid => -32, - )}.to_not raise_error - end - - it "should stringify normally" do - expect(dsc_windowsprocess.to_s).to eq("Dsc_windowsprocess[foo]") - end - - it 'should default to ensure => present' do - expect(dsc_windowsprocess[:ensure]).to eq :present - end - - it 'should require that dsc_path is specified' do - #dsc_windowsprocess[:dsc_path] - expect { Puppet::Type.type(:dsc_windowsprocess).new( - :name => 'foo', - :dsc_arguments => 'foo', - )}.to raise_error(Puppet::Error, /dsc_path is a required attribute/) - end - - it 'should not accept array for dsc_path' do - expect{dsc_windowsprocess[:dsc_path] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_path' do - expect{dsc_windowsprocess[:dsc_path] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_path' do - expect{dsc_windowsprocess[:dsc_path] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_path' do - expect{dsc_windowsprocess[:dsc_path] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should require that dsc_arguments is specified' do - #dsc_windowsprocess[:dsc_arguments] - expect { Puppet::Type.type(:dsc_windowsprocess).new( - :name => 'foo', - :dsc_path => 'foo', - )}.to raise_error(Puppet::Error, /dsc_arguments is a required attribute/) - end - - it 'should not accept array for dsc_arguments' do - expect{dsc_windowsprocess[:dsc_arguments] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_arguments' do - expect{dsc_windowsprocess[:dsc_arguments] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_arguments' do - expect{dsc_windowsprocess[:dsc_arguments] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_arguments' do - expect{dsc_windowsprocess[:dsc_arguments] = 16}.to raise_error(Puppet::ResourceError) - end - - it "should not accept empty password for dsc_credential" do - expect{dsc_windowsprocess[:dsc_credential] = {"user"=>"user", "password"=>""}}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_credential' do - expect{dsc_windowsprocess[:dsc_credential] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_credential' do - expect{dsc_windowsprocess[:dsc_credential] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_credential' do - expect{dsc_windowsprocess[:dsc_credential] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_credential' do - expect{dsc_windowsprocess[:dsc_credential] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should accept dsc_ensure predefined value Present' do - dsc_windowsprocess[:dsc_ensure] = 'Present' - expect(dsc_windowsprocess[:dsc_ensure]).to eq('Present') - end - - it 'should accept dsc_ensure predefined value present' do - dsc_windowsprocess[:dsc_ensure] = 'present' - expect(dsc_windowsprocess[:dsc_ensure]).to eq('present') - end - - it 'should accept dsc_ensure predefined value present and update ensure with this value (ensure end value should be a symbol)' do - dsc_windowsprocess[:dsc_ensure] = 'present' - expect(dsc_windowsprocess[:ensure]).to eq(dsc_windowsprocess[:dsc_ensure].downcase.to_sym) - end - - it 'should accept dsc_ensure predefined value Absent' do - dsc_windowsprocess[:dsc_ensure] = 'Absent' - expect(dsc_windowsprocess[:dsc_ensure]).to eq('Absent') - end - - it 'should accept dsc_ensure predefined value absent' do - dsc_windowsprocess[:dsc_ensure] = 'absent' - expect(dsc_windowsprocess[:dsc_ensure]).to eq('absent') - end - - it 'should accept dsc_ensure predefined value absent and update ensure with this value (ensure end value should be a symbol)' do - dsc_windowsprocess[:dsc_ensure] = 'absent' - expect(dsc_windowsprocess[:ensure]).to eq(dsc_windowsprocess[:dsc_ensure].downcase.to_sym) - end - - it 'should not accept values not equal to predefined values' do - expect{dsc_windowsprocess[:dsc_ensure] = 'invalid value'}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_ensure' do - expect{dsc_windowsprocess[:dsc_ensure] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_ensure' do - expect{dsc_windowsprocess[:dsc_ensure] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_ensure' do - expect{dsc_windowsprocess[:dsc_ensure] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_ensure' do - expect{dsc_windowsprocess[:dsc_ensure] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_standardoutputpath' do - expect{dsc_windowsprocess[:dsc_standardoutputpath] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_standardoutputpath' do - expect{dsc_windowsprocess[:dsc_standardoutputpath] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_standardoutputpath' do - expect{dsc_windowsprocess[:dsc_standardoutputpath] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_standardoutputpath' do - expect{dsc_windowsprocess[:dsc_standardoutputpath] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_standarderrorpath' do - expect{dsc_windowsprocess[:dsc_standarderrorpath] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_standarderrorpath' do - expect{dsc_windowsprocess[:dsc_standarderrorpath] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_standarderrorpath' do - expect{dsc_windowsprocess[:dsc_standarderrorpath] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_standarderrorpath' do - expect{dsc_windowsprocess[:dsc_standarderrorpath] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_standardinputpath' do - expect{dsc_windowsprocess[:dsc_standardinputpath] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_standardinputpath' do - expect{dsc_windowsprocess[:dsc_standardinputpath] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_standardinputpath' do - expect{dsc_windowsprocess[:dsc_standardinputpath] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_standardinputpath' do - expect{dsc_windowsprocess[:dsc_standardinputpath] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_workingdirectory' do - expect{dsc_windowsprocess[:dsc_workingdirectory] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_workingdirectory' do - expect{dsc_windowsprocess[:dsc_workingdirectory] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept int for dsc_workingdirectory' do - expect{dsc_windowsprocess[:dsc_workingdirectory] = -16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept uint for dsc_workingdirectory' do - expect{dsc_windowsprocess[:dsc_workingdirectory] = 16}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept array for dsc_pagedmemorysize' do - expect{dsc_windowsprocess[:dsc_pagedmemorysize] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_pagedmemorysize' do - expect{dsc_windowsprocess[:dsc_pagedmemorysize] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should accept uint for dsc_pagedmemorysize' do - dsc_windowsprocess[:dsc_pagedmemorysize] = 64 - expect(dsc_windowsprocess[:dsc_pagedmemorysize]).to eq(64) - end - - it 'should not accept signed (negative) value for dsc_pagedmemorysize' do - value = -64 - expect(value).to be < 0 - expect{dsc_windowsprocess[:dsc_pagedmemorysize] = value}.to raise_error(Puppet::ResourceError) - end - - it 'should accept string-like uint for dsc_pagedmemorysize' do - dsc_windowsprocess[:dsc_pagedmemorysize] = '16' - expect(dsc_windowsprocess[:dsc_pagedmemorysize]).to eq(16) - end - - it 'should accept string-like uint for dsc_pagedmemorysize' do - dsc_windowsprocess[:dsc_pagedmemorysize] = '32' - expect(dsc_windowsprocess[:dsc_pagedmemorysize]).to eq(32) - end - - it 'should accept string-like uint for dsc_pagedmemorysize' do - dsc_windowsprocess[:dsc_pagedmemorysize] = '64' - expect(dsc_windowsprocess[:dsc_pagedmemorysize]).to eq(64) - end - - it 'should not accept array for dsc_nonpagedmemorysize' do - expect{dsc_windowsprocess[:dsc_nonpagedmemorysize] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_nonpagedmemorysize' do - expect{dsc_windowsprocess[:dsc_nonpagedmemorysize] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should accept uint for dsc_nonpagedmemorysize' do - dsc_windowsprocess[:dsc_nonpagedmemorysize] = 64 - expect(dsc_windowsprocess[:dsc_nonpagedmemorysize]).to eq(64) - end - - it 'should not accept signed (negative) value for dsc_nonpagedmemorysize' do - value = -64 - expect(value).to be < 0 - expect{dsc_windowsprocess[:dsc_nonpagedmemorysize] = value}.to raise_error(Puppet::ResourceError) - end - - it 'should accept string-like uint for dsc_nonpagedmemorysize' do - dsc_windowsprocess[:dsc_nonpagedmemorysize] = '16' - expect(dsc_windowsprocess[:dsc_nonpagedmemorysize]).to eq(16) - end - - it 'should accept string-like uint for dsc_nonpagedmemorysize' do - dsc_windowsprocess[:dsc_nonpagedmemorysize] = '32' - expect(dsc_windowsprocess[:dsc_nonpagedmemorysize]).to eq(32) - end - - it 'should accept string-like uint for dsc_nonpagedmemorysize' do - dsc_windowsprocess[:dsc_nonpagedmemorysize] = '64' - expect(dsc_windowsprocess[:dsc_nonpagedmemorysize]).to eq(64) - end - - it 'should not accept array for dsc_virtualmemorysize' do - expect{dsc_windowsprocess[:dsc_virtualmemorysize] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_virtualmemorysize' do - expect{dsc_windowsprocess[:dsc_virtualmemorysize] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should accept uint for dsc_virtualmemorysize' do - dsc_windowsprocess[:dsc_virtualmemorysize] = 64 - expect(dsc_windowsprocess[:dsc_virtualmemorysize]).to eq(64) - end - - it 'should not accept signed (negative) value for dsc_virtualmemorysize' do - value = -64 - expect(value).to be < 0 - expect{dsc_windowsprocess[:dsc_virtualmemorysize] = value}.to raise_error(Puppet::ResourceError) - end - - it 'should accept string-like uint for dsc_virtualmemorysize' do - dsc_windowsprocess[:dsc_virtualmemorysize] = '16' - expect(dsc_windowsprocess[:dsc_virtualmemorysize]).to eq(16) - end - - it 'should accept string-like uint for dsc_virtualmemorysize' do - dsc_windowsprocess[:dsc_virtualmemorysize] = '32' - expect(dsc_windowsprocess[:dsc_virtualmemorysize]).to eq(32) - end - - it 'should accept string-like uint for dsc_virtualmemorysize' do - dsc_windowsprocess[:dsc_virtualmemorysize] = '64' - expect(dsc_windowsprocess[:dsc_virtualmemorysize]).to eq(64) - end - - it 'should not accept array for dsc_handlecount' do - expect{dsc_windowsprocess[:dsc_handlecount] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_handlecount' do - expect{dsc_windowsprocess[:dsc_handlecount] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should accept int for dsc_handlecount' do - dsc_windowsprocess[:dsc_handlecount] = -32 - expect(dsc_windowsprocess[:dsc_handlecount]).to eq(-32) - end - - it 'should accept string-like int for dsc_handlecount' do - dsc_windowsprocess[:dsc_handlecount] = '16' - expect(dsc_windowsprocess[:dsc_handlecount]).to eq(16) - end - - it 'should accept string-like int for dsc_handlecount' do - dsc_windowsprocess[:dsc_handlecount] = '-16' - expect(dsc_windowsprocess[:dsc_handlecount]).to eq(-16) - end - - it 'should accept string-like int for dsc_handlecount' do - dsc_windowsprocess[:dsc_handlecount] = '32' - expect(dsc_windowsprocess[:dsc_handlecount]).to eq(32) - end - - it 'should accept string-like int for dsc_handlecount' do - dsc_windowsprocess[:dsc_handlecount] = '-32' - expect(dsc_windowsprocess[:dsc_handlecount]).to eq(-32) - end - - - it 'should not accept array for dsc_processid' do - expect{dsc_windowsprocess[:dsc_processid] = ["foo", "bar", "spec"]}.to raise_error(Puppet::ResourceError) - end - - it 'should not accept boolean for dsc_processid' do - expect{dsc_windowsprocess[:dsc_processid] = true}.to raise_error(Puppet::ResourceError) - end - - it 'should accept int for dsc_processid' do - dsc_windowsprocess[:dsc_processid] = -32 - expect(dsc_windowsprocess[:dsc_processid]).to eq(-32) - end - - it 'should accept string-like int for dsc_processid' do - dsc_windowsprocess[:dsc_processid] = '16' - expect(dsc_windowsprocess[:dsc_processid]).to eq(16) - end - - it 'should accept string-like int for dsc_processid' do - dsc_windowsprocess[:dsc_processid] = '-16' - expect(dsc_windowsprocess[:dsc_processid]).to eq(-16) - end - - it 'should accept string-like int for dsc_processid' do - dsc_windowsprocess[:dsc_processid] = '32' - expect(dsc_windowsprocess[:dsc_processid]).to eq(32) - end - - it 'should accept string-like int for dsc_processid' do - dsc_windowsprocess[:dsc_processid] = '-32' - expect(dsc_windowsprocess[:dsc_processid]).to eq(-32) - end - - - # Configuration PROVIDER TESTS - - describe "powershell provider tests" do - - it "should successfully instanciate the provider" do - described_class.provider(:powershell).new(dsc_windowsprocess) - end - - before(:each) do - @provider = described_class.provider(:powershell).new(dsc_windowsprocess) - end - - describe "when dscmeta_module_name existing/is defined " do - - it "should compute powershell dsc test script with Invoke-DscResource" do - expect(@provider.ps_script_content('test')).to match(/Invoke-DscResource/) - end - - it "should compute powershell dsc test script with method Test" do - expect(@provider.ps_script_content('test')).to match(/Method\s+=\s*'test'/) - end - - it "should compute powershell dsc set script with Invoke-DscResource" do - expect(@provider.ps_script_content('set')).to match(/Invoke-DscResource/) - end - - it "should compute powershell dsc test script with method Set" do - expect(@provider.ps_script_content('set')).to match(/Method\s+=\s*'set'/) - end - - end - - describe "when dsc_ensure is 'present'" do - - before(:each) do - dsc_windowsprocess.original_parameters[:dsc_ensure] = 'present' - dsc_windowsprocess[:dsc_ensure] = 'present' - @provider = described_class.provider(:powershell).new(dsc_windowsprocess) - end - - it "should update :ensure to :present" do - expect(dsc_windowsprocess[:ensure]).to eq(:present) - end - - it "should compute powershell dsc test script in which ensure value is 'present'" do - expect(@provider.ps_script_content('test')).to match(/ensure = 'present'/) - end - - it "should compute powershell dsc set script in which ensure value is 'present'" do - expect(@provider.ps_script_content('set')).to match(/ensure = 'present'/) - end - - end - - describe "when dsc_ensure is 'absent'" do - - before(:each) do - dsc_windowsprocess.original_parameters[:dsc_ensure] = 'absent' - dsc_windowsprocess[:dsc_ensure] = 'absent' - @provider = described_class.provider(:powershell).new(dsc_windowsprocess) - end - - it "should update :ensure to :absent" do - expect(dsc_windowsprocess[:ensure]).to eq(:absent) - end - - it "should compute powershell dsc test script in which ensure value is 'present'" do - expect(@provider.ps_script_content('test')).to match(/ensure = 'present'/) - end - - it "should compute powershell dsc set script in which ensure value is 'absent'" do - expect(@provider.ps_script_content('set')).to match(/ensure = 'absent'/) - end - - end - - describe "when dsc_resource has credentials" do - - it "should convert credential hash to a pscredential object" do - expect(@provider.ps_script_content('test')).to match(/| new-pscredential'/) - end - - end - - - end -end diff --git a/tests/acceptance/tests/basic_dsc_resources/environment/env_delete_var.rb b/tests/acceptance/tests/basic_dsc_resources/environment/env_delete_var.rb deleted file mode 100755 index faa1cab3..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/environment/env_delete_var.rb +++ /dev/null @@ -1,46 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2501 - C68554 - Apply DSC Environment Resource that Deletes Environment Vairable' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'environment' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_name => 'delete', - :dsc_value => 'Should not exist!', -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Tests -agents.each do |agent| - step 'Apply Manifest to Create Environment Variable' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - # New manifest to delete value. - dsc_props[:dsc_ensure] = 'Absent' - dsc_delete_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - - step 'Apply Manifest to Delete Environment Variable' - on(agent, puppet('apply'), :stdin => dsc_delete_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - assert_dsc_resource( - agent, - dsc_type, - dsc_module, - :Ensure => dsc_props[:dsc_ensure], - :Name => dsc_props[:dsc_name] - ) -end diff --git a/tests/acceptance/tests/basic_dsc_resources/environment/env_new_var.rb b/tests/acceptance/tests/basic_dsc_resources/environment/env_new_var.rb deleted file mode 100755 index cdf3e163..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/environment/env_new_var.rb +++ /dev/null @@ -1,50 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2501 - C68547 - Apply DSC Environment Resource for Non-existent Environment Variable' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'environment' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_name => 'kitties', - :dsc_value => 'Buckets of cute kittens!', -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -teardown do - step 'Remove Test Artifacts' - set_dsc_resource( - agents, - dsc_type, - dsc_module, - :Ensure => 'Absent', - :Name => dsc_props[:dsc_name] - ) -end - -# Tests -agents.each do |agent| - step 'Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - assert_dsc_resource( - agent, - dsc_type, - dsc_module, - :Ensure => dsc_props[:dsc_ensure], - :Name => dsc_props[:dsc_name], - :Value => dsc_props[:dsc_value], - ) -end diff --git a/tests/acceptance/tests/basic_dsc_resources/environment/env_no_value.rb b/tests/acceptance/tests/basic_dsc_resources/environment/env_no_value.rb deleted file mode 100755 index 0762f942..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/environment/env_no_value.rb +++ /dev/null @@ -1,48 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2501 - C68551 - Apply DSC Environment Resource with No "Value" Specified' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'environment' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_name => 'sandwich' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -teardown do - step 'Remove Test Artifacts' - set_dsc_resource( - agents, - dsc_type, - dsc_module, - :Ensure => 'Absent', - :Name => dsc_props[:dsc_name] - ) -end - -# Tests -agents.each do |agent| - step 'Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - assert_dsc_resource( - agent, - dsc_type, - dsc_module, - :Ensure => dsc_props[:dsc_ensure], - :Name => dsc_props[:dsc_name] - ) -end diff --git a/tests/acceptance/tests/basic_dsc_resources/environment/env_update_path_var.rb b/tests/acceptance/tests/basic_dsc_resources/environment/env_update_path_var.rb deleted file mode 100755 index eb9b06c7..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/environment/env_update_path_var.rb +++ /dev/null @@ -1,54 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2501 - C68552 - Apply DSC Environment Resource that Updates the "PATH" Environment Variable' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'environment' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_name => 'PATH', - :dsc_value => 'C:\kittens', - :dsc_path => true -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -teardown do - step 'Remove Test Artifacts' - set_dsc_resource( - agents, - dsc_type, - dsc_module, - :Ensure => 'Absent', - :Name => dsc_props[:dsc_name], - :Value => dsc_props[:dsc_value], - :Path => "$#{dsc_props[:dsc_path]}", - ) -end - -# Tests -agents.each do |agent| - step 'Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - assert_dsc_resource( - agent, - dsc_type, - dsc_module, - :Ensure => dsc_props[:dsc_ensure], - :Name => dsc_props[:dsc_name], - :Value => dsc_props[:dsc_value], - :Path => "$#{dsc_props[:dsc_path]}", - ) -end diff --git a/tests/acceptance/tests/basic_dsc_resources/environment/env_update_var.rb b/tests/acceptance/tests/basic_dsc_resources/environment/env_update_var.rb deleted file mode 100755 index 84ced1bc..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/environment/env_update_var.rb +++ /dev/null @@ -1,59 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2501 - C68549 - Apply DSC Environment Resource for Existing Environment Variable' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'environment' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_name => 'puppies', - :dsc_value => 'Buckets of cute puppies!', -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -teardown do - step 'Remove Test Artifacts' - set_dsc_resource( - agents, - dsc_type, - dsc_module, - :Ensure => 'Absent', - :Name => dsc_props[:dsc_name] - ) -end - -# Tests -agents.each do |agent| - step 'Apply Manifest to Create Environment Variable' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - # New manifest to update value. - dsc_props[:dsc_value] = 'Everyone wants puppies now!' - dsc_update_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - - step 'Apply Manifest to Update Environment Variable' - on(agent, puppet('apply'), :stdin => dsc_update_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - assert_dsc_resource( - agent, - dsc_type, - dsc_module, - :Ensure => dsc_props[:dsc_ensure], - :Name => dsc_props[:dsc_name], - :Value => dsc_props[:dsc_value], - ) -end diff --git a/tests/acceptance/tests/basic_dsc_resources/file/dir_recurse.rb b/tests/acceptance/tests/basic_dsc_resources/file/dir_recurse.rb deleted file mode 100755 index fcb7468a..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/file/dir_recurse.rb +++ /dev/null @@ -1,83 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2286 - C68566 - Apply DSC File (Directory) Resource with "Recurse" Enabled' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' -sub_dir_name = "sub_dir_test_" - -# ERB Manifest -dsc_type = 'file' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_type => 'Directory', - :dsc_destinationpath => 'C:\test_dir', - :dsc_sourcepath => 'C:\source_dir', - :dsc_recurse => 'true' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -teardown do - step 'Remove Test Artifacts' - set_dsc_resource( - agents, - dsc_type, - dsc_module, - :Ensure => 'Absent', - :Type => dsc_props[:dsc_type], - :DestinationPath => dsc_props[:dsc_destinationpath], - :Force => '$true', - :Recurse => '$true' - ) - set_dsc_resource( - agents, - dsc_type, - dsc_module, - :Ensure => 'Absent', - :Type => dsc_props[:dsc_type], - :DestinationPath => dsc_props[:dsc_sourcepath], - :Force => '$true', - :Recurse => '$true' - ) -end - -# Setup -step 'Create Source Directory Hierarchy' -agents.each do |agent| - 3.times do |n| - set_dsc_resource( - agent, - dsc_type, - dsc_module, - :Ensure => 'Present', - :Type => dsc_props[:dsc_type], - :DestinationPath => "#{dsc_props[:dsc_sourcepath]}\\#{sub_dir_name}#{n}" - ) - end -end - -# Tests -agents.each do |agent| - step 'Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - 3.times do |n| - assert_dsc_resource( - agent, - dsc_type, - dsc_module, - :Ensure => dsc_props[:dsc_ensure], - :Type => dsc_props[:dsc_type], - :DestinationPath => "#{dsc_props[:dsc_destinationpath]}\\#{sub_dir_name}#{n}" - ) - end -end diff --git a/tests/acceptance/tests/basic_dsc_resources/file/dir_remove_dir.rb b/tests/acceptance/tests/basic_dsc_resources/file/dir_remove_dir.rb deleted file mode 100755 index 409c4406..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/file/dir_remove_dir.rb +++ /dev/null @@ -1,47 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2286 - C68568 - Apply DSC File Resource that Removes a Directory' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'file' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_type => 'Directory', - :dsc_destinationpath => 'C:\test_remove_dir', -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Tests -agents.each do |agent| - step 'Apply Manifest to Create Directory' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - # New manifest to remove value. - dsc_props[:dsc_ensure] = 'Absent' - dsc_remove_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - - step 'Apply Manifest to Remove Directory' - on(agent, puppet('apply'), :stdin => dsc_remove_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - assert_dsc_resource( - agent, - dsc_type, - dsc_module, - :Ensure => dsc_props[:dsc_ensure], - :Type => dsc_props[:dsc_type], - :DestinationPath => dsc_props[:dsc_destinationpath], - ) -end diff --git a/tests/acceptance/tests/basic_dsc_resources/file/dir_valid_path.rb b/tests/acceptance/tests/basic_dsc_resources/file/dir_valid_path.rb deleted file mode 100755 index d579183c..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/file/dir_valid_path.rb +++ /dev/null @@ -1,52 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2286 - C68564 - Apply DSC File (Directory) Resource with Valid "DestinationPath" Specified' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'file' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_type => 'Directory', - :dsc_destinationpath => 'C:\test_dir', -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -teardown do - step 'Remove Test Artifacts' - set_dsc_resource( - agents, - dsc_type, - dsc_module, - :Ensure => 'Absent', - :Type => dsc_props[:dsc_type], - :DestinationPath => dsc_props[:dsc_destinationpath], - :Force => '$true' - ) -end - -# Tests -agents.each do |agent| - step 'Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - assert_dsc_resource( - agent, - dsc_type, - dsc_module, - :Ensure => dsc_props[:dsc_ensure], - :Type => dsc_props[:dsc_type], - :DestinationPath => dsc_props[:dsc_destinationpath], - ) -end diff --git a/tests/acceptance/tests/basic_dsc_resources/file/dir_valid_unicode_path.rb b/tests/acceptance/tests/basic_dsc_resources/file/dir_valid_unicode_path.rb deleted file mode 100755 index 3f1327d8..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/file/dir_valid_unicode_path.rb +++ /dev/null @@ -1,44 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2286 - C68565 - Apply DSC File (Directory) Resource with Valid Unicode "DestinationPath" Specified' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' -test_manifest_name = 'test_manifest.pp' -test_dir_name = "\u1134\u1169\u1185\u1173\u112D\u1117\u1114\u1135\u114E" - -# ERB Manifest -dsc_type = 'file' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_type => 'Directory', - :dsc_destinationpath => "C:\\#{test_dir_name}" -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -teardown do - step 'Remove Test Artifacts' - on(agents, "rm -rf /cygdrive/c/#{test_dir_name}") - on(agents, "rm -rf /cygdrive/c/#{test_manifest_name}") -end - -# Setup -create_remote_file(agents, "/cygdrive/c/#{test_manifest_name}", dsc_manifest) - -# Tests -agents.each do |agent| - step 'Apply Manifest' - on(agent, puppet("apply C:\\\\#{test_manifest_name}"), :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - # Expected to fail because of MODULES-2310 - step 'Verify Results' - on(agent, "test -d /cygdrive/c/#{test_dir_name}", :acceptable_exit_codes => 1) -end diff --git a/tests/acceptance/tests/basic_dsc_resources/file/file_remove_file.rb b/tests/acceptance/tests/basic_dsc_resources/file/file_remove_file.rb deleted file mode 100755 index cf7ec8b1..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/file/file_remove_file.rb +++ /dev/null @@ -1,47 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2286 - C68567 - Apply DSC File Resource that Removes a File' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'file' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_destinationpath => 'C:\test_remove.file', - :dsc_contents => 'The Microsoft documentation is a lie!' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Tests -agents.each do |agent| - step 'Apply Manifest to Create File' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - # New manifest to remove value. - dsc_props[:dsc_ensure] = 'Absent' - dsc_remove_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - - step 'Apply Manifest to Remove File' - on(agent, puppet('apply'), :stdin => dsc_remove_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - assert_dsc_resource( - agent, - dsc_type, - dsc_module, - :Ensure => dsc_props[:dsc_ensure], - :DestinationPath => dsc_props[:dsc_destinationpath], - :Contents => dsc_props[:dsc_contents] - ) -end diff --git a/tests/acceptance/tests/basic_dsc_resources/file/file_valid_path_contents.rb b/tests/acceptance/tests/basic_dsc_resources/file/file_valid_path_contents.rb deleted file mode 100755 index 9af296a7..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/file/file_valid_path_contents.rb +++ /dev/null @@ -1,50 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2286 - C68557 - Apply DSC File Resource with Valid "DestinationPath" and "Contents" Specified' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'file' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_destinationpath => 'C:\test.file', - :dsc_contents => 'Cats go meow!', -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -teardown do - step 'Remove Test Artifacts' - set_dsc_resource( - agents, - dsc_type, - dsc_module, - :Ensure => 'Absent', - :DestinationPath => dsc_props[:dsc_destinationpath] - ) -end - -# Tests -agents.each do |agent| - step 'Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - assert_dsc_resource( - agent, - dsc_type, - dsc_module, - :Ensure => dsc_props[:dsc_ensure], - :DestinationPath => dsc_props[:dsc_destinationpath], - :Contents => dsc_props[:dsc_contents], - ) -end diff --git a/tests/acceptance/tests/basic_dsc_resources/file/file_valid_path_source.rb b/tests/acceptance/tests/basic_dsc_resources/file/file_valid_path_source.rb deleted file mode 100755 index 6caa87a5..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/file/file_valid_path_source.rb +++ /dev/null @@ -1,71 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2286 - C68558 - Apply DSC File Resource with Valid "DestinationPath" and "SourcePath" Specified' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'file' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_destinationpath => 'C:\test.file', - :dsc_sourcepath => 'C:\source.file', -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Verify -source_file_contents = 'Dogs go bark!' - -# Teardown -teardown do - step 'Remove Test Artifacts' - set_dsc_resource( - agents, - dsc_type, - dsc_module, - :Ensure => 'Absent', - :DestinationPath => dsc_props[:dsc_destinationpath] - ) - - set_dsc_resource( - agents, - dsc_type, - dsc_module, - :Ensure => 'Absent', - :DestinationPath => dsc_props[:dsc_sourcepath] - ) -end - -# Setup -set_dsc_resource( - agents, - dsc_type, - dsc_module, - :Ensure => 'Present', - :DestinationPath => dsc_props[:dsc_sourcepath], - :Contents => source_file_contents -) - -# Tests -agents.each do |agent| - step 'Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - assert_dsc_resource( - agent, - dsc_type, - dsc_module, - :Ensure => dsc_props[:dsc_ensure], - :DestinationPath => dsc_props[:dsc_destinationpath], - :Contents => source_file_contents, - ) -end diff --git a/tests/acceptance/tests/basic_dsc_resources/file/file_valid_unicode_contents.rb b/tests/acceptance/tests/basic_dsc_resources/file/file_valid_unicode_contents.rb deleted file mode 100755 index 101765fa..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/file/file_valid_unicode_contents.rb +++ /dev/null @@ -1,52 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2286 - C68560 - Apply DSC File Resource with Valid Unicode "Contents" Specified' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' -test_manifest_name = 'test_manifest.pp' -test_file_name = 'test.file' -test_file_contents = "\u3172\u3142\u3144\u3149\u3151\u3167\u3169\u3159\u3158\u3140\u3145\u3176\u3145" - -# ERB Manifest -dsc_type = 'file' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_destinationpath => "C:\\#{test_file_name}" -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Verify -test_file_md5_sum_regex = /6ba9d431f246339d2e659e71c6d1eb6a \/cygdrive\/c\/#{test_file_name}/ - -# Teardown -teardown do - step 'Remove Test Artifacts' - on(agents, "rm -rf /cygdrive/c/#{test_file_name}") - on(agents, "rm -rf /cygdrive/c/#{test_manifest_name}") -end - -# Setup -create_remote_file(agents, "/cygdrive/c/#{test_manifest_name}", dsc_manifest) - -# Tests -agents.each do |agent| - step 'Apply Manifest' - on(agent, puppet("apply C:\\\\#{test_manifest_name}"), :acceptable_exit_codes => [0,2]) do |result| - expect_failure('Expected to fail because of MODULES-2310') do - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - end - - step 'Verify Results' - on(agent, "md5sum /cygdrive/c/#{test_file_name}", :acceptable_exit_codes => 1) do |result| - expect_failure('Expected to fail because of MODULES-2310') do - assert_match(test_file_md5_sum_regex, result.stdout, 'Expected file content is invalid!') - end - end -end diff --git a/tests/acceptance/tests/basic_dsc_resources/file/file_valid_unicode_path.rb b/tests/acceptance/tests/basic_dsc_resources/file/file_valid_unicode_path.rb deleted file mode 100755 index 3a31f5d3..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/file/file_valid_unicode_path.rb +++ /dev/null @@ -1,44 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2286 - C68559 - Apply DSC File Resource with Valid Unicode "DestinationPath" Specified' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' -test_manifest_name = 'test_manifest.pp' -test_file_name = "\u3172\u3142\u3144\u3149\u3151\u3167\u3169\u3159\u3158\u3140\u3145\u3176\u3145" - -# ERB Manifest -dsc_type = 'file' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_destinationpath => "C:\\#{test_file_name}" -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -teardown do - step 'Remove Test Artifacts' - on(agents, "rm -rf /cygdrive/c/#{test_file_name}") - on(agents, "rm -rf /cygdrive/c/#{test_manifest_name}") -end - -# Setup -create_remote_file(agents, "/cygdrive/c/#{test_manifest_name}", dsc_manifest) - -# Tests -agents.each do |agent| - step 'Apply Manifest' - on(agent, puppet("apply C:\\\\#{test_manifest_name}"), :acceptable_exit_codes => [0,2]) do |result| - expect_failure('Expected to fail because of MODULES-2310') do - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - end - - step 'Verify Results' - on(agent, "test -f /cygdrive/c/#{test_file_name}", :acceptable_exit_codes => 1) -end diff --git a/tests/acceptance/tests/basic_dsc_resources/file/file_valid_unicode_source.rb b/tests/acceptance/tests/basic_dsc_resources/file/file_valid_unicode_source.rb deleted file mode 100755 index a504910a..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/file/file_valid_unicode_source.rb +++ /dev/null @@ -1,55 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2286 - C68561 - Apply DSC File Resource with Valid Unicode "SourcePath" Specified' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' -test_manifest_name = 'test_manifest.pp' -test_file_name = 'test.file' -source_file_name = "\u3172\u3142\u3144\u3149\u3151\u3167\u3169\u3159\u3158\u3140\u3145\u3176\u3145" - -# ERB Manifest -dsc_type = 'file' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_destinationpath => "C:\\#{test_file_name}", - :dsc_sourcepath => "C:\\#{source_file_name}" -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -teardown do - step 'Remove Test Artifacts' - on(agents, "rm -rf /cygdrive/c/#{test_file_name}") - on(agents, "rm -rf /cygdrive/c/#{source_file_name}") - on(agents, "rm -rf /cygdrive/c/#{test_manifest_name}") -end - -# Verify -source_file_contents = 'Valid data!' - -# Setup -create_remote_file(agents, "/cygdrive/c/#{test_manifest_name}", dsc_manifest) -create_remote_file(agents, "/cygdrive/c/#{source_file_name}", source_file_contents) - -# Tests -agents.each do |agent| - step 'Apply Manifest' - on(agent, puppet("apply C:\\\\#{test_manifest_name}"), :acceptable_exit_codes => [0,2]) do |result| - expect_failure('Expected to fail because of MODULES-2310') do - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - end - - step 'Verify Results' - on(agent, "cat /cygdrive/c/#{test_file_name}", :acceptable_exit_codes => 1) do |result| - expect_failure('Expected to fail because of MODULES-2310') do - assert_match(/\A#{source_file_contents}\z/, result.stdout, 'File content is invalid!') - end - end -end diff --git a/tests/acceptance/tests/basic_dsc_resources/file/negative/file_invalid_force.rb b/tests/acceptance/tests/basic_dsc_resources/file/negative/file_invalid_force.rb deleted file mode 100755 index 502bb1a1..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/file/negative/file_invalid_force.rb +++ /dev/null @@ -1,31 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2286 - C68788 - Attempt to Apply DSC File Resource with Invalid Data Type for "Force" Specified' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'file' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_destinationpath => 'C:\test.file', - :dsc_contents => 'You will never see this!', - :dsc_force => 'cows' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Verify -error_msg = /invalid value: cows/ - -# Tests -agents.each do |agent| - step 'Attempt to Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => 1) do |result| - assert_match(error_msg, result.stderr, 'Expected error was not detected!') - end -end diff --git a/tests/acceptance/tests/basic_dsc_resources/file/negative/file_invalid_path.rb b/tests/acceptance/tests/basic_dsc_resources/file/negative/file_invalid_path.rb deleted file mode 100755 index 84c6edc3..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/file/negative/file_invalid_path.rb +++ /dev/null @@ -1,30 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2286 - C68569 - Attempt to Apply DSC File Resource with Invalid "DestinationPath" Specified' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'file' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_destinationpath => 'K:\test.file', - :dsc_contents => 'You will never see this!', -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Verify -error_msg = /Error: No such file or directory/ - -# Tests -agents.each do |agent| - step 'Attempt to Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => 0) do |result| - assert_match(error_msg, result.stderr, 'Expected error was not detected!') - end -end diff --git a/tests/acceptance/tests/basic_dsc_resources/file/negative/file_invalid_sourcepath.rb b/tests/acceptance/tests/basic_dsc_resources/file/negative/file_invalid_sourcepath.rb deleted file mode 100755 index 4149ac23..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/file/negative/file_invalid_sourcepath.rb +++ /dev/null @@ -1,30 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2286 - C68571 - Attempt to Apply DSC File Resource with Invalid "SourcePath" Specified' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'file' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_destinationpath => 'C:\test.file', - :dsc_sourcepath => 'K:\source\does_not.exist', -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Verify -error_msg = /Error:.*SourcePath must be accessible for current configuration./ - -# Tests -agents.each do |agent| - step 'Attempt to Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => 0) do |result| - assert_match(error_msg, result.stderr, 'Expected error was not detected!') - end -end diff --git a/tests/acceptance/tests/basic_dsc_resources/group/group_remove.rb b/tests/acceptance/tests/basic_dsc_resources/group/group_remove.rb deleted file mode 100755 index 98dccc6e..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/group/group_remove.rb +++ /dev/null @@ -1,45 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2523 - C68580 - Apply DSC Group Resource that Removes a Group' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'group' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_groupname => 'RemoveGroup' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Tests -agents.each do |agent| - step 'Apply Manifest to Create Group' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - # New manifest to remove group. - dsc_props[:dsc_ensure] = 'Absent' - dsc_remove_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - - step 'Apply Manifest to Remove Group' - on(agent, puppet('apply'), :stdin => dsc_remove_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - assert_dsc_resource( - agent, - dsc_type, - dsc_module, - :Ensure => dsc_props[:dsc_ensure], - :GroupName => dsc_props[:dsc_groupname] - ) -end diff --git a/tests/acceptance/tests/basic_dsc_resources/group/group_unicode_groupname.rb b/tests/acceptance/tests/basic_dsc_resources/group/group_unicode_groupname.rb deleted file mode 100755 index ec9115b5..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/group/group_unicode_groupname.rb +++ /dev/null @@ -1,55 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2523 - C68585 - Apply DSC Group Resource with Valid Unicode "GroupName" Specified' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' -test_manifest_name = 'test_manifest.pp' - -# ERB Manifest -dsc_type = 'group' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_groupname => "\u1134\u1169\u1185\u1173\u112D\u1117\u1114\u1135\u114E" -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -teardown do - step 'Remove Test Artifacts' - set_dsc_resource( - agents, - dsc_type, - dsc_module, - :Ensure => 'Absent', - :GroupName => dsc_props[:dsc_groupname] - ) - on(agents, "rm -rf /cygdrive/c/#{test_manifest_name}") -end - -# Setup -create_remote_file(agents, "/cygdrive/c/#{test_manifest_name}", dsc_manifest) - -# Tests -agents.each do |agent| - step 'Apply Manifest' - on(agent, puppet("apply C:\\\\#{test_manifest_name}"), :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - expect_failure('Expected to fail because of MODULES-2593') do - assert_dsc_resource( - agent, - dsc_type, - dsc_module, - :Ensure => dsc_props[:dsc_ensure], - :GroupName => dsc_props[:dsc_groupname] - ) - end -end diff --git a/tests/acceptance/tests/basic_dsc_resources/group/group_valid_members.rb b/tests/acceptance/tests/basic_dsc_resources/group/group_valid_members.rb deleted file mode 100755 index 3d2b3ef8..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/group/group_valid_members.rb +++ /dev/null @@ -1,50 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2523 - C68578 - Apply DSC Group Resource with Valid "GroupName" and "Members" Specified' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'group' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_groupname => 'TestGroupMembers', - :dsc_members => '["Administrator","Guest"]' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -teardown do - step 'Remove Test Artifacts' - set_dsc_resource( - agents, - dsc_type, - dsc_module, - :Ensure => 'Absent', - :GroupName => dsc_props[:dsc_groupname] - ) -end - -# Tests -agents.each do |agent| - step 'Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - assert_dsc_resource( - agent, - dsc_type, - dsc_module, - :Ensure => dsc_props[:dsc_ensure], - :GroupName => dsc_props[:dsc_groupname], - :Members => '@("Administrator","Guest")' - ) -end diff --git a/tests/acceptance/tests/basic_dsc_resources/group/negative/group_add_non-existent_user.rb b/tests/acceptance/tests/basic_dsc_resources/group/negative/group_add_non-existent_user.rb deleted file mode 100755 index 2be472bf..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/group/negative/group_add_non-existent_user.rb +++ /dev/null @@ -1,31 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2523 - C68583 - Attempt to Apply DSC Group Resource with Non-existent Users Specified' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'group' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_groupname => 'crumbs', - :dsc_members => '["dogman","catperson"]' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Verify -error_msg = /Error:.*Could not find a principal with the provided name/m - -# Tests -agents.each do |agent| - step 'Attempt to Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => 0) do |result| - assert_match(error_msg, result.stderr, 'Expected error was not detected!') - end -end diff --git a/tests/acceptance/tests/basic_dsc_resources/group/negative/group_invalid_groupname.rb b/tests/acceptance/tests/basic_dsc_resources/group/negative/group_invalid_groupname.rb deleted file mode 100755 index 57eab9af..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/group/negative/group_invalid_groupname.rb +++ /dev/null @@ -1,30 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2523 - C68582 - Attempt to Apply DSC Group Resource with Invalid "GroupName" Specified' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'group' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_groupname => 'meow?' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Verify -error_msg = /Error:.*The name meow\? cannot be used/m - -# Tests -agents.each do |agent| - step 'Attempt to Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => 0) do |result| - assert_match(error_msg, result.stderr, 'Expected error was not detected!') - end -end diff --git a/tests/acceptance/tests/basic_dsc_resources/group/negative/group_member_conflict.rb b/tests/acceptance/tests/basic_dsc_resources/group/negative/group_member_conflict.rb deleted file mode 100755 index a3a9c584..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/group/negative/group_member_conflict.rb +++ /dev/null @@ -1,32 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2523 - C68584 - Attempt to Apply DSC Group Resource with User Collision Between "MembersToExclude" and "MembersToInclude"' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'group' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_groupname => 'Tension', - :dsc_memberstoinclude => '["Administrator","Guest"]', - :dsc_memberstoexclude => '["Administrator","Guest"]' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Verify -error_msg = /Error:.*The same principal must not be included in both MembersToInclude and MembersToExclude/m - -# Tests -agents.each do |agent| - step 'Attempt to Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => 0) do |result| - assert_match(error_msg, result.stderr, 'Expected error was not detected!') - end -end diff --git a/tests/acceptance/tests/basic_dsc_resources/package/negative/package_failed_install.rb b/tests/acceptance/tests/basic_dsc_resources/package/negative/package_failed_install.rb deleted file mode 100755 index 4cec517b..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/package/negative/package_failed_install.rb +++ /dev/null @@ -1,71 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2559 - C68690 - Attempt to Apply DSC Package Resource with Package that Fails to Install' - -confine(:to, :platform => 'windows') - -# Init -local_manifests_root_path = ENV['MANIFESTS'] || 'tests/manifests' -local_files_root_path = ENV['FILES'] || 'tests/files' - -local_installer_file_path = File.join(local_files_root_path, 'test_installer', 'test_program_installer.exe') -install_path = 'C:\test_program' -uninstall_reg_key_path = 'Software\Microsoft\Windows\CurrentVersion\Uninstall\TestProgram' -ps_uninstall_command = "Remove-Item -Recurse -Path HKLM:\\#{uninstall_reg_key_path}" - -# ERB Manifest -dsc_type = 'package' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_path => "C:\\test_program_installer.exe", - :dsc_name => 'Test Program', - :dsc_productid => '', - :dsc_arguments => "/S /D=#{install_path}" -} - -dsc_manifest_template_path = File.join(local_manifests_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -teardown do - step 'Remove Test Artifacts' - # This invocation will be deprecated by the changes in MODULES-2656 - # The method will be renamed and marked as public. - _exec_dsc_script(agents, "if ( #{ps_uninstall_command} ) { exit 0 } else { exit 1 }") - - set_dsc_resource( - agents, - 'file', - dsc_module, - :Ensure => 'Absent', - :Type => 'File', - :DestinationPath => dsc_props[:dsc_path] - ) - - set_dsc_resource( - agents, - 'file', - dsc_module, - :Ensure => 'Absent', - :Type => 'Directory', - :Force => '$true', - :Recurse => '$true', - :DestinationPath => install_path - ) -end - -# Verify -error_msg = /Error:.*The return code 4 was not expected/m - -# Setup -step 'Copy Installer to Agents' -scp_to(agents, local_installer_file_path, dsc_props[:dsc_path]) - -# Tests -agents.each do |agent| - step 'Attempt to Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => 0) do |result| - assert_match(error_msg, result.stderr, 'Expected error was not detected!') - end -end diff --git a/tests/acceptance/tests/basic_dsc_resources/package/negative/package_invalid_msi.rb b/tests/acceptance/tests/basic_dsc_resources/package/negative/package_invalid_msi.rb deleted file mode 100755 index 81b1abe9..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/package/negative/package_invalid_msi.rb +++ /dev/null @@ -1,57 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2559 - C68689 - Attempt to Apply DSC Package Resource with Invalid MSI Package Specified' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' -download_url = 'http://int-resources.ops.puppetlabs.net/QA_resources/7zip/7z920.exe' - -# ERB Manifest -dsc_type = 'package' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_path => "C:\\python.msi", - :dsc_name => 'Python 2.7.10', - :dsc_productid => 'B2E52010-307C-53EF-BF77-822E0B6707B1' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -teardown do - step 'Remove Test Artifacts' - set_dsc_resource( - agents, - 'file', - dsc_module, - :Ensure => 'Absent', - :Type => 'File', - :DestinationPath => dsc_props[:dsc_path] - ) -end - -# Verify -error_msg = /Error:.*The specified Name .* and IdentifyingNumber .* do not match Name .* and IdentifyingNumber/m - -# Setup -step 'Download Test Package' -set_dsc_resource( - agents, - 'script', - dsc_module, - :GetScript => 'return @{}', - :TestScript => "Test-Path '#{dsc_props[:dsc_path]}'", - :SetScript => "(New-Object Net.WebClient).DownloadFile('#{download_url}', '#{dsc_props[:dsc_path]}')" -) - -# Tests -agents.each do |agent| - step 'Attempt to Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => 0) do |result| - assert_match(error_msg, result.stderr, 'Expected error was not detected!') - end -end diff --git a/tests/acceptance/tests/basic_dsc_resources/package/negative/package_invalid_path.rb b/tests/acceptance/tests/basic_dsc_resources/package/negative/package_invalid_path.rb deleted file mode 100755 index 95bdda0c..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/package/negative/package_invalid_path.rb +++ /dev/null @@ -1,32 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2559 - C68686 - Attempt to Apply DSC Package Resource with Invalid "Path" Specified' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'package' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_path => "C:\\not_here_python.msi", - :dsc_name => 'Python 2.7.10', - :dsc_productid => 'E2B51919-207A-43EB-AE78-733F9C6797C2' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Verify -error_msg = /Error:.*The given Path .* could not be found/m - -# Tests -agents.each do |agent| - step 'Attempt to Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => 0) do |result| - assert_match(error_msg, result.stderr, 'Expected error was not detected!') - end -end diff --git a/tests/acceptance/tests/basic_dsc_resources/package/negative/package_invalid_productid.rb b/tests/acceptance/tests/basic_dsc_resources/package/negative/package_invalid_productid.rb deleted file mode 100755 index b36175cd..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/package/negative/package_invalid_productid.rb +++ /dev/null @@ -1,57 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2559 - C68687 - Attempt to Apply DSC Package Resource with Invalid "ProductID" Specified' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' -download_url = 'http://int-resources.ops.puppetlabs.net/QA_resources/python/python-2.7.10.msi' - -# ERB Manifest -dsc_type = 'package' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_path => "C:\\python.msi", - :dsc_name => 'Python 2.7.10', - :dsc_productid => 'B2E52010-307C-53EF-BF77-822E0B6707B1' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -teardown do - step 'Remove Test Artifacts' - set_dsc_resource( - agents, - 'file', - dsc_module, - :Ensure => 'Absent', - :Type => 'File', - :DestinationPath => dsc_props[:dsc_path] - ) -end - -# Verify -error_msg = /Error:.*The specified Name .* and IdentifyingNumber .* do not match Name .* and IdentifyingNumber/m - -# Setup -step 'Download Test Package' -set_dsc_resource( - agents, - 'script', - dsc_module, - :GetScript => 'return @{}', - :TestScript => "Test-Path '#{dsc_props[:dsc_path]}'", - :SetScript => "(New-Object Net.WebClient).DownloadFile('#{download_url}', '#{dsc_props[:dsc_path]}')" -) - -# Tests -agents.each do |agent| - step 'Attempt to Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => 0) do |result| - assert_match(error_msg, result.stderr, 'Expected error was not detected!') - end -end diff --git a/tests/acceptance/tests/basic_dsc_resources/package/package_uninstall.rb b/tests/acceptance/tests/basic_dsc_resources/package/package_uninstall.rb deleted file mode 100755 index 153d543b..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/package/package_uninstall.rb +++ /dev/null @@ -1,85 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2559 - C68682 - Apply DSC Package Resource that Uninstalls Package' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' -download_url = 'http://int-resources.ops.puppetlabs.net/QA_resources/python/python-2.7.10.msi' - -# ERB Manifest -dsc_type = 'package' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_path => "C:\\python.msi", - :dsc_name => 'Python 2.7.10', - :dsc_productid => 'E2B51919-207A-43EB-AE78-733F9C6797C2' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -teardown do - step 'Remove Test Artifacts' - set_dsc_resource( - agents, - 'file', - dsc_module, - :Ensure => 'Absent', - :Type => 'File', - :DestinationPath => dsc_props[:dsc_path] - ) -end - -# Setup -step 'Download Test Package' -set_dsc_resource( - agents, - 'script', - dsc_module, - :GetScript => 'return @{}', - :TestScript => "Test-Path '#{dsc_props[:dsc_path]}'", - :SetScript => "(New-Object Net.WebClient).DownloadFile('#{download_url}', '#{dsc_props[:dsc_path]}')" -) - -# Tests -agents.each do |agent| - step 'Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - assert_dsc_resource( - agent, - dsc_type, - dsc_module, - :Ensure => dsc_props[:dsc_ensure], - :Path => dsc_props[:dsc_path], - :Name => dsc_props[:dsc_name], - :ProductId => dsc_props[:dsc_productid] - ) - - # New manifest to uninstall package. - dsc_props[:dsc_ensure] = 'Absent' - dsc_remove_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - - step 'Apply Manifest to Uninstall Package' - on(agent, puppet('apply'), :stdin => dsc_remove_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - assert_dsc_resource( - agent, - dsc_type, - dsc_module, - :Ensure => dsc_props[:dsc_ensure], - :Path => dsc_props[:dsc_path], - :Name => dsc_props[:dsc_name], - :ProductId => dsc_props[:dsc_productid] - ) -end diff --git a/tests/acceptance/tests/basic_dsc_resources/package/package_valid_args.rb b/tests/acceptance/tests/basic_dsc_resources/package/package_valid_args.rb deleted file mode 100755 index 1d0e24f9..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/package/package_valid_args.rb +++ /dev/null @@ -1,69 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2559 - C68684 - Apply DSC Package Resource with Valid "Arguments" Specified' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' -download_url = 'http://int-resources.ops.puppetlabs.net/QA_resources/7zip/7z920.exe' -install_path = 'C:\7zip' - -# ERB Manifest -dsc_type = 'package' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_path => "C:\\7zip.exe", - :dsc_name => '7-Zip 9.20', - :dsc_productid => '', - :dsc_arguments => "/S /D=#{install_path}" -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -teardown do - step 'Remove Test Artifacts' - on(agents, "cmd /c \"#{install_path}\\Uninstall.exe /S\"") - - set_dsc_resource( - agents, - 'file', - dsc_module, - :Ensure => 'Absent', - :Type => 'File', - :DestinationPath => dsc_props[:dsc_path] - ) -end - -# Setup -step 'Download Test Package' -set_dsc_resource( - agents, - 'script', - dsc_module, - :GetScript => 'return @{}', - :TestScript => "Test-Path '#{dsc_props[:dsc_path]}'", - :SetScript => "(New-Object Net.WebClient).DownloadFile('#{download_url}', '#{dsc_props[:dsc_path]}')" -) - -# Tests -agents.each do |agent| - step 'Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - assert_dsc_resource( - agent, - dsc_type, - dsc_module, - :Ensure => dsc_props[:dsc_ensure], - :Path => dsc_props[:dsc_path], - :Name => dsc_props[:dsc_name], - :ProductId => dsc_props[:dsc_productid] - ) -end diff --git a/tests/acceptance/tests/basic_dsc_resources/package/package_valid_msi.rb b/tests/acceptance/tests/basic_dsc_resources/package/package_valid_msi.rb deleted file mode 100755 index 537df167..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/package/package_valid_msi.rb +++ /dev/null @@ -1,75 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2559 - C68594 - Apply DSC Package Resource with Valid "Name", "Path" and "ProductID" Specified' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' -download_url = 'http://int-resources.ops.puppetlabs.net/QA_resources/python/python-2.7.10.msi' - -# ERB Manifest -dsc_type = 'package' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_path => "C:\\python.msi", - :dsc_name => 'Python 2.7.10', - :dsc_productid => 'E2B51919-207A-43EB-AE78-733F9C6797C2' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -teardown do - step 'Remove Test Artifacts' - set_dsc_resource( - agents, - dsc_type, - dsc_module, - :Ensure => 'Absent', - :Path => dsc_props[:dsc_path], - :Name => dsc_props[:dsc_name], - :ProductId => dsc_props[:dsc_productid] - ) - - set_dsc_resource( - agents, - 'file', - dsc_module, - :Ensure => 'Absent', - :Type => 'File', - :DestinationPath => dsc_props[:dsc_path] - ) -end - -# Setup -step 'Download Test Package' -set_dsc_resource( - agents, - 'script', - dsc_module, - :GetScript => 'return @{}', - :TestScript => "Test-Path '#{dsc_props[:dsc_path]}'", - :SetScript => "(New-Object Net.WebClient).DownloadFile('#{download_url}', '#{dsc_props[:dsc_path]}')" -) - -# Tests -agents.each do |agent| - step 'Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - assert_dsc_resource( - agent, - dsc_type, - dsc_module, - :Ensure => dsc_props[:dsc_ensure], - :Path => dsc_props[:dsc_path], - :Name => dsc_props[:dsc_name], - :ProductId => dsc_props[:dsc_productid] - ) -end diff --git a/tests/acceptance/tests/basic_dsc_resources/package/package_valid_returncode.rb b/tests/acceptance/tests/basic_dsc_resources/package/package_valid_returncode.rb deleted file mode 100755 index 5fb0db55..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/package/package_valid_returncode.rb +++ /dev/null @@ -1,81 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2559 - C92336 - Apply DSC Package Resource with Non-Zero "ReturnCode" Specified' - -confine(:to, :platform => 'windows') - -# Init -local_manifests_root_path = ENV['MANIFESTS'] || 'tests/manifests' -local_files_root_path = ENV['FILES'] || 'tests/files' - -local_installer_file_path = File.join(local_files_root_path, 'test_installer', 'test_program_installer.exe') -install_path = 'C:\test_program' -uninstall_reg_key_path = 'Software\Microsoft\Windows\CurrentVersion\Uninstall\TestProgram' -ps_uninstall_command = "Remove-Item -Recurse -Path HKLM:\\#{uninstall_reg_key_path}" - -# ERB Manifest -dsc_type = 'package' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_path => "C:\\test_program_installer.exe", - :dsc_name => 'Test Program', - :dsc_productid => '', - :dsc_arguments => "/S /D=#{install_path}", - :dsc_returncode => '4' -} - -dsc_manifest_template_path = File.join(local_manifests_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -teardown do - step 'Remove Test Artifacts' - # This invocation will be deprecated by the changes in MODULES-2656 - # The method will be renamed and marked as public. - _exec_dsc_script(agents, "if ( #{ps_uninstall_command} ) { exit 0 } else { exit 1 }") - - set_dsc_resource( - agents, - 'file', - dsc_module, - :Ensure => 'Absent', - :Type => 'File', - :DestinationPath => dsc_props[:dsc_path] - ) - - set_dsc_resource( - agents, - 'file', - dsc_module, - :Ensure => 'Absent', - :Type => 'Directory', - :Force => '$true', - :Recurse => '$true', - :DestinationPath => install_path - ) -end - -# Setup -step 'Copy Installer to Agents' -scp_to(agents, local_installer_file_path, dsc_props[:dsc_path]) - -# Tests -agents.each do |agent| - step 'Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => 0) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - assert_dsc_resource( - agent, - dsc_type, - dsc_module, - :Ensure => dsc_props[:dsc_ensure], - :Path => dsc_props[:dsc_path], - :Name => dsc_props[:dsc_name], - :ProductId => dsc_props[:dsc_productid], - :ReturnCode => "[uint32[]]@(#{dsc_props[:dsc_returncode]})" - ) -end diff --git a/tests/acceptance/tests/basic_dsc_resources/registry/negative/reg_invalid_binary_value.rb b/tests/acceptance/tests/basic_dsc_resources/registry/negative/reg_invalid_binary_value.rb deleted file mode 100755 index 52ad4d63..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/registry/negative/reg_invalid_binary_value.rb +++ /dev/null @@ -1,32 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2230 - C68710 - Attempt to Apply DSC Registry Resource with Invalid "ValueData" Specified Binary Type' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'registry' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_key => 'HKEY_LOCAL_MACHINE\SOFTWARE\TestKey', - :dsc_valuename => 'BadBinaryValue', - :dsc_valuedata => 'This is not binary!', - :dsc_valuetype => 'Binary' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Verify -error_msg = /'ValueData' has an invalid value/ - -# Tests -agents.each do |agent| - step 'Attempt to Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_match(error_msg, result.stderr, 'Expected error was not detected!') - end -end diff --git a/tests/acceptance/tests/basic_dsc_resources/registry/negative/reg_invalid_dword_value.rb b/tests/acceptance/tests/basic_dsc_resources/registry/negative/reg_invalid_dword_value.rb deleted file mode 100755 index 426621ed..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/registry/negative/reg_invalid_dword_value.rb +++ /dev/null @@ -1,32 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2230 - C68711 - Attempt to Apply DSC Registry Resource with Invalid "ValueData" Specified Dword Type' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'registry' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_key => 'HKEY_LOCAL_MACHINE\SOFTWARE\TestKey', - :dsc_valuename => 'BadDwordValue', - :dsc_valuedata => 'This is not a dword!', - :dsc_valuetype => 'Dword' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Verify -error_msg = /string was not in a correct format/ - -# Tests -agents.each do |agent| - step 'Attempt to Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_match(error_msg, result.stderr, 'Expected error was not detected!') - end -end diff --git a/tests/acceptance/tests/basic_dsc_resources/registry/negative/reg_invalid_key.rb b/tests/acceptance/tests/basic_dsc_resources/registry/negative/reg_invalid_key.rb deleted file mode 100755 index 80a1aeb9..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/registry/negative/reg_invalid_key.rb +++ /dev/null @@ -1,31 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2230 - C68708 - Attempt to Apply DSC Registry Resource with Invalid "Key" Specified' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'registry' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_key => 'HKEY_COW_MEAT\TestKey', - :dsc_valuename => 'TestValueName', - :dsc_valuetype => 'String' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Verify -error_msg = /registry hive was specified in registry key 'HKEY_COW_MEAT\\TestKey'/ - -# Tests -agents.each do |agent| - step 'Attempt to Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_match(error_msg, result.stderr, 'Expected error was not detected!') - end -end diff --git a/tests/acceptance/tests/basic_dsc_resources/registry/reg_force_value.rb b/tests/acceptance/tests/basic_dsc_resources/registry/reg_force_value.rb deleted file mode 100755 index a5505616..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/registry/reg_force_value.rb +++ /dev/null @@ -1,66 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2230 - C88970 - Apply DSC Registry Resource with "Force" Enabled' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'registry' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_key => 'HKEY_LOCAL_MACHINE\SOFTWARE\TestKey', - :dsc_valuename => 'TestForceValue', - :dsc_valuedata => 'Gif Party!', - :dsc_valuetype => 'String' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -teardown do - step 'Remove Test Artifacts' - set_dsc_resource( - agents, - dsc_type, - dsc_module, - :Ensure => 'Absent', - :Key => dsc_props[:dsc_key], - :ValueName => dsc_props[:dsc_valuename] - ) -end - -# Tests -agents.each do |agent| - step 'Apply Manifest to Create Value' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - # New manifest to force value. - dsc_props[:dsc_force] = 'true' - dsc_props[:dsc_valuedata] = 'Meow Police!' - dsc_force_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - - step 'Apply Manifest Again with Force Enabled' - on(agent, puppet('apply'), :stdin => dsc_force_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - assert_dsc_resource( - agent, - dsc_type, - dsc_module, - :Ensure => dsc_props[:dsc_ensure], - :Key => dsc_props[:dsc_key], - :ValueName => dsc_props[:dsc_valuename], - :ValueData => "@(\"#{dsc_props[:dsc_valuedata]}\")", - :ValueType => dsc_props[:dsc_valuetype], - :Force => "$#{dsc_props[:dsc_force]}" - ) -end diff --git a/tests/acceptance/tests/basic_dsc_resources/registry/reg_remove_value.rb b/tests/acceptance/tests/basic_dsc_resources/registry/reg_remove_value.rb deleted file mode 100755 index 3ca5b165..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/registry/reg_remove_value.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2230 - C68706 - Apply DSC Registry Resource that Removes Registry Value' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'registry' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_key => 'HKEY_LOCAL_MACHINE\SOFTWARE\TestKey', - :dsc_valuename => 'TestRemoveValue', - :dsc_valuedata => 'Cats', - :dsc_valuetype => 'String' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Tests -agents.each do |agent| - step 'Apply Manifest to Create Value' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - # New manifest to remove value. - dsc_props[:dsc_ensure] = 'Absent' - dsc_remove_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - - step 'Apply Manifest to Remove Value' - on(agent, puppet('apply'), :stdin => dsc_remove_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - assert_dsc_resource( - agent, - dsc_type, - dsc_module, - :Ensure => dsc_props[:dsc_ensure], - :Key => dsc_props[:dsc_key], - :ValueName => dsc_props[:dsc_valuename], - :ValueData => "@(\"#{dsc_props[:dsc_valuedata]}\")", - :ValueType => dsc_props[:dsc_valuetype] - ) -end diff --git a/tests/acceptance/tests/basic_dsc_resources/registry/reg_valid_binary_valuedata.rb b/tests/acceptance/tests/basic_dsc_resources/registry/reg_valid_binary_valuedata.rb deleted file mode 100755 index ca304389..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/registry/reg_valid_binary_valuedata.rb +++ /dev/null @@ -1,55 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2230 - C68702 - Apply DSC Registry Resource with Valid "ValueData" Specified for Binary Type' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'registry' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_key => 'HKEY_LOCAL_MACHINE\SOFTWARE\TestKey', - :dsc_valuename => 'TestBinaryValue', - :dsc_valuedata => 'BEEF', - :dsc_valuetype => 'Binary' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -teardown do - step 'Remove Test Artifacts' - set_dsc_resource( - agents, - dsc_type, - dsc_module, - :Ensure => 'Absent', - :Key => dsc_props[:dsc_key], - :ValueName => dsc_props[:dsc_valuename] - ) -end - -# Tests -agents.each do |agent| - step 'Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - assert_dsc_resource( - agent, - dsc_type, - dsc_module, - :Ensure => dsc_props[:dsc_ensure], - :Key => dsc_props[:dsc_key], - :ValueName => dsc_props[:dsc_valuename], - :ValueData => "@(\"#{dsc_props[:dsc_valuedata]}\")", - :ValueType => dsc_props[:dsc_valuetype] - ) -end diff --git a/tests/acceptance/tests/basic_dsc_resources/registry/reg_valid_dword_hex_valuedata.rb b/tests/acceptance/tests/basic_dsc_resources/registry/reg_valid_dword_hex_valuedata.rb deleted file mode 100755 index cb5e52e2..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/registry/reg_valid_dword_hex_valuedata.rb +++ /dev/null @@ -1,57 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2230 - C68704 - Apply DSC Registry Resource with Valid "ValueData" Specified for Dword Hex Type' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'registry' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_key => 'HKEY_LOCAL_MACHINE\SOFTWARE\TestKey', - :dsc_valuename => 'TestDwordHexValue', - :dsc_valuedata => 'BEEF', - :dsc_valuetype => 'Dword', - :dsc_hex => 'true' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -teardown do - step 'Remove Test Artifacts' - set_dsc_resource( - agents, - dsc_type, - dsc_module, - :Ensure => 'Absent', - :Key => dsc_props[:dsc_key], - :ValueName => dsc_props[:dsc_valuename] - ) -end - -# Tests -agents.each do |agent| - step 'Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - assert_dsc_resource( - agent, - dsc_type, - dsc_module, - :Ensure => dsc_props[:dsc_ensure], - :Key => dsc_props[:dsc_key], - :ValueName => dsc_props[:dsc_valuename], - :ValueData => "@(\"#{dsc_props[:dsc_valuedata]}\")", - :ValueType => dsc_props[:dsc_valuetype], - :Hex => "$#{dsc_props[:dsc_hex]}" - ) -end diff --git a/tests/acceptance/tests/basic_dsc_resources/registry/reg_valid_dword_valuedata.rb b/tests/acceptance/tests/basic_dsc_resources/registry/reg_valid_dword_valuedata.rb deleted file mode 100755 index a3346b9f..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/registry/reg_valid_dword_valuedata.rb +++ /dev/null @@ -1,55 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2230 - C68703 - Apply DSC Registry Resource with Valid "ValueData" Specified for Dword Type' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'registry' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_key => 'HKEY_LOCAL_MACHINE\SOFTWARE\TestKey', - :dsc_valuename => 'TestDwordValue', - :dsc_valuedata => '-2147483648', - :dsc_valuetype => 'Dword' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -teardown do - step 'Remove Test Artifacts' - set_dsc_resource( - agents, - dsc_type, - dsc_module, - :Ensure => 'Absent', - :Key => dsc_props[:dsc_key], - :ValueName => dsc_props[:dsc_valuename] - ) -end - -# Tests -agents.each do |agent| - step 'Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - assert_dsc_resource( - agent, - dsc_type, - dsc_module, - :Ensure => dsc_props[:dsc_ensure], - :Key => dsc_props[:dsc_key], - :ValueName => dsc_props[:dsc_valuename], - :ValueData => "@(\"#{dsc_props[:dsc_valuedata]}\")", - :ValueType => dsc_props[:dsc_valuetype] - ) -end diff --git a/tests/acceptance/tests/basic_dsc_resources/registry/reg_valid_implicit_valuedata.rb b/tests/acceptance/tests/basic_dsc_resources/registry/reg_valid_implicit_valuedata.rb deleted file mode 100755 index e370de41..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/registry/reg_valid_implicit_valuedata.rb +++ /dev/null @@ -1,53 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2230 - C68701 - Apply DSC Registry Resource with Valid "ValueData" Specified for Implicit String Type' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'registry' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_key => 'HKEY_LOCAL_MACHINE\SOFTWARE\TestKey', - :dsc_valuename => 'TestStringValue', - :dsc_valuedata => 'This is a test string!' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -teardown do - step 'Remove Test Artifacts' - set_dsc_resource( - agents, - dsc_type, - dsc_module, - :Ensure => 'Absent', - :Key => dsc_props[:dsc_key], - :ValueName => dsc_props[:dsc_valuename] - ) -end - -# Tests -agents.each do |agent| - step 'Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - assert_dsc_resource( - agent, - dsc_type, - dsc_module, - :Ensure => dsc_props[:dsc_ensure], - :Key => dsc_props[:dsc_key], - :ValueName => dsc_props[:dsc_valuename], - :ValueData => "@(\"#{dsc_props[:dsc_valuedata]}\")" - ) -end diff --git a/tests/acceptance/tests/basic_dsc_resources/registry/reg_valid_key_valuename.rb b/tests/acceptance/tests/basic_dsc_resources/registry/reg_valid_key_valuename.rb deleted file mode 100755 index 176c00a7..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/registry/reg_valid_key_valuename.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2230 - C68700 - Apply DSC Registry Resource with Valid "Key" and "ValueName" Specified' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'registry' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_key => 'HKEY_LOCAL_MACHINE\SOFTWARE\TestKey', - :dsc_valuename => 'TestValueName' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -teardown do - step 'Remove Test Artifacts' - set_dsc_resource( - agents, - dsc_type, - dsc_module, - :Ensure => 'Absent', - :Key => dsc_props[:dsc_key], - :ValueName => dsc_props[:dsc_valuename] - ) -end - -# Tests -agents.each do |agent| - step 'Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - assert_dsc_resource( - agent, - dsc_type, - dsc_module, - :Ensure => dsc_props[:dsc_ensure], - :Key => dsc_props[:dsc_key], - :ValueName => dsc_props[:dsc_valuename] - ) -end diff --git a/tests/acceptance/tests/basic_dsc_resources/service/negative/service_incompatible_startup_state.rb b/tests/acceptance/tests/basic_dsc_resources/service/negative/service_incompatible_startup_state.rb deleted file mode 100755 index e0bc140b..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/service/negative/service_incompatible_startup_state.rb +++ /dev/null @@ -1,30 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2336 - C68749 - Attempt to Apply DSC Service Resource with Incompatible "StartupType" and "State"' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'service' -dsc_props = { - :dsc_name => 'w32time', - :dsc_state => 'Running', - :dsc_startuptype => 'Disabled' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Verify -error_msg = /Error\:.*Dsc_service\[service_test\]:.*Cannot start and disable a service/m - -# Tests -agents.each do |agent| - step 'Attempt to Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_match(error_msg, result.stderr, 'Expected error was not detected!') - end -end diff --git a/tests/acceptance/tests/basic_dsc_resources/service/negative/service_invalid_name.rb b/tests/acceptance/tests/basic_dsc_resources/service/negative/service_invalid_name.rb deleted file mode 100755 index 95a01fcc..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/service/negative/service_invalid_name.rb +++ /dev/null @@ -1,30 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2336 - C68748 - Attempt to Apply DSC Service Resource with Invalid "Name" Specified' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'service' -dsc_props = { - :dsc_name => 'makebelieve', - :dsc_state => 'Running', - :dsc_startuptype => 'Automatic' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Verify -error_msg = /Error: PowerShell DSC resource MSFT_ServiceResource.*Dsc_service\[service_test\].*The service 'makebelieve' does not exist/m - -# Tests -agents.each do |agent| - step 'Attempt to Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_match(error_msg, result.stderr, 'Expected error was not detected!') - end -end diff --git a/tests/acceptance/tests/basic_dsc_resources/service/service_remove.rb b/tests/acceptance/tests/basic_dsc_resources/service/service_remove.rb deleted file mode 100755 index a89a7f3a..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/service/service_remove.rb +++ /dev/null @@ -1,42 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2511 - C68729 - Apply DSC Service Resource that Removes a Service' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'service' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Absent', - :dsc_name => 'puppet' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -# A teardown is not necessary because the Puppet Agent service is not -# needed for acceptance testing. - -# Tests -agents.each do |agent| - step 'Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - expect_failure('Expected to fail because of MODULES-2512') do - assert_dsc_resource( - agent, - dsc_type, - dsc_module, - :Ensure => dsc_props[:dsc_ensure], - :Name => dsc_props[:dsc_name] - ) - end -end diff --git a/tests/acceptance/tests/basic_dsc_resources/service/service_valid_name_startuptype_state.rb b/tests/acceptance/tests/basic_dsc_resources/service/service_valid_name_startuptype_state.rb deleted file mode 100755 index a5a45082..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/service/service_valid_name_startuptype_state.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2264 - C68727 - Apply DSC Service Resource with Valid "Name", "StartupType" and "State" Specified' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'service' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_name => 'w32time', - :dsc_state => 'Running', - :dsc_startuptype => 'Automatic' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -teardown do - step 'Remove Test Artifacts' - set_dsc_resource( - agents, - dsc_type, - dsc_module, - :Name => 'w32time', - :State => 'Stopped', - :StartupType => 'Manual' - ) -end - -# Tests -agents.each do |agent| - step 'Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - assert_dsc_resource( - agent, - dsc_type, - dsc_module, - :Name => dsc_props[:dsc_name], - :State => dsc_props[:dsc_state], - :StartupType => dsc_props[:dsc_startuptype] - ) -end diff --git a/tests/acceptance/tests/basic_dsc_resources/user/negative/user_invalid_password.rb b/tests/acceptance/tests/basic_dsc_resources/user/negative/user_invalid_password.rb deleted file mode 100755 index f772454b..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/user/negative/user_invalid_password.rb +++ /dev/null @@ -1,31 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2537 - C68756 - Attempt to Apply DSC User Resource with Invalid "Password" Specified' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'user' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_username => 'catsinhats', - :dsc_password => "{'user' => 'incorrect', 'password' => ''}" -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Verify -error_msg = /Error:.*password must not be empty/m - -# Tests -agents.each do |agent| - step 'Attempt to Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => 1) do |result| - assert_match(error_msg, result.stderr, 'Expected error was not detected!') - end -end diff --git a/tests/acceptance/tests/basic_dsc_resources/user/negative/user_invalid_passwordneverexpires.rb b/tests/acceptance/tests/basic_dsc_resources/user/negative/user_invalid_passwordneverexpires.rb deleted file mode 100755 index ee1825f9..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/user/negative/user_invalid_passwordneverexpires.rb +++ /dev/null @@ -1,31 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2229 - C68757 - Attempt to Apply DSC User Resource with Invalid Data Type for "PasswordNeverExpires" Specified' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'user' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_username => 'goatkong', - :dsc_passwordneverexpires => 2 -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Verify -error_msg = /Error:.*invalid value/m - -# Tests -agents.each do |agent| - step 'Attempt to Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => 1) do |result| - assert_match(error_msg, result.stderr, 'Expected error was not detected!') - end -end diff --git a/tests/acceptance/tests/basic_dsc_resources/user/negative/user_invalid_username.rb b/tests/acceptance/tests/basic_dsc_resources/user/negative/user_invalid_username.rb deleted file mode 100755 index 8e040fd8..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/user/negative/user_invalid_username.rb +++ /dev/null @@ -1,30 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2229 - C68755 - Attempt to Apply DSC User Resource with Invalid "UserName" Specified' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'user' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_username => 'not a valid user name for windows systems' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Verify -error_msg = /Error:.*The specified username is invalid/m - -# Tests -agents.each do |agent| - step 'Attempt to Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => 0) do |result| - assert_match(error_msg, result.stderr, 'Expected error was not detected!') - end -end diff --git a/tests/acceptance/tests/basic_dsc_resources/user/user_remove.rb b/tests/acceptance/tests/basic_dsc_resources/user/user_remove.rb deleted file mode 100755 index 0b21fb2a..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/user/user_remove.rb +++ /dev/null @@ -1,45 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2229 - C68752 - Apply DSC User Resource that Removes a User' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'user' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_username => 'catmandew' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Tests -agents.each do |agent| - step 'Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - # New manifest to remove value. - dsc_props[:dsc_ensure] = 'Absent' - dsc_remove_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - - step 'Apply Manifest to Remove User' - on(agent, puppet('apply'), :stdin => dsc_remove_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - assert_dsc_resource( - agent, - dsc_type, - dsc_module, - :Ensure => 'Absent', - :UserName => dsc_props[:dsc_username] - ) -end diff --git a/tests/acceptance/tests/basic_dsc_resources/user/user_valid_password.rb b/tests/acceptance/tests/basic_dsc_resources/user/user_valid_password.rb deleted file mode 100755 index 99cc773e..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/user/user_valid_password.rb +++ /dev/null @@ -1,54 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2537 - C68751 - Apply DSC User Resource with Valid "UserName" and "Password" Specified' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' -username = 'specialcat' -password = 'specialcatpassword' - -# ERB Manifest -dsc_type = 'user' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_username => username, - :dsc_password => "{'user' => '#{username}', 'password' => '#{password}'}" -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -teardown do - step 'Remove Test Artifacts' - set_dsc_resource( - agents, - dsc_type, - dsc_module, - :Ensure => 'Absent', - :UserName => username - ) -end - -# Tests -agents.each do |agent| - step 'Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - assert_dsc_cred_resource( - agent, - username, - password, - dsc_type, - dsc_module, - :Password, - :Ensure => dsc_props[:dsc_ensure], - :UserName => username - ) -end diff --git a/tests/acceptance/tests/basic_dsc_resources/user/user_valid_unicode.rb b/tests/acceptance/tests/basic_dsc_resources/user/user_valid_unicode.rb deleted file mode 100755 index d45e7107..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/user/user_valid_unicode.rb +++ /dev/null @@ -1,61 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2537 - C68754 - Apply DSC User Resource with Valid Unicode "UserName" and "Password" Specified' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' -test_manifest_name = 'test_manifest.pp' -username = "unicode" -password = "\u11D4\u11D7\u11E8\u11F9\u118E\u1185\u118A\u11A0\u11A9\u11C5" - -# ERB Manifest -dsc_type = 'user' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_username => username, - :dsc_password => "{'user' => '#{username}', 'password' => '#{password}'}" -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -teardown do - step 'Remove Test Artifacts' - set_dsc_resource( - agents, - dsc_type, - dsc_module, - :Ensure => 'Absent', - :UserName => username - ) - on(agents, "rm -rf /cygdrive/c/#{test_manifest_name}") -end - -# Setup -create_remote_file(agents, "/cygdrive/c/#{test_manifest_name}", dsc_manifest) - -# Tests -agents.each do |agent| - step 'Apply Manifest' - on(agent, puppet("apply C:\\\\#{test_manifest_name}"), :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - expect_failure('Expected to fail because of MODULES-2588') do - assert_dsc_cred_resource( - agent, - username, - password, - dsc_type, - dsc_module, - :Password, - :Ensure => dsc_props[:dsc_ensure], - :UserName => username - ) - end -end diff --git a/tests/acceptance/tests/basic_dsc_resources/waitforall/negative/waitforall_blacklist.rb b/tests/acceptance/tests/basic_dsc_resources/waitforall/negative/waitforall_blacklist.rb deleted file mode 100755 index 28caf900..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/waitforall/negative/waitforall_blacklist.rb +++ /dev/null @@ -1,29 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2399 - C68777 - Attempt to Apply DSC WaitForAll Resource' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'waitforall' -dsc_props = { - :dsc_nodename => 'localhost', - :dsc_resourcename => 'does_not_matter' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Verify -error_msg = /Error:.*resource.*dsc_waitforall/ - -# Tests -agents.each do |agent| - step 'Attempt to Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => 1) do |result| - assert_match(error_msg, result.stderr, 'Expected error was not detected!') - end -end diff --git a/tests/acceptance/tests/basic_dsc_resources/waitforany/negative/waitforany_blacklist.rb b/tests/acceptance/tests/basic_dsc_resources/waitforany/negative/waitforany_blacklist.rb deleted file mode 100755 index 6f40b5b4..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/waitforany/negative/waitforany_blacklist.rb +++ /dev/null @@ -1,29 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2399 - C71648 - Attempt to Apply DSC WaitForAny Resource' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'waitforany' -dsc_props = { - :dsc_nodename => 'localhost', - :dsc_resourcename => 'does_not_matter' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Verify -error_msg = /Error:.*resource.*dsc_waitforany/ - -# Tests -agents.each do |agent| - step 'Attempt to Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => 1) do |result| - assert_match(error_msg, result.stderr, 'Expected error was not detected!') - end -end diff --git a/tests/acceptance/tests/basic_dsc_resources/waitforsome/negative/waitforsome_blacklist.rb b/tests/acceptance/tests/basic_dsc_resources/waitforsome/negative/waitforsome_blacklist.rb deleted file mode 100755 index 4c415bb1..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/waitforsome/negative/waitforsome_blacklist.rb +++ /dev/null @@ -1,29 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2399 - C71647 - Attempt to Apply DSC WaitForSome Resource' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'waitforsome' -dsc_props = { - :dsc_nodename => 'localhost', - :dsc_resourcename => 'does_not_matter' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Verify -error_msg = /Error:.*resource.*dsc_waitforsome/ - -# Tests -agents.each do |agent| - step 'Attempt to Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => 1) do |result| - assert_match(error_msg, result.stderr, 'Expected error was not detected!') - end -end diff --git a/tests/acceptance/tests/basic_dsc_resources/windowsprocess/negative/process_invalid_path.rb b/tests/acceptance/tests/basic_dsc_resources/windowsprocess/negative/process_invalid_path.rb deleted file mode 100755 index 8a18ae6f..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/windowsprocess/negative/process_invalid_path.rb +++ /dev/null @@ -1,31 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2398 - C68696 - Attempt to Apply DSC WindowsProcess Resource with Invalid "Path" Specified' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'windowsprocess' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_path => 'C:\Windows\System32\fake.exe', - :dsc_arguments => "-moo", -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Verify -error_msg = /Error:.*Invalid argument: 'Path' with value/ - -# Tests -agents.each do |agent| - step 'Attempt to Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_match(error_msg, result.stderr, 'Unexpected error was detected!') - end -end diff --git a/tests/acceptance/tests/basic_dsc_resources/windowsprocess/process_kill.rb b/tests/acceptance/tests/basic_dsc_resources/windowsprocess/process_kill.rb deleted file mode 100755 index ffdedd48..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/windowsprocess/process_kill.rb +++ /dev/null @@ -1,47 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2398 - C68692 - Apply DSC WindowsProcess Resource that Kills a Long Running Process' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'windowsprocess' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_path => 'C:\Windows\System32\ping.exe', - :dsc_arguments => '-t -4 localhost', -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Tests -agents.each do |agent| - step 'Apply Manifest to Start Process' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - # New manifest to kill process. - dsc_props[:dsc_ensure] = 'Absent' - dsc_kill_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - - step 'Apply Manifest to Stop Process' - on(agent, puppet('apply'), :stdin => dsc_kill_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - assert_dsc_resource( - agent, - dsc_type, - dsc_module, - :Ensure => dsc_props[:dsc_ensure], - :Path => dsc_props[:dsc_path], - :Arguments => dsc_props[:dsc_arguments], - ) -end diff --git a/tests/acceptance/tests/basic_dsc_resources/windowsprocess/process_valid_args.rb b/tests/acceptance/tests/basic_dsc_resources/windowsprocess/process_valid_args.rb deleted file mode 100755 index f932e85b..00000000 --- a/tests/acceptance/tests/basic_dsc_resources/windowsprocess/process_valid_args.rb +++ /dev/null @@ -1,49 +0,0 @@ -require 'erb' -require 'dsc_utils' -test_name 'MODULES-2398 - C68691 - Apply DSC WindowsProcess Resource with Valid "Arguments" and "Path" Specified' - -confine(:to, :platform => 'windows') - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' -output_file_name = 'ping.out' - -# ERB Manifest -dsc_type = 'windowsprocess' -dsc_module = 'PSDesiredStateConfiguration' -dsc_props = { - :dsc_ensure => 'Present', - :dsc_path => 'C:\Windows\System32\cmd.exe', - :dsc_arguments => "/c ping.exe -n 2 -4 localhost > C:\\#{output_file_name}", -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -teardown do - step 'Remove Test Artifacts' - set_dsc_resource( - agents, - 'file', - dsc_module, - :Ensure => 'Absent', - :DestinationPath => "C:\\#{output_file_name}" - ) -end - -# Verify -output_file_regex = /Reply from 127.0.0.1/ - -# Tests -agents.each do |agent| - step 'Apply Manifest' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - on(agent, "cat /cygdrive/c/#{output_file_name}") do |result| - assert_match(output_file_regex, result.stdout, 'Expected contents not detected!') - end -end diff --git a/tests/acceptance/tests/user_scenarios/vendored_resource.rb b/tests/acceptance/tests/user_scenarios/vendored_resource.rb deleted file mode 100755 index 787ec993..00000000 --- a/tests/acceptance/tests/user_scenarios/vendored_resource.rb +++ /dev/null @@ -1,54 +0,0 @@ -require 'erb' -require 'master_manipulator' -require 'dsc_utils' -test_name 'MODULES-2296 - C68574 - Apply DSC Manifest with a Vendored Resource' - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'xservice' -dsc_module = 'xPSDesiredStateConfiguration' -dsc_props = { - :dsc_name => 'w32time', - :dsc_state => 'Running', - :dsc_startuptype => 'Automatic' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -teardown do - confine_block(:to, :platform => 'windows') do - step 'Remove Test Artifacts' - set_dsc_resource( - agents, - dsc_type, - dsc_module, - :Name => 'w32time', - :State => 'Stopped', - :StartupType => 'Manual' - ) - end -end - -# Tests -confine_block(:to, :platform => 'windows') do - agents.each do |agent| - step 'Run Puppet Agent' - on(agent, puppet('apply'), :stdin => dsc_manifest, :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Results' - assert_dsc_resource( - agent, - dsc_type, - dsc_module, - :Name => dsc_props[:dsc_name], - :State => dsc_props[:dsc_state], - :StartupType => dsc_props[:dsc_startuptype] - ) - end -end diff --git a/tests/files/test_installer/README.md b/tests/files/test_installer/README.md deleted file mode 100755 index c35f213b..00000000 --- a/tests/files/test_installer/README.md +++ /dev/null @@ -1,9 +0,0 @@ -Test Installer -=========================== - -This folder contains a NSI script for creating a test package for Windows. -[Download NSIS](http://nsis.sourceforge.net/Download) and run the following command to compile the package installer: - -``` -makensis.exe test.nsi -``` diff --git a/tests/files/test_installer/test.nsi b/tests/files/test_installer/test.nsi deleted file mode 100755 index c01d0a86..00000000 --- a/tests/files/test_installer/test.nsi +++ /dev/null @@ -1,58 +0,0 @@ -RequestExecutionLevel admin - -!define UNINST_KEY \ - "Software\Microsoft\Windows\CurrentVersion\Uninstall\TestProgram" - -!include x64.nsh - -# define installer name -Name "Test Program" -OutFile "test_program_installer.exe" - -# set default install directory -InstallDir "$PROGRAMFILES\TestProgram" - -# default section start -Section - - # define output path - SetOutPath $INSTDIR - - # Add to add/remove programs - ${If} ${RunningX64} - SetRegView 64 - ${EndIf} - - WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\TestProgram" "DisplayName" "Test Program" - WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\TestProgram" "UninstallString" "$\"$INSTDIR\uninstall.exe$\"" - WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\TestProgram" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S" - - # specify file to go in output path - File test.txt - - # define uninstaller name - WriteUninstaller $INSTDIR\uninstall.exe - - # Set a custom exit code - SetErrorLevel 4 - -SectionEnd - -# create a section to define what the uninstaller does. -# the section will always be named "Uninstall" -Section "Uninstall" - - # Always delete uninstaller first - Delete $INSTDIR\uninstall.exe - - # now delete everything - RMDir /r $INSTDIR - - # Remove from add/remove programs - ${If} ${RunningX64} - SetRegView 64 - ${EndIf} - - DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\TestProgram" - -SectionEnd diff --git a/tests/files/test_installer/test.txt b/tests/files/test_installer/test.txt deleted file mode 100755 index a435ad9e..00000000 --- a/tests/files/test_installer/test.txt +++ /dev/null @@ -1 +0,0 @@ -Meow! diff --git a/tests/files/test_installer/test_program_installer.exe b/tests/files/test_installer/test_program_installer.exe deleted file mode 100755 index b84fe35cf2e285f698c6314647109ab64bbe44cd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 48629 zcmeFa4R}=5wKsm|BgqgZ%m9f-`5GWt+5nEs*; zmcXQwXokZeZPjaAuZ3do>%DDXX={~UH6}nwK-4G{v0#lzb&r$UC^QTZIsf0}6hYXFH~sAV`JX>dAbH%h ze;+5jFy@Wvdo?TGn7+za-(qPFG(8xoS!Y>W)7aP~S|0FP0#c);zR^;Am&>xQsn$C$ zBO^U0QS~i*I~GareOjM%FCPC*{RSS6)qjTfi^pH8uf==%#Xr<nm%u}-ocUPg&9Z00Q)?bqeUb`Ul z%xg?!q&&laAHX2x3$z5*A`8a}a3iE6@G#spKRd7Tnu!1Q{vX3Yr92cGstUCkO=2#d zC9)$^$_SNao8=5&Y^e|~)jJi*tVl*hGALQ40lN@gsu2X2Th41ndc^Up2N{sG0!bn7 zIU(#YMjU6Sdga_H=}G29WlLFveNXT+iiNjlF4u7mNC=wy}EtjGV>44 zE7o_m4kNt+QKlEmD^1UrFRib`zlN4nGWyu+;9hv?o94W<`+#`Z@X=bYiP zI6y=*A;+*j?8tPgfEbmmRRBbhGL@qt2h-=bG1ImUilT%z->ryVW&Hv`k5ZjIC?i(N zZAQPw)8{y22CRJ!X246yaw3DW{%#NIBA=8g=iLpDM>(!`*k?gLr(f}{`DiI(v+m|C z8j;T11)fxtR3ZNU)z+T-4(&4w@`@b&t}dWae%n?5PBx~N+as^i8bcup&h%`Y>G zsX5(C!zBh=76+nO-dEqlf!LI7h%D8}CW0f~uUW}{3T#qPFU=n5wTn8%F*?$#5mWGv zArQBvPz~}x;1z2R06DbJAcWdR1@UaCEiQl&g_K93>2!6OFbVw5}H^kn%f*ZGW zBy_>jvLK(MV*Q+m)8LV{&!tKetjg_2Kk0mURMZTJ}u(qUq-!*-H@BY7;jt@wf_(`|1u)&Rm}7|f<%4p@4uJ4b&tzS1XrV@| zaPmR2giDG%rNhBoCG1@UH0$_mh)Ur_QE;O(0)fo}6C zO39l4ExX|KX))Z2n3Jt!6@v;pN7}w;?OBbXpenb-{z}lv8H6X)A+|TLdc*@VU+~AE zctFQC=5tU%MD0V*f(z^-76DR{3?6^lJ(0E(VaE~c$+JI|9jD~VL3vod*!yuh?`ybv zwD*&A-RHUsk+M_ajMg84F_fJM^W#nF$b2Yx5pb6HVJk^2DN(IXR)>}2mPM9JTfpM8lcLvhU(9Y)NlWOZS# zMt_79MLMEnjZ!rcgn9?H`PFBn8FJSkbz2kevJ5R1SPu%zfKwl#=;&JHlzB>+=ZmhS z2*;Vof=)`e_Q>OGubUq4nOVl<;?7gyanS-~P!>EvsqW~J3CNu>A6=32)&TLg*TuAz z70PkKQbsYNQMf}vCMP1JBk=f#*}a4kX%L`y0QAltQ|J3gi2kdYrxp-^aSwZY3EsoD zv*J>Jm7CqmLoUzO)UK&rjvMidGxH~7(yO5d)N#&@C!zP%D~=IcYn%e%8Wlak`r=LmjsL;2r*NJcX`l)LQ56@q)lB@t`w4>dbc$<5$>U(Wgk6p~B5mT~1I~EpNos*@PTX69Du7 zg}sSvPB;4q=#2(|9se!tWki9#9j8KrY3{HT4?7HO%3^@o9Rz8ky9PJ=#ZrKBJ;$V* z?L@%IB8Bwa1HYRM7Yo8`!QGHnZ3f+@TimP_jKF#boiRtsSg0qn0)xK>;K=>xaj54@ zki8I`*?a!Pq#irk%da*_scxpARcjCG(3qY8sr!)0?q&wS8j35JkJ5U|=<*TA@vs}H zY3^s^;8mnyKD*gW1b}GdVIxK8n&VV&T<28N{$&yBVtP}D3;du|oaFXjjCw}lm*W1@ z%$tYQHiI^L@0W;5VKiZEpi)Zxl--V0B_$J+%H^V|C!Jw`%0g5IMTOd!BFClFP}`6q zPKY=d1U7SF7%@ekL&v#i2p-!dQ{;~ri;!|zn&^+ZnFtusfSY;Yi5dK#xmgW-KC@uK zgu4a$wkx&(!<30pRHRc*b{agzw%^oI4$8a=EV?E4HbI=E! zEEBzs)>EX0y@5z4I}7@Zc7XozXQ#0n$w!-#~FE zdl}_ymoUh2Q&%=(Z1K%n8Di&{t`Ai8C{pD%1G?C8X`CRmncQqEqIB_%DdB2^e5qX_ z@<;!X*fsf^(c^ggEo>1rdkf~V0*@jyTvV%oSk#GGYvSTQ^m_XF9hp7m9%Dx2;5itwJjT_b}Ih{ZKx?Rv+h&_;d zA-3A|{9E#cmn7fSSj9VxQP9N#kM$s}jq# zT@vHSe-6EhO@(KSTJU0Qyj4le{8;MIPh#4miYL11A||Ycr6++o1K^y*mxO>_2pup+ zJ3$h_ms}Wp-cGEfxRl1?1F$uDiEY31IfdRvDAcFtlN+4sDCXQQ${y;`J3Z_`GU%po z^j;&z_^3FG3SIy+i`=fqIR6-#WuG3S>$d}(Zy{bf1)f);ce3v% zs|=@x^QcJlkEqqJW3vdiP;QT~N$`z0hBX*VC}CDM8)3vFij=Zqmd(S4P}_;=evMSj zVrY#I$7y)vvf%<^*@t11SjxGa6fRHJ%iP*c^6%>X?8beHosu zhLQIs9h%v{HEjeesbXdy*Kld_8ju^BRetp;)3%!cH>PUzTwGCHtPbVC)@CCEasE}{ z8M0$AYNXC-St+GruYpx6|bdfCnHu^^JJLCe#Ml_&TMTrg^FVUS9b^ z%C2PDF=kFc`4a$(An8=+Pxy7aJD#@-EP}}0kHfdsF$B52wLkcw=3vT?5TWVHc#7f? zqs`I#cEaD4@dG@6@zZQT9s0wuv5}lbw(`_*!M1$#;2Ty)A!}NwcC+#8ndytfp zRY2auTvXmnd5IMes{J$M6Ko23vM@}UJAvRx!FboS zL<^>lr%|&rIn@%~=%P5lgeh>0%||ha?gbIYE09D-oIdjo3=5Qs@oK^(*>OZ^hGf45 zKybg&!)Cz`?H1Xhvmg}nr({F2CEMKgq5$ZI**4&m4`&FT{OTc^vl$>gBhVtp!P(4y zEXkBCb0RE0jQTJgGbv2^T_H)9>QV7}lAsTrgQPtUNN-7UyV*Vgp!$eWa3RjwJkjp) z(1FZYIx6#@XD`p?q-5&+KE}?&&O?W!IoL@dB`X_EMK{9lABo_fDD4&Uya8mhUy;uNM6>7MbB7(Tuq?=Y2$3}ZboMynNQd(UMLQ7S^6kJI zDy=%>w*3Lvfo>D2JhIZa6DhL6sf;Iln6~{&O>#SBgHqunacSU$%fmTx*-*DaIeL5J zhM5P&47tqUtdPemD+`c>yuBC9vKb20$^}^7K~tO{S5oxM>;djJY7}uHLM1{uBwF^G+QT^opHLt(zD^V=faK`>%wI}XNPkM`%i;c zt>IvsI(`5-7TaBzG5m|M;uNke`I(E|gle4ZwfV6Ag0QwkHzSvla*i}PAH3EP*dg|d zV_ocb=mKBZLA;Iek7vK3FxdPMLNnO^pwJ2b8|)c)oGy~F79y%8XGsG0ISkXwHw&yC ziCl!VlIMLQt47N2BV_}$;>L6w06pfQsGMqZ7@|!eceEkpf-RH*Q8Xb;9Y02PNWELB zELzG2?{Leo|4fD_HVxopBL&0|`cMlxkOtY8l#?x`Sfa3wND9z<4{CvSNRiSI4dk$2 zOCX&@zy0Hhno0Cyjo_+~Gt8v39@4rhTrQUr79zgJKqt{6Ezk;3Vd%1k>-5q%|4jBI zih9^9w?QKhUDhK?$LbK}-c4Hn-J#1m$>bBjp*`R}jJ*NY01+$=AoL1mEQB$ySkfif z%bOT{-wlFRV7CKazZG<|0M*$pbxk#O>;P#*%Hn;FIN`AZ5W6b?B=ibYVm(xZ3Aq4j zx?a2?zsvxG1~hgFD=BcIQOuC8$@631Qf{;M0MBk{TZm;VFpXnXT~lEdidCxZzJ=!e zI<)&^bX9FP8||XdZ>iNVYBpB5sZ|4w!VSO^M;(tcCeZXTxQeP;A|H)bR0kSgh(26G z9d7n#2pMPevkM@aKQk8^0?VV7Fk5gd@Ecc59X~-0&gkx8B8xNPcqj}eWcvx3DX`j) zWq>j#A;QUu&;_cv1qC=D>WaqA!qf)T5F*c=s0V{yeT*Ff9IzQci85_#0xY~!w%*OU zaM=;6W;+JJ-Bmr7-GSmTOMvTbZj+^B5yyZF0^_`2L!v~fv=P&x@vg~>ZD*tJ|3y&<#JwmAVsc@s5H_KAK7$(3Rmu+mY})oD zazww02W1cA?PlLrvn)iG=mtueCT2%EtFY1qM61=r0wjWlmL#aYYihI%Inm57(M%*l znQ6UhM>dR+WbT^QH8qhpIukij(rKLYaLWT)__W&XoRI#*t_#M z2Ta4@yAkVVQ^A+~S|4z4ceD8j@O3Rzkbg$hE)iTx&Lia+q8$PWW);kC@!Kx;He?SN zyoWu>J!c^Kj}z+%O9SEp(3BhVY>;^{m15cQIJra*t6zn#&kZwjKMO4*? zN^XC+?2HJLHA_cbVaH(1tVlzVl58g{N6ujR7>I{6a@kZTJ*Gy4XQvjjeI9Um}Qsy!95~tb(#kkh92MNVRYK z&f};nwn()gDlfEC(8CT>-dS?S;PWs6%IS_sl?jqdu>yZw3 zBHJ#Ugv+?WF3f;i0QVcXkKt~*5&RhLPjIP|?7}Y+Zrx<)?QlPZ>xG*%1#QCh!cCeA zKiu!&oYU-r#bOr%)9u1JxS2BmAKd?d)6KLC&%=E!2YNr;({SBzsk7|D>u?w0GHhRtOxZ2>_;kw|SfcpX5Kf~>U`!~23;CkWSgL@xNwdRtcRawyP z7g!Nyj+5;GT_=srog*IkV4L>*2|0_~WBWrNntJ1UWx-Zhrc=m{T&KO(P%VSPhxeI*eWt(0$}-EFXxdgcr68)V>jeio25G= zo##MiG?hl#uc2^&txQnkJXCy?tG2%<4;K&MF`Z}`8c2>y$)ko6O$@}aDV4|szRzv! zMj?L+WsyEh!jXyA(ZU~NAE?%MDSg)&kSxIy1SVk1CIyvuU@Sa-tf1KY#G`g`+%@aj z0l)~>MjfK1@%e$74nwtCG&E#yZ!?-vmvn<)@LdGS`!#(25A(ThoQNdkpqI2l&IsOF zB<$KD!{pn)Nh|j|{k0Vd<2;tGzU&=9`4z(iEoOOD=TH>|e5sI6G;`11L?%DlK*HWg zJ`D3>_O7n6sPv$ihVl&g!+8|3dVfBDlQr^TOvKgum8@;(hApK5C|Ez!?X%_Dq2e|v zd20}%WDTLHKgGG53aiV_)%*Dl;cS=NdeRfFj*~9J>*yA$mZ>Uo3L`%4+D&yTS&yTB zzmC{-(9PPv0g{P_6eZktE?k(2{z>V3_1}e@IRT8gyM-0Yz~MWvFmbcJvq7LfVGZog zEr@V|x$YoX_wOcz$-}1YpPtCkPm?dl$gcK-60_;&RHhEm^UjPm*Y-XT| zP$3BjL3-FfIpR2hErLB?2Skn&{|ce6NP+gYQ-A6H#UG{m_BOV>u|<^Dw6~pUX{r+? zPkY;7xzx}gm5*_dTCa{>Xiz&QMF4$4QM4TlXHey)$9@I4MjQs1WAW5WMKG&Jnn!Jy z*H4fy$HpN}3-KVZyFgX<*z%}1Z5gEV#aT9{7bJ$JkO(99eCLSiF$(~*o&-C$5HFrW zE!-oz^0D@tq2y6E7Ds16vwoO~UWS)etWe>gDNA#}`I8G=d6;7<)HB)14k8CQa0i3H$+N`?+G!3X8v+m zbv4AZX!xTGL-Q17?9eL-YoD=~&wxHl)9yJ>qU(<8T;VI}WWBrN#jLJ$LktvC>c z8gs5oE&@ui)wXGzoUs=*>98?o=Kaj1ejde8(vYsld&F^l(9}^0pFD+#8JoJZhF-9v z%2|wF?cPkFa7)-Rytnyv2;7tbtcnfj_3l<+Z?}jCHo5y!n&BZwf_J+Q)pZLfoiAm! zL9NPstqVzzw)Z4j9z_LTmomeJJ*X|5cK}bh?Hus#;}M1Zh}eAu5B4jrz=R#xWPT2X zfTNg{@5nSgrYEo8KN_3jzZ|=vQvtOlkU;$hlwhBw{x9#2EtjQuGAW6le4Z{2 zMjU28)J^C{S3%fglg!f3c*B|0&n>UTbYThW4Rt@%Ow1S5f%5`JDoe~Rk9fot4LUtv zGD<0=(`&I)S&gkquxHweG$u2WT1)b*TUbS$RiPx|}ZGQ;!i3ycfl&|Ilnm$FI$J^K#06zId^qvb}W zlJzVhZ3Vhs$qu0adw{2ln>prH71+)G6}m4Ba6q`^&7VRnMl5rA*bir5x(vt0v@f>Y zzobx1DYu<(Icqyl14A++P}?;X%*M@T15i--H!z$8m;>#=OBw=%? z2rm(@g;S_~X>0&ZnClmmoG zs{#T_Tmp-dkEE)S^|adHT$h{u2Axe5%i+aZsTkWc6>J+f#~z=WyWqJPYUc$bK$YYz>rE|Vl2k8$qrhc?DWr8vYtYv zPUZLL^&G_IIDK<~7MF4yEBfM`*|b$E=FG>)ECfsf-o?PQpuCHPCrmd$GiV~sKZZT` zfuii9vB08D)YDL)91b85rgza?r}%M+PJ}Y}>}Qx9fH^9pr8A3*yw3YEEqDO z>?m%%eA_*pBhnXix+9SUzW6SB+c_fM=#ekWw<#O2L?e@CVu^n+-S`C1+4YVZ&~E zp{Op@uh4;t&`>7$ih4rI<4Z7;w!ZZ@`Cb8iU>wz{B3%c(w_=R> zu;Zu!mJcUT%EM$lot5mnC|b$x=ioqMyqJxSSF(Rbtj`_8N1t4wo_b$wpl;1?ov zRZJ&^=2>7JGtHqc_2uQY^4q58-#q^ZUB*tN=nj|H$zQLtvYD~E&OeK(n0iC88{`UY zIE!GGD^kN*2H+)9k>2@^G@-8j5;XC&m&t$_+ig7=`*Ap{fS`Lx13}qm0qQQRVsr}{ zM<-P*(xPY=KUBtTBz#`Rae@5iaSydWyHy|HOAOtjK1mCAZE z>p#I~U5;N<=`#V9*FpV|ib z&z91GW+1yXYzVa{>gb$`lDjA+pXWD)G7zDx&yiPW`UD>s@M-WhWxd6B116h?)$-KI zzDYbpMm}ZzY~PJMREm&aml$JpfFKv=h=#iMkG{MddR;HS9{SKg##EvzdH*aL7bizP z-}ROEV-@OTWK<1(qzB_7l&TxTw)aI{WlZbW_|^=ApQ4RTKrL!&#S15J`OsAQ&S9KU z-$LbRf<7iz!oaElUOdWCwZ2%Yl1IbF-a_LqlK|p#(8W$*^`WfKcCkOfqucLfQM_rb zP7@M?VqjJXVv;fcOzT%5{RzB7oAoKu6ty)|Cs{-C=MDm!rp^sWjcTuSXW3OOnCq zyNK~lpd9EBk)OvSsu_NNR%Im+Vj)+VBqEyd=#Y^;a6Cx|Qk5S|6m@#j;P_IAmiD8S z*tBFk!LQ`ebPCUQJgAf;=ez2(vgH zN0PB{l}n5Ok1SktM1u}|tEaugB}OFiCE_9U7{GFS&9gKuBr_}tyurQHxMXB=CxN2M zGQ%3oeB`k9R0G{=2NR||m)m3N%)p4q)tU0Q=XWY?g2^X^?R?g!S8RO`?4~3u^@b!Ug z_u*{unDZxq7D7L41-@l!I@A`89zlm149%jRL!3{)5p5zqPmSj&l`?(Hli7MO?}4Fc z4UhrkkU)^9aM8p;knWWo=3ZtdrK)ot62Ws*sEn!8LRm9t7DqN_j-**k9pez=boz#Y zKp*v$x^>ivEg2J#6#DS8b8LUu#L8$l=mPTKE<(Af^DyO3BH^gqmf60=K)Wok+-)&x zzyV=jzH74V$;P?$+{5h`$j%e4B!rXV+Oi^2cCG^byA$nEQ-x0fFFx%SP%hRg@|4F3 zP0CT|niL_8`VM@Thy?hqqKrZ!BeJMX3)J+TXqx7$v^2EEoFR=zS&dJXm8!@?^dxNd zqDsFxF~^QWq{XHJg(Q4vS`(H~C(I=@9oUZ`8Myr#Gry2Twy=x1x|Fhum@weeaHdV9 zj~PiO*#xbUaZS2OSwG)Dg-B`$x|Cc}K=yk&%jrzwj`f&nt*JIP4~@Z?lA!w1T{KEA z955J^n+s(7LLAv{KS-q$;Ciqb{4%ZXr3|-=wNXWE0SG4nffT^$MG^o+7pNu9vLW3RK%(O-nZxcLE~ z!GUl>A*+=-%eu#7p!fz@kk%APo85ky+XO6Rse2RZHq>WOBG8ktA*A8>;2y*)DMv7} zvXsW)nqOu-hvUJQ=)E`1BBATA+ewM+H)WmnCtRU zwe_Tnxo#ly0GOtj2SZ_>IG3)%keLuxaO}@lo8SN2s`@O8SOlGe#==z>w1DHDLh*BObWnGgw)tNHQ$?>A!5rQ#5U|fX7#SjgAu?jh zbRGfF3o(n_b^?crO+W8T?`7$USSb5C+_vE*{VD8KKBF(JcJl;{yk7#6-P2T*CLdy9WX&$YM>`1xxX3clV(Cd}(@L zxQ*e4i4zACsfPLQfX zSx;i#%KE3kAHEj4WWmg6JBKy*^%FoP9^W!dN8+}}VehC&`j>?+P2Y3~l1oO9#2?T1 zXVILK{tAi`f4snd9fcl5$cjCze15~qwEX}Ok0S`Uw-v4&iYzq;7h|F_&vbRJgK7To`feL1Y;sX+#C|qz{`_2=eaA z8H7_@)uWiO{g8nAZ5eCLz0bjdXipG;?!C+#EEK@g%Oae&v2q4 zrjEO7hr(^gF#NGOM-T~qnFwKc@Q;q z9NL(ID|ayiR4~{tKi4?J>8!R7R$DS8S`VEcNCMf*3^RLiOB1?oe%m>*Ty~smZ#6VR zA(h4{%~c-X4FFt4C{OWI%Ir`pSl|TNUX{2ySe$JL8E{$gYD^VkW`2+m=~AGsz0G_9 z5}cOF3H7p211Y!=VbJyMNlJue(bPeUV2{)1Oh(ElLYEW~`?bUQ1y4yjzvVs``!zZP z+o^>^2d3QTAR`dA&@!(|T-raDjHsSGybpkf>uR^|qPc|`LhFt>m~5Q55@9<06E36- z;X<$8HC`uCC)Jd>r<4Q)I`O2cO&hV?G;B@ncse9*4+n+{1 zBXBg@S2k0F#ejs(|gE)#X6_;q*3#>u_V z%|R_@Q5Wjb$!{xCPw(K^&}qZiee&DA7gBURq0^Sohnlhbil8f1__WDsMklB}zKmp0 z0YU61-Vd5lPdk~mJ&1V)-H(vXPyg)Vg1*%(Wj$opXkU*MFwE#;|{uMy|a zou^ETdZP}Kymt`i5_xUMJ-*8cUe0w=DE?Ok`K_N{E67nRnI2qj>H1Kc*&?<1X!5Zy za5w;~o=%_yIfx{>iMFMwBoeZI4xSC2r-C2!V0nO4J`t9Tn84MUv|nkw0gQp zi{?6}+Y{!I><5sR*wh)uX?5%iY{d{lAM79z%F9C?tr~^LG_P z=(?bw+4hrSZtBiCwm|^a8%AW5ixu|VRLB=#ADY}1SQuO477JcszTx_E>>WCgLO;_ z?XN<8eh6n8u^XKmI%vFWq-0bhn#i!B+{WIbUK*|(|OPA4w2`oVm`lWF%81!z5}G6QKci4dJ$ zx-AL+aX;=-9QQCC;6qlraV1r%dm!RX{#MoaP2i#~*F;d~7BPm!~V&1H5fExYSjpOp3f=yt zs=BIP6g&VF^UGCX=@`!S^Wmq$y5YLM)Qt3!l4UlK-3K)4Sv|-L513=t3#bW4CkViv z=nK#WxXNvY*4~%GURx>@174@K$47oA|Dhm8^a!c|gT>)KD9tpy5a)-;*g0zeb*YCB zh!K!W7-Nqi0XjWQpa!|W{X<2WCWH!U^Gy&_dRdlqd#I4MoN%J4{c}OcRxhsmPJGuc z>^_CZt~D6a-GlH^4ZF|40}%0CL-RFb2tFn2#J6}GWP2GZCFIkh#lwCC!WnTGxfSzz z8f|3bH|W%}tkK7j)g@OO@lgi4z%zkN8M%l<8Lg>fI(*&ic`!jYYfHtF{-l`UoBe$Z z0o#gT4Ev@#ktMi9kj4ZHDPxs1mfuVAuzFlrW$`1Mx%d5BE{d^jY9tTLU&qc&H1*n^-Tl{p8+^sQ+if=>#n#E)_>$1>R&qyfh%BZ66c z+s)`?otu3M7H{iwZ~2hD3K{^?Xs6$Lh&1vidgWd&Zy{;Xa34UKm`V+j9#TML=)`NZdM4K zC*+)`(ybgN2BJe*Tc7E%OCbDi_A;>#UNKMn7?G6tN4(vYz6IbWKK2r+bY#7ePjFQx zbil0anT=}P>}!}8e!UO5d)(|TjHt{)Un=2-oJ>>4tmE)1(Y3VR$sKSA7 z`7~i4EgR_YxRGfNpU2{TwoN(NQl-z>LVWBCnDl|5dn5YAJjTh0C5HOay+>z$1l&K{%v#27trWU4a~-y5;IA@zlzT9?6&&0Zab)B6o+I0Ol6WF4_=(VX-x3q zH@E2b7=HcD;OP&77w?vId(1_q?(sz-BpOZKXKlx~q=Y`5AG@KzEKQfc2z~rP=yK7f z>qD1IwoC|}P7CcDW9l9@J%3*J1r8@4gr&^%JkIpvlRWs)3w4k~$04L0Gk~YeIzpF6DDF-?)f2p0t};`>8J(%E zUnnOY_GeISv;(2grCHKAjy?#WGiW;YtBbfp199l7twK zF5U^j zTT|sfcJ#=X#r#TnE(wW(Y3pY=eFd2A%#U1!rnUtNAq=5j?YJcHO+I{!FX z)*$>i_X(kLhJ?zysOe)eQ0t+2VQG-u~Q=FjJo)1qtRM`H{)o(<49fEaGjr zdp6LLlG|GvGsutZL`-fkYyr{zuqNR%A08j@*meZg-hGI`cNmniBl7E}7losPV;nt- zqd&CY5W1ubzzp3Jis^dS_2}?99hp9zKwp*!eVFz(3-ua8ObBn!M7yRA+GH*j-KAn_ zsj0IXm4@C@`clWEW2gc=G|b_{ed(|YagiQ9lFRy?VLS)IyfbVk0h8o;eW@_T2+{F~ z3l_%z0EC-5cOr&1+xE5|S}GL2@cL5Wmxj%mg{^Pk;)ecmZ){BA3G!-xnP%!f6vn4{ z^o4OmY=RLa{u-5W`dZ(CF`@xP>Jt(6^Pd{ZsGpr`&z^XEf>6 zLd{gDnFwD6-mk%TlaBB1%lwh^D7vcLyC>zI7HcMH8Ed9V%=)-Bj3sX#w-UHq@YY=K};Z8hE zk1j_Tq&_Yb8yBiG2z{wAz0pw^?2Ceu@=FXY^)ZXuocy0ON7JSprrjP)8B88icUS~{ z(HsgFZ#SZ!N{IpIW_qLPpiGfz;Q30^w_nqAKAQey zOk1Mqh|z3&FYsQXX46YX6^ODPxiX%6LiaX4SyZA|+mz$Ie@O{_GA%SXEz*%jHseS^ zx-D*cbQ8`f;PX{xT+Y3qF@0wp9c0+F-2i!^L;z=aVG+jk4(U8TX^6^bzy?r9@24rD z)2K;HHQD-2-+2>46X~IUq27b{oP)yD%c#ZQ62m|d-35E3@*GeRd4z^&CG^ly=rA<3 z;bqRNET#g3<-wtaVGNVNFT&GG8q&2NA{9q!@I55Hi_hyp*kA)DmwQLk@2FwSab^`0cHbYmr8N3G{=)?<$vNG}U$i7tM z2YnlpwD2NE=f6e^RM}bOPNR&%2q;;Xwu0 zcJnQO@c*-$|Di+1KDzoTL?1$()S=E4^dnquG`&=+jp)13eAG$JUF}ZA|DyG4x?@aq zr!SRgPj(E*Zbaq2*&gM5^>E8Xm8s_*&V4hoO|#|<)JC8n_b?81!Vo=(y<9*ew;k(L zOr77QDmZtx_2K&xoQEeE^kIC%XP>RNB`vpqIllO%%_S2=EwTPbIO`unAaiem^+S~) z)_);4eiv9juQWF6m!@5*Ig4uM+11KZ|+%(MX!(8n6 zJ}|ts+|XsZy%g1vwly9Ahc2b99}|ih6nvqmtRI7T6|cXfAyL)1C%H&HOiEjtyzeV& zo9!@3;(S%+h2n;ADsCmFhT&wZ<+if-9}D3y;G2*W!X4;(w3y#6m&t zegUH`KeLy{{L=bV`I$WwE-~hQ0KuV!Wz2&k$GK2WjO;k9^_tbdD`nALvc;wA@*kms zk?uW{VDbNLxSK+;Uxs<5s@@N^w|!^`7(##;NV!;z;?O`pzku27e%lsyJvHW_t&2lde7Zpc#VC`-@y#6dkv23&j zUl6h67eBE>(m@vFS6afAY`rdAX_4D3;l)Qkie=1q5 zS%KTa`MDp2s|QS7-$A18Qn+&!h%}sUJ#>dS(W>ZH6h4j*)7=r?R!H&EU*u|hB2OM0 z+7CTPoEX^_aUxnCA1-);RMe&6@weOBjDbJO+wyoqwIx(`P6>HWVGbDaHQVziZDkBH zKio;leU3pY749UvpXsr)Am~Vi5?K-15w1Le&raZ*L-H*+zS^-LDcHco=akAU<+|6g zPk_~JxNOL@{RnVd5|)N#iD4HwR~oWOmi5SKp^xdllUp{l6d%y79L7qe?F_9o9mjM7 zwl`ZcV;Sg{?j1SJHn2V|cc94jX5cfqayBfa@`R&4YE%JsJA=vp&I90p_>_A>W8h+&o>ebdtOIPKXE)4Ly&<8#xUe|j;n|m1F zOiHIUgz-sCx3bA$4Za>Ezo)~SE0Fz23`M#jHV7b@Di@Zo}BAoSa)`mMgP$hqh*p5AJh@9E19!Rh|l*#g}t&6IXus=;@f=`o-Iyb{?RXYt0|YKwgS4%GH>`AjKpdx1wwQJj_ywH*_1 zAs8wM|7`IYJ%&bcoB$!1w%>?Y(6eJe97FepaSotg-4e@zMW`9eab;EmfBNwJ@8AD> z7?{&82zI!saO2<}hwFd~z}3R7grna&i8x;nIyYP?+^ukv;mmLX+%V2g z({KAmLD&iRKjHSl9fvy&cM;C~upn6A7Qo#Bw-W9FxMsLV;C=}AFK{ow1(E+0-k-r; zh8y>7LAVia9^7KM6>wE>jd0(A+X441+#a}B;NF1?ppH7Yd*K$t&4-%-XM`KUb<5Lm z1907Nd*FTuw+U_y+$y+IxZw?ga2wv=fV&aS0Cy2_M*tK3jsykaMYw0-9)}CUoq?m@ zsWvF&a2MgyHv?aAbKnZ#@M$z*HCzMSX1J|zPr>~g+`q&1!~Fqn2<|f61mO2D>REty z3EV2UI=F}7w!u9E_X1oG+%dS7$Xft6A8sm~5pHA?V1hdc_afY{5VsR<2i#`309+2r zK7jYXA^mB%t#F&*M7UbGm2gYp=EKc^n*f&zcM(%&M=aYY4v7@A@a>c5uWlfD@psB&)tZDQ%R4s25 zy@AFWvA(IXrh)Q(HM!W^@{rinT(#2M(j*1edRH{9t!eO5zWY{s8*A2it25FCVOA}4 z0(=N$LruV2RaUVB zOqgvGh3kb$!Zcx~kSkaPo3Ko932TKGAtdY;_6r{gw1WJ5KaHUN(_%-1{^=6`^k|3v zr6m5*AOC1Z1sa}*;?vN623o#Bm@eER6bUs#yU;6WH0>IVR-@DCHK`hd#;7rCvNaaX ze2rbRCfPoNY?8PIFPw*+D5HTl*DLHo$}!ZrD{pgAY<)n1eDS)xPa+jdRdFydw- z?iA*D@>dL+Z4F?qUlX?jaX!TTz2ATH*#G9S|F`g1QClW86xU-WgoI*mgIDyH)HmQO z>hB08U~MJ!ffiAX5Ki%!a{M_VHR4SkUe?gm;uR+8TwWgSY^o=2D+s^QuJqQRJaN)z zb)G=ITCwo7=60{>4Aif$5xvepQynt6#6W%HgGGYyuWG)3kSYs?X*K%fTVe5YD_)7qli+JLvE1w323qN%1fk?v?kD_bZ}SyQdl;4Q6b ztfkHh_fnjrwO(9?KSu?y*7CADbe@`ev7{;B0(=eLyB_d+*NQ@1b9+P612qjr4Gm3e z1tk$8D4!$5sEZS7@VNRtGQ+^%BO2pTBvLUEj)zvcp?lP0->e^ zu2%VgGUyL=iEsjL)PDf8WF1E4TBu!#Txw5`Ci`#=c8+kU8oU5XcvXe4MufkY^13#* zh~9PARLCgyiehr7V`aHxh4t2XwGGgP`UOX0t+NJmmT0#)P_tnb=68{B8gsj$VI`3} zu9u+vvW9xlGLOg*mUpqdAPBH{a*<&EoW8tU=) zz`SaW2heKG0}Woa7-Rv*>@uN8LvwZcI<;I7^(01hMHA-_<9WV@2bZIRg76E?@|I)` zXE-lXLo~@3Ukd}xnHFZAx!+Hjfq-6S{$vy zHw0p2#8-=iXN2NktL4MAFEL7G-bP8qcopSP8>2|! zcIrE?TpghQd1XY@@vRj?SMdc@CipCBSk?qZSZKW3Vq%2Lc#Tq^1*!kesR2v?fg)ic zu;g9)P;tY9OC?bx6}x~+CkBQp#~&O7^(?Iy*VTZYG&HE)Q3>;xSDT59xZo8ICDqs`+BV4P*HIZ_CCFZmy(P0qC^2S=u zy^DmooPwMI?|OVq5){0cu_y zBH=m;FMWu!$3;obgyq%M*1w*JT^f*De936xv4l2}toI?_7w`J|wccel%`HNfT5qD2 z+l!Yc0Q#ZeDkWA23M8XT?OwUA0h!q1Thn4xUyq!2bDW@!KmF)t=@ zNmE0u7bF9Y#`6*PF9|fQTVA{Z(*g1O)p%F4cP(a{nw?gCv_gc&Q0iEbWRM?fFoztC z(mHodgM^mfPloUGLS&w&P=(|TY~;yYyU^3D1In((yiK`O0zfIs^g53r#R(C@2@0vI zSE7|;S7UfPLlh>GOO!7vb{9F52*b?a9FzKXe}dCMr??siRj90{86s$_R@sdQPBnnGW{tZ7^enV6!vtHE2@Sl?JL0$U`rKNAqM{A$>XQmfEJnRgvm zgPIz=iP20KAb74~2)GxBpV7!AB$7ISn!giE>H$8v=ve7mepk6FuKwO)>c8Xuw_OL z#f_G=#IY^Dnifl44Mx0no(0CuqI^NK7Y3*TwF$JnrO|1ng znx(deRDoK{I&W=#4Ha$_Yu1Vu(MLrRKzyymQX`4bfGuK^rRf0?x{Rg9(&*h_Sqp7( zUV3^Nq&ixvYYMF66WmfGE=u=_V)LS#Z*FXm3(i{iGW{#QR9% z{X*jXG~Sdih<7WT53UNX6i(&P9Q1_tO`Nslt`)_OmDHrGv`7-0Xmvy5PT>_EFg4-> zl`Y-?l*$^c_9~aJsA+sq0u@l1qFTSyBCcwB$a@vx)VCE)O%F-USH>X0MFoLaW7k_@{pWwz zTMf|11MrWCQT?S|W5PsCT5II}9coHzd>FQq$GYDCff}*pv0!uBqwz1_`vJ%RKcqjJ z*1DzZy{FVL(pxt?`e^*UE_qKfy|uNqd5rur4=2*`HL<IR!1=BWcNQO=4H*COERFr06!-nRrE+p|EK;U6sGd+T7igMo2mDZ*H9z`-` zKrH_e2qc-WLkrzXAiiF3lY*#g(`o3g4PR|P zQT{9G*T72|c{ivlf^s=c>4|HUo@PPmu?SmwfI+w=s#}9Mxnx+-!LNZ6{?-Lm>es~a z9)-IM2M{$%{6BG{0xqyzCBjm};b1E2#?3s1HgZ(uA$TSR8v(k@=mk z)UOw`_B8Bqq-(w-&`0JJ<*Vt~5xLtYd>2p~1ik)h`d9j|7woEBpjy=5f4%=fXEyd! zKF6L4UA>%Cx73i_ofo%}t?Vkfay21Rn@Tb_@ z?E?0K#%O#3ovUp} z0_~Uf^$KU)GH?D2ix>K8E!4Nd8I`L_<}RFJp`}tS>^6}H0Sc(!0Bekuo6)mrY z0gkllYhjr;pWta$?VvD|z%UF$`&tniWZ{gv7v46*LK~QcGw3fD(0=7SQbkEk^uZuG z!y;~MM&gG0M(eFJZeCna>up&ZsBfla@Zw|%OG2@?sCFOA`djBMxUJykYqJ)JSoy;s zP}lTd?5uUh;(`{eNCxZzwj#Fr=g3d`kIZ}UL)h5*eOdY*Tr+%+VUrR&n+t>fiQMy(niyI+g8yj} z@V|XK@PB)KKr;wRjb`){YfrIw<- zJ6cBDiLUN91Ov*+o9CNvIv0%N&s(SkQZnmmT;~3`p2F}aupo`JHc|DCjl|67Tv;uj zw4-(n6j=o{Jo7`86g=QVe)g@XHAuDIyZV@w>zgo)N3cc&N=c4fWObo0G`;s1fb>Re z&bJ=lvBx{8L3Qb;@%Uny-9JuvD!VoU z@N_kNoS(*3fFbLV6U_8z6XR*C^o42}TK8$X%ydugT$EGbB&YUQr0#r!r`%w5HEmJw zaG+FfaV(GmJ(8)}-A549xRA8%2WpNIGP@IFR#+zt;XzN@k?maZn@gEWDQud$L-g?! ztvaD=Ow8VOjH51m(pHvYgF8AtH?0FCW+{W#^zS?!JR-~DFoPXoGlIgWXLgV867o^X z_IEd3TR$IvP9=1yvBVBH*HZI+DTgWS`7^BpBjQn5#J359`_@3tO#`)FSHh|mobX!{ zl>bw2M%oRGE5cn^3Ay*cLzGvOyWxQsags}F&NY7MEZbo9WuWW;XVy{?`lnB>gtD|0 z`v79Hs|M>P0t3Bz>p<#x$S#Np6s@o_r=;p=HMXnPnX0C0lEkpdJU^wgYewm$J59nt z5NdciSm~JGRAs;9_OmZSCsd$UcrI~*Z`|%C_n1lEqCTpxI!8-0{tRm+DH#OO`?23} zl%)}hXHd7C+e){cW^;|YoxBhhL$%Ke6m`cA8M<7(MTgI;u&1#ka;x-nf|EJzBVplB z=Q4WUtC@$bI5=g$s#%tZF*AwkMXDbQ)okvgAxmhA2~L^RSpwF@!OIUxLxwY4=8~&Xn5i>-Q+J)OT?4 zT((9=vny@W&L=+L`HWPno4bWnSh~b-t&l=OS{;%+qnBS>O`9}s4EaruiiS#CHu^OB zalhoX?=3X>lT6P8I>bj)msv32E?*@hy5bHk`h8Dj|V~JmD?1^D2Z1=N~|Qp@ZRcyAWA67Ej^|DL z8J_7!;Cpm_l6MlNim)hETa@uKFHe*>GUz)%4vccQ9FkiNX!t>ItyM$f>#cn(YmH)g zta^7+**XP-z#2m{kXFI#R+pK_aItXWNQd?%Tf#)ZdJwss5_((~xAo7U( zEvl4|9aZJ6`g}s%w3fZTww$ylG4HUiuVstZX+Hiu`wsvuQ`=xkQCrSxqVlwn5ci78 zJSZqXVC`3dXZrB06%$grx*P->&aYgmpUYeG?RKUx3)mU7`#6ThZx^3^z{MvP*-QdT zh1Wy<5I6-0k3J77QrE+9njPwE5y&co)*t)aW~~6o@_^0!uEtJk&ZXmo29gdxS`Du& z)(H&#nul2{XyTNL;)=*ul&Vvq-C4e~Ea#z_L?MsQW@wowjoLf~Z%TFVyR;LrHCpPcLi{W4+#W ze4(^J^j!)?z47()ON|zeE`v+%3lD&aET8!W%*$4WLk@{o747$(5CmfTfEh&f8OfBf z-pRcYiBcvxM!3Wmp4Nh|9}5bU)V9?*H`OaXZ*-4Ywq02q9IjFV@njrg=+RIKrthDy zhS>oMqC}p+zWXci?Qbo67mJ7-b<-~WA*cI+%js$uyV|9K^B;?Z8^ntR$fdi=+{kha zJd7oTE5hh0)&?RLv@#y}hpkuR4)I#XX4OhRq;(w{aT8wH&=2kvs-Ypj?u_ETviRJ7 zI@OlN?ojt34n53sjd9z3&OMc_KFSF3aLo6*I5wHM2#p>J5oxyc8}6?{ z-0tLb=B7M->Z2kkfpteR1R9^lW&xT@)d81p%#o>ME`f*P7Hn&^Z4#wYF_TEMP@~ax z{57Q<=1*zfRH-E?q`5~z=giILAXqEklzcBfjOxX z_yU#E_yUB4e59!>x-gY_}Pu#<@I<@o0%GpebB~ozPY?5sR*XJS6=Q^1K)cxX*a!_`%_1IWj^~D|{wj49 z4E{DvFPdVg*Hd{B=qQx zaGDv%B!4@uxs9-YE4;uAl>tX}-+6A4xh0;7-J(1Rj1!O-7;yfgOljvGEy~sHplxeg<;49C`ok{==7>Sj}P-D7RiBoWH<6R z3f`*@Y*Wi}AqH02*@!De%eM#s3Ns$nzZK56}!e zqi_N1X;@dRKo#Ka=SUiyl@TkkGB4!T$evduW)r}XW(9MV+C1iXTRn_0gkrLm)$77R zTg}@}i?5KVpEDF0^kCi&i#{6rjsWMqVfx_xwV5KGXP$77c?fz!icdQ_F;X|a5B`o0 z3mOb7;Yej;{f9-$~Irr(X<9c=fPGF=lUolCXAX!+|wz@`D< zW^f)PUcnmHO)D69B%XQ!;P)yC<@5}a5^$G+y7_#b(8Aie#oA+-$<#+B=!qqEijws) zHJLBA4FsE?5EtFe&r$tzMF%18&ua7JSe`!>q>QE(k%t<5r47}(5EzM+*Ob$4_)8Xsn)%J zjWz4H=ejV zV#lYNZY(rG!0{lV4}O96CaFgLAvCsgR8NIpvX22@E#;wxN-zAK3?<2>(?KZ5F(bfX zM0Bp)5NAS%)9CalRKkm>^#`gG;qv&f`56A_RTpB(h8Q9yZLgMF5maptd<7hhxv*UmS&70330*t=3*&HZFn zxE`(tl~b_Qbx0=Hu?nyb2y)<5_s$jOJo;@|u3|4gMgU7Jx3}mUyPcv*3y;K-sZCWg zEXSBapHN046hxN_qgMG2^zDh`jI(4W!T`h1(|#RjYa+WzI75mtiLPUNZ2uYHZ(4HC zD>#F;8AAhJd{ULLpgoR`~f$uwlo%utiJkGS?=*8rZ72lm?Sdbp{jrUy@)z>)Po5?_B|YOguISJ0A)j_Cj_YJRff^QrcIX4 zG#g&nKObX6m$2a0Rw8AB(h-HF%ul+`>PMY(<-W^@Eb_JWs-oRslgp-GIry3U6epF+ zIm)VG%tMzc8P+MF%u>+SKiX!^<(Nac$pQHUrM~0@&p?=_**c1~4o5I5y(!nX|jGqkMe zU`}`Tv5;)a98p&^s4Bm{6)Ud%yAo3SE~3G9gp{_uBRmLF!4A?7nD2PS?CJeM@aAX7 zmmCi+{8vDO|#G9NK>b@l74Qa?@Sm3va@0~+0&U(-)=?mfAhPYq|T_* zFhVKTS&;^Qw_Bg06sXd6Yazk%XiDW0O{!e>@kzp$>H2m#QRLRRv~}Xr%#~-?gsd&qVV)nK zJz*Z>@)m`MzmHtugW2Lmmp#E!SL^8Y;*fkx$V`hA)Y8m;&+pg|c=$c)FLE{we{j3u3AJCk51dv?EVUIW1rrY3tnmQK}! zD+A;(l6DB<@)LcQd%rgJ+tbU5^{F&48&X zh_*Dnc!$@JqAYHItPDdh>3h%WfpFM{;x{+@2d?&>mW9c}rd9;oKWWqHB$C@SYNL$3 z*8N^%det>AyYhY8b*L*>XB3xLhtEBY!Yqm*a)gA}J$)ay@|`Jt{gi2Xoiq2J96g1_ zddU5{6uo+!8@t8Yk|pO}BS@;*zF_7*UT>0<;TPove~x1!L`B@cG)ODEyF9jnq43nAf*}pnYt9^A%*bb z>ciq~qx@C}q322^E$yamWhTkFbiqYxCjQ9^1FKod4hKz&XzWK@HX#d=LbXoa0USkk zCmgewc&Np$m5XqipF`ul5`f<=bUq;q=8!;wwQ+4|w-_q&oxW*$rHIVRCiJjKYESkY z)Oh53;-L3bRMHaTw&CE9NiV?4*R4-Am<$=54w}mp7%wF@4-f;X#d?pnC$`1srbpn zQ2>409M2EIT6_iUN>A2}d;iof=P2%_IQAGuhDwxMRDzG52p{6;&1sOx-SZn)t{eF} zchmBrJO*@LvOGNxSo`1L?qqxvsFu&n4f6J2kYxB+JtJWW+hA)+LcBTydk~gX(@wJU z+n2t5#U?)}l;B7qN=mc@7e=qw&#T>SZD!XZz5O4?^3sNqZ4p}0K8&@c$QDwTp%jdM zFlWG%ofdwMG~mdo7qZr_byvB-T+ce?Tt`Mpu^m7~*|(Lf6KL93(2pYA$jb#Kpb^Au zj#@`;I%s9pFI1fzKQa?2M5UnDj^mkMi322Qy=HliY~(L zl2FTwE~4xbPflv_vm#D^qSD{B zp{}l8xOlF?YGYZgY+Xlq;BE4*88M#t;WmJsZW(upBS9DUhkr%qx?d;!TK$|V<}dXI zcAEvEf%rt2GL&BlwL(=eG$q>VNDSYyLY#kT<3dsvs30-Cq*-!afBUKpZK=ko#=%}2 z$GOvgp89XJFXfIv%>%to%u$WiDUpHA zL~V{zTkV?Yj;er}hn24qo0LjTot(Zls@lg|L}(A`VWLIs=xh}xZ!4rzOH*9ZSzZ#p zk=KTCCIIunD~KC?KZhL2=h2~6074V)QA$q62*pl55&9Kl?Y5sF3K)HeDX}8A!0tks zP_CvK<3T*ZA4iJz(t53vvm89aE=z}(qq*4Z!>SDr#VWm5u^nm3s3q^^WvRXWM_bU2 z=B3gUQ)X-^M3ocNqR47I<-tmVx!yA9y8?FySR2MYO}+bh_sO&A)#bVEZhc9=?$4ml z#9Qub#ohEB@Wk}APek9a(hj^S8$6EjR%NHZx!DB@&c;H;kfUyH9#Gt&xx#uaKR^@z zqjn=V8JD*$9w=@a>9oQ%Hd?l0vsZ6_?;!8U+vM7K--vD6&N6*4U}wzjK%k62jqlQr z|D|x7r~fuODLNMPYg?}$6kUW5`#xGW&(Lk$31-JvNYRj1TxwAeobMf z^OsqHG>cDitM4ppiQ4(0Rm0mx-r~I_ausfTCX2-NF?D-%yGD2UR-nd)8Fnq2j+^ir zXLSJcU1j@jHh}rD;6}!YJ-IW&Gl4V6GeeuH5p!0eEN(VdIH%MzJ08Ah+=(5+ewzO3 zt&lC}-tBZ#wHS`!q?g143h?l6a6rsnq%4G6q5$^Dyb3Zo;HGU+(p^vORY;! zyq0i!PfYEY$8=A*^6MR@1@m2SC!M$UW?5|8MjEuJB;^xa95uWVc<7c<7qOY}Scff4 z5!38a^t_R} zG=dv~!ubEnQusf4?c)0eT>spA&p+`yRUNg(6UXpn6w71W`z6$y!lR;U7F(rY=2(fS zYOjPLmOzWJ(w?4 zBqx`%c^LJWccEV{X|yAje|tRT>)<@UUn^a&4J-amwgml(z$S3B`(aY}fXtI7?lm~t z`E%lp7vb%q@YaMQiHO@dT$|nbRxljXZQ) zDo)rq=oR`Vrt@~j)lv*iPtKWf_I|SbWT^aQeV4=l++z#pXTj3|+dGyAC(*+X-wKy< z4ej`<-l+#2?5~*^-o}|mc1N#d8lrbtvul$u+~1h@hLVB?clMLs1_S#!{ToR1uI7r` z4&}jO;H8f547UCAC(cZZm7211*oVEo3~ROZ2C~MLW$c#+q0?uF{QDJF()Bl){g4h* zm+_X6o>RPpbHa^qy;t6yxY}sLD!Bd|Q=M@_xv`K*e-b&@=y1FSs?5ofAFEF^B<^f< zY^p{NYKrrKL`X8K}n8DB6FQ1uv;h$w~OWb;ZHlX15%)W^7RqP%Esk_GQs4l=ArIo9=f;g3R30uMBgR z^<{ow3a1B-TBg1TkAEP0714UN$#(dLHjOe+=RK`88OUWB41LagQ3tFUgPP zH0sYZ%9vN3ds6W#p5eo#vA`XB5jBzlZBwfGM2=(yW0ips?kvoJB~=Cbos>pz$c+ha zvd^$r3z34bcrS{Qo&`E?)|juf_hT5yW{(*bl~Ntut8afqmVL6LYX-4( zZ8IscA3_X)3Zc5yLWuG(8$_UMmg8O-wSow))6=oA;qUP3{+8Yeo6qh0>lZKT>mE?k zr_2VlnGXHA@@O)x4V6Arb=D&KFzpA|P5%4qUu5<>41EEdj}#la8{P(h2aE^g2mD5a z7swarzl8NKVf{;3{}R@}g!M0B{YzN?64t+j^)F%lOIZIB*1v@HFJb*lSpO2%zl8NK gVf{;3{}R@}g!M0B{YzN?za*@E9JWMYEmWod07hhWbN~PV diff --git a/tests/integration/tests/user_scenarios/create_mysql_database_server.rb b/tests/integration/tests/user_scenarios/create_mysql_database_server.rb deleted file mode 100755 index 872454e3..00000000 --- a/tests/integration/tests/user_scenarios/create_mysql_database_server.rb +++ /dev/null @@ -1,142 +0,0 @@ -require 'erb' -require 'dsc_utils' -require 'securerandom' -require 'master_manipulator' -test_name 'MODULES-2538 - C89507 - Apply DSC Manifest for Creating a MySql Database Server' - -# Init -mysql_msi_file = 'mysql-installer.msi' -sqlserver_dl_url = 'http://int-resources.ops.puppetlabs.net/QA_resources/microsoft_sql/mysql-installer-community-5.6.17.0.msi' -sqlserver_dl_version = '5.6.17.0' -sqlserver_dl_path = "C:\\#{mysql_msi_file}" -user = 'Admin' + SecureRandom.hex(2) -user_password = 'P@ssw0rd!' -mysql_instance = ('MYSQL' + SecureRandom.hex(2)).upcase -database_name = 'DB' + SecureRandom.hex(3) - -# Teardown -teardown do - step 'Remove Test Artifacts' - confine_block(:to, :platform => 'windows') do - expect_failure('expected to fail due to xMySQL DSC module releasing breaking changes from v2.x') do - set_dsc_cred_resource( - agents, - user, - user_password, - 'xMySqlServer', - 'xMySql', - :RootPassword, - :Ensure => 'Absent', - :ServiceName => mysql_instance, - ) - end - on(agents, "rm -rf /cygdrive/c/#{mysql_msi_file}") - on(agents, "rm -rf /cygdrive/c/temp.ps1") - end -end - -pp1 = <<-MANIFEST -dsc_script{ 'download_sqlserver_msi': - dsc_getscript => 'return @{}', - dsc_testscript => "Test-Path '#{sqlserver_dl_path}'", - dsc_setscript => "(New-Object Net.WebClient).DownloadFile('#{sqlserver_dl_url}', '#{sqlserver_dl_path}')" -} --> -dsc_package {'mysql_source': - dsc_path => "#{sqlserver_dl_path}", - dsc_productid => '437AC169-780B-47A9-86F6-14D43C8F596B', - dsc_name => "MySQL Installer", - dsc_ensure => 'Present', -} --> -dsc_user {'create_admin_user_#{user}': - dsc_ensure => 'Present', - dsc_username => '#{user}', - dsc_disabled => 'false', - dsc_password => {'user' => '#{user}', 'password' => '#{user_password}'}, -} --> -dsc_group {'add_#{user}_to_admin_group': - dsc_ensure => 'Present', - dsc_groupname => 'Administrators', - dsc_memberstoinclude => ['#{user}'] -} --> -dsc_xmysqlserver {'mysql': - dsc_ensure => 'Present', - dsc_rootpassword => {'user' => '#{user}', 'password' => '#{user_password}'}, - dsc_mysqlversion => '#{sqlserver_dl_version}', -} -MANIFEST - -step 'Inject "site.pp" on Master' -site_pp = create_site_pp(master, :manifest => pp1) -inject_site_pp(master, get_site_pp_path(master), site_pp) - -step 'Run Puppet Agent to create mysql instance' -confine_block(:to, :platform => 'windows') do - agents.each do |agent| - on(agent, puppet('agent -t --environment production'), :stdin => pp1, :accept_all_exit_codes => true) do |result| - expect_failure('expected to fail due to xMySQL DSC module releasing breaking changes from v2.x') do - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - end - end -end - -pp2 = <<-MANIFEST -dsc_xmysqlserver {'mysql': - dsc_ensure => 'Present', - dsc_rootpassword => {'user' => '#{user}', 'password' => '#{user_password}'}, -} --> -dsc_xmysqldatabase {'create_database_#{database_name}': - dsc_ensure => 'Present', - dsc_name => '#{database_name}', - dsc_connectioncredential => {'user' => '#{user}', 'password' => '#{user_password}'}, -} --> -dsc_xmysqluser {'create_sqluser_#{user}': - dsc_name => '#{user}', - dsc_credential => {'user' => '#{user}', 'password' => '#{user_password}'}, - dsc_ensure => 'Present', - dsc_connectioncredential => {'user' => '#{user}', 'password' => '#{user_password}'}, -} --> -dsc_xmysqlgrant {'granting_#{user}_to_#{database_name}': - dsc_username => '#{user}', - dsc_databasename => '#{database_name}', - dsc_permissiontype => 'ALL PRIVILEGES', - dsc_ensure => 'Present', - dsc_connectioncredential => {'user' => '#{user}', 'password' => '#{user_password}'}, -} -MANIFEST - -step 'Inject "site.pp" on Master' -site_pp = create_site_pp(master, :manifest => pp2) -inject_site_pp(master, get_site_pp_path(master), site_pp) - -step 'Create mysql database' -confine_block(:to, :platform => 'windows') do - agents.each do |agent| - on(agent, puppet('agent -t --environment production'), :stdin => pp2, :accept_all_exit_codes => true) do |result| - expect_failure('expected to fail due to xMySQL DSC module releasing breaking changes from v2.x') do - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - end - end - - step 'Verify Results' - expect_failure('expected to fail due to xMySQL DSC module releasing breaking changes from v2.x') do - assert_dsc_cred_resource( - agent, - user, - user_password, - 'xMySqlDatabase', - 'xMySql', - :ConnectionCredential, - :Ensure => 'Present', - :Name => database_name, - ) - end -end diff --git a/tests/integration/tests/user_scenarios/kitchen_sink.rb b/tests/integration/tests/user_scenarios/kitchen_sink.rb deleted file mode 100755 index 754741e2..00000000 --- a/tests/integration/tests/user_scenarios/kitchen_sink.rb +++ /dev/null @@ -1,181 +0,0 @@ -require 'erb' -require 'master_manipulator' -require 'dsc_utils' -test_name 'MODULES-2400 - C89536 - Apply DSC Basic Resource Kitchen Sink Manifest' - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' -dsc_module = 'PSDesiredStateConfiguration' - -# ERB Manifest -temp_dl_path = 'C:\Windows\Temp\kitchen_sink' - -seven_zip_url = 'http://int-resources.ops.puppetlabs.net/QA_resources/7zip/7z920.exe' -seven_zip_dl_path = "#{temp_dl_path}\\7zip.exe" -seven_zip_product_name = '7-Zip 9.20' -seven_zip_install_path = 'C:\7zip' - -seven_zip_test_archive_path = 'C:\Windows\Temp\test_archive.7z' -seven_zip_exe_path = "#{seven_zip_install_path}\\7z.exe" -seven_zip_command_args = "a -t7z #{seven_zip_test_archive_path} #{temp_dl_path}\\*" - -env_var_name = 'Test' -env_var_value = 'TestValue' - -nssm_url = 'http://int-resources.ops.puppetlabs.net/QA_resources/nssm/nssm-2.24.zip' -nssm_dl_path = "#{temp_dl_path}\\nssm.zip" - -ftp_feature_name = 'Web-Ftp-Server' -ftp_service_name = 'FTPSVC' -ftp_service_startup_type = 'Disabled' -ftp_service_state = 'Stopped' - -user_name = 'TestUser' -group_name = 'TestGroup' - -registry_key = 'HKEY_LOCAL_MACHINE\SOFTWARE\TestKey' -registry_value = 'TestValueName' - -dsc_manifest_template_path = File.join(local_files_root_path, 'user_scenarios', 'kitchen_sink.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Teardown -teardown do - confine_block(:to, :platform => 'windows') do - step 'Uninstall 7-zip' - on(agents, "cmd /c \"#{seven_zip_install_path}\\Uninstall.exe /S\"") - - step 'Unset Environment Variable' - set_dsc_resource( - agents, - 'Environment', - dsc_module, - :Ensure => 'Absent', - :Name => env_var_name - ) - - step 'Remove Registry Value' - set_dsc_resource( - agents, - 'Registry', - dsc_module, - :Ensure => 'Absent', - :Key => registry_key, - :ValueName => registry_value - ) - - step 'Remove Group' - set_dsc_resource( - agents, - 'Group', - dsc_module, - :Ensure => 'Absent', - :GroupName => group_name - ) - - step 'Remove User' - set_dsc_resource( - agents, - 'User', - dsc_module, - :Ensure => 'Absent', - :UserName => user_name - ) - - step 'Remove Temporary Directory' - set_dsc_resource( - agents, - 'File', - dsc_module, - :Ensure => 'Absent', - :Type => 'Directory', - :Force => '$true', - :DestinationPath => temp_dl_path, - ) - - step 'Remove Test Archive' - set_dsc_resource( - agents, - 'File', - dsc_module, - :Ensure => 'Absent', - :Type => 'File', - :DestinationPath => seven_zip_test_archive_path, - ) - end -end - -# Setup -step 'Inject "site.pp" on Master' -site_pp = create_site_pp(master, :manifest => dsc_manifest) -inject_site_pp(master, get_site_pp_path(master), site_pp) - -# Tests -confine_block(:to, :platform => 'windows') do - agents.each do |agent| - step 'Run Puppet Agent' - on(agent, puppet('agent -t --environment production'), :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Environment Variable' - assert_dsc_resource( - agent, - 'Environment', - dsc_module, - :Ensure => 'Present', - :Name => env_var_name, - :Value => env_var_value - ) - - step 'Verify NSSM Extracted' - assert_dsc_resource( - agent, - 'File', - dsc_module, - :Ensure => 'Present', - :Type => 'Directory', - :DestinationPath => "#{temp_dl_path}\\nssm-2.24", - ) - - step 'Verify FTP Service State' - assert_dsc_resource( - agent, - 'Service', - dsc_module, - :Name => ftp_service_name, - :StartupType => ftp_service_startup_type, - :State => ftp_service_state - ) - - step 'Verify Group Membership' - assert_dsc_resource( - agent, - 'Group', - dsc_module, - :Ensure => 'Present', - :GroupName => group_name, - :Members => "@(\"#{user_name}\")" - ) - - step 'Verify Registry Value' - assert_dsc_resource( - agent, - 'Registry', - dsc_module, - :Ensure => 'Present', - :Key => registry_key, - :ValueName => registry_value - ) - - step 'Verify 7-zip Archive' - assert_dsc_resource( - agent, - 'File', - dsc_module, - :Ensure => 'Present', - :Type => 'File', - :DestinationPath => seven_zip_test_archive_path - ) - end -end diff --git a/tests/integration/tests/user_scenarios/negative/blacklist_xchrome.rb b/tests/integration/tests/user_scenarios/negative/blacklist_xchrome.rb deleted file mode 100755 index b9170e77..00000000 --- a/tests/integration/tests/user_scenarios/negative/blacklist_xchrome.rb +++ /dev/null @@ -1,35 +0,0 @@ -require 'erb' -require 'master_manipulator' -require 'dsc_utils' -test_name 'MODULES-2700 - C94733 - Attempt to Apply DSC Resource for Black Listed "xChrome" Module' - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'msft_xchrome' -dsc_props = { - :dsc_language => 'en', - :dsc_localpath => 'C:/Windows/Temp' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Verify -error_msg = /Error:.*resource.*dsc_msft_xchrome/ - -# Setup -step 'Inject "site.pp" on Master' -site_pp = create_site_pp(master, :manifest => dsc_manifest) -inject_site_pp(master, get_site_pp_path(master), site_pp) - -# Tests -confine_block(:to, :platform => 'windows') do - agents.each do |agent| - step 'Run Puppet Agent' - on(agent, puppet('agent -t --environment production'), :acceptable_exit_codes => 1) do |result| - assert_match(error_msg, result.stderr, 'Expected error was not detected!') - end - end -end diff --git a/tests/integration/tests/user_scenarios/negative/blacklist_xfirefox.rb b/tests/integration/tests/user_scenarios/negative/blacklist_xfirefox.rb deleted file mode 100755 index 25c5ea8b..00000000 --- a/tests/integration/tests/user_scenarios/negative/blacklist_xfirefox.rb +++ /dev/null @@ -1,35 +0,0 @@ -require 'erb' -require 'master_manipulator' -require 'dsc_utils' -test_name 'MODULES-2700 - C94734 - Attempt to Apply DSC Resource for Black Listed "xFireFox" Module' - -# Init -local_files_root_path = ENV['MANIFESTS'] || 'tests/manifests' - -# ERB Manifest -dsc_type = 'msft_xfirefox' -dsc_props = { - :dsc_language => 'en-US', - :dsc_localpath => 'C:/Windows/Temp' -} - -dsc_manifest_template_path = File.join(local_files_root_path, 'basic_dsc_resources', 'dsc_single_resource.pp.erb') -dsc_manifest = ERB.new(File.read(dsc_manifest_template_path), 0, '>').result(binding) - -# Verify -error_msg = /Error:.*resource.*dsc_msft_xfirefox/ - -# Setup -step 'Inject "site.pp" on Master' -site_pp = create_site_pp(master, :manifest => dsc_manifest) -inject_site_pp(master, get_site_pp_path(master), site_pp) - -# Tests -confine_block(:to, :platform => 'windows') do - agents.each do |agent| - step 'Run Puppet Agent' - on(agent, puppet('agent -t --environment production'), :acceptable_exit_codes => 1) do |result| - assert_match(error_msg, result.stderr, 'Expected error was not detected!') - end - end -end diff --git a/tests/manifests/user_scenarios/kitchen_sink.pp.erb b/tests/manifests/user_scenarios/kitchen_sink.pp.erb deleted file mode 100755 index c8447fb4..00000000 --- a/tests/manifests/user_scenarios/kitchen_sink.pp.erb +++ /dev/null @@ -1,101 +0,0 @@ -$temp_dl_path = '<%= temp_dl_path %>' - -$seven_zip_url = '<%= seven_zip_url %>' -$seven_zip_dl_path = '<%= seven_zip_dl_path %>' -$seven_zip_product_name = '<%= seven_zip_product_name %>' -$seven_zip_install_path = '<%= seven_zip_install_path %>' - -$seven_zip_test_archive_path = '<%= seven_zip_test_archive_path %>' -$seven_zip_exe_path = '<%= seven_zip_exe_path %>' -$seven_zip_command_args = '<%= seven_zip_command_args %>' - -$env_var_name = '<%= env_var_name %>' -$env_var_value = '<%= env_var_value %>' - -$nssm_url = '<%= nssm_url %>' -$nssm_dl_path = '<%= nssm_dl_path %>' - -$ftp_feature_name = '<%= ftp_feature_name %>' -$ftp_service_name = '<%= ftp_service_name %>' -$ftp_service_startup_type = '<%= ftp_service_startup_type %>' -$ftp_service_state = '<%= ftp_service_state %>' - -$user_name = '<%= user_name %>' -$group_name = '<%= group_name %>' - -$registry_key = '<%= registry_key %>' -$registry_value = '<%= registry_value %>' - -dsc_file { 'temp_dl_path': - dsc_ensure => 'Present', - dsc_type => 'Directory', - dsc_destinationpath => $temp_dl_path -} --> -dsc_script { 'download_7zip': - dsc_getscript => 'return @{ 7zip = "Installed" }', - dsc_testscript => "Test-Path \"${seven_zip_dl_path}\"", - dsc_setscript => "(New-Object Net.WebClient).DownloadFile(\"${seven_zip_url}\", \"${seven_zip_dl_path}\")" -} --> -dsc_script { 'download_nssm': - dsc_getscript => 'return @{ NSSM = "Installed" }', - dsc_testscript => "Test-Path \"${nssm_dl_path}\"", - dsc_setscript => "(New-Object Net.WebClient).DownloadFile(\"${nssm_url}\", \"${nssm_dl_path}\")" -} --> -dsc_package { 'install_7zip': - dsc_ensure => 'Present', - dsc_path => $seven_zip_dl_path, - dsc_name => $seven_zip_product_name, - dsc_productid => '', - dsc_arguments => "/S /D=${seven_zip_install_path}" -} -dsc_environment { 'add_env_var': - dsc_ensure => 'Present', - dsc_name => $env_var_name, - dsc_value => $env_var_value -} --> -dsc_archive { 'extract_nssm': - dsc_ensure => 'Present', - dsc_path => $nssm_dl_path, - dsc_destination => $temp_dl_path -} --> -dsc_windowsfeature { 'ftp_server': - dsc_ensure => 'Present', - dsc_name => $ftp_feature_name, - dsc_logpath => "$temp_dl_path/ftp_install.log" -} --> -dsc_service { 'disable_ftp_service': - dsc_name => $ftp_service_name, - dsc_startuptype => $ftp_service_startup_type, - dsc_state => $ftp_service_state -} --> -dsc_user { 'create_test_user': - dsc_ensure => 'Present', - dsc_disabled => 'false', - dsc_username => $user_name, -} --> -dsc_group { 'create_test_group': - dsc_ensure => 'Present', - dsc_groupname => $group_name, - dsc_members => [$user_name] -} --> -dsc_registry { 'create_registry_entry': - dsc_ensure => 'Present', - dsc_key => $registry_key, - dsc_valuename => $registry_value -} --> -dsc_windowsprocess { 'create_7zip_archive': - dsc_ensure => 'Present', - dsc_path => $seven_zip_exe_path, - dsc_arguments => $seven_zip_command_args, - dsc_workingdirectory => $seven_zip_install_path -} From 9ce3d745696d8c33dca9a2bfde1ec2adeb350324 Mon Sep 17 00:00:00 2001 From: Iristyle Date: Thu, 9 Nov 2017 07:31:17 -0800 Subject: [PATCH 3/3] (MODULES-5968) Remove uses_win32console fact --- lib/facter/uses_win32console.rb | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 lib/facter/uses_win32console.rb diff --git a/lib/facter/uses_win32console.rb b/lib/facter/uses_win32console.rb deleted file mode 100644 index aa8a2d7a..00000000 --- a/lib/facter/uses_win32console.rb +++ /dev/null @@ -1,8 +0,0 @@ -Facter.add(:uses_win32console) do - setcode do - if Puppet::Util::Platform.windows? - defined?(Win32::Console) && - Win32::Console.class == Class - end - end -end